From 75f043dfa6660716364e66ee0b3cf99f44255686 Mon Sep 17 00:00:00 2001 From: DYL0109 <dn18191638832@163.com> Date: 星期三, 16 四月 2025 19:20:36 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop1.0' into dyl_dev --- zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue | 381 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 218 insertions(+), 163 deletions(-) diff --git a/zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue b/zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue index 5eef2db..2ce4615 100644 --- a/zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue +++ b/zhitan-vue/src/views/modelconfiguration/setpeakvalley/setPeakValley.vue @@ -6,52 +6,70 @@ <el-input v-model="queryParams.remark" placeholder="璇疯緭鍏ュ娉�" /> </el-form-item> <el-form-item> - <el-button type="primary" icon="Search" @click="handleQuery"> - 鎼滅储 - </el-button> + <el-button type="primary" icon="Search" @click="handleQuery"> 鎼滅储 </el-button> <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + <el-form-item style="float: right"> + <el-button type="primary" icon="Plus" @click="handleAdd"> 鏃舵閰嶇疆 </el-button> </el-form-item> </el-form> </div> - <div class="table-box"> - <div class="mt20 mb20"> - <el-button type="primary" icon="Plus" @click="handleAdd"> - 鏃舵閰嶇疆 - </el-button> + <div class="table-bg-style"> + <div class="table-box"> + <el-table v-loading="loading" :data="productoutputList" style="width: 100%" row-key="id"> + <el-table-column + label="鐢熸晥寮�濮嬫棩鏈�" + align="center" + key="beginDate" + prop="beginDate" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鐢熸晥缁撴潫鏃ユ湡" + align="center" + key="endDate" + prop="endDate" + :show-overflow-tooltip="true" + /> + <el-table-column label="澶囨敞" align="center" key="remark" prop="remark" :show-overflow-tooltip="true" /> + <el-table-column + label="鍒涘缓鏃堕棿" + align="center" + key="createTime" + prop="createTime" + :show-overflow-tooltip="true" + /> + <el-table-column label="鎿嶄綔" align="center" width="300" class-name="small-padding fixed-width"> + <template #default="scope"> + <el-tooltip content="鐢典环閰嶇疆" placement="top"> + <el-button link type="primary" icon="Plus" @click="handleExpandChange(scope.row)"> 鐢典环閰嶇疆 </el-button> + </el-tooltip> + <el-tooltip content="缂栬緫" placement="top"> + <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"> 缂栬緫 </el-button> + </el-tooltip> + <el-tooltip content="鍒犻櫎" placement="top"> + <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"> 鍒犻櫎 </el-button> + </el-tooltip> + </template> + </el-table-column> + </el-table> </div> - <el-table v-loading="loading" :data="productoutputList" style="width: 100%" row-key="id"> - <el-table-column label="鐢熸晥寮�濮嬫棩鏈�" align="center" key="beginDate" prop="beginDate" :show-overflow-tooltip="true" /> - <el-table-column label="鐢熸晥缁撴潫鏃ユ湡" align="center" key="endDate" prop="endDate" :show-overflow-tooltip="true" /> - <el-table-column label="澶囨敞" align="center" key="remark" prop="remark" :show-overflow-tooltip="true" /> - <el-table-column label="鍒涘缓鏃堕棿" align="center" key="createTime" prop="createTime" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔" align="center" width="300" class-name="small-padding fixed-width"> - <template #default="scope"> - <el-tooltip content="鐢典环閰嶇疆" placement="top"> - <el-button link type="primary" icon="Plus" @click="handleExpandChange(scope.row)"> - 鐢典环閰嶇疆 - </el-button> - </el-tooltip> - <el-tooltip content="缂栬緫" placement="top"> - <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"> - 缂栬緫 - </el-button> - </el-tooltip> - <el-tooltip content="鍒犻櫎" placement="top"> - <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"> - 鍒犻櫎 - </el-button> - </el-tooltip> - </template> - </el-table-column> - </el-table> </div> <el-dialog :title="title" v-model="open" width="600px" append-to-body> <el-form :model="form" :rules="rules" ref="formRef" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="鐢熸晥鏃ユ湡" prop="beginEndDate"> - <el-date-picker v-model="form.beginEndDate" type="daterange" range-separator="鍒�" format="YYYY-MM-DD" - value-format="YYYY-MM-DD" start-placeholder="鐢熸晥寮�濮嬫棩鏈�" end-placeholder="鐢熸晥缁撴潫鏃ユ湡" style="width: 100%" /> + <el-date-picker + v-model="form.beginEndDate" + type="daterange" + range-separator="鍒�" + format="YYYY-MM-DD" + value-format="YYYY-MM-DD" + start-placeholder="鐢熸晥寮�濮嬫棩鏈�" + end-placeholder="鐢熸晥缁撴潫鏃ユ湡" + style="width: 100%" + /> </el-form-item> </el-col> <el-col :span="24"> @@ -79,45 +97,89 @@ </el-row> <el-row v-for="(item, index) in formChild.data" :key="item.id"> <el-col :span="4"> - <el-form-item label="绫诲埆鍚嶇О" :prop="'data.' + index + '.type'" :rules="{ - required: true, - message: '绫诲埆鍚嶇О涓嶈兘涓虹┖', - trigger: ['change'], - }"> + <el-form-item + label="绫诲埆鍚嶇О" + :prop="'data.' + index + '.type'" + :rules="{ + required: true, + message: '绫诲埆鍚嶇О涓嶈兘涓虹┖', + trigger: ['change'], + }" + > <el-select v-model="item.type" placeholder="绫诲埆鍚嶇О" clearable style="width: 100%"> - <el-option v-for="dict in electricity_price" :key="dict.value" :label="dict.label" - :value="dict.value" /> + <el-option + v-for="dict in electricity_price" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> </el-select> </el-form-item> </el-col> <el-col :span="4"> - <el-form-item label="鏃舵鐢典环" :prop="'data.' + index + '.effecticityPrice'" :rules="{ - required: true, - message: '鏃舵鐢典环涓嶈兘涓虹┖', - trigger: ['blur', 'change'], - }"> - <el-input-number v-model="item.effecticityPrice" :min="0.0" :precision="2" :step="0.1" - placeholder="鏃舵鐢典环" style="width: 100%" controls-position="right" /> + <el-form-item + label="鏃舵鐢典环" + :prop="'data.' + index + '.effecticityPrice'" + :rules="{ + required: true, + message: '鏃舵鐢典环涓嶈兘涓虹┖', + trigger: ['blur', 'change'], + }" + > + <el-input-number + v-model="item.effecticityPrice" + :min="0.0" + :precision="2" + :step="0.1" + placeholder="鏃舵鐢典环" + style="width: 100%" + controls-position="right" + /> </el-form-item> </el-col> <el-col :span="4"> - <el-form-item label="寮�濮嬫椂闂�" :prop="'data.' + index + '.startTime'" :rules="{ - required: true, - message: '寮�濮嬫椂闂翠笉鑳戒负绌�', - trigger: ['blur', 'change'], - }"> - <el-time-select v-model="item.startTime" placeholder="寮�濮嬫椂闂�" :max-time="item.stopTime" start="00:00:00" - step="00:30:00" end="24:00:00" style="width: 100%" format="HH:mm:00" /> + <el-form-item + label="寮�濮嬫椂闂�" + :prop="'data.' + index + '.startTime'" + :rules="{ + required: true, + message: '寮�濮嬫椂闂翠笉鑳戒负绌�', + trigger: ['blur', 'change'], + }" + > + <el-time-select + v-model="item.startTime" + placeholder="寮�濮嬫椂闂�" + :max-time="item.stopTime" + start="00:00:00" + step="00:30:00" + end="24:00:00" + style="width: 100%" + format="HH:mm:00" + /> </el-form-item> </el-col> <el-col :span="4"> - <el-form-item label="缁撴潫鏃堕棿" :prop="'data.' + index + '.stopTime'" :rules="{ - required: true, - message: '缁撴潫鏃堕棿涓嶈兘涓虹┖', - trigger: ['blur', 'change'], - }"> - <el-time-select v-model="item.stopTime" placeholder="缁撴潫鏃堕棿" :min-time="item.startTime" start="00:00:00" - step="00:30:00" end="24:00:00" style="width: 100%" format="HH:mm:00" :disabled="item.startTime==null" /> + <el-form-item + label="缁撴潫鏃堕棿" + :prop="'data.' + index + '.stopTime'" + :rules="{ + required: true, + message: '缁撴潫鏃堕棿涓嶈兘涓虹┖', + trigger: ['blur', 'change'], + }" + > + <el-time-select + v-model="item.stopTime" + placeholder="缁撴潫鏃堕棿" + :min-time="item.startTime" + start="00:00:00" + step="00:30:00" + end="24:00:00" + style="width: 100%" + format="HH:mm:00" + :disabled="item.startTime == null" + /> </el-form-item> </el-col> <el-col :span="4"> @@ -127,11 +189,14 @@ </el-col> <el-col :span="4"> <el-form-item> - <el-button link type="primary" icon="Plus" @click="handleAddChildChild"> - 鏂板 - </el-button> - <el-button link type="primary" icon="Delete" @click="handleDeleteChildChild(item, index)" - v-if="formChild.data.length > 1"> + <el-button link type="primary" icon="Plus" @click="handleAddChildChild"> 鏂板 </el-button> + <el-button + link + type="primary" + icon="Delete" + @click="handleDeleteChildChild(item, index)" + v-if="formChild.data.length > 1" + > 鍒犻櫎 </el-button> </el-form-item> @@ -157,18 +222,18 @@ delPeakValleyConfiguration, listPeakValleyConfigurationChild, updatePeakValleyConfigurationChild, -} from "@/api/modelConfiguration/setPeakValley"; -import { nanoid } from "nanoid"; -const { proxy } = getCurrentInstance(); -const { electricity_price } = proxy.useDict("electricity_price"); -const productoutputList = ref([]); -const open = ref(false); -const loading = ref(false); -const showSearch = ref(true); -const title = ref(""); -const loadingChild = ref(true); -const openChild = ref(false); -const titleChild = ref(""); +} from "@/api/modelConfiguration/setPeakValley" +import { nanoid } from "nanoid" +const { proxy } = getCurrentInstance() +const { electricity_price } = proxy.useDict("electricity_price") +const productoutputList = ref([]) +const open = ref(false) +const loading = ref(false) +const showSearch = ref(true) +const title = ref("") +const loadingChild = ref(true) +const openChild = ref(false) +const titleChild = ref("") const data = reactive({ form: {}, queryParams: { @@ -195,82 +260,80 @@ }, ], }, -}); +}) -const { queryParams, form, rules, formChild } = toRefs(data); -getList(); +const { queryParams, form, rules, formChild } = toRefs(data) +getList() // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鍒楄〃 function getList() { - loading.value = true; - listPeakValleyConfiguration(proxy.addDateRange(queryParams.value)).then( - (res) => { - loading.value = false; - productoutputList.value = res.rows; - queryParams.value.total = res.total; - } - ); + loading.value = true + listPeakValleyConfiguration(proxy.addDateRange(queryParams.value)).then((res) => { + loading.value = false + productoutputList.value = res.rows + queryParams.value.total = res.total + }) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鎼滅储 function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-閲嶇疆 function resetQuery() { - proxy.resetForm("queryRef"); - (queryParams.value = { + proxy.resetForm("queryRef") + ;(queryParams.value = { pageNum: 1, pageSize: 10, timeType: "YEAR", dataTime: null, total: 0, }), - handleQuery(); + handleQuery() } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏂板 function handleAdd() { - reset(); - open.value = true; - title.value = "鏂板灏栧嘲骞宠胺鏃舵閰嶇疆"; + reset() + open.value = true + title.value = "鏂板灏栧嘲骞宠胺鏃舵閰嶇疆" } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-缂栬緫 function handleUpdate(row) { - reset(); + reset() getPeakValleyConfiguration(row.id).then((response) => { - form.value = response.data; - form.value.beginEndDate = [response.data.beginDate, response.data.endDate]; - open.value = true; - title.value = "缂栬緫灏栧嘲骞宠胺鏃舵閰嶇疆"; - }); + form.value = response.data + form.value.beginEndDate = [response.data.beginDate, response.data.endDate] + open.value = true + title.value = "缂栬緫灏栧嘲骞宠胺鏃舵閰嶇疆" + }) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏂板/缂栬緫-淇濆瓨 function submitForm() { proxy.$refs["formRef"].validate((valid) => { if (valid) { - form.value.beginDate = form.value.beginEndDate[0]; - form.value.endDate = form.value.beginEndDate[1]; - delete form.value.beginEndDate; + form.value.beginDate = form.value.beginEndDate[0] + form.value.endDate = form.value.beginEndDate[1] + delete form.value.beginEndDate if (form.value.id != undefined) { updatePeakValleyConfiguration(form.value).then((response) => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addPeakValleyConfiguration(form.value).then((response) => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏂板/缂栬緫-鍙栨秷 function cancel() { - open.value = false; - proxy.$refs.formRef.resetFields(); - reset(); + open.value = false + proxy.$refs.formRef.resetFields() + reset() } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏂板/缂栬緫-琛ㄥ崟閲嶇疆 function reset() { @@ -278,88 +341,80 @@ beginDate: null, endDate: null, remark: null, - }; + } } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鍒犻櫎 function handleDelete(row) { proxy.$modal - .confirm( - '鏄惁纭鍒犻櫎鐢熸晥鏃ユ湡涓�"' + - row.beginDate + - "鍒�" + - row.endDate + - '"鐨勬暟鎹」锛�' - ) + .confirm('鏄惁纭鍒犻櫎鐢熸晥鏃ユ湡涓�"' + row.beginDate + "鍒�" + row.endDate + '"鐨勬暟鎹」锛�') .then(function () { - return delPeakValleyConfiguration(row.id); + return delPeakValleyConfiguration(row.id) }) .then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") }) - .catch(() => { }); + .catch(() => {}) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏃舵鐢典环閰嶇疆-鏂板 function handleExpandChange(row) { - formChild.value.parentId = row.id; - formChild.value.beginEndDate = [row.beginDate, row.endDate]; - formChild.value.beginDate = row.beginDate; - formChild.value.endDate = row.endDate; + formChild.value.parentId = row.id + formChild.value.beginEndDate = [row.beginDate, row.endDate] + formChild.value.beginDate = row.beginDate + formChild.value.endDate = row.endDate listPeakValleyConfigurationChild( proxy.addDateRange({ parentId: row.id, }) ).then((res) => { - loadingChild.value = false; + loadingChild.value = false formChild.value.data = res.rows.length > 0 ? res.rows : [ - { - parentId: row.id, - type: null, - startTime: null, - stopTime: null, - effecticityPrice: 0.0, - }, - ]; - }); - openChild.value = true; - titleChild.value = "灏栧嘲骞宠胺鏃舵鐢典环閰嶇疆"; + { + parentId: row.id, + type: null, + startTime: null, + stopTime: null, + effecticityPrice: 0.0, + }, + ] + }) + openChild.value = true + titleChild.value = "灏栧嘲骞宠胺鏃舵鐢典环閰嶇疆" } function handleAddChildChild() { - console.log(formChild.value); + console.log(formChild.value) formChild.value.data.push({ parentId: formChild.value.parentId, type: null, startTime: null, stopTime: null, effecticityPrice: 0.0, - }); - openChild.value = true; - titleChild.value = "灏栧嘲骞宠胺鏃舵鐢典环閰嶇疆"; + }) + openChild.value = true + titleChild.value = "灏栧嘲骞宠胺鏃舵鐢典环閰嶇疆" } function handleDeleteChildChild(item, index) { - formChild.value.data.splice(index, 1); + formChild.value.data.splice(index, 1) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏃舵鐢典环閰嶇疆-鏂板/缂栬緫-淇濆瓨 function submitFormChild() { proxy.$refs["formChildRef"].validate((valid) => { if (valid) { - updatePeakValleyConfigurationChild(formChild.value.data).then( - (response) => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - openChild.value = false; - getList(); - } - ); + updatePeakValleyConfigurationChild(formChild.value.data).then((response) => { + proxy.$modal.msgSuccess("淇敼鎴愬姛") + openChild.value = false + getList() + }) } - }); + }) } // 妯″瀷閰嶇疆绠$悊-灏栧嘲骞宠胺閰嶇疆-鏂板/缂栬緫-鍙栨秷 function cancelChild() { - openChild.value = false; - proxy.$refs.formChildRef.resetFields(); + openChild.value = false + proxy.$refs.formChildRef.resetFields() } </script> <style scoped lang="scss"> -- Gitblit v1.9.3