Selaa lähdekoodia

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

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

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

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

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

@@ -12,7 +12,7 @@
12 12
                     <list-card v-for="item in filteredList" :key="item.id" :showChecked="true"
13 13
                         @click="navigateToDetail(item)">
14 14
                         <template #checkbox
15
-                            v-if="item.instance && item.instance.businessType === 'SEIZURE_REPORT' && currentTab === 'todo'">
15
+                            v-if="canShowCheckbox(item)">
16 16
                             <u-checkbox style="margin-top: 6rpx;" :checked="item.checked" :key="item.id"
17 17
                                 @change="itemChange(item)" />
18 18
                         </template>
@@ -111,7 +111,7 @@
111 111
 import HomeContainer from "@/components/HomeContainer.vue";
112 112
 import HTabs from "@/components/h-tabs/h-tabs.vue";
113 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 115
 import { showMessageTabRedDot } from "@/utils/common.js"
116 116
 export default {
117 117
     components: { HomeContainer, HTabs },
@@ -136,6 +136,9 @@ export default {
136 136
         }
137 137
     },
138 138
     computed: {
139
+        userInfoRoles() {
140
+            return this.$store.state.user && this.$store.state.user.roles
141
+        },
139 142
         tabList() {
140 143
             return [
141 144
                 {
@@ -153,12 +156,41 @@ export default {
153 156
                     title: '已办'
154 157
                 }
155 158
             ];
159
+        },
160
+        // 判断是否显示复选框的条件
161
+        showCheckboxCondition(item) {
162
+            return this.canShowCheckbox(item);
156 163
         }
157 164
     },
158 165
     watch: {
159 166
 
160 167
     },
161 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 194
         async getUnreadCount() {
163 195
             try {
164 196
                 const query = {
@@ -233,7 +265,7 @@ export default {
233 265
             return ''
234 266
         },
235 267
         navigateToDetail(row) {
236
-            
268
+
237 269
             let type = 'view'; // 默认查看模式
238 270
             if (this.currentTab == 'msg') {
239 271
                 const { businessType, businessId, instanceId } = row;
@@ -254,6 +286,7 @@ export default {
254 286
                 });
255 287
                 return;
256 288
             }
289
+
257 290
             const { instance, id, nodeDefinition } = row;
258 291
             const { businessId = "", businessType = "", id: instanceId } = instance || {};
259 292
             const { nodeCode = "" } = nodeDefinition || {};
@@ -278,7 +311,7 @@ export default {
278 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 315
                 url = `/pages/problemRect/index?params=${encodeURIComponent(JSON.stringify(obj))}`;
283 316
             }
284 317
             if (url) {
@@ -315,8 +348,8 @@ export default {
315 348
             this.$nextTick(() => {
316 349
                 this.filteredList = this.filteredList.map(item => ({
317 350
                     ...item,
318
-                    //只有查获可以批量审批
319
-                    ...(item.instance && item.instance.businessType === 'SEIZURE_REPORT' ? { checked: e } : {}),
351
+                    //查获和部门检查可以批量审批
352
+                    ...(this.canShowCheckbox(item) ? { checked: e } : {}),
320 353
                 }));
321 354
                 this.selectedItems = this.filteredList.filter(item => item.checked);
322 355
             })
@@ -332,11 +365,22 @@ export default {
332 365
             }
333 366
 
334 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 385
                 uni.showToast({
342 386
                     title: '批量驳回成功',
@@ -371,11 +415,22 @@ export default {
371 415
             }
372 416
 
373 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 435
                 uni.showToast({
381 436
                     title: '批量通过成功',

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 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 172
  * 找出deptType为BRIGADE的节点
171 173
  * @param {Array} tree - 树形结构数据
172 174
  * @param {boolean} includeFullData - 是否包含节点的完整数据,默认false