Browse Source

feat(approve): 添加部门检查批量审批功能并优化界面显示

- 新增部门检查的批量审批通过和驳回接口
- 调整待办列表中复选框显示逻辑,支持部门检查任务
- 修改检查表单中的部门选择标签显示
- 优化文件选择器样式和权限判断逻辑
huoyi 2 months ago
parent
commit
394237f175

+ 17 - 0
src/api/approve/approve.js

@@ -59,4 +59,21 @@ export const getApproveList = (data) => {
59
         method: 'get',
59
         method: 'get',
60
         data
60
         data
61
     })
61
     })
62
+}
63
+
64
+//整改审批通过
65
+export const rectifyApprovePass = (data) => {
66
+    return request({
67
+        url: `/check/checkCorrection/approveTaskBatch`,
68
+        method: 'post',
69
+        data
70
+    })
71
+}
72
+//整改审批驳回
73
+export const rectifyApproveReject = (data) => {
74
+    return request({
75
+        url: `/check/checkCorrection/rejectTaskBatch`,
76
+        method: 'post',
77
+        data
78
+    })
62
 }
79
 }

+ 9 - 9
src/pages/checklist/index.vue

@@ -24,10 +24,10 @@
24
                                     :disabled="true" />
24
                                     :disabled="true" />
25
                             </uni-forms-item>
25
                             </uni-forms-item>
26
                             <uni-forms-item :label="getCheckLabel" :name="getCheckFieldName" required>
26
                             <uni-forms-item :label="getCheckLabel" :name="getCheckFieldName" required>
27
-                                <uni-data-picker v-if="getCheckLabel == '被检查'" :localdata="departments"
27
+                                <uni-data-picker v-if="getCheckLabel == '被检查主管'" :localdata="departments"
28
                                     :popup-title="`请选择${getCheckLabel}`" v-model="formData.checkedDepartmentId"
28
                                     :popup-title="`请选择${getCheckLabel}`" v-model="formData.checkedDepartmentId"
29
                                     @change="handlecheckedDepartmentIdChange" :readonly="formDisabled" />
29
                                     @change="handlecheckedDepartmentIdChange" :readonly="formDisabled" />
30
-                                <uni-data-picker v-if="getCheckLabel == '被检查主管'" :localdata="brigades"
30
+                                <uni-data-picker v-if="getCheckLabel == '被检查大队'" :localdata="brigades"
31
                                     :popup-title="`请选择${getCheckLabel}`" v-model="formData.checkedBrigadeId"
31
                                     :popup-title="`请选择${getCheckLabel}`" v-model="formData.checkedBrigadeId"
32
                                     @change="handlecheckedBrigadeIdChange" :readonly="formDisabled" />
32
                                     @change="handlecheckedBrigadeIdChange" :readonly="formDisabled" />
33
                                 <uni-data-picker v-if="getCheckLabel == '被检查班组'" :localdata="teams"
33
                                 <uni-data-picker v-if="getCheckLabel == '被检查班组'" :localdata="teams"
@@ -142,7 +142,7 @@ import TextSwitch from "@/components/text-switch/text-switch.vue"
142
 import { checkedLevelEnums } from "@/utils/enums.js"
142
 import { checkedLevelEnums } from "@/utils/enums.js"
143
 import UnqualifiedPersonnel from "./components/unqualified.vue"
143
 import UnqualifiedPersonnel from "./components/unqualified.vue"
144
 import { treeSelectByType } from "@/api/system/common"
144
 import { treeSelectByType } from "@/api/system/common"
145
-import { buildTeamOptions, buildDepartmentOptions, buildBrigadeOptions } from '@/utils/common'
145
+import { buildTeamOptions, buildDepartmentOptions, buildBrigadeOptions,buildManagerOptions } from '@/utils/common'
146
 import useDictMixin from '@/utils/dict'
146
 import useDictMixin from '@/utils/dict'
147
 import { getDeptRoleUser } from "@/api/check/checklist.js"
147
 import { getDeptRoleUser } from "@/api/check/checklist.js"
148
 import { addDraftInspection, submitInspection, getInspectionListById } from '@/api/check/checkReward.js'
148
 import { addDraftInspection, submitInspection, getInspectionListById } from '@/api/check/checkReward.js'
@@ -199,10 +199,10 @@ export default {
199
                 return '被检查人'
199
                 return '被检查人'
200
             }
200
             }
201
             if (this.formData.checkedLevel == checkedLevelEnums.DEPARTMENT_LEVEL) {
201
             if (this.formData.checkedLevel == checkedLevelEnums.DEPARTMENT_LEVEL) {
202
-                return '被检查'
202
+                return '被检查主管'
203
             }
203
             }
204
             if (this.formData.checkedLevel == checkedLevelEnums.BRIGADE_LEVEL) {
204
             if (this.formData.checkedLevel == checkedLevelEnums.BRIGADE_LEVEL) {
205
-                return '被检查主管'
205
+                return '被检查大队'
206
             }
206
             }
207
         },
207
         },
208
         // 获取验证字段名
208
         // 获取验证字段名
@@ -240,14 +240,14 @@ export default {
240
             if (this.formData.checkedLevel == checkedLevelEnums.DEPARTMENT_LEVEL) {
240
             if (this.formData.checkedLevel == checkedLevelEnums.DEPARTMENT_LEVEL) {
241
                 changeRule = {
241
                 changeRule = {
242
                     checkedDepartmentId: {
242
                     checkedDepartmentId: {
243
-                        rules: [{ required: true, errorMessage: '请选择被检查' }]
243
+                        rules: [{ required: true, errorMessage: '请选择被检查主管' }]
244
                     }
244
                     }
245
                 }
245
                 }
246
             }
246
             }
247
             if (this.formData.checkedLevel == checkedLevelEnums.BRIGADE_LEVEL) {
247
             if (this.formData.checkedLevel == checkedLevelEnums.BRIGADE_LEVEL) {
248
                 changeRule = {
248
                 changeRule = {
249
                     checkedBrigadeId: {
249
                     checkedBrigadeId: {
250
-                        rules: [{ required: true, errorMessage: '请选择被检查主管' }]
250
+                        rules: [{ required: true, errorMessage: '请选择被检查大队' }]
251
                     }
251
                     }
252
                 }
252
                 }
253
             }
253
             }
@@ -290,7 +290,7 @@ export default {
290
     data() {
290
     data() {
291
         return {
291
         return {
292
             teams: [],//被检查班组选项
292
             teams: [],//被检查班组选项
293
-            departments: [],//被检查选项
293
+            departments: [],//被检查主管选项
294
             userOptions: [],//全部的人
294
             userOptions: [],//全部的人
295
             brigades: [],
295
             brigades: [],
296
             checkcheckedTeamIdOptions: [],
296
             checkcheckedTeamIdOptions: [],
@@ -505,7 +505,7 @@ export default {
505
             const deptTree = await getDeptList();
505
             const deptTree = await getDeptList();
506
             this.deptTree = deptTree.data || [];
506
             this.deptTree = deptTree.data || [];
507
             this.teams = buildTeamOptions(deptTree.data || []);
507
             this.teams = buildTeamOptions(deptTree.data || []);
508
-            this.departments = buildDepartmentOptions(deptTree.data || []);
508
+            this.departments = buildManagerOptions(deptTree.data || []);
509
             this.brigades = buildBrigadeOptions(deptTree.data || []);
509
             this.brigades = buildBrigadeOptions(deptTree.data || []);
510
             console.log(this.departments, "this.departments")
510
             console.log(this.departments, "this.departments")
511
             const [positionRes] = await Promise.all([
511
             const [positionRes] = await Promise.all([

+ 70 - 15
src/pages/myToDoList/index.vue

@@ -12,7 +12,7 @@
12
                     <list-card v-for="item in filteredList" :key="item.id" :showChecked="true"
12
                     <list-card v-for="item in filteredList" :key="item.id" :showChecked="true"
13
                         @click="navigateToDetail(item)">
13
                         @click="navigateToDetail(item)">
14
                         <template #checkbox
14
                         <template #checkbox
15
-                            v-if="item.instance && item.instance.businessType === 'SEIZURE_REPORT' && currentTab === 'todo'">
15
+                            v-if="canShowCheckbox(item)">
16
                             <u-checkbox style="margin-top: 6rpx;" :checked="item.checked" :key="item.id"
16
                             <u-checkbox style="margin-top: 6rpx;" :checked="item.checked" :key="item.id"
17
                                 @change="itemChange(item)" />
17
                                 @change="itemChange(item)" />
18
                         </template>
18
                         </template>
@@ -111,7 +111,7 @@
111
 import HomeContainer from "@/components/HomeContainer.vue";
111
 import HomeContainer from "@/components/HomeContainer.vue";
112
 import HTabs from "@/components/h-tabs/h-tabs.vue";
112
 import HTabs from "@/components/h-tabs/h-tabs.vue";
113
 import { listCheckApprovalCcDetails, listCheckPendingTasks, listCheckFinishedTasks, updateCheckApprovalCcDetails } from "@/api/myToDoList/myToDoList.js"
113
 import { listCheckApprovalCcDetails, listCheckPendingTasks, listCheckFinishedTasks, updateCheckApprovalCcDetails } from "@/api/myToDoList/myToDoList.js"
114
-import { approvePassBatch, approveRejectBatch } from "@/api/approve/approve.js";
114
+import { approvePassBatch, approveRejectBatch,rectifyApprovePass,rectifyApproveReject } from "@/api/approve/approve.js";
115
 import { showMessageTabRedDot } from "@/utils/common.js"
115
 import { showMessageTabRedDot } from "@/utils/common.js"
116
 export default {
116
 export default {
117
     components: { HomeContainer, HTabs },
117
     components: { HomeContainer, HTabs },
@@ -136,6 +136,9 @@ export default {
136
         }
136
         }
137
     },
137
     },
138
     computed: {
138
     computed: {
139
+        userInfoRoles() {
140
+            return this.$store.state.user && this.$store.state.user.roles
141
+        },
139
         tabList() {
142
         tabList() {
140
             return [
143
             return [
141
                 {
144
                 {
@@ -153,12 +156,41 @@ export default {
153
                     title: '已办'
156
                     title: '已办'
154
                 }
157
                 }
155
             ];
158
             ];
159
+        },
160
+        // 判断是否显示复选框的条件
161
+        showCheckboxCondition(item) {
162
+            return this.canShowCheckbox(item);
156
         }
163
         }
157
     },
164
     },
158
     watch: {
165
     watch: {
159
 
166
 
160
     },
167
     },
161
     methods: {
168
     methods: {
169
+        // 判断是否显示复选框的条件
170
+        canShowCheckbox(item) {
171
+      
172
+            return ((item.instance && item.instance.businessType === 'SEIZURE_REPORT') || 
173
+                   (item.instance && item.instance.businessType === 'DEPARTMENT_CHECK' && 
174
+                    this.userInfoRoles.includes('jingli'))) && 
175
+                   this.currentTab === 'todo';
176
+        },
177
+
178
+        // 根据任务类型分组
179
+        groupTasksByType(selectedItems) {
180
+            const seizureTaskIds = [];
181
+            const departmentTaskIds = [];
182
+
183
+            selectedItems.forEach(item => {
184
+                if (item.instance && item.instance.businessType === 'SEIZURE_REPORT') {
185
+                    seizureTaskIds.push(item.id);
186
+                } else if (item.instance && item.instance.businessType === 'DEPARTMENT_CHECK' && 
187
+                          this.userInfoRoles.includes('jingli')) {
188
+                    departmentTaskIds.push(item.id);
189
+                }
190
+            });
191
+
192
+            return { seizureTaskIds, departmentTaskIds };
193
+        },
162
         async getUnreadCount() {
194
         async getUnreadCount() {
163
             try {
195
             try {
164
                 const query = {
196
                 const query = {
@@ -233,7 +265,7 @@ export default {
233
             return ''
265
             return ''
234
         },
266
         },
235
         navigateToDetail(row) {
267
         navigateToDetail(row) {
236
-            
268
+
237
             let type = 'view'; // 默认查看模式
269
             let type = 'view'; // 默认查看模式
238
             if (this.currentTab == 'msg') {
270
             if (this.currentTab == 'msg') {
239
                 const { businessType, businessId, instanceId } = row;
271
                 const { businessType, businessId, instanceId } = row;
@@ -254,6 +286,7 @@ export default {
254
                 });
286
                 });
255
                 return;
287
                 return;
256
             }
288
             }
289
+
257
             const { instance, id, nodeDefinition } = row;
290
             const { instance, id, nodeDefinition } = row;
258
             const { businessId = "", businessType = "", id: instanceId } = instance || {};
291
             const { businessId = "", businessType = "", id: instanceId } = instance || {};
259
             const { nodeCode = "" } = nodeDefinition || {};
292
             const { nodeCode = "" } = nodeDefinition || {};
@@ -278,7 +311,7 @@ export default {
278
                 url = `/pages/seizedReported/index?params=${encodeURIComponent(JSON.stringify(obj))}`;
311
                 url = `/pages/seizedReported/index?params=${encodeURIComponent(JSON.stringify(obj))}`;
279
             }
312
             }
280
             // 巡检对应个人 班组  科室
313
             // 巡检对应个人 班组  科室
281
-            if (['PERSONAL_CHECK', 'GROUP_CHECK', 'SECTION_CHECK', 'BRIGADE_CHECK'].includes(businessType) || this.currentTab == 'msg') {
314
+            if (['PERSONAL_CHECK', 'GROUP_CHECK', 'SECTION_CHECK', 'BRIGADE_CHECK', 'DEPARTMENT_CHECK'].includes(businessType) || this.currentTab == 'msg') {
282
                 url = `/pages/problemRect/index?params=${encodeURIComponent(JSON.stringify(obj))}`;
315
                 url = `/pages/problemRect/index?params=${encodeURIComponent(JSON.stringify(obj))}`;
283
             }
316
             }
284
             if (url) {
317
             if (url) {
@@ -315,8 +348,8 @@ export default {
315
             this.$nextTick(() => {
348
             this.$nextTick(() => {
316
                 this.filteredList = this.filteredList.map(item => ({
349
                 this.filteredList = this.filteredList.map(item => ({
317
                     ...item,
350
                     ...item,
318
-                    //只有查获可以批量审批
319
-                    ...(item.instance && item.instance.businessType === 'SEIZURE_REPORT' ? { checked: e } : {}),
351
+                    //查获和部门检查可以批量审批
352
+                    ...(this.canShowCheckbox(item) ? { checked: e } : {}),
320
                 }));
353
                 }));
321
                 this.selectedItems = this.filteredList.filter(item => item.checked);
354
                 this.selectedItems = this.filteredList.filter(item => item.checked);
322
             })
355
             })
@@ -332,11 +365,22 @@ export default {
332
             }
365
             }
333
 
366
 
334
             try {
367
             try {
335
-                // 提取选中项的任务ID数组
336
-                const taskIds = this.selectedItems.map(item => item.id);
368
+                // 根据任务类型分组
369
+                const { seizureTaskIds, departmentTaskIds } = this.groupTasksByType(this.selectedItems);
370
+
371
+                // 分别调用不同的驳回接口
372
+                const promises = [];
373
+                
374
+                if (seizureTaskIds.length > 0) {
375
+                    promises.push(approveRejectBatch(seizureTaskIds));
376
+                }
377
+                
378
+                if (departmentTaskIds.length > 0) {
379
+                    promises.push(rectifyApproveReject({taskIdList: departmentTaskIds}));
380
+                }
337
 
381
 
338
-                // 调用批量驳回接口
339
-                await approveRejectBatch(taskIds);
382
+                // 等待所有接口调用完成
383
+                await Promise.all(promises);
340
 
384
 
341
                 uni.showToast({
385
                 uni.showToast({
342
                     title: '批量驳回成功',
386
                     title: '批量驳回成功',
@@ -371,11 +415,22 @@ export default {
371
             }
415
             }
372
 
416
 
373
             try {
417
             try {
374
-                // 提取选中项的任务ID数组
375
-                const taskIds = this.selectedItems.map(item => item.id);
376
-
377
-                // 调用批量通过接口
378
-                await approvePassBatch(taskIds);
418
+                // 根据任务类型分组
419
+                const { seizureTaskIds, departmentTaskIds } = this.groupTasksByType(this.selectedItems);
420
+
421
+                // 分别调用不同的通过接口
422
+                const promises = [];
423
+                
424
+                if (seizureTaskIds.length > 0) {
425
+                    promises.push(approvePassBatch(seizureTaskIds));
426
+                }
427
+                
428
+                if (departmentTaskIds.length > 0) {
429
+                    promises.push(rectifyApprovePass({ taskIdList: departmentTaskIds }));
430
+                }
431
+debugger
432
+                // 等待所有接口调用完成
433
+                await Promise.all(promises);
379
 
434
 
380
                 uni.showToast({
435
                 uni.showToast({
381
                     title: '批量通过成功',
436
                     title: '批量通过成功',

File diff suppressed because it is too large
+ 9 - 9
src/pages/problemRect/index.vue


+ 2 - 0
src/utils/common.js

@@ -167,6 +167,8 @@ export function buildDepartmentOptions(tree = [], includeFullData = false) {
167
 }
167
 }
168
 
168
 
169
 /**
169
 /**
170
+ *
171
+/**
170
  * 找出deptType为BRIGADE的节点
172
  * 找出deptType为BRIGADE的节点
171
  * @param {Array} tree - 树形结构数据
173
  * @param {Array} tree - 树形结构数据
172
  * @param {boolean} includeFullData - 是否包含节点的完整数据,默认false
174
  * @param {boolean} includeFullData - 是否包含节点的完整数据,默认false