Commit fd1e8cdf authored by xuke's avatar xuke

能源消耗接口样式完善

parent 2c0d9c74
...@@ -15,7 +15,6 @@ import { vFloatNumber } from "@/utils/directives.js"; ...@@ -15,7 +15,6 @@ import { vFloatNumber } from "@/utils/directives.js";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const tableData = ref([{}]); const tableData = ref([{}]);
const formEnergy = ref({ const formEnergy = ref({
<<<<<<< HEAD
"updateNullFields": "", "updateNullFields": "",
"supplyId": "", "supplyId": "",
"energyType": "", "energyType": "",
...@@ -25,18 +24,6 @@ const formEnergy = ref({ ...@@ -25,18 +24,6 @@ const formEnergy = ref({
}) })
const energyForm = ref() const energyForm = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
=======
updateNullFields: "",
supplyId: "",
energyType: "",
record: "",
recordDate: "",
energyName: "",
});
const energyForm = ref();
const dialogVisible = ref(false);
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const getEnergyData = async () => { const getEnergyData = async () => {
await http await http
.post("/api/energy/getData", config.supplyType) .post("/api/energy/getData", config.supplyType)
...@@ -49,15 +36,6 @@ const getEnergyData = async () => { ...@@ -49,15 +36,6 @@ const getEnergyData = async () => {
}); });
ElMessage.success("获取数据成功"); ElMessage.success("获取数据成功");
}; };
<<<<<<< HEAD
=======
//获取换热机组列表
// const getSupplys =() => {
// const res = http.get("api/home/GetOrg",false)
// console.log(res.data);
// }
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const tableLabel = reactive([ const tableLabel = reactive([
{ {
...@@ -93,10 +71,6 @@ const formInline = reactive({ ...@@ -93,10 +71,6 @@ const formInline = reactive({
const config = reactive({ const config = reactive({
supplyType: ["0", "1", "2", "3", "4"], supplyType: ["0", "1", "2", "3", "4"],
}); });
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const handleSearch = () => { const handleSearch = () => {
config.supplyType = formInline.keyWord; config.supplyType = formInline.keyWord;
...@@ -114,13 +88,8 @@ const timeFormat = (time) => { ...@@ -114,13 +88,8 @@ const timeFormat = (time) => {
function add(m) { function add(m) {
return m < 10 ? "0" + m : m; return m < 10 ? "0" + m : m;
} }
<<<<<<< HEAD
return year + '/' + add(month) + '/' + add(date) + ' 0:00:00' return year + '/' + add(month) + '/' + add(date) + ' 0:00:00'
} }
=======
return year + "/" + add(month) + "/" + add(date) + " 0:00:00";
};
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
//表单校验规则 //表单校验规则
const rules = reactive({ const rules = reactive({
...@@ -131,33 +100,6 @@ const rules = reactive({ ...@@ -131,33 +100,6 @@ const rules = reactive({
record: [{ required: true, message: "能源用度是必选项", trigger: "change" }], record: [{ required: true, message: "能源用度是必选项", trigger: "change" }],
recordDate: [{ required: true, message: "日期是必选项" }], recordDate: [{ required: true, message: "日期是必选项" }],
}); });
<<<<<<< HEAD
=======
// const handleChange = (page) => {
// config.page = page,
// getEnergyData()
// }
// 删除
// const handleDelete = async (row) => {
// // console.log(row.energyId);
// console.log('"' + row.energyId + '"');
// await ElMessageBox.confirm("你确定要删除吗?", {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// confirmButtonClass: 'ExitConfirmButton'
// }).then(async () => {
// // await postEnergyDel('"'+row.energyId+'"')
// await postEnergyDel({ EnergyId: row.energyId })
// ElMessage({
// type: 'success', message: '删除成功'
// })
// getEnergyData()
// })
// }
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
// 删除 // 删除
const handleDelete = async (row) => { const handleDelete = async (row) => {
...@@ -165,25 +107,12 @@ const handleDelete = async (row) => { ...@@ -165,25 +107,12 @@ const handleDelete = async (row) => {
console.log('"' + row.energyId + '"'); console.log('"' + row.energyId + '"');
let EnergyId = row.energyId; let EnergyId = row.energyId;
await ElMessageBox.confirm("你确定要删除吗?", { await ElMessageBox.confirm("你确定要删除吗?", {
<<<<<<< HEAD
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
confirmButtonClass: 'ExitConfirmButton' confirmButtonClass: 'ExitConfirmButton'
}) })
const res = await http.post("api/energy/Delete", { id: row.energyId }, false) const res = await http.post("api/energy/Delete", { id: row.energyId }, false)
=======
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
confirmButtonClass: "ExitConfirmButton",
});
const res = await http.get(
"api/energy/Delete",
{ params: { EnergyId: row.energyId } },
false
);
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
if (res.success) { if (res.success) {
ElMessage.success("删除成功"); ElMessage.success("删除成功");
getEnergyData(); getEnergyData();
...@@ -193,7 +122,6 @@ const handleDelete = async (row) => { ...@@ -193,7 +122,6 @@ const handleDelete = async (row) => {
}; };
// 新增 // 新增
<<<<<<< HEAD
const action = ref('add') const action = ref('add')
const handleClose = () => { const handleClose = () => {
dialogVisible.value = false dialogVisible.value = false
...@@ -210,26 +138,6 @@ const handleAdd = () => { ...@@ -210,26 +138,6 @@ const handleAdd = () => {
formEnergy.supplyType = '', formEnergy.supplyType = '',
formEnergy.energyType = '' formEnergy.energyType = ''
} }
=======
const action = ref("add");
const handleClose = () => {
dialogVisible.value = false;
proxy.$ref["energyForm"].resetFields();
};
const handleCancel = (formEl) => {
dialogVisible.value = false;
if (!formEl) return;
formEl.resetFields();
};
const handleAdd = () => {
action.value = "add"
dialogVisible.value = true;
formEnergy.supplyType = "";
formEnergy.energyType = "";
};
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const handleEdit = (val) => { const handleEdit = (val) => {
action.value = "edit"; action.value = "edit";
...@@ -237,14 +145,6 @@ const handleEdit = (val) => { ...@@ -237,14 +145,6 @@ const handleEdit = (val) => {
nextTick(() => { nextTick(() => {
Object.assign(formEnergy.value, { ...val }); Object.assign(formEnergy.value, { ...val });
console.log("val:", val); console.log("val:", val);
<<<<<<< HEAD
=======
// var newArr = []
// formEnergy.supplyId.map((item)=> {
// newArr.push(item[item.length-1])
// })
// console.log(newArr);
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
}); });
}; };
...@@ -258,11 +158,7 @@ const onSubmit = (formEl) => { ...@@ -258,11 +158,7 @@ const onSubmit = (formEl) => {
if (action.value === "add") { if (action.value === "add") {
await http await http
.post("api/energy/Save", { ...formEnergy.value }, false) .post("api/energy/Save", { ...formEnergy.value }, false)
<<<<<<< HEAD
.then((res) => { }) .then((res) => { })
=======
.then((res) => {})
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
.then((res) => { .then((res) => {
ElMessage({ ElMessage({
type: "success", type: "success",
...@@ -329,12 +225,7 @@ const getSupplys = () => { ...@@ -329,12 +225,7 @@ const getSupplys = () => {
let c = []; let c = [];
center.supplyList.forEach((supply) => { center.supplyList.forEach((supply) => {
let chi = []; let chi = [];
<<<<<<< HEAD
supply.transferList.forEach(unit => { supply.transferList.forEach(unit => {
=======
supply.transferList.forEach((unit) => {
// chi.push({ value: unit.unitId, label: unit.unitName });
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
}); });
c.push({ c.push({
children: chi, children: chi,
...@@ -356,7 +247,6 @@ const getSupplys = () => { ...@@ -356,7 +247,6 @@ const getSupplys = () => {
} }
}); });
} }
<<<<<<< HEAD
} }
onMounted(() => { onMounted(() => {
getEnergyData() getEnergyData()
...@@ -406,115 +296,12 @@ onMounted(() => { ...@@ -406,115 +296,12 @@ onMounted(() => {
stripe> stripe>
<el-table-column v-for="item in tableLabel" :key="item.prop" :width="item.width ? item.width : 150" <el-table-column v-for="item in tableLabel" :key="item.prop" :width="item.width ? item.width : 150"
:prop="item.prop" :label="item.label" /> :prop="item.prop" :label="item.label" />
=======
};
onMounted(() => {
getEnergyData();
getSupplys();
});
</script>
<template>
<table
class="table_search"
cellpadding="0"
cellspacing="1"
style="background-color: #99bbe8; width: 100%"
>
<tr style="height: 10px">
<th width="30%">
<span>能源类型:</span>
</th>
<th style="background-color: #ffffff">
<div class="th_div">
<el-form
ref="formRef"
:model="formInline"
:inline="true"
style="
display: flex;
justify-content: center;
align-items: center;
margin: 0;
"
>
<el-form-item
class="select-clean"
prop="supplyType"
label-width="280px"
style="margin: 0"
>
<el-select
v-model="formInline.keyWord"
placeholder="请选择"
style="width: 360px; margin-left: 20px"
>
<el-option label="非节能" value="0" />
<el-option label="一步节能" value="1" />
<el-option label="二步节能" value="2" />
<el-option label="三步节能" value="3" />
<el-option label="四步节能" value="4" />
</el-select>
</el-form-item>
</el-form>
</div>
</th>
<th width="100%" style="background-color: #ffffff; text-align: left">
<el-button type="primary" @click="handleSearch">
<Search style="width: 1em; height: 1em; margin-right: 8px" />
查询
</el-button>
<el-button type="primary" @click="handleAdd">
<Document style="width: 1em; height: 1em; margin-right: 8px" />
新增
</el-button>
</th>
</tr>
</table>
<div class="table">
<el-table
:data="tableData"
style="width: 100%; font-size: 12px; color: #181818"
:header-cell-style="{
color: '#225475',
backgroundColor: '#B8CFEE',
'text-align': 'center',
height: '30px',
padding: '0px',
border: '1px solid #99bbe8',
}"
:cell-style="{ 'text-align': 'center', padding: '0px' }"
:row-style="{ height: '30px', padding: '0px' }"
border
stripe
>
<el-table-column
v-for="item in tableLabel"
:key="item.prop"
:width="item.width ? item.width : 150"
:prop="item.prop"
:label="item.label"
/>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<el-table-column fixed="right" label="操作" min-width="140"> <el-table-column fixed="right" label="操作" min-width="140">
<template #default="scope"> <template #default="scope">
<el-button <el-button link type="primary" size="small" @click="handleEdit(scope.row)">
link
type="primary"
size="small"
@click="handleEdit(scope.row)"
>
编辑 编辑
</el-button> </el-button>
<el-button <el-button link type="primary" size="small" @click="handleDelete(scope.row)">删除</el-button>
link
type="primary"
size="small"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
<template #empty> <template #empty>
...@@ -522,25 +309,8 @@ onMounted(() => { ...@@ -522,25 +309,8 @@ onMounted(() => {
</template> </template>
</el-table> </el-table>
</div> </div>
<<<<<<< HEAD
<el-dialog v-model="dialogVisible" :title="action == 'add' ? '数据新增' : '数据修改'" width="50%" :before-close="handleClose"> <el-dialog v-model="dialogVisible" :title="action == 'add' ? '数据新增' : '数据修改'" width="50%" :before-close="handleClose">
<el-form :inline="true" :model="formEnergy" :rules="rules" ref="energyForm" :hide-required-asterisk="true"> <el-form :inline="true" :model="formEnergy" :rules="rules" ref="energyForm" :hide-required-asterisk="true">
=======
<el-dialog
v-model="dialogVisible"
:title="action == 'add' ? '数据新增' : '数据修改'"
width="50%"
:before-close="handleClose"
>
<el-form
:inline="true"
:model="formEnergy"
:rules="rules"
ref="energyForm"
:hide-required-asterisk="true"
>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<table cellpadding="0" cellspacing="1" style="background-color: #99bbe8"> <table cellpadding="0" cellspacing="1" style="background-color: #99bbe8">
<tr> <tr>
<th style="width: 25%">供热站</th> <th style="width: 25%">供热站</th>
...@@ -552,26 +322,9 @@ onMounted(() => { ...@@ -552,26 +322,9 @@ onMounted(() => {
<el-option label="东部供热站" value="DFA20074-8731-457F-B63F-4E1858CFE266" /> <el-option label="东部供热站" value="DFA20074-8731-457F-B63F-4E1858CFE266" />
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select> --> </el-select> -->
<<<<<<< HEAD
<el-form-item prop="supplyName" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="supplyName" style="margin: 0; padding: 0; width: 100%">
<el-cascader :options="options" v-model="formEnergy.supplyId" :props="props" collapse-tags clearable <el-cascader :options="options" v-model="formEnergy.supplyId" :props="props" collapse-tags clearable
:show-all-levels="false" placeholder="请选择" class="el-cascader-menu" /> :show-all-levels="false" placeholder="请选择" class="el-cascader-menu" />
=======
<el-form-item
prop="supplyName"
style="margin: 0; padding: 0; width: 100%"
>
<el-cascader
:options="options"
v-model="formEnergy.supplyId"
:props="props"
collapse-tags
clearable
:show-all-levels="false"
placeholder="请选择"
class="el-cascader-menu"
/>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -584,19 +337,8 @@ onMounted(() => { ...@@ -584,19 +337,8 @@ onMounted(() => {
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<<<<<<< HEAD
<el-form-item prop="energyType" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="energyType" style="margin: 0; padding: 0; width: 100%">
<el-select v-model="formEnergy.energyType" placeholder="请选择"> <el-select v-model="formEnergy.energyType" placeholder="请选择">
=======
<el-form-item
prop="energyType"
style="margin: 0; padding: 0; width: 100%"
>
<el-select
v-model="formEnergy.energyType"
placeholder="请选择"
>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<el-option label="非节能" :value="0" /> <el-option label="非节能" :value="0" />
<el-option label="一步节能" :value="1" /> <el-option label="一步节能" :value="1" />
<el-option label="二步节能" :value="2" /> <el-option label="二步节能" :value="2" />
...@@ -609,63 +351,29 @@ onMounted(() => { ...@@ -609,63 +351,29 @@ onMounted(() => {
</table> </table>
</td> </td>
</tr> </tr>
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<tr> <tr>
<th style="width: 25%">能源用度</th> <th style="width: 25%">能源用度</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<<<<<<< HEAD
<el-form-item prop="record" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="record" style="margin: 0; padding: 0; width: 100%">
<el-input v-float-number v-model="formEnergy.record" placeholder="请输入能源用度" /> <el-input v-float-number v-model="formEnergy.record" placeholder="请输入能源用度" />
=======
<el-form-item
prop="record"
style="margin: 0; padding: 0; width: 100%"
>
<el-input
v-float-number
v-model="formEnergy.record"
placeholder="请输入能源用度"
/>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<tr> <tr>
<th style="width: 25%">日期</th> <th style="width: 25%">日期</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td> <td>
<<<<<<< HEAD
<el-form-item prop="recordDate" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="recordDate" style="margin: 0; padding: 0; width: 100%">
<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="formEnergy.recordDate" type="datetime" <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="formEnergy.recordDate" type="datetime"
placeholder="请输入日期" style="width: 100%" /> placeholder="请输入日期" style="width: 100%" />
=======
<el-form-item
prop="recordDate"
style="margin: 0; padding: 0; width: 100%"
>
<el-date-picker
value-format="YYYY-MM-DD HH:mm:ss"
v-model="formEnergy.recordDate"
type="datetime"
placeholder="请输入日期"
style="width: 100%"
/>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -674,13 +382,7 @@ onMounted(() => { ...@@ -674,13 +382,7 @@ onMounted(() => {
</tr> </tr>
</table> </table>
<div class="dialog-footer"> <div class="dialog-footer">
<<<<<<< HEAD
<el-button type="primary" @click="handleCancel(energyForm)">关闭</el-button> <el-button type="primary" @click="handleCancel(energyForm)">关闭</el-button>
=======
<el-button type="primary" @click="handleCancel(energyForm)"
>关闭</el-button
>
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<el-button type="primary" @click="onSubmit(energyForm)">保存</el-button> <el-button type="primary" @click="onSubmit(energyForm)">保存</el-button>
</div> </div>
</el-form> </el-form>
...@@ -704,11 +406,7 @@ onMounted(() => { ...@@ -704,11 +406,7 @@ onMounted(() => {
} }
<<<<<<< HEAD
table { table {
=======
.table_search {
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
width: 100%; width: 100%;
} }
...@@ -757,47 +455,17 @@ table td { ...@@ -757,47 +455,17 @@ table td {
} }
//鼠标所在行的颜色 //鼠标所在行的颜色
<<<<<<< HEAD
::v-deep .el-table__body tr:hover>td { ::v-deep .el-table__body tr:hover>td {
background: linear-gradient(to top, background: linear-gradient(to top,
rgb(0, 198, 255), rgb(0, 198, 255),
rgb(255, 255, 255)) !important; rgb(255, 255, 255)) !important;
=======
::v-deep .el-table__body tr:hover > td {
background: linear-gradient(
to top,
rgb(0, 198, 255),
rgb(255, 255, 255)
) !important;
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
} }
::v-deep .el-table__body tr.current-row > td { ::v-deep .el-table__body tr.current-row>td {
background-color: #92cbf1 !important; background-color: #92cbf1 !important;
} }
.el-cascader-menu { .el-cascader-menu {
width: 100%; width: 100%;
} }
<<<<<<< HEAD
=======
// .bottom {
// // border: 1px solid red;
// margin-top: 10px;
// width: 100%;
// display: flex;
// right: 10px;
// bottom: 30px;
// justify-content: space-between;
// .bottom-left {
// display: flex;
// }
// .pager {
// display: flex;
// }
// }
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment