sasp-flow-render 1.0.1

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 (68) hide show
  1. package/index.js +108 -0
  2. package/package.json +21 -0
  3. package/router.js +13 -0
  4. package/src/assets/font/iconfont.css +1158 -0
  5. package/src/assets/font/iconfont.eot +0 -0
  6. package/src/assets/font/iconfont.js +1 -0
  7. package/src/assets/font/iconfont.svg +827 -0
  8. package/src/assets/font/iconfont.ttf +0 -0
  9. package/src/assets/font/iconfont.woff +0 -0
  10. package/src/assets/images/card_zwsj.png +0 -0
  11. package/src/assets/images/dataStore.png +0 -0
  12. package/src/assets/images/dataStore_icon.png +0 -0
  13. package/src/assets/images/draft.png +0 -0
  14. package/src/assets/images/edit_icon.png +0 -0
  15. package/src/assets/images/end.png +0 -0
  16. package/src/assets/images/end_icon.png +0 -0
  17. package/src/assets/images/gateway.png +0 -0
  18. package/src/assets/images/gateway_icon.png +0 -0
  19. package/src/assets/images/globalConnect_icon.png +0 -0
  20. package/src/assets/images/group_icon.png +0 -0
  21. package/src/assets/images/hander_icon.png +0 -0
  22. package/src/assets/images/icon_ quality.png +0 -0
  23. package/src/assets/images/lasso_icon.png +0 -0
  24. package/src/assets/images/mobile_preview.png +0 -0
  25. package/src/assets/images/participant_icon.png +0 -0
  26. package/src/assets/images/publicProcess_icon.png +0 -0
  27. package/src/assets/images/remind_example.png +0 -0
  28. package/src/assets/images/space_icon.png +0 -0
  29. package/src/assets/images/start.png +0 -0
  30. package/src/assets/images/start_icon.png +0 -0
  31. package/src/assets/images/subprocess_icon.png +0 -0
  32. package/src/assets/images/tab_set_example.png +0 -0
  33. package/src/assets/images/timer.png +0 -0
  34. package/src/assets/images/timer_icon.png +0 -0
  35. package/src/assets/images/userTask_icon.png +0 -0
  36. package/src/assets/images/user_task.png +0 -0
  37. package/src/assets/js/api/apiFlow.js +219 -0
  38. package/src/assets/js/flowInstall.js +25 -0
  39. package/src/assets/js/global/cacheGlobal.js +110 -0
  40. package/src/assets/js/global/flowGlobal.js +61 -0
  41. package/src/assets/js/global/flowUserGlobal.js +35 -0
  42. package/src/assets/js/global/interfaceCache.js +31 -0
  43. package/src/assets/js/storageIO.js +106 -0
  44. package/src/components/flowChart.vue +463 -0
  45. package/src/components/flowInst/css/flowInstList.scss +193 -0
  46. package/src/components/flowInst/flowInstList.vue +818 -0
  47. package/src/components/flowInst/flowInstTab.vue +2858 -0
  48. package/src/components/flowInst/popup/flowInstForm.vue +54 -0
  49. package/src/components/flowRoamRecords.vue +768 -0
  50. package/src/components/messageMould/messageMould.vue +547 -0
  51. package/src/components/roamRecord.vue +567 -0
  52. package/src/components/userSelect.vue +537 -0
  53. package/src/views/flowInstView.vue +178 -0
  54. package/src/views/menuRouter/flowMenuRouter.vue +260 -0
  55. package/src/views/menuRouter/flowResRouter.vue +223 -0
  56. package/src/views/popup/css/flowMain.scss +156 -0
  57. package/src/views/popup/event/compoment/diy/info.txt +1 -0
  58. package/src/views/popup/event/compoment/eventParentConfig.vue +45 -0
  59. package/src/views/popup/event/js/loadFlowEventPlugin.js +279 -0
  60. package/src/views/popup/js/controls/CustomContextPad.js +310 -0
  61. package/src/views/popup/js/controls/CustomPalette.js +303 -0
  62. package/src/views/popup/js/controls/CustomRenderer.js +219 -0
  63. package/src/views/popup/js/controls/index.js +11 -0
  64. package/src/views/popup/js/customModeler/CustomModeler.js +22 -0
  65. package/src/views/popup/js/translations/customTranslate.js +14 -0
  66. package/src/views/popup/js/translations/translations.js +234 -0
  67. package/src/views/popup/js/utils/utils.js +53 -0
  68. package/src/views/test.vue +79 -0
@@ -0,0 +1,2858 @@
1
+ <template>
2
+ <div class="flow-inst" style="height: 100%;background-color: white;">
3
+ <div class="flow-chart" style="z-index:100;position:absolute;top:9px;right:0;text-align: right;">
4
+ <el-button size="mini" style="margin-right: 12px;"
5
+ type="warning" round icon="saspiconfont pl-icon-gongzuoliuchengtu"
6
+ @click="openFlowChart()">流程图
7
+ </el-button>
8
+ </div>
9
+
10
+ <el-tabs v-model="tabActive" v-if="initSuccess" type="border-card" @tab-click="tabClick"
11
+ style="width: 100%;height: 100%;">
12
+ <el-tab-pane name="draft" v-if="tabShow('draft')" style="height: 100%;" :lazy="true">
13
+ <span slot="label">
14
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['draft'].iconShow"></i>
15
+ {{tabTypeObj['showtTabText']? tabTypeObj['draft'].tabName : ''}}
16
+ <span style="color: red">({{numberObj['draft']}})</span>
17
+ </span>
18
+ <flow-inst-list ref="draftRef"
19
+ tab-type="draft"
20
+ :flow-define="flowDefine"
21
+ :userArr="userArr"
22
+ :userMap="userMap"
23
+ :form-id="formInfo.formId"
24
+ :flow-node-id-to-info="flowNodeIdToInfo"
25
+ :flow-node-name-obj="flowNodeNameObj"
26
+ :node-list-button-obj="nodeListButtonObj"
27
+ :opt-column-width="150"
28
+ :show-model="showModel"
29
+ :start-node-key-obj="startNodeKeyObj"
30
+ :flow-version-node-obj="flowVersionNodeObj"
31
+ @initTabNum="initTabNum"
32
+ :open-add-flow-form="openAddFlowForm"
33
+ :open-update-flow-form="openUpdateFlowForm"
34
+ :open-batch-update-flow-form="openBatchUpdateFlowForm"
35
+ >
36
+ </flow-inst-list>
37
+ </el-tab-pane>
38
+ <el-tab-pane name="pending" v-if="tabShow('pending')" style="height: 100%;">
39
+ <span slot="label">
40
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['pending'].iconShow"></i>
41
+ {{tabTypeObj['showtTabText']? tabTypeObj['pending'].tabName : ''}}
42
+ <span style="color: red">({{numberObj['pending']}})</span>
43
+ </span>
44
+ <flow-inst-list ref="pendingRef"
45
+ tab-type="pending"
46
+ :flow-define="flowDefine"
47
+ :userArr="userArr"
48
+ :userMap="userMap"
49
+ :form-id="formInfo.formId"
50
+ :flow-node-id-to-info="flowNodeIdToInfo"
51
+ :flow-node-name-obj="flowNodeNameObj"
52
+ :node-list-button-obj="nodeListButtonObj"
53
+ :opt-column-width="optColumnWidth"
54
+ :show-model="showModel"
55
+ :start-node-key-obj="startNodeKeyObj"
56
+ :flow-version-node-obj="flowVersionNodeObj"
57
+ @initTabNum="initTabNum"
58
+
59
+ :open-flow-chart="openFlowChart"
60
+ :open-flow-record="openFlowRecord"
61
+ :open-update-flow-form="openUpdateFlowForm"
62
+ :open-batch-update-flow-form="openBatchUpdateFlowForm"
63
+ >
64
+ </flow-inst-list>
65
+ </el-tab-pane>
66
+ <el-tab-pane name="processed" v-if="tabShow('processed')" :lazy="true">
67
+ <span slot="label">
68
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['processed'].iconShow"></i>
69
+ {{tabTypeObj['showtTabText']? tabTypeObj['processed'].tabName : ''}}
70
+ <span style="color: red">({{numberObj['processed']}})</span>
71
+ </span>
72
+ <flow-inst-list ref="processedRef"
73
+ tab-type="processed"
74
+ :flow-define="flowDefine"
75
+ :userArr="userArr"
76
+ :userMap="userMap"
77
+ :form-id="formInfo.formId"
78
+ :flow-node-id-to-info="flowNodeIdToInfo"
79
+ :flow-node-name-obj="flowNodeNameObj"
80
+ :node-list-button-obj="nodeListButtonObj"
81
+ :opt-column-width="optColumnWidth"
82
+ @initTabNum="initTabNum"
83
+ :show-model="showModel"
84
+ :start-node-key-obj="startNodeKeyObj"
85
+ :flow-version-node-obj="flowVersionNodeObj"
86
+ :open-flow-chart="openFlowChart"
87
+ :open-flow-record="openFlowRecord"
88
+ :open-view-flow-form="openViewFlowForm"
89
+ >
90
+ </flow-inst-list>
91
+ </el-tab-pane>
92
+ <el-tab-pane name="finished" v-if="tabShow('finished')" :lazy="true">
93
+ <span slot="label">
94
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['finished'].iconShow"></i>
95
+ {{tabTypeObj['showtTabText']? tabTypeObj['finished'].tabName : ''}}
96
+ <span style="color: red">({{numberObj['finished']}})</span>
97
+ </span>
98
+ <flow-inst-list ref="finishedRef"
99
+ tab-type="finished"
100
+ :flow-define="flowDefine"
101
+ :userArr="userArr"
102
+ :userMap="userMap"
103
+ :form-id="formInfo.formId"
104
+ :flow-node-id-to-info="flowNodeIdToInfo"
105
+ :flow-node-name-obj="flowNodeNameObj"
106
+ :node-list-button-obj="nodeListButtonObj"
107
+ :opt-column-width="optColumnWidth"
108
+ @initTabNum="initTabNum"
109
+ :show-model="showModel"
110
+ :start-node-key-obj="startNodeKeyObj"
111
+ :flow-version-node-obj="flowVersionNodeObj"
112
+ :open-flow-record="openFlowRecord"
113
+ :open-view-flow-form="openViewFlowForm"
114
+ >
115
+ </flow-inst-list>
116
+ </el-tab-pane>
117
+ <el-tab-pane name="rescinded" v-if="tabShow('rescinded')" :lazy="true">
118
+ <span slot="label">
119
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['rescinded'].iconShow"></i>
120
+ {{tabTypeObj['showtTabText']? tabTypeObj['rescinded'].tabName : ''}}
121
+ <span style="color: red">({{numberObj['rescinded']}})</span>
122
+ </span>
123
+ <flow-inst-list ref="rescindedRef"
124
+ tab-type="rescinded"
125
+ :flow-define="flowDefine"
126
+ :userArr="userArr"
127
+ :userMap="userMap"
128
+ :form-id="formInfo.formId"
129
+ :flow-node-id-to-info="flowNodeIdToInfo"
130
+ :flow-node-name-obj="flowNodeNameObj"
131
+ :node-list-button-obj="nodeListButtonObj"
132
+ :opt-column-width="optColumnWidth"
133
+ @initTabNum="initTabNum"
134
+ :show-model="showModel"
135
+ :start-node-key-obj="startNodeKeyObj"
136
+ :flow-version-node-obj="flowVersionNodeObj"
137
+ :open-flow-record="openFlowRecord"
138
+ :open-view-flow-form="openViewFlowForm"
139
+ >
140
+ </flow-inst-list>
141
+ </el-tab-pane>
142
+ <el-tab-pane name="discontinue" v-if="tabShow('discontinue')" :lazy="true">
143
+ <span slot="label">
144
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['discontinue'].iconShow"></i>
145
+ {{tabTypeObj['showtTabText']? tabTypeObj['discontinue'].tabName : ''}}
146
+ <span style="color: red">({{numberObj['discontinue']}})</span>
147
+ </span>
148
+ <flow-inst-list ref="discontinueRef"
149
+ tab-type="discontinue"
150
+ :flow-define="flowDefine"
151
+ :userArr="userArr"
152
+ :userMap="userMap"
153
+ :form-id="formInfo.formId"
154
+ :flow-node-id-to-info="flowNodeIdToInfo"
155
+ :flow-node-name-obj="flowNodeNameObj"
156
+ :node-list-button-obj="nodeListButtonObj"
157
+ :opt-column-width="optColumnWidth"
158
+ @initTabNum="initTabNum"
159
+ :show-model="showModel"
160
+ :start-node-key-obj="startNodeKeyObj"
161
+ :flow-version-node-obj="flowVersionNodeObj"
162
+ :open-flow-record="openFlowRecord"
163
+ :open-view-flow-form="openViewFlowForm"
164
+ >
165
+ </flow-inst-list>
166
+ </el-tab-pane>
167
+ <el-tab-pane name="flowQuery" v-if="tabShow('flowQuery')" :lazy="true">
168
+ <span slot="label">
169
+ <i v-if="tabTypeObj['showTabIcon']" :class="tabTypeObj['flowQuery'].iconShow"></i>
170
+ {{tabTypeObj['showtTabText']? tabTypeObj['flowQuery'].tabName : ''}}
171
+ </span>
172
+ <flow-inst-list ref="flowQueryRef"
173
+ tab-type="flowQuery"
174
+ :flow-define="flowDefine"
175
+ :userArr="userArr"
176
+ :userMap="userMap"
177
+ :form-id="formInfo.formId"
178
+ :flow-node-id-to-info="flowNodeIdToInfo"
179
+ :flow-node-name-obj="flowNodeNameObj"
180
+ :node-list-button-obj="nodeListButtonObj"
181
+ :opt-column-width="optColumnWidth"
182
+ :show-model="showModel"
183
+ :start-node-key-obj="startNodeKeyObj"
184
+ :flow-version-node-obj="flowVersionNodeObj"
185
+ :open-flow-chart="openFlowChart"
186
+ :open-flow-record="openFlowRecord"
187
+ :open-view-flow-form="openViewFlowForm"
188
+ :inst-query-power="dataPermis"
189
+ >
190
+ </flow-inst-list>
191
+ </el-tab-pane>
192
+ </el-tabs>
193
+
194
+ <!--处理、修改、查看流程信息弹窗-->
195
+ <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowInstDataDialog" append-to-body
196
+ custom-class="flowInstTabDialog">
197
+ <span slot="title" class="dialog-title">
198
+ <span>{{flowFormTitle}}</span>
199
+ </span>
200
+ <template v-if="flowInstDataDialog">
201
+ <slot name="formInfo"></slot>
202
+ </template>
203
+ <!-- <table-form-render ref="flowInstDataInfo"-->
204
+ <!-- :tableview-id="formInfo.tableViewId"-->
205
+ <!-- :data-id="formInfo.dataId"-->
206
+ <!-- :form-id="formInfo.formId"-->
207
+ <!-- :list-view-id="formInfo.listViewId"-->
208
+ <!-- :flow-field-status="formInfo.fieldStatus"-->
209
+ <!-- :form-operate="formInfo.opt"-->
210
+ <!-- :is-flow=true-->
211
+ <!-- :use-load-self=true-->
212
+ <!-- :flow-field-default="formInfo.fieldDefaultVal"-->
213
+ <!-- :flow-field-default-change-num="formInfo.fieldDefaultValChangeNum"-->
214
+ <!-- :flow-field-default-from-form="formInfo.flowFieldDefaultFromForm"-->
215
+ <!-- :form-field-obj="formFieldObj"-->
216
+ <!-- :formPrintVisble="currNodeName">-->
217
+ <!-- </table-form-render>-->
218
+
219
+ <div slot="footer" style="height:31px;" class="dialog-footer">
220
+ <div>
221
+ <el-button v-for="btn in formBtnArr" @click="btn.method" :disabled="isDisabled[btn.btnType]?false:true"
222
+ v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"
223
+ :key="btn.btnType"
224
+ :type="btn.type"
225
+ :icon="btn.icon"
226
+ size="small">
227
+ {{btn.text}}
228
+ </el-button>
229
+ </div>
230
+ </div>
231
+ </el-dialog>
232
+
233
+ <!--批量处理信息弹窗-->
234
+ <el-dialog :close-on-click-modal=false top="5vh" width="90%" height="90%" :visible.sync="flowBatchPendingDialog"
235
+ @close="closeFlowBatchPending()" class="batchDialog" append-to-body>
236
+ <span slot="title" class="dialog-title">
237
+ <span>批量处理</span>
238
+ <el-button size="mini" type="danger" round
239
+ style="margin-left: 20px;padding-top: 5px;padding-bottom: 5px;background: red;cursor: auto;position: relative;top: -3px;">
240
+ {{batchUpdateFormInfo.dataRows.length>99? '99+':batchUpdateFormInfo.dataRows.length}}
241
+ </el-button>
242
+ </span>
243
+ <el-tabs type="card" v-model="batchUpdateFormInfo.activeName"
244
+ :closable="batchUpdateFormInfo.dataRows.length > 1" @tab-click="batchTabClick"
245
+ @tab-remove="batchTabRemove"
246
+ v-if="flowBatchPendingDialog">
247
+ <el-tab-pane
248
+ v-for="(item, index) in batchUpdateFormInfo.dataRows"
249
+ :key="item.dataId"
250
+ :label="item.startUserName"
251
+ :name="item.dataId" :closable="batchUpdateFormInfo.dataRows.length > 1" :lazy="true">
252
+ <table-form-render :ref="`batchTableForm${item.dataId}Ref`"
253
+ :tableview-id="formInfo.tableViewId"
254
+ :data-id="batchUpdateFormInfo.batchDataId"
255
+ :form-id="formInfo.formId"
256
+ :list-view-id="formInfo.listViewId"
257
+ :flow-field-status="formInfo.fieldStatus"
258
+ :form-operate="formInfo.opt"
259
+ :is-flow="true"
260
+ use-load-self
261
+ :flow-field-default="formInfo.fieldDefaultVal"
262
+ :flow-field-default-change-num="formInfo.fieldDefaultValChangeNum"
263
+ :flow-field-default-from-form="formInfo.flowFieldDefaultFromForm"
264
+ :form-field-obj="formFieldObj"
265
+ v-if="batchUpdateFormInfo.formShow && flowBatchPendingDialog">
266
+ </table-form-render>
267
+ </el-tab-pane>
268
+ </el-tabs>
269
+ <div slot="footer" class="dialog-footer">
270
+ <el-button v-for="btn in formBtnArr" @click="btn.method"
271
+ v-show="btn.show && ((formInfo.opt != 'view') || (formInfo.opt=='view' && btn.isView))"
272
+ :key="btn.btnType"
273
+ :type="btn.type"
274
+ :icon="btn.icon"
275
+ size="small">
276
+ {{btn.text}}
277
+ </el-button>
278
+ </div>
279
+ </el-dialog>
280
+
281
+
282
+ <el-dialog :close-on-click-modal=false :title="'下一步' + (nextNodeName ? (' -> ' + nextNodeName) : '')"
283
+ :top="nextNode.nextType != 'inclusiveGateway' ? '20vh': '10vh'" append-to-body
284
+ width="500px" :visible.sync="nextSteptUserDialog" @closed="closeNextSteptUserDialog">
285
+ <el-form label-width="100px" size="small" v-if="nextNode.nodeType != 'EndEvent'">
286
+ <fieldset v-if="nextNode.nextType == 'inclusiveGateway'"
287
+ v-for="(itemAll,index) in (nextNode.result || [])" :key="index">
288
+ <legend>
289
+ {{itemAll.nodeName}}
290
+ </legend>
291
+ <el-form-item label="" label-width="0">
292
+ <el-select v-model="chooseNextUserIdObj[itemAll.nodeKey]" v-if="itemAll.type != 'all'"
293
+ :multiple="itemAll.mulitiChooseUser" style="width:100%">
294
+ <el-option v-for="item in itemAll.userArr" :key="item.id" :value="item.id"
295
+ :label="item.userName"></el-option>
296
+ </el-select>
297
+ <div @click="chooseUser(itemAll.nodeKey)">
298
+ <el-input v-model="chooseNextUserNameObj[itemAll.nodeKey]" v-if="itemAll.type == 'all'"
299
+ readonly>
300
+ <el-button slot="append" icon="el-icon-search"></el-button>
301
+ </el-input>
302
+ </div>
303
+ </el-form-item>
304
+ </fieldset>
305
+ <el-form-item label="下一步执行人" v-if="nextNode.nextType != 'inclusiveGateway'">
306
+ <el-select v-model="chooseNextUserId" v-if="nextSteptUserType != 'all' && nextSteptUserDialog"
307
+ :multiple="mulitiChooseUser" filterable style="width:100%">
308
+ <el-option v-for="item in nextSteptUserArr" :key="item.id" :value="item.id"
309
+ :label="item.userName"></el-option>
310
+ </el-select>
311
+ <div @click="chooseUser()">
312
+ <el-input v-model="chooseNextUserName" v-if="nextSteptUserType == 'all'" readonly>
313
+ <el-button slot="append" icon="el-icon-search"></el-button>
314
+ </el-input>
315
+ </div>
316
+ </el-form-item>
317
+ <fieldset v-if="nextNode.nextType == 'inclusiveGateway'">
318
+ <legend>
319
+ {{'附加说明'}}
320
+ </legend>
321
+ <el-form-item label="" label-width="0">
322
+ <el-input type="textarea" :rows="5" v-model="description"></el-input>
323
+ </el-form-item>
324
+ </fieldset>
325
+ <el-form-item label="附加说明" v-if="nextNode.nextType != 'inclusiveGateway'">
326
+ <el-input type="textarea" :rows="5" v-model="description"></el-input>
327
+ </el-form-item>
328
+ </el-form>
329
+ <div v-if="nextNode.nodeType == 'EndEvent'">流程即将结束,是否继续?</div>
330
+ <div slot="footer" class="dialog-footer">
331
+ <el-button type="primary" size="small" @click="saveNextStept()" :disabled="isDisabled1?false:true">确定
332
+ </el-button>
333
+ <el-button size="small" @click="closeNextSteptUserDialog">取消</el-button>
334
+ </div>
335
+ </el-dialog>
336
+
337
+ <el-dialog :close-on-click-modal=false title="组织岗位用户" top="5vh" width="80%" height="80%"
338
+ :visible.sync="sysOrgPosUserDialog" append-to-body>
339
+ <!-- <sys-org-pos-user-select ref="orgPosUserRef" v-if="sysOrgPosUserDialog"-->
340
+ <!-- :filterUserParam="{'commonUserType':'common' }" :ognEnable="false"-->
341
+ <!-- :default-user-ids="inclusiveChooseKey ? choosePosUserIdsObj[inclusiveChooseKey]:choosePosUserIds"-->
342
+ <!-- defaultChooseIds="$"-->
343
+ <!-- :posEnable="false" :checkbox="mulitiChooseUser">-->
344
+ <!-- </sys-org-pos-user-select>-->
345
+ <user-select ref="orgPosUserRef"
346
+ :choose-user-ids="inclusiveChooseKey ? choosePosUserIdsObj[inclusiveChooseKey]:choosePosUserIds"
347
+ :checkbox="mulitiChooseUser" v-if="sysOrgPosUserDialog">
348
+ </user-select>
349
+ <div slot="footer" class="dialog-footer">
350
+ <el-button type="primary" size="small" @click="sureNextUser()">确定</el-button>
351
+ <el-button size="small" @click="sysOrgPosUserDialog = false">取消</el-button>
352
+ </div>
353
+ </el-dialog>
354
+
355
+ <el-dialog :close-on-click-modal=false title="选择加签人" top="5vh" width="80%" height="80%"
356
+ :visible.sync="completeSignDialog" append-to-body>
357
+ <!-- <sys-org-pos-user-select ref="completeSignRef"-->
358
+ <!-- :filterUserParam="{'commonUserType':'common','filterLoginUser':'Y'}"-->
359
+ <!-- :ognEnable="false"-->
360
+ <!-- :posEnable="false"-->
361
+ <!-- :checkbox="true"-->
362
+ <!-- v-if="completeSignDialog"-->
363
+ <!-- >-->
364
+ <!-- </sys-org-pos-user-select>-->
365
+ <user-select ref="completeSignRef"
366
+ v-if="completeSignDialog">
367
+ </user-select>
368
+ <div slot="footer" class="dialog-footer">
369
+ <el-button type="primary" size="small" @click="sureCompleteSign()">确定</el-button>
370
+ <el-button size="small" @click="completeSignDialog = false">取消</el-button>
371
+ </div>
372
+ </el-dialog>
373
+
374
+ <el-dialog :close-on-click-modal=false title="选择转签人" top="5vh" width="80%" height="80%"
375
+ :visible.sync="turnSignDialog" append-to-body>
376
+ <!-- <sys-org-pos-user-select ref="turnSignRef"-->
377
+ <!-- :filterUserParam="{'commonUserType':'common' }"-->
378
+ <!-- :ognEnable="false"-->
379
+ <!-- :posEnable="false"-->
380
+ <!-- :checkbox="false"-->
381
+ <!-- v-if="turnSignDialog"-->
382
+ <!-- >-->
383
+ <!-- </sys-org-pos-user-select>-->
384
+ <user-select ref="turnSignRef"
385
+ :checkbox="false"
386
+ v-if="turnSignDialog">
387
+ </user-select>
388
+ <div slot="footer" class="dialog-footer">
389
+ <el-button type="primary" size="small" @click="sureTurnSign()">确定</el-button>
390
+ <el-button size="small" @click="turnSignDialog = false">取消</el-button>
391
+ </div>
392
+ </el-dialog>
393
+
394
+
395
+ <el-dialog :close-on-click-modal="false" append-to-body title="查看流程图"
396
+ :visible.sync="flowChartObj.dialogVisible"
397
+ width="90%" height="90%"
398
+ top="5vh">
399
+ <flow-chart :flow-id="flowId + ''" :inst-id="flowChartObj.instId + ''"
400
+ :link-proc-id="flowChartObj.linkProcId + ''"
401
+ :is-release="flowChartObj.isRelease"
402
+ v-if="flowChartObj.dialogVisible"></flow-chart>
403
+ <div slot="footer" class="dialog-footer">
404
+ <el-button @click="flowChartObj.dialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
405
+ </div>
406
+ </el-dialog>
407
+
408
+ <el-dialog :close-on-click-modal="false" append-to-body title="流转记录"
409
+ :visible.sync="flowRecordObj.dialogVisible"
410
+ width="90%" height="90%"
411
+ top="5vh">
412
+ <flow-roam-record :instId="flowRecordObj.instId + ''" v-if="flowRecordObj.dialogVisible"></flow-roam-record>
413
+ <div slot="footer" class="dialog-footer">
414
+ <el-button @click="flowRecordObj.dialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
415
+ </div>
416
+ </el-dialog>
417
+
418
+ <el-dialog :close-on-click-modal="false" append-to-body title="流转记录"
419
+ :visible.sync="flowRecordObj.oldDialogVisible"
420
+ width="90%" height="90%"
421
+ top="5vh">
422
+ <roam-record :flow-inst-id="flowRecordObj.instId + ''" v-if="flowRecordObj.oldDialogVisible"></roam-record>
423
+ <div slot="footer" class="dialog-footer">
424
+ <el-button @click="flowRecordObj.oldDialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
425
+ </div>
426
+ </el-dialog>
427
+
428
+ <el-dialog :close-on-click-modal="false" append-to-body title="选择退回节点"
429
+ :visible.sync="backDialogVisible"
430
+ width="450px" height="320px"
431
+ top="30vh">
432
+ <el-form label-width="80px">
433
+ <el-form-item label="退回节点">
434
+ <el-select v-model="backNodeId" clearable style="width: 100%">
435
+ <el-option v-for="item in backNodeArr" :key="item.nodeId" :label="item.nodeName" :value="item.nodeId">
436
+ </el-option>
437
+ </el-select>
438
+ </el-form-item>
439
+ <el-form-item label="退回备注">
440
+ <el-input v-model="backMsg" type="textarea" :autosize="{minRows:4,maxRows:4}"></el-input>
441
+ </el-form-item>
442
+ </el-form>
443
+ <div slot="footer" class="dialog-footer">
444
+ <el-button @click="beginBack" size="small" type="primary" icon="el-icon-success" :disabled="isDisabled2?false:true">确定</el-button>
445
+ <el-button @click="backDialogVisible = false" size="small" icon="el-icon-error">关闭</el-button>
446
+ </div>
447
+ </el-dialog>
448
+ </div>
449
+ </template>
450
+
451
+ <script>
452
+ import FlowInstList from "./flowInstList";
453
+ import FlowChart from "../flowChart";
454
+ import FlowRoamRecord from "../flowRoamRecords";
455
+ import {AjaxUtil} from 'sasp-base';
456
+
457
+ // import {Replace} from "sasp-base";
458
+ import RoamRecord from "../roamRecord";
459
+ import UserSelect from "../userSelect";
460
+ export default {
461
+ name: "flow-inst-tab",
462
+ components: {
463
+ UserSelect,
464
+ RoamRecord,
465
+ FlowRoamRecord,
466
+ FlowChart, FlowInstList
467
+ },
468
+ props: {
469
+ flowId: {type: String, default: ''},
470
+ operateRootArr: {type: Array},
471
+ flowobj: {type: Object},
472
+ defaultTab: {type: String},
473
+ settingData:{type: Object,default:()=>{return {};}},
474
+ userArr:{type: Array,default:()=>{return [];}},
475
+ userMap:{type: Object,default:()=>{return {};}},
476
+ initMessageFunc:{type: Function,default:null},
477
+ initFormInfo:{type: Function,default:null}, // 添加修改打开表单时执行的事件
478
+ saveFormInfo:{type: Function,default:null}, // 保存表单时执行的事件
479
+ dataPermis:{type:String,default:''},
480
+ },
481
+ data() {
482
+ let vm = this;
483
+ return {
484
+ flowData:{
485
+ flowId: '',
486
+ operateRootArr: [],
487
+ flowobj: {},
488
+ defaultTab: '',
489
+ dataPermisArr:[],
490
+ },
491
+ tabActive: "pending",
492
+ loginUser: {},//当前登录用户
493
+ userDept: {},//当前登录用户所在部门信息
494
+ flowDefine: {},
495
+ flowNodeIdToInfo: {},//key为id
496
+ flowNodeNameObj:{}, //节点名称对应节点id分组
497
+ draftNodeId:"", // 草稿节点id
498
+ allNodeInfo: {},//key为id
499
+ startNodeKey: "",//开始节点key
500
+ formFieldObj: {},//表单字段
501
+
502
+ isShow: false,
503
+ currentStartUser: "",
504
+ currentStartTime: "",
505
+
506
+ currentInst: {},//当前流程实例
507
+
508
+ // 列表按钮
509
+ listButtonObj: {
510
+ add: "新增",
511
+ delete: "删除",
512
+ update: "修改",
513
+ view: "查看",
514
+ deal: "处理",
515
+ flowRecord: "流转记录",
516
+ flowChart: "流程图",
517
+ },
518
+
519
+ // 批量处理
520
+ flowBatchPendingDialog: false,
521
+ batchUpdateFormInfo: {
522
+ formShow: false,
523
+ dataRows: [],
524
+ pendingNums: 0,
525
+ activeName: "",
526
+ batchDataId: ""
527
+ },
528
+
529
+ nodeFormBtnObj: {},
530
+
531
+ formBtnArr: [],
532
+ formBtnObjDefault: {
533
+ saveDraft: {
534
+ text: "存草稿",
535
+ type: "success",
536
+ icon: "el-icon-check",
537
+ show: true,
538
+ method: () => {
539
+ this.saveDraft();
540
+ }
541
+ },
542
+
543
+ nextStep: {
544
+ text: "下一步",
545
+ type: "primary",
546
+ icon: "el-icon-d-arrow-right",
547
+ show: true,
548
+ method: () => {
549
+ this.nextStep();
550
+ this.isDisabled1 = true;
551
+ }
552
+ },
553
+
554
+ completeSign: {
555
+ text: "加签",
556
+ type: "primary",
557
+ icon: "saspiconfont pl-icon-jiaqian",
558
+ show: false,
559
+ method: () => {
560
+ this.completeSignDialog = true;
561
+ }
562
+ },
563
+
564
+ turnSign: {
565
+ text: "转签",
566
+ type: "primary",
567
+ icon: "saspiconfont pl-icon-zhuanqian-icon",
568
+ show: false,
569
+ method: () => {
570
+ this.turnSignDialog = true;
571
+ }
572
+ },
573
+
574
+ back: {
575
+ text: "退回",
576
+ type: "danger",
577
+ icon: "el-icon-d-arrow-left",
578
+ show: false,
579
+ method: () => {
580
+ this.backToPrevious(this.currentInst);
581
+ }
582
+ },
583
+
584
+ retSpecified: {
585
+ text: "退回指定节点",
586
+ type: "danger",
587
+ icon: "el-icon-refresh-left",
588
+ show: false,
589
+ method: () => {
590
+ this.retSpecified(this.currentInst); //退回指定节点
591
+ }
592
+ },
593
+
594
+ stopped: {
595
+ text: "中止",
596
+ type: "danger",
597
+ icon: "saspiconfont pl-icon-yizhongzhi",
598
+ show: false,
599
+ method: () => {
600
+ this.axios.post(this.api.plFlowInst.stopFlow, {
601
+ instId: this.currentInst.flowInstId, type: "0",
602
+ procInstId: this.currentInst.linkProcId,
603
+ taskId: this.currentInst.taskId
604
+ }).then(res => {
605
+ if (res && res.data) {
606
+ if (res.data.operateSuccess) {
607
+ this.$message({type: "success", message: "中止成功!"});
608
+ if (this.flowBatchPendingDialog) {
609
+ this.batchTabRemove(this.currentInst.dataId);
610
+ } else {
611
+ this.tabCrudSearch();
612
+ this.flowInstDataDialog = false;
613
+ }
614
+ this.initTabNum();
615
+
616
+ let remindParam = {
617
+ instId:this.currentInst.flowInstId,
618
+ flowId:this.flowDefine.id,
619
+ flowName:this.flowDefine.flowName,
620
+ formId:this.formInfo.formId,
621
+ listViewId:this.formInfo.listViewId,
622
+ dataId:this.formInfo.dataId,
623
+ instType:"stopped"
624
+ };
625
+ this.axios.post(this.api.plFlowInst.saveRemind,remindParam);
626
+
627
+ //执行事件规则
628
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode] ||{};
629
+ if(currentNodeObj.openEvent == '1'){
630
+ this.exeNewFlowEvent("suspend",currentNodeObj.nodeLinkId||'');
631
+ }
632
+ } else {
633
+ this.$message({type: "error", message: res.data.operateMessage});
634
+ }
635
+ }
636
+ });
637
+ }
638
+ },
639
+
640
+ cancel: {
641
+ text: "撤销",
642
+ type: "danger",
643
+ icon: "saspiconfont pl-icon-chexiao",
644
+ show: false,
645
+ isView: true,
646
+ method: () => {
647
+ this.axios.post(this.api.plFlowInst.revokeFlow, {
648
+ instId: this.currentInst.flowInstId,
649
+ taskId: this.currentInst.taskId
650
+ }).then(res => {
651
+ if (res && res.data) {
652
+ if (res.data.operateSuccess) {
653
+ this.$message({type: "success", message: "撤销成功!"});
654
+ this.tabCrudSearch();
655
+ this.flowInstDataDialog = false;
656
+ this.initTabNum();
657
+
658
+ let remindParam = {
659
+ instId:this.currentInst.flowInstId,
660
+ flowId:this.flowDefine.id,
661
+ flowName:this.flowDefine.flowName,
662
+ formId:this.formInfo.formId,
663
+ listViewId:this.formInfo.listViewId,
664
+ dataId:this.formInfo.dataId,
665
+ instType:"cancel"
666
+ };
667
+ this.axios.post(this.api.plFlowInst.saveRemind,remindParam);
668
+
669
+
670
+ } else {
671
+ this.$message({type: "error", message: res.data.operateMessage});
672
+ }
673
+ }
674
+ });
675
+ }
676
+ },
677
+
678
+ getBack: {
679
+ text: "取回",
680
+ type: "danger",
681
+ icon: "el-icon-refresh-left",
682
+ show: false,
683
+ isView: true,
684
+ method: () => {
685
+ this.getBackPrevious();
686
+ }
687
+ },
688
+
689
+ restore: {
690
+ text: "恢复",
691
+ type: "success",
692
+ icon: "saspiconfont pl-icon-chexiao",
693
+ show: false,
694
+ isView: true,
695
+ method: () => {
696
+ this.restoreFlow();
697
+ }
698
+ },
699
+ record: {
700
+ text: "流转记录",
701
+ type: "warning",
702
+ icon: "saspiconfont pl-icon-liuchengtu",
703
+ show: true,
704
+ isView: true,
705
+ method: () => {
706
+ this.openFlowRecord(this.currentInst);
707
+ }
708
+ },
709
+ close: {
710
+ text: "关闭",
711
+ type: "",
712
+ icon: "el-icon-close",
713
+ show: true,
714
+ isView: true,
715
+ method: () => {
716
+ this.flowInstDataDialog = false;
717
+ this.flowBatchPendingDialog = false;
718
+ }
719
+ },
720
+ },
721
+
722
+ //表单按钮
723
+ formButtonObj: {
724
+ saveDraft: "存草稿",
725
+ completeSign: "加签",
726
+ turnSign: "转签",
727
+ nextStep: "下一步",
728
+ back: "退回",
729
+ getBack: "取回",
730
+ cancel: "撤销",
731
+ stopped: "中止",
732
+ close: "关闭",
733
+ export: "导出",
734
+ retSpecified: "退回指定节点"
735
+ },
736
+
737
+ nodeListButtonObj: {},
738
+ nodeFormButtonObj: {},
739
+ optColumnWidth: 336,
740
+ showModel: "list",//默认风格 list:列表card:卡片
741
+ showInfo: "",//展示信息 flow:流程信息 form:表单信息
742
+ operateType: {},
743
+ tabTypeObj: {},//标签页对象
744
+ numberObj: {draft: 0, pending: 0, processed: 0, rescinded: 0, finished: 0, discontinue: 0},//标签内容数量对象
745
+ flowChartDialogVisible: false,
746
+ agentTitle: "", //代理标题
747
+ agentFormObj: {
748
+ openAgent: '0',
749
+ agentUserId: '', //代理人
750
+ flowId: "",
751
+ userId: '',
752
+ agentNodeUser: '',
753
+ agentUser: {}, //代理人
754
+ agentUserName: '',//代理人名称
755
+ agentUserKey: '', //代理人id
756
+ }, //代理对象
757
+ agentNodeUserArr: [], //代理人arr
758
+ agentVisible: false,
759
+
760
+ flowFormTitle: "" || "流程信息",//工作流表单信息弹出框标题
761
+
762
+ // 流转记录
763
+ flowRecordObj: {
764
+ instId: "",
765
+ dialogVisible: false,
766
+ oldDialogVisible: false,
767
+ },
768
+
769
+ // 流程图
770
+ flowChartObj: {
771
+ dialogVisible: false,
772
+ flowId: "",
773
+ instId: "",
774
+ linkProcId:"",
775
+ isRelease:"",
776
+ },
777
+
778
+ completeSignDialog: false,//加签人窗口
779
+ turnSignDialog: false,//转签人窗口
780
+ pendingNums: "",//批量处理条数
781
+ sysOrgPosUserDialog: false,
782
+ mulitiChooseUser: false,//处理人是否多选
783
+
784
+ nextSteptUserDialog: false,//下一步执行人窗口
785
+ nextSteptUserType: "all",
786
+ nextSteptUserArr: [],//下一步处理人
787
+ chooseNextUserId: "",//选择的处理人
788
+ chooseNextUserName: "",//选择的处理人名称
789
+ choosePosUserIds: "",//选择的处理人组织岗位id
790
+ chooseNextUserIdObj: {},//选择的处理人集合
791
+ choosePosUserIdsObj: {},//选择的处理人组织岗位id集合
792
+ chooseNextUserNameObj: {},//选择的处理人名称集合
793
+ inclusiveChooseKey:"", // 并行网关下一步选择多个节点时是全部人员选择时
794
+
795
+ nextNodeName:"", // 下一个节点名称
796
+ nextNode: {},//下一个节点信息
797
+ description: "",//附加说明
798
+
799
+ // 处理、修改、查看流程信息弹窗
800
+ flowInstDataDialog: false,
801
+ currentRowData: {}, // 修改时行数据
802
+
803
+ // 表单信息
804
+ formInfo: {
805
+ formId: "",
806
+ formDefineKey:"",
807
+ listViewId: "",
808
+ tableViewId: "",
809
+ dataId: "",
810
+ fieldStatus: {},
811
+ fieldDefaultVal: {},
812
+ fieldDefaultValChangeNum:{},
813
+ flowFieldDefaultFromForm:{},
814
+
815
+ opt: "view",
816
+ },
817
+
818
+ isDisabled: {
819
+ update: true,
820
+ deal: true,
821
+ flowRecord: true,
822
+ flowChart: true,
823
+ view: true,
824
+ saveDraft: true,
825
+ completeSign: true,
826
+ turnSign: true,
827
+ nextStep: true,
828
+ back: true,
829
+ cancel: true,
830
+ stopped: true,
831
+ close: true,
832
+ export: true,
833
+ retSpecified: true,
834
+ getBack: true,
835
+ record: true,
836
+ restore: true,
837
+ },
838
+ flowParams:{}, // 流程流转变量
839
+ isDisabled1: true,
840
+
841
+ initSuccess: false,
842
+
843
+ backDialogVisible:false, //退回指定节点窗口
844
+ backNodeArr:[], //退回节点arr
845
+ backMsg:'',//退回信息
846
+ backNodeId:'',//退回节点id
847
+ isDisabled2:true,
848
+ isShowAgentSet:false,//是否显示流程设置
849
+ loadAgentSuccess:false,//是否显示流程设置
850
+
851
+ startNodeKeyObj:{}, //当前开始节点 key 和对应版本号
852
+ flowVersionNodeObj:{}, //版本号对应的节点对象
853
+ parentListViewId:"",
854
+ parentTableViewId:"",
855
+ scriptObj:{},
856
+ newScriptObj:{}, //新事件规则-脚本
857
+ newEventObj:{}, //新事件规则-规则
858
+ installListObj:this.EVENT_PLUGIN['installEventObj']||{}, //已经安装的流程事件
859
+ formSettingVisible:false,
860
+ workListViews:{},
861
+ workTableViews:{},
862
+ currNodeName: "", //当前节点名称
863
+ nextUserInfo:{}, // 下一步处理人的信息
864
+ dataId:"", // 表单数据id
865
+ }
866
+ },
867
+ watch:{
868
+ flowInstDataDialog(){
869
+ if(this.flowInstDataDialog){
870
+ this.isDisabled1 = true;
871
+ this.isDisabled['nextStep'] = true;
872
+ }
873
+ }
874
+ },
875
+ created() {
876
+ if(this.settingData&&Object.keys(this.settingData).length>0){
877
+ this.flowData.operateRootArr = this.settingData["operateRootArr"];
878
+ this.flowData.flowobj = this.settingData["flowObj"];
879
+ this.flowData.flowId = this.settingData["flowId"];
880
+ this.flowData.defaultTab = this.settingData["defaultTab"];
881
+ }else{
882
+ this.flowData.operateRootArr = this.operateRootArr;
883
+ this.flowData.flowobj = this.flowobj;
884
+ this.flowData.flowId = this.flowId;
885
+ this.flowData.defaultTab = this.defaultTab;
886
+ }
887
+ this.agentFormObj.flowId = this.flowData.flowId;
888
+ this.isShowAgentSet = false;
889
+ this.loginUser = this.CACHE_GLOBAL.getLoginUser();
890
+ this.userDept = this.CACHE_GLOBAL.getLoginDept();
891
+ // this.initResource();
892
+
893
+ this.getFlowInfo().then(res => {
894
+ this.initSuccess = true;
895
+ this.initflowObj();
896
+ this.getFlowAgent(); //加载流程代理
897
+ });
898
+ this.initTabNum();
899
+ // this.initWorkStageTurnOn();
900
+ },
901
+ methods: {
902
+
903
+ /**
904
+ * 打开[添加]窗口
905
+ */
906
+ openAddFlowForm() {
907
+ let nowVersion = this.flowDefine.releaseVersion; //只要已发布最小版本为1.0
908
+ this.currentRowData = {};
909
+ this.initFieldStatus(this.startNodeKeyObj[nowVersion],nowVersion).then(()=>{
910
+ this.initFormInfoFunc('add').then(() => {
911
+ this.formBtnArr = this.getAddAndUpdateFormBtn({});
912
+ Object.assign(this.formInfo, {
913
+ dataId: "",
914
+ opt: "add"
915
+ });
916
+ this.currentInst = {};
917
+ this.flowInstDataDialog = true;
918
+ })
919
+ });
920
+ // this.$refs.flowInstDataInfo && (this.$refs.flowInstDataInfo.optFormData = {});
921
+ // this.initFieldStatus(this.startNodeKeyObj[nowVersion],nowVersion).then(()=>{
922
+ // this.formBtnArr = this.getAddAndUpdateFormBtn({});
923
+ // Object.assign(this.formInfo, {
924
+ // dataId: "",
925
+ // opt: "add"
926
+ // });
927
+ // this.currentInst = {};
928
+ // this.$nextTick(() => {
929
+ // this.$refs.flowInstDataInfo.loadData().then(() => {
930
+ // this.exeFlowEvent("add","afterClick");
931
+ // let startNodeKey = this.startNodeKeyObj[nowVersion];
932
+ // let startNodeObj = this.flowVersionNodeObj[nowVersion][startNodeKey] || {};
933
+ // if(startNodeObj.openEvent == '1'){
934
+ // this.exeNewFlowEvent("addAfter");//新事件规则
935
+ // }
936
+ // })
937
+ // })
938
+ // });
939
+ },
940
+ initFormInfoFunc(type,rowData){
941
+ if(!rowData){
942
+ rowData = {};
943
+ }
944
+ let dataId = rowData.dataId || "";
945
+ let nodeObjs = this.flowVersionNodeObj[this.flowDefine.releaseVersion];
946
+ let startNodeKey = this.startNodeKeyObj[rowData.version];
947
+ let nodeKey = rowData.nodeKey;
948
+ let currentNode = nodeObjs[nodeKey || startNodeKey];
949
+ if(type === 'add'){
950
+ let version = this.flowDefine.releaseVersion;
951
+ currentNode = this.flowVersionNodeObj[version][this.startNodeKeyObj[version]];
952
+ }
953
+ // console.log(currentNode);
954
+ return new Promise(resolve => {
955
+ this.initFormInfo && this.initFormInfo(type,dataId,JSON.parse(currentNode.fieldOperate || "{}"),rowData.id);
956
+ resolve();
957
+ })
958
+ },
959
+ /**
960
+ * 打开[修改和处理]窗口
961
+ */
962
+ initUpdateFlowForm(row) {
963
+ this.currentRowData = row;
964
+ this.currNodeName = 'noEnd';
965
+
966
+ return new Promise(resolve => {
967
+ let startNodeKey = this.startNodeKeyObj[row.version];
968
+ this.initFieldStatus(row.nodeKey || startNodeKey,row.version).then(()=>{
969
+ this.initFormInfoFunc('update',row).then(() => {
970
+ this.currentStartUser = this.userMap[row.startUserId] || "";
971
+ this.currentStartTime = row.startTime;
972
+ this.currentInst = row;
973
+
974
+ Object.assign(this.formInfo, {
975
+ dataId: row.dataId,
976
+ opt: "update"
977
+ });
978
+ this.formBtnArr = this.getAddAndUpdateFormBtn(row);
979
+ resolve(true);
980
+ });
981
+ })
982
+ })
983
+ },
984
+
985
+ /**
986
+ * 打开[修改和处理]窗口
987
+ */
988
+ openUpdateFlowForm(row,executePosition) {
989
+ this.currentRowData = row;
990
+ this.currNodeName = 'noEnd';
991
+ this.flowInstDataDialog = true;
992
+ this.initUpdateFlowForm(row).then(() =>{
993
+ this.flowInstDataDialog = true;
994
+ // this.$nextTick(() => {
995
+ // this.$refs.flowInstDataInfo.loadData().then(() => {
996
+ // this.exeFlowEvent(executePosition,"afterClick",row.currentNode);
997
+ //
998
+ // let currentNodeObj = this.flowNodeIdToInfo[row.currentNode] ||{};
999
+ // if(currentNodeObj.openEvent== '1'){ //开启事件
1000
+ // this.exeNewFlowEvent("editAfter",currentNodeObj.nodeLinkId ||'');//新事件规则
1001
+ // }
1002
+ // })
1003
+ // })
1004
+ });
1005
+ },
1006
+
1007
+ /**
1008
+ * 打开[查看]窗口
1009
+ */
1010
+ openViewFlowForm(row) {
1011
+ this.currentRowData = row;
1012
+ let startNodeKey = this.startNodeKeyObj[row.version];
1013
+ if (row.currentNodeName === "结束"){
1014
+ this.currNodeName = "end";
1015
+ }
1016
+ this.initFieldStatus(row.nodeKey || startNodeKey,row.version,row.flowStatus).then(() =>{
1017
+ this.initFormInfoFunc('view',row).then(() => {
1018
+ this.currentStartUser = this.userMap[row.startUserId] || "";
1019
+ this.currentStartTime = row.startTime;
1020
+ this.currentInst = row;
1021
+
1022
+ Object.assign(this.formInfo, {
1023
+ dataId: row.dataId,
1024
+ opt: "view",
1025
+ });
1026
+ this.formBtnArr = this.getViewFormBtn(row);
1027
+ this.flowInstDataDialog = true;
1028
+ });
1029
+ });
1030
+ },
1031
+
1032
+ /**
1033
+ * 打开批量处理窗口
1034
+ * @param rows 需要批量修改的数据
1035
+ */
1036
+ openBatchUpdateFlowForm(rows) {
1037
+ let arrRows = [];
1038
+ rows.forEach(data => {
1039
+ arrRows.push(Object.assign({}, data));
1040
+ });
1041
+ Object.assign(this.batchUpdateFormInfo, {
1042
+ formShow: false,
1043
+ dataRows: arrRows,
1044
+ pendingNums: arrRows.length,
1045
+ activeName: arrRows[0].dataId,
1046
+ batchDataId: arrRows[0].dataId
1047
+ });
1048
+
1049
+ this.initUpdateFlowForm(arrRows[0]).then(()=>{
1050
+ this.flowBatchPendingDialog = true;
1051
+ this.batchUpdateFormInfo.formShow = true;
1052
+ let ref='batchTableForm'+arrRows[0].dataId+'Ref'
1053
+
1054
+ this.$nextTick(()=>{
1055
+ this.$refs[ref][0].loadData().then(() => {
1056
+ this.exeFlowEvent("handle","afterClick",arrRows[0].currentNode,ref);
1057
+ })
1058
+ })
1059
+ });
1060
+ },
1061
+
1062
+ /**
1063
+ * 获取[添加、修改和处理]的操作按钮
1064
+ */
1065
+ getAddAndUpdateFormBtn(row) {
1066
+ //走版本
1067
+ let arrNodeFormBtns = [];
1068
+ if(row.version){
1069
+ arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1070
+ }else {
1071
+ arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1072
+ }
1073
+ let hideBtnTypes = new Set(["getBack"]);
1074
+ if (this.tabActive == "draft") {
1075
+ hideBtnTypes.add("flowRecord");
1076
+ hideBtnTypes.add("record");
1077
+ }else if(this.tabActive == "pending"){//待处理
1078
+ hideBtnTypes.add("cancel");
1079
+ if(row.operateStatus=='1'||row.operateStatus=='3'){//如果是加签转签 不需要部分按钮
1080
+ hideBtnTypes.add("retSpecified");
1081
+ hideBtnTypes.add("back");
1082
+ hideBtnTypes.add("completeSign");
1083
+ hideBtnTypes.add("turnSign");
1084
+ }
1085
+ }
1086
+
1087
+ return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
1088
+ },
1089
+
1090
+ /**
1091
+ * 获取[查看]的操作按钮
1092
+ */
1093
+ getViewFormBtn(row) {
1094
+ //走版本
1095
+ let arrNodeFormBtns = [];
1096
+ if(row.version){
1097
+ arrNodeFormBtns = this.nodeFormBtnObj[(this.flowVersionNodeObj[row.version][row.nodeKey || this.startNodeKeyObj[row.version]] || {}).id];
1098
+ }else {
1099
+ arrNodeFormBtns = this.nodeFormBtnObj[this.flowVersionNodeObj[this.flowDefine.releaseVersion][this.startNodeKeyObj[this.flowDefine.releaseVersion]].id];
1100
+ }
1101
+ let hideBtnTypes = new Set(["getBack", "cancel", "restore"]);
1102
+ if (this.tabActive == "processed") { // 已处理
1103
+
1104
+ // 上个节点的处理可以取回(已开启按钮的情况下)
1105
+ if ((row.beforeDealer || "").split(",").indexOf(this.loginUser.id) > -1) {
1106
+ hideBtnTypes.delete("getBack");
1107
+ }
1108
+
1109
+ // 流程的发起人可以撤销(已开启按钮的情况下)
1110
+ if (row.startUserId == this.loginUser.id) {
1111
+ hideBtnTypes.delete("cancel");
1112
+ }
1113
+ //被挂起数据只有查看按钮
1114
+ if(row.hangUp == '1'){
1115
+ hideBtnTypes.add("getBack");
1116
+ hideBtnTypes.add("cancel");
1117
+ hideBtnTypes.add("restore");
1118
+ }
1119
+ } else if (this.tabActive == "discontinue" && row.discontinueUserId == this.loginUser.id) { // 已中止
1120
+ // 当前登陆用户是中止人才显示恢复按钮(已开启按钮的情况下)
1121
+ hideBtnTypes.delete("restore");
1122
+ }
1123
+
1124
+ return this.formatterFormBtnByHideBtnTypes(arrNodeFormBtns, hideBtnTypes);
1125
+ },
1126
+
1127
+ /**
1128
+ * 根据隐藏按钮类型格式化按钮信息
1129
+ */
1130
+ formatterFormBtnByHideBtnTypes(arrFormBtns, hideBtnTypes) {
1131
+ let arrResults = [];
1132
+ arrFormBtns.forEach(data => {
1133
+ let objTmp = Object.assign({}, data);
1134
+ hideBtnTypes.has(data.btnType) && (objTmp.show = false);
1135
+ if(this.tabActive == "discontinue" && data.btnType == "restore" && !hideBtnTypes.has(data.btnType)){
1136
+ objTmp.show = true;
1137
+ }
1138
+ if(this.tabActive == "processed" && data.btnType == "getBack" && !hideBtnTypes.has(data.btnType)){
1139
+ objTmp.show = true;
1140
+ }
1141
+ if(this.tabActive == "processed" && data.btnType == "cancel" && !hideBtnTypes.has(data.btnType)){
1142
+ objTmp.show = true;
1143
+ }
1144
+ arrResults.push(objTmp);
1145
+ });
1146
+ return arrResults;
1147
+ },
1148
+
1149
+ /**
1150
+ * 打开流程图窗口
1151
+ * @param instId 流程实例ID
1152
+ */
1153
+ openFlowChart(row) {
1154
+ let instId = "";
1155
+ let linkProcId = "";
1156
+ let isRelease = "";
1157
+ if(row){
1158
+ instId = row.flowInstId;
1159
+ linkProcId = row.linkProcId;
1160
+ isRelease = row.isRelease;
1161
+ }
1162
+ this.flowChartObj = {instId: instId,linkProcId:linkProcId,isRelease:isRelease, dialogVisible: true};
1163
+ },
1164
+
1165
+ /**
1166
+ * 打开流转记录窗口
1167
+ * @param row 流程行数据
1168
+ */
1169
+ openFlowRecord(row) {
1170
+ let arr = ["2","3","4"]; // 旧版本的已办结已撤销以及已中止数据通过旧版接口查询流转记录
1171
+ if(arr.indexOf(row.flowStatus) > -1 && row.isOldData == "1"){
1172
+ this.flowRecordObj = {instId: row.flowInstId || "", oldDialogVisible: true};
1173
+ }else{
1174
+ this.flowRecordObj = {instId: row.flowInstId || "", dialogVisible: true};
1175
+ }
1176
+ },
1177
+
1178
+ /**
1179
+ * 存草稿
1180
+ */
1181
+ saveDraft() {
1182
+ // let loading = this.$loading({
1183
+ // lock: true,
1184
+ // spinner: 'el-icon-loading',
1185
+ // background: 'rgba(0, 0, 0, 0.7)'
1186
+ // })
1187
+
1188
+ this.saveDataFunc().then(resData => {
1189
+ this.tabCrudSearch();
1190
+
1191
+ this.flowInstDataDialog = false;
1192
+ if (resData.flowInstId) {
1193
+ this.$message({type: "success", message: "保存成功!"});
1194
+ } else {
1195
+ this.$message({type: "error", message: "保存失败!"});
1196
+ }
1197
+ // loading && loading.close();
1198
+ this.currentInst={};
1199
+ });
1200
+ },
1201
+
1202
+ saveDataFunc(type){ // 保存完成后返回流程的相关变量,通过变量传递到后台驱动流程运转
1203
+ // 保存草稿、下一步保存
1204
+ return new Promise(resolve => {
1205
+ if(this.saveFormInfo){
1206
+ let result = this.saveFormInfo(type);
1207
+ if(result && result.then){
1208
+ result.then(res => {
1209
+ if(!res){
1210
+ return;
1211
+ }
1212
+ if(typeof res !== 'object'){
1213
+ res = {};
1214
+ }
1215
+ this.saveFlowData(res).then(flowInstData => {
1216
+ res['flowInstId'] = flowInstData.id;
1217
+ resolve(res);
1218
+ })
1219
+ })
1220
+ }else{
1221
+ if(!result){
1222
+ return;
1223
+ }
1224
+ if(typeof result !== 'object'){
1225
+ result = {};
1226
+ }
1227
+ this.saveFlowData(result).then(flowInstData => {
1228
+ result['flowInstId'] = flowInstData.id;
1229
+ resolve(result);
1230
+ })
1231
+ }
1232
+ }else{
1233
+ this.saveFlowData().then(flowInstData => {
1234
+ let obj = {};
1235
+ obj['flowInstId'] = flowInstData.id;
1236
+ resolve(obj);
1237
+ })
1238
+ }
1239
+ })
1240
+ },
1241
+
1242
+ saveFlowData(flowParams){
1243
+ return new Promise(resolve => {
1244
+ flowParams = flowParams || {};
1245
+ let flowSummary = this.getFlowSummary(flowParams);
1246
+ let flowInst = {};
1247
+ let dataId = (flowParams || {}).flowDataId || "";
1248
+ this.dataId = dataId;
1249
+ if(this.currentInst && this.currentInst.id){
1250
+ this.$set(this.formInfo,"opt","update");
1251
+ flowInst = {
1252
+ "id": this.currentInst.id,
1253
+ "flowSummary": flowSummary,
1254
+ "updated": this.loginUser.id,
1255
+ };
1256
+ if(this.formInfo.opt == 'add' || this.tabActive == 'draft'){ //版本号也要随之更新
1257
+ flowInst = Object.assign(flowInst,{"version":this.flowDefine.releaseVersion,"isRelease":this.flowDefine.isRelease})
1258
+ }
1259
+ this.axios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1260
+ resolve(instRes.data.operateObj);
1261
+ });
1262
+ }else{
1263
+ let startNodeKey = this.startNodeKeyObj[this.flowDefine.releaseVersion];
1264
+ if (this.formInfo.opt == "add") {
1265
+ flowInst = {
1266
+ flowId: this.flowDefine.id,
1267
+ flowSummary: flowSummary,
1268
+ dataId: dataId,
1269
+ version:this.flowDefine.releaseVersion, //版本号
1270
+ startTime: this.DATE_UTIL.getCurrentDateTime(), flowStatus: "0",
1271
+ created: this.loginUser.id,
1272
+ currentNode: this.flowVersionNodeObj[this.flowDefine.releaseVersion][startNodeKey].id,
1273
+ isRelease:this.flowDefine.isRelease
1274
+ };
1275
+ } else {
1276
+ flowInst = {
1277
+ id: this.currentInst.id,
1278
+ flowSummary: flowSummary,
1279
+ version:this.flowDefine.releaseVersion, //版本号也要随之更新
1280
+ updated: this.loginUser.id,
1281
+ };
1282
+ }
1283
+ this.axios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1284
+ resolve(instRes.data.operateObj);
1285
+ this.currentInst=instRes.data.operateObj;
1286
+ });
1287
+ }
1288
+ })
1289
+ },
1290
+
1291
+ /**
1292
+ * 保存草稿
1293
+ */
1294
+ saveData() {
1295
+ let type = this.flowBatchPendingDialog ? "batch" : "";
1296
+ return new Promise(resolve => {
1297
+ let flowInstDataInfoRef = "";
1298
+ if (type == 'batch') {
1299
+ // 批量处理
1300
+ flowInstDataInfoRef = this.$refs[`batchTableForm${this.batchUpdateFormInfo.activeName}Ref`];
1301
+ flowInstDataInfoRef = flowInstDataInfoRef[0] || flowInstDataInfoRef;
1302
+ } else {
1303
+ flowInstDataInfoRef = this.$refs.flowInstDataInfo;
1304
+ }
1305
+ let startNodeKey = this.startNodeKeyObj[this.flowDefine.releaseVersion];
1306
+ flowInstDataInfoRef.saveData(this.loginUser.id).then(res => {
1307
+ if (res && res.operateSuccess) {
1308
+ let flowSummary = this.getFlowSummary(flowInstDataInfoRef.optFormData,flowInstDataInfoRef.fieldSysDataObj || {});
1309
+ let flowInst = {};
1310
+ let dataId = res.operateObj;
1311
+ this.dataId = dataId;
1312
+ if(this.currentInst && this.currentInst.id){
1313
+ this.$set(this.formInfo,"opt","update");
1314
+ flowInst = {
1315
+ "id": this.currentInst.id,
1316
+ "flowSummary": flowSummary,
1317
+ "updated": this.loginUser.id,
1318
+ };
1319
+ if(this.formInfo.opt == 'add' || this.tabActive == 'draft'){ //版本号也要随之更新
1320
+ flowInst = Object.assign(flowInst,{"version":this.flowDefine.releaseVersion,"isRelease":this.flowDefine.isRelease})
1321
+ }
1322
+ this.axios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1323
+ resolve(instRes.data);
1324
+ });
1325
+ }else{
1326
+ if (this.formInfo.opt == "add") {
1327
+ flowInst = {
1328
+ flowId: this.flowDefine.id,
1329
+ flowSummary: flowSummary,
1330
+ dataId: dataId,
1331
+ startUserId: this.loginUser.id,
1332
+ version:this.flowDefine.releaseVersion, //版本号
1333
+ startTime: this.DATE_UTIL.getCurrentDateTime(), flowStatus: "0",
1334
+ created: this.loginUser.id,
1335
+ currentNode: this.flowVersionNodeObj[this.flowDefine.releaseVersion][startNodeKey].id,
1336
+ isRelease:this.flowDefine.isRelease
1337
+ };
1338
+ } else {
1339
+ flowInst = {
1340
+ id: this.currentInst.id,
1341
+ flowSummary: flowSummary,
1342
+ version:this.flowDefine.releaseVersion, //版本号也要随之更新
1343
+ updated: this.loginUser.id,
1344
+ };
1345
+ }
1346
+ this.axios.post(this.api.plFlowInst.url + "/" + this.formInfo.opt, flowInst).then(instRes => {
1347
+ resolve(instRes.data);
1348
+ this.currentInst=instRes.data;
1349
+ });
1350
+ }
1351
+ let afterClickResult;
1352
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1353
+ if (type == 'batch') {//批量处理 需处理tab页
1354
+ let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
1355
+ if(currentNodeObj.openEvent == '1'){
1356
+ afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId,ref);
1357
+ }
1358
+ }else {
1359
+ if(currentNodeObj.openEvent == '1'){
1360
+ afterClickResult=this.exeNewFlowEvent("saveAfter", currentNodeObj.nodeLinkId);
1361
+ }
1362
+ }
1363
+ }else{
1364
+ this.$message({type:"error",message:"保存失败!"});
1365
+ }
1366
+ });
1367
+ });
1368
+ },
1369
+
1370
+ /**
1371
+ * 下一步,保存数据以及获取处理人
1372
+ */
1373
+ nextStep() {
1374
+ // let type = this.flowBatchPendingDialog ? "batch" : "";
1375
+ // let afterClickResult;
1376
+ // let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1377
+ // afterClickResult=this.exeFlowEvent("nextStep","afterClick", this.currentInst.currentNode || this.draftNodeId);
1378
+ //
1379
+ // if(currentNodeObj.openEvent == '1'){
1380
+ // afterClickResult = this.exeNewFlowEvent("nextClick",currentNodeObj.nodeLinkId);
1381
+ // }
1382
+
1383
+ // let afterValidateResult;
1384
+ // let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1385
+ // afterValidateResult=this.exeFlowEvent("nextStep","afterValidate", this.currentInst.currentNode || this.draftNodeId);
1386
+ // if(currentNodeObj.openEvent == '1'){
1387
+ // afterValidateResult = this.exeNewFlowEvent("nextCheck",currentNodeObj.nodeLinkId);
1388
+ // }
1389
+
1390
+ this.isDisabled['nextStep'] = false;
1391
+ this.flowParams = {};
1392
+ this.saveDataFunc().then(flowParams => {
1393
+ this.flowParams = JSON.parse(JSON.stringify(flowParams));
1394
+ let instId = flowParams.flowInstId;
1395
+ this.$set(this.formInfo,"opt","update");
1396
+ this.currentInst.id = instId;
1397
+ this.description = "";
1398
+ this.saveInstId = instId;
1399
+ //获取处理人
1400
+ let obj = {instId: instId, taskId: this.currentInst.taskId};
1401
+ let params = {};
1402
+ Object.assign(params,flowParams || {},obj);
1403
+ this.axios.post(this.api.plFlowInst.getNextUsers, params).then(res => {
1404
+ if(!res.data.operateSuccess){
1405
+ this.isDisabled['nextStep'] = true;
1406
+ if(res.data.resultObject === 'requestException'){
1407
+ this.$message.error(res.data.errorInfo);
1408
+ }else{
1409
+ this.$message.error("未获取到处理人");
1410
+ }
1411
+ return;
1412
+ }
1413
+ let obj = {};
1414
+ if (res && res.data) {
1415
+ obj = res.data.operateObj || {};
1416
+ }
1417
+ this.nextNodeName = "";
1418
+ this.choosePosUserIds = "";
1419
+ this.choosePosUserIdsObj = {};
1420
+ if (obj.nextType == "inclusiveGateway") {
1421
+ this.nextNode = obj;
1422
+ this.chooseNextUserIdObj = {};
1423
+ this.chooseNextUserNameObj = {};
1424
+ let autoChooseUser = false;
1425
+ (obj.result || []).forEach(item => {
1426
+ //获取下一个节点信息
1427
+ let nextNodeTmp = this.flowNodeIdToInfo[item.nextNodeId] || {};
1428
+ if (nextNodeTmp.nodeType == "UserTask") {
1429
+ item.mulitiChooseUser = nextNodeTmp.dealType != "single";
1430
+ autoChooseUser = nextNodeTmp.autoChooseUser == "1";
1431
+ if (item.mulitiChooseUser) {
1432
+ this.$set(this.chooseNextUserIdObj, item.nodeKey, []);
1433
+ } else {
1434
+ this.$set(this.chooseNextUserIdObj, item.nodeKey, "");
1435
+ }
1436
+ } else if (this.nextNode.nodeType == "EndEvent") {
1437
+ return;
1438
+ }
1439
+ let userArr = item.userArr || [];
1440
+ //自动执行时的自动执行人
1441
+ if (autoChooseUser) {
1442
+ if (item.type == "user" && userArr.length == 0) {
1443
+ // this.$message({type:"error",message:"没有处理人!"});
1444
+ return;
1445
+ } else {
1446
+ let userIds = "";
1447
+ let userNames = "";
1448
+ userArr.forEach(userInfo => {
1449
+ userIds += "," + userInfo.id;
1450
+ userNames += "," + userInfo.userName;
1451
+ });
1452
+ this.chooseNextUserIdObj[item.nodeKey] = userIds.substring(1);
1453
+ this.chooseNextUserId = userIds.substring(1);
1454
+ this.chooseNextUserName = userNames.substring(1);
1455
+ this.saveNextStept();
1456
+ }
1457
+ }
1458
+ item.nextSteptUserType = obj.type;
1459
+ if (item.type == "user" || item.type== 'all') {
1460
+ item.nextSteptUserArr = userArr;
1461
+ }
1462
+ });
1463
+ if(!autoChooseUser){
1464
+ this.nextSteptUserDialog = true;
1465
+ }
1466
+ } else {
1467
+ //获取下一个节点信息
1468
+ this.nextNode = this.allNodeInfo[obj.nextNodeId] || {};
1469
+ this.nextNodeName = obj.nextNodeName || "";
1470
+ let autoChooseUser = false;
1471
+ if (this.nextNode.nodeType == "UserTask") {
1472
+ this.mulitiChooseUser = this.nextNode.dealType != "single";
1473
+ autoChooseUser = this.nextNode.autoChooseUser == "1";
1474
+ this.chooseNextUserId = "";
1475
+ this.chooseNextUserName = "";
1476
+ } else if (this.nextNode.nodeType == "EndEvent") {
1477
+ this.nextSteptUserDialog = true;
1478
+ return;
1479
+ }
1480
+ let userArr = obj.userArr || [];
1481
+ //自动执行时的自动执行人
1482
+ if (autoChooseUser) {
1483
+ if (obj.type == "user" && userArr.length == 0) {
1484
+ this.$message({type: "error", message: "没有处理人!"});
1485
+ return;
1486
+ } else {
1487
+ let userIds = "";
1488
+ let userNames = "";
1489
+ userArr.forEach(userInfo => {
1490
+ userIds += "," + userInfo.id;
1491
+ userNames += "," + userInfo.userName;
1492
+ });
1493
+ if (userIds) {
1494
+ this.chooseNextUserId = userIds.substring(1);
1495
+ this.chooseNextUserName = userNames.substring(1);
1496
+ }
1497
+ this.saveNextStept();
1498
+ }
1499
+ }
1500
+ this.nextSteptUserType = obj.type;
1501
+ if (obj.type == "user" || obj.type == 'all') {
1502
+ this.nextSteptUserArr = userArr;
1503
+ }
1504
+ if(!autoChooseUser){
1505
+ this.nextSteptUserDialog = true;
1506
+ }
1507
+ }
1508
+ if(this.nextNode.nextType == 'inclusiveGateway'){
1509
+ (this.nextNode.result || []).forEach(item => {
1510
+ this.chooseNextUserIdObj[item.nodeKey] = (item.userArr || {}).id;
1511
+ });
1512
+ }else{
1513
+ let userInfo = this.nextSteptUserArr[0] || {};
1514
+ if(this.nextNode.dealType=="single"){
1515
+ this.chooseNextUserId = userInfo.id;
1516
+ this.chooseNextUserName = userInfo.userName;
1517
+ }
1518
+ }
1519
+ });
1520
+ });
1521
+ },
1522
+
1523
+ /**
1524
+ * 关闭批量处理页面
1525
+ */
1526
+ closeFlowBatchPending() {
1527
+ this.flowBatchPendingDialog = false;
1528
+ this.$nextTick(() => {
1529
+ this.pendingNums = 0;
1530
+ });
1531
+ },
1532
+
1533
+ /**
1534
+ * 点击标签页
1535
+ */
1536
+ batchTabClick(val) {
1537
+ this.batchUpdateFormInfo.batchDataId = val.name;
1538
+ this.initUpdateFlowForm(this.batchUpdateFormInfo.dataRows[val.index]);
1539
+ let dataId=this.batchUpdateFormInfo.dataRows[val.index].dataId;
1540
+ let currentNode=this.batchUpdateFormInfo.dataRows[val.index].currentNode;
1541
+ let ref='batchTableForm'+dataId+'Ref';
1542
+
1543
+ this.$nextTick(()=>{
1544
+ this.$refs[ref][0].loadData().then(() => {
1545
+ this.exeFlowEvent("handle","afterClick",currentNode,ref);
1546
+ })
1547
+ })
1548
+
1549
+ },
1550
+
1551
+ /**
1552
+ * 关闭标签页
1553
+ */
1554
+ batchTabRemove(targetName) {
1555
+ let dataRows = this.batchUpdateFormInfo.dataRows;
1556
+ let nextTab;
1557
+ let i;
1558
+ for (i = 0; i < dataRows.length; i++) {
1559
+ let data = dataRows[i];
1560
+ if (data.dataId == targetName) {
1561
+ if (this.batchUpdateFormInfo.activeName == targetName) {
1562
+ nextTab = dataRows[i + 1] || dataRows[i - 1] || null;
1563
+ }
1564
+ break;
1565
+ }
1566
+ }
1567
+ dataRows.splice(i, 1);
1568
+ if (nextTab) {
1569
+ this.batchUpdateFormInfo.activeName = nextTab.dataId;
1570
+ this.batchUpdateFormInfo.batchDataId =nextTab.dataId;
1571
+ this.initUpdateFlowForm(nextTab).then(()=>{
1572
+ this.$nextTick(()=>{
1573
+ let ref='batchTableForm'+nextTab.dataId+'Ref';
1574
+ this.$refs[ref][0].loadData().then(() => {
1575
+ this.exeFlowEvent("handle","afterClick",nextTab.currentNode,ref);
1576
+ })
1577
+ })
1578
+ });
1579
+ }
1580
+
1581
+ if (dataRows.length == 0) {
1582
+ this.flowBatchPendingDialog = false;
1583
+ }
1584
+ //初始化数据
1585
+ this.tabCrudSearch();
1586
+ },
1587
+
1588
+ /**
1589
+ * 选择下一步执行人
1590
+ */
1591
+ chooseUser(nodekey) {
1592
+ this.inclusiveChooseKey = nodekey || "";
1593
+ this.sysOrgPosUserDialog = true;
1594
+ },
1595
+
1596
+ /**
1597
+ * 确认执行人
1598
+ */
1599
+ sureNextUser() {
1600
+ let checkedUserArr = this.$refs.orgPosUserRef.chooseUsers || [];
1601
+ let userName = "";
1602
+ let userId = "";
1603
+ let arr = [];
1604
+ let posUserIdArr = [];
1605
+ checkedUserArr.forEach(item => {
1606
+ userName += "," + item.dataLabel;
1607
+ userId += "," + item.dataKey;
1608
+ arr.push(item.dataKey);
1609
+ posUserIdArr.push(item.dataKey);
1610
+ });
1611
+ if (userName) {
1612
+ userName = userName.substring(1);
1613
+ userId = userId.substring(1);
1614
+ }
1615
+ this.chooseNextUserName = userName;
1616
+ this.chooseNextUserId = userId;
1617
+ this.choosePosUserIds = posUserIdArr.join(",");
1618
+ if(this.inclusiveChooseKey){
1619
+ this.chooseNextUserNameObj[this.inclusiveChooseKey] = userName;
1620
+ this.chooseNextUserIdObj[this.inclusiveChooseKey] = arr;
1621
+ this.choosePosUserIdsObj[this.inclusiveChooseKey] = posUserIdArr.join(",");
1622
+ }
1623
+ this.sysOrgPosUserDialog = false;
1624
+ },
1625
+
1626
+ /**
1627
+ * 下一步确定
1628
+ */
1629
+ saveNextStept() {
1630
+ this.isDisabled1 = false;
1631
+ let dealers = this.chooseNextUserId;
1632
+ let dealerNames = this.chooseNextUserName;
1633
+ let dealersObj = {};
1634
+ if (this.nextNode.nextType == "inclusiveGateway") {
1635
+ // 校验是否选人了
1636
+ let tempResult = true;
1637
+ Object.keys(this.chooseNextUserIdObj).forEach(key => {
1638
+ let dealers = this.chooseNextUserIdObj[key];
1639
+ if(Array.isArray(dealers)){
1640
+ dealersObj[key] = dealers.join(",");
1641
+ }else{
1642
+ dealersObj[key] = dealers;
1643
+ }
1644
+ if ((this.chooseNextUserIdObj[key] || []).length == 0) {
1645
+ tempResult = false;
1646
+ }
1647
+ });
1648
+ if (!tempResult) {
1649
+ this.$message.error("所有任务都需要设置执行人!");
1650
+ this.isDisabled1 = true;
1651
+ return;
1652
+ }
1653
+ } else {
1654
+ if (dealers && !dealerNames) {
1655
+ let userName = "";
1656
+ this.nextSteptUserArr.forEach(item => {
1657
+ if (("," + dealers + ",").indexOf("," + item.id + ",") > -1) {
1658
+ userName += "," + item.userName;
1659
+ }
1660
+ });
1661
+ if (userName) {
1662
+ userName = userName.substring(1);
1663
+ }
1664
+ this.chooseNextUserName = userName;
1665
+ dealerNames = this.chooseNextUserName;
1666
+ }
1667
+ if (this.nextNode.nodeType != 'EndEvent') {
1668
+ if (!this.chooseNextUserId || this.chooseNextUserId.length == 0) {
1669
+ this.$message({type: "error", message: "请选择处理人!"});
1670
+ this.isDisabled1 = true;
1671
+ return;
1672
+ }
1673
+ if (this.nextNode.dealType != "single") {
1674
+ if (typeof this.chooseNextUserId == 'string') {
1675
+ dealers = this.chooseNextUserId;
1676
+ } else {
1677
+ dealers = this.chooseNextUserId.join(",");
1678
+ }
1679
+ if (typeof this.chooseNextUserName == 'string') {
1680
+ dealerNames = this.chooseNextUserName;
1681
+ } else {
1682
+ dealerNames = this.chooseNextUserName.join(",");
1683
+ }
1684
+ }else if(this.nextNode.dealType == "single"){
1685
+ dealers=dealers.split(",")[0];
1686
+ dealerNames=dealerNames.split(",")[0];
1687
+ }
1688
+ } else {
1689
+ dealers = "";
1690
+ }
1691
+ dealersObj[this.nextNode["nodeLinkId"]] = dealers;
1692
+ }
1693
+
1694
+ this.nextUserInfo['dealers'] = dealers;
1695
+ this.nextUserInfo['dealerNames'] = dealerNames;
1696
+ this.nextUserInfo['dealersObj'] = dealersObj;
1697
+
1698
+ let obj = {
1699
+ instId: this.saveInstId,
1700
+ dealers: dealers,
1701
+ dealerNames: dealerNames,
1702
+ nextNodeType: this.nextNode.nodeType,
1703
+ dealersObj: JSON.stringify(dealersObj),
1704
+ taskId: this.currentInst.taskId,
1705
+ nextNodeId: this.nextNode.id,
1706
+ nextNodeKey: this.nextNode.nodeLinkId,
1707
+ }
1708
+ let params = {};
1709
+ Object.assign(params,this.flowParams || {},obj);
1710
+ this.axios.post(this.api.plFlowInst.executeNextStep,params).then(res => {
1711
+ if (res && res.data && res.data.operateSuccess) {
1712
+ this.initTabNum();
1713
+ this.$message({type: "success", message: "提交成功!"});
1714
+ if (this.flowBatchPendingDialog) {
1715
+ this.batchTabRemove(this.currentInst.dataId);
1716
+ } else {
1717
+ this.tabCrudSearch();
1718
+ }
1719
+
1720
+ this.nextSteptUserDialog = false;
1721
+ this.flowInstDataDialog = false;
1722
+
1723
+ let type = this.flowBatchPendingDialog ? "batch" : "";
1724
+ let currentNodeObj = this.flowNodeIdToInfo[this.currentInst.currentNode || this.draftNodeId] ||{};
1725
+ let submitSuccessRusult;
1726
+ if (type == 'batch') {
1727
+ // 批量处理
1728
+ let ref = "batchTableForm"+this.batchUpdateFormInfo.activeName+"Ref";
1729
+ submitSuccessRusult=this.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId,ref);
1730
+ if(currentNodeObj.openEvent == '1'){
1731
+ submitSuccessRusult = this.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'',ref)
1732
+ }
1733
+ } else {
1734
+ submitSuccessRusult=this.exeFlowEvent("nextStep","submitSuccess", this.currentInst.currentNode || this.draftNodeId);
1735
+ if(currentNodeObj.openEvent == '1'){
1736
+ submitSuccessRusult =this.exeNewFlowEvent("nextSubmit",currentNodeObj.nodeLinkId||'')
1737
+ }
1738
+ }
1739
+ if(submitSuccessRusult){
1740
+ //办结提醒
1741
+ if(this.nextNode.nodeType == "EndEvent"){
1742
+ let remindParam = {
1743
+ instId:this.saveInstId,
1744
+ flowId:this.flowDefine.id,
1745
+ flowName:this.flowDefine.flowName,
1746
+ formId:this.formInfo.formId,
1747
+ listViewId:this.formInfo.listViewId,
1748
+ dataId:this.formInfo.dataId,
1749
+ instType:"end"
1750
+ };
1751
+ this.axios.post(this.api.plFlowInst.saveRemind,remindParam);
1752
+ }
1753
+ }else{
1754
+ console.log("脚本异常")
1755
+ }
1756
+
1757
+
1758
+ } else {
1759
+ this.$message({type: "error", message: "保存失败!"});
1760
+ this.isDisabled1 = true;
1761
+ this.isDisabled['nextStep'] = true;
1762
+ }
1763
+ });
1764
+ },
1765
+
1766
+
1767
+ /**
1768
+ * 确认加签
1769
+ */
1770
+ sureCompleteSign() {
1771
+ let checkedUserArr = this.$refs.completeSignRef.chooseUsers || [];
1772
+ if (checkedUserArr.length == 0) {
1773
+ this.$message({type: "error", message: "请选择加签人!"});
1774
+ return;
1775
+ }
1776
+ let userIds = "";
1777
+ checkedUserArr.forEach(item => {
1778
+ userIds += "," + item.dataKey;
1779
+ });
1780
+ this.axios.post(this.api.plFlowInst.completeSign, {
1781
+ taskId: this.currentInst.taskId,
1782
+ dealers: userIds.substring(1)
1783
+ }).then(res => {
1784
+ if (res && res.data && res.data.operateSuccess) {
1785
+ this.completeSignDialog = false;
1786
+ this.flowInstDataDialog = false;
1787
+ this.initTabNum();
1788
+ this.$message({type: "success", message: "加签成功!"});
1789
+ this.tabCrudSearch();
1790
+ } else {
1791
+ this.$message({type: "error", message: "加签失败!"});
1792
+ }
1793
+ });
1794
+ },
1795
+
1796
+ /**
1797
+ * 确认转签
1798
+ */
1799
+ sureTurnSign() {
1800
+ let checkedUserArr = this.$refs.turnSignRef.chooseUsers || [];
1801
+ if (checkedUserArr.length == 0) {
1802
+ this.$message({type: "error", message: "请选择转签人!"});
1803
+ return;
1804
+ }
1805
+ let userId = checkedUserArr[0].dataKey;
1806
+ this.axios.post(this.api.plFlowInst.turnSign, {
1807
+ taskId: this.currentInst.taskId,
1808
+ dealers: userId
1809
+ }).then(res => {
1810
+ if (res && res.data && res.data.operateSuccess) {
1811
+ this.turnSignDialog = false;
1812
+ this.flowInstDataDialog = false;
1813
+ this.initTabNum();
1814
+ this.$message({type: "success", message: "转签成功!"});
1815
+ this.tabCrudSearch();
1816
+ } else {
1817
+ this.$message({type: "error", message: "转签失败!"});
1818
+ }
1819
+ });
1820
+
1821
+ },
1822
+
1823
+ /**
1824
+ * 回退到上一步
1825
+ */
1826
+ backToPrevious() {
1827
+ let loading = this.$loading({
1828
+ lock: true,
1829
+ text: '正在退回,请稍后....',
1830
+ spinner: 'el-icon-loading',
1831
+ background: 'rgba(0, 0, 0, 0.7)'
1832
+ })
1833
+ let currentInst = this.currentInst;
1834
+ this.$confirm('确定要退回至上一个节点吗?', '警告', {
1835
+ confirmButtonText: '确定',
1836
+ cancelButtonText: '取消',
1837
+ }).then(() => {
1838
+ this.axios.post(this.api.plFlowInst.backRewrite,
1839
+ {
1840
+ taskId:currentInst.taskId
1841
+ }).then(res => {
1842
+ if (res && res.data && res.data.operateSuccess) {
1843
+ this.$message({type: "success", message: "退回成功!"});
1844
+ this.initTabNum();
1845
+ if (this.flowBatchPendingDialog) {
1846
+ this.batchTabRemove(this.currentInst.dataId);
1847
+ } else {
1848
+ this.tabCrudSearch();
1849
+ }
1850
+ } else {
1851
+ this.$message({type: "error", message: res.data.operateMessage});
1852
+ }
1853
+ loading && loading.close();
1854
+ this.flowInstDataDialog = false;
1855
+ })
1856
+ }).catch(() => {
1857
+ loading && loading.close();
1858
+ });
1859
+ },
1860
+
1861
+
1862
+ /**
1863
+ * 取回
1864
+ */
1865
+ getBackPrevious() {
1866
+ let loading = this.$loading({
1867
+ lock: true,
1868
+ text: '正在取回,请稍后....',
1869
+ spinner: 'el-icon-loading',
1870
+ background: 'rgba(0, 0, 0, 0.7)'
1871
+ })
1872
+ let currentInst = this.currentInst;
1873
+ this.$confirm('确定要取回吗?', '警告', {
1874
+ confirmButtonText: '确定',
1875
+ cancelButtonText: '取消',
1876
+ }).then(() => {
1877
+ this.axios.post(this.api.plFlowInst.getBackRewrite,
1878
+ {
1879
+ flowInstId: currentInst.flowInstId,
1880
+ }).then(res => {
1881
+ if (res && res.data && res.data.operateSuccess) {
1882
+ this.$message({type: "success", message: "取回成功!"});
1883
+ this.initTabNum();
1884
+ if (this.flowBatchPendingDialog) {
1885
+ this.batchTabRemove(this.currentInst.dataId);
1886
+ } else {
1887
+ this.tabCrudSearch();
1888
+ }
1889
+ } else {
1890
+ this.$message({type: "error", message: res.data.operateMessage});
1891
+ }
1892
+ loading && loading.close();
1893
+ this.flowInstDataDialog = false;
1894
+ })
1895
+ }).catch(() => {
1896
+ loading && loading.close();
1897
+ });
1898
+ },
1899
+
1900
+ /**
1901
+ * 基于当前选中的选项卡进行查询
1902
+ */
1903
+ tabCrudSearch() {
1904
+ this.tabClick({name: this.tabActive});
1905
+ },
1906
+
1907
+ /**
1908
+ * 获取流程概要
1909
+ */
1910
+ getFlowSummary(dataObj) {
1911
+ let flowSummary = "";
1912
+ let summarySet = this.flowDefine.flowSummary;
1913
+ if (this.tabActive == "draft") {
1914
+ flowSummary = this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.loginUser.userName);
1915
+ flowSummary = this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.DATE_UTIL.getCurrentDateTime());
1916
+ } else {
1917
+ flowSummary = this.platStringUtil.replaceAll(summarySet, "${startUserName*}", this.currentStartUser);
1918
+ flowSummary = this.platStringUtil.replaceAll(flowSummary, "${createTime*}", this.currentStartTime);
1919
+ }
1920
+ flowSummary = this.platStringUtil.replaceAll(flowSummary, "${flowName*}", this.flowDefine.flowName);
1921
+ if (this.flowDefine.summaryNameId) {
1922
+ // flowSummary = flowSummary.toUpperCase();
1923
+ let summaryNameId = JSON.parse(this.flowDefine.summaryNameId);
1924
+ Object.keys(summaryNameId).forEach(fieldName => {
1925
+ let fieldId = summaryNameId[fieldName];
1926
+ if (fieldName && dataObj.hasOwnProperty(fieldId)) {
1927
+ let replaceVal = dataObj[fieldId];
1928
+ if(dataObj[fieldId + "_sequence"]){ // 自增序列
1929
+ replaceVal = dataObj[fieldId + "_sequence"];
1930
+ }
1931
+ flowSummary = this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", replaceVal);
1932
+ }else{
1933
+ flowSummary = this.platStringUtil.replaceAll(flowSummary, "${" + fieldName + "}", "");
1934
+ }
1935
+ });
1936
+ }
1937
+ return flowSummary;
1938
+ },
1939
+
1940
+ /**
1941
+ * 各字段的状态
1942
+ * nodeKey 当前key
1943
+ * version 当前版本号
1944
+ */
1945
+ initFieldStatus(nodeKey,version,flowStatus) {
1946
+ return new Promise(resolve => {
1947
+ // let nodeInfo = this.flowVersionNodeObj[version][nodeKey] || {};
1948
+ // this.formInfo.fieldStatus = {};
1949
+ // this.formInfo.fieldDefaultVal = {}; //初始化可编辑状态和默认值
1950
+ // let orgChargeField = [];
1951
+ // let supervisorField = [];
1952
+ // let levels = "";
1953
+ // if (nodeInfo.fieldOperate) {
1954
+ // let fieldOperate = JSON.parse(nodeInfo.fieldOperate);
1955
+ // Object.keys(fieldOperate).forEach(field => {
1956
+ // let fieldObj = fieldOperate[field];
1957
+ // if(flowStatus!='4'){
1958
+ // if (fieldObj.edit == "1") {//可编辑
1959
+ // this.formInfo.fieldStatus[field] = "edit";
1960
+ // } else if (fieldObj.hide == "1") {//不可见
1961
+ // this.formInfo.fieldStatus[field] = "hide";
1962
+ // }
1963
+ // }
1964
+ // let defaultValType = fieldObj.defaultValType;
1965
+ // let defaultVal = fieldObj.defaultVal;
1966
+ // let dateTimeType = fieldObj.dateTimeType;
1967
+ // if (defaultVal) {
1968
+ // if (defaultValType == "sysData") {
1969
+ // this.formInfo.fieldDefaultVal[field] = defaultVal[defaultVal.length - 1];
1970
+ // } else if (defaultValType == "formInfo"){
1971
+ // this.formInfo.fieldDefaultVal[field] = "&&," + defaultVal + ",&&";
1972
+ // } else if (defaultValType == "diyVal" || (defaultValType == "dateTime" && dateTimeType == "diyTime")) {
1973
+ // this.formInfo.fieldDefaultVal[field] = defaultVal;
1974
+ // } else {
1975
+ // if (defaultVal.indexOf("LOGINUSER") > -1) {
1976
+ // this.formInfo.fieldDefaultVal[field] = Replace.def(this.loginUser, defaultVal);
1977
+ // } else {
1978
+ // this.formInfo.fieldDefaultVal[field] = Replace.def(this.userDept, defaultVal);
1979
+ // }
1980
+ // }
1981
+ // }
1982
+ // //时间
1983
+ // if(defaultValType == "dateTime" && dateTimeType == "sysTime"){
1984
+ // let time = "";
1985
+ // let dateTimeFormat = fieldObj.dateTimeFormat || "yyyy-MM-dd";
1986
+ // let specialDate = fieldObj.specialDate;
1987
+ // let specialOpt = fieldObj.specialOpt;
1988
+ // let specialVal = fieldObj.specialVal;
1989
+ // if(specialDate && specialOpt && specialVal){
1990
+ // time = this.DATE_UTIL.timeConversion(new Date(),dateTimeFormat,specialDate,specialOpt,specialVal);
1991
+ // }else{
1992
+ // time = this.DATE_UTIL.formaterDateOrTime(new Date(),dateTimeFormat);
1993
+ // }
1994
+ // this.formInfo.fieldDefaultVal[field] = time;
1995
+ // }
1996
+ //
1997
+ // if(defaultValType == "dateTime" && dateTimeType == "formField"){
1998
+ // this.formInfo.flowFieldDefaultFromForm[field] = fieldObj;
1999
+ // }
2000
+ //
2001
+ //
2002
+ // //处理人上级
2003
+ // let dealerLeaderType = fieldObj.dealerLeaderType;
2004
+ // if(dealerLeaderType){
2005
+ // if(dealerLeaderType == "1"){
2006
+ // orgChargeField.push(field);
2007
+ // }else{
2008
+ // supervisorField.push({field:field,level:fieldObj.leaderLevel})
2009
+ // levels += "," + fieldObj.leaderLevel;
2010
+ // }
2011
+ // }
2012
+ // this.formInfo.fieldDefaultValChangeNum[field] = fieldObj.changeNum;
2013
+ // });
2014
+ // }
2015
+ // //防止切换数据污染
2016
+ // this.formInfo.listViewId = this.parentListViewId;
2017
+ // this.formInfo.tableViewId = this.parentTableViewId;
2018
+ // if(nodeInfo.nodeSetForm == '1'){ //开启定制表单
2019
+ // //开启定制表单
2020
+ // // nodeFormType
2021
+ // // nodeResouceId
2022
+ // if(nodeInfo.nodeFormType == 'form'){ //智能建表
2023
+ // let nodeResouceIdArr = JSON.parse(nodeInfo.nodeResourceId || "[]");
2024
+ // if(nodeResouceIdArr.length > 0){
2025
+ // let resouceId = nodeResouceIdArr[nodeResouceIdArr.length - 1];
2026
+ // this.RES_GLOBAL.getById(resouceId).then(resData => {
2027
+ //
2028
+ // //获取资源池
2029
+ // // this.$set(this.formInfo,'listViewId',resData.rkey);
2030
+ // this.FORM_GLOBAL.getViewAndFields(resData.rkey,
2031
+ // resData.rclassId,this.loginUser.userType).then(data => {
2032
+ // if (data) {
2033
+ // let resultMap = data || {};
2034
+ // this.formInfo.formId = resultMap.formId;
2035
+ // this.formInfo.listViewId = resultMap.listViewId;
2036
+ // this.formInfo.tableViewId = resultMap.tableViewId;
2037
+ // let fieldList = resultMap.fieldList || [];
2038
+ // fieldList.forEach(fieldObj => {
2039
+ // this.formFieldObj[fieldObj.id] = fieldObj;
2040
+ // });
2041
+ // this.initFlowTitle();
2042
+ // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2043
+ // // resolve(true);
2044
+ // }
2045
+ // });
2046
+ // });
2047
+ // }
2048
+ // }else {
2049
+ // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2050
+ // // resolve(true);
2051
+ // }
2052
+ // }else {
2053
+ // this.getDefaultUser(orgChargeField,supervisorField,levels,resolve);
2054
+ // // resolve(true);
2055
+ // }
2056
+ resolve();
2057
+ });
2058
+ },
2059
+
2060
+ // getDefaultUser(orgChargeField,supervisorField,levels,resolve){
2061
+ // if(orgChargeField.length > 0 && supervisorField.length > 0){
2062
+ // this.axios.post(this.api.sysOrgPosUser.getDeptSupervisorByUserId,
2063
+ // {userId:this.loginUser.id}).then(res => {
2064
+ // if(res && res.data){
2065
+ // let userId = (res.data[0] || {}).id;
2066
+ // orgChargeField.forEach(fieldId => {
2067
+ // this.formInfo.fieldDefaultVal[fieldId] = userId || "";
2068
+ // });
2069
+ // }
2070
+ //
2071
+ // this.axios.post(this.api.sysOrgPosUser.getSupervisorByLevels,
2072
+ // {userId:this.loginUser.id,levels:levels.substring(1)}).then(res => {
2073
+ // if(res && res.data){
2074
+ // let userIdMap = res.data || {};
2075
+ // supervisorField.forEach(item => {
2076
+ // this.formInfo.fieldDefaultVal[item.field] = userIdMap[item.level] || "";
2077
+ // });
2078
+ // resolve(true);
2079
+ // }
2080
+ // });
2081
+ // });
2082
+ // }else if(orgChargeField.length > 0){
2083
+ // this.axios.post(this.api.sysOrgPosUser.getDeptSupervisorByUserId,
2084
+ // {userId:this.loginUser.id}).then(res => {
2085
+ // if (res && res.data) {
2086
+ // let userId = (res.data[0] || {}).id;
2087
+ // orgChargeField.forEach(fieldId => {
2088
+ // this.formInfo.fieldDefaultVal[fieldId] = userId || "";
2089
+ // });
2090
+ // resolve(true);
2091
+ // }
2092
+ // });
2093
+ // }else if(supervisorField.length > 0){
2094
+ // this.axios.post(this.api.sysOrgPosUser.getSupervisorByLevels,
2095
+ // {userId:this.loginUser.id,levels:levels.substring(1)}).then(res => {
2096
+ // if(res && res.data){
2097
+ // let userIdMap = res.data || {};
2098
+ // supervisorField.forEach(item => {
2099
+ // this.formInfo.fieldDefaultVal[item.field] = userIdMap[item.level] || "";
2100
+ // });
2101
+ // resolve(true);
2102
+ // }
2103
+ // });
2104
+ // }else{
2105
+ // resolve(true);
2106
+ // }
2107
+ // },
2108
+
2109
+
2110
+
2111
+ /**
2112
+ * 批量处理存草稿
2113
+ */
2114
+ // batchSaveDraft() {
2115
+ // this.batchTabRemove(this.currentInst.dataId);
2116
+ // },
2117
+
2118
+
2119
+ /**
2120
+ * 关闭下一步执行人弹窗
2121
+ */
2122
+ closeNextSteptUserDialog() {
2123
+ this.nextSteptUserDialog = false;
2124
+ this.isDisabled['nextStep'] = true;
2125
+ },
2126
+
2127
+ /**
2128
+ * 恢复方法
2129
+ */
2130
+ restoreFlow() {
2131
+ this.axios.post(this.api.plFlowInst.stopFlow, {
2132
+ instId: this.currentInst.flowInstId, type: "1",
2133
+ procInstId: this.currentInst.linkProcId,
2134
+ taskId: this.currentInst.taskId
2135
+ }).then(res => {
2136
+ if (res && res.data) {
2137
+ if (res.data.operateSuccess) {
2138
+ this.$message({type: "success", message: "恢复成功!"});
2139
+ this.flowInstDataDialog = false;
2140
+ if (this.flowBatchPendingDialog) {
2141
+ this.batchTabRemove(this.currentInst.dataId);
2142
+ } else {
2143
+ this.tabCrudSearch();
2144
+ }
2145
+ this.initTabNum();
2146
+ } else {
2147
+ this.$message({type: "error", message: res.data.operateMessage});
2148
+ }
2149
+ }
2150
+ })
2151
+ },
2152
+
2153
+ // 获取工作流表单信息弹出框标题
2154
+ initFlowTitle() {
2155
+ // this.FORM_GLOBAL.getTableViews(this.formInfo.tableViewId,this.loginUser.userType).then(data => {
2156
+ // if (data) {
2157
+ // this.flowFormTitle = data.viewName;
2158
+ // }
2159
+ // });
2160
+ },
2161
+
2162
+ initTabNum() {
2163
+ this.initMessageFunc && this.initMessageFunc();
2164
+ this.axios.all([
2165
+ this.axios.post(this.api.plFlowInst.getTabsNum,
2166
+ {flowId: this.flowData.flowId, type: "1"}),
2167
+ this.axios.post(this.api.plFlowInst.getTabsNum,
2168
+ {flowId: this.flowData.flowId, type: "2"}),
2169
+ ]).then(this.axios.spread((res1, res2) => {
2170
+ Object.assign(this.numberObj, res1.data, res2.data);
2171
+ }));
2172
+ },
2173
+
2174
+ // 数据回显
2175
+ // previewtabnum(tabType, total) {
2176
+ // this.$set(this.numberObj, tabType, total);
2177
+ // },
2178
+
2179
+ getFlowInfo() {
2180
+ this.flowDefine.id = this.flowData.flowId;
2181
+ return new Promise(resolve => {
2182
+ this.FLOW_GLOBAL.getFlowDefineById(this.flowData.flowId).then(flowobj => {
2183
+ this.flowDefine = flowobj;
2184
+ let tabSetting = JSON.parse(this.flowDefine.tabSetting,"[]");
2185
+ (tabSetting || []).forEach(item => {
2186
+ if(item.isUse == '1'){
2187
+ this.operateType[item.type] = true;
2188
+ }
2189
+ })
2190
+ this.showModel = flowobj.showModel;
2191
+ this.showInfo = flowobj.showInfo;
2192
+ let formType = flowobj.formType;
2193
+ // if (formType == "form") {
2194
+ // let resourceIdArr = JSON.parse(flowobj.resourceId);
2195
+ // let resourceId = resourceIdArr[1];
2196
+ // this.RES_GLOBAL.getById(resourceId).then(resourceData => {
2197
+ // this.FORM_GLOBAL.getViewAndFields(resourceData.rkey,
2198
+ // resourceData.rclassId,this.loginUser.userType).then(data => {
2199
+ // if (data) {
2200
+ // let resultMap = data || {};
2201
+ // this.formInfo.formId = resultMap.formId;
2202
+ // this.formInfo.listViewId = resultMap.listViewId;
2203
+ // this.formInfo.formDefineKey = resourceData.rclassId;
2204
+ // this.parentListViewId = resultMap.listViewId;
2205
+ // this.formInfo.tableViewId = resultMap.tableViewId;
2206
+ // this.parentTableViewId = resultMap.tableViewId;
2207
+ // let fieldList = resultMap.fieldList || [];
2208
+ // fieldList.forEach(fieldObj => {
2209
+ // this.formFieldObj[fieldObj.id] = fieldObj;
2210
+ // });
2211
+ //
2212
+ // this.initFlowTitle();
2213
+ // }
2214
+ // });
2215
+ // });
2216
+ // }
2217
+ //工作流节点
2218
+ this.startNodeKey = "Activity_draft";
2219
+ this.startNodeKeyObj = {};
2220
+ // let flowVersion = this.flowDefine.flowVersion || '1.0';
2221
+ this.FLOW_GLOBAL.getFlowNodesByFlowId(this.flowData.flowId).then(nodeDatas => {
2222
+ if (nodeDatas) {
2223
+ nodeDatas.forEach(item => {
2224
+ if (item.nodeLinkId.indexOf("Activity_draft") > -1) {
2225
+ this.startNodeKey = item.nodeLinkId;
2226
+ this.startNodeKeyObj[item.version] = item.nodeLinkId; //开始节点对应版本号
2227
+ }
2228
+ if(!this.flowVersionNodeObj[item.version]){
2229
+ this.$set(this.flowVersionNodeObj,item.version,{});
2230
+ }
2231
+ this.$set(this.flowVersionNodeObj[item.version],item.nodeLinkId,item); //版本节点对象
2232
+ // if(item.version == this.flowDefine.releaseVersion){ //节点信息只取最新版本
2233
+ this.flowNodeIdToInfo[item.id] = item;
2234
+ if(item.nodeType&&['StartEvent','ParallelGateway','SequenceFlow','ExclusiveGateway','InclusiveGateway'].indexOf(item.nodeType) == -1){
2235
+ if(!this.flowNodeNameObj[item.nodeLinkId]){
2236
+ this.$set(this.flowNodeNameObj,item.nodeLinkId,item.nodeName);
2237
+ }else {
2238
+ if(this.flowNodeNameObj[item.nodeLinkId] != item.nodeName){
2239
+ this.flowNodeNameObj[item.nodeLinkId] = this.flowNodeNameObj[item.nodeLinkId] + "," + item.nodeName;
2240
+ }
2241
+ }
2242
+ }
2243
+ if(item.nodeType == "UserTask" && (item.nodeLinkId || "").indexOf("Activity_draft") > -1){
2244
+ this.draftNodeId = item.id; // 草稿节点id
2245
+ }
2246
+ // }
2247
+ this.allNodeInfo[item.id] = item;
2248
+ // 行按钮
2249
+ let listButton = JSON.parse(item.listButton || "[]") || [];
2250
+ listButton.forEach(button => {
2251
+ button.showName = button.showName ? button.showName : this.listButtonObj[button.type];
2252
+ });
2253
+ this.nodeListButtonObj[item.id] = listButton;
2254
+
2255
+ // 表单按钮
2256
+ let formButton = JSON.parse(item.formButton || "[]") || [];
2257
+ formButton.forEach(button => {
2258
+ button.showName = button.showName ? button.showName : this.formButtonObj[button.type];
2259
+ });
2260
+
2261
+ this.nodeFormButtonObj[item.id] = this.sortButtonArr(formButton);
2262
+ this.nodeFormBtnObj[item.id] = this.formatterFormButton(formButton);
2263
+
2264
+ let width = 0;
2265
+ (this.nodeListButtonObj[item.id] || []).forEach(item => {
2266
+ let nameLength = item.showName.length;
2267
+ if (nameLength > 2) {
2268
+ width += 100 + (nameLength - 2) * 12;
2269
+ } else {
2270
+ width += 100;
2271
+ }
2272
+ });
2273
+ if (this.optColumnWidth < width) {
2274
+ this.optColumnWidth = width;
2275
+ }
2276
+ });
2277
+
2278
+ // 显示
2279
+ this.isShowAgentSet = true;
2280
+ this.$forceUpdate();
2281
+ }
2282
+ // 加载工作流脚本与工作流事件规则
2283
+ this.initFlowScript().then(() => {
2284
+ resolve(true);
2285
+ })
2286
+ });
2287
+
2288
+ if (this.flowData.defaultTab) {
2289
+ this.tabActive = this.flowData.defaultTab;
2290
+ }
2291
+
2292
+ });
2293
+ });
2294
+ },
2295
+
2296
+ /**
2297
+ * 加载工作流脚本与工作流事件规则
2298
+ */
2299
+ initFlowScript(){
2300
+ return new Promise(resolve => {
2301
+ this.axios.all([
2302
+ this.axios.post(this.api.plFlowScript.find,{"flowId":this.flowData.flowId}),
2303
+ this.axios.post(this.api.plFlowEventDetail.findByFlowAndLeadFunc,{"flowId":this.flowData.flowId,"version":this.flowDefine.flowVersion||"1.0"})
2304
+ ]).then(this.axios.spread((resScript, resEvent) => {
2305
+ // 流程脚本
2306
+ if(resScript){
2307
+ let scriptDatas = resScript.data || [];
2308
+ // 脚本order排序
2309
+ scriptDatas = scriptDatas.sort(sortScript);
2310
+ function sortScript(a,b){
2311
+ return Number(a.scriptOrder) - Number(b.scriptOrder);
2312
+ }
2313
+ // 根据节点区分
2314
+ let scriptObj = {};
2315
+ let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
2316
+ let serviceName = (window.SERVICE_NAME || {});
2317
+ let adminServeName = serviceName.admin || "/admin/";
2318
+ let formServeName = serviceName.form || "/form/";
2319
+ let flowServeName = serviceName.flow || "/flow/";
2320
+ let oaServeName = serviceName.oa || "/oaproject/";
2321
+ scriptDatas.forEach(item => {
2322
+ // 添加修改是单独区分开,没有节点概念
2323
+ if(item.executePosition == "add" || item.executePosition == "update"){
2324
+ if(!scriptObj[item.executePosition]){
2325
+ scriptObj[item.executePosition] = {};
2326
+ }
2327
+ if(!scriptObj[item.executePosition][item.executeTime]){
2328
+ scriptObj[item.executePosition][item.executeTime] = [];
2329
+ }
2330
+ try{
2331
+ if(item.content){
2332
+ let value = item.content;
2333
+ value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
2334
+ value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
2335
+ value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
2336
+ value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
2337
+ value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
2338
+ value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
2339
+ value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
2340
+ item.content = value;
2341
+ }
2342
+ scriptObj[item.executePosition][item.executeTime].push(new Function(...arr,item.content));
2343
+ }catch (e) {
2344
+ console.log(item.content);
2345
+ console.log("脚本编译失败!");
2346
+ }
2347
+ }else{
2348
+ if(!scriptObj[item.nodeId]){
2349
+ scriptObj[item.nodeId] = {};
2350
+ }
2351
+ let nodeObj = scriptObj[item.nodeId]; // 节点的所有内容
2352
+ if(!nodeObj[item.executePosition]){
2353
+ nodeObj[item.executePosition] = {};
2354
+ }
2355
+ let positionObj = nodeObj[item.executePosition]; // 脚本的执行位置,add,update,deal,等
2356
+ if(!positionObj[item.executeTime]){
2357
+ positionObj[item.executeTime] = [];
2358
+ }
2359
+ let executeTimeArr = positionObj[item.executeTime]; // 在该时间对应的脚本内容数组
2360
+ try{
2361
+ if(item.content){
2362
+ let value = item.content;
2363
+ value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
2364
+ value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
2365
+ value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
2366
+ value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
2367
+ value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
2368
+ value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
2369
+ item.content = value;
2370
+ }
2371
+ executeTimeArr.push(new Function(...arr,item.content));
2372
+ }catch (e) {
2373
+ console.log(item.content);
2374
+ console.log("脚本编译失败!");
2375
+ }
2376
+ }
2377
+ })
2378
+ this.scriptObj = scriptObj;
2379
+ }
2380
+ // 流程事件规则
2381
+ if(resEvent){
2382
+ let eventDataArr = resEvent.data || [];
2383
+ let scriptObj = {};
2384
+ let eventObj = {};
2385
+ let arr = ['vm','axios','CTX','formData','LOGINUSER','Ajax','nextNode','resolve'];
2386
+ let serviceName = (window.SERVICE_NAME || {});
2387
+ let adminServeName = serviceName.admin || "/admin/";
2388
+ let formServeName = serviceName.form || "/form/";
2389
+ let flowServeName = serviceName.flow || "/flow/";
2390
+ let oaServeName = serviceName.oa || "/oaproject/";
2391
+ eventDataArr.forEach(item =>{
2392
+ let executeTypeArr = (item.executeType || '').split(",");
2393
+ executeTypeArr.forEach(executeType =>{
2394
+ if (item.source == 'diy'){
2395
+ //自定义
2396
+ // 添加修改是单独区分开,没有节点概念
2397
+ if(executeType == "addAfter" || executeType == "editAfter"){
2398
+ if(!scriptObj[executeType]){
2399
+ scriptObj[executeType] = [];
2400
+ }
2401
+ try{
2402
+ if(item.funcBody){ //方法体
2403
+ let value = item.funcBody;
2404
+ value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
2405
+ value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
2406
+ value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
2407
+ value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
2408
+ value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
2409
+ value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
2410
+ value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
2411
+ item.funcBody = value;
2412
+ }
2413
+ scriptObj[executeType].push(new Function(...arr,item.funcBody));
2414
+ }catch (e) {
2415
+ console.log(item.funcBody);
2416
+ console.log("脚本编译失败!");
2417
+ }
2418
+ }else{
2419
+ if(!scriptObj[item.nodeKey]){
2420
+ scriptObj[item.nodeKey] = {};
2421
+ }
2422
+ let nodeObj = scriptObj[item.nodeKey]; // 节点的所有内容
2423
+ if(!nodeObj[executeType]){
2424
+ nodeObj[executeType] = [];
2425
+ }
2426
+ let positionArr = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
2427
+ try{
2428
+ if(item.funcBody){
2429
+ let value = item.funcBody;
2430
+ value = this.platStringUtil.replaceAll(value,"/admin/",adminServeName);
2431
+ value = this.platStringUtil.replaceAll(value,"/form/",formServeName);
2432
+ value = this.platStringUtil.replaceAll(value,"/flow/",flowServeName);
2433
+ value = this.platStringUtil.replaceAll(value,"/oaproject/",oaServeName);
2434
+ value = this.platStringUtil.replaceAll(value,"/oaadmin/",adminServeName);
2435
+ value = this.platStringUtil.replaceAll(value,"/oaform/",formServeName);
2436
+ value = this.platStringUtil.replaceAll(value,"/oaflow/",flowServeName);
2437
+ item.funcBody = value;
2438
+ }
2439
+ positionArr.push(new Function(...arr,item.funcBody));
2440
+ }catch (e) {
2441
+ console.log(item.funcBody);
2442
+ console.log("脚本编译失败!");
2443
+ }
2444
+ }
2445
+ this.newScriptObj = scriptObj;
2446
+ }else if(item.source == 'event'){ //事件规则
2447
+ //获取响应配置
2448
+ // 添加修改是单独区分开,没有节点概念
2449
+ if(executeType == "addAfter" || executeType == "editAfter"){
2450
+ if(!eventObj[executeType]){
2451
+ eventObj[executeType] = {};
2452
+ }
2453
+ try{
2454
+ if(item.resConfigurateion){ //响应配置
2455
+ let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
2456
+ let eventKey = resConfigurateionObj.eventKey;
2457
+ if(!eventObj[executeType][eventKey]){
2458
+ eventObj[executeType][eventKey] = [];
2459
+ }
2460
+ eventObj[executeType][eventKey].push(resConfigurateionObj); //复制响应配置
2461
+ }
2462
+ }catch (e) {
2463
+ console.log(item.funcBody);
2464
+ console.log("脚本编译失败!");
2465
+ }
2466
+ }else{
2467
+ if(!eventObj[item.nodeKey]){
2468
+ eventObj[item.nodeKey] = {};
2469
+ }
2470
+ let nodeObj = eventObj[item.nodeKey]; // 节点的所有内容
2471
+ if(!nodeObj[executeType]){
2472
+ nodeObj[executeType] = {};
2473
+ }
2474
+ let positionObj = nodeObj[executeType]; // 脚本的执行位置,add,update,deal,等
2475
+ try{
2476
+ if(item.resConfigurateion){//响应配置
2477
+ let resConfigurateionObj = JSON.parse(item.resConfigurateion || "{}");
2478
+ let eventKey = resConfigurateionObj.eventKey;
2479
+ if(!positionObj[eventKey]){
2480
+ positionObj[eventKey] = [];
2481
+ }
2482
+ positionObj[eventKey].push(resConfigurateionObj); //复制响应配\
2483
+ }
2484
+ }catch (e) {
2485
+ console.log(item.funcBody);
2486
+ console.log("脚本编译失败!");
2487
+ }
2488
+ }
2489
+ this.newEventObj = eventObj;
2490
+ }
2491
+ });
2492
+ });
2493
+ }
2494
+ // 结束
2495
+ resolve();
2496
+ }));
2497
+ })
2498
+ },
2499
+
2500
+ /**
2501
+ * 执行工作流脚本,为兼容1.0版本定制
2502
+ */
2503
+ exeFlowEvent(executePosition,executeTime,nodeId,batchDataRef){
2504
+ // executePosition(为方便1.0转换,与1.0保持相同):add/update/handle/nextStep/view/columnFormatter
2505
+ // executePosition:add:['afterClick'],update:['afterClick'],handle:['afterClick'],
2506
+ // nextStep:['afterClick','afterValidate','submitSuccess'],view:['afterClick'],
2507
+ // (columnFormatter:['finished','end']?暂时不用)
2508
+ let formData;
2509
+ if(batchDataRef){//批量处理走单独方法
2510
+ formData=this.$refs[batchDataRef][0] && this.$refs[batchDataRef][0].optFormData || {};
2511
+ }else{
2512
+ formData=(this.$refs.flowInstDataInfo && this.$refs.flowInstDataInfo.optFormData) || {};
2513
+ }
2514
+ let CTX = window.JAVA_URL;
2515
+ let paramValues = [this,this.axios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode,null]; // 入参
2516
+ if(executePosition == "add" || executePosition == "update"){
2517
+ ((this.scriptObj[executePosition] || {})[executeTime] || []).forEach(event => {
2518
+ event && event(...paramValues); // 执行事件
2519
+ });
2520
+ return;
2521
+ }
2522
+ let eventArr = ((this.scriptObj[nodeId] || {})[executePosition] || {})[executeTime] || [];
2523
+ let result=true;
2524
+ try{
2525
+ eventArr.forEach(event => {
2526
+ let eventResult=event && event(...paramValues); // 执行事件
2527
+ if(eventResult ==false){
2528
+ throw new Error("ending");//报错,就跳出循环
2529
+ }
2530
+ })
2531
+ }catch (e) {
2532
+ console.log(e);
2533
+ result=false;
2534
+ }
2535
+ return result;
2536
+ },
2537
+
2538
+
2539
+
2540
+ /**
2541
+ * 执行工作流新版本事件规则
2542
+ */
2543
+ exeNewFlowEvent(executeType,nodeKey,batchDataRef){
2544
+ let formData;
2545
+ if(batchDataRef){//批量处理走单独方法
2546
+ formData=this.$refs[batchDataRef][0] && this.$refs[batchDataRef][0].optFormData || {};
2547
+ }else{
2548
+ formData=(this.$refs.flowInstDataInfo && this.$refs.flowInstDataInfo.optFormData) || {};
2549
+ }
2550
+ //执行自定义脚本
2551
+ let CTX = window.JAVA_URL;
2552
+ let paramValues = [this,this.axios,CTX,formData,this.loginUser,AjaxUtil,this.nextNode]; // 入参
2553
+ if(executeType == "addAfter" || executeType == "editAfter"){ //新增或者修改后
2554
+ (this.newScriptObj[executeType] || []).forEach(event => {
2555
+ event && event(...paramValues); // 执行事件
2556
+ });
2557
+
2558
+ //执行事件规则脚本
2559
+ Object.keys(this.newEventObj[executeType] || {}).forEach(eventKey =>{
2560
+ if(this.installListObj[eventKey]
2561
+ && this.installListObj[eventKey]["config"]
2562
+ && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
2563
+ let affectContentArr = this.newEventObj[executeType][eventKey] || [];
2564
+ affectContentArr.forEach(affectContent =>{
2565
+ this.installListObj[eventKey]["config"].methods.renderFlowConfig(this,this.CTX,this.axios,this.nextNode,formData,affectContent);
2566
+ });
2567
+ }
2568
+ });
2569
+ return;
2570
+ }
2571
+ let eventArr = (this.newScriptObj[nodeKey] || {})[executeType] || [];
2572
+ let result=true;
2573
+ try{
2574
+ eventArr.forEach(event => {
2575
+ let eventResult=event && event(...paramValues); // 执行事件
2576
+ if(eventResult ==false){
2577
+ throw new Error("ending");//报错,就跳出循环
2578
+ }
2579
+ });
2580
+
2581
+ let eventObj = (this.newEventObj[nodeKey] || {})[executeType] || {};
2582
+ Object.keys(eventObj).forEach(eventKey =>{
2583
+ if(this.installListObj[eventKey]
2584
+ && this.installListObj[eventKey]["config"]
2585
+ && this.installListObj[eventKey]["config"].methods.renderFlowConfig){
2586
+ let affectContentArr = eventObj[eventKey] || [];
2587
+ affectContentArr.forEach(affectContent =>{
2588
+ this.installListObj[eventKey]["config"].methods.renderFlowConfig(this,this.CTX,this.axios,this.nextNode,formData,affectContent,executeType);
2589
+ });
2590
+ }
2591
+ });
2592
+ }catch (e) {
2593
+ console.log(e);
2594
+ result=false;
2595
+ }
2596
+
2597
+ // if(affect.eventKey
2598
+ // && this.installListObj[affect.eventKey]
2599
+ // && this.installListObj[affect.eventKey]["config"]
2600
+ // && this.installListObj[affect.eventKey]["config"].methods.renderTableViewConfig){
2601
+ // //调用渲染方法
2602
+ // this.$set(affect,"field",field);//当前响应控件
2603
+ // this.installListObj[affect.eventKey]["config"].methods.renderTableViewConfig(this,this.CTX,this.axios,this.dataAllObj,affect);
2604
+ // }
2605
+
2606
+
2607
+ return result;
2608
+
2609
+ },
2610
+
2611
+
2612
+ /**
2613
+ * 格式化表单操作按钮
2614
+ */
2615
+ formatterFormButton(formButton) {
2616
+
2617
+ let formBtnObj = {};
2618
+ let formBtnArr = [];
2619
+
2620
+ for (let [key, data] of Object.entries(this.formBtnObjDefault)) {
2621
+ formBtnObj[key] = Object.assign({btnType: key}, data);
2622
+ }
2623
+
2624
+ let objTmp;
2625
+ (formButton || []).forEach(data => {
2626
+ if (formBtnObj[data.type]) {
2627
+ objTmp = formBtnObj[data.type];
2628
+ objTmp.show = (data.isUse != '0');
2629
+ objTmp.text = data.showName || objTmp.text;
2630
+ }
2631
+ });
2632
+
2633
+ for (let [key, data] of Object.entries(formBtnObj)) {
2634
+ formBtnArr.push(data);
2635
+ }
2636
+ return formBtnArr;
2637
+ },
2638
+
2639
+ sortButtonArr(formButton) {
2640
+ let objBtnOrder = {
2641
+ "saveDraft": 1,
2642
+ "nextStep": 2,
2643
+ "completeSign": 3,
2644
+ "turnSign": 4,
2645
+ "retSpecified": 5,
2646
+ "back": 6,
2647
+ "stopped": 7,
2648
+ "close": 8
2649
+ };
2650
+ (formButton || []).forEach(data => {
2651
+ data.order = objBtnOrder[data.type] || data.order;
2652
+ });
2653
+ return formButton;
2654
+ },
2655
+
2656
+ tabClick(tab) {
2657
+ if (this.showInfo == "flow" && this.$refs[tab.name + "Ref"] && this.$refs[tab.name + "Ref"].crud) {
2658
+ this.$refs[tab.name + "Ref"].crud.search();
2659
+ this.initTabNum();
2660
+ } else if (this.showInfo == "form" && this.$refs[tab.name + "Ref"] && this.$refs[tab.name + "Ref"].getDataRows) {
2661
+ this.$refs[tab.name + "Ref"].getDataRows();
2662
+ this.initTabNum();
2663
+ }
2664
+ },
2665
+ tabShow(val) {
2666
+ return this.operateType[val];
2667
+ },
2668
+ // async initResource() {//处理资源池信息
2669
+ // (this.flowData.operateRootArr || []).forEach(item => {
2670
+ // this.$set(this.operateType, item.powerCode, true)
2671
+ // });
2672
+ // },
2673
+
2674
+ initflowObj() {//处理流程定义对象
2675
+ let tabSetting = JSON.parse(this.flowDefine.tabSetting);
2676
+ tabSetting.forEach(data => {
2677
+ this.$set(this.tabTypeObj, data.type, data);
2678
+ });
2679
+ Object.keys(this.tabTypeObj).forEach(key => {
2680
+ let objTemp = this.tabTypeObj[key];
2681
+ objTemp.tabName = objTemp["showName"] || objTemp["name"];
2682
+ });
2683
+ let tabTitleType = this.flowDefine.tabTitleType;
2684
+ if (tabTitleType == "1") {
2685
+ this.tabTypeObj["showtTabText"] = true;
2686
+ this.tabTypeObj["showTabIcon"] = true;
2687
+ } else if (tabTitleType == "2") {
2688
+ this.tabTypeObj["showtTabText"] = true;
2689
+ } else if (tabTitleType == "3") {
2690
+ this.tabTypeObj["showTabIcon"] = true;
2691
+ }
2692
+ },
2693
+
2694
+ /**
2695
+ * 初始化流程代理
2696
+ */
2697
+ async getFlowAgent() {
2698
+ this.agentTitle = "\"" + this.flowDefine.flowName + "\"" + " 流程设置";
2699
+ this.agentFormObj.userId = this.loginUser.id;
2700
+ let flowAgentRes = await this.axios.post(this.api.plFlowSetting.getByUserFlowId, {
2701
+ flowId: this.flowData.flowId,
2702
+ userId: this.loginUser.id
2703
+ });
2704
+ if (flowAgentRes && flowAgentRes.data && flowAgentRes.data.operateObj) {
2705
+ this.agentFormObj = flowAgentRes.data.operateObj;
2706
+ if (this.agentFormObj.agentNodeUser) {
2707
+ let agentNodeUserObj = JSON.parse(this.agentFormObj.agentNodeUser); //节点代理人
2708
+ let nodeKeyArr = Object.keys(agentNodeUserObj);// {'66':{1:'张三'}}
2709
+ this.agentNodeUserArr = [];
2710
+ nodeKeyArr.forEach(key => {
2711
+ let userInfoObj = agentNodeUserObj[key];
2712
+ let userIdArr = Object.keys(userInfoObj);
2713
+ let userNameArr = [];
2714
+ userIdArr.forEach(userId => {
2715
+ userNameArr.push(userInfoObj[userId]);
2716
+ });
2717
+ this.agentNodeUserArr.push({
2718
+ nodeId: key,
2719
+ userIds: userIdArr.join(","),
2720
+ userNames: userNameArr.join(","),
2721
+ userInfoObj: userInfoObj
2722
+ });
2723
+ });
2724
+ }
2725
+ if (this.agentFormObj.agentUserId) { //解析获取
2726
+ let agentUserInfo = JSON.parse(this.agentFormObj.agentUserId);
2727
+ this.agentFormObj.agentUserKey = agentUserInfo.id; //用户id
2728
+ this.agentFormObj.agentUserName = agentUserInfo.name; //名称
2729
+ }
2730
+ }
2731
+ this.loadAgentSuccess = true;
2732
+ },
2733
+
2734
+ /**
2735
+ * 保存流程代理
2736
+ */
2737
+ saveAgent() {
2738
+ this.$refs.flowAgentSetRef.saveAgent();
2739
+ },
2740
+
2741
+ /**
2742
+ * 重新加载查询
2743
+ */
2744
+ initTabSeach() {
2745
+ //计算数量
2746
+ this.initTabNum();
2747
+ //查询待处理数据
2748
+ if (this.$refs["pendingRef"]) {
2749
+ this.$refs["pendingRef"].crud.search();
2750
+ }
2751
+ },
2752
+
2753
+ /**
2754
+ * 打开退回节点窗口
2755
+ */
2756
+ retSpecified(currentInst){
2757
+ let flowInstId = currentInst.flowInstId;
2758
+ this.axios.post(this.api.plFlowInst.getBackData,{"flowInstId":flowInstId}).then(res => {
2759
+ this.backNodeArr = [];
2760
+ if(res.data.operateSuccess){
2761
+ let result = res.data.resultObject || [];
2762
+ if(result.length == 0){
2763
+ this.$message.warning("没有可以退回的节点!");
2764
+ return;
2765
+ }
2766
+ let arr = [];
2767
+ result.forEach((item,index) =>{
2768
+ // if(index != res.data.resultObject.length -1){
2769
+ // this.backNodeArr.push(item);
2770
+ // }
2771
+ if(item["endTimeNull"]){
2772
+ arr.push(item);
2773
+ }else{
2774
+ this.backNodeArr.push(item);
2775
+ }
2776
+ });
2777
+ this.backNodeArr = this.backNodeArr.concat(arr);
2778
+ this.backNodeArr.splice(this.backNodeArr.length - 1,1);
2779
+ this.isDisabled2 = true;
2780
+ this.backMsg = "";
2781
+ this.backNodeId = "";
2782
+ this.backDialogVisible = true;
2783
+ }
2784
+ })
2785
+ },
2786
+
2787
+ /**
2788
+ * 执行退回
2789
+ */
2790
+ beginBack(){
2791
+ if(!this.backNodeId){
2792
+ this.$message.error("没有选择要退回的节点!");
2793
+ return;
2794
+ }
2795
+ this.isDisabled2 = false;
2796
+ this.axios.post(this.api.plFlowInst.skipToNode,
2797
+ {"instId":this.currentInst.flowInstId,"skipNode":this.backNodeId,
2798
+ "backMsg":this.backMsg,"skipStatus":"skip"}).then(res => {
2799
+ if(res.data.operateSuccess){
2800
+ this.initTabNum();
2801
+ this.$message.success("退回成功!");
2802
+ this.backDialogVisible = false;
2803
+ this.isDisabled2 = true;
2804
+ this.isDisabled['retSpecified'] = true;
2805
+ this.flowInstDataDialog = false;
2806
+ if (this.flowBatchPendingDialog) {
2807
+ this.batchTabRemove(this.currentInst.dataId);
2808
+ } else {
2809
+ this.tabCrudSearch();
2810
+ }
2811
+ this.initTabNum();
2812
+ }else{
2813
+ this.$message.error("退回失败!");
2814
+ this.isDisabled['retSpecified'] = true;
2815
+ }
2816
+ })
2817
+ },
2818
+ isOldData(btnObj){
2819
+ if(this.currentRowData.isOldData == "1"){
2820
+ let type = btnObj["btnType"];
2821
+ if(type == "retSpecified" || type == "cancel" || type == "back" || type == "getBack"){
2822
+ return false;
2823
+ }
2824
+ }
2825
+ return true;
2826
+ },
2827
+ }
2828
+ }
2829
+ </script>
2830
+
2831
+ <style lang="scss" scoped>
2832
+ /deep/ .el-tabs__content {
2833
+ height: calc(100% - 60px);
2834
+ }
2835
+
2836
+ .el-tab-pane {
2837
+ height: 100%;
2838
+ }
2839
+ fieldset {
2840
+ border: 1px solid #c2c2c2;
2841
+ border-radius: 3px;
2842
+ padding: 15px 20px 10px 20px;
2843
+ margin-bottom: 5px;
2844
+ box-sizing: border-box;
2845
+ }
2846
+
2847
+ legend {
2848
+ margin-left: 3px;
2849
+ font-size: 16px;
2850
+ font-weight: bold;
2851
+ }
2852
+
2853
+ .flowAgentPopover /deep/ .el-popover{
2854
+ right: 2px !important;
2855
+ width: 400px !important;
2856
+ margin-top: 5px !important;
2857
+ }
2858
+ </style>