Commit 2a2ea4b3 authored by xuke's avatar xuke

能源消耗接口样式完善

parent 71843e84
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="getdata" style="min-width: 70px;">查询</el-button> <el-button type="primary" @click="getdata" style="min-width: 70px;">查询</el-button>
<el-button type="primary" @click="paramsSetting" style="min-width: 70px;">报警参数设置</el-button> <el-button type="primary" @click="open" style="min-width: 70px;">报警参数设置</el-button>
</el-form-item> </el-form-item>
</div> </div>
</el-card> </el-card>
...@@ -64,6 +64,25 @@ ...@@ -64,6 +64,25 @@
<el-dialog v-model="show" class="dialog" :show-scrollbar="true"> <el-dialog v-model="show" class="dialog" :show-scrollbar="true">
<div class="div-header">
<el-form :inline="true">
<el-form-item label="查询类型:">
<el-select v-model="type" placeholder="请选择" style="width: 150px" @change="getoptions">
<el-option label="换热机组" value="GetTransAlarmStatusData" />
<el-option label="锅炉" value="GetBoilerAlarmStatusData" />
<el-option label="总管" value="GetPipeAlarmStatusData" />
</el-select>
</el-form-item>
<el-form-item label="设备:">
<el-cascader :options="options" v-model="dept" :props="prop" collapse-tags clearable :show-all-levels="false"
placeholder="请选择" style="min-width: 210px;" @change="getopt" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="paramsSetting" style="min-width: 70px;">确定</el-button>
</el-form-item>
</el-form>
</div>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<div class="left"> <div class="left">
...@@ -87,7 +106,7 @@ ...@@ -87,7 +106,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%" v-model="cnNames_before.cnName"></el-input> <el-input style="width: 80%" v-model="param.cnName"></el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -99,7 +118,7 @@ ...@@ -99,7 +118,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-checkbox></el-checkbox> <el-checkbox v-model="addParams.isVoice"></el-checkbox>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -111,7 +130,7 @@ ...@@ -111,7 +130,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%"></el-input> <el-input style="width: 80%" v-model="addParams.topMost"></el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -123,7 +142,7 @@ ...@@ -123,7 +142,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%"></el-input> <el-input style="width: 80%" v-model="addParams.upper"></el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -136,7 +155,7 @@ ...@@ -136,7 +155,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%"></el-input> <el-input style="width: 80%" v-model="addParams.downMost"></el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -150,7 +169,7 @@ ...@@ -150,7 +169,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%" type="textarea" rows="6"></el-input> <el-input style="width: 80%" type="textarea" rows="6" v-model="addParams.alarmPlan"></el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -162,7 +181,7 @@ ...@@ -162,7 +181,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-checkbox></el-checkbox> <el-checkbox v-model="addParams.isAlarm"></el-checkbox>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -174,7 +193,7 @@ ...@@ -174,7 +193,7 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-checkbox></el-checkbox> <el-checkbox v-model="addParams.isShortMessage"></el-checkbox>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -183,9 +202,15 @@ ...@@ -183,9 +202,15 @@
</table> </table>
<div class="btngrounp"> <div class="btngrounp">
<el-button v-if="button" type="primary" @click="onDel">添加</el-button> <div v-if="button">
<el-button v-else-if="button" type="primary" @click="onDel">删除</el-button> <el-button :disabled="param.cnName === '' ? true : false" type="primary" @click="onAdd">添加</el-button>
<el-button v-else="button" type="primary" @click="onDel">修改</el-button> <el-button disabled type="primary" @click="onDel">删除</el-button>
</div>
<div v-else="button">
<el-button type="primary" @click="onEdit">修改</el-button>
<el-button type="primary" @click="onDel">删除</el-button>
</div>
</div> </div>
<!-- </el-card> --> <!-- </el-card> -->
</div> </div>
...@@ -216,6 +241,9 @@ ...@@ -216,6 +241,9 @@
import { ref, reactive, onMounted, onUnmounted } from 'vue'; import { ref, reactive, onMounted, onUnmounted } from 'vue';
import http from '../../api/http'; import http from '../../api/http';
import store from "../../store/index"; import store from "../../store/index";
import { ElMessage } from 'element-plus';
import { watch } from 'fs';
import { watchEffect } from 'vue';
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -232,22 +260,14 @@ const type = ref('GetTransAlarmStatusData'); ...@@ -232,22 +260,14 @@ const type = ref('GetTransAlarmStatusData');
const show = ref(false) const show = ref(false)
const refreshItem = ref(0) const refreshItem = ref(0)
const AlarmInfo = ref([]) const AlarmInfo = ref([])
const dept = ref('')
// getCnNames()
// console.log("type.value:",type.value);
// console.log("AlarmInfo.value:",AlarmInfo.value);
// console.log(type.value);
function open() {
function paramsSetting() {
show.value = true show.value = true
getCnNames()
} }
function onsubmit() { function onsubmit() {
...@@ -267,6 +287,7 @@ function getEnterprise() { ...@@ -267,6 +287,7 @@ function getEnterprise() {
} }
} }
const props = { multiple: true, emitPath: false } const props = { multiple: true, emitPath: false }
const prop = { multiple: true, emitPath: false, checkStrictly: true, multiple: false }
function setContentHeight() { function setContentHeight() {
tableHeight.value = window.innerHeight - 195; tableHeight.value = window.innerHeight - 195;
...@@ -330,7 +351,6 @@ function getoptions() { ...@@ -330,7 +351,6 @@ function getoptions() {
getSupplys(); getSupplys();
} }
gettransfer(); gettransfer();
getCnNames()
} }
//获取锅炉列表 //获取锅炉列表
...@@ -390,10 +410,10 @@ function getPipes() { ...@@ -390,10 +410,10 @@ function getPipes() {
} }
}); });
} }
options.forEach(element => { // options.forEach(element => {
AlarmInfo.push(element.value); // AlarmInfo.push(element.value);
}) // })
console.log(AlarmInfo.value); // console.log(AlarmInfo.value);
} }
//获取换热机组列表 //获取换热机组列表
...@@ -479,31 +499,41 @@ function getImgUrl(scope, item) { ...@@ -479,31 +499,41 @@ function getImgUrl(scope, item) {
return url; return url;
} }
console.log("AlarmInfo.value:::", AlarmInfo.value);
// 报警参数设置 // 报警参数设置
let cnNames_before = reactive([{ let cnNames_before = ref([])
cnName: "" let cnNames_after = ref([])
}]) console.log("---------------------AlarmInfo.value:", AlarmInfo.value);
let cnNames_after = reactive([{ let newType = ref(0)
cnName: "" watchEffect(() => {
}]) console.log("监听::::", type.value);
const getCnNames = () => { if (type.value === "GetPipeAlarmStatusData") {
let newType = newType.value = 1
type.value == "GetPipeAlarmStatusData" ? 1 : type.value == "GetBoilerAlarmStatusData" ? 2 : 3 } else if (type.value === "GetBoilerAlarmStatusData") {
let newAlarmInfo = AlarmInfo.value[0]; newType.value = 2
let data = http.post("api/alarm/para/GetAlarmPara", { type: newType, id: newAlarmInfo }, false) } else {
// console.log("data:", data); newType.value = 3
}
})
// 接口2:换热站基础参数编号(transParaBaseId) -> 接口1:baseId
const getCnNames = () => {
// console.log('dept-------------------', dept.value);
// console.log("++++++++++++++++++++++++", newType.value);
let data = http.post("api/alarm/para/GetAlarmPara", { type: newType.value, id: dept.value }, false);
data.then(function (val) { data.then(function (val) {
cnNames_before = val.data.before cnNames_before.value = val.data.before
cnNames_after = val.data.after cnNames_after.value = val.data.after
// console.log("@@@@", cnNames_before); // console.log("cnNames_before@@@@", cnNames_before);
// console.log("@@@@",cnNames_after); // console.log("cnNames_after@@@@", cnNames_after);
// console.log("cnNames_before.transParaBaseId:", cnNames_before.transParaBaseId) // console.log("cnNames_before.transParaBaseId:", cnNames_before.transParaBaseId)
}); });
} }
let params = reactive([{
let params = ref({
"pipeAlarmParaId": "", "pipeAlarmParaId": "",
"pipeParaBaseId": "", "pipeParaBaseId": "",
"pipeId": "", "pipeId": "",
...@@ -518,30 +548,78 @@ let params = reactive([{ ...@@ -518,30 +548,78 @@ let params = reactive([{
"isShortMessage": "", "isShortMessage": "",
"isAlarm": "", "isAlarm": "",
"isActive": "", "isActive": "",
"updateNullFields": "" "updateNullFields": "",
}]) })
let addParams = ref({
"updateNullFields": "",
"pipeParaBaseId": "",
"pipeId": dept.value,
"gatherType": "",
"voicePath": "",
"isVoice": "",
"topMost": "",
"upper": "",
"lower": "",
"downMost": "",
"alarmPlan": "",
"isShortMessage": "",
"isAlarm": "",
"isActive": ""
})
let param = ref({
"cnName": "",
"transParaBaseId": ""
})
// 点击确定查询数据
const paramsSetting = () => {
getCnNames()
}
const selectParams = (row) => {
param.value.transParaBaseId = row.transParaBaseId
console.log("param.value.transParaBaseId========", param.value.transParaBaseId);
if (param.value.transParaBaseId) {
const data = http.post("/api/alarm/para/GetAlarmParaInfo", { type: newType.value, id: dept.value, baseid: param.value.transParaBaseId }, false)
console.log("dataaaaa:", data);
data.then(function (val) {
console.log("valllll:", val);
params.value = val.data
console.log("!!!!!Params.value:", params.value);
param.value.cnName = row.cnName
});
} else {
ElMessage.info("该参数暂不需要修改...")
}
}
getCnNames() watchEffect(() => {
addParams.value.pipeId = dept.value
console.log(addParams.value.pipeId);
const selectParams = (row) => { })
getCnNames()
let newType =
type.value == "GetPipeAlarmStatusData" ? 1 : type.value == "GetBoilerAlarmStatusData" ? 2 : 3
let newAlarmInfo = AlarmInfo.value[0];
const data = http.post("/api/alarm/para/GetAlarmParaInfo", { type: newType, id: newAlarmInfo, baseid: row.transParaBaseId }, false)
// console.log(data);
data.then(function (val) {
params = val.data
console.log("Params:", params);
});
const onAdd = () => {
// const data = http.post("api/alarm/para/pipesave", { ...addParams.value }, false)
// console.log("新增data:::", data);
// if (data.success) {
// ElMessage.success("修改成功!!")
// } else {
// ElMessage.error("修改失败!!")
// }
http.post("api/alarm/para/pipesave", { ...addParams.value }, false).then((res) => {
if (res.success) {
ElMessage.success("修改成功!!")
getCnNames()
} else {
ElMessage.error("修改失败!!")
}
})
} }
// 按钮 // 按钮
const button = ref(false) const button = ref(true)
onMounted(() => { onMounted(() => {
......
<script setup> <script setup>
import { ref, onMounted, getCurrentInstance, reactive, nextTick } from 'vue' import { ref, onMounted, getCurrentInstance, reactive, nextTick } from "vue";
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from "element-plus";
import axios from 'axios' import axios from "axios";
import { Search, Document } from "@element-plus/icons-vue" import { Search, Document } from "@element-plus/icons-vue";
import { postEnergyManage, postEnergyDel, postEnergyUpdate } from "@/api/scheduling" import {
import http from '../../api/http' postEnergyManage,
import loading from 'element-plus' postEnergyDel,
import store from '../../store' postEnergyUpdate,
} from "@/api/scheduling";
import http from "../../api/http";
import loading from "element-plus";
import store from "../../store";
import { vFloatNumber } from "@/utils/directives.js"; import { vFloatNumber } from "@/utils/directives.js";
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance();
const tableData = ref([{}]) const tableData = ref([{}]);
const formEnergy = ref({ const formEnergy = ref({
"updateNullFields": "", "updateNullFields": "",
"supplyId": "", "supplyId": "",
...@@ -20,138 +24,107 @@ const formEnergy = ref({ ...@@ -20,138 +24,107 @@ const formEnergy = ref({
}) })
const energyForm = ref() const energyForm = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const getEnergyData = async () => { const getEnergyData = async () => {
await http.post("/api/energy/getData", config.supplyType).then(res => { await http
// console.log("res:", res); .post("/api/energy/getData", config.supplyType)
tableData.value = res.data .then((res) => {
}).catch(err => { // console.log("res:", res);
console.log(error) tableData.value = res.data;
}) })
ElMessage.success('获取数据成功') .catch((err) => {
} console.log(error);
});
//获取换热机组列表 ElMessage.success("获取数据成功");
// const getSupplys =() => { };
// const res = http.get("api/home/GetOrg",false)
// console.log(res.data);
// }
const tableLabel = reactive([ const tableLabel = reactive([
{ {
prop: 'allowPagingId', prop: "allowPagingId",
label: "序号", label: "序号",
width: 100 width: 100,
}, },
{ {
prop: 'supplyName', prop: "supplyName",
label: '名称', label: "名称",
width: 200 width: 200,
}, },
{ {
prop: 'energyType', prop: "energyType",
label: "能源类型" label: "能源类型",
}, },
{ {
prop: 'record', prop: "record",
label: "用度", label: "用度",
width: 200 width: 200,
}, },
{ {
prop: 'recordDate', prop: "recordDate",
label: "日期", label: "日期",
width: 300 width: 300,
} },
]) ]);
const formInline = reactive({ const formInline = reactive({
keyWord: '' keyWord: "",
}) });
const config = reactive({ const config = reactive({
supplyType: ["0", "1", "2", "3", "4"], supplyType: ["0", "1", "2", "3", "4"],
}) });
const handleSearch = () => { const handleSearch = () => {
config.supplyType = formInline.keyWord config.supplyType = formInline.keyWord;
config.supplyType = [`${config.supplyType}`] config.supplyType = [`${config.supplyType}`];
getEnergyData(), getEnergyData(),
formEnergy.value.energyType = '', (formEnergy.value.energyType = ""),
ElMessage.success('获取数据成功') ElMessage.success("获取数据成功");
} };
const timeFormat = (time) => { const timeFormat = (time) => {
var time = new Date(time) var time = new Date(time);
var year = time.getFullYear() var year = time.getFullYear();
var month = time.getMonth() var month = time.getMonth();
var date = time.getDate() var date = time.getDate();
function add(m) { function add(m) {
return m < 10 ? '0' + m : m return m < 10 ? "0" + m : m;
} }
return year + '/' + add(month) + '/' + add(date) + ' 0:00:00' return year + '/' + add(month) + '/' + add(date) + ' 0:00:00'
} }
//表单校验规则 //表单校验规则
const rules = reactive({ const rules = reactive({
supplyId: [{ required: true, message: "名称是必填项", trigger: "blur" }], supplyId: [{ required: true, message: "名称是必填项", trigger: "blur" }],
energyType: [ energyType: [
{ required: true, message: "能源类型是必填项", trigger: "blur" }, { required: true, message: "能源类型是必填项", trigger: "blur" },
], ],
record: [{ required: true, message: "能源用度是必选项", trigger: "change" }], record: [{ required: true, message: "能源用度是必选项", trigger: "change" }],
recordDate: [{ required: true, message: "日期是必选项" }] recordDate: [{ required: true, message: "日期是必选项" }],
}) });
// 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()
// })
// }
// 删除 // 删除
const handleDelete = async (row) => { const handleDelete = async (row) => {
console.log(row.energyId); console.log(row.energyId);
console.log('"' + row.energyId + '"'); console.log('"' + row.energyId + '"');
let EnergyId = row.energyId let EnergyId = row.energyId;
await ElMessageBox.confirm("你确定要删除吗?", { await ElMessageBox.confirm("你确定要删除吗?", {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
confirmButtonClass: 'ExitConfirmButton' confirmButtonClass: 'ExitConfirmButton'
}) })
const res = await http.get("api/energy/Delete", { params: { EnergyId: row.energyId } }, false) const res = await http.post("api/energy/Delete", { id: row.energyId }, false)
if (res.success) { if (res.success) {
ElMessage.success("删除成功") ElMessage.success("删除成功");
getEnergyData() getEnergyData();
} else { } else {
ElMessage.error("删除失败") ElMessage.error("删除失败");
} }
} };
// 新增 // 新增
const action = ref('add') const action = ref('add')
const handleClose = () => { const handleClose = () => {
dialogVisible.value = false dialogVisible.value = false
proxy.$ref['energyForm'].resetFields() proxy.$ref['energyForm'].resetFields()
...@@ -159,7 +132,6 @@ const handleClose = () => { ...@@ -159,7 +132,6 @@ const handleClose = () => {
const handleCancel = () => { const handleCancel = () => {
dialogVisible.value = false dialogVisible.value = false
proxy.$ref['energyForm'].resetFields() proxy.$ref['energyForm'].resetFields()
} }
const handleAdd = () => { const handleAdd = () => {
action.value = "add", action.value = "add",
...@@ -167,63 +139,62 @@ const handleAdd = () => { ...@@ -167,63 +139,62 @@ const handleAdd = () => {
proxy.$refs['energyForm'].resetFields() proxy.$refs['energyForm'].resetFields()
formEnergy.supplyType = '', formEnergy.supplyType = '',
formEnergy.energyType = '' formEnergy.energyType = ''
} }
const handleEdit = (val) => { const handleEdit = (val) => {
action.value = "edit" action.value = "edit";
dialogVisible.value = true dialogVisible.value = true;
nextTick(() => { nextTick(() => {
Object.assign(formEnergy.value, { ...val }) Object.assign(formEnergy.value, { ...val });
console.log("val:", val); console.log("val:", val);
// var newArr = [] });
// formEnergy.supplyId.map((item)=> { };
// newArr.push(item[item.length-1])
// })
// console.log(newArr);
})
} const onSubmit = (formEl) => {
const onSubmit = () => {
energyForm.value.validate(async (valid) => { energyForm.value.validate(async (valid) => {
if (valid) { if (valid) {
let res = null; let res = null;
formEnergy.recordDate = /^\d{4}-\d{2}-\d{2}$/.test(formEnergy.recordDate) ? formEnergy.recordDate : timeFormat(formEnergy.recordDate) formEnergy.recordDate = /^\d{4}-\d{2}-\d{2}$/.test(formEnergy.recordDate)
if (action.value === 'add') { ? formEnergy.recordDate
await http.post("api/energy/Save", { ...formEnergy.value }, false).then(res => { : timeFormat(formEnergy.recordDate);
}).then(res => { if (action.value === "add") {
ElMessage({ await http
type: 'success', message: '新增成功' .post("api/energy/Save", { ...formEnergy.value }, false)
}) .then((res) => { })
getEnergyData() .then((res) => {
}) ElMessage({
type: "success",
message: "新增成功",
});
getEnergyData();
});
if (res) { if (res) {
dialogVisible.value = false dialogVisible.value = false;
getEnergyData() getEnergyData();
if (!formEl) return;
formEl.resetFields();
} }
} else { } else {
res = postEnergyUpdate(formEnergy.value) res = postEnergyUpdate(formEnergy.value);
proxy.$refs['energyForm'].resetFields() if (!formEl) return;
dialogVisible.value = false formEl.resetFields();
formEnergy.value.supplyId = '' dialogVisible.value = false;
formEnergy.energyType = '' formEnergy.value.supplyId = "";
getEnergyData() formEnergy.energyType = "";
getEnergyData();
} }
} else { } else {
ElMessage({ ElMessage({
showClose: true, showClose: true,
message: '请输入正确的内容', message: "请输入正确的内容",
type: 'error' type: "error",
}) });
} }
}) });
} };
const props = { multiple: false, emitPath: false, checkStrictly: true } const props = { multiple: false, emitPath: false, checkStrictly: true };
const enterpriseId = ref(); const enterpriseId = ref();
let supplyIdOptions = reactive([]) let supplyIdOptions = reactive([]);
getEnterprise(); getEnterprise();
function getEnterprise() { function getEnterprise() {
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
...@@ -232,13 +203,13 @@ function getEnterprise() { ...@@ -232,13 +203,13 @@ function getEnterprise() {
} }
} }
const PatrolInfo = reactive({ const PatrolInfo = reactive({
"Id": [], Id: [],
"startTime": "", startTime: "",
"endTime": "", endTime: "",
"start": 0, start: 0,
"count": 30, count: 30,
"sort": "" sort: "",
}) });
const options = reactive([]); const options = reactive([]);
const getSupplys = () => { const getSupplys = () => {
loading.value = true; loading.value = true;
...@@ -246,83 +217,83 @@ const getSupplys = () => { ...@@ -246,83 +217,83 @@ const getSupplys = () => {
PatrolInfo.Id.length = 0; PatrolInfo.Id.length = 0;
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
if (result) { if (result) {
result.forEach(element => { result.forEach((element) => {
if (element.enterpriseId === enterpriseId.value) { if (element.enterpriseId === enterpriseId.value) {
if (element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()) { if (
element.serviceCenterList.forEach(center => { element.enterpriseId ===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()
) {
element.serviceCenterList.forEach((center) => {
let c = []; let c = [];
center.supplyList.forEach(supply => { center.supplyList.forEach((supply) => {
let chi = []; let chi = [];
supply.transferList.forEach(unit => { supply.transferList.forEach(unit => {
// chi.push({ value: unit.unitId, label: unit.unitName });
}); });
c.push({ children: chi, label: supply.supplyName, value: supply.supplyId }); c.push({
children: chi,
label: supply.supplyName,
value: supply.supplyId,
});
}); });
options.push({ children: c, label: center.serviceCenterName }); options.push({ children: c, label: center.serviceCenterName });
}) });
} else { } else {
element.supplyList.forEach(element => { element.supplyList.forEach((element) => {
let chi = []; let chi = [];
element.transferList.forEach(unit => { element.transferList.forEach((unit) => {
chi.push({ value: unit.unitId, label: unit.unitName }); chi.push({ value: unit.unitId, label: unit.unitName });
}) });
options.push({ children: chi, label: element.supplyName }); options.push({ children: chi, label: element.supplyName });
}) });
} }
} }
}); });
} }
} }
onMounted(() => { onMounted(() => {
getEnergyData() getEnergyData()
getSupplys() getSupplys()
}) })
</script> </script>
<template> <template>
<table class="table_search" cellpadding="0" cellspacing="1" style="background-color: #99bbe8;width: 100%;"> <div class="contentBlock">
<tr style="height: 10px;"> <table cellpadding="0" cellspacing="1" style="background-color: #99bbe8;width: 100%;">
<th width="30%"> <tr style="height: 10px;">
<span>能源类型:</span> <th width="30%">
</th> <span>能源类型:</span>
<th style=" background-color: #ffffff;"> </th>
<div class="th_div"> <th width="40%" style=" background-color: #ffffff;">
<el-form ref="formRef" :model="formInline" :inline="true" <div class="th_div">
style="display: flex; justify-content: center; align-items: center; margin: 0;"> <el-form ref="formRef" :model="formInline" :inline="true"
<el-form-item class="select-clean" prop="supplyType" label-width="280px" style="margin: 0;"> style="display: flex; justify-content: center; align-items: center; margin: 0;">
<el-select v-model="formInline.keyWord" placeholder="请选择" style="width:360px; margin-left: 20px;"> <el-form-item class="select-clean" prop="supplyType" label-width="280px" style="margin: 0;">
<el-option label="非节能" value="0" /> <el-select v-model="formInline.keyWord" placeholder="请选择" style="width:360px; margin-left: 20px;">
<el-option label="一步节能" value="1" /> <el-option label="非节能" value="0" />
<el-option label="二步节能" value="2" /> <el-option label="一步节能" value="1" />
<el-option label="三步节能" value="3" /> <el-option label="二步节能" value="2" />
<el-option label="四步节能" value="4" /> <el-option label="三步节能" value="3" />
</el-select> <el-option label="四步节能" value="4" />
</el-form-item> </el-select>
</el-form> </el-form-item>
</div> </el-form>
</div>
</th> </th>
<th width="100%" style="background-color: #ffffff;text-align: left;"> <th width="100%" style="background-color: #ffffff;text-align: center;">
<el-button type="primary" @click="handleSearch"> <el-button type="primary" @click="handleSearch">
<Search style="width: 1em; height: 1em; margin-right: 8px" /> <Search style="width: 1em; height: 1em; margin-right: 8px" />
查询 查询
</el-button> </el-button>
<el-button type="primary" @click="handleAdd"> <el-button type="primary" @click="handleAdd">
<Document style="width: 1em; height: 1em; margin-right: 8px" /> <Document style="width: 1em; height: 1em; margin-right: 8px" />
新增 新增
</el-button> </el-button>
</th> </th>
</tr> </tr>
</table> </table>
<div class="table">
<el-table :data="tableData" style="width: 100%;font-size: 12px;color: #181818;" <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' }" :header-cell-style="{ color: '#225475', backgroundColor: '#B8CFEE', 'text-align': 'center', height: '40px', padding: '0px', border: '1px solid #99bbe8' }"
:cell-style="{ 'text-align': 'center', padding: '0px' }" :row-style="{ height: '30px', padding: '0px' }" border :cell-style="{ 'text-align': 'center', padding: '0px' }" :row-style="{ height: '30px', padding: '0px' }" border
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"
...@@ -339,22 +310,13 @@ onMounted(() => { ...@@ -339,22 +310,13 @@ onMounted(() => {
<el-empty description="暂无数据,快去添加数据吧.."></el-empty> <el-empty description="暂无数据,快去添加数据吧.."></el-empty>
</template> </template>
</el-table> </el-table>
<!-- <div class="bottom">
<div class="bottom-left" style="color: #4B4847; font-size: 12px;">
共{{ config.total }}条记录,当前为第{{ config.page }}页,共{{ parseInt(config.total / 10 + 0.9) }}页
</div>
<el-pagination background layout="prev, pager, next" next-text="下一页" class="pager" :total="total"
size="small" @current-change="handleChange" />
</div> -->
</div> </div>
<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">
<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>
<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">
...@@ -362,7 +324,7 @@ onMounted(() => { ...@@ -362,7 +324,7 @@ 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> -->
<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> </el-form-item>
...@@ -371,20 +333,19 @@ onMounted(() => { ...@@ -371,20 +333,19 @@ onMounted(() => {
</table> </table>
</td> </td>
</tr> </tr>
<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">
<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-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" />
<el-option label="三步节能" value="3" /> <el-option label="三步节能" :value="3" />
<el-option label="四步节能" value="4" /> <el-option label="四步节能" :value="4" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</td> </td>
...@@ -392,15 +353,13 @@ onMounted(() => { ...@@ -392,15 +353,13 @@ onMounted(() => {
</table> </table>
</td> </td>
</tr> </tr>
<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">
<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> </el-form-item>
</td> </td>
...@@ -408,15 +367,13 @@ onMounted(() => { ...@@ -408,15 +367,13 @@ onMounted(() => {
</table> </table>
</td> </td>
</tr> </tr>
<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>
<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> </el-form-item>
...@@ -425,40 +382,34 @@ onMounted(() => { ...@@ -425,40 +382,34 @@ onMounted(() => {
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="handleCancel">关闭</el-button> <el-button type="primary" @click="handleCancel(energyForm)">关闭</el-button>
<el-button type="primary" @click="onSubmit">保存</el-button> <el-button type="primary" @click="onSubmit(energyForm)">保存</el-button>
</div> </div>
</el-form> </el-form>
</el-dialog> </el-dialog>
</template> </template>
<style scoped lang="less"> <style scoped lang="less">
.energy-header { .contentBlock {
display: flex; position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ffffff;
overflow: auto;
overflow-x: hidden;
} }
.select-clean { .select-clean {
display: flex; display: flex;
} }
.table {
margin-top: 10px;
margin-left: 4px;
}
.table_search { table {
width: 100%; width: 100%;
margin-left: 4px;
} }
table, table,
...@@ -486,15 +437,30 @@ table td { ...@@ -486,15 +437,30 @@ table td {
padding: 5px 10px; padding: 5px 10px;
} }
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
margin-top: 10px; margin-top: 10px;
background-color: #ffffff; background-color: #ffffff;
} }
.el-table__header th {
height: 50px;
/* 调整表头的高度 */
line-height: 50px;
/* 使文本垂直居中 */
}
.el-table__header th .cell {
font-size: 14px;
/* 调整字体大小 */
}
//鼠标所在行的颜色 //鼠标所在行的颜色
::v-deep .el-table__body tr:hover>td { ::v-deep .el-table__body tr:hover>td {
background: linear-gradient(to top, rgb(0, 198, 255), rgb(255, 255, 255)) !important; background: linear-gradient(to top,
rgb(0, 198, 255),
rgb(255, 255, 255)) !important;
} }
::v-deep .el-table__body tr.current-row>td { ::v-deep .el-table__body tr.current-row>td {
...@@ -504,22 +470,4 @@ table td { ...@@ -504,22 +470,4 @@ table td {
.el-cascader-menu { .el-cascader-menu {
width: 100%; width: 100%;
} }
</style>
// .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;
// }
// }</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