From 0a09148f6aa65d402f211f6839404157c1c2227e Mon Sep 17 00:00:00 2001
From: CD配唱片 <CD配唱片>
Date: 星期六, 26 四月 2025 16:16:25 +0800
Subject: [PATCH] 修改计划大表push多次问题和负载统计查询重置
---
/dev/null | 209 --------------
src/views/mainPlan/platePlanList/index.vue | 92 +++---
src/views/mainPlan/gasProduceStatics/index.vue | 512 ++++++++++++++++++++++-------------
3 files changed, 369 insertions(+), 444 deletions(-)
diff --git a/src/views/mainPlan/gasPlanning2/index.vue b/src/views/mainPlan/gasPlanning2/index.vue
deleted file mode 100644
index d79ef8f..0000000
--- a/src/views/mainPlan/gasPlanning2/index.vue
+++ /dev/null
@@ -1,209 +0,0 @@
-<template>
- <div class="app-container">
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="Download"
- @click="handleExport"
- v-hasPermi="['apsPartRouteStat:export']"
- >瀵煎嚭</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="Refresh"
- @click="handleRefresh"
- v-hasPermi="['apsPartRouteStat:edit']"
- >鏇存柊</el-button>
- </el-col>
- <right-toolbar @queryTable="getList" :search="false"></right-toolbar>
- </el-row>
- <vxe-grid ref="gridRef" v-bind="gridOptions" :loading="loading"></vxe-grid>
- </div>
-</template>
-
-<script setup name="apsPartRouteStat">
-import { query,updateStat } from "@/api/mainPlan/partRouteStat.js";
-import { ref } from "vue";
-import * as XLSX from 'xlsx';
-
-const { proxy } = getCurrentInstance();
-
-const loading = ref(true);
-const gridRef = ref();
-const height = ref(document.documentElement.clientHeight - 130 + "px;")
-const headers = ref([]);
-const exportData = ref([]);
-
-const gridOptions = reactive({
- border: true,
- stripe: true,
- loading: false,
- showOverflow: true,
- showHeaderOverflow: true,
- showFooterOverflow: true,
- height: height,
- columnConfig: {
- resizable: true
- },
- scrollX: {
- enabled: true,
- gt: 0,
- threshold: 50
- },
- scrollY: {
- enabled: true,
- gt: 0,
- threshold: 50
- }
-});
-
-let tableColumn = []
-let tableData = []
-let merges = [];
-
-/** 鏌ヨ闆朵欢缁熻琛ㄥ垪琛� */
-function getList() {
- let rowKey = 0
- let colKey = 0
- headers.value = []
- exportData.value = []
- tableColumn = []
- tableData = []
- loading.value = true;
- query().then(response => {
- const colList = []
- let headersOne = []
- let headersTwo = []
- if(response.code == '200'){
- if (!response.planTitle) {
- loading.value = false;
- return;
- }
- headersOne.push('鏃ユ湡');
- headersTwo.push('璧勬簮缁�');
- colList.push({
- field: 'dateCol',
- title: '鏃ユ湡',
- fixed: 'left',
- children: [
- { field: `resourceName`, title: '璧勬簮缁�', width: 250, type: 'html'},
- ],
- width: 160
- })
- response.planTitle.forEach(item => {
- headersOne.push(item);
- headersOne.push('');
- headersOne.push('');
- headersTwo.push('璁捐宸ユ椂');
- headersTwo.push('闇�姹傚伐鏃�');
- headersTwo.push('浜ц兘璐熻嵎');
- colKey++
- colList.push({
- field: `dateColTime${colKey}`,
- title: item,
- children: [
- { field: `designTimes${colKey}`, title: '璁捐宸ユ椂', width: 80},
- { field: `requireTimes${colKey}`, title: '闇�姹傚伐鏃�', width: 80},
- { field: `capacityLoad${colKey}`, title: '浜ц兘璐熻嵎', width: 80, type: 'html'},
- ],
- width: 160
- })
- });
-
- headers.value.push(headersOne);
- headers.value.push(headersTwo);
-
- const columnList = [...tableColumn, ...colList]
- const dataList = []
- let startCol = 1;
-
- //鑾峰彇map
- response.planTable.forEach(mapItem => {
- rowKey++
- let lastCol = startCol + 2;
- merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol} });
- startCol = lastCol + 1;
- let data = [];
- const item = {
- id: `${rowKey}`
- }
- for (const [key, listValue] of Object.entries(mapItem)) {
- data.push(key);
-
- let tableKey = 0;
- let flag = false;
- listValue.forEach(listItem => {
-
- tableKey++
- item[`designTimes${tableKey}`] = listItem.designTimes;
- item[`requireTimes${tableKey}`] = listItem.requireTimes;
- item[`capacityLoad${tableKey}`] = listItem.capacityLoad > 100 ? `<font color="red">${listItem.capacityLoad}%</font>` :listItem.capacityLoad+'%';
- data.push(listItem.designTimes);
- data.push(listItem.requireTimes);
- data.push(listItem.capacityLoad+'%');
- if (listItem.capacityLoad > 100) {
- flag = true;
- }
- });
-
- item[`resourceName`] = flag ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` : key;
- }
- exportData.value.push(data);
- dataList.push(item);
- });
-
- const $grid = gridRef.value
- if ($grid) {
- tableColumn = columnList
- tableData = [...tableData, ...dataList]
- $grid.loadColumn(tableColumn)
- $grid.loadData(tableData)
- gridOptions.loading = false
- }
-
- loading.value = false;
- }
- });
-}
-
-/** 瀵煎嚭鎸夐挳鎿嶄綔 */
-function handleExport() {
-
- // 鍚堝苟琛ㄥご鍜屾暟鎹�
- const finalData = [...headers.value, ...exportData.value];
-
- // 灏嗘暟鎹浆鎹负 worksheet
- const ws = XLSX.utils.aoa_to_sheet(finalData);
-
- // 鍚堝苟鍗曞厓鏍硷紙濡傛灉闇�瑕侊級
- /* ws['!merges'] = [
- { s: { r: 0, c: 1 }, e: { r: 0, c: 3 } },
- { s: { r: 0, c: 0 }, e: { r: 0, c: 0 } }
- ]; */
-
- ws['!merges'] = merges;
-
- // 鍒涘缓 workbook
- const wb = XLSX.utils.book_new();
- // 灏� worksheet 娣诲姞鍒� workbook 涓�
- XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
- // 瀵煎嚭鏂囦欢
- XLSX.writeFile(wb, `apsPartRouteStat_${new Date().getTime()}.xlsx`);
-
-}
-
-/** 鍒锋柊鎸夐挳鎿嶄綔 */
-function handleRefresh(){
- updateStat().then(response => {
- if(response.code == '200'){
- getList();
- }
- });
-}
-
-getList();
-</script>
diff --git a/src/views/mainPlan/gasProduceStatics/index.vue b/src/views/mainPlan/gasProduceStatics/index.vue
index 1417358..7ae4f68 100644
--- a/src/views/mainPlan/gasProduceStatics/index.vue
+++ b/src/views/mainPlan/gasProduceStatics/index.vue
@@ -84,6 +84,29 @@
></vxe-grid>
</div>
</div>
+ <el-row :gutter="10" class="mb8">
+ <el-col :span="1.5">
+ <el-button
+ type="warning"
+ plain
+ icon="Download"
+ @click="handleExport2"
+ v-hasPermi="['apsPartRouteStat:export']"
+ >瀵煎嚭</el-button
+ >
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
+ type="info"
+ plain
+ icon="Refresh"
+ @click="handleRefresh2"
+ v-hasPermi="['apsPartRouteStat:edit']"
+ >鏇存柊</el-button
+ >
+ </el-col>
+ <right-toolbar @queryTable="getList" :search="false"></right-toolbar>
+ </el-row>
<div class="box_container">
<div class="title_text">姘旀煖瑙勫垝浜ц兘璐熻浇缁熻</div>
<div class="tabel_container">
@@ -104,6 +127,7 @@
} from "@/api/mainPlan/gasProduceStatics.js";
import { ref } from "vue";
import * as XLSX from "xlsx";
+import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -159,8 +183,8 @@
let tableData = [];
let merges = [];
function handleChangeSelectType(e) {
- searchTypeValue.value = e
- console.log(e,searchTypeValue.value, "sjcsuhcushc");
+ searchTypeValue.value = e;
+ console.log(e, searchTypeValue.value, "sjcsuhcushc");
if (e === "day") {
dayCom.value = true;
} else {
@@ -173,31 +197,25 @@
const year = dateTime.getFullYear();
const month = String(dateTime.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮嬶紝鎵�浠ラ渶瑕佸姞1锛屽苟鐢╬adStart琛ラ浂
// 鏍煎紡鍖栧勾浠藉拰鏈堜唤涓� "yyyy-mm" 鏍煎紡鐨勫瓧绗︿覆
- return`${year}-${month}`;
+ return `${year}-${month}`;
}
-/** 鏌ヨ闆朵欢缁熻琛ㄥ垪琛� */
-function getPipeList() {
- let sYearMonth = "";
- let eYearMonth = "";
- // let type = "";
- // options.map((item) => {
- // if (queryParams.value.searchType === item.label) {
- // type = item.value;
- // }
- // });
+function dateRangeStr(monthRange) {
// 鍒涘缓涓�涓狣ate瀵硅薄
- let sDate = new Date(queryParams.value.monthRange[0]);
- let eDate = new Date(queryParams.value.monthRange[1]);
+ let sDate = new Date(monthRange[0]);
+ let eDate = new Date(monthRange[1]);
// 鑾峰彇骞翠唤鍜屾湀浠�
let sYear = sDate.getFullYear();
let sMonth = sDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
let eYear = eDate.getFullYear();
let eMonth = eDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
// 鏍煎紡鍖栦负"YYYY-MM"鐨勫舰寮�
- sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`;
- eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`;
- console.log(sYearMonth, eYearMonth, "yearMonth");
-
+ return {
+ sYearMonth: `${sYear}-${sMonth.toString().padStart(2, "0")}`,
+ eYearMonth: `${eYear}-${eMonth.toString().padStart(2, "0")}`,
+ };
+}
+/** 鏌ヨ闆朵欢缁熻琛ㄥ垪琛� */
+function getPipeList() {
let rowKey = 0;
let colKey = 0;
headers.value = [];
@@ -206,106 +224,118 @@
tableData = [];
loading.value = true;
listGasProduceStatics({
- searchStartDate:
- queryParams.value.searchType === "鎸夋湀缁熻"
- ? sYearMonth
- : dateStr(queryParams.value.monthDays),
- searchEndDate:
- queryParams.value.searchType === "鎸夋湀缁熻"
- ? eYearMonth
- : dateStr(queryParams.value.monthDays),
+ searchStartDate: !dayCom.value
+ ? dateRangeStr(queryParams.value.monthRange).sYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchEndDate: !dayCom.value
+ ? dateRangeStr(queryParams.value.monthRange).eYearMonth
+ : dateStr(queryParams.value.monthDays),
searchType: searchTypeValue.value,
- major:'piping'
+ major: "piping",
}).then((response) => {
- console.log(response.data.planTable,'responseresponseresponse')
+ console.log(response.data.planTable, "responseresponseresponse");
const colList = [];
let headersOne = [];
let headersTwo = [];
- if(response.code == '200'){
+ if (response.code == "200") {
if (!response.data.planTitle) {
loading.value = false;
return;
}
- headersOne.push('鏃ユ湡');
- headersTwo.push('宸ュ簭鍚嶇О');
+ headersOne.push("鏃ユ湡");
+ headersTwo.push("宸ュ簭鍚嶇О");
colList.push({
- field: 'dateCol',
- title: '鏃ユ湡',
- fixed: 'left',
- children: [
- { field: `resourceName`, title: '宸ュ簭鍚嶇О', width: 250, type: 'html'},
- ],
- width: 160
- })
- response.data.planTitle.forEach(item => {
+ field: "dateCol",
+ title: "鏃ユ湡",
+ fixed: "left",
+ children: [
+ {
+ field: `resourceName`,
+ title: "宸ュ簭鍚嶇О",
+ width: 250,
+ type: "html",
+ },
+ ],
+ width: 160,
+ });
+ response.data.planTitle.forEach((item) => {
headersOne.push(item);
- headersOne.push('');
- headersOne.push('');
- headersTwo.push('璁捐浜ц兘');
- headersTwo.push('闇�姹備骇鑳�');
- headersTwo.push('浜ц兘璐熻浇');
- colKey++
+ headersOne.push("");
+ headersOne.push("");
+ headersTwo.push("璁捐浜ц兘");
+ headersTwo.push("闇�姹備骇鑳�");
+ headersTwo.push("浜ц兘璐熻浇");
+ colKey++;
colList.push({
field: `dateColTime${colKey}`,
title: item,
children: [
- { field: `designTimes${colKey}`, title: '璁捐浜ц兘', width: 80},
- { field: `requireTimes${colKey}`, title: '闇�姹備骇鑳�', width: 80},
- { field: `capacityLoad${colKey}`, title: '浜ц兘璐熻浇', width: 80, type: 'html'},
+ { field: `designTimes${colKey}`, title: "璁捐浜ц兘", width: 80 },
+ { field: `requireTimes${colKey}`, title: "闇�姹備骇鑳�", width: 80 },
+ {
+ field: `capacityLoad${colKey}`,
+ title: "浜ц兘璐熻浇",
+ width: 80,
+ type: "html",
+ },
],
- width: 160
- })
+ width: 160,
+ });
});
headers.value.push(headersOne);
headers.value.push(headersTwo);
- const columnList = [...tableColumn, ...colList]
- const dataList = []
+ const columnList = [...tableColumn, ...colList];
+ const dataList = [];
let startCol = 1;
//鑾峰彇map
- response.data.planTable.map(mapItem => {
- rowKey++
+ response.data.planTable.map((mapItem) => {
+ rowKey++;
let lastCol = startCol + 2;
- merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol} });
+ merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } });
startCol = lastCol + 1;
let data = [];
const item = {
- id: `${rowKey}`
- }
+ id: `${rowKey}`,
+ };
for (const [key, listValue] of Object.entries(mapItem)) {
data.push(key);
-
+
let tableKey = 0;
let flag = false;
- listValue.forEach(listItem => {
-
- tableKey++
+ listValue.forEach((listItem) => {
+ tableKey++;
item[`designTimes${tableKey}`] = listItem.designTimes;
item[`requireTimes${tableKey}`] = listItem.requireTimes;
- item[`capacityLoad${tableKey}`] = listItem.capacityLoad > 100 ? `<font color="red">${listItem.capacityLoad}%</font>` :listItem.capacityLoad+'%';
+ item[`capacityLoad${tableKey}`] =
+ listItem.capacityLoad > 100
+ ? `<font color="red">${listItem.capacityLoad}%</font>`
+ : listItem.capacityLoad + "%";
data.push(listItem.designTimes);
data.push(listItem.requireTimes);
- data.push(listItem.capacityLoad+'%');
+ data.push(listItem.capacityLoad + "%");
if (listItem.capacityLoad > 100) {
flag = true;
}
});
- item[`resourceName`] = flag ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` : key;
+ item[`resourceName`] = flag
+ ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
+ : key;
}
exportData.value.push(data);
dataList.push(item);
});
-
- const $grid = gridRef.value
+
+ const $grid = gridRef.value;
if ($grid) {
- tableColumn = columnList
- tableData = [...tableData, ...dataList]
- $grid.loadColumn(tableColumn)
- $grid.loadData(tableData)
- gridOptions.loading = false
+ tableColumn = columnList;
+ tableData = [...tableData, ...dataList];
+ $grid.loadColumn(tableColumn);
+ $grid.loadData(tableData);
+ gridOptions.loading = false;
}
loading.value = false;
@@ -313,6 +343,133 @@
});
}
function getGasList() {
+ let rowKey = 0;
+ let colKey = 0;
+ headers.value = [];
+ exportData.value = [];
+ tableColumn = [];
+ tableData = [];
+ loading.value = true;
+ listGasProduceStatics({
+ searchStartDate: !dayCom.value
+ ? dateRangeStr(queryParams.value.monthRange).sYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchEndDate: !dayCom.value
+ ? dateRangeStr(queryParams.value.monthRange).eYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchType: searchTypeValue.value,
+ major: "gas",
+ }).then((response) => {
+ console.log(response.data.planTable, "responseresponseresponse");
+ const colList = [];
+ let headersOne = [];
+ let headersTwo = [];
+ if (response.code == "200") {
+ if (!response.data.planTitle) {
+ loading.value = false;
+ return;
+ }
+ headersOne.push("鏃ユ湡");
+ headersTwo.push("宸ュ簭鍚嶇О");
+ colList.push({
+ field: "dateCol",
+ title: "鏃ユ湡",
+ fixed: "left",
+ children: [
+ {
+ field: `resourceName`,
+ title: "宸ュ簭鍚嶇О",
+ width: 250,
+ type: "html",
+ },
+ ],
+ width: 160,
+ });
+ response.data.planTitle.forEach((item) => {
+ headersOne.push(item);
+ headersOne.push("");
+ headersOne.push("");
+ headersTwo.push("璁捐浜ц兘");
+ headersTwo.push("闇�姹備骇鑳�");
+ headersTwo.push("浜ц兘璐熻浇");
+ colKey++;
+ colList.push({
+ field: `dateColTime${colKey}`,
+ title: item,
+ children: [
+ { field: `designTimes${colKey}`, title: "璁捐浜ц兘", width: 80 },
+ { field: `requireTimes${colKey}`, title: "闇�姹備骇鑳�", width: 80 },
+ {
+ field: `capacityLoad${colKey}`,
+ title: "浜ц兘璐熻浇",
+ width: 80,
+ type: "html",
+ },
+ ],
+ width: 160,
+ });
+ });
+
+ headers.value.push(headersOne);
+ headers.value.push(headersTwo);
+
+ const columnList = [...tableColumn, ...colList];
+ const dataList = [];
+ let startCol = 1;
+
+ //鑾峰彇map
+ response.data.planTable.map((mapItem) => {
+ rowKey++;
+ let lastCol = startCol + 2;
+ merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } });
+ startCol = lastCol + 1;
+ let data = [];
+ const item = {
+ id: `${rowKey}`,
+ };
+ for (const [key, listValue] of Object.entries(mapItem)) {
+ data.push(key);
+
+ let tableKey = 0;
+ let flag = false;
+ listValue.forEach((listItem) => {
+ tableKey++;
+ item[`designTimes${tableKey}`] = listItem.designTimes;
+ item[`requireTimes${tableKey}`] = listItem.requireTimes;
+ item[`capacityLoad${tableKey}`] =
+ listItem.capacityLoad > 100
+ ? `<font color="red">${listItem.capacityLoad}%</font>`
+ : listItem.capacityLoad + "%";
+ data.push(listItem.designTimes);
+ data.push(listItem.requireTimes);
+ data.push(listItem.capacityLoad + "%");
+ if (listItem.capacityLoad > 100) {
+ flag = true;
+ }
+ });
+
+ item[`resourceName`] = flag
+ ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
+ : key;
+ }
+ exportData.value.push(data);
+ dataList.push(item);
+ });
+
+ const $grid = gridRef2.value;
+ if ($grid) {
+ tableColumn = columnList;
+ tableData = [...tableData, ...dataList];
+ $grid.loadColumn(tableColumn);
+ $grid.loadData(tableData);
+ gridOptions.loading = false;
+ }
+
+ loading.value = false;
+ }
+ });
+}
+function formatDate() {
let sYearMonth = "";
let eYearMonth = "";
// let type = "";
@@ -332,127 +489,80 @@
// 鏍煎紡鍖栦负"YYYY-MM"鐨勫舰寮�
sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`;
eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`;
- console.log(sYearMonth, eYearMonth, "yearMonth");
-
- let rowKey = 0;
- let colKey = 0;
- headers.value = [];
- exportData.value = [];
- tableColumn = [];
- tableData = [];
- loading.value = true;
- listGasProduceStatics({
- searchStartDate:
- queryParams.value.searchType === "鎸夋湀缁熻"
- ? sYearMonth
- : dateStr(queryParams.value.monthDays),
- searchEndDate:
- queryParams.value.searchType === "鎸夋湀缁熻"
- ? eYearMonth
- : dateStr(queryParams.value.monthDays),
- searchType: searchTypeValue.value,
- major:'gas'
- }).then((response) => {
- console.log(response.data.planTable,'responseresponseresponse')
- const colList = [];
- let headersOne = [];
- let headersTwo = [];
- if(response.code == '200'){
- if (!response.data.planTitle) {
- loading.value = false;
- return;
- }
- headersOne.push('鏃ユ湡');
- headersTwo.push('宸ュ簭鍚嶇О');
- colList.push({
- field: 'dateCol',
- title: '鏃ユ湡',
- fixed: 'left',
- children: [
- { field: `resourceName`, title: '宸ュ簭鍚嶇О', width: 250, type: 'html'},
- ],
- width: 160
- })
- response.data.planTitle.forEach(item => {
- headersOne.push(item);
- headersOne.push('');
- headersOne.push('');
- headersTwo.push('璁捐浜ц兘');
- headersTwo.push('闇�姹備骇鑳�');
- headersTwo.push('浜ц兘璐熻浇');
- colKey++
- colList.push({
- field: `dateColTime${colKey}`,
- title: item,
- children: [
- { field: `designTimes${colKey}`, title: '璁捐浜ц兘', width: 80},
- { field: `requireTimes${colKey}`, title: '闇�姹備骇鑳�', width: 80},
- { field: `capacityLoad${colKey}`, title: '浜ц兘璐熻浇', width: 80, type: 'html'},
- ],
- width: 160
- })
- });
-
- headers.value.push(headersOne);
- headers.value.push(headersTwo);
-
- const columnList = [...tableColumn, ...colList]
- const dataList = []
- let startCol = 1;
-
- //鑾峰彇map
- response.data.planTable.map(mapItem => {
- rowKey++
- let lastCol = startCol + 2;
- merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol} });
- startCol = lastCol + 1;
- let data = [];
- const item = {
- id: `${rowKey}`
- }
- for (const [key, listValue] of Object.entries(mapItem)) {
- data.push(key);
-
- let tableKey = 0;
- let flag = false;
- listValue.forEach(listItem => {
-
- tableKey++
- item[`designTimes${tableKey}`] = listItem.designTimes;
- item[`requireTimes${tableKey}`] = listItem.requireTimes;
- item[`capacityLoad${tableKey}`] = listItem.capacityLoad > 100 ? `<font color="red">${listItem.capacityLoad}%</font>` :listItem.capacityLoad+'%';
- data.push(listItem.designTimes);
- data.push(listItem.requireTimes);
- data.push(listItem.capacityLoad+'%');
- if (listItem.capacityLoad > 100) {
- flag = true;
- }
- });
-
- item[`resourceName`] = flag ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` : key;
- }
- exportData.value.push(data);
- dataList.push(item);
- });
-
- const $grid = gridRef2.value
- if ($grid) {
- tableColumn = columnList
- tableData = [...tableData, ...dataList]
- $grid.loadColumn(tableColumn)
- $grid.loadData(tableData)
- gridOptions.loading = false
- }
-
- loading.value = false;
- }
- });
}
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
+ let sYearMonth = "";
+ let eYearMonth = "";
+ // let type = "";
+ // options.map((item) => {
+ // if (queryParams.value.searchType === item.label) {
+ // type = item.value;
+ // }
+ // });
+ // 鍒涘缓涓�涓狣ate瀵硅薄
+ let sDate = new Date(queryParams.value.monthRange[0]);
+ let eDate = new Date(queryParams.value.monthRange[1]);
+ // 鑾峰彇骞翠唤鍜屾湀浠�
+ let sYear = sDate.getFullYear();
+ let sMonth = sDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
+ let eYear = eDate.getFullYear();
+ let eMonth = eDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
+ // 鏍煎紡鍖栦负"YYYY-MM"鐨勫舰寮�
+ sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`;
+ eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`;
proxy.download(
"/aps/apsGasPipingRouteStat/exportExcel",
- {},
+ {
+ searchStartDate:
+ queryParams.value.searchType === "鎸夋湀缁熻"
+ ? sYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchEndDate:
+ queryParams.value.searchType === "鎸夋湀缁熻"
+ ? eYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchType: searchTypeValue.value,
+ major: "piping",
+ },
+ `aps_gas_produce_statics_${new Date().getTime()}.xlsx`
+ );
+}
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+function handleExport2() {
+ let sYearMonth = "";
+ let eYearMonth = "";
+ // let type = "";
+ // options.map((item) => {
+ // if (queryParams.value.searchType === item.label) {
+ // type = item.value;
+ // }
+ // });
+ // 鍒涘缓涓�涓狣ate瀵硅薄
+ let sDate = new Date(queryParams.value.monthRange[0]);
+ let eDate = new Date(queryParams.value.monthRange[1]);
+ // 鑾峰彇骞翠唤鍜屾湀浠�
+ let sYear = sDate.getFullYear();
+ let sMonth = sDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
+ let eYear = eDate.getFullYear();
+ let eMonth = eDate.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑锛屾墍浠ヨ鍔�1
+ // 鏍煎紡鍖栦负"YYYY-MM"鐨勫舰寮�
+ sYearMonth = `${sYear}-${sMonth.toString().padStart(2, "0")}`;
+ eYearMonth = `${eYear}-${eMonth.toString().padStart(2, "0")}`;
+ proxy.download(
+ "/aps/apsGasPipingRouteStat/exportExcel",
+ {
+ searchStartDate:
+ queryParams.value.searchType === "鎸夋湀缁熻"
+ ? sYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchEndDate:
+ queryParams.value.searchType === "鎸夋湀缁熻"
+ ? eYearMonth
+ : dateStr(queryParams.value.monthDays),
+ searchType: searchTypeValue.value,
+ major: "gas",
+ },
`aps_gas_produce_statics_${new Date().getTime()}.xlsx`
);
}
@@ -475,15 +585,31 @@
/** 閲嶇疆鎸夐挳鎿嶄綔 */
function resetQuery() {
- proxy.resetForm("queryRef");
- handleQuery();
+ queryParams.value.monthRange = "";
+ queryParams.value.monthDays = "";
+ dayCom.value = false;
+ (queryParams.value.searchType = "鎸夋湀缁熻"),
+ (searchTypeValue.value = "month");
+ tableData = [];
+ const $grid = gridRef.value;
+ const $grid2 = gridRef2.value;
+ if ($grid) {
+ $grid.loadColumn([]);
+ $grid.loadData([]);
+ gridOptions.loading = false;
+ }
+ if ($grid2) {
+ $grid2.loadColumn([]);
+ $grid2.loadData([]);
+ gridOptions.loading = false;
+ }
}
/** 鍒锋柊鎸夐挳鎿嶄綔 */
function handleRefresh() {
updateStat().then((response) => {
if (response.code == "200") {
- getPipeList();
- getGasList();
+ getPipeList();
+ getGasList();
}
});
}
diff --git a/src/views/mainPlan/platePlanList/index.vue b/src/views/mainPlan/platePlanList/index.vue
index 0e3de41..d4d98be 100644
--- a/src/views/mainPlan/platePlanList/index.vue
+++ b/src/views/mainPlan/platePlanList/index.vue
@@ -54,10 +54,7 @@
>
</el-col>
- <right-toolbar
- :search="false"
- @queryTable="getList"
- ></right-toolbar>
+ <right-toolbar :search="false" @queryTable="getList"></right-toolbar>
</el-row>
<HxlhTable
@@ -111,7 +108,10 @@
</template>
<script setup name="Aps_plate_process_stat">
-import { listApsPlateProcessShopStat, listApsPlateProcessShopStatUpdate } from "@/api/mainPlan/apsPlatePlanList";
+import {
+ listApsPlateProcessShopStat,
+ listApsPlateProcessShopStatUpdate,
+} from "@/api/mainPlan/apsPlatePlanList";
import HxlhTable from "@/components/HxlhTable/index.vue";
import { getToken } from "@/utils/auth";
import { nextTick, onMounted, ref } from "vue";
@@ -128,7 +128,7 @@
const multiple = ref(true);
const total = ref(0);
const title = ref("");
-const height = ref(document.documentElement.clientHeight-180 + "px;");
+const height = ref(document.documentElement.clientHeight - 180 + "px;");
const columnsVersion = ref(0);
const data = reactive({
// form: {},
@@ -160,36 +160,36 @@
title: "涓讳欢鏂欏彿",
field: "mainPartNumber",
width: 150,
- fixed:"left"
+ fixed: "left",
},
{
title: "涓氬姟绫诲瀷",
field: "businessType",
width: 120,
- fixed:"left"
+ fixed: "left",
},
{
title: "鍗曟嵁鍙�",
field: "documentNumber",
width: 160,
- fixed:"left"
+ fixed: "left",
},
{
title: "闇�姹傚垎绫�",
field: "requirementType",
width: 100,
- fixed:"left"
+ fixed: "left",
},
{
title: "鍗曟嵁鐘舵��",
field: "documentStatus",
width: 100,
- fixed:"left"
+ fixed: "left",
},
{
title: "瀹℃牳鏃堕棿",
field: "updateBy",
- width: 100
+ width: 100,
},
{
title: "褰撳墠宸ュ簭",
@@ -204,7 +204,7 @@
{
title: "涓嬩竴宸ュ簭",
field: "updateBy",
- width: 100
+ width: 100,
},
{
title: "涓嬩竴宸ュ簭宸ュ簭璐熻矗浜�",
@@ -232,7 +232,7 @@
{
title: "浣庨樁鐮�",
field: "updateBy",
- width: 100
+ width: 100,
},
{
title: "鐢熶骇鏁伴噺",
@@ -243,7 +243,7 @@
{
title: "宸ュ崟璁″垝涓嬪彂鏃堕棿",
field: "updateBy",
- width: 200
+ width: 200,
},
{
title: "绯荤粺瀹屽伐鏃堕棿",
@@ -257,26 +257,29 @@
async function getList() {
loading.value = true;
const response = await listApsPlateProcessShopStat();
- const listValue = response.data;
- const resData = listValue.map((item,index)=>{
- item.deptPlans.map((n, i) => {
- item[`${i}_startDate`] = n.planStartDate
- item[`${i}_endDate`] = n.planEndDate
- });
- return {
- ...item
- }
- })
- console.log(resData,'resDataresDataresData')
+ let listValue = response.data;
dynamicList.value = response.shopNames;
aps_plate_process_statList.value = listValue;
total.value = response.total;
loading.value = false;
await nextTick();
- const newArray = dynamicList.value.flatMap((item, index) => [
+ aps_plate_process_statList.value = aps_plate_process_statList.value.map(
+ (item, index) => {
+ item.deptPlans.map((n, i) => {
+ item[`${i}_startDate`] = n.planStartDate;
+ item[`${i}_endDate`] = n.planEndDate;
+ });
+ return {
+ ...item,
+ };
+ }
+ );
+ console.log(aps_plate_process_statList.value, "resDataresDataresData");
+ let newArray = [];
+ newArray = dynamicList.value.flatMap((item, index) => [
{
title: `${item}寮�濮嬫椂闂碻,
- field:`${index}_startDate`,
+ field: `${index}_startDate`,
width: 140,
formatter: ({ cellValue, row, column }) => {
let dateStr = "";
@@ -290,16 +293,16 @@
// `${item}寮�濮嬫椂闂碻,
// "planStartDate"
// );
- dateStr = n.planStartDate;
+ dateStr = n.planStartDate;
}
});
}
- return dateStr
+ return dateStr;
},
},
{
title: `${item}缁撴潫鏃堕棿`,
- field:`${index}_endDate`,
+ field: `${index}_endDate`,
width: 140,
formatter: ({ cellValue, row, column }) => {
let dateStr = "";
@@ -313,22 +316,26 @@
// `${item}寮�濮嬫椂闂碻,
// "planStartDate"
// );
- dateStr = n.planEndDate;
+ dateStr = n.planEndDate;
}
});
}
- return dateStr
+ return dateStr;
},
},
]);
- newArray.splice(2,0,{
- title: "鐒婃帴浠堕綈濂楀紑濮嬫椂闂�",
- field:"hanjie_startDate",
- width: 140,
- })
- await nextTick();
- columns.value = [...columns.value, ...newArray]; // 寮哄埗缁勪欢閲嶆柊娓叉煋
-
+ newArray.splice(2, 0, {
+ title: "鐒婃帴浠堕綈濂楀紑濮嬫椂闂�",
+ field: "hanjie_startDate",
+ width: 140,
+ });
+ columns.value = [
+ ...columns.value,
+ ...newArray.filter(
+ (item) => !columns.value.some((col) => col.field === item.field)
+ ),
+ ];
+ // columns.value = columns.value
}
// // 鍙栨秷鎸夐挳
@@ -400,7 +407,8 @@
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
proxy.download(
- "/aps/plateProcessShopStat/export", {},
+ "/aps/plateProcessShopStat/export",
+ {},
`aps_plate_process_stat_${new Date().getTime()}.xlsx`
);
}
--
Gitblit v1.9.3