Commit fd1e8cdf authored by xuke's avatar xuke

能源消耗接口样式完善

parent 2c0d9c74
......@@ -15,7 +15,6 @@ import { vFloatNumber } from "@/utils/directives.js";
const { proxy } = getCurrentInstance();
const tableData = ref([{}]);
const formEnergy = ref({
<<<<<<< HEAD
"updateNullFields": "",
"supplyId": "",
"energyType": "",
......@@ -25,18 +24,6 @@ const formEnergy = ref({
})
const energyForm = ref()
const dialogVisible = ref(false)
=======
updateNullFields: "",
supplyId: "",
energyType: "",
record: "",
recordDate: "",
energyName: "",
});
const energyForm = ref();
const dialogVisible = ref(false);
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const getEnergyData = async () => {
await http
.post("/api/energy/getData", config.supplyType)
......@@ -49,15 +36,6 @@ const getEnergyData = async () => {
});
ElMessage.success("获取数据成功");
};
<<<<<<< HEAD
=======
//获取换热机组列表
// const getSupplys =() => {
// const res = http.get("api/home/GetOrg",false)
// console.log(res.data);
// }
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const tableLabel = reactive([
{
......@@ -93,10 +71,6 @@ const formInline = reactive({
const config = reactive({
supplyType: ["0", "1", "2", "3", "4"],
});
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
const handleSearch = () => {
config.supplyType = formInline.keyWord;
......@@ -114,13 +88,8 @@ const timeFormat = (time) => {
function add(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";
};
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
//表单校验规则
const rules = reactive({
......@@ -131,33 +100,6 @@ const rules = reactive({
record: [{ required: true, message: "能源用度是必选项", trigger: "change" }],
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) => {
......@@ -165,25 +107,12 @@ const handleDelete = async (row) => {
console.log('"' + row.energyId + '"');
let EnergyId = row.energyId;
await ElMessageBox.confirm("你确定要删除吗?", {
<<<<<<< HEAD
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'ExitConfirmButton'
})
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) {
ElMessage.success("删除成功");
getEnergyData();
......@@ -193,7 +122,6 @@ const handleDelete = async (row) => {
};
// 新增
<<<<<<< HEAD
const action = ref('add')
const handleClose = () => {
dialogVisible.value = false
......@@ -210,26 +138,6 @@ const handleAdd = () => {
formEnergy.supplyType = '',
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) => {
action.value = "edit";
......@@ -237,14 +145,6 @@ const handleEdit = (val) => {
nextTick(() => {
Object.assign(formEnergy.value, { ...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) => {
if (action.value === "add") {
await http
.post("api/energy/Save", { ...formEnergy.value }, false)
<<<<<<< HEAD
.then((res) => { })
=======
.then((res) => {})
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
.then((res) => {
ElMessage({
type: "success",
......@@ -329,12 +225,7 @@ const getSupplys = () => {
let c = [];
center.supplyList.forEach((supply) => {
let chi = [];
<<<<<<< HEAD
supply.transferList.forEach(unit => {
=======
supply.transferList.forEach((unit) => {
// chi.push({ value: unit.unitId, label: unit.unitName });
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
});
c.push({
children: chi,
......@@ -356,7 +247,6 @@ const getSupplys = () => {
}
});
}
<<<<<<< HEAD
}
onMounted(() => {
getEnergyData()
......@@ -406,115 +296,12 @@ onMounted(() => {
stripe>
<el-table-column v-for="item in tableLabel" :key="item.prop" :width="item.width ? item.width : 150"
: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">
<template #default="scope">
<el-button
link
type="primary"
size="small"
@click="handleEdit(scope.row)"
>
<el-button link type="primary" size="small" @click="handleEdit(scope.row)">
编辑
</el-button>
<el-button
link
type="primary"
size="small"
@click="handleDelete(scope.row)"
>删除</el-button
>
<el-button link type="primary" size="small" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
<template #empty>
......@@ -522,25 +309,8 @@ onMounted(() => {
</template>
</el-table>
</div>
<<<<<<< HEAD
<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-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">
<tr>
<th style="width: 25%">供热站</th>
......@@ -552,26 +322,9 @@ onMounted(() => {
<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-select> -->
<<<<<<< HEAD
<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" />
=======
<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>
</td>
</tr>
......@@ -584,19 +337,8 @@ onMounted(() => {
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<<<<<<< HEAD
<el-form-item prop="energyType" style="margin: 0; padding: 0; width: 100%">
<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="1" />
<el-option label="二步节能" :value="2" />
......@@ -609,63 +351,29 @@ onMounted(() => {
</table>
</td>
</tr>
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<tr>
<th style="width: 25%">能源用度</th>
<td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<<<<<<< HEAD
<el-form-item prop="record" style="margin: 0; padding: 0; width: 100%">
<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>
</td>
</tr>
</table>
</td>
</tr>
<<<<<<< HEAD
=======
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
<tr>
<th style="width: 25%">日期</th>
<td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<<<<<<< HEAD
<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%" />
=======
<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>
</td>
</tr>
......@@ -674,13 +382,7 @@ onMounted(() => {
</tr>
</table>
<div class="dialog-footer">
<<<<<<< HEAD
<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>
</div>
</el-form>
......@@ -704,11 +406,7 @@ onMounted(() => {
}
<<<<<<< HEAD
table {
=======
.table_search {
>>>>>>> 76205dae5936b8059d9c2fcb1cfab676ad1879fa
width: 100%;
}
......@@ -757,47 +455,17 @@ table td {
}
//鼠标所在行的颜色
<<<<<<< HEAD
::v-deep .el-table__body tr:hover>td {
background: linear-gradient(to top,
rgb(0, 198, 255),
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;
}
.el-cascader-menu {
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>
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