@lambo-design/workflow-approve 1.0.0-beta.87 → 1.0.0-beta.89

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/workflow-approve",
3
- "version": "1.0.0-beta.87",
3
+ "version": "1.0.0-beta.89",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -278,6 +278,10 @@ export default {
278
278
  onOk(){
279
279
  let self = this
280
280
  let idSelectedArr = self.idSelectedArr
281
+ if (self.idSelectedArr.length === 0) {
282
+ self.onCancel()
283
+ return
284
+ }
281
285
  self.loading = true
282
286
  if (self.helpBoxType ==='addMultitaskInstance'){
283
287
  idSelectedArr = [...new Set(idSelectedArr)]
@@ -59,6 +59,11 @@ export default {
59
59
  UploadFile
60
60
  },
61
61
  props: {
62
+ value: {
63
+ type: String,
64
+ required: false,
65
+ default: ''
66
+ },
62
67
  attachmentFile:{
63
68
  type: Boolean,
64
69
  default: false,
@@ -289,7 +294,7 @@ export default {
289
294
  },
290
295
  },
291
296
  mounted() {
292
- this.auditOpinion = this.defaultAuditOpinion
297
+ this.auditOpinion = this.defaultAuditOpinion || this.value
293
298
  },
294
299
  watch: {
295
300
  auditOpinionText(label) {
@@ -298,6 +303,9 @@ export default {
298
303
  auditOpinion(val) {
299
304
  this.$emit('input', val)
300
305
  },
306
+ value(newVal) {
307
+ this.auditOpinion = newVal;
308
+ },
301
309
  defaultAuditOpinion(val) {
302
310
  this.auditOpinion = this.defaultAuditOpinion
303
311
  this.$emit('input', val)
@@ -198,6 +198,11 @@ export default {
198
198
  LamboPagingTable,
199
199
  },
200
200
  props: {
201
+ value: {
202
+ type: String,
203
+ required: false,
204
+ default: ''
205
+ },
201
206
  isDetail: {
202
207
  type: Boolean,
203
208
  required: false,
@@ -515,11 +520,15 @@ export default {
515
520
  mounted() {
516
521
  this.getAttachList(this.taskId)
517
522
  this.processInfoWidth = this.inHorizontal ? 1000 : this.portraitWidth
523
+ this.form.auditOpinion = this.value;
518
524
  },
519
525
  watch: {
520
526
  'form.auditOpinion'(val) {
521
527
  this.$emit('input', val)
522
528
  },
529
+ value(newVal) {
530
+ this.form.auditOpinion = newVal;
531
+ },
523
532
  defaultAuditOpinion(val) {
524
533
  this.auditOpinion = this.defaultAuditOpinion
525
534
  this.$emit('input', val)
package/src/portrait.vue CHANGED
@@ -165,9 +165,7 @@
165
165
  </Table>
166
166
  </Modal>
167
167
  <!-- 下一环节设置弹框 -->
168
- <Modal v-model="appointBoxShow" title="下一环节设置"
169
- @on-cancel="appointBoxShow = false" width="600"
170
- @on-ok="appointOk">
168
+ <Modal v-model="appointBoxShow" title="下一环节设置" width="600">
171
169
  <Card v-for="(item,index) of nextNodesFormList" :key="index" style="margin-bottom: 10px"
172
170
  v-if="handleButtons && (handleButtons.includes('appointHandler') || handleButtons.includes('appointTimeoutTime'))">
173
171
  <Form ref="appointBox" justify="center" :label-width="100" :model="item"
@@ -250,6 +248,10 @@
250
248
  </div>
251
249
  </Form>
252
250
  </Card>
251
+ <template slot="footer">
252
+ <Button @click="appointBoxShow = false">取消</Button>
253
+ <Button type="primary" @click="appointOk">确定</Button>
254
+ </template>
253
255
  </Modal>
254
256
  <Modal v-model="rejectAttributesBoxShow" title="驳回的节点通过后"
255
257
  @on-cancel="rejectAttributesCancel"
@@ -512,7 +514,9 @@ export default {
512
514
  '84': '委派任务',
513
515
  '61': '交回委派任务',
514
516
  '62': '撤回委派任务',
517
+ 'passContinue': '通过并继续',
515
518
  },
519
+ isPassContinue: false, // 标记是否为通过并继续操作
516
520
  handleTypeList: [
517
521
  {
518
522
  value: '00',
@@ -637,6 +641,13 @@ export default {
637
641
  action: () => this.audit('30'),
638
642
  type: 'primary'
639
643
  },
644
+ {
645
+ id: 'passContinue',
646
+ label: `${this.passName}并继续`,
647
+ condition: this.handleButtons?.includes('passContinue') && !this.isDetail && !this.appointTask,
648
+ action: () => this.passContinueAudit(),
649
+ type: 'primary'
650
+ },
640
651
  {
641
652
  id: 'revokeDelegateTask',
642
653
  label: '撤回委派',
@@ -1278,6 +1289,85 @@ export default {
1278
1289
  self.auditResult = auditResult
1279
1290
  self.submit()
1280
1291
  },
1292
+
1293
+ // 通过并继续审批
1294
+ passContinueAudit: function () {
1295
+ let self = this
1296
+ self.auditResult = '30' // 设置为通过
1297
+ self.isPassContinue = true // 标记为通过并继续
1298
+ self.submit()
1299
+ },
1300
+
1301
+ // 获取下一条待办并刷新页面
1302
+ getNextTodoAndRefresh() {
1303
+ let self = this
1304
+ let param = {
1305
+ procType: self.procType
1306
+ }
1307
+ // 获取待办列表,获取下一条数据,排除当前已处理的任务
1308
+ ajax.get(self.smartFlowServerContext + "/manage/processTodo/list",{params:param}).then(function (resp) {
1309
+ if (resp.data.code === '200' && resp.data.data.rows && resp.data.data.rows.length > 0) {
1310
+ // 过滤掉当前已处理的任务
1311
+ const availableTodos = resp.data.data.rows.filter(todo => todo.applyId !== self.applyId)
1312
+ if (availableTodos.length === 0) {
1313
+ self.$Message.info('该类型没有更多待办任务了')
1314
+ self.isPassContinue = false // 重置标志
1315
+ self.executionCompleted(true, null, null, { code: '30', name: '通过' }, self.curTaskId)
1316
+ return
1317
+ }
1318
+ const nextTodo = availableTodos[0]
1319
+ // 获取节点配置信息
1320
+ let param = {
1321
+ procId: nextTodo.procId,
1322
+ taskNode: nextTodo.taskNode
1323
+ }
1324
+ ajax.post(self.smartFlowServerContext + '/manage/approvalCenter/getNodeData', param).then(function (nodeResp) {
1325
+ if (nodeResp.data.code === '200' && nodeResp.data.data && nodeResp.data.data.length > 0) {
1326
+ const nodeData = nodeResp.data.data[0]
1327
+ // 跳转处理
1328
+ self.jumpToNextTodo(nextTodo, nodeData)
1329
+ } else {
1330
+ self.$Message.warning('无法获取下一条待办的节点配置信息')
1331
+ self.isPassContinue = false // 重置标志
1332
+ self.executionCompleted(true, null, null, { code: '30', name: '通过' }, self.curTaskId)
1333
+ }
1334
+ }).catch(err => {
1335
+ console.error('获取节点配置失败:', err)
1336
+ self.$Message.error('获取节点配置失败')
1337
+ self.isPassContinue = false // 重置标志
1338
+ self.executionCompleted(true, null, null, { code: '30', name: '通过' }, self.curTaskId)
1339
+ })
1340
+ } else {
1341
+ self.$Message.info('没有更多待办任务了')
1342
+ self.isPassContinue = false // 重置标志
1343
+ self.executionCompleted(true, null, null, { code: '30', name: '通过' }, self.curTaskId)
1344
+ }
1345
+ }).catch(err => {
1346
+ console.error('获取待办列表失败:', err)
1347
+ self.$Message.error('获取下一条待办失败')
1348
+ self.isPassContinue = false // 重置标志
1349
+ self.executionCompleted(true, null, null, { code: '30', name: '通过' }, self.curTaskId)
1350
+ })
1351
+ },
1352
+
1353
+ // 通过executionCompleted回调通知父组件进行页面跳转
1354
+ jumpToNextTodo(nextTodo, nodeData) {
1355
+ // 先重置标志
1356
+ this.isPassContinue = false
1357
+
1358
+ this.$Message.success(`已切换到下一条待办`)
1359
+
1360
+ // 构建特殊的auditResult对象,包含下一条待办的信息
1361
+ let auditResult = {
1362
+ code: 'passContinueSuccess',
1363
+ name: '通过并继续',
1364
+ nextTodo: nextTodo,
1365
+ nodeData: nodeData
1366
+ }
1367
+
1368
+ // 通过executionCompleted回调通知父组件处理跳转
1369
+ this.executionCompleted(true, null, null, auditResult, this.curTaskId)
1370
+ },
1281
1371
  submit() {
1282
1372
  let self = this
1283
1373
  self.auditParams = {
@@ -1301,6 +1391,7 @@ export default {
1301
1391
  }
1302
1392
  if (self.form.auditOpinion == '' || self.form.auditOpinion == null) {
1303
1393
  if (self.auditResult === '30') {
1394
+ self.form.auditOpinion = '通过'
1304
1395
  self.auditParams.auditOpinion = '通过'
1305
1396
  self.businessFormSave ? self.businessFormSave(self.handleSaveResult, auditResult) : self.handleSaveResult(true)
1306
1397
  return
@@ -1367,6 +1458,7 @@ export default {
1367
1458
  let taskIds = result.data.id ? result.data.id : result.data.map(item => item.id).join(',')
1368
1459
  setTimeout(() => {
1369
1460
  self.executionCompleted(true, result.data.id ? result.data.processInstanceId : result.data[0].processInstanceId, taskIds, auditResult, self.curTaskId)
1461
+ self.isPassContinue = false // 重置标志
1370
1462
  }, 1000)
1371
1463
  }
1372
1464
  } else {
@@ -1414,6 +1506,7 @@ export default {
1414
1506
  //后端没有返回数据
1415
1507
  setTimeout(() => {
1416
1508
  self.executionCompleted(true, null, null, auditResult, self.curTaskId)
1509
+ self.isPassContinue = false // 重置标志
1417
1510
  }, 1000)
1418
1511
  bus.$emit('triggerTimer')
1419
1512
  } else {
@@ -1422,6 +1515,7 @@ export default {
1422
1515
  self.$Message.error(auditMessage)
1423
1516
  setTimeout(() => {
1424
1517
  self.executionCompleted(false, null, null, auditResult, self.curTaskId)
1518
+ self.isPassContinue = false // 重置标志
1425
1519
  }, 1000)
1426
1520
  }
1427
1521
  bus.$emit('triggerTimer')
@@ -1459,8 +1553,8 @@ export default {
1459
1553
  let self = this
1460
1554
  this.modal = false
1461
1555
  let auditResult = {
1462
- code: self.auditResult,
1463
- name: self.handleButtonsNames[self.auditResult]
1556
+ code: self.isPassContinue ? 'passContinue' : self.auditResult,
1557
+ name: self.isPassContinue ? self.handleButtonsNames['passContinue'] : self.handleButtonsNames[self.auditResult]
1464
1558
  }
1465
1559
  if (self.auditResult === '82' && (self.targetTaskNode == '' || self.targetTaskNode == null)) {
1466
1560
  self.auditResult = ''
@@ -1480,15 +1574,21 @@ export default {
1480
1574
  message = result.message ? self.replaceName(result.message, '驳回', self.rejectName) : `${self.rejectName}成功`
1481
1575
  }
1482
1576
  self.$Message.success(message)
1483
- if (result.data) {
1484
- let taskIds = result.data.id ? result.data.id : result.data.map(item => item.id).join(',')
1485
- setTimeout(() => {
1486
- self.executionCompleted(true, result.data.id ? result.data.processInstanceId : result.data[0].processInstanceId, taskIds, auditResult, self.curTaskId)
1487
- }, 1000)
1577
+ if (self.isPassContinue) {
1578
+ // 通过并继续操作,获取下一条待办
1579
+ self.getNextTodoAndRefresh()
1488
1580
  } else {
1489
- setTimeout(() => {
1490
- self.executionCompleted(true, null, null, auditResult, self.curTaskId)
1491
- }, 1000)
1581
+ // 普通操作,正常回调
1582
+ if (result.data) {
1583
+ let taskIds = result.data.id ? result.data.id : result.data.map(item => item.id).join(',')
1584
+ setTimeout(() => {
1585
+ self.executionCompleted(true, result.data.id ? result.data.processInstanceId : result.data[0].processInstanceId, taskIds, auditResult, self.curTaskId)
1586
+ }, 1000)
1587
+ } else {
1588
+ setTimeout(() => {
1589
+ self.executionCompleted(true, null, null, auditResult, self.curTaskId)
1590
+ }, 1000)
1591
+ }
1492
1592
  }
1493
1593
  } else if (result.code == '10012') {
1494
1594
  // 数据同步
@@ -1503,9 +1603,17 @@ export default {
1503
1603
  self.loading = false
1504
1604
  self.disable = false
1505
1605
  self.$Message.success(result.message)
1506
- setTimeout(() => {
1507
- self.executionCompleted(true, '流程已结束', '流程已结束', auditResult, self.curTaskId)
1508
- }, 1000)
1606
+ if (self.isPassContinue) {
1607
+ // 通过并继续操作,获取下一条待办
1608
+ setTimeout(() => {
1609
+ self.getNextTodoAndRefresh()
1610
+ }, 500)
1611
+ }else {
1612
+ setTimeout(() => {
1613
+ self.executionCompleted(true, '流程已结束', '流程已结束', auditResult, self.curTaskId)
1614
+ self.isPassContinue = false // 重置标志
1615
+ }, 1000)
1616
+ }
1509
1617
  } else {
1510
1618
  self.loading = false
1511
1619
  self.disable = false
@@ -1765,6 +1873,7 @@ export default {
1765
1873
  appointOk() {
1766
1874
  const self = this
1767
1875
  let oldSettings
1876
+ let illegalNodes = []
1768
1877
  let params = this.nextNodesFormList.reduce((acc, item) => {
1769
1878
  acc[item.id] = {
1770
1879
  needUpdate: 'false',
@@ -1779,17 +1888,25 @@ export default {
1779
1888
  acc[item.id].timeLimit = ''
1780
1889
  }
1781
1890
  oldSettings = self.nextNodesOldSettings.filter(oldSetting => oldSetting.id === item.id)[0]
1891
+ if ((!item.assignee && !oldSettings.assignee && !item.candidateGroups && !oldSettings.candidates) || (item.isMultiInstance && !item.candidateGroups && !oldSettings.candidates)){
1892
+ illegalNodes = [...illegalNodes, item.name]
1893
+ }
1782
1894
  if (oldSettings.assignee !== item.assignee || self.checkGroupsUpdate(oldSettings.candidates, item.candidateGroups, item.isMultiInstance) || self.checkTimeLimitUpdate(oldSettings.timeLimit, timeLimit)) {
1783
1895
  acc[item.id].needUpdate = 'true'
1784
1896
  }
1785
1897
  return acc
1786
1898
  }, {})
1899
+ if (illegalNodes.length > 0){
1900
+ self.$Message.error(`请选择节点${illegalNodes.join(',')}的审批人!`);
1901
+ return
1902
+ }
1787
1903
  self.auditParams.nodeConfigMaps = JSON.stringify(params)
1788
1904
  self.doPass((execResult, instanceId, taskIds, auditResult, curTaskId) => {
1789
1905
  if (this.executionCompleted) {
1790
1906
  this.executionCompleted(execResult, instanceId, taskIds, auditResult, curTaskId)
1791
1907
  }
1792
1908
  })
1909
+ self.appointBoxShow = false
1793
1910
  },
1794
1911
  checkGroupsUpdate(oldSetting, newSetting, isMultiInstance) {
1795
1912
  if (oldSetting && newSetting) {