From 1e00770dddc0bdf350f6121256d885879f550629 Mon Sep 17 00:00:00 2001
From: Zhu Zhonghua <zhonghua@qq.com>
Date: 星期五, 25 四月 2025 20:46:32 +0800
Subject: [PATCH] Merge branch 'dev' of http://192.168.50.149:8085/r/aps-kj-web into dev
---
src/views/mainPlan/gasPlanning/index.vue | 300 +++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 225 insertions(+), 75 deletions(-)
diff --git a/src/views/mainPlan/gasPlanning/index.vue b/src/views/mainPlan/gasPlanning/index.vue
index a84817d..2bb0a90 100644
--- a/src/views/mainPlan/gasPlanning/index.vue
+++ b/src/views/mainPlan/gasPlanning/index.vue
@@ -51,11 +51,11 @@
</HxlhTable> -->
<vxe-table
border
- ref="xTable"
+ ref="tableRef"
show-overflow
:loading="loading"
:height="height"
- :edit-config="{ mode: 'row', trigger: 'click', showStatus: true }"
+ :edit-config="{ trigger: 'manual', mode: 'row', showStatus: true }"
:data="routePlanList"
@cell-click="cellClickEvent"
>
@@ -66,10 +66,13 @@
field="dayProduceType"
title="鏃ヤ骇鍑虹被鍨�"
min-width="160"
- :edit-render="{ }"
+ :edit-render="{}"
>
<template #edit="{ row }">
- <vxe-select v-model="row.dayProduceType" :options="dayProduceTypeOptions"></vxe-select>
+ <vxe-select
+ v-model="row.dayProduceType"
+ :options="dayProduceTypeOptions"
+ ></vxe-select>
</template>
<template #default="{ row }">
<span>{{ formatTypeLabel([row.dayProduceType]) }}</span>
@@ -82,10 +85,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.dayProduceNum"
- size="mini"
- />
+ <el-input-number v-model="row.dayProduceNum" size="mini" />
</template>
</vxe-column>
<vxe-column
@@ -105,9 +105,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.personnelNumber"
- />
+ <el-input-number v-model="row.personnelNumber" />
</template>
</vxe-column>
<vxe-column
@@ -117,10 +115,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.dayProduceAllNum"
- disabled
- />
+ <el-input-number v-model="row.dayProduceAllNum" disabled />
</template>
</vxe-column>
<vxe-column
@@ -140,7 +135,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number v-model="row.monthProduceAllNum" disabled/>
+ <el-input-number v-model="row.monthProduceAllNum" disabled />
</template>
</vxe-column>
<vxe-column
@@ -152,6 +147,22 @@
<template #edit="{ row }">
<el-input type="textarea" v-model="row.remark" />
</template>
+ </vxe-column>
+ <vxe-column title="鎿嶄綔" width="200" fixed="right">
+ <!-- <template #default="{ row }">
+ <vxe-button @click="handleSave(row)" :loading="row.loading"
+ >淇濆瓨</vxe-button
+ > -->
+ <template #default="{ row }">
+ <template v-if="hasEditStatus(row)">
+ <el-button @click="saveRowEvent(row)" size="small">淇濆瓨</el-button>
+ <el-button @click="cancelRowEvent()" size="small">鍙栨秷</el-button>
+ </template>
+ <template v-else>
+ <el-button @click="editRowEvent(row)" size="small">缂栬緫</el-button>
+ </template>
+ </template>
+ <!-- </template> -->
</vxe-column>
</vxe-table>
</div>
@@ -167,11 +178,11 @@
:height="height"
>
</HxlhTable> -->
- <vxe-table
+ <vxe-table
border
- ref="xTable"
+ ref="tableRef1"
show-overflow
- :loading="loading"
+ :loading="loading2"
:height="height"
:edit-config="{ mode: 'row', trigger: 'click', showStatus: true }"
:data="gasPlanList"
@@ -184,10 +195,13 @@
field="dayProduceType"
title="鏃ヤ骇鍑虹被鍨�"
min-width="160"
- :edit-render="{ }"
+ :edit-render="{}"
>
<template #edit="{ row }">
- <vxe-select v-model="row.dayProduceType" :options="dayProduceTypeOptions"></vxe-select>
+ <vxe-select
+ v-model="row.dayProduceType"
+ :options="dayProduceTypeOptions"
+ ></vxe-select>
</template>
<template #default="{ row }">
<span>{{ formatTypeLabel([row.dayProduceType]) }}</span>
@@ -200,10 +214,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.dayProduceNum"
- size="mini"
- />
+ <el-input-number v-model="row.dayProduceNum" size="mini" />
</template>
</vxe-column>
<vxe-column
@@ -223,9 +234,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.personnelNumber"
- />
+ <el-input-number v-model="row.personnelNumber" />
</template>
</vxe-column>
<vxe-column
@@ -235,9 +244,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number
- v-model="row.dayProduceAllNum"
- />
+ <el-input-number v-model="row.dayProduceAllNum" />
</template>
</vxe-column>
<vxe-column
@@ -247,7 +254,7 @@
:edit-render="{ autoFocus: 'input' }"
>
<template #edit="{ row }">
- <el-input-number v-model="row.days" />
+ <el-input-number v-model="row.days" />
</template>
</vxe-column>
<vxe-column
@@ -270,10 +277,26 @@
<el-input type="textarea" v-model="row.remark" />
</template>
</vxe-column>
+ <vxe-column title="鎿嶄綔" width="200" fixed="right">
+ <!-- <template #default="{ row }">
+ <el-button @click="handleSave(row)" :loading="row.loading"
+ >淇濆瓨</el-button
+ > -->
+ <template #default="{ row }">
+ <template v-if="hasEditStatus1(row)">
+ <el-button @click="saveRowEvent1(row)" size="small">淇濆瓨</el-button>
+ <el-button @click="cancelRowEvent1()" size="small">鍙栨秷</el-button>
+ </template>
+ <template v-else>
+ <el-button @click="editRowEvent1(row)" size="small">缂栬緫</el-button>
+ </template>
+ </template>
+ <!-- </template> -->
+ </vxe-column>
</vxe-table>
- <div class="btn_center">
- <el-button type="primary" @click="handleSave">淇濆瓨</el-button>
- </div>
+ <!-- <div class="btn_center">
+ <el-button type="primary" @click="handleSave2">淇濆瓨</el-button>
+ </div> -->
</div>
</div>
</div>
@@ -286,11 +309,14 @@
import { listGasPlan, getGasPlanSave } from "@/api/mainPlan/gasPlanning";
const height = ref(document.documentElement.clientHeight - 400 + "px;");
const loading = ref(false);
+const loading2 = ref(false);
const data = reactive({
queryParams: {
date: "",
},
});
+const tableRef = ref()
+const tableRef1 = ref()
const { queryParams } = toRefs(data);
const gasPlanList = ref([]);
const routePlanList = ref([]);
@@ -300,13 +326,17 @@
]);
const formatTypeLabel = (list) => {
if (list) {
- return list.map(type => {
- const item = dayProduceTypeOptions.value.find(item => item.value === type)
- return item ? item.label : type
- }).join(',')
+ return list
+ .map((type) => {
+ const item = dayProduceTypeOptions.value.find(
+ (item) => item.value === type
+ );
+ return item ? item.label : type;
+ })
+ .join(",");
}
- return ''
-}
+ return "";
+};
// 琛ㄦ牸閰嶇疆
// const columns = ref([
// // {
@@ -378,6 +408,68 @@
// type: "html",
// },
// ]);
+const hasEditStatus = (row) => {
+ const $table = tableRef.value
+ if ($table) {
+ return $table.isEditByRow(row)
+ }
+}
+const editRowEvent = (row) => {
+ const $table = tableRef.value
+ if ($table) {
+ $table.setEditRow(row)
+ }
+}
+const saveRowEvent = (row) => {
+ const $table = tableRef.value
+ if ($table) {
+ $table.clearEdit().then(() => {
+ // loading.value = true
+ // setTimeout(() => {
+ // loading.value = false
+ // VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' })
+ // }, 300)
+ handleSave(row)
+ })
+ }
+}
+const cancelRowEvent = () => {
+ const $table = tableRef.value
+ if ($table) {
+ $table.clearEdit()
+ }
+}
+const hasEditStatus1 = (row) => {
+ const $table = tableRef1.value
+ if ($table) {
+ return $table.isEditByRow(row)
+ }
+}
+const editRowEvent1 = (row) => {
+ const $table = tableRef1.value
+ if ($table) {
+ $table.setEditRow(row)
+ }
+}
+const saveRowEvent1 = (row) => {
+ const $table = tableRef1.value
+ if ($table) {
+ $table.clearEdit().then(() => {
+ // loading.value = true
+ // setTimeout(() => {
+ // loading.value = false
+ // VxeUI.modal.message({ content: `淇濆瓨鎴愬姛锛乶ame=${row.name}`, status: 'success' })
+ // }, 300)
+ handleSave2(row)
+ })
+ }
+}
+const cancelRowEvent1 = () => {
+ const $table = tableRef1.value
+ if ($table) {
+ $table.clearEdit()
+ }
+}
async function getRouteList(year, month) {
const res = await listGasPlan({
major: "绠¤矾",
@@ -395,10 +487,14 @@
personnelNumber:
item.personnelNumber == null ? "1" : item.personnelNumber,
dayProduceAllNum:
- item.dayProduceAllNum == null ? "0" : item.dayProduceNum*item.personnelNumber,
+ item.dayProduceAllNum == null
+ ? "0"
+ : item.dayProduceNum * item.personnelNumber,
days: item.days == null ? "22" : item.days,
monthProduceAllNum:
- item.monthProduceAllNum == null ? "0" : item.dayProduceAllNum*item.days,
+ item.monthProduceAllNum == null
+ ? "0"
+ : item.dayProduceAllNum * item.days,
};
});
loading.value = false;
@@ -420,55 +516,109 @@
personnelNumber:
item.personnelNumber == null ? "1" : item.personnelNumber,
dayProduceAllNum:
- item.dayProduceAllNum == null ? "0" : item.dayProduceNum*item.personnelNumber,
+ item.dayProduceAllNum == null
+ ? "0"
+ : item.dayProduceNum * item.personnelNumber,
days: item.days == null ? "22" : item.days,
monthProduceAllNum:
- item.monthProduceAllNum == null ? "0" : item.dayProduceAllNum*item.days,
+ item.monthProduceAllNum == null
+ ? "0"
+ : item.dayProduceAllNum * item.days,
};
});
- loading.value = false;
+ loading2.value = false;
}
-function cellClickEvent ({ row, column }){
- console.log(column,row)
- row.dayProduceAllNum = row.dayProduceNum*row.personnelNumber
- row.monthProduceAllNum = row.dayProduceAllNum*row.days
+function cellClickEvent({ row, column }) {
+ console.log(column, row);
+ row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber;
+ row.monthProduceAllNum = row.dayProduceAllNum * row.days;
}
function handleQuery() {
+ if(!queryParams.value.date){
+ ElMessage({
+ message: "璇烽�夋嫨骞存湀",
+ type: "error",
+ });
+ return;
+ }
console.log(queryParams.value.date, "scsciciisc");
const year = queryParams.value.date.split("-")[0];
const month = parseInt(queryParams.value.date.split("-")[1]);
getRouteList(year, month);
getGasList(year, month);
}
-async function handleSave() {
+function resetQuery() {
+ queryParams.value.date = ""
+}
+async function handleSave(row) {
const year = queryParams.value.date.split("-")[0];
const month = parseInt(queryParams.value.date.split("-")[1]);
- gasPlanList.value = gasPlanList.value.map((item)=>{
- return {
- ...item,
- major: "姘斾綋",
- year,
- month
- }
- })
- routePlanList.value = routePlanList.value.map((item)=>{
- return {
- ...item,
+ console.log(row, "baocun");
+ // gasPlanList.value = gasPlanList.value.map((item) => {
+ // return {
+ // ...item,
+ // major: "姘斾綋",
+ // year,
+ // month,
+ // };
+ // });
+ // routePlanList.value = routePlanList.value.map((item) => {
+ // return {
+ // ...item,
+ // major: "绠¤矾",
+ // year,
+ // month,
+ // };
+ // });
+ const res = await getGasPlanSave([
+ {
+ ...row,
major: "绠¤矾",
year,
- month
- }
- })
- const res = await getGasPlanSave([
- ...gasPlanList.value,
- ...routePlanList.value
- ])
- ElMessage({
+ month,
+ },
+ ]);
+ ElMessage({
message: "鏁版嵁淇濆瓨鎴愬姛",
type: "success",
});
- handleQuery()
- console.log(res,"akiwjciwj")
+ handleQuery();
+ console.log(res, "akiwjciwj");
+}
+async function handleSave2(row) {
+ const year = queryParams.value.date.split("-")[0];
+ const month = parseInt(queryParams.value.date.split("-")[1]);
+ console.log(row, "baocun");
+ // gasPlanList.value = gasPlanList.value.map((item) => {
+ // return {
+ // ...item,
+ // major: "姘斾綋",
+ // year,
+ // month,
+ // };
+ // });
+ // routePlanList.value = routePlanList.value.map((item) => {
+ // return {
+ // ...item,
+ // major: "绠¤矾",
+ // year,
+ // month,
+ // };
+ // });
+ const res = await getGasPlanSave([
+ {
+ ...row,
+ major: "姘斾綋",
+ year,
+ month,
+ },
+ ]);
+ ElMessage({
+ message: "鏁版嵁淇濆瓨鎴愬姛",
+ type: "success",
+ });
+ handleQuery();
+ console.log(res, "akiwjciwj");
}
onMounted(() => {
// getRouteList();
@@ -491,11 +641,11 @@
margin: 20px auto;
}
}
-.btn_center{
+.btn_center {
display: flex;
justify-content: center;
align-items: center;
- margin-top:20px;
- padding-bottom:20px;
+ margin-top: 20px;
+ padding-bottom: 20px;
}
</style>
--
Gitblit v1.9.3