Parcourir la source

预警页面添加

zhuqingsong il y a 1 an
Parent
commit
5028d302b8

+ 9 - 1
src/api/dataStatistics/index.ts

@@ -58,7 +58,6 @@ export function getDetailList(data: any) {
58 58
   });
59 59
 }
60 60
 
61
-
62 61
 //导出---救灾物资数量价值表
63 62
 export function exportJzwzsljzb(data: object) {
64 63
   return request({
@@ -100,3 +99,12 @@ export function exportyjwzflb(data: any) {
100 99
     responseType: "blob"
101 100
   });
102 101
 }
102
+
103
+//预警列表
104
+export function getDetaWarninglList(data: any) {
105
+  return request({
106
+    url: "/admin/in/selectListByStorageMaterials",
107
+    method: "post",
108
+    data
109
+  });
110
+}

+ 8 - 0
src/router/index.ts

@@ -105,6 +105,14 @@ const routes: Array<RouteRecordRaw> = [
105 105
         props(route) {
106 106
           return route.query;
107 107
         }
108
+      },
109
+      {
110
+        path: "WarningDetail",
111
+        name: "维护保养统计明细详情",
112
+        component: () => import("@/views/dataStatistics/warning/detail.vue"),
113
+        props(route) {
114
+          return route.query;
115
+        }
108 116
       }
109 117
     ]
110 118
   },

+ 10 - 0
src/views/dataStatistics/DisasterWaring/index.vue

@@ -0,0 +1,10 @@
1
+<!-- 救灾物资明细统计表 -->
2
+<template>
3
+  <detailedTable fileName="防汛抗旱物资预警表" :payload="['100', '200']" />
4
+</template>
5
+
6
+<script setup lang="ts">
7
+import detailedTable from "@/views/dataStatistics/warning/detailedTable.vue";
8
+</script>
9
+
10
+<style lang="scss" scoped></style>

+ 10 - 0
src/views/dataStatistics/DroughtWaring/index.vue

@@ -0,0 +1,10 @@
1
+<!-- 救灾物资明细统计表 -->
2
+<template>
3
+  <detailedTable fileName="救灾物资预警表" :payload="['300']" />
4
+</template>
5
+
6
+<script setup lang="ts">
7
+import detailedTable from "@/views/dataStatistics/warning/detailedTable.vue";
8
+</script>
9
+
10
+<style lang="scss" scoped></style>

+ 518 - 0
src/views/dataStatistics/warning/detail.vue

@@ -0,0 +1,518 @@
1
+<template>
2
+  <basic-container>
3
+    <el-form class="whole_form">
4
+      <el-row :gutter="20">
5
+        <el-col :span="6" v-if="userInfo.deptType === '1'">
6
+          <el-form-item label="省份">
7
+            <el-select v-model="searchList.provinceSiteIdList" filterable clearable multiple>
8
+              <el-option v-for="item in provinceList" :key="item.id" :label="item.name" :value="item.code" />
9
+            </el-select>
10
+          </el-form-item>
11
+        </el-col>
12
+        <el-col :span="6" v-if="userInfo.deptType === '1'">
13
+          <el-form-item label="储备仓库">
14
+            <el-select
15
+              multiple
16
+              filterable
17
+              clearable
18
+              v-model="searchList.warehouseDeptId"
19
+              :disabled="!searchList.gameDeptId"
20
+              :placeholder="!searchList.gameDeptId ? '请先选择垂管局' : '请选择储备仓库'"
21
+            >
22
+              <el-option
23
+                v-for="item in warehouseList"
24
+                :key="item.deptId"
25
+                :label="item.abbreviationName"
26
+                :value="item.deptId"
27
+              />
28
+            </el-select>
29
+          </el-form-item>
30
+        </el-col>
31
+        <el-col :span="6" v-if="userInfo.deptType === '2'">
32
+          <el-form-item label="储备仓库">
33
+            <el-select v-model="searchList.warehouseDeptId" multiple clearable placeholder="请选择储备仓库">
34
+              <el-option
35
+                v-for="item in warehouseList"
36
+                :key="item.deptId"
37
+                :label="item.abbreviationName"
38
+                :value="item.deptId"
39
+              />
40
+            </el-select>
41
+          </el-form-item>
42
+        </el-col>
43
+        <el-col :span="6">
44
+          <el-form-item label="物资名称">
45
+            <el-input v-model="searchList.dmUpname2" clearable />
46
+          </el-form-item>
47
+        </el-col>
48
+        <el-col :span="6" class="btn_center">
49
+          <el-button :icon="Search" type="primary" @click="getList">查询</el-button>
50
+          <el-button :icon="RefreshRight" @click="clearSearch">清空</el-button>
51
+          <!-- <el-button type="primary" :disable="!tableLoading" :icon="Download" @click="downloadExcel">导出</el-button> -->
52
+          <el-button type="primary" :icon="Download" @click="exportTemplate" v-if="hasBtn('tj:export')">导出</el-button>
53
+        </el-col>
54
+        <!-- <el-col :span="6" class="btn_center">
55
+          <el-button class="color1" @click="handlerColor('success', '1')">超期</el-button>
56
+          <el-button class="color2" @click="handlerColor('danger', '4')">临期</el-button>
57
+          <el-button class="color3" @click="handlerColor('warning', '2')">存储过半</el-button>
58
+        </el-col> -->
59
+      </el-row>
60
+    </el-form>
61
+    <el-table
62
+      :data="tableData"
63
+      :span-method="arraySpanMethod"
64
+      stripe
65
+      border
66
+      style="height: 80%"
67
+      v-loading="tableLoading"
68
+      :row-style="cellStyle"
69
+    >
70
+      <!-- <el-table :data="tableData" stripe border> -->
71
+      <el-table-column fixed type="index" label="序号" header-align="center" align="center" width="60">
72
+        <template #default="scope">
73
+          <span>
74
+            {{ scope.$index + 1 }}
75
+          </span>
76
+        </template>
77
+      </el-table-column>
78
+      <el-table-column
79
+        v-if="userInfo.deptType === '1' || userInfo.deptType === '2'"
80
+        fixed
81
+        prop="provinceName"
82
+        label="省份"
83
+        header-align="center"
84
+        align="center"
85
+      />
86
+      <el-table-column fixed prop="warehouse" label="储备仓库" header-align="center" align="center">
87
+        <template #default="{ row }">
88
+          <p class="font-style;" style="cursor: pointer" @click="openDetail(row, 'look')">
89
+            {{ row.warehouse }}
90
+          </p>
91
+        </template>
92
+      </el-table-column>
93
+      <el-table-column fixed prop="materialsName" label="物资名称" header-align="center" align="center" />
94
+      <el-table-column prop="province" label="储存年限过半" class-name="Bgcolor1" header-align="center" align="center">
95
+        <el-table-column
96
+          prop="quantitygb"
97
+          label="数量"
98
+          class-name="Bgcolor1"
99
+          header-align="center"
100
+          align="center"
101
+        ></el-table-column>
102
+        <el-table-column
103
+          prop="totalPricegb"
104
+          label="价值"
105
+          class-name="Bgcolor1"
106
+          header-align="center"
107
+          align="center"
108
+        ></el-table-column>
109
+      </el-table-column>
110
+      <el-table-column
111
+        prop="province"
112
+        label="22年底到达年限"
113
+        class-name="Bgcolor2"
114
+        header-align="center"
115
+        align="center"
116
+      >
117
+        <el-table-column
118
+          prop="quantity22"
119
+          label="数量"
120
+          class-name="Bgcolor2"
121
+          header-align="center"
122
+          align="center"
123
+        ></el-table-column>
124
+        <el-table-column
125
+          prop="totalPrice22"
126
+          label="价值"
127
+          class-name="Bgcolor2"
128
+          header-align="center"
129
+          align="center"
130
+        ></el-table-column>
131
+      </el-table-column>
132
+      <el-table-column
133
+        prop="quantity23"
134
+        label="23年底到达年限"
135
+        class-name="Bgcolor2"
136
+        header-align="center"
137
+        align="center"
138
+      >
139
+        <el-table-column
140
+          prop="quantity23"
141
+          label="数量"
142
+          class-name="Bgcolor2"
143
+          header-align="center"
144
+          align="center"
145
+        ></el-table-column>
146
+        <el-table-column
147
+          prop="totalPrice23"
148
+          label="价值"
149
+          class-name="Bgcolor2"
150
+          header-align="center"
151
+          align="center"
152
+        ></el-table-column>
153
+      </el-table-column>
154
+      <el-table-column
155
+        prop="totalPrice24"
156
+        label="24年底到达年限"
157
+        class-name="Bgcolor3"
158
+        header-align="center"
159
+        align="center"
160
+      >
161
+        <el-table-column
162
+          prop="quantity24"
163
+          label="数量"
164
+          class-name="Bgcolor3"
165
+          header-align="center"
166
+          align="center"
167
+        ></el-table-column>
168
+        <el-table-column
169
+          prop="totalPrice24"
170
+          label="价值"
171
+          class-name="Bgcolor3"
172
+          header-align="center"
173
+          align="center"
174
+        ></el-table-column>
175
+      </el-table-column>
176
+      <el-table-column
177
+        prop="province"
178
+        label="25年底到达年限"
179
+        class-name="Bgcolor3"
180
+        header-align="center"
181
+        align="center"
182
+      >
183
+        <el-table-column
184
+          prop="quantity25"
185
+          label="数量"
186
+          class-name="Bgcolor3"
187
+          header-align="center"
188
+          align="center"
189
+        ></el-table-column>
190
+        <el-table-column
191
+          prop="totalPrice25"
192
+          label="价值"
193
+          class-name="Bgcolor3"
194
+          header-align="center"
195
+          align="center"
196
+        ></el-table-column>
197
+      </el-table-column>
198
+      <el-table-column
199
+        prop="province"
200
+        label="26年底到达年限"
201
+        class-name="Bgcolor3"
202
+        header-align="center"
203
+        align="center"
204
+      >
205
+        <el-table-column
206
+          prop="quantity26"
207
+          label="数量"
208
+          class-name="Bgcolor3"
209
+          header-align="center"
210
+          align="center"
211
+        ></el-table-column>
212
+        <el-table-column
213
+          prop="totalPrice26"
214
+          label="价值"
215
+          class-name="Bgcolor3"
216
+          header-align="center"
217
+          align="center"
218
+        ></el-table-column>
219
+      </el-table-column>
220
+    </el-table>
221
+  </basic-container>
222
+</template>
223
+
224
+<script setup lang="ts">
225
+import { ref, onMounted } from "vue";
226
+import { useGetters } from "@/hooks/storeHooks";
227
+import { getDetaWarninglList, getCityList, getSysTreeDict, exportjzwzmxtjb } from "@/api/dataStatistics/index";
228
+import { Search, RefreshRight, Download } from "@element-plus/icons-vue";
229
+import { exportExcel } from "@/utils/exprot";
230
+import { da } from "element-plus/es/locale";
231
+import { deepClone, handleTree } from "@/utils/util";
232
+import exportBlob from "@/global/exportBlob";
233
+import hasBtn from "@/global/hasBtn";
234
+import { setQuery } from "@/hooks/detailQuery/index";
235
+
236
+import { useDict } from "@/hooks/dict";
237
+
238
+const { Storage_state } = useDict("Storage_state");
239
+
240
+const tableData: any = ref([]);
241
+const tableLoading = ref(false);
242
+const searchList: any = ref({
243
+  gameDeptId: [],
244
+  warehouseDeptId: [],
245
+  dmUpname2: "",
246
+  provinceSiteIdList: []
247
+});
248
+const mergeObj: any = ref({});
249
+const cityList: any = ref([]);
250
+const warehouseList: any = ref([]);
251
+const suppliesList: any = ref([]);
252
+const provinceList: any = ref([]);
253
+
254
+const { userInfo } = useGetters(["userInfo"]);
255
+const props = defineProps({
256
+  payload: {
257
+    type: Array,
258
+    default: () => []
259
+  },
260
+  fileName: {
261
+    type: String,
262
+    default: ""
263
+  }
264
+});
265
+
266
+if (userInfo.value.deptType === "1") {
267
+  // 获取垂管局列表
268
+  getCityList({ deptType: 2 }).then((res: any) => {
269
+    if (res.code === 0) {
270
+      cityList.value = res.data;
271
+      // searchList.value.gameDeptId = [cityList.value[0].deptId];
272
+      getSupplies(searchList.value.gameDeptId);
273
+      getList();
274
+    }
275
+  });
276
+} else {
277
+  // 获取储备仓库
278
+  let postData = {
279
+    parentIdList: [userInfo.value.deptId],
280
+    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
281
+  };
282
+  getCityList(postData).then((res: any) => {
283
+    if (res.code === 0) {
284
+      warehouseList.value = res.data;
285
+      searchList.value.warehouseDeptId =
286
+        warehouseList.value && warehouseList.value.length > 0 ? [warehouseList.value[0].deptId] : [];
287
+      getList();
288
+    }
289
+  });
290
+}
291
+
292
+// 根据省份列表获取储备仓库
293
+const getSupplies = (value: string) => {
294
+  let postData = {
295
+    parentIdList: value,
296
+    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
297
+  };
298
+  getCityList(postData).then((res: any) => {
299
+    if (res.code === 0) {
300
+      warehouseList.value = res.data;
301
+    }
302
+  });
303
+};
304
+
305
+// 获取物资类别
306
+getSysTreeDict({ type: 1, difference: 2, parentCodeList: props.payload }).then((res: any) => {
307
+  if (res.code === 0) {
308
+    suppliesList.value = res.data;
309
+  }
310
+});
311
+// 获取省份
312
+getSysTreeDict({ type: 2, difference: 1 }).then((res: any) => {
313
+  if (res.code === 0) {
314
+    provinceList.value = res.data;
315
+  }
316
+});
317
+
318
+const clearSearch = () => {
319
+  searchList.value = {
320
+    gameDeptId: [],
321
+    warehouseDeptId: [],
322
+    dmUpname2: "",
323
+    provinceSiteIdList: []
324
+  };
325
+  getList();
326
+};
327
+
328
+// 获取表格数据
329
+const getList = () => {
330
+  const data = {
331
+    dmUpcode0List: props.payload,
332
+    ...searchList.value
333
+  };
334
+  tableLoading.value = true;
335
+  getDetaWarninglList(data).then((res: any) => {
336
+    if (res.code === 0) {
337
+      tableData.value = res.data;
338
+      getSpanArr(tableData.value);
339
+    }
340
+  });
341
+};
342
+
343
+const arraySpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
344
+  if (columnIndex === 1) {
345
+    if (rowIndex % 2 === 0) {
346
+      return {
347
+        rowspan: 2,
348
+        colspan: 1
349
+      };
350
+    } else {
351
+      return {
352
+        rowspan: 0,
353
+        colspan: 0
354
+      };
355
+    }
356
+  }
357
+};
358
+const shunxu = [
359
+  "gameName",
360
+  "province",
361
+  "warehouseName",
362
+  "materials1",
363
+  "materials2",
364
+  "materials3",
365
+  "materials4",
366
+  "specs",
367
+  "quantity",
368
+  "inboundTime",
369
+  "years",
370
+  "unitPrice",
371
+  "totalPrice",
372
+  "remarks"
373
+];
374
+const headerName = [
375
+  "垂管局",
376
+  "省份",
377
+  "储备仓库",
378
+  "物资大类",
379
+  "物资类别",
380
+  "物资名称",
381
+  "物资单位",
382
+  "规格",
383
+  "数量",
384
+  "入库时间",
385
+  "建议年限",
386
+  "单价(元)",
387
+  "总价(万元)",
388
+  "备注"
389
+];
390
+// const downloadExcel = () => {
391
+//   let data: any = []
392
+//   tableData.value.forEach((item, index) => {
393
+//     let temp: any = [];
394
+//     shunxu.forEach((item2, index2) => {
395
+//       if (item[item2] == null){
396
+//         temp.push('');
397
+//       }else{
398
+//         temp.push(item[item2]);
399
+//       }
400
+
401
+//     })
402
+//     data.push(temp);
403
+//   })
404
+//   const exportPayload = {
405
+//     data: data,
406
+//     tableheader: [headerName],
407
+//     fileName: 'kk',
408
+//     merges: { header: [1, 4], content: [0, 4] },
409
+//     fixedCol:1
410
+//   };
411
+//   console.log(exportPayload);
412
+//   exportExcel(exportPayload);
413
+
414
+// };
415
+const downloadExcel = () => {
416
+  console.log(tableData.value);
417
+  tableData.value.forEach((item) => {
418
+    if (item.unitPrice == "合计") {
419
+      item.totalPrice = item.warehouseTotalPrice;
420
+    }
421
+  });
422
+  tableData.value[0].totalPrice = tableData.value[0].warehouseTotalPrice;
423
+  tableData.value[1].totalPrice = tableData.value[1].warehouseTotalPrice;
424
+  let data: any = [];
425
+  tableData.value.forEach((item, index) => {
426
+    let temp: any = [];
427
+    shunxu.forEach((item2, index2) => {
428
+      if (item[item2] == null || undefined) {
429
+        temp.push("");
430
+      } else {
431
+        temp.push(item[item2]);
432
+      }
433
+    });
434
+    data.push(temp);
435
+  });
436
+
437
+  const exportPayload = {
438
+    data: data,
439
+    tableheader: [headerName],
440
+    fileName: props.fileName || "*",
441
+    merges: { header: [1, 2], content: [0, 3] },
442
+    fixedCol: 1
443
+  };
444
+  exportExcel(exportPayload);
445
+};
446
+
447
+// getSpanArr方法
448
+const getSpanArr = (data: any) => {
449
+  const mergeCol = ["gameName", "province", "warehouseName", "materials1", "materials2"];
450
+  mergeCol.forEach((key: any) => {
451
+    let count = 0; // 用来记录需要合并行的起始位置
452
+    mergeObj.value[key] = []; // 记录每一列的合并信息
453
+    data.forEach((item: any, index: number) => {
454
+      // index == 0表示数据为第一行,直接 push 一个 1
455
+      if (index === 0) {
456
+        mergeObj.value[key].push(1);
457
+      } else {
458
+        // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
459
+        if (item[key] === data[index - 1][key]) {
460
+          mergeObj.value[key][count] += 1;
461
+          mergeObj.value[key].push(0);
462
+        } else {
463
+          // 如果当前行和上一行其值不相等
464
+          count = index; // 记录当前位置
465
+          mergeObj.value[key].push(1); // 重新push 一个 1
466
+        }
467
+      }
468
+    });
469
+  });
470
+  tableLoading.value = false;
471
+};
472
+
473
+//导出
474
+const exportTemplate = async () => {
475
+  try {
476
+    const data = {
477
+      dmUpcode0List: props.payload,
478
+      ...searchList.value
479
+    };
480
+    const response = await exportjzwzmxtjb(data);
481
+    exportBlob(response, props.fileName);
482
+  } catch (error) {
483
+    console.error("Error exporting Excel:", error);
484
+  }
485
+};
486
+const openDetail = (row: any, type: any) => {
487
+  setQuery("/dataStatistics/WarningDetail", { id: row.maintenanceId, type: type });
488
+};
489
+
490
+const cellStyle = () => {
491
+  // return "background-color: yellow !important;";
492
+};
493
+</script>
494
+<style lang="scss" scoped>
495
+::v-deep .success {
496
+  background: #fc7e6d !important;
497
+}
498
+
499
+::v-deep .danger {
500
+  background: #f7bb48 !important;
501
+}
502
+
503
+::v-deep .warning {
504
+  background: #f3f44e !important;
505
+}
506
+
507
+::v-deep .Bgcolor1 {
508
+  background: rgba(242, 233, 11, 0.5) !important;
509
+}
510
+
511
+::v-deep .Bgcolor2 {
512
+  background: rgba(242, 9, 9, 0.5) !important;
513
+}
514
+
515
+::v-deep .Bgcolor3 {
516
+  background: rgba(244, 129, 24, 0.5) !important;
517
+}
518
+</style>

+ 517 - 0
src/views/dataStatistics/warning/detailedTable.vue

@@ -0,0 +1,517 @@
1
+<template>
2
+  <basic-container>
3
+    <el-form class="whole_form">
4
+      <el-row :gutter="20">
5
+        <el-col :span="6" v-if="userInfo.deptType === '1'">
6
+          <el-form-item label="省份">
7
+            <el-select v-model="searchList.provinceSiteIdList" filterable clearable multiple>
8
+              <el-option v-for="item in provinceList" :key="item.id" :label="item.name" :value="item.code" />
9
+            </el-select>
10
+          </el-form-item>
11
+        </el-col>
12
+        <el-col :span="6" v-if="userInfo.deptType === '1'">
13
+          <el-form-item label="储备仓库">
14
+            <el-select
15
+              multiple
16
+              filterable
17
+              clearable
18
+              v-model="searchList.warehouseDeptId"
19
+              :disabled="!searchList.gameDeptId"
20
+              :placeholder="!searchList.gameDeptId ? '请先选择垂管局' : '请选择储备仓库'"
21
+            >
22
+              <el-option
23
+                v-for="item in warehouseList"
24
+                :key="item.deptId"
25
+                :label="item.abbreviationName"
26
+                :value="item.deptId"
27
+              />
28
+            </el-select>
29
+          </el-form-item>
30
+        </el-col>
31
+        <el-col :span="6" v-if="userInfo.deptType === '2'">
32
+          <el-form-item label="储备仓库">
33
+            <el-select v-model="searchList.warehouseDeptId" multiple clearable placeholder="请选择储备仓库">
34
+              <el-option
35
+                v-for="item in warehouseList"
36
+                :key="item.deptId"
37
+                :label="item.abbreviationName"
38
+                :value="item.deptId"
39
+              />
40
+            </el-select>
41
+          </el-form-item>
42
+        </el-col>
43
+        <el-col :span="6">
44
+          <el-form-item label="物资名称">
45
+            <el-input v-model="searchList.dmUpname2" clearable />
46
+          </el-form-item>
47
+        </el-col>
48
+        <el-col :span="6" class="btn_center">
49
+          <el-button :icon="Search" type="primary" @click="getList">查询</el-button>
50
+          <el-button :icon="RefreshRight" @click="clearSearch">清空</el-button>
51
+          <!-- <el-button type="primary" :disable="!tableLoading" :icon="Download" @click="downloadExcel">导出</el-button> -->
52
+          <el-button type="primary" :icon="Download" @click="exportTemplate" v-if="hasBtn('tj:export')">导出</el-button>
53
+        </el-col>
54
+        <!-- <el-col :span="6" class="btn_center">
55
+          <el-button class="color1" @click="handlerColor('success', '1')">超期</el-button>
56
+          <el-button class="color2" @click="handlerColor('danger', '4')">临期</el-button>
57
+          <el-button class="color3" @click="handlerColor('warning', '2')">存储过半</el-button>
58
+        </el-col> -->
59
+      </el-row>
60
+    </el-form>
61
+    <el-table
62
+      :data="tableData"
63
+      :span-method="arraySpanMethod"
64
+      stripe
65
+      border
66
+      style="height: 80%"
67
+      v-loading="tableLoading"
68
+      :row-style="cellStyle"
69
+    >
70
+      <!-- <el-table :data="tableData" stripe border> -->
71
+      <el-table-column fixed type="index" label="序号" header-align="center" align="center" width="60">
72
+        <template #default="scope">
73
+          <span>
74
+            {{ scope.$index + 1 }}
75
+          </span>
76
+        </template>
77
+      </el-table-column>
78
+      <el-table-column
79
+        v-if="userInfo.deptType === '1' || userInfo.deptType === '2'"
80
+        fixed
81
+        prop="provinceName"
82
+        label="省份"
83
+        header-align="center"
84
+        align="center"
85
+      />
86
+      <el-table-column fixed prop="warehouse" label="储备仓库" header-align="center" align="center">
87
+        <template #default="{ row }">
88
+          <p class="font-style;" style="cursor: pointer" @click="openDetail(row, 'look')">
89
+            {{ row.warehouse }}
90
+          </p>
91
+        </template>
92
+      </el-table-column>
93
+      <el-table-column prop="province" label="储存年限过半" class-name="Bgcolor1" header-align="center" align="center">
94
+        <el-table-column
95
+          prop="quantitygb"
96
+          label="数量"
97
+          class-name="Bgcolor1"
98
+          header-align="center"
99
+          align="center"
100
+        ></el-table-column>
101
+        <el-table-column
102
+          prop="totalPricegb"
103
+          label="价值"
104
+          class-name="Bgcolor1"
105
+          header-align="center"
106
+          align="center"
107
+        ></el-table-column>
108
+      </el-table-column>
109
+      <el-table-column
110
+        prop="province"
111
+        label="22年底到达年限"
112
+        class-name="Bgcolor2"
113
+        header-align="center"
114
+        align="center"
115
+      >
116
+        <el-table-column
117
+          prop="quantity22"
118
+          label="数量"
119
+          class-name="Bgcolor2"
120
+          header-align="center"
121
+          align="center"
122
+        ></el-table-column>
123
+        <el-table-column
124
+          prop="totalPrice22"
125
+          label="价值"
126
+          class-name="Bgcolor2"
127
+          header-align="center"
128
+          align="center"
129
+        ></el-table-column>
130
+      </el-table-column>
131
+      <el-table-column
132
+        prop="quantity23"
133
+        label="23年底到达年限"
134
+        class-name="Bgcolor2"
135
+        header-align="center"
136
+        align="center"
137
+      >
138
+        <el-table-column
139
+          prop="quantity23"
140
+          label="数量"
141
+          class-name="Bgcolor2"
142
+          header-align="center"
143
+          align="center"
144
+        ></el-table-column>
145
+        <el-table-column
146
+          prop="totalPrice23"
147
+          label="价值"
148
+          class-name="Bgcolor2"
149
+          header-align="center"
150
+          align="center"
151
+        ></el-table-column>
152
+      </el-table-column>
153
+      <el-table-column
154
+        prop="totalPrice24"
155
+        label="24年底到达年限"
156
+        class-name="Bgcolor3"
157
+        header-align="center"
158
+        align="center"
159
+      >
160
+        <el-table-column
161
+          prop="quantity24"
162
+          label="数量"
163
+          class-name="Bgcolor3"
164
+          header-align="center"
165
+          align="center"
166
+        ></el-table-column>
167
+        <el-table-column
168
+          prop="totalPrice24"
169
+          label="价值"
170
+          class-name="Bgcolor3"
171
+          header-align="center"
172
+          align="center"
173
+        ></el-table-column>
174
+      </el-table-column>
175
+      <el-table-column
176
+        prop="province"
177
+        label="25年底到达年限"
178
+        class-name="Bgcolor3"
179
+        header-align="center"
180
+        align="center"
181
+      >
182
+        <el-table-column
183
+          prop="quantity25"
184
+          label="数量"
185
+          class-name="Bgcolor3"
186
+          header-align="center"
187
+          align="center"
188
+        ></el-table-column>
189
+        <el-table-column
190
+          prop="totalPrice25"
191
+          label="价值"
192
+          class-name="Bgcolor3"
193
+          header-align="center"
194
+          align="center"
195
+        ></el-table-column>
196
+      </el-table-column>
197
+      <el-table-column
198
+        prop="province"
199
+        label="26年底到达年限"
200
+        class-name="Bgcolor3"
201
+        header-align="center"
202
+        align="center"
203
+      >
204
+        <el-table-column
205
+          prop="quantity26"
206
+          label="数量"
207
+          class-name="Bgcolor3"
208
+          header-align="center"
209
+          align="center"
210
+        ></el-table-column>
211
+        <el-table-column
212
+          prop="totalPrice26"
213
+          label="价值"
214
+          class-name="Bgcolor3"
215
+          header-align="center"
216
+          align="center"
217
+        ></el-table-column>
218
+      </el-table-column>
219
+    </el-table>
220
+  </basic-container>
221
+</template>
222
+
223
+<script setup lang="ts">
224
+import { ref, onMounted } from "vue";
225
+import { useGetters } from "@/hooks/storeHooks";
226
+import { getDetaWarninglList, getCityList, getSysTreeDict, exportjzwzmxtjb } from "@/api/dataStatistics/index";
227
+import { Search, RefreshRight, Download } from "@element-plus/icons-vue";
228
+import { exportExcel } from "@/utils/exprot";
229
+import { da } from "element-plus/es/locale";
230
+import { deepClone, handleTree } from "@/utils/util";
231
+import exportBlob from "@/global/exportBlob";
232
+import hasBtn from "@/global/hasBtn";
233
+import { setQuery } from "@/hooks/detailQuery/index";
234
+
235
+import { useDict } from "@/hooks/dict";
236
+
237
+const { Storage_state } = useDict("Storage_state");
238
+
239
+const tableData: any = ref([]);
240
+const tableLoading = ref(false);
241
+const searchList: any = ref({
242
+  gameDeptId: [],
243
+  warehouseDeptId: [],
244
+  dmUpname2: "",
245
+  provinceSiteIdList: []
246
+});
247
+const mergeObj: any = ref({});
248
+const cityList: any = ref([]);
249
+const warehouseList: any = ref([]);
250
+const suppliesList: any = ref([]);
251
+const provinceList: any = ref([]);
252
+
253
+const { userInfo } = useGetters(["userInfo"]);
254
+const props = defineProps({
255
+  payload: {
256
+    type: Array,
257
+    default: () => []
258
+  },
259
+  fileName: {
260
+    type: String,
261
+    default: ""
262
+  }
263
+});
264
+
265
+if (userInfo.value.deptType === "1") {
266
+  // 获取垂管局列表
267
+  getCityList({ deptType: 2 }).then((res: any) => {
268
+    if (res.code === 0) {
269
+      cityList.value = res.data;
270
+      // searchList.value.gameDeptId = [cityList.value[0].deptId];
271
+      getSupplies(searchList.value.gameDeptId);
272
+      getList();
273
+    }
274
+  });
275
+} else {
276
+  // 获取储备仓库
277
+  let postData = {
278
+    parentIdList: [userInfo.value.deptId],
279
+    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
280
+  };
281
+  getCityList(postData).then((res: any) => {
282
+    if (res.code === 0) {
283
+      warehouseList.value = res.data;
284
+      searchList.value.warehouseDeptId =
285
+        warehouseList.value && warehouseList.value.length > 0 ? [warehouseList.value[0].deptId] : [];
286
+      getList();
287
+    }
288
+  });
289
+}
290
+
291
+// 根据省份列表获取储备仓库
292
+const getSupplies = (value: string) => {
293
+  let postData = {
294
+    parentIdList: value,
295
+    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
296
+  };
297
+  getCityList(postData).then((res: any) => {
298
+    if (res.code === 0) {
299
+      warehouseList.value = res.data;
300
+    }
301
+  });
302
+};
303
+
304
+// 获取物资类别
305
+getSysTreeDict({ type: 1, difference: 2, parentCodeList: props.payload }).then((res: any) => {
306
+  if (res.code === 0) {
307
+    suppliesList.value = res.data;
308
+  }
309
+});
310
+// 获取省份
311
+getSysTreeDict({ type: 2, difference: 1 }).then((res: any) => {
312
+  if (res.code === 0) {
313
+    provinceList.value = res.data;
314
+  }
315
+});
316
+
317
+const clearSearch = () => {
318
+  searchList.value = {
319
+    gameDeptId: [],
320
+    warehouseDeptId: [],
321
+    dmUpname2: "",
322
+    provinceSiteIdList: []
323
+  };
324
+  getList();
325
+};
326
+
327
+// 获取表格数据
328
+const getList = () => {
329
+  const data = {
330
+    dmUpcode0List: props.payload,
331
+    ...searchList.value
332
+  };
333
+  tableLoading.value = true;
334
+  getDetaWarninglList(data).then((res: any) => {
335
+    if (res.code === 0) {
336
+      tableData.value = res.data;
337
+      getSpanArr(tableData.value);
338
+    }
339
+  });
340
+};
341
+
342
+const arraySpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
343
+  if (columnIndex === 1) {
344
+    if (rowIndex % 2 === 0) {
345
+      return {
346
+        rowspan: 2,
347
+        colspan: 1
348
+      };
349
+    } else {
350
+      return {
351
+        rowspan: 0,
352
+        colspan: 0
353
+      };
354
+    }
355
+  }
356
+};
357
+const shunxu = [
358
+  "gameName",
359
+  "province",
360
+  "warehouseName",
361
+  "materials1",
362
+  "materials2",
363
+  "materials3",
364
+  "materials4",
365
+  "specs",
366
+  "quantity",
367
+  "inboundTime",
368
+  "years",
369
+  "unitPrice",
370
+  "totalPrice",
371
+  "remarks"
372
+];
373
+const headerName = [
374
+  "垂管局",
375
+  "省份",
376
+  "储备仓库",
377
+  "物资大类",
378
+  "物资类别",
379
+  "物资名称",
380
+  "物资单位",
381
+  "规格",
382
+  "数量",
383
+  "入库时间",
384
+  "建议年限",
385
+  "单价(元)",
386
+  "总价(万元)",
387
+  "备注"
388
+];
389
+// const downloadExcel = () => {
390
+//   let data: any = []
391
+//   tableData.value.forEach((item, index) => {
392
+//     let temp: any = [];
393
+//     shunxu.forEach((item2, index2) => {
394
+//       if (item[item2] == null){
395
+//         temp.push('');
396
+//       }else{
397
+//         temp.push(item[item2]);
398
+//       }
399
+
400
+//     })
401
+//     data.push(temp);
402
+//   })
403
+//   const exportPayload = {
404
+//     data: data,
405
+//     tableheader: [headerName],
406
+//     fileName: 'kk',
407
+//     merges: { header: [1, 4], content: [0, 4] },
408
+//     fixedCol:1
409
+//   };
410
+//   console.log(exportPayload);
411
+//   exportExcel(exportPayload);
412
+
413
+// };
414
+const downloadExcel = () => {
415
+  console.log(tableData.value);
416
+  tableData.value.forEach((item) => {
417
+    if (item.unitPrice == "合计") {
418
+      item.totalPrice = item.warehouseTotalPrice;
419
+    }
420
+  });
421
+  tableData.value[0].totalPrice = tableData.value[0].warehouseTotalPrice;
422
+  tableData.value[1].totalPrice = tableData.value[1].warehouseTotalPrice;
423
+  let data: any = [];
424
+  tableData.value.forEach((item, index) => {
425
+    let temp: any = [];
426
+    shunxu.forEach((item2, index2) => {
427
+      if (item[item2] == null || undefined) {
428
+        temp.push("");
429
+      } else {
430
+        temp.push(item[item2]);
431
+      }
432
+    });
433
+    data.push(temp);
434
+  });
435
+
436
+  const exportPayload = {
437
+    data: data,
438
+    tableheader: [headerName],
439
+    fileName: props.fileName || "*",
440
+    merges: { header: [1, 2], content: [0, 3] },
441
+    fixedCol: 1
442
+  };
443
+  exportExcel(exportPayload);
444
+};
445
+
446
+// getSpanArr方法
447
+const getSpanArr = (data: any) => {
448
+  const mergeCol = ["gameName", "province", "warehouseName", "materials1", "materials2"];
449
+  mergeCol.forEach((key: any) => {
450
+    let count = 0; // 用来记录需要合并行的起始位置
451
+    mergeObj.value[key] = []; // 记录每一列的合并信息
452
+    data.forEach((item: any, index: number) => {
453
+      // index == 0表示数据为第一行,直接 push 一个 1
454
+      if (index === 0) {
455
+        mergeObj.value[key].push(1);
456
+      } else {
457
+        // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
458
+        if (item[key] === data[index - 1][key]) {
459
+          mergeObj.value[key][count] += 1;
460
+          mergeObj.value[key].push(0);
461
+        } else {
462
+          // 如果当前行和上一行其值不相等
463
+          count = index; // 记录当前位置
464
+          mergeObj.value[key].push(1); // 重新push 一个 1
465
+        }
466
+      }
467
+    });
468
+  });
469
+  tableLoading.value = false;
470
+};
471
+
472
+//导出
473
+const exportTemplate = async () => {
474
+  try {
475
+    const data = {
476
+      dmUpcode0List: props.payload,
477
+      ...searchList.value
478
+    };
479
+    const response = await exportjzwzmxtjb(data);
480
+    exportBlob(response, props.fileName);
481
+  } catch (error) {
482
+    console.error("Error exporting Excel:", error);
483
+  }
484
+};
485
+const openDetail = (row: any, type: any) => {
486
+  setQuery("/dataStatistics/WarningDetail", { id: row.maintenanceId, type: type });
487
+};
488
+
489
+const cellStyle = () => {
490
+  // return "background-color: yellow !important;";
491
+};
492
+</script>
493
+<style lang="scss" scoped>
494
+::v-deep .success {
495
+  background: #fc7e6d !important;
496
+}
497
+
498
+::v-deep .danger {
499
+  background: #f7bb48 !important;
500
+}
501
+
502
+::v-deep .warning {
503
+  background: #f3f44e !important;
504
+}
505
+
506
+::v-deep .Bgcolor1 {
507
+  background: rgba(242, 233, 11, 0.5) !important;
508
+}
509
+
510
+::v-deep .Bgcolor2 {
511
+  background: rgba(242, 9, 9, 0.5) !important;
512
+}
513
+
514
+::v-deep .Bgcolor3 {
515
+  background: rgba(244, 129, 24, 0.5) !important;
516
+}
517
+</style>