Kaynağa Gözat

添加明细表

zhuqingsong 1 yıl önce
ebeveyn
işleme
59b8bac67a

+ 1 - 2
src/views/dataStatistics/components/detailedTable1.vue

@@ -273,8 +273,7 @@ const clearSearch = () => {
273 273
 const getList = () => {
274 274
   const data = {
275 275
     dmUpcode0List: props.payload,
276
-    ...searchList.value,
277
-    isMaintenance: true
276
+    ...searchList.value
278 277
   };
279 278
   tableLoading.value = true;
280 279
   getDetailList(data).then((res: any) => {

+ 42 - 84
src/views/dataStatistics/warning/detail.vue

@@ -2,44 +2,6 @@
2 2
   <basic-container>
3 3
     <el-form class="whole_form">
4 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 5
         <el-col :span="6">
44 6
           <el-form-item label="物资名称">
45 7
             <el-input v-model="searchList.dmUpname2" clearable />
@@ -240,28 +202,30 @@ const { Storage_state } = useDict("Storage_state");
240 202
 const tableData: any = ref([]);
241 203
 const tableLoading = ref(false);
242 204
 const searchList: any = ref({
243
-  gameDeptId: [],
244
-  warehouseDeptId: [],
245
-  dmUpname2: "",
246
-  provinceSiteIdList: []
205
+  dmUpname2: ""
247 206
 });
248 207
 const mergeObj: any = ref({});
249 208
 const cityList: any = ref([]);
250 209
 const warehouseList: any = ref([]);
251 210
 const suppliesList: any = ref([]);
252 211
 const provinceList: any = ref([]);
253
-
212
+import { getQuery } from "@/hooks/detailQuery/index";
254 213
 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
-});
214
+const props = getQuery("/dataStatistics/WarningDetail");
215
+// const props = defineProps({
216
+//   payload: {
217
+//     type: Array,
218
+//     default: () => []
219
+//   },
220
+//   fileName: {
221
+//     type: String,
222
+//     default: ""
223
+//   },
224
+//   deptId: {
225
+//     type: String,
226
+//     default: ""
227
+//   }
228
+// });
265 229
 
266 230
 if (userInfo.value.deptType === "1") {
267 231
   // 获取垂管局列表
@@ -277,7 +241,7 @@ if (userInfo.value.deptType === "1") {
277 241
   // 获取储备仓库
278 242
   let postData = {
279 243
     parentIdList: [userInfo.value.deptId],
280
-    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
244
+    warehouseType: props.dmUpcode0List
281 245
   };
282 246
   getCityList(postData).then((res: any) => {
283 247
     if (res.code === 0) {
@@ -293,7 +257,7 @@ if (userInfo.value.deptType === "1") {
293 257
 const getSupplies = (value: string) => {
294 258
   let postData = {
295 259
     parentIdList: value,
296
-    warehouseType: props.fileName.substr(0, 2) == "救灾" ? 200 : 100
260
+    warehouseType: props.dmUpcode0List
297 261
   };
298 262
   getCityList(postData).then((res: any) => {
299 263
     if (res.code === 0) {
@@ -302,34 +266,21 @@ const getSupplies = (value: string) => {
302 266
   });
303 267
 };
304 268
 
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 269
 const clearSearch = () => {
319 270
   searchList.value = {
320
-    gameDeptId: [],
321
-    warehouseDeptId: [],
322
-    dmUpname2: "",
323
-    provinceSiteIdList: []
271
+    dmUpname2: ""
324 272
   };
325 273
   getList();
326 274
 };
327 275
 
328 276
 // 获取表格数据
329 277
 const getList = () => {
278
+  console.log(props.deptId, "props.deptId");
330 279
   const data = {
331
-    dmUpcode0List: props.payload,
332
-    ...searchList.value
280
+    dmUpcode0List: props.dmUpcode0List,
281
+    ...searchList.value,
282
+    isDetails: true,
283
+    deptId: props.deptId
333 284
   };
334 285
   tableLoading.value = true;
335 286
   getDetaWarninglList(data).then((res: any) => {
@@ -341,17 +292,24 @@ const getList = () => {
341 292
 };
342 293
 
343 294
 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
-      };
295
+  if (columnIndex === 1 || columnIndex === 2) {
296
+    const currentValue = row[column.property];
297
+    const preRow = tableData.value[rowIndex - 1];
298
+    const preValue = preRow ? preRow[column.property] : null;
299
+    if (currentValue === preValue) {
300
+      return { rowspan: 0, colspan: 0 };
350 301
     } else {
351
-      return {
352
-        rowspan: 0,
353
-        colspan: 0
354
-      };
302
+      let rowspan = 1;
303
+      for (let i = rowIndex + 1; i < tableData.value.length; i++) {
304
+        const nextRow = tableData.value[i];
305
+        const nextValue = nextRow[column.property];
306
+        if (nextValue === currentValue) {
307
+          rowspan++;
308
+        } else {
309
+          break;
310
+        }
311
+      }
312
+      return { rowspan, colspan: 1 };
355 313
     }
356 314
   }
357 315
 };

+ 23 - 16
src/views/dataStatistics/warning/detailedTable.vue

@@ -40,16 +40,16 @@
40 40
             </el-select>
41 41
           </el-form-item>
42 42
         </el-col>
43
-        <el-col :span="6">
43
+        <!-- <el-col :span="6">
44 44
           <el-form-item label="物资名称">
45 45
             <el-input v-model="searchList.dmUpname2" clearable />
46 46
           </el-form-item>
47
-        </el-col>
47
+        </el-col> -->
48 48
         <el-col :span="6" class="btn_center">
49 49
           <el-button :icon="Search" type="primary" @click="getList">查询</el-button>
50 50
           <el-button :icon="RefreshRight" @click="clearSearch">清空</el-button>
51 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>
52
+          <!-- <el-button type="primary" :icon="Download" @click="exportTemplate" v-if="hasBtn('tj:export')">导出</el-button> -->
53 53
         </el-col>
54 54
         <!-- <el-col :span="6" class="btn_center">
55 55
           <el-button class="color1" @click="handlerColor('success', '1')">超期</el-button>
@@ -241,7 +241,6 @@ const tableLoading = ref(false);
241 241
 const searchList: any = ref({
242 242
   gameDeptId: [],
243 243
   warehouseDeptId: [],
244
-  dmUpname2: "",
245 244
   provinceSiteIdList: []
246 245
 });
247 246
 const mergeObj: any = ref({});
@@ -318,7 +317,6 @@ const clearSearch = () => {
318 317
   searchList.value = {
319 318
     gameDeptId: [],
320 319
     warehouseDeptId: [],
321
-    dmUpname2: "",
322 320
     provinceSiteIdList: []
323 321
   };
324 322
   getList();
@@ -328,7 +326,8 @@ const clearSearch = () => {
328 326
 const getList = () => {
329 327
   const data = {
330 328
     dmUpcode0List: props.payload,
331
-    ...searchList.value
329
+    ...searchList.value,
330
+    isMaintenance: true
332 331
   };
333 332
   tableLoading.value = true;
334 333
   getDetaWarninglList(data).then((res: any) => {
@@ -341,16 +340,23 @@ const getList = () => {
341 340
 
342 341
 const arraySpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
343 342
   if (columnIndex === 1) {
344
-    if (rowIndex % 2 === 0) {
345
-      return {
346
-        rowspan: 2,
347
-        colspan: 1
348
-      };
343
+    const currentValue = row[column.property];
344
+    const preRow = tableData.value[rowIndex - 1];
345
+    const preValue = preRow ? preRow[column.property] : null;
346
+    if (currentValue === preValue) {
347
+      return { rowspan: 0, colspan: 0 };
349 348
     } else {
350
-      return {
351
-        rowspan: 0,
352
-        colspan: 0
353
-      };
349
+      let rowspan = 1;
350
+      for (let i = rowIndex + 1; i < tableData.value.length; i++) {
351
+        const nextRow = tableData.value[i];
352
+        const nextValue = nextRow[column.property];
353
+        if (nextValue === currentValue) {
354
+          rowspan++;
355
+        } else {
356
+          break;
357
+        }
358
+      }
359
+      return { rowspan, colspan: 1 };
354 360
     }
355 361
   }
356 362
 };
@@ -483,7 +489,8 @@ const exportTemplate = async () => {
483 489
   }
484 490
 };
485 491
 const openDetail = (row: any, type: any) => {
486
-  setQuery("/dataStatistics/WarningDetail", { id: row.maintenanceId, type: type });
492
+  console.log(row.deptId);
493
+  setQuery("/dataStatistics/WarningDetail", { deptId: row.deptId, type: type, dmUpcode0List: props.payload });
487 494
 };
488 495
 
489 496
 const cellStyle = () => {