@zhijiancloud/bpm 0.0.5 → 0.0.7

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.
Files changed (99) hide show
  1. package/components/api/batch-loader.js +61 -0
  2. package/components/api/index.js +108 -0
  3. package/components/css/bpmAudit.less +13 -0
  4. package/components/css/bpmMulFile.less +13 -5
  5. package/components/css/bpmSelectEntranceForm.less +62 -0
  6. package/components/css/bpmSelectHouseOwner.less +30 -0
  7. package/components/css/bpmSignature.less +40 -0
  8. package/components/css/bpmText.less +0 -10
  9. package/components/css/common.less +43 -0
  10. package/components/css/index.less +6 -1
  11. package/components/lib/bpmAudit/index.js +7 -0
  12. package/components/lib/bpmAudit/src/main.vue +117 -0
  13. package/components/lib/bpmAudit/src/part/auditor/audit-new.vue +534 -0
  14. package/components/lib/bpmAudit/src/part/auditor/audit-select.vue +127 -0
  15. package/components/lib/bpmAudit/src/part/auditor/audit-with-others.vue +634 -0
  16. package/components/lib/bpmAudit/src/part/auditor.vue +54 -0
  17. package/components/lib/bpmAudit/src/part/editor.vue +318 -0
  18. package/components/lib/bpmAudit/src/part/reader.vue +218 -0
  19. package/components/lib/bpmDateTime/src/part/editor.vue +3 -1
  20. package/components/lib/bpmField/src/main.vue +5 -147
  21. package/components/lib/bpmFieldsFilter/index.js +7 -0
  22. package/components/lib/bpmFieldsFilter/src/main.vue +324 -0
  23. package/components/lib/bpmFormField/index.js +7 -0
  24. package/components/lib/bpmFormField/src/lib/form_mixin.js +818 -0
  25. package/components/lib/bpmFormField/src/lib/mixin.js +245 -0
  26. package/components/lib/bpmFormField/src/main.vue +35 -0
  27. package/components/lib/bpmMulFile/src/main.vue +0 -1
  28. package/components/lib/bpmMulFile/src/part/editor.vue +1 -1
  29. package/components/lib/bpmMulFile/src/part/reader.vue +12 -33
  30. package/components/lib/bpmMulImage/src/main.vue +1 -2
  31. package/components/lib/bpmMulImage/src/part/editor.vue +10 -6
  32. package/components/lib/bpmMulImage/src/part/reader.vue +14 -4
  33. package/components/lib/bpmNumber/src/part/editor.vue +8 -9
  34. package/components/lib/bpmSelect/src/part/reader.vue +11 -2
  35. package/components/lib/bpmSelectCheckItem/src/part/editor.vue +3 -7
  36. package/components/lib/bpmSelectEntranceForm/index.js +7 -0
  37. package/components/lib/bpmSelectEntranceForm/src/main.vue +529 -0
  38. package/components/lib/bpmSelectFromField/src/main.vue +1 -0
  39. package/components/lib/bpmSelectFromField/src/part/editor.vue +27 -13
  40. package/components/lib/bpmSelectFromForm/src/part/editor.vue +2 -5
  41. package/components/lib/bpmSelectHouseOwner/index.js +7 -0
  42. package/components/lib/bpmSelectHouseOwner/src/main.vue +102 -0
  43. package/components/lib/bpmSelectHouseOwner/src/part/editor.vue +101 -0
  44. package/components/lib/bpmSelectHouseOwner/src/part/reader.vue +17 -0
  45. package/components/lib/bpmSelectIssue/index.js +7 -0
  46. package/components/lib/bpmSelectIssue/src/main.vue +180 -0
  47. package/components/lib/bpmSignature/index.js +7 -0
  48. package/components/lib/bpmSignature/src/main.vue +248 -0
  49. package/components/lib/bpmSubForm/src/main.vue +25 -3
  50. package/components/lib/bpmTime/src/part/editor.vue +3 -2
  51. package/components/lib/field-const.js +6 -2
  52. package/components/lib/index.ts +57 -7
  53. package/components/mixins/field_base_mixin.vue +188 -0
  54. package/components/vendor/draw.js +240 -0
  55. package/dist/bpmAudit.umd.js +2 -0
  56. package/dist/bpmAudit.umd.js.LICENSE.txt +9 -0
  57. package/dist/bpmDateTime.umd.js +1 -1
  58. package/dist/bpmField.umd.js +7 -1
  59. package/dist/bpmField.umd.js.LICENSE.txt +2 -0
  60. package/dist/bpmFieldsFilter.umd.js +8 -0
  61. package/dist/bpmFieldsFilter.umd.js.LICENSE.txt +1 -0
  62. package/dist/bpmFormField.umd.js +8 -0
  63. package/dist/bpmFormField.umd.js.LICENSE.txt +11 -0
  64. package/dist/bpmMulFile.umd.js +1 -1
  65. package/dist/bpmMulImage.umd.js +1 -1
  66. package/dist/bpmNumber.umd.js +1 -1
  67. package/dist/bpmSelect.umd.js +1 -1
  68. package/dist/bpmSelectCheckItem.umd.js +1 -1
  69. package/dist/bpmSelectEntranceForm.umd.js +8 -0
  70. package/dist/bpmSelectEntranceForm.umd.js.LICENSE.txt +1 -0
  71. package/dist/bpmSelectFromField.umd.js +1 -1
  72. package/dist/bpmSelectFromForm.umd.js +1 -1
  73. package/dist/bpmSelectHouseOwner.umd.js +1 -0
  74. package/dist/bpmSelectIssue.umd.js +1 -0
  75. package/dist/bpmSignature.umd.js +2 -0
  76. package/dist/bpmSignature.umd.js.LICENSE.txt +9 -0
  77. package/dist/bpmSubForm.umd.js +1 -1
  78. package/dist/bpmText.umd.js +1 -1
  79. package/dist/bpmTime.umd.js +1 -1
  80. package/dist/css/bpmAudit.css +1 -0
  81. package/dist/css/bpmMulFile.css +1 -1
  82. package/dist/css/bpmSelectEntranceForm.css +1 -0
  83. package/dist/css/bpmSelectHouseOwner.css +1 -0
  84. package/dist/css/bpmSignature.css +1 -0
  85. package/dist/css/bpmText.css +1 -1
  86. package/dist/css/common.css +1 -0
  87. package/dist/css/index.css +1 -1
  88. package/dist/demo.umd.js +1 -1
  89. package/dist/demo2.umd.js +1 -1
  90. package/dist/index.umd.js +7 -1
  91. package/dist/index.umd.js.LICENSE.txt +2 -0
  92. package/package.json +26 -18
  93. package/CHANGELOG.md +0 -23
  94. package/dist/bpmDateTime.umd.js.LICENSE.txt +0 -38
  95. package/dist/bpmNumber.umd.js.LICENSE.txt +0 -38
  96. package/dist/bpmSelect.umd.js.LICENSE.txt +0 -38
  97. package/dist/bpmSelectUser.umd.js +0 -1
  98. package/dist/bpmText.umd.js.LICENSE.txt +0 -38
  99. package/dist/bpmTime.umd.js.LICENSE.txt +0 -38
@@ -0,0 +1,534 @@
1
+ <template>
2
+ <div class="audit-new">
3
+ <div class="submit-btns-container">
4
+ <el-button :disabled="submiting" @click="doOperation(2)">{{
5
+ selectOptions[1]["label"]
6
+ }}</el-button>
7
+ <el-button type="primary" :disabled="submiting" @click="doOperation(1)">{{
8
+ selectOptions[0]["label"]
9
+ }}</el-button>
10
+ </div>
11
+
12
+ <el-dialog
13
+ :visible.sync="openAuditDlg"
14
+ class="audit-modal"
15
+ @close="onHide"
16
+ :modal="false"
17
+ center
18
+ width="60%"
19
+ :title="getViewFont"
20
+ @open="onOpen"
21
+ >
22
+ <div>
23
+ <el-form
24
+ ref="form"
25
+ class="audit-modal-content"
26
+ :model="curVal"
27
+ label-width="120px"
28
+ >
29
+ <el-form-item
30
+ v-if="form.result == 2 && showReject"
31
+ :label="$z('回退节点:', 'b2.common.fallback_node')"
32
+ >
33
+ <el-select v-model="form.reject_target" placeholder="">
34
+ <el-option
35
+ v-for="item in rejectTargetList"
36
+ :key="item.value"
37
+ :label="item.label"
38
+ :value="item.value"
39
+ >
40
+ </el-option>
41
+ </el-select>
42
+ </el-form-item>
43
+
44
+ <component
45
+ :is="opt.component"
46
+ :key="opt.id"
47
+ :conf="opt"
48
+ :container="container"
49
+ v-for="opt in optAss"
50
+ >
51
+ </component>
52
+
53
+ <el-form-item
54
+ :required="isSignatureMust"
55
+ v-show="showSignature"
56
+ :label="$z('签名:', 'b2.common.sign')"
57
+ >
58
+ <bpm-signature ref="signature" v-model="form.signature"></bpm-signature>
59
+ </el-form-item>
60
+
61
+ <el-form-item
62
+ :required="isJudgmentMust"
63
+ :label="$z('填写意见:', 'b2.common.fill_comment')"
64
+ v-if="showJudgment"
65
+ >
66
+ <el-input
67
+ v-model="form.judgment"
68
+ type="textarea"
69
+ :placeholder="$z('请输入评审意见', 'b2.common.en_comment')"
70
+ :clearable="form.judgment ? true : false"
71
+ ></el-input>
72
+ </el-form-item>
73
+
74
+ <el-form-item
75
+ v-if="showPhoto"
76
+ :label="$z('拍照:', 'b2.common.photograph')"
77
+ :required="isPhotoMust"
78
+ >
79
+ <component
80
+ :is="componentName"
81
+ v-model="form.photos"
82
+ :value="form.photos"
83
+ :config="fieldConf"
84
+ :closeCheck="true"
85
+ >
86
+ </component>
87
+ </el-form-item>
88
+
89
+ <el-form-item
90
+ required
91
+ v-if="isOpenAudit"
92
+ :label="$z('审批日期:', 'b2.common.audit_date')"
93
+ >
94
+ <el-date-picker
95
+ ref="dateSelect"
96
+ v-model="form.auditTime"
97
+ type="datetime"
98
+ placeholder="选择日期时间"
99
+ :format="auditTimeFormat"
100
+ >
101
+ </el-date-picker>
102
+ </el-form-item>
103
+ </el-form>
104
+ </div>
105
+ <span slot="footer" class="dialog-footer">
106
+ <el-button @click="onCancel" :disabled="isSimulation ? false : submiting">取 消</el-button>
107
+ <el-button type="primary" @click="onSubmit">确 定</el-button>
108
+ </span>
109
+ </el-dialog>
110
+ </div>
111
+ </template>
112
+
113
+
114
+ <script>
115
+ import _ from "lodash";
116
+ import Vue from "vue";
117
+ import { Dialog, DatePicker } from "element-ui";
118
+ Vue.use(Dialog);
119
+ Vue.use(DatePicker);
120
+ import MulImage from "../../../../bpmMulImage/index";
121
+ import Signature from "../../../../bpmSignature/index";
122
+
123
+ Vue.use(MulImage);
124
+ Vue.use(Signature);
125
+
126
+ export default {
127
+ data() {
128
+ return {
129
+ curVal: {
130
+ result: 1,
131
+ judgment: "",
132
+ photos: [],
133
+ reject_target: "",
134
+ signature: "",
135
+ auditor_name: "",
136
+ audit_at: "",
137
+ auditor: "",
138
+ },
139
+
140
+
141
+ openAuditDlg: false,
142
+ result: 1,
143
+ form: {
144
+ result: 1,
145
+ judgment: "",
146
+ photos: [],
147
+ signature: "",
148
+ auditTime: new Date().getTime()
149
+ },
150
+ passForm: {
151
+ result: 1,
152
+ judgment: "",
153
+ signature: "",
154
+ photos: [],
155
+ auditTime: new Date().getTime()
156
+ },
157
+ notPassForm: {
158
+ result: 2,
159
+ judgment: "",
160
+ photos: [],
161
+ signature: "",
162
+ reject_target: "",
163
+ auditTime: new Date().getTime()
164
+ },
165
+ canvasBox: null,
166
+ hasDraw: false,
167
+ degree: 0,
168
+ submiting: false,
169
+ openLastSign: false,
170
+ lastSign: "",
171
+ useNextUser: false,
172
+ selectOptions: [
173
+ {
174
+ label: zj.z('通过', 'b2.common.pass'),
175
+ value: 1,
176
+ },
177
+ {
178
+ label: zj.z('不通过', 'b2.common.fail'),
179
+ value: 2,
180
+ },
181
+ ],
182
+ optAss: [],
183
+ isOpenAudit: false,
184
+ auditTimeFormat: "YYYY-MM-DD HH:mm:ss"
185
+
186
+ };
187
+ },
188
+ props: ["value", "fieldConf", "row" ,"container"],
189
+ computed: {
190
+
191
+ useDetail() {
192
+ return !!_.get(this.fieldConf, "detail_allow", null) && !!_.get(this.fieldConf, "detail_deny", null)
193
+ },
194
+ judgment() {
195
+ let result = this.result
196
+ let judgment = _.get(this.fieldConf, "judgment");
197
+ if (this.useDetail) {
198
+ judgment = result == 1 ? _.get(this.fieldConf, 'detail_allow.judgment') : _.get(this.fieldConf, 'detail_deny.judgment')
199
+ }
200
+ return judgment
201
+ },
202
+ showJudgment() {
203
+ return this.judgment == "yes" || this.judgment == "must";
204
+ },
205
+ signature() {
206
+ let result = this.result
207
+ let signature = _.get(this.fieldConf, "signature");
208
+ if (this.useDetail) {
209
+ signature = result == 1 ? _.get(this.fieldConf, 'detail_allow.signature') : _.get(this.fieldConf, 'detail_deny.signature')
210
+ }
211
+ return signature
212
+ },
213
+ allowColor() {
214
+ let color = _.get(this.fieldConf, "detail_allow.color", "#fff")
215
+ return color == "#fff" || color == "#ffffff" ? "primary" : color
216
+ },
217
+ denyColor() {
218
+ let color = _.get(this.fieldConf, "detail_deny.color", "#fff")
219
+ return color == "#fff" || color == "#ffffff" ? "primary" : color
220
+ },
221
+ showSignature() {
222
+ return this.signature == "yes" || this.signature == "must";
223
+ },
224
+ photo() {
225
+ let result = this.result
226
+ let photo = _.get(this.fieldConf, "photo");
227
+ if (this.useDetail) {
228
+ photo = result == 1 ? _.get(this.fieldConf, 'detail_allow.photo') : _.get(this.fieldConf, 'detail_deny.photo')
229
+ }
230
+ return photo
231
+ },
232
+ showPhoto() {
233
+ return this.photo == "yes" || this.photo == "must";
234
+ },
235
+ isJudgmentMust() {
236
+ return this.judgment == "must";
237
+ },
238
+ isSignatureMust() {
239
+ return this.signature == "must";
240
+ },
241
+ isPhotoMust() {
242
+ return this.photo == "must";
243
+ },
244
+ getCanvasBoxStyle() {
245
+ return {
246
+ height: "150px",
247
+ width: "100%",
248
+ };
249
+ },
250
+ componentName() {
251
+ return "MulImagePc";
252
+ },
253
+ isMobile() {
254
+ return this.$q.platform.is.mobile;
255
+ },
256
+ getViewFont() {
257
+ let result = this.result;
258
+ let font = result == 1 ? zj.z('通过', 'b2.common.pass') : result == -1 ? "" : zj.z('不通过', 'b2.common.fail')
259
+ if (this.useDetail) {
260
+ font = result == 1 ? _.get(this.fieldConf, "detail_allow.text", zj.z('通过', 'b2.common.pass')) : result == -1 ? "" : _.get(this.fieldConf, "detail_deny.text", zj.z('不通过', 'b2.common.fail'))
261
+ }
262
+ return font;
263
+ },
264
+ userId() {
265
+ return _.get(this.$bpm.userInfo, "user_id", 0);
266
+ },
267
+ userName() {
268
+ return _.get(this.$bpm.userInfo, "user_name", "");
269
+ },
270
+ showReject() {
271
+ return !!_.get(this.container, "formSchema.reject_targets")
272
+ },
273
+ rejectTargetMap() {
274
+ let rejectTargets = _.get(this.container, "formSchema.reject_targets")
275
+ return _.keyBy(rejectTargets, "node")
276
+ },
277
+ rejectTargetList() {
278
+
279
+ console.log("this.container",this.container)
280
+
281
+ let rejectTargets = _.get(this.container, "formSchema.reject_targets")
282
+ let passedNodes = _.get(this.container, "_formData.passed_nodes")
283
+ let list = []
284
+ _.each(rejectTargets, rejectTarget => {
285
+ if (_.includes(passedNodes, rejectTarget.node) && rejectTarget.only_passed) {
286
+ list.push({
287
+ label: rejectTarget.name,
288
+ value: rejectTarget.node
289
+ })
290
+ }
291
+ else if (!rejectTarget.only_passed) {
292
+ list.push({
293
+ label: rejectTarget.name || zj.z("上一个节点", "b2.common.previous_node"),
294
+ value: rejectTarget.node || "last_id"
295
+ })
296
+ }
297
+ })
298
+ return list
299
+ },
300
+ isSimulation() {
301
+ return this.$bpm.isSimulation
302
+ }
303
+ },
304
+ created() {
305
+ this.loadProjBaseInfo()
306
+ },
307
+ destroyed() {
308
+ if(this.container){
309
+ this.container.$off("afterFormSubmit")
310
+ }
311
+ },
312
+ mounted() {
313
+ if(this.value){
314
+ let value = _.cloneDeep(this.value);
315
+ value.audit_at = value.audit_at * 1000
316
+ this.curVal = _.merge(this.curVal, value)
317
+ }
318
+
319
+ if(this.container){
320
+ this.container.$on("afterFormSubmit", (errors) => {
321
+ if (!errors && this.openLastSign && this.value.signature) {
322
+ this.$bpm.postEleSign(this.value.signature, this.useNextUser)
323
+ }
324
+ })
325
+ }
326
+
327
+ if (this.useDetail) {
328
+ this.selectOptions = [
329
+ {
330
+ label: _.get(this.fieldConf, "detail_allow.text", zj.z('通过', 'b2.common.pass')),
331
+ value: 1,
332
+ },
333
+ {
334
+ label: _.get(this.fieldConf, "detail_deny.text", zj.z('不通过', 'b2.common.fail')),
335
+ value: 2
336
+ }
337
+ ]
338
+ }
339
+ },
340
+ methods: {
341
+ onHide() {
342
+ this.openAuditDlg = false;
343
+ },
344
+ onOpen() {
345
+ if (this.result == 1) {
346
+ this.form = _.cloneDeep(this.passForm)
347
+ this.form.result = 1
348
+ }
349
+ else {
350
+ this.form = _.cloneDeep(this.notPassForm)
351
+ this.form.result = 2
352
+ if (this.rejectTargetList.length == 1) {
353
+ let result = _.get(this.rejectTargetList, "0.value")
354
+ this.form.reject_target = result
355
+ }
356
+ else {
357
+ this.form.reject_target = ""
358
+ }
359
+ }
360
+
361
+ console.log("this.result",this.result)
362
+
363
+ this.form.auditTime = new Date().getTime()
364
+
365
+ this.handleInitSign()
366
+
367
+ if (this.value) {
368
+ let value = _.cloneDeep(this.value);
369
+ value.audit_at = value.audit_at * 1000
370
+ this.curVal = _.merge(this.curVal, value)
371
+ this.form = this.curVal
372
+ }
373
+ },
374
+ async onSubmit() {
375
+ let curVal = this.form;
376
+
377
+ console.log("curVal",curVal);
378
+
379
+
380
+ if (this.isRequired && !curVal.result) {
381
+ this.$message({
382
+ message: "请选择审批结果",
383
+ type: 'warning',
384
+
385
+ });
386
+ return;
387
+ }
388
+ if (this.isSignatureMust && !curVal.signature) {
389
+ this.$message({
390
+ message: "请完成签名",
391
+ type: 'warning',
392
+
393
+ });
394
+ return;
395
+ }
396
+ if (this.isJudgmentMust && !curVal.judgment) {
397
+ this.$message({
398
+ message: "请填写意见",
399
+ type: 'warning',
400
+
401
+ });
402
+ return;
403
+ }
404
+ if (this.isPhotoMust && _.isEmpty(curVal.photos)) {
405
+ this.$message({
406
+ message: "请至少上传一张图片",
407
+ type: 'warning',
408
+
409
+ });
410
+ return;
411
+ }
412
+
413
+ this._dealSubmit(curVal)
414
+ this.openAuditDlg = false;
415
+ },
416
+
417
+ _dealSubmit(form){
418
+ let value = {
419
+ result: form.result,
420
+ signature: form.signature,
421
+ judgment: form.judgment,
422
+ photos: form.photos,
423
+ audit_at: form.auditTime / 1000,
424
+ auditor:
425
+ (zj.app.accessInfo && zj.app.accessInfo.user_info.user_id) ||
426
+ this.userId,
427
+ auditor_name:
428
+ (zj.app.accessInfo && zj.app.accessInfo.user_info.user_name) ||
429
+ this.userName,
430
+ }
431
+ if (form.result == 2 && this.showReject) {
432
+ _.set(value, "reject_target", this.getRejectTarget(form.reject_target))
433
+ }
434
+ this.curVal = value;
435
+
436
+ this.$emit('change',this.curVal)
437
+
438
+ console.log("this.container",this.container);
439
+
440
+ let modal = this.container.$parent
441
+
442
+ if (modal) {
443
+ this.submiting = true
444
+ try {
445
+ modal.doOperation()
446
+ } catch (error) {
447
+ this.submiting = false
448
+ }
449
+ this.$bpm.$on("afterFormSubmit", ({ mode, errors }) => {
450
+ if (!errors) {
451
+ // 表单提交成功,刷新列表页
452
+ this.openAuditDlg = false
453
+ this.submiting = false
454
+ this.handleSaveSign()
455
+ }
456
+ else {
457
+ this.submiting = false
458
+ }
459
+ });
460
+
461
+ }
462
+ },
463
+
464
+ handleSaveSign() {
465
+ if (this.openLastSign && this.value.signature && this.useNextUser) {
466
+ this.$bpm.postEleSign(this.value.signature, this.useNextUser)
467
+ }
468
+ },
469
+
470
+ getRejectTarget(id) {
471
+ let rejectTargetMap = this.rejectTargetMap
472
+ return id == 'last_id' ? { type: 'RejectToLastUserNode' } : _.get(rejectTargetMap, id)
473
+
474
+ },
475
+
476
+ onCancel() {
477
+ this.openAuditDlg = false
478
+ },
479
+
480
+ handleInitSign() {
481
+ if (!this.showSignature) return
482
+ let userSign = this.$bpm.userSign
483
+ this.openLastSign = userSign.open
484
+ if (userSign.for_next_use) this.lastSign = userSign.signature
485
+ console.log("this.lastSign", this.lastSign)
486
+ if (this.openLastSign && this.lastSign && userSign.for_next_use) this.form.signature = userSign.signature
487
+ if (userSign.for_next_use && this.openLastSign) this.useNextUser = true
488
+
489
+ },
490
+ async loadProjBaseInfo() {
491
+ let info = await this.$bpm.getBaseSetting("open_audit")
492
+ let isOpen = info.value == 1 ? true : false
493
+ this.isOpenAudit = isOpen
494
+ let result = await this.$bpm.getBaseSetting("audit_dt_fmt")
495
+ this.auditFormat = result.value || this.auditFormat
496
+ },
497
+
498
+ async loadUserInfo() {
499
+ let info = await this.$bpm.requestAppendOrgParams({
500
+ url: "/uc/common/user_info/",
501
+ params: zj.utils.pageParam(),
502
+ });
503
+ info = _.get(info, "data.data")
504
+ this.$bpm.setUserInfo(info.user_info);
505
+ },
506
+
507
+ async doOperation(result) {
508
+
509
+ console.log("this.fieldConf",this.fieldConf)
510
+
511
+ setTimeout(() => {
512
+ let optAssIds = _.get(this.fieldConf, `opt_ass.${result}`)
513
+ let optAss = _.map(optAssIds, id => {
514
+ return _.get(this.container, `eleMap.${id}`)
515
+ })
516
+ optAss = _.compact(optAss)
517
+ this.optAss = optAss
518
+ let excludeElemIds = _.concat(optAssIds, this.fieldConf.id)
519
+ excludeElemIds = _.compact(excludeElemIds)
520
+ this.container.verfifyData(excludeElemIds, () => {
521
+ this.result = result
522
+ this.openAuditDlg = true
523
+ this.useNextUser = false
524
+ setTimeout(() => {
525
+ if (this.$refs.signature) this.$refs.signature.initCanvas();
526
+ }, 200)
527
+ })
528
+ }, 100)
529
+ }
530
+
531
+ }
532
+ };
533
+ </script>
534
+
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div>
3
+ <el-select v-model="form.result" :placeholder="$z('请选择回退节点', 'b2.common.select_back_to')">
4
+ <el-option
5
+ v-for="item in selectOptions"
6
+ :key="item.value"
7
+ :label="item.label"
8
+ :value="item.value"
9
+ >
10
+ </el-option>
11
+ </el-select>
12
+ </div>
13
+
14
+ </template>
15
+
16
+ <script>
17
+ export default {
18
+ props: ["value", "fieldConf", "row" ,"container"],
19
+ data() {
20
+ return {
21
+ selectOptions: [
22
+ {
23
+ label: zj.z('通过', 'b2.common.pass'),
24
+ value: 1,
25
+ },
26
+ {
27
+ label: zj.z('不通过', 'b2.common.fail'),
28
+ value: 2,
29
+ },
30
+ ],
31
+ form: {
32
+ result: "",
33
+ reject_target: ""
34
+ },
35
+ };
36
+ },
37
+ computed: {
38
+ userId() {
39
+ return _.get(this.$bpm.userInfo, "user_id", 0);
40
+ },
41
+ userName() {
42
+ return _.get(this.$bpm.userInfo, "user_name", "");
43
+ },
44
+ rejectTargetMap() {
45
+ let rejectTargets = _.get(this.field, "topContainer.formSchema.reject_targets")
46
+ return _.keyBy(rejectTargets, "node")
47
+ },
48
+ rejectTargetList() {
49
+ let rejectTargets = _.get(this.field, "topContainer.formSchema.reject_targets")
50
+ let passedNodes = _.get(this.field, "topContainer._formData.passed_nodes")
51
+ let list = []
52
+ _.each(rejectTargets, rejectTarget => {
53
+ if (_.includes(passedNodes, rejectTarget.node) && rejectTarget.only_passed) {
54
+ list.push({
55
+ label: rejectTarget.name,
56
+ value: rejectTarget.node
57
+ })
58
+ }
59
+ else {
60
+ list.push({
61
+ label: rejectTarget.name || zj.z("上一个节点", "b2.common.previous_node"),
62
+ value: rejectTarget.node || "last_id"
63
+ })
64
+ }
65
+ })
66
+ return list
67
+ }
68
+ },
69
+ watch: {
70
+ form: {
71
+ handler(val) {
72
+ let auditor = zj.app.accessInfo && zj.app.accessInfo.user_info.user_id || this.userId
73
+ if (!auditor) {
74
+ this.loadUserInfo()
75
+ this.$message({
76
+ message: zj.z("当前网络加载有问题,请重新进入", 'b2.common.network_err'),
77
+ type: 'warning',
78
+ });
79
+
80
+ return
81
+ }
82
+ if (val.result == 2 && this.showReject && !val.reject_target) {
83
+ // 打回节点必选
84
+ this.$message({
85
+ message: zj.z("回退节点必填", "b2.common.back_to_required"),
86
+ type: 'warning',
87
+ });
88
+
89
+ return;
90
+ }
91
+ let value = {
92
+ result: val,
93
+ signature: "",
94
+ audit_at: new Date().getTime() / 1000,
95
+ auditor: zj.app.accessInfo && zj.app.accessInfo.user_info.user_id || this.userId,
96
+ auditor_name: zj.app.accessInfo && zj.app.accessInfo.user_info.user_name || this.userName,
97
+ }
98
+ if(val.result == 2 && this.showReject){
99
+ _.set(value, "reject_target", this.getRejectTarget(val.reject_target))
100
+ }
101
+ this.$emit("change",value)
102
+ this.$emit("input",value)
103
+ },
104
+ deep: true
105
+ }
106
+ },
107
+ methods: {
108
+ onDataLoaded(container) {
109
+ this.form.result = _.get(this.field.value, "result", "");
110
+ },
111
+ getRejectTarget(id) {
112
+ let rejectTargetMap = this.rejectTargetMap
113
+ return id == 'last_id' ? { type: 'RejectToLastUserNode' } : _.get(rejectTargetMap, id)
114
+
115
+ }
116
+ },
117
+ };
118
+ </script>
119
+
120
+ <style lang="less" scoped>
121
+ .bpm-status {
122
+ min-height: 24px;
123
+ border-radius: 3px;
124
+ }
125
+ </style>
126
+
127
+