@lambo-design-mobile/workflow-approve 1.0.0-beta.2 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
  # Changelog
2
+ ## [1.0.0-beta.4](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/workflow-approve@1.0.0-beta.3...@lambo-design-mobile/workflow-approve@1.0.0-beta.4) (2024-11-11)
3
+
4
+
5
+ ### 🐛 Bug Fixes | Bug 修复
6
+
7
+ * **@lambo-design-mobile/workflow-approve:** 修复待办列表卡片组件中的 URL错误 ([8ca75a9](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/commit/8ca75a9278313ebc4679b9e14546066085678e81))
8
+
9
+ ## [1.0.0-beta.3](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/workflow-approve@1.0.0-beta.2...@lambo-design-mobile/workflow-approve@1.0.0-beta.3) (2024-11-04)
10
+
2
11
  ## [1.0.0-beta.2](http://git.inspur.com/ecbh/lambo-design/lambo-design/-/compare/@lambo-design-mobile/workflow-approve@1.0.0-beta.1...@lambo-design-mobile/workflow-approve@1.0.0-beta.2) (2024-10-10)
3
12
 
4
13
  ## 1.0.0-beta.1 (2024-10-09)
package/api.js CHANGED
@@ -243,6 +243,17 @@ export const batchApproval = (status, flowIds, auditOpinion) => {
243
243
  }));
244
244
  }
245
245
 
246
+ export const getProcessType = (proType) => {
247
+ const params = {
248
+ proType: proType,
249
+ };
250
+ return ajax.request({
251
+ url: config.smartFlowServerContext + "/manage/processType/lists",
252
+ method: 'get',
253
+ params: params
254
+ })
255
+ }
256
+
246
257
  export const getUserList = (offset, limit, searchForm = {}) => {
247
258
 
248
259
  // 处理 searchForm 的各个字段,确保即使未传值也有默认空字符串
@@ -250,7 +261,7 @@ export const getUserList = (offset, limit, searchForm = {}) => {
250
261
  offset: offset,
251
262
  limit: limit,
252
263
  orgTreeType: "00",
253
- permScopeList: "all",
264
+ permScopeList: searchForm.permScopeList || 'all',
254
265
  userId: searchForm.userId || '',
255
266
  userName: searchForm.userName || '',
256
267
  organId: searchForm.organId || '',
@@ -274,4 +285,45 @@ export const getOrgRootTree = () => {
274
285
  method: 'get',
275
286
  params: params,
276
287
  });
288
+ }
289
+
290
+ export const getOrgSubNodes = (organCode) => {
291
+ const params = {
292
+ treeTypeId: "00",
293
+ organCode: organCode,
294
+ };
295
+ return ajax.request({
296
+ url: config.upmsServerContext + "/manage/ucOrgan/getOrgSubNodes",
297
+ method: 'get',
298
+ params: params,
299
+ });
300
+ }
301
+
302
+ export const getPosition = (positionId) => {
303
+ const params = {
304
+ positionId: positionId,
305
+ };
306
+ return ajax.request({
307
+ url: config.smartFlowServerContext + "/manage/position/get",
308
+ method: 'get',
309
+ params: params
310
+ })
311
+ }
312
+
313
+ export const getRole = (roleId) => {
314
+ return ajax.request({
315
+ url: config.upmsServerContext + "/manage/role/get/" + roleId,
316
+ method: 'get',
317
+ })
318
+ }
319
+
320
+ export const getOrgan = (organId) => {
321
+ const data = {
322
+ orgTreeType: "00",
323
+ };
324
+ return ajax.request({
325
+ url: config.upmsServerContext + "/manage/org/get/" + organId,
326
+ method: 'post',
327
+ data
328
+ })
277
329
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design-mobile/workflow-approve",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -13,9 +13,9 @@
13
13
  "bpmn-js": "^7.3.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@lambo-design-mobile/lambo-scan-code": "^1.0.0-beta.1",
17
16
  "@lambo-design-mobile/upload-file": "^1.0.0-beta.9",
18
- "@lambo-design-mobile/shared": "^1.0.0-beta.8"
17
+ "@lambo-design-mobile/lambo-scan-code": "^1.0.0-beta.1",
18
+ "@lambo-design-mobile/shared": "^1.0.0-beta.12"
19
19
  },
20
20
  "scripts": {
21
21
  "release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
@@ -62,7 +62,7 @@
62
62
  <van-cell center>
63
63
  <template #icon>
64
64
  <div
65
- v-if="['通过', '跳转指定节点'].includes(getAuditStatus(item.auditResult).text)"
65
+ v-if="['通过','流程发起','跳转指定节点'].includes(getAuditStatus(item.auditResult).text)"
66
66
  class="completed-icon">
67
67
  <van-icon class="iconfont" class-prefix='icon' :name=getAuditStatus(item.auditResult).icon
68
68
  size="30px" color="#fff"/>
@@ -84,7 +84,7 @@
84
84
  </div>
85
85
  </template>
86
86
  <template #label>
87
- <div>{{ item.startDate }}{{ item.auditDate }}</div>
87
+ <div>{{ item.auditDate || item.createTime }}</div>
88
88
  </template>
89
89
  <template #default>
90
90
  <span :style="{ color: getAuditStatus(item.auditResult).color }">{{
@@ -195,47 +195,49 @@
195
195
  :is-link="true" :arrow-direction="detailsVisible[index] ? 'down' : ''">
196
196
  </van-cell>
197
197
  <div v-if="detailsVisible[index] && item.personType === 'candidate'">
198
- <van-cell @click="clickCandidateGroup()" title-style="padding-left:10px" title="候选用户"
199
- :value="(item.candidateGroups?.users ?? []).map(user => user.name).join(',')">
200
- </van-cell>
201
- <van-cell @click="clickCandidateGroup()" title-style="padding-left:10px" title="候选岗位"
202
- :value="(item.candidateGroups?.positions ?? []).map(position => position.name).join(',')">
203
- </van-cell>
204
- <van-cell @click="clickCandidateGroup()" title-style="padding-left:10px" title="候选角色"
205
- :value="(item.candidateGroups?.roles ?? []).map(role => role.name).join(',')">
206
- </van-cell>
207
- <van-cell @click="clickCandidateGroup()" title-style="padding-left:10px" title="候选组织"
208
- :value="(item.candidateGroups?.organs ?? []).map(organ => organ.name).join(',')">
209
- </van-cell>
198
+ <van-field @click="handleSelectUserPopupShow(index)" label="候选用户" readonly placeholder="点击选择"
199
+ :value="(item.candidateGroups?.users ?? []).map(user => user.name).join(',')">
200
+ </van-field>
201
+ <van-field @click="handleSelectPositionPopupShow(index)" label="候选岗位" readonly placeholder="点击选择"
202
+ :value="(item.candidateGroups?.positions ?? []).map(position => position.name).join(',')">
203
+ </van-field>
204
+ <van-field @click="handleSelectRolePopupShow(index)" label="候选角色" readonly placeholder="点击选择"
205
+ :value="(item.candidateGroups?.roles ?? []).map(role => role.name).join(',')">
206
+ </van-field>
207
+ <van-field @click="handleSelectOrganizePopupShow(index)" label="候选组织" readonly placeholder="点击选择"
208
+ :value="(item.candidateGroups?.organs ?? []).map(organ => organ.name).join(',')">
209
+ </van-field>
210
210
  </div>
211
- <van-cell center title="停留时间">
212
- <template #default>
213
- <div style="display: flex; align-items: center;">
214
- <div style="display: flex; align-items: center; margin-right: 16px;">
215
- <van-stepper disable-input button-size="22" min="0" v-model="item.remainDay"/>
216
- <span style="margin-left: 4px;">天</span>
217
- </div>
211
+ <div v-if="handleButtons.includes('appointTimeoutTime')">
212
+ <van-cell center title="停留时间">
213
+ <template #default>
218
214
  <div style="display: flex; align-items: center;">
219
- <van-stepper disable-input button-size="22" min="0" v-model="item.remainTime"/>
220
- <span style="margin-left: 4px;">小时</span>
221
- </div>
222
- </div>
223
- </template>
224
- </van-cell>
225
- <van-cell title="任务提前">
226
- <template #default>
227
- <div style="display: flex; align-items: center;">
228
- <div style="display: flex; align-items: center; margin-right: 16px;">
229
- <van-stepper disable-input button-size="22" min="0" v-model="item.inAdvanceDay"/>
230
- <span style="margin-left: 4px;">天</span>
215
+ <div style="display: flex; align-items: center; margin-right: 16px;">
216
+ <van-stepper disable-input button-size="22" min="0" v-model="item.remainDay"/>
217
+ <span style="margin-left: 4px;">天</span>
218
+ </div>
219
+ <div style="display: flex; align-items: center;">
220
+ <van-stepper disable-input button-size="22" min="0" v-model="item.remainTime"/>
221
+ <span style="margin-left: 4px;">小时</span>
222
+ </div>
231
223
  </div>
224
+ </template>
225
+ </van-cell>
226
+ <van-cell title="任务提前">
227
+ <template #default>
232
228
  <div style="display: flex; align-items: center;">
233
- <van-stepper disable-input button-size="22" min="0" v-model="item.inAdvanceTime"/>
234
- <span style="margin-left: 4px;">小时</span>
229
+ <div style="display: flex; align-items: center; margin-right: 16px;">
230
+ <van-stepper disable-input button-size="22" min="0" v-model="item.inAdvanceDay"/>
231
+ <span style="margin-left: 4px;">天</span>
232
+ </div>
233
+ <div style="display: flex; align-items: center;">
234
+ <van-stepper disable-input button-size="22" min="0" v-model="item.inAdvanceTime"/>
235
+ <span style="margin-left: 4px;">小时</span>
236
+ </div>
235
237
  </div>
236
- </div>
237
- </template>
238
- </van-cell>
238
+ </template>
239
+ </van-cell>
240
+ </div>
239
241
  <van-field
240
242
  readonly
241
243
  clickable
@@ -260,9 +262,25 @@
260
262
  <div class="bar-item approve" @click="handleSelect('select')">确认</div>
261
263
  </div>
262
264
  </van-popup>
263
- <van-popup v-model="selectHandlePopupShow" closeable round position="bottom"
265
+ <van-popup v-if="selectHandlePopupShow" v-model="selectHandlePopupShow" closeable round position="bottom"
264
266
  :style="{ height: '80%' }" style="background: #f7f8fa">
265
- <select-handle @selectHandle="handleSelectResult"></select-handle>
267
+ <select-handle title="指定办理人" :multi-select="false" :procType="procType" @selectHandle="handleSelectResult"></select-handle>
268
+ </van-popup>
269
+ <van-popup v-if="selectOrganizePopupShow" v-model="selectOrganizePopupShow" closeable round position="bottom"
270
+ :style="{ height: '80%' }">
271
+ <select-organize ref="selectOrganize" :all-organize="false" :organize-id-list="permissionsScope.O" @selectOrganizeHandle="selectOrganizeHandle" ></select-organize>
272
+ </van-popup>
273
+ <van-popup v-if="selectUserPopupShow" v-model="selectUserPopupShow" closeable round position="bottom"
274
+ :style="{ height: '80%' }">
275
+ <select-handle title="选择用户" :multi-select="true" :procType="procType" @selectHandle="selectUserHandle" ></select-handle>
276
+ </van-popup>
277
+ <van-popup v-if="selectPositionPopupShow" v-model="selectPositionPopupShow" closeable round position="bottom"
278
+ :style="{ height: '80%' }">
279
+ <select-normal-list title="选择岗位" :id-list="permissionsScope.P" @selectNormalListHandle="selectPositionHandle" :parse-function="parsePositionFunction"></select-normal-list>
280
+ </van-popup>
281
+ <van-popup v-if="selectRolePopupShow" v-model="selectRolePopupShow" closeable round position="bottom"
282
+ :style="{ height: '80%' }">
283
+ <select-normal-list title="选择角色" :id-list="permissionsScope.R" @selectNormalListHandle="selectRoleHandle" :parse-function="parseRoleFunction"></select-normal-list>
266
284
  </van-popup>
267
285
  <van-dialog v-model="nodeListDialogShow" @confirm="processJumpSpecifiedNode()" @close="nodeListDialogShowClose()"
268
286
  :title="getAuditButtonStatus(auditResult)" show-cancel-button>
@@ -297,18 +315,24 @@
297
315
 
298
316
  <script>
299
317
  import {
300
- audit, config,
318
+ audit,
319
+ config,
301
320
  getAllPreNodes,
302
321
  getAttachmentList,
303
322
  getNextNodes,
304
323
  getNodesBehind,
324
+ getPosition,
305
325
  getPreNode,
306
- getProcessHis
326
+ getProcessHis,
327
+ getProcessType, getRole
307
328
  } from "../api";
308
329
  import {Dialog, Toast} from "vant";
309
330
  import UploadFile from '@lambo-design-mobile/upload-file';
310
331
  import {flutterUtil} from "./utils/flutterUtil";
311
332
  import SelectHandle from "./SelectHandle.vue";
333
+ import Tree from "./tree/Tree.vue";
334
+ import SelectOrganize from "./SelectOrganize.vue";
335
+ import SelectNormalList from "./SelectNormalList.vue";
312
336
 
313
337
 
314
338
  export default {
@@ -317,7 +341,7 @@ export default {
317
341
  return config
318
342
  }
319
343
  },
320
- components: {SelectHandle, UploadFile},
344
+ components: {SelectNormalList, SelectOrganize, Tree, SelectHandle, UploadFile},
321
345
  props: {
322
346
  //业务表单保存方法
323
347
  businessFormSave: {
@@ -348,6 +372,7 @@ export default {
348
372
  //初始化路由数据
349
373
  taskNode: this.$route.query.taskNode,
350
374
  procId: this.$route.query.procId,
375
+ procType: this.$route.query.procType,
351
376
  instanceId: this.$route.query.instanceId,
352
377
  applyId: this.$route.query.applyId,
353
378
  formUrl: this.$route.query.formUrl,
@@ -404,7 +429,13 @@ export default {
404
429
  //给附件列表展示
405
430
  files: [],
406
431
  //文件上传列表
407
- fileList: []
432
+ fileList: [],
433
+
434
+ permissionsScope: {},
435
+ selectOrganizePopupShow: false,
436
+ selectUserPopupShow: false,
437
+ selectRolePopupShow: false,
438
+ selectPositionPopupShow: false,
408
439
  };
409
440
  },
410
441
  methods: {
@@ -412,6 +443,7 @@ export default {
412
443
  this.getProcessHistory();
413
444
  this.getNextNodes();
414
445
  this.getAttachmentList();
446
+ this.getProcessTypeList();
415
447
  //设置提示持续时间默认为500ms
416
448
  Toast.setDefaultOptions({duration: 500});
417
449
  },
@@ -434,6 +466,77 @@ export default {
434
466
  }
435
467
  })
436
468
  },
469
+ getProcessTypeList() {
470
+ getProcessType(this.procType).then(res => {
471
+ let permScope = res.data.data.rows[0].permScope;
472
+ this.permissionsScope = this.extractPermissions(permScope);
473
+ });
474
+ },
475
+ extractPermissions(permScope) {
476
+ const permissions = {};
477
+
478
+ // 使用正则分别匹配 O、U、P 和 R
479
+ const oMatch = permScope.match(/O:([^,]*)/);
480
+ const uMatch = permScope.match(/U:([^,]*)/);
481
+ const pMatch = permScope.match(/P:([^,]*)/);
482
+ const rMatch = permScope.match(/R:([^,]*)/);
483
+
484
+ // 分别解析 O、U、P 和 R 权限
485
+ permissions.O = oMatch && oMatch[1] ? oMatch[1].split(';') : [];
486
+ permissions.U = uMatch && uMatch[1] ? uMatch[1].split(';') : [];
487
+ permissions.P = pMatch && pMatch[1] ? pMatch[1].split(';') : [];
488
+ permissions.R = rMatch && rMatch[1] ? rMatch[1].split(';') : [];
489
+
490
+ return permissions;
491
+ },
492
+ async parsePositionFunction(idList) {
493
+ try {
494
+ // 并行调用 getPosition 方法
495
+ return await Promise.all(
496
+ idList.map(async (id) => {
497
+ const response = await getPosition(id);
498
+ const result = response.data; // 假设响应的主体包含在 data 中
499
+
500
+ // 返回 { id, name } 对象
501
+ return {
502
+ id: id,
503
+ name: result.data.positionName || `Unknown Name for ${id}`, // 使用返回数据中的 name,若无则提供默认值
504
+ };
505
+ })
506
+ ); // 返回解析结果数组
507
+ } catch (error) {
508
+ console.error('Error fetching positions:', error);
509
+ // 在错误情况下返回默认结构
510
+ return idList.map((id) => ({
511
+ id: id,
512
+ name: `Unknown Name for ${id}`,
513
+ }));
514
+ }
515
+ },
516
+ async parseRoleFunction(idList) {
517
+ try {
518
+ // 并行调用 getPosition 方法
519
+ return await Promise.all(
520
+ idList.map(async (id) => {
521
+ const response = await getRole(id);
522
+ const result = response.data; // 假设响应的主体包含在 data 中
523
+
524
+ // 返回 { id, name } 对象
525
+ return {
526
+ id: id,
527
+ name: result.data.name || `Unknown Name for ${id}`, // 使用返回数据中的 name,若无则提供默认值
528
+ };
529
+ })
530
+ ); // 返回解析结果数组
531
+ } catch (error) {
532
+ console.error('Error fetching positions:', error);
533
+ // 在错误情况下返回默认结构
534
+ return idList.map((id) => ({
535
+ id: id,
536
+ name: `Unknown Name for ${id}`,
537
+ }));
538
+ }
539
+ },
437
540
  processData(data) {
438
541
  return data.map(node => {
439
542
  node.personType = node.assignee ? "assignee" : "candidate";
@@ -527,6 +630,22 @@ export default {
527
630
  this.nextNodePopupShow = false;
528
631
  }
529
632
  },
633
+ handleSelectOrganizePopupShow(index) {
634
+ this.nextNodeHandleIndex = index;
635
+ this.selectOrganizePopupShow=true;
636
+ },
637
+ handleSelectUserPopupShow(index) {
638
+ this.nextNodeHandleIndex = index;
639
+ this.selectUserPopupShow=true;
640
+ },
641
+ handleSelectRolePopupShow(index) {
642
+ this.nextNodeHandleIndex = index;
643
+ this.selectRolePopupShow = true;
644
+ },
645
+ handleSelectPositionPopupShow(index) {
646
+ this.nextNodeHandleIndex = index;
647
+ this.selectPositionPopupShow = true;
648
+ },
530
649
  getAttachmentList() {
531
650
  getAttachmentList(this.procId, this.applyId).then(resp => {
532
651
  if (resp.data.code === '200') {
@@ -565,6 +684,7 @@ export default {
565
684
  },
566
685
  getAuditStatus(auditResult) {
567
686
  const statusMap = {
687
+ '00': {text: '流程发起', icon: "faqiliuchen", color: '#0d88ff', type: 'success'},
568
688
  '30': {text: '通过', icon: "tongguo", color: '#0d88ff', type: 'success'},
569
689
  '40': {text: '驳回上一节点', icon: "bohui", color: '#ed4014', type: 'danger'},
570
690
  '50': {text: '驳回到原点', icon: "bohui", color: '#ed4014', type: 'danger'},
@@ -823,6 +943,44 @@ export default {
823
943
  }
824
944
  self.selectHandlePopupShow = false;
825
945
  },
946
+ selectOrganizeHandle(handle, checkedNodes) {
947
+ if (handle === 'select') {
948
+ this.nextNodeProcessedData[this.nextNodeHandleIndex].candidateGroups.organs =
949
+ checkedNodes.map(item => ({
950
+ name: item.node.title,
951
+ id: item.node.id,
952
+ }));
953
+ }
954
+ this.selectOrganizePopupShow = false
955
+ },
956
+ selectUserHandle(checkResult) {
957
+ this.nextNodeProcessedData[this.nextNodeHandleIndex].candidateGroups.users =
958
+ checkResult.map(item => ({
959
+ name: item.userName,
960
+ id: item.userId,
961
+ }));
962
+ this.selectUserPopupShow = false;
963
+ },
964
+ selectPositionHandle(handle, result) {
965
+ if (handle === 'select') {
966
+ this.nextNodeProcessedData[this.nextNodeHandleIndex].candidateGroups.positions =
967
+ result.map(item => ({
968
+ name: item.name,
969
+ id: item.id,
970
+ }));
971
+ }
972
+ this.selectPositionPopupShow = false
973
+ },
974
+ selectRoleHandle(handle, result) {
975
+ if (handle === 'select') {
976
+ this.nextNodeProcessedData[this.nextNodeHandleIndex].candidateGroups.roles =
977
+ result.map(item => ({
978
+ name: item.name,
979
+ id: item.id,
980
+ }));
981
+ }
982
+ this.selectRolePopupShow = false
983
+ },
826
984
  },
827
985
  activated() {
828
986
  this.updateActiveTab();
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <div id="headTitle" class="headTitle">
4
4
  <div class="van-nav-bar__content">
5
- <div class="van-nav-bar__title">指定办理人</div>
5
+ <div class="van-nav-bar__title">{{title}}</div>
6
6
  </div>
7
7
  <van-search
8
8
  show-action
@@ -28,8 +28,8 @@
28
28
  :overlay-style="{ position:'absolute',marginTop: '104px'}" transition="none">
29
29
  <div style="padding: 12px">
30
30
  <van-form>
31
- <van-field clearable v-model="searchForm.organId" label="组织ID" readonly />
32
- <van-field clearable v-model="searchForm.organTitle" label="组织名称" readonly />
31
+ <van-field clearable @click="searchOrganShow = true" v-model="searchForm.organId" label="组织ID" readonly />
32
+ <van-field clearable @click="searchOrganShow = true" v-model="searchForm.organTitle" label="组织名称" readonly />
33
33
  <van-field clearable v-model="searchForm.userId" label="用户ID" placeholder="请输入用户ID"/>
34
34
  <van-field name="radio" label="是否管理员">
35
35
  <template #input>
@@ -47,12 +47,12 @@
47
47
  </van-form>
48
48
  </div>
49
49
  </van-popup>
50
- <div id="listContent">
50
+ <div id="listContent" style="background: #f7f8fa">
51
51
  <van-list v-model="loading" style="padding-top: 15px"
52
52
  :finished="finished"
53
53
  finished-text="没有更多了"
54
54
  @load="handleLoad()">
55
- <select-handle-card ref="selectHandleCard" :person-list="personList.rows"
55
+ <select-handle-card ref="selectHandleCard" :multi-select="multiSelect" :person-list="personList.rows"
56
56
  :result.sync="checkResult">
57
57
  </select-handle-card>
58
58
  </van-list>
@@ -61,23 +61,45 @@
61
61
  <div class="bar-item" @click="handleSelect('cancel')">取消</div>
62
62
  <div class="bar-item approve" @click="handleSelect('select')">选择</div>
63
63
  </div>
64
+
65
+ <van-popup v-model="searchOrganShow" closeable round position="bottom" :style="{ height: '80%' }">
66
+ <select-organize :all-organize="true" :show-check-box="false" @handleSelect="onSelect" ></select-organize>
67
+ </van-popup>
64
68
  </div>
65
69
  </template>
66
70
 
67
71
  <script>
68
72
  import SelectHandleCard from "./SelectHandleCard.vue";
69
- import {getOrgRootTree, getUserList} from "../api";
73
+ import {getOrgRootTree, getProcessType, getUserList} from "../api";
74
+ import Tree from "./tree/Tree.vue";
75
+ import SelectOrganize from "./SelectOrganize.vue";
70
76
 
71
77
  export default {
72
78
  name: "SelectHandle",
73
- components: {SelectHandleCard},
79
+ components: {SelectOrganize, Tree, SelectHandleCard},
80
+ props: {
81
+ title: {
82
+ type: String,
83
+ default: ''
84
+ },
85
+ procType: {
86
+ type: String,
87
+ required: true
88
+ },
89
+ multiSelect: { // 新增一个 prop 来控制是否开启多选模式
90
+ type: Boolean,
91
+ default: false
92
+ }
93
+ },
74
94
  data() {
75
95
  return {
96
+ searchOrganShow: false,
76
97
  searchFilterShow: false,
77
98
  searchFilterBadge: false,
78
99
  searchForm: {
79
100
  userId: '',
80
101
  userName: '',
102
+ permScopeList: '',
81
103
  organId: '',
82
104
  organTitle: '',
83
105
  directChild: '',
@@ -91,43 +113,64 @@ export default {
91
113
  rows: []
92
114
  },
93
115
  checkResult: [], // 需要传递到子组件的 checkResult
94
- }
116
+ };
117
+ },
118
+ mounted() {
119
+ this.initSearch();
95
120
  },
96
121
  methods: {
97
- handleLoad() {
98
- console.log("触发加载")
122
+ initSearch() {
99
123
  getOrgRootTree().then(res => {
100
124
  const result = res.data;
101
125
  if (result.code === 1) {
102
126
  this.searchForm.organId = result.data[0].organId;
103
127
  this.searchForm.organTitle = result.data[0].organName;
128
+ }
129
+ this.handleLoad()
130
+ })
131
+ },
132
+ handleLoad() {
133
+ console.log("触发加载")
134
+ const offset = this.personList.rows.length;
135
+ const limit = 10;
104
136
 
105
- const offset = this.personList.rows.length;
106
- const limit = 10;
107
-
108
- getUserList(offset, limit, this.searchForm).then(res => {
109
-
110
- const result = res.data;
111
- if (result.code === "1") {
137
+ getProcessType(this.procType).then(res => {
112
138
 
113
- //返回的数据添加到 personList
114
- this.personList.rows = this.personList.rows.concat(result.data.rows);
115
- this.personList.total = result.data.total;
139
+ const userArray = this.extractUsers(res.data.data.rows[0].permScope);
140
+ console.log(userArray)
141
+ if (userArray.length > 0) {
142
+ this.searchForm.permScopeList = userArray.join(',')
143
+ }
144
+ getUserList(offset, limit, this.searchForm).then(res => {
116
145
 
117
- } else {
118
- console.error('Failed to load data');
119
- }
146
+ const result = res.data;
147
+ if (result.code === "1") {
148
+ //返回的数据添加到 personList 中
149
+ this.personList.rows = this.personList.rows.concat(result.data.rows);
150
+ this.personList.total = result.data.total;
151
+ }
120
152
 
121
- this.loading = false;
122
- this.finished = this.personList.rows.length >= this.personList.total;
153
+ this.loading = false;
154
+ this.finished = this.personList.rows.length >= this.personList.total;
123
155
 
124
- }).catch(error => {
125
- console.error('Error fetching data:', error);
126
- this.loading = false;
127
- });
128
- }
156
+ }).catch(error => {
157
+ console.error('Error fetching data:', error);
158
+ this.loading = false;
159
+ });
160
+ }).catch(error => {
161
+ console.error(error)
129
162
  })
130
163
  },
164
+
165
+ extractUsers(permScope) {
166
+ const match = permScope.match(/U:([^,]+)/);
167
+ if (match && match[1]) {
168
+ return match[1].split(';');
169
+ } else {
170
+ return [];
171
+ }
172
+ },
173
+
131
174
  onSearch() {
132
175
  // 如果搜索弹框是打开的
133
176
  if (this.searchFilterShow) {
@@ -148,15 +191,7 @@ export default {
148
191
  }
149
192
  },
150
193
  resetSearch() {
151
- // 遍历 searchForm 对象的每个属性,将其值置为空
152
- for (let key in this.searchForm) {
153
- // eslint-disable-next-line no-prototype-builtins
154
- if (this.searchForm.hasOwnProperty(key)) {
155
- if (key !== "organId" && key !== "organTitle") {
156
- this.searchForm[key] = '';
157
- }
158
- }
159
- }
194
+ this.initSearch()
160
195
  },
161
196
  resetAndLoadPersonList() {
162
197
  this.personList.total = 0;
@@ -174,6 +209,12 @@ export default {
174
209
  checkSearchForm() {
175
210
  this.searchFilterBadge = Object.values(this.searchForm).some(value => value !== '');
176
211
  },
212
+
213
+ onSelect(v) {
214
+ this.searchForm.organId = v.id;
215
+ this.searchForm.organTitle = v.title;
216
+ this.searchOrganShow = false;
217
+ },
177
218
  },
178
219
  watch: {
179
220
  // 监听 searchForm 的每一个字段的变化
@@ -265,6 +306,7 @@ export default {
265
306
  color: #fff;
266
307
  background: linear-gradient(90deg, #0096FF, #1677FF);
267
308
  border-radius: 9px;
309
+ margin: 0 20px;
268
310
  }
269
311
 
270
312
  .approve:active {