swordpass-ui 1.0.0

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/lib/demo.html +10 -0
  4. package/lib/img/icon_found_img.c785c1b7.png +0 -0
  5. package/lib/sword-vue-ui.common.js +61402 -0
  6. package/lib/sword-vue-ui.css +1 -0
  7. package/lib/sword-vue-ui.umd.js +61412 -0
  8. package/lib/sword-vue-ui.umd.min.js +6 -0
  9. package/package.json +109 -0
  10. package/packages/AddQueryStrategy/index.js +7 -0
  11. package/packages/AddQueryStrategy/src/main.vue +236 -0
  12. package/packages/Autocomplete/index.js +7 -0
  13. package/packages/Autocomplete/src/main.vue +192 -0
  14. package/packages/Button/index.js +7 -0
  15. package/packages/Button/src/main.vue +90 -0
  16. package/packages/Cascader/index.js +7 -0
  17. package/packages/Cascader/src/main.vue +210 -0
  18. package/packages/Chart/index.js +7 -0
  19. package/packages/Chart/src/Chart.vue +831 -0
  20. package/packages/Checkbox/index.js +7 -0
  21. package/packages/Checkbox/src/main.vue +200 -0
  22. package/packages/Collapse/index.js +7 -0
  23. package/packages/Collapse/src/ClCollapse.vue +67 -0
  24. package/packages/Collapse/src/ClCollapseItem.vue +21 -0
  25. package/packages/CollapseItem/index.js +7 -0
  26. package/packages/CustomDialog/index.js +7 -0
  27. package/packages/CustomDialog/src/customDialog.js +99 -0
  28. package/packages/CustomDialog/src/main.vue +1944 -0
  29. package/packages/DataView/index.js +7 -0
  30. package/packages/DataView/src/DataView.vue +45 -0
  31. package/packages/Date/index.js +7 -0
  32. package/packages/Date/src/main.vue +180 -0
  33. package/packages/DatePicker/index.js +7 -0
  34. package/packages/DatePicker/src/main.vue +155 -0
  35. package/packages/Demension/index.js +7 -0
  36. package/packages/Demension/src/main.vue +379 -0
  37. package/packages/Dialog/index.js +7 -0
  38. package/packages/Dialog/src/main.vue +160 -0
  39. package/packages/Dictionary/index.js +7 -0
  40. package/packages/Dictionary/src/main.vue +204 -0
  41. package/packages/DimensionSelector/index.js +7 -0
  42. package/packages/DimensionSelector/src/main.vue +359 -0
  43. package/packages/DimensionSelectorInput/index.js +7 -0
  44. package/packages/DimensionSelectorInput/src/main.vue +79 -0
  45. package/packages/Divider/index.js +7 -0
  46. package/packages/Divider/src/main.vue +38 -0
  47. package/packages/Duration/index.js +7 -0
  48. package/packages/Duration/src/main.vue +172 -0
  49. package/packages/Editor/index.js +7 -0
  50. package/packages/Editor/src/main.vue +280 -0
  51. package/packages/Explain/index.js +7 -0
  52. package/packages/Explain/src/main.vue +55 -0
  53. package/packages/FieldTail/index.js +7 -0
  54. package/packages/FieldTail/src/main.vue +163 -0
  55. package/packages/File/index.js +7 -0
  56. package/packages/File/src/FileCard.vue +169 -0
  57. package/packages/File/src/FileList.vue +180 -0
  58. package/packages/File/src/FileTable.vue +223 -0
  59. package/packages/File/src/main.vue +467 -0
  60. package/packages/FileUpload/index.js +7 -0
  61. package/packages/FileUpload/src/main.vue +222 -0
  62. package/packages/FlowChart/index.js +7 -0
  63. package/packages/FlowChart/src/main.vue +386 -0
  64. package/packages/FormItem/index.js +7 -0
  65. package/packages/FormItem/src/main.vue +167 -0
  66. package/packages/Global/index.js +12 -0
  67. package/packages/Global/src/GlobalQuery.vue +200 -0
  68. package/packages/Global/src/GlobalValidate.vue +69 -0
  69. package/packages/Icon/index.js +7 -0
  70. package/packages/Icon/src/icons/ad.js +14 -0
  71. package/packages/Icon/src/icons/address-book.js +14 -0
  72. package/packages/Icon/src/icons/arrow.js +14 -0
  73. package/packages/Icon/src/icons/attachment.js +18 -0
  74. package/packages/Icon/src/icons/balance.js +14 -0
  75. package/packages/Icon/src/icons/ban.js +14 -0
  76. package/packages/Icon/src/icons/bell.js +14 -0
  77. package/packages/Icon/src/icons/block.js +26 -0
  78. package/packages/Icon/src/icons/book.js +14 -0
  79. package/packages/Icon/src/icons/bookmark.js +14 -0
  80. package/packages/Icon/src/icons/bug.js +22 -0
  81. package/packages/Icon/src/icons/bullhorn.js +14 -0
  82. package/packages/Icon/src/icons/calc.js +14 -0
  83. package/packages/Icon/src/icons/checkbox.js +14 -0
  84. package/packages/Icon/src/icons/circle.js +14 -0
  85. package/packages/Icon/src/icons/close.js +14 -0
  86. package/packages/Icon/src/icons/cloud-sun.js +14 -0
  87. package/packages/Icon/src/icons/coffee.js +14 -0
  88. package/packages/Icon/src/icons/component.js +14 -0
  89. package/packages/Icon/src/icons/compress.js +14 -0
  90. package/packages/Icon/src/icons/copyright.js +14 -0
  91. package/packages/Icon/src/icons/dialog.js +14 -0
  92. package/packages/Icon/src/icons/download.js +14 -0
  93. package/packages/Icon/src/icons/duration.js +14 -0
  94. package/packages/Icon/src/icons/excel.js +18 -0
  95. package/packages/Icon/src/icons/expand.js +14 -0
  96. package/packages/Icon/src/icons/export.js +21 -0
  97. package/packages/Icon/src/icons/eye-slash.js +14 -0
  98. package/packages/Icon/src/icons/eye.js +14 -0
  99. package/packages/Icon/src/icons/file.js +18 -0
  100. package/packages/Icon/src/icons/form.js +14 -0
  101. package/packages/Icon/src/icons/ganged.js +14 -0
  102. package/packages/Icon/src/icons/gaode.js +27 -0
  103. package/packages/Icon/src/icons/gift.js +14 -0
  104. package/packages/Icon/src/icons/home.js +14 -0
  105. package/packages/Icon/src/icons/image.js +14 -0
  106. package/packages/Icon/src/icons/import.js +18 -0
  107. package/packages/Icon/src/icons/index.js +67 -0
  108. package/packages/Icon/src/icons/info.js +21 -0
  109. package/packages/Icon/src/icons/laptop.js +14 -0
  110. package/packages/Icon/src/icons/line.js +34 -0
  111. package/packages/Icon/src/icons/lock.js +14 -0
  112. package/packages/Icon/src/icons/map.js +18 -0
  113. package/packages/Icon/src/icons/more.js +19 -0
  114. package/packages/Icon/src/icons/move.js +14 -0
  115. package/packages/Icon/src/icons/org.js +18 -0
  116. package/packages/Icon/src/icons/palette.js +14 -0
  117. package/packages/Icon/src/icons/plan.js +17 -0
  118. package/packages/Icon/src/icons/ppt.js +18 -0
  119. package/packages/Icon/src/icons/question.js +18 -0
  120. package/packages/Icon/src/icons/radio.js +14 -0
  121. package/packages/Icon/src/icons/refresh.js +14 -0
  122. package/packages/Icon/src/icons/search.js +14 -0
  123. package/packages/Icon/src/icons/select.js +14 -0
  124. package/packages/Icon/src/icons/setting.js +18 -0
  125. package/packages/Icon/src/icons/simple-collapse.js +18 -0
  126. package/packages/Icon/src/icons/simple-expand.js +14 -0
  127. package/packages/Icon/src/icons/sort.js +22 -0
  128. package/packages/Icon/src/icons/sword.js +26 -0
  129. package/packages/Icon/src/icons/table.js +14 -0
  130. package/packages/Icon/src/icons/time.js +14 -0
  131. package/packages/Icon/src/icons/tree.js +14 -0
  132. package/packages/Icon/src/icons/typography.js +18 -0
  133. package/packages/Icon/src/icons/upload.js +18 -0
  134. package/packages/Icon/src/icons/user.js +14 -0
  135. package/packages/Icon/src/icons/users.js +30 -0
  136. package/packages/Icon/src/icons/video.js +14 -0
  137. package/packages/Icon/src/icons/word.js +18 -0
  138. package/packages/Icon/src/main.vue +432 -0
  139. package/packages/Image/index.js +7 -0
  140. package/packages/Image/src/main.vue +66 -0
  141. package/packages/Input/index.js +7 -0
  142. package/packages/Input/src/main.vue +552 -0
  143. package/packages/JobSelector/index.js +7 -0
  144. package/packages/JobSelector/src/main.vue +339 -0
  145. package/packages/JobSelectorInput/index.js +7 -0
  146. package/packages/JobSelectorInput/src/main.vue +87 -0
  147. package/packages/Map/index.js +7 -0
  148. package/packages/Map/src/Map.vue +427 -0
  149. package/packages/Milepost/index.js +7 -0
  150. package/packages/Milepost/src/main.vue +45 -0
  151. package/packages/OnlineForm/index.js +7 -0
  152. package/packages/OnlineForm/src/Form.vue +359 -0
  153. package/packages/OrgPostDialog/index.js +7 -0
  154. package/packages/OrgPostDialog/src/main.vue +244 -0
  155. package/packages/OrgSelector/index.js +7 -0
  156. package/packages/OrgSelector/src/main.vue +493 -0
  157. package/packages/OrgSelectorInput/index.js +7 -0
  158. package/packages/OrgSelectorInput/src/OrgSelectorInput.vue +216 -0
  159. package/packages/PostSelector/index.js +7 -0
  160. package/packages/PostSelector/src/main.vue +463 -0
  161. package/packages/PostSelectorInput/index.js +7 -0
  162. package/packages/PostSelectorInput/src/PostSelectorInput.vue +200 -0
  163. package/packages/Preview/index.js +7 -0
  164. package/packages/Preview/src/FillPage.vue +311 -0
  165. package/packages/Preview/src/FrameViewer.vue +135 -0
  166. package/packages/Preview/src/Loading.vue +126 -0
  167. package/packages/Preview/src/PdfViewer.vue +125 -0
  168. package/packages/Preview/src/TextViewer.vue +99 -0
  169. package/packages/Preview/src/main.vue +242 -0
  170. package/packages/Preview/src/watermark.js +124 -0
  171. package/packages/ProcessRecord/index.js +7 -0
  172. package/packages/ProcessRecord/src/main.vue +392 -0
  173. package/packages/Qrcode/index.js +7 -0
  174. package/packages/Qrcode/src/Qrcode.vue +105 -0
  175. package/packages/QuerySqlPreview/index.js +7 -0
  176. package/packages/QuerySqlPreview/src/QuerySqlPreview.vue +163 -0
  177. package/packages/Radio/index.js +7 -0
  178. package/packages/Radio/src/main.vue +172 -0
  179. package/packages/Rate/index.js +7 -0
  180. package/packages/Rate/src/main.vue +89 -0
  181. package/packages/ReadonlyInput/index.js +7 -0
  182. package/packages/ReadonlyInput/src/main.vue +92 -0
  183. package/packages/RelevantFlow/index.js +7 -0
  184. package/packages/RelevantFlow/src/main.vue +547 -0
  185. package/packages/RelevantFlow/src/relevantFlow.js +28 -0
  186. package/packages/RoleSelector/index.js +7 -0
  187. package/packages/RoleSelector/src/main.vue +358 -0
  188. package/packages/RoleSelectorInput/index.js +7 -0
  189. package/packages/RoleSelectorInput/src/main.vue +84 -0
  190. package/packages/SaveButton/index.js +7 -0
  191. package/packages/SaveButton/src/main.vue +73 -0
  192. package/packages/Select/index.js +7 -0
  193. package/packages/Select/src/main.vue +330 -0
  194. package/packages/SelectTree/index.js +7 -0
  195. package/packages/SelectTree/src/SelectTree.vue +352 -0
  196. package/packages/Selector/index.js +7 -0
  197. package/packages/Selector/src/main.vue +617 -0
  198. package/packages/SidebarDialog/index.js +7 -0
  199. package/packages/SidebarDialog/src/main.vue +156 -0
  200. package/packages/Slider/index.js +7 -0
  201. package/packages/Slider/src/main.vue +84 -0
  202. package/packages/Step/index.js +7 -0
  203. package/packages/StepLayout/index.js +7 -0
  204. package/packages/Steps/index.js +7 -0
  205. package/packages/Steps/src/Step.vue +122 -0
  206. package/packages/Steps/src/StepLayout.vue +35 -0
  207. package/packages/Steps/src/Steps.vue +65 -0
  208. package/packages/Subtable/index.js +33 -0
  209. package/packages/Subtable/src/SubDialog.vue +1926 -0
  210. package/packages/Subtable/src/SubExportDialog.vue +115 -0
  211. package/packages/Subtable/src/SubImportDialog.vue +316 -0
  212. package/packages/Subtable/src/SubPagination.vue +112 -0
  213. package/packages/Subtable/src/SubtableBackfill.vue +83 -0
  214. package/packages/Subtable/src/dialog.js +42 -0
  215. package/packages/Switch/index.js +7 -0
  216. package/packages/Switch/src/main.vue +83 -0
  217. package/packages/Table/index.js +7 -0
  218. package/packages/Table/src/CustomColumn.vue +351 -0
  219. package/packages/Table/src/Table.vue +979 -0
  220. package/packages/TableColumn/index.js +7 -0
  221. package/packages/TableColumn/src/main.vue +177 -0
  222. package/packages/TableSearchField/index.js +7 -0
  223. package/packages/TableSearchField/src/main.vue +334 -0
  224. package/packages/TableSearchPanel/index.js +7 -0
  225. package/packages/TableSearchPanel/src/main.vue +149 -0
  226. package/packages/Tabs/index.js +7 -0
  227. package/packages/Tabs/src/Tabs.vue +140 -0
  228. package/packages/Tag/index.js +7 -0
  229. package/packages/Tag/src/main.vue +264 -0
  230. package/packages/TemplateBatchUpdate/index.js +7 -0
  231. package/packages/TemplateBatchUpdate/src/TemplateBatchUpdateDialog.vue +174 -0
  232. package/packages/TemplateForm/index.js +7 -0
  233. package/packages/TemplateForm/src/main.vue +645 -0
  234. package/packages/TemplateFormDialog/index.js +7 -0
  235. package/packages/TemplateFormDialog/src/main.vue +61 -0
  236. package/packages/TemplateImportResult/index.js +7 -0
  237. package/packages/TemplateImportResult/src/main.vue +158 -0
  238. package/packages/TemplatePreview/index.js +19 -0
  239. package/packages/TemplatePreview/src/TemplatePreview.vue +169 -0
  240. package/packages/TemplatePreview/src/TemplatePreviewFile.vue +171 -0
  241. package/packages/TemplatePreview/src/TemplatePreviewImage.vue +83 -0
  242. package/packages/TemplateTaskCirculate/index.js +7 -0
  243. package/packages/TemplateTaskCirculate/src/main.vue +238 -0
  244. package/packages/Text/index.js +7 -0
  245. package/packages/Text/src/main.vue +57 -0
  246. package/packages/TimePicker/index.js +7 -0
  247. package/packages/TimePicker/src/main.vue +139 -0
  248. package/packages/TimeSelect/index.js +7 -0
  249. package/packages/TimeSelect/src/main.vue +96 -0
  250. package/packages/Tree/index.js +7 -0
  251. package/packages/Tree/src/main.vue +439 -0
  252. package/packages/TreeDialog/index.js +7 -0
  253. package/packages/TreeDialog/src/main.vue +293 -0
  254. package/packages/TreeListDialog/index.js +7 -0
  255. package/packages/TreeListDialog/src/main.vue +219 -0
  256. package/packages/Typography/index.js +8 -0
  257. package/packages/Typography/src/create-header.js +72 -0
  258. package/packages/UserDialog/index.js +7 -0
  259. package/packages/UserDialog/src/main.vue +250 -0
  260. package/packages/UserSelector/index.js +7 -0
  261. package/packages/UserSelector/src/main.vue +746 -0
  262. package/packages/UserSelectorInput/index.js +7 -0
  263. package/packages/UserSelectorInput/src/main.vue +319 -0
  264. package/packages/picture/index.js +7 -0
  265. package/packages/picture/src/main.vue +530 -0
  266. package/packages/plugins/Echarts.js +30 -0
  267. package/packages/plugins/Map.js +29 -0
  268. package/packages/plugins/Preview.js +49 -0
  269. package/packages/plugins/Qrcode.js +7 -0
  270. package/packages/plugins/XLSX.js +7 -0
  271. package/packages/plugins/wangeditor.js +19 -0
  272. package/src/assets/icon_found_img.png +0 -0
  273. package/src/assets/table-no-data.png +0 -0
  274. package/src/directive/badge.js +53 -0
  275. package/src/directive/copy.js +47 -0
  276. package/src/directive/ellipsis.js +6 -0
  277. package/src/directive/expandClick.js +23 -0
  278. package/src/directive/express.js +86 -0
  279. package/src/directive/form.js +122 -0
  280. package/src/directive/format.js +24 -0
  281. package/src/directive/formulas.js +708 -0
  282. package/src/directive/index.js +42 -0
  283. package/src/directive/permissionLine.js +59 -0
  284. package/src/directive/permissionLineLable.js +56 -0
  285. package/src/directive/permit.js +23 -0
  286. package/src/directive/popconfirm.js +86 -0
  287. package/src/directive/relatedQuery.js +61 -0
  288. package/src/directive/resize.js +18 -0
  289. package/src/directive/subSort.js +18 -0
  290. package/src/directive/tableDrag.js +25 -0
  291. package/src/directive/tooltip.js +37 -0
  292. package/src/filter/computerSize.js +23 -0
  293. package/src/filter/dateFormat.js +10 -0
  294. package/src/filter/index.js +10 -0
  295. package/src/index.js +267 -0
  296. package/src/locale/format.js +44 -0
  297. package/src/locale/index.js +48 -0
  298. package/src/locale/lang/en.js +59 -0
  299. package/src/locale/lang/zh-CN.js +58 -0
  300. package/src/locale/lang/zh-TW.js +57 -0
  301. package/src/locale/validate/dict.js +223 -0
  302. package/src/math.js +270 -0
  303. package/src/mixins/emitter.js +33 -0
  304. package/src/mixins/form.js +25 -0
  305. package/src/mixins/formDataUpdate.js +32 -0
  306. package/src/mixins/ganged.js +126 -0
  307. package/src/mixins/inputName.js +30 -0
  308. package/src/mixins/linkage.js +403 -0
  309. package/src/mixins/locale.js +9 -0
  310. package/src/mixins/mobileMode.js +27 -0
  311. package/src/mixins/onlineHottable.js +105 -0
  312. package/src/mixins/onlineSubtable.js +468 -0
  313. package/src/mixins/permission.js +84 -0
  314. package/src/mixins/querySqlPreview.js +747 -0
  315. package/src/mixins/regionValidator.js +70 -0
  316. package/src/mixins/script.js +35 -0
  317. package/src/mixins/templatePreview.js +3673 -0
  318. package/src/service.js +336 -0
  319. package/src/services/CustomQuery.js +199 -0
  320. package/src/services/SubPagination.js +132 -0
  321. package/src/styles/index.scss +7 -0
  322. package/src/styles/selector.scss +127 -0
  323. package/src/styles/variables.scss +71 -0
  324. package/src/util/base64.js +21 -0
  325. package/src/util/brower.js +15 -0
  326. package/src/util/clone.js +61 -0
  327. package/src/util/path.js +4 -0
  328. package/src/util/request.js +14 -0
  329. package/src/utils.js +1205 -0
  330. package/src/validate.js +184 -0
@@ -0,0 +1,3673 @@
1
+ import { Loading } from 'element-ui'
2
+ import utils from 'sword-vue-ui/src/utils.js'
3
+ import { createObjectURL } from 'sword-vue-ui/src/util/brower.js'
4
+ const { Base64 } = require('js-base64')
5
+ import JSZip from 'jszip'
6
+ import html2canvas from 'html2canvas'
7
+ import $ from 'jquery'
8
+ const axios = require('axios')
9
+ const { saveAs } = require('file-saver')
10
+
11
+ const req = function (url, data = {}, option = {}) {
12
+ const requestData = {
13
+ url: url,
14
+ data: data,
15
+ method: option.method || 'GET',
16
+ params: option.params || {},
17
+ onUploadProgress: option.onUploadProgress || null,
18
+ headers: option.headers || '',
19
+ responseType: option.responseType || 'json',
20
+ }
21
+ return axios(requestData)
22
+ }
23
+
24
+ export default {
25
+ props: {
26
+ templateKey: String,
27
+ defKey: String,
28
+ taskType: {
29
+ type: String,
30
+ default: '',
31
+ },
32
+ dataView: Object,
33
+ isJoinFlow: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ parameterqQuerys: String,
38
+ },
39
+ data() {
40
+ return {
41
+ treeQuerys: [],
42
+ alias_new: 'statement',
43
+ loading: false,
44
+ QRCodeurl: '',
45
+ QRCodeDialog: false,
46
+ html: '',
47
+ tableData: { selectRows: [], querys: '' },
48
+ dialogExportVisible: false,
49
+ exportData: { getType: 'all', expField: [] },
50
+ displayFields: [],
51
+ exportSellection: [],
52
+ searchForm: {},
53
+ queryForm: {
54
+ queryData: '',
55
+ },
56
+ formType: false,
57
+ labelPosition: 'left',
58
+ incons: 'el-icon-arrow-down',
59
+ options: {
60
+ fullscreen: true,
61
+ lock: true,
62
+ },
63
+ rowTemplateId: null,
64
+ rowId: null,
65
+ QRCodeShow: true,
66
+ QRCodeDesc: [],
67
+ tree: [],
68
+ customDialog: [],
69
+ tableHeight: 0.685 * window.innerHeight,
70
+ dialogSubVisible: false,
71
+ tabs: [],
72
+ ents: [],
73
+ modifyRecord: {
74
+ pagination: {
75
+ pageBean: {
76
+ page: 1,
77
+ pageSize: 10,
78
+ total: 0,
79
+ },
80
+ },
81
+ },
82
+ recordList: [],
83
+ recordRefId: '',
84
+ dialogRecordVisible: false,
85
+ recordTableLoading: false,
86
+ modifyDetailDialogVisible: false,
87
+ currentModify: {},
88
+ refId: '',
89
+ querySubValue: '',
90
+ subTableLoading: false,
91
+ currentTabName: '',
92
+ currentTab: {},
93
+ exportType: 'main',
94
+ subDisplayFields: [],
95
+ subDisplayFieldsList: [],
96
+ notPrint: false,
97
+ displayField: {},
98
+ treeList: [],
99
+ rows: [],
100
+ pagination: {
101
+ page: 1,
102
+ pageSize: 10,
103
+ total: 1,
104
+ },
105
+ paginationLayout: 'total, sizes, prev, pager, next, jumper',
106
+ total: 0,
107
+ permission: {
108
+ print: true,
109
+ add: true,
110
+ del: true,
111
+ export: true,
112
+ edit: true,
113
+ hidden: false,
114
+ copy: true,
115
+ },
116
+ //是否显示最后的操作列
117
+ showRightMenu: true,
118
+ listSelectable: true,
119
+ filters: {},
120
+ sorter: null,
121
+ dialogSunVisible: false, //孙表对话框
122
+ sunTabs: [], //孙表数据
123
+ querySunValue: '',
124
+ operateColWidth: '240',
125
+ summaryFields: [],
126
+ dialogVisible: false,
127
+ pageResult: {
128
+ page: 1,
129
+ pageSize: 20,
130
+ total: 0,
131
+ },
132
+ logData: [],
133
+ notSortableFields: [
134
+ 'bpm_status_',
135
+ 'bpm_proc_inst_id_',
136
+ 'bpm_subject_',
137
+ 'bpm_proc_def_name_',
138
+ 'bpm_create_time_',
139
+ 'bpm_end_time_',
140
+ 'bpm_is_forbidden_',
141
+ 'bpm_creator_',
142
+ ],
143
+ defaultValueList: [], //批量更新数据
144
+ ignoredAlias: ['appCenterFront'],
145
+ QRCodePattern: true,
146
+ QRCodeType: '',
147
+ isMobile: false,
148
+ activeNames: ['1'],
149
+ switchMap: {},
150
+ filterMap: {},
151
+ dataViewDialogVisible: false,
152
+ dialogWidth: '1580px',
153
+ dialogHeight: '740px',
154
+ srcUrl: '',
155
+ filedList: [],
156
+ flowBtnPermission: {},
157
+ selectedDefId: '',
158
+ selectedInstId: '',
159
+ selectedTaskId: '',
160
+ showScriptButton: {},
161
+ curSelectParams: {},
162
+ importCacheKey: '',
163
+ isInit: true,
164
+ }
165
+ },
166
+ watch: {
167
+ ents: {
168
+ handler: function (newVal, oldValue) {
169
+ if (newVal && newVal.length >= 1 && newVal != oldValue) {
170
+ this.getSubData(this, this.refId)
171
+ }
172
+ },
173
+ deep: true,
174
+ immediate: true,
175
+ },
176
+ templateInfo: {
177
+ handler: function (newVal) {
178
+ if (newVal && newVal.id) {
179
+ let _me = this
180
+ _me.templateInfo = newVal
181
+ //是否分页
182
+ if (_me.templateInfo.needPage == 1) {
183
+ _me.pagination.pageSize = _me.templateInfo.pageSize
184
+ }
185
+
186
+ if (_me.templateInfo.displayField) {
187
+ let displayField = utils.parseToJson(_me.templateInfo.displayField)
188
+ for (let i = 0; i < displayField.length; i++) {
189
+ if (displayField[i].type) {
190
+ this.displayFields.push(displayField[i])
191
+ }
192
+ }
193
+ }
194
+ if (_me.templateInfo.manageField) {
195
+ let btn = ['add', 'switch', 'export', 'import']
196
+ let manageField = utils.parseToJson(_me.templateInfo.manageField)
197
+ for (let i = 0; i < manageField.length; i++) {
198
+ if (
199
+ btn.indexOf(manageField[i].name) == -1 &&
200
+ manageField[i].linePosition
201
+ ) {
202
+ this.filedList.push(manageField[i])
203
+ }
204
+ }
205
+ if (manageField.length == 1 && manageField.name == 'add') {
206
+ _me.showRightMenu = false
207
+ }
208
+ }
209
+ if (_me.templateInfo.conditionField) {
210
+ let conditionField = utils.parseToJson(
211
+ _me.templateInfo.conditionField
212
+ )
213
+ for (var i = 0; i < conditionField.length; i++) {
214
+ var fieldName =
215
+ conditionField[i].colPrefix + conditionField[i].name
216
+ this.$set(this.searchForm, fieldName, '')
217
+ }
218
+ }
219
+ let params = { templateId: _me.templateInfo.id }
220
+ let pageBean = {
221
+ pageBean: {
222
+ page: '1',
223
+ pageSize: newVal.pageSize,
224
+ showTotal: 'true',
225
+ },
226
+ } //初次加载默认pageBean
227
+ params.pagination = pageBean
228
+ if (_me.isJoinFlow) {
229
+ params.isJoinFlow = true
230
+ params.taskType = _me.taskType
231
+ params.defKey = _me.defKey
232
+ }
233
+ if (_me.dataView) {
234
+ _me.handelBindFiledValua()
235
+ //关联查询字段
236
+ if (_me.dataView.selectList && _me.dataView.selectList.length > 0) {
237
+ params.selectList = _me.dataView.selectList
238
+ }
239
+ params.refIdValue = _me.dataView.refIdValue
240
+ }
241
+ if (this.parameterqQuerys) {
242
+ var querys = JSON.parse(
243
+ Base64.decode(decodeURIComponent(this.parameterqQuerys))
244
+ )
245
+ params.pagination.querys = querys
246
+ }
247
+ let defaultQuery = this.buildDefaultQuerys()
248
+ if (defaultQuery.length > 0) {
249
+ if (params.pagination.querys) {
250
+ params.pagination.querys.concat(defaultQuery)
251
+ } else {
252
+ params.pagination.querys = defaultQuery
253
+ }
254
+ }
255
+ //如果有设置默认排序,优先使用默认排序
256
+ if (this.templateInfo.sortField) {
257
+ let sortField = JSON.parse(this.templateInfo.sortField)
258
+ let sorter = []
259
+ for (let x = 0; x < sortField.length; x++) {
260
+ const s = sortField[x]
261
+ const prefix = this.getColPreFix(sortField, s.name)
262
+ sorter.push({
263
+ property: prefix + s.name,
264
+ direction: s.sort,
265
+ })
266
+ }
267
+ params.pagination.sorter = sorter
268
+ }
269
+
270
+ // const this_ = this
271
+ if (params.templateId) {
272
+ // this.getBpmTemplateByPagination(
273
+ // params,
274
+ // this_.initSwitchStatus,
275
+ // this_.handleRightMenu
276
+ // )
277
+ }
278
+ if (newVal.treeField && newVal.treeField !== '{}') {
279
+ let treeField = JSON.parse(newVal.treeField)
280
+ if (treeField.alias) {
281
+ this.initTree(treeField)
282
+ this.formGetSubEntsByFormKey()
283
+ }
284
+ }
285
+ if (newVal.summaryField) {
286
+ this.summaryFields = JSON.parse(newVal.summaryField)
287
+ }
288
+ }
289
+ },
290
+ deep: true,
291
+ immediate: true,
292
+ },
293
+ currentTabName: function (newVal) {
294
+ if (newVal) {
295
+ this.querySubValue = ''
296
+ }
297
+ },
298
+ rows: {
299
+ handler: function (newVal) {
300
+ if (this.templateInfo.defId) {
301
+ let this_ = this
302
+ let boAlias = this.templateInfo.boDefAlias
303
+ let pks = []
304
+ let pkField = this.templateInfo.pkField
305
+ newVal.forEach((item) => {
306
+ if (!item['bpm_proc_inst_load_done']) {
307
+ pks.push(item[pkField])
308
+ }
309
+ })
310
+ if (pks.length != 0) {
311
+ this.$requestConfig.getInstanceByPks(pks, boAlias).then((resp) => {
312
+ if (resp && resp.state) {
313
+ let map = resp.value
314
+ newVal.forEach((row) => {
315
+ let objNode = map[row[pkField]]
316
+ Object.keys(objNode).forEach((key) => {
317
+ //row[key] = objNode[key];
318
+ this_.$set(row, key, objNode[key])
319
+ })
320
+ this_.$set(row, 'bpm_proc_inst_load_done', true)
321
+ })
322
+ this.$forceUpdate()
323
+ this_.checkFlowPermission()
324
+ }
325
+ })
326
+ }
327
+ }
328
+ },
329
+ },
330
+ },
331
+ computed: {
332
+ showDraftList() {
333
+ //如果当前页面被嵌入iframe里面不显示草稿
334
+ return !this.isJoinFlow
335
+ },
336
+ },
337
+ mounted() {
338
+ this.handelBindFiledValua()
339
+ let this_ = this
340
+ this.$root.$on('form-reload-success', function () {
341
+ this_.handelBindFiledValua()
342
+ })
343
+ this.$emit('afterMounted')
344
+ this.calcScriptBtnPermission()
345
+ // setTimeout(() => {
346
+ // this.$refs.multipleTemplateTable.handleFilterChange(this.filterMap)
347
+ // }, 100)
348
+ },
349
+ methods: {
350
+ queryFormatterData(item, array) {
351
+ let val = []
352
+ if (item || item === 0) {
353
+ let list = Base64.decode(array)
354
+ if (list) {
355
+ list = JSON.parse(list) || []
356
+ if (typeof item != 'number' && item.indexOf(',') != -1) {
357
+ let items = item.split(',')
358
+ items.forEach((i) => {
359
+ let format = list.find((e) => e.key_ == i) || {}
360
+ val.push(format.value_ || i)
361
+ })
362
+ } else {
363
+ let format = list.find((e) => e.key_ == item) || {}
364
+ val.push(format.value_ || item)
365
+ }
366
+ } else {
367
+ val.push(item)
368
+ }
369
+ }
370
+ return val.join(',')
371
+ },
372
+ calcScriptBtnPermission() {
373
+ let obj = {
374
+ print: true,
375
+ add: true,
376
+ edit: true,
377
+ del: true,
378
+ batchUpdate: true,
379
+ export: true,
380
+ import: true,
381
+ switch: true,
382
+ url: true,
383
+ copy: true,
384
+ }
385
+ if (this.templateInfo && this.templateInfo.manageField) {
386
+ let manageField = JSON.parse(this.templateInfo.manageField)
387
+ let this_ = this
388
+ manageField.forEach((item) => {
389
+ if (item.beforeScriptValue) {
390
+ let promise = this_.beforeScript(item.beforeScriptValue)
391
+ promise.then((res) => {
392
+ obj[item.name] = res
393
+ })
394
+ }
395
+ })
396
+ }
397
+ this.showScriptButton = obj
398
+ },
399
+ formGetSubEntsByFormKey() {
400
+ this.$requestConfig
401
+ .getSubEntsByFormKey(this.templateInfo.formKey)
402
+ .then((resp) => {
403
+ resp.forEach((item) => {
404
+ let subDisplayFields = []
405
+ item.attributeList.forEach((attr) => {
406
+ subDisplayFields.push({
407
+ desc: attr.comment,
408
+ name: attr.fieldName,
409
+ type: attr.columnType,
410
+ })
411
+ })
412
+ this.subDisplayFields.push({
413
+ fields: subDisplayFields,
414
+ name: item.name,
415
+ comment: item.comment,
416
+ })
417
+ })
418
+ })
419
+ },
420
+ handleRightMenu() {
421
+ if (this.$el && this.$el.querySelector) {
422
+ let topBtnDom = this.$el.querySelector('div.top_btn_col')
423
+ if (
424
+ !topBtnDom ||
425
+ (!topBtnDom.querySelector('i.el-icon-delete') &&
426
+ !topBtnDom.querySelector('i.el-icon-edit') &&
427
+ !topBtnDom.querySelector('i.el-icon-s-grid'))
428
+ ) {
429
+ this.listSelectable = false
430
+ }
431
+ let _this = this
432
+ setTimeout(function () {
433
+ let tdDom = _this.$el.querySelector('td.right_menu')
434
+ if (
435
+ !tdDom ||
436
+ (!tdDom.querySelector('button') && !tdDom.querySelector('switch'))
437
+ ) {
438
+ _this.showRightMenu = false
439
+ }
440
+ }, 200)
441
+ }
442
+ },
443
+ loadImportLogData(param, cb) {
444
+ let querys = param.querys || []
445
+ let hasDefaultQuery = false
446
+ this.handelBindFiledValua()
447
+ let pID = this.dataView.refIdValue
448
+ querys.forEach((q) => {
449
+ if (q.property == 'PId') {
450
+ hasDefaultQuery = true
451
+ }
452
+ })
453
+ if (!hasDefaultQuery) {
454
+ querys.push({
455
+ operation: 'EQUAL',
456
+ group: 'defalut',
457
+ property: 'PId',
458
+ relation: 'AND',
459
+ value: pID,
460
+ })
461
+ querys.push({
462
+ operation: 'EQUAL',
463
+ group: 'defalut',
464
+ property: 'boAlias',
465
+ relation: 'AND',
466
+ value: this.templateInfo.boDefAlias,
467
+ })
468
+ }
469
+ param.querys = querys
470
+ this.$requestConfig
471
+ .getDataTemplateImportLogData(param)
472
+ .then((data) => {
473
+ let response = data
474
+ this.logData = response.rows
475
+ this.pageResult = {
476
+ page: response.page,
477
+ pageSize: response.pageSize,
478
+ total: response.total,
479
+ }
480
+ })
481
+ .finally(() => {
482
+ cb()
483
+ })
484
+ },
485
+ handelBindFiledValua() {
486
+ //数据视图控件
487
+ let _me = this
488
+ if (this.dataView) {
489
+ const pInst = utils.getOnlineFormInstance(
490
+ this.$parent.$parent.$parent.$parent
491
+ )
492
+ if (!pInst[this.dataView.boDefAlias] && this.dataView.boDefAlias) {
493
+ this.dataView.boDefAlias = Object.keys(pInst.data)[0]
494
+ }
495
+ let refIdValue = utils.getValueByPath(
496
+ pInst,
497
+ 'data.' + this.dataView.boDefAlias + '.id_'
498
+ )
499
+
500
+ if (sessionStorage.getItem('formImportTempRefId') && !refIdValue) {
501
+ refIdValue = sessionStorage.getItem('formImportTempRefId')
502
+ } else if (!refIdValue) {
503
+ //导入的时候没有关键的外键,则为其自动添加
504
+ refIdValue = new Date().getTime()
505
+ sessionStorage.setItem('formImportTempRefId', refIdValue)
506
+ }
507
+ _me.dataView.refIdValue = refIdValue
508
+
509
+ if (
510
+ pInst.permission &&
511
+ pInst.permission.table &&
512
+ pInst.permission.table[this.templateInfo.boDefAlias]
513
+ ) {
514
+ this.permission = pInst.permission.table[this.templateInfo.boDefAlias]
515
+ }
516
+ if (this.permission.hidden) {
517
+ this.$parent.showDateView = false
518
+ }
519
+ //关联查询字段
520
+ let selectList = this.dataView.selectList
521
+ if (selectList && selectList.length > 0) {
522
+ for (let i = 0; i < selectList.length; i++) {
523
+ if (selectList[i].selectField) {
524
+ const path =
525
+ 'data.' +
526
+ this.dataView.boDefAlias +
527
+ '.' +
528
+ selectList[i].selectField
529
+ const value = utils.getValueByPath(pInst, path)
530
+ selectList[i].selectValue = value
531
+
532
+ //添加监听
533
+ pInst.$watch(path, function (newVal, oldVal) {
534
+ // 监听中使用间隔请求,减少请求次数
535
+ clearTimeout(this.timeout)
536
+ this.timeout = setTimeout(() => {
537
+ if (newVal !== oldVal) {
538
+ //_me.setDataViewValue(_me.dataView);
539
+ _me.search()
540
+ }
541
+ }, 500)
542
+ })
543
+ }
544
+ }
545
+ }
546
+ //关联填充字段
547
+ let bindList = this.dataView.bindList
548
+ if (bindList && bindList.length > 0) {
549
+ for (let i = 0; i < bindList.length; i++) {
550
+ if (bindList[i].fillField) {
551
+ const path =
552
+ 'data.' + this.dataView.boDefAlias + '.' + bindList[i].fillField
553
+ const value = utils.getValueByPath(pInst, path)
554
+
555
+ bindList[i].fillValue = value
556
+ pInst.$watch(path, function (newVal, oldVal) {
557
+ // 监听中使用间隔请求,减少请求次数
558
+ clearTimeout(this.timeout)
559
+ this.timeout = setTimeout(() => {
560
+ if (newVal !== oldVal) {
561
+ //_me.setDataViewValue(_me.dataView);
562
+ _me.search()
563
+ }
564
+ }, 500)
565
+ })
566
+ }
567
+ }
568
+ }
569
+ }
570
+ },
571
+ printList() {
572
+ this.notPrint = true
573
+ setTimeout(() => {
574
+ document.body.innerHTML = document.getElementById('printData').innerHTML
575
+ window.print()
576
+ location.reload()
577
+ }, 200)
578
+ setTimeout(() => {
579
+ this.notPrint = false
580
+ }, 200)
581
+ },
582
+ printDetail(templateId, id, action) {
583
+ //数据随机添加到其他菜单下面时获取当前菜单的别名
584
+ if (sessionStorage.menu_alias) {
585
+ this.alias_new = sessionStorage.menu_alias
586
+ }
587
+ var url =
588
+ '/templateForm/' + this.templateKey + '/' + action + '?single=true'
589
+ if (id) {
590
+ url = url + '&id=' + id
591
+ }
592
+ var startFlowStr = '&startFlow=false'
593
+ let path = url + startFlowStr
594
+ if (path.indexOf('othermenu') != -1) {
595
+ path = path.replace('/othermenu', '/')
596
+ }
597
+
598
+ this.$router.push({
599
+ path: path,
600
+ query: { isPrint: true },
601
+ })
602
+ },
603
+ complete(row, taskType) {
604
+ if (taskType == 'todo') {
605
+ this.$requestConfig
606
+ .getBpmTaskByInstId(row.bpm_proc_inst_id_)
607
+ .then((res) => {
608
+ if (res.data.length == 0) {
609
+ this.$message.error('此任务已被处理或不存在!')
610
+ } else if (res.data.length == 1) {
611
+ this.$router.push(
612
+ '/reportModuleInst/' +
613
+ res.data[0].id +
614
+ '/0' +
615
+ '/' +
616
+ this.defKey +
617
+ '/true/' +
618
+ this.templateKey
619
+ )
620
+ } else {
621
+ this.$message.error('暂不支持!')
622
+ }
623
+ })
624
+ } else if (taskType == 'done') {
625
+ this.$router.push(
626
+ '/reportModuleInstDone/' +
627
+ row.bpm_proc_inst_id_ +
628
+ '/doneList/' +
629
+ this.defKey +
630
+ '/' +
631
+ this.templateKey
632
+ )
633
+ } else if (taskType == 'request') {
634
+ this.$router.push(
635
+ '/reportModuleInstDone/' +
636
+ row.bpm_proc_inst_id_ +
637
+ '/request/' +
638
+ this.defKey +
639
+ '/' +
640
+ this.templateKey
641
+ )
642
+ } else if (taskType == 'todoRead') {
643
+ let pageBean = { page: 1, pageSize: 10, showTotal: 'true' }
644
+ let status = row.bpm_status_
645
+ this.$requestConfig
646
+ .getNoticeTodoReadList({
647
+ pageBean: pageBean,
648
+ querys: [
649
+ {
650
+ property: 'proc_inst_id_',
651
+ value: row.bpm_proc_inst_id_,
652
+ operation: 'EQUAL',
653
+ relation: 'AND',
654
+ },
655
+ ],
656
+ })
657
+ .then((response) => {
658
+ if (response.rows && response.rows.length > 0) {
659
+ let id = response.rows[0].id
660
+ let url = ''
661
+ 7
662
+ if (status == 'FOLLOW') {
663
+ url =
664
+ '/reportModuleInstTaskRead/' +
665
+ id +
666
+ '/FOLLOW/' +
667
+ this.defKey +
668
+ '/' +
669
+ this.templateKey
670
+ } else if (status == 'COMMU') {
671
+ url =
672
+ '/reportModuleInst/' +
673
+ id +
674
+ '/0/' +
675
+ this.defKey +
676
+ '/true/' +
677
+ this.templateKey
678
+ } else {
679
+ url =
680
+ '/reportModuleInstRead/' +
681
+ row.bpm_proc_inst_id_ +
682
+ '/read/' +
683
+ id +
684
+ '/' +
685
+ this.defKey +
686
+ '/' +
687
+ this.templateKey
688
+ }
689
+ this.$router.push(url)
690
+ }
691
+ })
692
+ } else if (taskType == 'doneRead') {
693
+ let pageBean = { page: 1, pageSize: 10, showTotal: 'true' }
694
+ this.$requestConfig
695
+ .getNoticeDoneReadList({
696
+ pageBean: pageBean,
697
+ querys: [
698
+ {
699
+ property: 'proc_inst_id_',
700
+ value: row.bpm_proc_inst_id_,
701
+ operation: 'EQUAL',
702
+ relation: 'AND',
703
+ },
704
+ ],
705
+ })
706
+ .then((response) => {
707
+ if (response.rows && response.rows.length > 0) {
708
+ let id = response.rows[0].id
709
+ this.$router.push(
710
+ '/reportModuleInstDone/' +
711
+ row.bpm_proc_inst_id_ +
712
+ '/read/done/' +
713
+ id +
714
+ '/' +
715
+ this.defKey +
716
+ '/' +
717
+ this.templateKey
718
+ )
719
+ }
720
+ })
721
+ } else if (taskType == 'myRead') {
722
+ let pageBean = { page: 1, pageSize: 10, showTotal: 'true' }
723
+ this.$requestConfig
724
+ .getMyNoticeReadList({
725
+ pageBean: pageBean,
726
+ querys: [
727
+ {
728
+ property: 'proc_inst_id_',
729
+ value: row.bpm_proc_inst_id_,
730
+ operation: 'EQUAL',
731
+ relation: 'AND',
732
+ },
733
+ ],
734
+ })
735
+ .then((response) => {
736
+ if (response.rows && response.rows.length > 0) {
737
+ let id = response.rows[0].id
738
+ this.$router.push(
739
+ '/reportModuleInstMyRead/' +
740
+ row.bpm_proc_inst_id_ +
741
+ '/' +
742
+ id +
743
+ '/myRead/' +
744
+ this.defKey +
745
+ '/' +
746
+ this.templateKey
747
+ )
748
+ }
749
+ })
750
+ } else if (taskType == 'myDelegate') {
751
+ this.$router.push(
752
+ '/reportModuleInstRead/' +
753
+ row.bpm_proc_inst_id_ +
754
+ '/delegate/' +
755
+ this.defKey +
756
+ '/' +
757
+ this.templateKey
758
+ )
759
+ }
760
+ },
761
+ //下载全部选中的二维码
762
+ downloadAllQRCode(
763
+ templateId,
764
+ mobileFormAlias,
765
+ display,
766
+ pkField,
767
+ QRCodePattern
768
+ ) {
769
+ this.QRCodePattern = QRCodePattern
770
+ const _selectData = this.$refs.multipleTemplateTable.selection
771
+ if (_selectData.length === 0) {
772
+ this.$message.warning('请至少选中一条数据!')
773
+ return
774
+ }
775
+ this.loading = true
776
+ let token = this.$store.state.login.currentUser.token
777
+ let mobile = window.context.mobile
778
+ let QRCodeurl = ''
779
+ let zip = new JSZip()
780
+ // 创建一个名为images的新的文件目录
781
+ let img = zip.folder('images')
782
+ let plist = []
783
+ for (let x = 0; x < _selectData.length; x++) {
784
+ if (this.QRCodePattern) {
785
+ QRCodeurl =
786
+ mobile +
787
+ '/QRCodeForm/' +
788
+ this.templateKey +
789
+ '/get' +
790
+ '?id=' +
791
+ _selectData[x][pkField] +
792
+ '&token=' +
793
+ token
794
+ } else {
795
+ QRCodeurl =
796
+ mobile +
797
+ '/QRCodeForm/' +
798
+ this.templateKey +
799
+ '/edit' +
800
+ '?id=' +
801
+ _selectData[x][pkField]
802
+ }
803
+ let msg = document.createElement('canvas')
804
+
805
+ this.$qrcode.toCanvas(msg, QRCodeurl, function (error) {
806
+ console.error(error)
807
+ })
808
+ let _canvas = document.createElement('div')
809
+ _canvas.setAttribute('id', 'QRCodeAndDescAll' + x)
810
+ _canvas.setAttribute(
811
+ 'style',
812
+ 'text-align:center;width:' + msg.width + 'px;'
813
+ )
814
+ _canvas.appendChild(msg)
815
+ if (!display) {
816
+ display = []
817
+ }
818
+ //创建底部的描述信息
819
+ for (let Y = 0; Y < display.length; Y++) {
820
+ let item = JSON.parse(display[Y])
821
+ if (_selectData[x][item.name]) {
822
+ let desc = document.createElement('div')
823
+ desc.innerHTML = item.desc + ':' + _selectData[x][item.name]
824
+ _canvas.appendChild(desc)
825
+ }
826
+ }
827
+ document.getElementById('QRCodeAndDescAll').appendChild(_canvas)
828
+ plist.push(this.downloadQRCodeAndDesc('#QRCodeAndDescAll' + x, _canvas))
829
+ }
830
+ Promise.all(plist).then((result) => {
831
+ document.getElementById('QRCodeAndDescAll').innerHTML = ''
832
+ for (let x = 0; x < result.length; x++) {
833
+ let canvas = result[x]
834
+ let image = canvas.toDataURL().split(';base64,')[1]
835
+ // 这个images文件目录中创建一个base64数据为imgData的图像,图像名是smile.gif
836
+ img.file(x + '.png', image, { base64: true })
837
+ }
838
+ // 把打包内容异步转成blob二进制格式
839
+ zip.generateAsync({ type: 'blob' }).then(function (content) {
840
+ let eleLink = document.createElement('a')
841
+ eleLink.download = '二维码.zip'
842
+ eleLink.style.display = 'none'
843
+ // 下载内容转变成blob地址
844
+ eleLink.href = createObjectURL(content)
845
+ // 触发点击
846
+ document.body.appendChild(eleLink)
847
+ eleLink.click()
848
+ // 然后移除
849
+ document.body.removeChild(eleLink)
850
+ })
851
+
852
+ this.loading = false
853
+ })
854
+ },
855
+ onCopy() {
856
+ this.$message.success('内容已复制到剪切板!')
857
+ },
858
+ // 复制失败时的回调函数
859
+ onError() {
860
+ this.$message.error('抱歉,复制失败!')
861
+ },
862
+ downloadQRCode() {
863
+ let plist = []
864
+ let _canvas = document.querySelector('#QRCodeAndDesc')
865
+ plist.push(this.downloadQRCodeAndDesc('#QRCodeAndDesc', _canvas))
866
+ Promise.all(plist).then((result) => {
867
+ let canvas = result[0]
868
+ let link = document.createElement('a')
869
+ link.href = canvas.toDataURL() //下载链接
870
+ link.setAttribute('download', '二维码.jpg')
871
+ link.style.display = 'none' //a标签隐藏
872
+ document.body.appendChild(link)
873
+ link.click()
874
+ })
875
+ },
876
+ //把二维码与二维码说明一起下载成图片
877
+ downloadQRCodeAndDesc(classs, _canvas) {
878
+ let p2 = new Promise((resolve) => {
879
+ let canvas2 = document.createElement('canvas')
880
+ let w = parseInt(window.getComputedStyle(_canvas).width)
881
+ let h = parseInt(window.getComputedStyle(_canvas).height)
882
+ //将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
883
+ canvas2.width = w * 2
884
+ canvas2.height = h * 2
885
+ canvas2.style.width = w + 'px'
886
+ canvas2.style.height = h + 'px'
887
+ //可以按照自己的需求,对context的参数修改,translate指的是偏移量
888
+ let context = canvas2.getContext('2d')
889
+ context.scale(2, 2)
890
+ return html2canvas(document.querySelector(classs), {
891
+ canvas: canvas2,
892
+ }).then(function (canvas) {
893
+ resolve(canvas)
894
+ })
895
+ })
896
+ return p2
897
+ },
898
+ QRCodeDialogClose() {
899
+ this.QRCodeType = ''
900
+ this.QRCodeDialog = false
901
+ },
902
+ foundQRCode() {
903
+ /*this.QRCodeurl =
904
+ window.context.front +
905
+ "/QRCodeForm/" +
906
+ this.templateKey +
907
+ "/get" +
908
+ "?id=" +
909
+ this.rowId +
910
+ "&token=" +
911
+ this.$store.state.login.currentUser.token;*/
912
+ if (this.QRCodeType == 'add') {
913
+ let isStartFlow = this.templateInfo.defId ? 'true' : 'false'
914
+ this.QRCodeurl =
915
+ this.$requestConfig.mobileUrl +
916
+ '/templateForm/' +
917
+ this.templateKey +
918
+ '/add/?startFlow=' +
919
+ isStartFlow
920
+ if (this.QRCodePattern) {
921
+ let token = this.$store.state.login.currentUser.token
922
+ this.QRCodeurl += '&token=' + token
923
+ }
924
+ } else {
925
+ //不论需不需要登录,访问的都是明细页面
926
+ if (this.QRCodePattern) {
927
+ //免登录
928
+ this.QRCodeurl =
929
+ this.$requestConfig.mobileUrl +
930
+ '/QRCodeForm/' +
931
+ this.templateKey +
932
+ '/get?id=' +
933
+ this.rowId +
934
+ '&token=' +
935
+ this.$store.state.login.currentUser.token
936
+ } else {
937
+ //需要登录
938
+ this.QRCodeurl =
939
+ this.$requestConfig.mobileUrl +
940
+ '/QRCodeForm/' +
941
+ this.templateKey +
942
+ '/get?id=' +
943
+ this.rowId
944
+ }
945
+ }
946
+ // Base64.encode(this.$store.state.login.currentUser.account);
947
+ let msg = document.getElementById('QRCode')
948
+
949
+ this.$qrcode.toCanvas(msg, this.QRCodeurl, function (error) {
950
+ console.log(error)
951
+ })
952
+ this.QRCodeShow = true
953
+ },
954
+ getQRCode(templateId, id, mobileFormAlias, display, index, QRCodePattern) {
955
+ this.QRCodePattern = QRCodePattern
956
+ this.QRCodeDesc = []
957
+ if (!display) {
958
+ display = []
959
+ }
960
+ for (let x = 0; x < display.length; x++) {
961
+ let item = JSON.parse(display[x])
962
+ if (this.rows[index][item.name]) {
963
+ this.QRCodeDesc.push(item.desc + ':' + this.rows[index][item.name])
964
+ }
965
+ }
966
+ this.mobileFormAlias = mobileFormAlias
967
+ this.QRCodeShow = false
968
+ this.QRCodeDialog = true
969
+ this.rowTemplateId = templateId
970
+ this.rowId = id
971
+ },
972
+ handleSizeChange: function (size) {
973
+ //每页下拉显示数据
974
+ this.pagination.pageSize = size
975
+ this.search()
976
+ },
977
+ handleCurrentChange: function (currentPage) {
978
+ //点击第几页
979
+ this.pagination.page = currentPage
980
+ this.search()
981
+ },
982
+ getParam(str) {
983
+ let params = {}
984
+ if (str == 'find') {
985
+ this.pagination.page = 1
986
+ }
987
+
988
+ //判断为合并查询还是分开查询
989
+ if (this.formType) {
990
+ params = this.getQueryFilter()
991
+ } else {
992
+ //判断是否配置了合并查询
993
+ if ($('.search-query').length > 0) {
994
+ params = this.getConditionQuery()
995
+ } else {
996
+ params = this.getQueryFilter()
997
+ }
998
+ }
999
+
1000
+ if (params.pagination && params.pagination && params.pagination.querys) {
1001
+ let tempQueryS = []
1002
+ let betweenConditions = {}
1003
+ params.pagination.querys.forEach((q) => {
1004
+ if (
1005
+ q.value &&
1006
+ (q.operation != 'BETWEEN' || q.value.constructor == Array)
1007
+ ) {
1008
+ tempQueryS.push(q)
1009
+ } else if (q.value) {
1010
+ let conditions = q
1011
+ if (betweenConditions[q.property]) {
1012
+ conditions = betweenConditions[q.property]
1013
+ conditions.value = [conditions.value]
1014
+ conditions.value.push(q.value)
1015
+ }
1016
+ betweenConditions[q.property] = conditions
1017
+ }
1018
+ })
1019
+ for (const key in betweenConditions) {
1020
+ tempQueryS.push(betweenConditions[key])
1021
+ }
1022
+ params.pagination.querys = tempQueryS
1023
+ }
1024
+ return params
1025
+ },
1026
+ //列表数据查询入口
1027
+ search(param, cb) {
1028
+ let params = {}
1029
+ //判断为合并查询还是高级查询
1030
+ let showAdvancedSearch = this.$refs.multipleTemplateTable
1031
+ ? this.$refs.multipleTemplateTable.showAdvancedSearch
1032
+ : false
1033
+ //高级查询
1034
+ if (showAdvancedSearch) {
1035
+ params = this.getQueryFilter()
1036
+ } else {
1037
+ //合并查询
1038
+ params = this.getConditionQuery(param)
1039
+ }
1040
+ if (!params.pagination) {
1041
+ params.pagination = {}
1042
+ }
1043
+ if (!params.pagination.querys) {
1044
+ params.pagination.querys = []
1045
+ }
1046
+ //处理排序字段
1047
+ if (param && param.sorter && param.sorter.length > 0) {
1048
+ let sortField = JSON.parse(this.templateInfo.sortField)
1049
+ params.pagination = params.pagination || {}
1050
+ params.pagination.sorter = []
1051
+ param.sorter.forEach((s) => {
1052
+ let prefix = this.getColPreFix(sortField, s.property)
1053
+ params.pagination.sorter.push({
1054
+ property: prefix + s.property,
1055
+ direction: s.direction,
1056
+ })
1057
+ })
1058
+ } else if (this.templateInfo.sortField) {
1059
+ let sortField = JSON.parse(this.templateInfo.sortField)
1060
+ let sorter = []
1061
+ for (let x = 0; x < sortField.length; x++) {
1062
+ const s = sortField[x]
1063
+ let prefix = this.getColPreFix(sortField, s.name)
1064
+ if (s.joinTableField && s.tableName) {
1065
+ prefix = `${s.tableName}.${prefix}`
1066
+ } else {
1067
+ prefix = `t.${prefix}`
1068
+ }
1069
+ sorter.push({
1070
+ property: prefix + s.name,
1071
+ direction: s.sort,
1072
+ })
1073
+ }
1074
+ params.pagination.sorter = sorter
1075
+ }
1076
+
1077
+ if (params.pagination && params.pagination.querys) {
1078
+ let tempQueryS = []
1079
+ let betweenConditions = {}
1080
+ params.pagination.querys.forEach((q) => {
1081
+ if (
1082
+ q.value &&
1083
+ (q.operation != 'BETWEEN' || q.value.constructor == Array)
1084
+ ) {
1085
+ tempQueryS.push(q)
1086
+ } else if (q.value) {
1087
+ let conditions = q
1088
+ if (betweenConditions[q.property]) {
1089
+ conditions = betweenConditions[q.property]
1090
+ conditions.value = [conditions.value]
1091
+ conditions.value.push(q.value)
1092
+ }
1093
+ betweenConditions[q.property] = conditions
1094
+ }
1095
+ })
1096
+ for (const key in betweenConditions) {
1097
+ tempQueryS.push(betweenConditions[key])
1098
+ }
1099
+ params.pagination.querys = tempQueryS
1100
+ params.pagination.querys = params.pagination.querys
1101
+ ? params.pagination.querys.concat(this.treeQuerys)
1102
+ : this.treeQuerys
1103
+ }
1104
+ //把过滤树的条件也拼接进去
1105
+ if (this.treeQuerys && this.treeQuerys.length > 0) {
1106
+ params.pagination.querys = params.pagination.querys
1107
+ ? params.pagination.querys.concat(this.treeQuerys)
1108
+ : this.treeQuerys
1109
+ }
1110
+ //初始化时,把查询字段和筛选字段的默认值也加进去
1111
+ if (this.isInit) {
1112
+ this.isInit = false
1113
+ this.handleInitQuery(params)
1114
+ }
1115
+ //数据视图控件
1116
+ if (this.dataView) {
1117
+ this.handelBindFiledValua()
1118
+ params.refIdValue = this.dataView.refIdValue
1119
+ //关联查询字段
1120
+ if (this.dataView.selectList && this.dataView.selectList.length > 0) {
1121
+ params.selectList = this.dataView.selectList
1122
+ }
1123
+ }
1124
+ const this_ = this
1125
+ if (this_.isJoinFlow) {
1126
+ params.isJoinFlow = true
1127
+ params.taskType = this_.taskType
1128
+ params.defKey = this_.defKey
1129
+ }
1130
+ if ($.isEmptyObject(this.searchForm)) {
1131
+ this.getBpmTemplateByPagination(params, cb)
1132
+ } else {
1133
+ this.getBpmTemplateByPagination(params, cb)
1134
+ }
1135
+ },
1136
+ handleInitQuery(params) {
1137
+ const conditionFields = JSON.parse(this.templateInfo.conditionField) || []
1138
+ const querys = []
1139
+ conditionFields.forEach((item) => {
1140
+ if (item.defaultValue) {
1141
+ querys.push({
1142
+ property: `${item.colPrefix}${item.name}`,
1143
+ value: item.defaultValue,
1144
+ operation: item.qt.toUpperCase(),
1145
+ relation: 'AND',
1146
+ group: 'defaultQuery',
1147
+ })
1148
+ }
1149
+ })
1150
+ const filteringFields = JSON.parse(this.templateInfo.filteringField) || []
1151
+ filteringFields.forEach((item) => {
1152
+ if (item.defaultValue && item.defaultValue.length) {
1153
+ querys.push({
1154
+ property: `${item.colPrefix}${item.name}`,
1155
+ value: item.defaultValue,
1156
+ operation: 'IN',
1157
+ relation: 'AND',
1158
+ group: 'defaultQuery',
1159
+ })
1160
+ }
1161
+ })
1162
+ if (!querys.length) {
1163
+ return
1164
+ }
1165
+ Array.prototype.push.apply(params.pagination.querys, querys)
1166
+ },
1167
+ getBpmTemplateByPagination(params, cb1, cb2) {
1168
+ const dataTemplateQueryVo = {
1169
+ templateId: params.templateId,
1170
+ queryFilter: params.pagination,
1171
+ }
1172
+ if (params.isJoinFlow && params.taskType && params.defKey) {
1173
+ dataTemplateQueryVo.isJoinFlow = params.isJoinFlow
1174
+ dataTemplateQueryVo.taskType = params.taskType
1175
+ dataTemplateQueryVo.defKey = params.defKey
1176
+ }
1177
+ if (params.selectField) {
1178
+ dataTemplateQueryVo.selectField = params.selectField
1179
+ dataTemplateQueryVo.selectValue = params.selectValue
1180
+ }
1181
+ if (params.selectList) {
1182
+ dataTemplateQueryVo.selectList = params.selectList
1183
+ }
1184
+ dataTemplateQueryVo.refIdValue = params.refIdValue
1185
+ this.curSelectParams = dataTemplateQueryVo
1186
+ this.$requestConfig
1187
+ .getDataTemplateDataList(dataTemplateQueryVo)
1188
+ .then((response) => {
1189
+ this.rows = response.rows
1190
+ this.total = response.total
1191
+ this.$set(this.pagination, 'page', response.page)
1192
+ this.$set(this.pagination, 'pageSize', response.pageSize)
1193
+ this.$set(this.pagination, 'total', response.total)
1194
+ this.$set(this, 'flowBtnPermission', {})
1195
+ })
1196
+ .finally(() => {
1197
+ cb1 && cb1()
1198
+ cb2 && cb2()
1199
+ })
1200
+ },
1201
+ getQueryFilter() {
1202
+ let operationMap = this.getSearchItems()
1203
+ let fieldTypeMap = this.getFieldType()
1204
+
1205
+ let specialMap = this.getSpecialMap()
1206
+ let querys = [] //查询条件
1207
+ let queryFilter = {}
1208
+ let pageBean = { pageBean: this.pagination }
1209
+ let params = { templateId: this.templateInfo.id }
1210
+ params.pagination = pageBean
1211
+ if (!$.isEmptyObject(this.searchForm)) {
1212
+ for (let key in this.searchForm) {
1213
+ if (
1214
+ typeof this.searchForm[key] != 'undefined' &&
1215
+ this.searchForm[key] != '' &&
1216
+ this.searchForm[key] != null
1217
+ ) {
1218
+ if (this.searchForm[key] instanceof Array) {
1219
+ for (let i = 0; i < this.searchForm[key].length; i++) {
1220
+ querys.push({
1221
+ property: key,
1222
+ value: this.searchForm[key][i],
1223
+ group: 'main',
1224
+ operation: operationMap[key],
1225
+ relation: 'AND',
1226
+ })
1227
+ }
1228
+ } else if (this.searchForm[key].includes(',') && !specialMap[key]) {
1229
+ let arr = this.searchForm[key].split(',')
1230
+
1231
+ querys.push({
1232
+ property: key,
1233
+ value: arr,
1234
+ group: 'main',
1235
+ operation: operationMap[key],
1236
+ relation: 'AND',
1237
+ })
1238
+ } else {
1239
+ let value = this.searchForm[key]
1240
+ //整数类型
1241
+ if (fieldTypeMap[key] && fieldTypeMap[key] == 'number') {
1242
+ value = parseFloat(this.searchForm[key])
1243
+ }
1244
+ querys.push({
1245
+ property: key,
1246
+ value: value,
1247
+ group: 'main',
1248
+ operation: operationMap[key],
1249
+ relation: 'AND',
1250
+ })
1251
+ }
1252
+ }
1253
+ }
1254
+ this.clearQueryByGroupName(querys, 'filter')
1255
+ // 将过滤条件添加查询参数数组中
1256
+ this.buildFilterParams(querys)
1257
+ }
1258
+ // 判断table中是否含有filter查询
1259
+ let tableQuerys = this.$refs['multipleTemplateTable'].querys
1260
+ if (tableQuerys && tableQuerys.some((item) => item.group === 'filter')) {
1261
+ Array.prototype.push.apply(
1262
+ querys,
1263
+ tableQuerys
1264
+ .filter((item) => item.group === 'filter')
1265
+ .map((item) => {
1266
+ let obj = { ...item }
1267
+ let colPrefix = ''
1268
+ let displayField = this.displayFields.filter(
1269
+ (field) => field.name === obj.property
1270
+ )[0]
1271
+ displayField && (colPrefix = displayField.colPrefix || '')
1272
+ obj.property = `${colPrefix}${obj.property}`
1273
+ return obj
1274
+ })
1275
+ )
1276
+ }
1277
+ queryFilter = { pageBean: this.pagination, querys }
1278
+ params.pagination = queryFilter
1279
+ return params
1280
+ },
1281
+ //在显示字段、查询字段、排序字段、筛选字段等字段中匹配返回字段的前缀
1282
+ getColPreFix(list, field) {
1283
+ list = list || []
1284
+ const f = list.find((e) => e.name === field) || {}
1285
+ if (!f.colPrefix && this.displayFields) {
1286
+ const _displayField =
1287
+ this.displayFields.find((e) => e.name === field) || {}
1288
+ return _displayField.colPrefix || ''
1289
+ } else {
1290
+ return f.colPrefix
1291
+ }
1292
+ },
1293
+ //构建筛选字段作为查询参数
1294
+ buildFilterParams(querys) {
1295
+ let result = []
1296
+ if (this.filters && Object.keys(this.filters).length > 0) {
1297
+ //管理端配置的筛选条件
1298
+ let filteringField = JSON.parse(
1299
+ this.templateInfo.filteringField || '[]'
1300
+ )
1301
+ Object.keys(this.filters).forEach((k) => {
1302
+ //获取字段的前缀
1303
+ let prefix = this.getColPreFix(filteringField, k)
1304
+
1305
+ const filter = this.filters[k]
1306
+ let q = {
1307
+ property: prefix + k,
1308
+ value: filter[0],
1309
+ group: 'filter',
1310
+ relation: 'AND',
1311
+ }
1312
+ if (filter.length == 1) {
1313
+ q.operation = 'EQUAL'
1314
+ } else if (filter.length > 1) {
1315
+ q.operation = 'IN'
1316
+ q.value = filter
1317
+ }
1318
+ querys && querys.push(q)
1319
+ result.push(q)
1320
+ })
1321
+ }
1322
+ return result
1323
+ },
1324
+ // 通过分组名称清除对应查询条件
1325
+ clearQueryByGroupName(querys, groupName) {
1326
+ // 待删除的查询条件
1327
+ let toDelete = []
1328
+ querys &&
1329
+ querys.forEach((query) => {
1330
+ if (query.group == groupName) {
1331
+ toDelete.push(query)
1332
+ }
1333
+ })
1334
+ toDelete.forEach((d) => {
1335
+ querys.remove(d)
1336
+ })
1337
+ },
1338
+ handleSortChange() {
1339
+ console.warn(
1340
+ '当前排序方法handleSortChange已经弃用,请重新保存该表单列表。'
1341
+ )
1342
+ },
1343
+ handleFilterChange(m) {
1344
+ this.filters = { ...this.filters, ...m }
1345
+ Object.keys(this.filters).forEach((k) => {
1346
+ if (!this.filters[k] || this.filters[k].length == 0) {
1347
+ delete this.filters[k]
1348
+ }
1349
+ })
1350
+ this.search()
1351
+ },
1352
+ getSearchItems() {
1353
+ let searchItems = $('.search-item')
1354
+ let operationMap = {}
1355
+ let operationType = {
1356
+ like: 'LIKE',
1357
+ equal: 'EQUAL',
1358
+ between: 'BETWEEN',
1359
+ left_like: 'LEFT_LIKE',
1360
+ right_like: 'RIGHT_LIKE',
1361
+ }
1362
+ if (searchItems) {
1363
+ for (let i = 0; i < searchItems.length; i++) {
1364
+ let operation = '='
1365
+ if (typeof $(searchItems[i]).attr('cl-query') != 'undefined') {
1366
+ operation = $(searchItems[i]).attr('operation')
1367
+ operationMap[$(searchItems[i]).attr('cl-query')] =
1368
+ typeof operationType[operation] != 'undefined'
1369
+ ? operationType[operation]
1370
+ : operation
1371
+ } else if (
1372
+ typeof $(searchItems[i]).children().attr('cl-query') != 'undefined'
1373
+ ) {
1374
+ operation = $(searchItems[i]).children().attr('operation')
1375
+ operationMap[$(searchItems[i]).children().attr('cl-query')] =
1376
+ typeof operationType[operation] != 'undefined'
1377
+ ? operationType[operation]
1378
+ : operation
1379
+ }
1380
+ }
1381
+ }
1382
+ return operationMap
1383
+ },
1384
+ getFieldType() {
1385
+ let searchItems = $('.search-item')
1386
+ let operationMap = {}
1387
+ let operationType = {
1388
+ number: 'number',
1389
+ text: 'text',
1390
+ }
1391
+ if (searchItems) {
1392
+ for (let i = 0; i < searchItems.length; i++) {
1393
+ let operation = '='
1394
+ if (typeof $(searchItems[i]).attr('cl-query') != 'undefined') {
1395
+ operation = $(searchItems[i]).attr('type')
1396
+ operationMap[$(searchItems[i]).attr('cl-query')] =
1397
+ typeof operationType[operation] != 'undefined'
1398
+ ? operationType[operation]
1399
+ : operation
1400
+ } else if (
1401
+ typeof $(searchItems[i]).children().attr('cl-query') != 'undefined'
1402
+ ) {
1403
+ operation = $(searchItems[i]).children().attr('type')
1404
+ operationMap[$(searchItems[i]).children().attr('cl-query')] =
1405
+ typeof operationType[operation] != 'undefined'
1406
+ ? operationType[operation]
1407
+ : operation
1408
+ }
1409
+ }
1410
+ }
1411
+ return operationMap
1412
+ },
1413
+ //获取特殊查询情况(自定义对话框)
1414
+ getSpecialMap() {
1415
+ let searchItems = $('.search-item')
1416
+ let fieldQueryMap = {} //查询条件字段
1417
+
1418
+ if (searchItems) {
1419
+ for (var i = 0; i < searchItems.length; i++) {
1420
+ if (typeof $(searchItems[i]).attr('cl-query') != 'undefined') {
1421
+ //查询条件字段
1422
+ fieldQueryMap[$(searchItems[i]).attr('cl-query')] =
1423
+ typeof $(searchItems[i]).attr('special-query') != 'undefined'
1424
+ ? true
1425
+ : false
1426
+ } else if (
1427
+ typeof $(searchItems[i]).children().attr('cl-query') != 'undefined'
1428
+ ) {
1429
+ //查询条件字段
1430
+ fieldQueryMap[$(searchItems[i]).children().attr('cl-query')] =
1431
+ typeof $(searchItems[i]).children().attr('special-query') !=
1432
+ 'undefined'
1433
+ ? true
1434
+ : false
1435
+ }
1436
+ }
1437
+ }
1438
+ return fieldQueryMap
1439
+ },
1440
+ //合并查询条件
1441
+ getConditionQuery(param) {
1442
+ let querys = [] //查询条件
1443
+ let queryFilter = {}
1444
+ let pageBean = { pageBean: this.pagination }
1445
+ let params = { templateId: this.templateInfo.id }
1446
+ params.pagination = pageBean
1447
+
1448
+ // 将过滤条件添加查询参数数组中
1449
+ this.buildFilterParams(querys)
1450
+
1451
+ if (param && param.querys) {
1452
+ let temquerys = [...param.querys]
1453
+ let conditionField = utils.parseToJson(this.templateInfo.conditionField)
1454
+ temquerys.forEach((q) => {
1455
+ let prefix = this.getColPreFix(conditionField, q.property)
1456
+ q.property = prefix + q.property
1457
+ querys.push(q)
1458
+ })
1459
+ }
1460
+
1461
+ if (this.parameterqQuerys) {
1462
+ let parameterQuerys = JSON.parse(Base64.decode(this.parameterqQuerys))
1463
+ if (parameterQuerys && parameterQuerys.length > 0) {
1464
+ parameterQuerys.forEach((query) => {
1465
+ let prefix = this.templateInfo.isExternal === 1 ? '' : 'F_'
1466
+ query.property = prefix + query.property
1467
+ this.$set(this.searchForm, query.property, query.value)
1468
+ querys.push(query)
1469
+ })
1470
+ }
1471
+ }
1472
+
1473
+ queryFilter = { pageBean: this.pagination, querys }
1474
+ params.pagination = queryFilter
1475
+ return params
1476
+ },
1477
+ //打开高级检索
1478
+ advanced() {
1479
+ this.formType = !this.formType
1480
+ if (this.formType) {
1481
+ this.incons = 'el-icon-arrow-up'
1482
+ this.queryForm.queryData = ''
1483
+ } else {
1484
+ this.incons = 'el-icon-arrow-down'
1485
+ this.searchForm = {}
1486
+ }
1487
+ },
1488
+ //回车查询
1489
+ searchEnterFun: function (e) {
1490
+ let keyCode = window.event ? e.keyCode : e.which
1491
+ if (keyCode == 13) {
1492
+ this.search()
1493
+ }
1494
+ },
1495
+ reset(flag) {
1496
+ this.queryForm.queryData = ''
1497
+ if (this.templateInfo.conditionField) {
1498
+ let conditionField = utils.parseToJson(this.templateInfo.conditionField)
1499
+ for (let i = 0; i < conditionField.length; i++) {
1500
+ let fieldName = conditionField[i].colPrefix + conditionField[i].name
1501
+ this.$set(this.searchForm, fieldName, '')
1502
+ this.$set(this.searchForm, conditionField[i].name, '')
1503
+ }
1504
+ }
1505
+ this.filters = {}
1506
+ this.$refs.multipleTemplateTable.clearFilter &&
1507
+ this.$refs.multipleTemplateTable.clearFilter()
1508
+ if (!flag) {
1509
+ this.search()
1510
+ }
1511
+ },
1512
+ handleSelectionChange(val) {
1513
+ this.tableData.selectRows = val
1514
+ },
1515
+ deleted() {
1516
+ if (
1517
+ this.tableData.selectRows == null ||
1518
+ this.tableData.selectRows.length == 0
1519
+ ) {
1520
+ this.$message.warning('请选择要删除的数据!')
1521
+ return false
1522
+ }
1523
+ this.$confirm('此操作将删除该文件, 是否继续?', '提示', {
1524
+ confirmButtonText: '确定',
1525
+ cancelButtonText: '取消',
1526
+ type: 'warning',
1527
+ })
1528
+ .then(() => {
1529
+ let s = []
1530
+ for (let i = 0; i < this.tableData.selectRows.length; i++) {
1531
+ s.push(this.tableData.selectRows[i][this.templateInfo.pkField])
1532
+ }
1533
+ let data = {
1534
+ ids: s.join(','),
1535
+ boAlias: this.templateInfo.boDefAlias,
1536
+ }
1537
+ this.$requestConfig.deleteTemplateDataById(data).then((resp) => {
1538
+ if (resp.state) {
1539
+ this.$message.success(resp.message)
1540
+ this.pagination.page = 1
1541
+ this.search()
1542
+ } else {
1543
+ this.$message.error(resp.message)
1544
+ }
1545
+ })
1546
+ })
1547
+ .catch(() => {
1548
+ this.$message({
1549
+ type: 'info',
1550
+ message: '已取消删除',
1551
+ })
1552
+ })
1553
+ },
1554
+ del(id) {
1555
+ this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
1556
+ confirmButtonText: '确定',
1557
+ cancelButtonText: '取消',
1558
+ type: 'warning',
1559
+ })
1560
+ .then(() => {
1561
+ let data = { ids: id, boAlias: this.templateInfo.boDefAlias }
1562
+ this.$requestConfig.deleteTemplateDataById(data).then((resp) => {
1563
+ if (resp.state) {
1564
+ this.$message.success(resp.message)
1565
+ this.pagination.page = 1
1566
+ this.search()
1567
+ } else {
1568
+ this.$message.error(resp.message)
1569
+ }
1570
+ })
1571
+ })
1572
+ .catch(() => {
1573
+ this.$message({
1574
+ type: 'info',
1575
+ message: '已取消删除',
1576
+ })
1577
+ })
1578
+ },
1579
+ operating(
1580
+ templateId,
1581
+ id,
1582
+ action,
1583
+ defId,
1584
+ isStartFlow,
1585
+ openType,
1586
+ quitAfterSaving
1587
+ ) {
1588
+ //isStartFlow (false:可以发起流程,true:不可以发起流程)
1589
+ if (this.templateInfo.manageField && !isStartFlow) {
1590
+ //先配置不能发起流程
1591
+ if (action == 'add' && isStartFlow == '') {
1592
+ isStartFlow = true
1593
+ }
1594
+ if (action == 'edit' && isStartFlow === false) {
1595
+ isStartFlow = true
1596
+ }
1597
+ //再判断是否可以发起流程
1598
+ let manageField = JSON.parse(this.templateInfo.manageField)
1599
+ //判断是否配置了发起流程按钮
1600
+ for (let k = 0; k < manageField.length; k++) {
1601
+ if (action == 'add' && manageField[k].name == 'startFlow') {
1602
+ isStartFlow = false
1603
+ break
1604
+ } else if (action == 'edit' && manageField[k].name == 'startFlow') {
1605
+ isStartFlow = false
1606
+ break
1607
+ }
1608
+ }
1609
+ }
1610
+ if (!templateId) {
1611
+ templateId = this.templateInfo.id
1612
+ action = action == 'select' ? 'get' : 'add'
1613
+ }
1614
+ //数据视图随机添加到其他菜单下面时获取当前菜单的别名 并且当前数据视图不是表单里的数据视图 dataView
1615
+ if (
1616
+ sessionStorage.menu_alias &&
1617
+ !this.dataView &&
1618
+ !this.ignoredAlias.includes(sessionStorage.menu_alias)
1619
+ ) {
1620
+ this.alias_new = sessionStorage.menu_alias
1621
+ }
1622
+ var url = '/templateForm/' + this.templateKey + '/' + action
1623
+ if (this.isJoinFlow) {
1624
+ this.alias_new = 'statement'
1625
+ }
1626
+ if (this.single == 'true') {
1627
+ // url = '/templateForm/' + this.templateKey + '/' + action + '/true'
1628
+ }
1629
+ //判断数据视图控件
1630
+ let isDataView = false
1631
+ if (this.dataView) {
1632
+ if (this.dataView.boDefAlias && this.dataView.boDefAlias != '') {
1633
+ isDataView = true
1634
+ }
1635
+ }
1636
+
1637
+ if (openType == 'new' || this.isJoinFlow || isDataView) {
1638
+ url += '/new'
1639
+ }
1640
+
1641
+ if (id) {
1642
+ url = url + '?id=' + id + '&'
1643
+ } else {
1644
+ url += '?'
1645
+ }
1646
+ let startFlowStr = 'startFlow=false'
1647
+ if (action == 'add' && defId && isStartFlow === false) {
1648
+ startFlowStr = 'startFlow=true'
1649
+ } else if (id && isStartFlow === false && defId) {
1650
+ startFlowStr = 'startFlow=true'
1651
+ }
1652
+ let dataUrl = ''
1653
+ if (this.dataView) {
1654
+ if (this.dataView.bindList && this.dataView.bindList.length > 0) {
1655
+ let bindList = []
1656
+ for (var i = 0; i < this.dataView.bindList.length; i++) {
1657
+ let item = {
1658
+ key: this.dataView.bindList[i].bindFilld,
1659
+ value: this.dataView.bindList[i].fillValue,
1660
+ }
1661
+ bindList.push(item)
1662
+ }
1663
+ dataUrl =
1664
+ '&bindList=' +
1665
+ encodeURIComponent(Base64.encode(JSON.stringify(bindList)))
1666
+ }
1667
+ }
1668
+ let path = url + startFlowStr
1669
+ if (dataUrl != '') {
1670
+ path = url + startFlowStr + dataUrl
1671
+ }
1672
+ //TODO 如果是模块开发 全部已新窗口打开
1673
+ if (openType == 'new' || this.isJoinFlow || isDataView) {
1674
+ window.open(
1675
+ this.$router.resolve(path + '&isNewPage=true').href,
1676
+ '_blank'
1677
+ )
1678
+ } else if (openType === 'dialog') {
1679
+ this.dialogWidth = 1580 + 'px'
1680
+ this.$refs.templateFormDialog.showDialog({
1681
+ templateKey: this.templateInfo.alias,
1682
+ action,
1683
+ dialogParam: { id },
1684
+ dialogWidth: this.dialogWidth,
1685
+ dialogHeight: this.dialogHeight,
1686
+ quitAfterSaving,
1687
+ })
1688
+ // this.dataViewDialogVisible = true
1689
+ // this.$refs.dataViewDialog.$el.firstChild.style.height = 740 + 'px'
1690
+ // this.srcUrl = path.replace(this.alias_new, 'statement')
1691
+ } else {
1692
+ // if (path.indexOf('othermenu') != -1) {
1693
+ // path = path.replace('/othermenu', '/statement')
1694
+ // }
1695
+ this.$router.push({
1696
+ path,
1697
+ query: { quitAfterSaving },
1698
+ })
1699
+ }
1700
+ },
1701
+ //url按钮的点击
1702
+ urlBtnClick(url, urlParamsStr, row) {
1703
+ if (urlParamsStr) {
1704
+ let urlParams = JSON.parse(Base64.decode(urlParamsStr) || '[]')
1705
+ urlParams.forEach((item, i) => {
1706
+ if (i === 0) {
1707
+ url += '?' + item.name + '=' + (row[item.field] || '')
1708
+ } else {
1709
+ url += '&' + item.name + '=' + (row[item.field] || '')
1710
+ }
1711
+ })
1712
+ window.open(url, '_blank')
1713
+ }
1714
+ },
1715
+ openUrl(url, type, row, fieldName) {
1716
+ if (row && fieldName) {
1717
+ url = this.handledUrlParams(url, row, fieldName)
1718
+ }
1719
+ if (type == 'new') {
1720
+ window.open(url, '_blank')
1721
+ } else {
1722
+ window.location.href = url
1723
+ }
1724
+ },
1725
+ handledUrlParams(url, row, fieldName) {
1726
+ if (this.templateInfo.displayField) {
1727
+ let displayFields = JSON.parse(this.templateInfo.displayField)
1728
+ displayFields.forEach((display) => {
1729
+ if (display.name == fieldName) {
1730
+ if (display.urlParams && display.urlParams.length > 0) {
1731
+ let urlParams = display.urlParams
1732
+ let suffix = ''
1733
+ urlParams.forEach((param) => {
1734
+ if (suffix) {
1735
+ suffix += '&'
1736
+ }
1737
+ suffix = suffix + param.name + '=' + row[param.field]
1738
+ })
1739
+ if (suffix) {
1740
+ if (url.indexOf('?') != -1) {
1741
+ url = url + '&' + suffix
1742
+ } else {
1743
+ url = url + '?' + suffix
1744
+ }
1745
+ return url
1746
+ }
1747
+ }
1748
+ return url
1749
+ }
1750
+ })
1751
+ }
1752
+ return url
1753
+ },
1754
+ viewReport(data, jsonStr, openType) {
1755
+ let item = JSON.parse(Base64.decode(jsonStr))
1756
+ let conditionField = item.conditionField
1757
+ let querys = []
1758
+ // 构建查询参数
1759
+ if (conditionField && conditionField.length > 0) {
1760
+ conditionField.forEach((obj) => {
1761
+ if (obj.parameter) {
1762
+ querys.push({
1763
+ property: obj.key,
1764
+ value: data[obj.parameter],
1765
+ group: 'main',
1766
+ operation: obj.qt,
1767
+ relation: 'AND',
1768
+ })
1769
+ }
1770
+ })
1771
+ }
1772
+
1773
+ if (!this.$requestConfig.viewReportURLHandler) {
1774
+ console.error(
1775
+ 'sword.js中没有提供viewReportURLHandler方法来构建页面访问地址.'
1776
+ )
1777
+ return
1778
+ }
1779
+ const appendQuerys =
1780
+ querys.length > 0
1781
+ ? encodeURIComponent(Base64.encode(JSON.stringify(querys)))
1782
+ : ''
1783
+ this.$requestConfig
1784
+ .viewReportURLHandler({ item, querys })
1785
+ .then((url) => {
1786
+ if (!url) {
1787
+ console.error(
1788
+ `未获取到${item.alias}对应的菜单页面,请确认是否已发布为前端资源。`
1789
+ )
1790
+ return
1791
+ }
1792
+ if (appendQuerys) {
1793
+ //TODO 构建初始查询参数
1794
+ // url = `${url}?${appendQuerys}`
1795
+ }
1796
+ if (openType == 'new') {
1797
+ window.open(this.$router.resolve(url).href, '_blank')
1798
+ } else {
1799
+ this.$router.push(url)
1800
+ }
1801
+ })
1802
+ .catch((err) => {
1803
+ console.error(`页面跳转失败,${err}`)
1804
+ })
1805
+ },
1806
+ toStartFlow() {
1807
+ // if(this.checkSelect()){
1808
+ // let row = this.tableData.selectRows[0];
1809
+ // if(!row.isStartFlow){
1810
+ // this.startFlow(defId);
1811
+ // }else{
1812
+ // this.$message({
1813
+ // message: '该条数据已发起流程,不能再发起!',
1814
+ // type: 'warning',
1815
+ // })
1816
+ // }
1817
+ // }
1818
+ },
1819
+ startFlow(id) {
1820
+ let data = {
1821
+ defKey: this.templateInfo.defId,
1822
+ businessKey: id,
1823
+ boAlias: this.templateInfo.boDefAlias,
1824
+ }
1825
+ let loadingInstance = Loading.service({ fullscreen: true }) //开始
1826
+ this.$requestConfig.startForm(data).then((result) => {
1827
+ loadingInstance.close() // 结束
1828
+ if (result.state) {
1829
+ this.$message.success(result.message)
1830
+ this.search()
1831
+ } else {
1832
+ this.disabled = false
1833
+ }
1834
+ })
1835
+ },
1836
+ //点击导出按钮
1837
+ exports() {
1838
+ this.curSelectParams.queryFilter = this.curSelectParams.pagination
1839
+ if (!this.curSelectParams.queryFilter) {
1840
+ this.curSelectParams.queryFilter = {
1841
+ pageBean: this.pagination,
1842
+ }
1843
+ }
1844
+ if (!this.curSelectParams.queryFilter.querys) {
1845
+ this.curSelectParams.queryFilter.querys = []
1846
+ }
1847
+ if (this.treeQuerys) {
1848
+ this.treeQuerys.forEach((item) => {
1849
+ this.curSelectParams.queryFilter.querys.push(item)
1850
+ })
1851
+ }
1852
+ this.$requestConfig
1853
+ .exportByBtnSetting({
1854
+ id: this.templateInfo.id,
1855
+ params: this.curSelectParams,
1856
+ })
1857
+ .then(({ data, headers }) => {
1858
+ const fileName = decodeURIComponent(
1859
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
1860
+ )
1861
+ const blob = new Blob([data])
1862
+ saveAs(blob, fileName)
1863
+ })
1864
+ },
1865
+ importCommand(params) {
1866
+ switch (params.command) {
1867
+ case 'downloadTempFile':
1868
+ this.downloadMainTempFile()
1869
+ break
1870
+ case 'importMain':
1871
+ this.importMain()
1872
+ break
1873
+ case 'log':
1874
+ this.openLog()
1875
+ break
1876
+ case 'showImportResult':
1877
+ this.$refs['importResult'].showDialog(this.importCacheKey)
1878
+ break
1879
+ default:
1880
+ break
1881
+ }
1882
+ },
1883
+ openLog() {
1884
+ this.dialogVisible = true
1885
+ },
1886
+ downloadMainTempFile() {
1887
+ let customTemplateId = ''
1888
+ if (this.templateInfo && this.templateInfo.manageField) {
1889
+ let manageFieldList = JSON.parse(this.templateInfo.manageField)
1890
+ for (let index = 0; index < manageFieldList.length; index++) {
1891
+ let manage = manageFieldList[index]
1892
+ if (manage.name == 'import') {
1893
+ if (manage.importTemplate && manage.importTemplate.length > 0) {
1894
+ customTemplateId = manage.importTemplate[0].id
1895
+ }
1896
+ break
1897
+ }
1898
+ }
1899
+ }
1900
+
1901
+ if (customTemplateId) {
1902
+ this.$requestConfig
1903
+ .download(customTemplateId)
1904
+ .then(({ data, headers }) => {
1905
+ const fileName = decodeURIComponent(
1906
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
1907
+ )
1908
+ const blob = new Blob([data], {
1909
+ type: 'application/pdf',
1910
+ })
1911
+ saveAs(blob, fileName)
1912
+ })
1913
+ } else {
1914
+ let loadingInstance = Loading.service({ fullscreen: true }) //开始
1915
+ this.$requestConfig
1916
+ .downloadTempFile(this.templateInfo.alias)
1917
+ .then(({ data, headers }) => {
1918
+ const fileName = decodeURIComponent(
1919
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
1920
+ )
1921
+ const blob = new Blob([data])
1922
+ saveAs(blob, fileName)
1923
+ loadingInstance.close() // 结束
1924
+ })
1925
+ .catch((e) => {
1926
+ console.error(e)
1927
+ loadingInstance.close()
1928
+ })
1929
+ }
1930
+ },
1931
+
1932
+ importMain(param) {
1933
+ let formData = new FormData()
1934
+ formData.append('file', param.file)
1935
+
1936
+ let params = {
1937
+ data: formData,
1938
+ alias: this.templateInfo.alias,
1939
+ }
1940
+
1941
+ if (this.dataView) {
1942
+ this.handelBindFiledValua()
1943
+ params.bindFilld = this.dataView.bindFilld || ''
1944
+ params.fillValue = this.dataView.fillValue || ''
1945
+ params.refIdValue = this.dataView.refIdValue
1946
+ }
1947
+
1948
+ let loadingInstance = Loading.service({ fullscreen: true }) //开始
1949
+
1950
+ this.$requestConfig
1951
+ .dataTemplateMainImport(params)
1952
+ .then((data) => {
1953
+ if (data && data.state) {
1954
+ //导入成功之后重新渲染当前组件
1955
+ // this.$parent.refreshTime = new Date().getTime()
1956
+ // this.$message({ type: 'success', message: data.message })
1957
+ // param.onSuccess()
1958
+ // if (sessionStorage.getItem('formImportTempRefId')) {
1959
+ // let json = JSON.parse(data.value)
1960
+ // json.boAlias = this.dataView.boDefAlias
1961
+ // let oldConf = sessionStorage.getItem('formImportTempJson')
1962
+ // if (!oldConf) {
1963
+ // sessionStorage.setItem(
1964
+ // 'formImportTempJson',
1965
+ // JSON.stringify([json])
1966
+ // )
1967
+ // } else {
1968
+ // let oldJosn = JSON.parse(oldConf)
1969
+ // let isInOldJosn = false
1970
+ // for (let index = 0; index < oldJosn.length; index++) {
1971
+ // const old = oldJosn[index]
1972
+ // if (
1973
+ // old.tabName == json.tabName &&
1974
+ // old.bindFilld == json.bindFilld
1975
+ // ) {
1976
+ // isInOldJosn = true
1977
+ // break
1978
+ // }
1979
+ // }
1980
+ // if (!isInOldJosn) {
1981
+ // oldJosn.push(json)
1982
+ // }
1983
+ // sessionStorage.setItem(
1984
+ // 'formImportTempJson',
1985
+ // JSON.stringify(oldJosn)
1986
+ // )
1987
+ // }
1988
+ // }
1989
+ // this.search()
1990
+ param.onSuccess()
1991
+ this.importCacheKey = data.value
1992
+ this.$refs['importResult'].showDialog(data.value)
1993
+ } else {
1994
+ param.onError()
1995
+ }
1996
+ })
1997
+ .catch((error) => {
1998
+ let msg =
1999
+ (error.response &&
2000
+ error.response.data &&
2001
+ error.response.data.message) ||
2002
+ '导入失败!'
2003
+ this.$message.error(msg)
2004
+ })
2005
+ .finally(() => {
2006
+ loadingInstance.close()
2007
+ })
2008
+ },
2009
+ afterImportSave() {
2010
+ this.importCacheKey = ''
2011
+ this.search()
2012
+ },
2013
+ //显示子表对话框
2014
+ showSubList(refId) {
2015
+ this.refId = refId
2016
+ this.getSubEntsByFormKey(refId)
2017
+ },
2018
+ addFlow(manageFlowFormData, row) {
2019
+ let flowFormData = JSON.parse(Base64.decode(manageFlowFormData))
2020
+
2021
+ if (!row) {
2022
+ if (this.checkSelect()) {
2023
+ row = this.tableData.selectRows[0]
2024
+ }
2025
+ }
2026
+
2027
+ if (!row) {
2028
+ return
2029
+ }
2030
+
2031
+ if (flowFormData.paramFields && flowFormData.paramFields.length > 0) {
2032
+ var data = {}
2033
+ flowFormData.paramFields.forEach((obj) => {
2034
+ data[obj.targetField] = row[obj.sourceField]
2035
+ })
2036
+ }
2037
+
2038
+ let param = {
2039
+ bizType: 'startFlow',
2040
+ openType: flowFormData.openType,
2041
+ parameters: {
2042
+ defId: flowFormData.flow.id,
2043
+ data: encodeURIComponent(Base64.encode(JSON.stringify(data))),
2044
+ },
2045
+ }
2046
+
2047
+ this.$requestConfig.openUrl(param)
2048
+ },
2049
+ addData(manageFlowFormData, row) {
2050
+ let flowFormData = JSON.parse(Base64.decode(manageFlowFormData))
2051
+
2052
+ if (!row) {
2053
+ if (this.checkSelect()) {
2054
+ row = this.tableData.selectRows[0]
2055
+ }
2056
+ }
2057
+ if (!row) {
2058
+ return
2059
+ }
2060
+ //
2061
+ if (flowFormData.paramFields && flowFormData.paramFields.length > 0) {
2062
+ var data = {}
2063
+ flowFormData.paramFields.forEach((obj) => {
2064
+ data[obj.targetField] = row[obj.sourceField]
2065
+ })
2066
+ }
2067
+
2068
+ let param = {
2069
+ bizType: 'addData',
2070
+ openType: flowFormData.openType,
2071
+ parameters: {
2072
+ previewTemplateAlias: flowFormData.report.key,
2073
+ data: encodeURIComponent(Base64.encode(JSON.stringify(data))),
2074
+ },
2075
+ }
2076
+
2077
+ this.$requestConfig.openUrl(param)
2078
+ },
2079
+ searchData(manageFlowFormData, row) {
2080
+ let flowFormData = JSON.parse(Base64.decode(manageFlowFormData))
2081
+
2082
+ if (!row) {
2083
+ if (this.checkSelect()) {
2084
+ row = this.tableData.selectRows[0]
2085
+ }
2086
+ }
2087
+ if (!row) {
2088
+ return
2089
+ }
2090
+
2091
+ let querys = []
2092
+ if (flowFormData.paramFields && flowFormData.paramFields.length > 0) {
2093
+ flowFormData.paramFields.forEach((obj) => {
2094
+ querys.push({
2095
+ property: obj.targetField,
2096
+ value: row[obj.sourceField],
2097
+ group: 'main',
2098
+ operation: 'EQUAL',
2099
+ relation: 'AND',
2100
+ })
2101
+ })
2102
+ }
2103
+
2104
+ let param = {
2105
+ bizType: 'searchData',
2106
+ openType: flowFormData.openType || 'new',
2107
+ parameters: {
2108
+ previewTemplateAlias: flowFormData.report.key,
2109
+ data: encodeURIComponent(Base64.encode(JSON.stringify(querys))),
2110
+ },
2111
+ }
2112
+
2113
+ this.$requestConfig.openUrl(param)
2114
+ },
2115
+ //显示修改记录
2116
+ openRecordList(refId) {
2117
+ this.dialogRecordVisible = true
2118
+ this.recordRefId = refId
2119
+ let param = {
2120
+ pageBean: { page: 1, pageSize: 10, showTotal: true },
2121
+ sorter: [{ direction: 'ASC', property: 'modifyTime' }],
2122
+ querys: [
2123
+ {
2124
+ property: 'ref_id_',
2125
+ value: this.recordRefId,
2126
+ group: 'main',
2127
+ operation: 'EQUAL',
2128
+ relation: 'AND',
2129
+ },
2130
+ ],
2131
+ }
2132
+ this.recordTableLoading = true
2133
+ this.$requestConfig.boDataModifyRecord(param).then((resp) => {
2134
+ this.recordTableLoading = false
2135
+ this.recordList = resp.rows
2136
+ this.modifyRecord.pagination.pageBean = {
2137
+ pageSize: resp.pageSize,
2138
+ page: resp.page,
2139
+ total: resp.total,
2140
+ }
2141
+ })
2142
+ },
2143
+ handleRecordCurrentChange(index, modifyRecord) {
2144
+ modifyRecord.pagination.pageBean.page = index
2145
+ let param = {
2146
+ pageBean: modifyRecord.pagination.pageBean,
2147
+ sorter: [{ direction: 'ASC', property: 'modifyTime' }],
2148
+ querys: [
2149
+ {
2150
+ property: 'ref_id_',
2151
+ value: this.recordRefId,
2152
+ group: 'main',
2153
+ operation: 'EQUAL',
2154
+ relation: 'AND',
2155
+ },
2156
+ ],
2157
+ }
2158
+ this.recordTableLoading = true
2159
+ this.$requestConfig.boDataModifyRecord(param).then((resp) => {
2160
+ this.recordTableLoading = false
2161
+ this.recordList = resp.rows
2162
+ this.modifyRecord.pagination.pageBean = {
2163
+ pageSize: resp.pageSize,
2164
+ page: resp.page,
2165
+ total: resp.total,
2166
+ }
2167
+ })
2168
+ },
2169
+ //取消修改记录对话框
2170
+ recordCancel() {
2171
+ this.dialogRecordVisible = false
2172
+ this.recordList = []
2173
+ this.recordRefId = ''
2174
+ this.modifyRecord = {
2175
+ pagination: {
2176
+ pageBean: {
2177
+ page: 1,
2178
+ pageSize: 10,
2179
+ total: 0,
2180
+ },
2181
+ },
2182
+ }
2183
+ },
2184
+ //
2185
+ openModifyDetail(row) {
2186
+ this.currentModify = row
2187
+ this.modifyDetailDialogVisible = true
2188
+ },
2189
+ //查看修改记录详情
2190
+ showModifyRecord(id, refId) {
2191
+ var url =
2192
+ '/templateForm/' +
2193
+ this.templateKey +
2194
+ '/get?single=true' +
2195
+ '&id=' +
2196
+ refId +
2197
+ '&startFlow=false&recordId=' +
2198
+ id +
2199
+ '&isNewPage=true'
2200
+ window.open(this.$router.resolve(url).href, '_blank')
2201
+ //this.$router.push(url)
2202
+ },
2203
+ //确定导出
2204
+ submitExport() {
2205
+ if (!this.exportData || this.exportData.expField.length < 1) {
2206
+ this.$message({
2207
+ type: 'info',
2208
+ message: '请选择要导出的字段!',
2209
+ })
2210
+ return
2211
+ }
2212
+
2213
+ if (this.exportType === 'main') this.exportMain()
2214
+ else
2215
+ this.exportSubData(
2216
+ this.exportData.expField,
2217
+ this.refId,
2218
+ this.currentTab.entName
2219
+ )
2220
+ },
2221
+ exportMain() {
2222
+ let expField = ''
2223
+ for (let i = 0; i < this.exportData.expField.length; i++) {
2224
+ if (i > 0) {
2225
+ expField += ','
2226
+ }
2227
+ expField += this.exportData.expField[i].name
2228
+ }
2229
+ expField = Base64.encode(expField)
2230
+
2231
+ let data = {
2232
+ boAlias: this.templateInfo.alias,
2233
+ getType: this.exportData.getType,
2234
+ expField: expField,
2235
+ filterKey: '',
2236
+ }
2237
+ //data.query = this.getQueryFilter().pagination
2238
+ data.query = this.getParam().pagination
2239
+
2240
+ if (this.dataView && this.dataView.bindSelectd) {
2241
+ data.query.querys.push({
2242
+ value: this.dataView.selectValue,
2243
+ operation: 'EQUAL',
2244
+ property: 'F_' + this.dataView.bindSelectd,
2245
+ })
2246
+ }
2247
+ let loadingInstance = Loading.service({ fullscreen: true }) //开始
2248
+ this.$requestConfig.templateExport(data).then(({ data, headers }) => {
2249
+ const fileName = decodeURIComponent(
2250
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
2251
+ )
2252
+ const blob = new Blob([data])
2253
+ saveAs(blob, fileName)
2254
+ loadingInstance.close() // 结束
2255
+ this.dialogExportVisible = false
2256
+ })
2257
+ for (let i = 0; i < this.subDisplayFieldsList.length; i++) {
2258
+ this.exportSubData(
2259
+ this.$refs['subExportTable'][i].selection,
2260
+ '',
2261
+ this.subDisplayFieldsList[i].name
2262
+ )
2263
+ this.$set(this.$refs['subExportTable'][i], 'selection', [])
2264
+ }
2265
+ },
2266
+ exportSubData(expFields, refId, alias) {
2267
+ let expField = []
2268
+ for (let i = 0; i < expFields.length; i++) {
2269
+ expField.push({
2270
+ key: expFields[i].name,
2271
+ value: expFields[i].desc,
2272
+ })
2273
+ }
2274
+ let data = {
2275
+ alias: alias,
2276
+ refId: refId,
2277
+ type: this.exportData.getType,
2278
+ expField: JSON.stringify(expField),
2279
+ filterKey: '',
2280
+ }
2281
+ data.queryFilter = this.currentTab.pagination
2282
+ let loadingInstance = Loading.service({ fullscreen: true })
2283
+ this.$requestConfig
2284
+ .dataTemplateSubExport(data)
2285
+ .then(({ data, headers }) => {
2286
+ const fileName = decodeURIComponent(
2287
+ headers['content-disposition'].split(';')[1].split('filename=')[1]
2288
+ )
2289
+ const blob = new Blob([data])
2290
+ saveAs(blob, fileName)
2291
+ loadingInstance.close()
2292
+ this.dialogExportVisible = false
2293
+ })
2294
+ .catch((e) => {
2295
+ console.error(e)
2296
+ loadingInstance.close()
2297
+ })
2298
+ },
2299
+ //取消导出
2300
+ exportCancel() {
2301
+ this.dialogExportVisible = false
2302
+ this.exportData.expField = []
2303
+ },
2304
+ //取消子表对话框
2305
+ subCancel() {
2306
+ this.dialogSubVisible = false
2307
+ this.tabs = []
2308
+ this.ents = []
2309
+ },
2310
+ sunCancel() {
2311
+ this.dialogSunVisible = false
2312
+ this.sunTabs = []
2313
+ },
2314
+ handleExportSelectionChange(val) {
2315
+ this.exportData.expField = []
2316
+ if (val) {
2317
+ this.exportData.expField = val
2318
+ }
2319
+ },
2320
+ //全选
2321
+ handleExportSelectAll() {
2322
+ this.exportData.expField = this.displayFields
2323
+ },
2324
+ //排序
2325
+ sort(index, type) {
2326
+ if ('up' == type) {
2327
+ if (index === 0) {
2328
+ this.$message({
2329
+ message: '已经是列表中第一位',
2330
+ type: 'warning',
2331
+ })
2332
+ } else {
2333
+ let temp = this.displayFields[index - 1]
2334
+ this.$set(this.displayFields, index - 1, this.displayFields[index])
2335
+ this.$set(this.displayFields, index, temp)
2336
+ }
2337
+ } else {
2338
+ if (index === this.displayFields.length - 1) {
2339
+ this.$message({
2340
+ message: '已经是列表中最后一位',
2341
+ type: 'warning',
2342
+ })
2343
+ } else {
2344
+ this.isTransition = true
2345
+ let i = this.displayFields[index + 1]
2346
+ this.$set(this.displayFields, index + 1, this.displayFields[index])
2347
+ this.$set(this.displayFields, index, i)
2348
+ }
2349
+ }
2350
+ },
2351
+ async getSunData(tab, row) {
2352
+ let ents = tab.childEnts
2353
+ let pk = tab.pkKey
2354
+ let refId = ''
2355
+ if (row[pk.toLocaleLowerCase()]) {
2356
+ refId = row[pk.toLocaleLowerCase()]
2357
+ } else {
2358
+ refId = row[pk.toUpperCase()]
2359
+ }
2360
+ this.subTableLoading = true
2361
+ if (ents && ents.length > 0) {
2362
+ for (let i = 0; i < ents.length; i++) {
2363
+ let tab = await this.getBoData(ents[i], refId)
2364
+ this.sunTabs.push(tab)
2365
+ }
2366
+ }
2367
+ this.subTableLoading = false
2368
+ this.dialogSunVisible = true
2369
+ },
2370
+ getBoData(ent, refId) {
2371
+ let attributeList = ent.attributeList.filter((obj) => !obj.isShow)
2372
+ let tab = {
2373
+ refId: refId,
2374
+ pkKey: ent.pkKey,
2375
+ name: ent.tableName,
2376
+ entName: ent.name,
2377
+ title: ent.comment,
2378
+ attributeList: attributeList,
2379
+ comment: ent.comment,
2380
+ pagination: {
2381
+ pageBean: {
2382
+ pageSize: 10,
2383
+ page: 1,
2384
+ total: 0,
2385
+ },
2386
+ },
2387
+ }
2388
+ tab.childEnts = []
2389
+ if (ent.childEnts && ent.childEnts.length > 0) {
2390
+ tab.childEnts = ent.childEnts
2391
+ }
2392
+ return new Promise((resolve) => {
2393
+ this.getSubDataPagination(tab, ent.name, refId, resolve, null)
2394
+ })
2395
+ },
2396
+ getSubEntsByFormKey(refId) {
2397
+ /*if (!this.ents || this.ents.length < 1) {
2398
+ form.getSubEntsByFormKey(this.templateInfo.formKey, (resp) => {
2399
+ // 子表与孙表字段名设置小写
2400
+ for (let i = 0; i < resp.data.length; i++) {
2401
+ resp.data[i].attributeList.forEach(attribute => {
2402
+ attribute.fieldName = attribute.fieldName.toLowerCase();
2403
+ })
2404
+ resp.data[i].childEnts.forEach(showChildEnt => {
2405
+ showChildEnt.attributeList.forEach(attribute => {
2406
+ attribute.fieldName = attribute.fieldName.toLowerCase();
2407
+ })
2408
+ })
2409
+ }
2410
+ this.ents = resp.data;
2411
+ });
2412
+ } else {*/
2413
+ this.getSubData(this, refId)
2414
+ /* }*/
2415
+ },
2416
+ async getSubData(_me, refId) {
2417
+ //let ents = this.ents;
2418
+ let ents = JSON.parse(_me.templateInfo.subField)
2419
+
2420
+ if (ents && ents.length > 0) {
2421
+ for (let i = 0; i < ents.length; i++) {
2422
+ ents[i].attributeList.forEach((attr) => {
2423
+ attr.fieldName = attr.fieldName.toLowerCase()
2424
+ })
2425
+ ents[i].childEnts.forEach((showChildEnt) => {
2426
+ showChildEnt.attributeList.forEach((attribute) => {
2427
+ attribute.fieldName = attribute.fieldName.toLowerCase()
2428
+ })
2429
+ })
2430
+ let tab = await this.getBoData(ents[i], refId)
2431
+ this.tabs.push(tab)
2432
+ }
2433
+ }
2434
+ this.dialogSubVisible = true
2435
+ },
2436
+ nodeClick(node) {
2437
+ this.pagination.page = 1
2438
+ //每次点击过滤树,应该把右边的table 与分页全部重置为初始
2439
+
2440
+ let pageBean = {
2441
+ pageBean: { page: 1, pageSize: this.pagination.pageSize },
2442
+ }
2443
+ pageBean.querys = []
2444
+ if (!node.id || node.id != -1) {
2445
+ let treeField = JSON.parse(this.templateInfo.treeField)
2446
+ let queryScope = treeField.queryScope
2447
+ treeField.querys.forEach((item) => {
2448
+ let value = node[item.value_]
2449
+ let operation = 'EQUAL'
2450
+ if (queryScope === 'currentAndSubordinate') {
2451
+ //查询当前层级和下属层级
2452
+ value = this.getTreeBindValue(
2453
+ item.value_,
2454
+ treeField.pidVal,
2455
+ node,
2456
+ treeField
2457
+ )
2458
+ operation = 'IN'
2459
+ }
2460
+ if (item.key_ && item.value_) {
2461
+ pageBean.querys.push({
2462
+ property: '$TREE$' + item.key_.colPrefix + item.key_.name,
2463
+ value,
2464
+ group: 'main',
2465
+ operation,
2466
+ relation: 'AND',
2467
+ })
2468
+ }
2469
+ })
2470
+ }
2471
+ //把过滤树的查询条件存一份起来,右边的搜索与分页才能同时使用
2472
+ this.treeQuerys = pageBean.querys
2473
+
2474
+ let params = {
2475
+ templateId: this.templateInfo.id,
2476
+ pagination: pageBean,
2477
+ }
2478
+ this.reset(true)
2479
+ //数据视图控件
2480
+ if (this.dataView) {
2481
+ if (this.dataView.selectList && this.dataView.selectList.length > 0) {
2482
+ params.selectList = this.dataView.selectList
2483
+ }
2484
+ }
2485
+ const this_ = this
2486
+ if (this_.isJoinFlow) {
2487
+ params.isJoinFlow = true
2488
+ params.taskType = this_.taskType
2489
+ params.defKey = this_.defKey
2490
+ }
2491
+ this.getBpmTemplateByPagination(params)
2492
+ },
2493
+ //加载树的信息
2494
+ toTreeData(data, id, pid, name, pvalue) {
2495
+ // 建立个树形结构,需要定义个最顶层的父节点,pvalue是0
2496
+ let parents = data.filter(
2497
+ (value) =>
2498
+ value[id] == value[pid] || value[pid] == null || value[pid] == pvalue
2499
+ )
2500
+ if (!parents) {
2501
+ parents = data.filter(
2502
+ (value) =>
2503
+ value[pid] !== 'undefined' &&
2504
+ value[pid] != null &&
2505
+ value[id] != value[pid]
2506
+ )
2507
+ }
2508
+ return parents
2509
+ },
2510
+ //初始化树
2511
+ initTree(treeField) {
2512
+ const this_ = this
2513
+ this.$requestConfig
2514
+ .getCustomDialogByAlias(treeField.alias)
2515
+ .then((res) => {
2516
+ this_.customDialog = res
2517
+
2518
+ this.$requestConfig
2519
+ .getCustomDialogTreeData(treeField.alias)
2520
+ .then((resp) => {
2521
+ if (this_.customDialog.displayfield) {
2522
+ let displayfield = JSON.parse(this_.customDialog.displayfield)
2523
+ this_.displayField = displayfield
2524
+ this_.treeList = resp
2525
+ let head = {}
2526
+ head[displayfield.displayName] = '全部'
2527
+ head.id = -1
2528
+ this_.tree.push(head)
2529
+ this_.$nextTick(() => {
2530
+ this_.setDefaultExpand()
2531
+ })
2532
+ }
2533
+ })
2534
+ })
2535
+ },
2536
+ loadTree(node, resolve) {
2537
+ if (node) {
2538
+ if (node.data.id === -1) {
2539
+ let tree = this.toTreeData(
2540
+ this.treeList,
2541
+ this.displayField.id,
2542
+ this.displayField.pid,
2543
+ this.displayField.displayName,
2544
+ this.displayField.pvalue ? this.displayField.pvalue : '0'
2545
+ )
2546
+ resolve(tree)
2547
+ } else {
2548
+ resolve(
2549
+ this.treeList.filter(
2550
+ (value) =>
2551
+ value[this.displayField.pid] === node.data[this.displayField.id]
2552
+ )
2553
+ )
2554
+ }
2555
+ } else {
2556
+ resolve([])
2557
+ }
2558
+ },
2559
+ handleSubCurrentChange(index, tab) {
2560
+ tab.pagination.pageBean.page = index
2561
+ this.handleLoadSubData(tab)
2562
+ },
2563
+ handleSubSizeChange(pageSize, tab) {
2564
+ tab.pagination.pageBean.pageSize = pageSize
2565
+ this.handleLoadSubData(tab)
2566
+ },
2567
+ handleLoadSubData(tab) {
2568
+ this.subTableLoading = true
2569
+ this.getSubDataPagination(
2570
+ tab,
2571
+ tab.entName,
2572
+ tab.refId ? tab.refId : this.refId,
2573
+ null,
2574
+ () => {
2575
+ this.subTableLoading = false
2576
+ }
2577
+ )
2578
+ },
2579
+ getSubDataPagination(tab, name, refId, resolve, final) {
2580
+ this.$requestConfig
2581
+ .getDataTemplateSubData({
2582
+ pagination: tab.pagination,
2583
+ name: name,
2584
+ refId: refId,
2585
+ })
2586
+ .then((data) => {
2587
+ if (data && data.rows.length > 0) {
2588
+ tab.dataList = data.rows
2589
+ tab.pagination.pageBean.pageSize = data.pageSize
2590
+ tab.pagination.pageBean.page = data.page
2591
+ tab.pagination.pageBean.total = data.total
2592
+ } else {
2593
+ tab.dataList = []
2594
+ tab.pagination.pageBean.pageSize = 1
2595
+ tab.pagination.pageBean.page = 1
2596
+ tab.pagination.pageBean.total = 0
2597
+ }
2598
+ resolve && resolve(tab)
2599
+ })
2600
+ .finally(() => {
2601
+ final && final()
2602
+ })
2603
+ },
2604
+ querySubTable(tab) {
2605
+ tab.pagination.querys = []
2606
+ if (this.querySubValue) {
2607
+ tab.attributeList.forEach((item) => {
2608
+ //pgSql使用模糊查询,类型不匹配时会报错,此处只保留varchar类型
2609
+ // if (item.dataType == 'varchar') {
2610
+ tab.pagination.querys.push({
2611
+ property: item.fieldName,
2612
+ value: this.querySubValue,
2613
+ group: 'other',
2614
+ operation: 'LIKE',
2615
+ relation: 'OR',
2616
+ })
2617
+ // }
2618
+ })
2619
+ } else if (this.querySunValue) {
2620
+ tab.attributeList.forEach((item) => {
2621
+ // if (item.dataType == 'varchar') {
2622
+ tab.pagination.querys.push({
2623
+ property: item.fieldName,
2624
+ value: this.querySunValue,
2625
+ group: 'other',
2626
+ operation: 'LIKE',
2627
+ relation: 'OR',
2628
+ })
2629
+ // }
2630
+ })
2631
+ }
2632
+ this.handleSubCurrentChange(1, tab)
2633
+ },
2634
+ importSub(param) {
2635
+ let formData = new FormData()
2636
+ formData.append('file', param.file)
2637
+ let params = {
2638
+ data: formData,
2639
+ alias: this.currentTab.entName,
2640
+ refId: this.refId,
2641
+ }
2642
+ this.$requestConfig.dataTemplateSubImport(params).then((data) => {
2643
+ if (data && data.state) {
2644
+ this.$message({ type: 'success', message: data.message })
2645
+ param.onSuccess()
2646
+ this.handleSubCurrentChange(1, this.currentTab)
2647
+ } else {
2648
+ this.$message.error(data.message)
2649
+ param.onError()
2650
+ }
2651
+ })
2652
+ },
2653
+ exportSub(tab) {
2654
+ this.exportType = 'sub'
2655
+ this.currentTab = tab
2656
+ this.displayFields = []
2657
+ this.subDisplayFieldsList = []
2658
+ tab.attributeList.forEach((item) => {
2659
+ if (!item.isShow) {
2660
+ this.displayFields.push({
2661
+ desc: item.comment,
2662
+ name: item.fieldName,
2663
+ type: item.columnType,
2664
+ })
2665
+ }
2666
+ })
2667
+ this.dialogExportVisible = true
2668
+ },
2669
+ importButton(tab) {
2670
+ this.currentTab = tab
2671
+ },
2672
+ myDraftList() {
2673
+ //数据视图随机添加到其他菜单下面时获取当前菜单的别名 并且当前数据视图不是表单里的数据视图 dataView
2674
+ if (
2675
+ sessionStorage.menu_alias &&
2676
+ !this.dataView &&
2677
+ !this.ignoredAlias.includes(sessionStorage.menu_alias)
2678
+ ) {
2679
+ this.alias_new = sessionStorage.menu_alias
2680
+ }
2681
+ let dataViewFlag = false
2682
+ //判断当前数据视图是不是表单里的数据视图
2683
+ if (this.dataView) {
2684
+ if (this.dataView.boDefAlias && this.dataView.boDefAlias != '') {
2685
+ dataViewFlag = true
2686
+ }
2687
+ }
2688
+ let path =
2689
+ '/templateDraftList/' +
2690
+ this.templateInfo.alias +
2691
+ '?dataViewFlag=' +
2692
+ dataViewFlag
2693
+ if (this.openType == 'new' || dataViewFlag) {
2694
+ path += '&isNew=true'
2695
+ }
2696
+ if (dataViewFlag) {
2697
+ window.open(path, '_blank')
2698
+ } else {
2699
+ this.$router.push(path)
2700
+ }
2701
+
2702
+ // let url =
2703
+ // "/statement/draftList?tempAlias=" + ;
2704
+ // const { href } = this.$router.push({
2705
+ // path: url,
2706
+ // });
2707
+ // window.open(href, "_blank");
2708
+ },
2709
+ initSwitchStatus() {
2710
+ //初始化开关状态
2711
+ let manages = utils.parseToJson(this.templateInfo.manageField)
2712
+ for (let i = 0; i < manages.length; i++) {
2713
+ if (manages[i].name === 'switch') {
2714
+ let fieldName = manages[i].bind
2715
+ this.$set(this.switchMap, fieldName, {})
2716
+ this.switchMap[fieldName].on = manages[i].switchOn
2717
+ this.switchMap[fieldName].off = manages[i].switchOff
2718
+ this.switchMap[fieldName].onLabel = manages[i].switchOnLabel
2719
+ this.switchMap[fieldName].offLabel = manages[i].switchOffLabel
2720
+ }
2721
+ }
2722
+ },
2723
+ switchChange(pkVal, on, off, fieldName, row, defaultTrue) {
2724
+ let this_ = this
2725
+ let val = row[fieldName]
2726
+ if (val != on && val != off) {
2727
+ if (defaultTrue == 'true') {
2728
+ this.$set(row, fieldName, off)
2729
+ val = off
2730
+ } else {
2731
+ this.$set(row, fieldName, on)
2732
+ val = on
2733
+ }
2734
+ }
2735
+ this_
2736
+ .$confirm('将会修改该数据,是否继续?', {
2737
+ confirmButtonText: '确定',
2738
+ cancelButtonText: '取消',
2739
+ type: 'warning',
2740
+ })
2741
+ .then(() => {
2742
+ let formAlias = this_.templateInfo.formKey //表单别名
2743
+ let dataDefAlias = this_.templateInfo.boDefAlias //数据建模别名
2744
+ this.$requestConfig
2745
+ .getDataTemplateForm(formAlias, dataDefAlias, pkVal)
2746
+ .then((resp) => {
2747
+ let boData = resp.data
2748
+ boData[dataDefAlias][fieldName] = val
2749
+ let saveData = {
2750
+ boAlias: this_.templateInfo.boDefAlias,
2751
+ boData: resp.data,
2752
+ templateKey: this.templateInfo.alias,
2753
+ }
2754
+ if (saveData.formKey) {
2755
+ saveData.boData.formKey = saveData.formKey
2756
+ }
2757
+ if (saveData.templateKey) {
2758
+ saveData.boData.templateKey = saveData.templateKey
2759
+ }
2760
+ this_.$requestConfig.boSave(saveData).then((result) => {
2761
+ if (result.state) {
2762
+ this_.$message({
2763
+ type: 'success',
2764
+ message: '保存成功',
2765
+ })
2766
+ } else {
2767
+ this_.$message({
2768
+ type: 'error',
2769
+ message: '保存失败',
2770
+ })
2771
+ }
2772
+ })
2773
+ })
2774
+ })
2775
+ .catch(() => {
2776
+ let formAlias = this_.templateInfo.formKey //表单别名
2777
+ let dataDefAlias = this_.templateInfo.boDefAlias //数据建模别名
2778
+ this.$requestConfig
2779
+ .getDataTemplateForm(formAlias, dataDefAlias, pkVal)
2780
+ .then((resp) => {
2781
+ this_.$set(row, fieldName, resp.data[dataDefAlias][fieldName])
2782
+ })
2783
+ })
2784
+ },
2785
+ display() {
2786
+ //pc端的数据报表不需要做本方法的处理,直接返回true即可。
2787
+ return true
2788
+ },
2789
+ getFixed(fixed) {
2790
+ return fixed
2791
+ },
2792
+ summary(method, field, decimal) {
2793
+ let list = this.rows
2794
+ .filter((item) => item[field] !== undefined && item[field] !== '')
2795
+ .map((item) => new Number(item[field]))
2796
+ if (!list || list.length == 0) {
2797
+ return
2798
+ }
2799
+ if (method === 'count') {
2800
+ return list.length
2801
+ } else if (method === 'sum') {
2802
+ return list.reduce((a, b) => a + b).toFixed(decimal)
2803
+ } else if (method === 'min') {
2804
+ return Math.min(...list).toFixed(decimal)
2805
+ } else if (method === 'max') {
2806
+ return Math.max(...list).toFixed(decimal)
2807
+ } else if (method === 'avg') {
2808
+ return (list.reduce((a, b) => a + b) / list.length).toFixed(decimal)
2809
+ }
2810
+ },
2811
+ getColor(data, row) {
2812
+ let resuColor = 'color:black'
2813
+ let decode = Base64.decode(data)
2814
+ let colorRule = JSON.parse(decode)
2815
+ if (colorRule && colorRule instanceof Array) {
2816
+ colorRule.forEach((rule) => {
2817
+ let Fn = Function('data', rule.proRule)
2818
+ if (Fn(row)) {
2819
+ resuColor = 'color:' + rule.proColor
2820
+ }
2821
+ })
2822
+ }
2823
+ return resuColor
2824
+ },
2825
+ getProValue(value, rule) {
2826
+ return Math.round((value / rule) * 10000) / 100 // 小数点后两位百分比
2827
+ },
2828
+ getProColor(data, row) {
2829
+ let resuColor = '#409eff'
2830
+ let decode = Base64.decode(data)
2831
+ /*decode=decode.replace(/\s*!/g,"");*/
2832
+ let colorRule = JSON.parse(decode)
2833
+ if (colorRule && colorRule instanceof Array) {
2834
+ colorRule.forEach((rule) => {
2835
+ let Fn = Function('data', rule.proRule)
2836
+ if (Fn(row)) {
2837
+ resuColor = rule.proColor
2838
+ }
2839
+ })
2840
+ }
2841
+ return resuColor
2842
+ },
2843
+ isSortable(field) {
2844
+ let isClob = false
2845
+ this.displayFields.forEach((item) => {
2846
+ if (item.name === field && item.type === 'clob') {
2847
+ isClob = true
2848
+ }
2849
+ })
2850
+ return !this.notSortableFields.includes(field) && !isClob
2851
+ },
2852
+ customEvilJS(row, clScript) {
2853
+ let Fn = Function('_req', 'row', '_this', Base64.decode(clScript)) //一个变量指向Function,防止有些前端编译工具报错
2854
+ Fn(req, row, this)
2855
+ },
2856
+ batchUpdate(title, base64Json, base64Fileds, row) {
2857
+ let defaultValueList = []
2858
+ let outForm = []
2859
+ if (base64Json) {
2860
+ //是否有用户自己输入的字段
2861
+ let res = true
2862
+ let batchUpdateData = JSON.parse(Base64.decode(base64Json))
2863
+ let filedsObj = JSON.parse(Base64.decode(base64Fileds))
2864
+ batchUpdateData.forEach((item) => {
2865
+ if (item.valueType == 1) {
2866
+ var isRequired = false
2867
+ if (item.isRequired) {
2868
+ isRequired = true
2869
+ }
2870
+ let obj = {
2871
+ name: item.name,
2872
+ desc: filedsObj[item.name],
2873
+ outType: item.outValueType,
2874
+ single: false,
2875
+ selectCurrent: false,
2876
+ isRequired: isRequired,
2877
+ }
2878
+ if (item.outValueType == 'select') {
2879
+ let selectConfig = JSON.parse(item.outConfig)
2880
+ obj.ganged = {
2881
+ alias: '',
2882
+ valueBind: '',
2883
+ noInit: '',
2884
+ labelBind: '',
2885
+ bind: {},
2886
+ }
2887
+ if (selectConfig.customQuery) {
2888
+ let ganged = {
2889
+ alias: selectConfig.customQuery.alias,
2890
+ valueBind: selectConfig.customQuery.valueBind,
2891
+ noInit: '',
2892
+ labelBind: selectConfig.customQuery.labelBind,
2893
+ bind: {},
2894
+ }
2895
+ obj.ganged = ganged
2896
+ }
2897
+ obj.selectData = selectConfig.selectData
2898
+ } else if (item.outValueType == 'dialog') {
2899
+ let selectConfig = JSON.parse(item.outConfig)
2900
+ let dialogConfig = selectConfig.dialogConfig
2901
+ let mappingConf = []
2902
+ let parameter = selectConfig.parameter
2903
+ for (let key in parameter) {
2904
+ let value = parameter[key] || ''
2905
+ mappingConf.push({
2906
+ from: key,
2907
+ target: [value],
2908
+ targetSub: [value],
2909
+ })
2910
+ }
2911
+ let custdialog = {
2912
+ selectNum: dialogConfig.selectNum,
2913
+ conditions: [],
2914
+ mappingConf: mappingConf,
2915
+ custQueryJson: [],
2916
+ alias: dialogConfig.alias,
2917
+ type: dialogConfig.custDialog,
2918
+ }
2919
+ obj.custdialog = {
2920
+ name: '请选择',
2921
+ custDialog: custdialog,
2922
+ resultField: dialogConfig.resultField,
2923
+ }
2924
+ } else if (
2925
+ item.outConfig &&
2926
+ (item.outValueType != 'input' ||
2927
+ item.outValueType != 'data' ||
2928
+ item.outValueType != 'number')
2929
+ ) {
2930
+ let outConfig = JSON.parse(item.outConfig)
2931
+ let parameter = outConfig.parameter
2932
+ for (let key in parameter) {
2933
+ if (!parameter[key]) {
2934
+ delete parameter[key]
2935
+ } else {
2936
+ parameter[key] = 'data.' + parameter[key]
2937
+ }
2938
+ }
2939
+ if (outConfig.selectCurrent) {
2940
+ obj.selectCurrent = outConfig.selectCurrent
2941
+ }
2942
+ if (outConfig.isSingle) {
2943
+ obj.single = outConfig.isSingle
2944
+ }
2945
+ obj.bindConfig = parameter
2946
+ }
2947
+ outForm.push(obj)
2948
+ res = false
2949
+ } else {
2950
+ defaultValueList.push({
2951
+ key: item.name,
2952
+ value: item.defaultValue,
2953
+ })
2954
+ }
2955
+ })
2956
+ if (res) {
2957
+ if (row) {
2958
+ this.updateBo(defaultValueList, row)
2959
+ } else {
2960
+ this.updateBo(defaultValueList)
2961
+ }
2962
+ } else {
2963
+ this.defaultValueList = defaultValueList
2964
+ this.$refs.templateBatchUpdateDialog.showDialog(title, outForm)
2965
+ }
2966
+ } else {
2967
+ this.$message({ type: 'info', message: '未设置更新内容' })
2968
+ }
2969
+ },
2970
+ onConfirm(data) {
2971
+ let defaultValueList = []
2972
+ for (var key in data) {
2973
+ defaultValueList.push({ key: key, value: data[key] })
2974
+ }
2975
+ let boData = this.defaultValueList
2976
+ ? this.defaultValueList.concat(defaultValueList)
2977
+ : this.defaultValue
2978
+ this.updateBo(boData)
2979
+ },
2980
+ updateBo(defaultValueList, row) {
2981
+ this.$confirm('此操作将批量更新数据, 是否继续?', '提示', {
2982
+ confirmButtonText: '确定',
2983
+ cancelButtonText: '取消',
2984
+ type: 'warning',
2985
+ })
2986
+ .then(() => {
2987
+ let selectRows = this.tableData.selectRows
2988
+ ? this.tableData.selectRows
2989
+ : row
2990
+ for (let i = 0; i < selectRows.length; i++) {
2991
+ selectRows[i].formKey = this.templateInfo.formKey
2992
+ for (let j = 0; j < defaultValueList.length; j++) {
2993
+ selectRows[i][defaultValueList[j].key] = defaultValueList[j].value
2994
+ }
2995
+ }
2996
+ let data = {
2997
+ boData: selectRows,
2998
+ boAlias: this.templateInfo.boDefAlias,
2999
+ }
3000
+ this.$requestConfig.batchUpdateTemplateData(data).then((data) => {
3001
+ if (data.state) {
3002
+ this.$message({ type: 'success', message: data.message })
3003
+ this.search()
3004
+ }
3005
+ })
3006
+ })
3007
+ .catch(() => {
3008
+ this.$message({ type: 'info', message: '已取消更新' })
3009
+ })
3010
+ },
3011
+ addCommand(command) {
3012
+ if (command == 'notLogin' || command == 'login') {
3013
+ this.getAddQRCode(command)
3014
+ }
3015
+ },
3016
+ getAddQRCode(command) {
3017
+ this.QRCodePattern = command == 'notLogin' ? true : false
3018
+ this.QRCodeDesc = []
3019
+ this.QRCodeType = 'add'
3020
+ this.QRCodeShow = false
3021
+ this.QRCodeDialog = true
3022
+ },
3023
+ showSearchPane() {
3024
+ return true
3025
+ },
3026
+ buildDefaultQuerys() {
3027
+ let this_ = this
3028
+ let querys = []
3029
+ let conditions = JSON.parse(this_.templateInfo.conditionField)
3030
+ //条件字段默认值判断
3031
+ conditions.forEach((condition) => {
3032
+ if (condition.defaultValue) {
3033
+ let field = condition.colPrefix + condition.na
3034
+ this_.$set(this_.searchForm, field, condition.defaultValue)
3035
+ let value = condition.defaultValue
3036
+ if (condition.ty == 'number') {
3037
+ value = parseFloat(value)
3038
+ }
3039
+ querys.push({
3040
+ property: field,
3041
+ value: value,
3042
+ group: 'main',
3043
+ operation: condition.qt.toUpperCase(),
3044
+ relation: 'AND',
3045
+ })
3046
+ }
3047
+ })
3048
+ //筛选字段默认值判断
3049
+
3050
+ if (this.parameterqQuerys) {
3051
+ let parameterQuerys = JSON.parse(Base64.decode(this.parameterqQuerys))
3052
+ if (parameterQuerys && parameterQuerys.length > 0) {
3053
+ parameterQuerys.forEach((query) => {
3054
+ let prefix = this.templateInfo.isExternal === 1 ? '' : 'F_'
3055
+ query.property = prefix + query.property
3056
+ this_.$set(this_.searchForm, query.property, query.value)
3057
+ querys.push(query)
3058
+ })
3059
+ }
3060
+ }
3061
+ let filters = JSON.parse(this_.templateInfo.filteringField)
3062
+ filters.forEach((filter) => {
3063
+ if (filter.defaultValue && filter.defaultValue.length > 0) {
3064
+ this_.filterMap[filter.name] = filter.defaultValue
3065
+ filter.defaultValue.forEach((val) => {
3066
+ querys.push({
3067
+ property: filter.colPrefix + filter.name,
3068
+ value: val,
3069
+ group: 'defVal_' + filter.name,
3070
+ operation: 'EQUAL',
3071
+ relation: 'OR',
3072
+ })
3073
+ })
3074
+ }
3075
+ })
3076
+ this_.$on('afterMounted', () => {
3077
+ const tab = document.getElementById(this_.templateInfo.alias)
3078
+ if (tab && tab.__vue__) {
3079
+ let headerColumns = tab.__vue__.$refs.tableHeader
3080
+ ? tab.__vue__.$refs.tableHeader.columns
3081
+ : []
3082
+ headerColumns.forEach((column) => {
3083
+ if (this_.filterMap.hasOwnProperty(column.property)) {
3084
+ this_.filterMap[column.property].forEach((val) => {
3085
+ column.filteredValue.push(val)
3086
+ })
3087
+ }
3088
+ })
3089
+ }
3090
+ })
3091
+ return querys
3092
+ },
3093
+ handleClose() {
3094
+ this.dataViewDialogVisible = false
3095
+ },
3096
+ startFlowSucess(m) {
3097
+ this.$message.success(m)
3098
+ this.search()
3099
+ },
3100
+ async scriptClick(btnAlias, afterScriptValue, parameter) {
3101
+ if (parameter && parameter.dialogWidth) {
3102
+ this.dialogWidth = parameter.dialogWidth + 'px'
3103
+ }
3104
+ if (parameter && parameter.dialogHeight) {
3105
+ this.dialogHeight = parameter.dialogHeight + 'px'
3106
+ }
3107
+ let row = null
3108
+ if (parameter && parameter.id) {
3109
+ row = this.rows.filter(
3110
+ (item) => item[this.templateInfo.pkField] == parameter.id
3111
+ )[0]
3112
+ }
3113
+ let btn = [
3114
+ 'add',
3115
+ 'edit',
3116
+ 'del',
3117
+ 'print',
3118
+ 'url',
3119
+ 'import',
3120
+ 'deleted',
3121
+ 'export',
3122
+ 'copyOne',
3123
+ 'copyAll',
3124
+ 'detail',
3125
+ 'record',
3126
+ 'printDetail',
3127
+ 'sub',
3128
+ 'js',
3129
+ 'startFlow',
3130
+ ] //点击按钮就触发
3131
+
3132
+ let btnOk = ['switch', 'batchUpdate'] //需要点击确认按钮才触发
3133
+ if (btn.indexOf(btnAlias) != -1) {
3134
+ let scriptResult = true
3135
+ if (afterScriptValue) {
3136
+ let script = Base64.decode(afterScriptValue)
3137
+ scriptResult = await this.tempScript(script, row)
3138
+ }
3139
+ if (scriptResult) {
3140
+ if (btnAlias == 'add') {
3141
+ this.operating(
3142
+ parameter.templateId,
3143
+ parameter.id,
3144
+ parameter.action,
3145
+ parameter.defId,
3146
+ parameter.isStartFlow,
3147
+ parameter.openType,
3148
+ parameter.quitAfterSaving
3149
+ )
3150
+ } else if (btnAlias == 'edit') {
3151
+ if (parameter && parameter.id) {
3152
+ this.operating(
3153
+ parameter.templateId,
3154
+ parameter.id,
3155
+ parameter.action,
3156
+ parameter.defId,
3157
+ parameter.isStartFlow,
3158
+ parameter.openType,
3159
+ parameter.quitAfterSaving
3160
+ )
3161
+ } else if (this.checkSelect()) {
3162
+ parameter.id = this.tableData.selectRows[0].id_
3163
+ parameter.isStartFlow = this.tableData.selectRows[0].isStartFlow
3164
+ this.operating(
3165
+ parameter.templateId,
3166
+ parameter.id,
3167
+ parameter.action,
3168
+ parameter.defId,
3169
+ parameter.isStartFlow,
3170
+ parameter.openType,
3171
+ parameter.quitAfterSaving
3172
+ )
3173
+ }
3174
+ } else if (btnAlias == 'del') {
3175
+ this.del(parameter.pkField)
3176
+ } else if (btnAlias == 'print') {
3177
+ this.printList()
3178
+ } else if (btnAlias == 'url') {
3179
+ this.openUrl(
3180
+ parameter.url,
3181
+ parameter.type,
3182
+ parameter.row,
3183
+ parameter.fieldName
3184
+ )
3185
+ } else if (btnAlias == 'export') {
3186
+ this.exports(parameter.exportSettingFields)
3187
+ } else if (btnAlias == 'deleted') {
3188
+ this.deleted()
3189
+ } else if (btnAlias == 'copyOne') {
3190
+ this.copyOne(parameter)
3191
+ } else if (btnAlias == 'copyAll') {
3192
+ this.copyAll()
3193
+ } else if (btnAlias == 'detail' && this.checkSelect()) {
3194
+ parameter.id = this.tableData.selectRows[0].id_
3195
+ this.operating(
3196
+ parameter.templateId,
3197
+ parameter.id,
3198
+ parameter.action,
3199
+ parameter.defId,
3200
+ parameter.isStartFlow,
3201
+ parameter.openType,
3202
+ parameter.quitAfterSaving
3203
+ )
3204
+ } else if (btnAlias == 'record' && this.checkSelect()) {
3205
+ this.openRecordList(this.tableData.selectRows[0].id_)
3206
+ } else if (btnAlias == 'printDetail' && this.checkSelect()) {
3207
+ parameter.id = this.tableData.selectRows[0].id_
3208
+ this.printDetail(
3209
+ parameter.templateId,
3210
+ parameter.id,
3211
+ parameter.action
3212
+ )
3213
+ } else if (btnAlias == 'sub' && this.checkSelect()) {
3214
+ this.showSubList(this.tableData.selectRows[0].id_)
3215
+ } else if (btnAlias == 'js' && this.checkSelect()) {
3216
+ this.customEvilJS(this.tableData.selectRows[0], parameter.jsValue)
3217
+ } else if (
3218
+ btnAlias == 'startFlow' &&
3219
+ parameter.defId &&
3220
+ !parameter.isStartFlow
3221
+ ) {
3222
+ this.operating(
3223
+ parameter.templateId,
3224
+ parameter.id,
3225
+ parameter.action,
3226
+ parameter.defId,
3227
+ parameter.isStartFlow,
3228
+ parameter.openType,
3229
+ parameter.quitAfterSaving
3230
+ )
3231
+ }
3232
+ }
3233
+ } else if (btnOk.indexOf(btnAlias) != -1) {
3234
+ if (btnAlias == 'switch') {
3235
+ this.switchChange(
3236
+ parameter.pkField,
3237
+ parameter.switchOn,
3238
+ parameter.switchOff,
3239
+ parameter.bind,
3240
+ parameter.row,
3241
+ parameter.switchDefaultTrue,
3242
+ afterScriptValue
3243
+ )
3244
+ } else if (btnAlias == 'batchUpdate') {
3245
+ //如果是行间按钮,就不用判断是否选择了数据
3246
+ if (parameter.position) {
3247
+ this.batchUpdate(
3248
+ parameter.desc,
3249
+ parameter.batchUpdateData,
3250
+ parameter.filedsObj,
3251
+ afterScriptValue,
3252
+ parameter.row
3253
+ )
3254
+ } else {
3255
+ this.batchUpdate(
3256
+ parameter.desc,
3257
+ parameter.batchUpdateData,
3258
+ parameter.filedsObj,
3259
+ afterScriptValue
3260
+ )
3261
+ }
3262
+ }
3263
+ }
3264
+ },
3265
+ checkSelect() {
3266
+ if (!this.tableData.selectRows || this.tableData.selectRows.length == 0) {
3267
+ this.$message.warning('请选择一条数据进行操作!')
3268
+ return false
3269
+ }
3270
+ if (this.tableData.selectRows.length > 1) {
3271
+ this.$message.warning('您选择了多条数据,请选择其中一条进行操作!')
3272
+ return false
3273
+ }
3274
+ return true
3275
+ },
3276
+ copyOne(parameter) {
3277
+ this.$confirm('此操作将复制一份数据, 是否继续?', '提示', {
3278
+ confirmButtonText: '确定',
3279
+ cancelButtonText: '取消',
3280
+ type: 'warning',
3281
+ })
3282
+ .then(() => {
3283
+ let ids = []
3284
+ ids.push(parameter.pkField)
3285
+ let param = {}
3286
+ param.ids = ids
3287
+ param.boAlias = this.templateInfo.boDefAlias
3288
+ let loadingInstance = Loading.service('表单复制中')
3289
+ this.$requestConfig
3290
+ .boCopy(param)
3291
+ .then((res) => {
3292
+ if (res.state) {
3293
+ this.$message({
3294
+ message: res.message,
3295
+ type: 'success',
3296
+ })
3297
+ this.$nextTick(() => {
3298
+ // 以服务的方式调用的 Loading 需要异步关闭
3299
+ loadingInstance.close()
3300
+ })
3301
+ this.search()
3302
+ } else {
3303
+ this.$message({
3304
+ message: res.message,
3305
+ type: 'warning',
3306
+ })
3307
+ this.$nextTick(() => {
3308
+ // 以服务的方式调用的 Loading 需要异步关闭
3309
+ loadingInstance.close()
3310
+ })
3311
+ }
3312
+ })
3313
+ .finally(() => {
3314
+ loadingInstance.close()
3315
+ })
3316
+ })
3317
+ .catch(() => {
3318
+ this.$message({
3319
+ type: 'info',
3320
+ message: '已取消复制',
3321
+ })
3322
+ })
3323
+ },
3324
+ copyAll() {
3325
+ if (
3326
+ this.tableData.selectRows == null ||
3327
+ this.tableData.selectRows.length == 0
3328
+ ) {
3329
+ this.$message.warning('请选择数据复制!')
3330
+ return false
3331
+ }
3332
+ this.$confirm('此操作将复制所选数据, 是否继续?', '提示', {
3333
+ confirmButtonText: '确定',
3334
+ cancelButtonText: '取消',
3335
+ type: 'warning',
3336
+ })
3337
+ .then(() => {
3338
+ let s = []
3339
+ for (let i = 0; i < this.tableData.selectRows.length; i++) {
3340
+ s.push(this.tableData.selectRows[i][this.templateInfo.pkField])
3341
+ }
3342
+ let param = {
3343
+ ids: s,
3344
+ boAlias: this.templateInfo.boDefAlias,
3345
+ }
3346
+ let loadingInstance = Loading.service('表单复制中')
3347
+ this.$requestConfig
3348
+ .boCopy(param)
3349
+ .then((res) => {
3350
+ if (res.state) {
3351
+ this.$message({
3352
+ message: res.message,
3353
+ type: 'success',
3354
+ })
3355
+ this.$nextTick(() => {
3356
+ // 以服务的方式调用的 Loading 需要异步关闭
3357
+ loadingInstance.close()
3358
+ })
3359
+ this.search()
3360
+ } else {
3361
+ this.$message({
3362
+ message: res.message,
3363
+ type: 'warning',
3364
+ })
3365
+ this.$nextTick(() => {
3366
+ // 以服务的方式调用的 Loading 需要异步关闭
3367
+ loadingInstance.close()
3368
+ })
3369
+ }
3370
+ })
3371
+ .finally(() => {
3372
+ loadingInstance.close()
3373
+ })
3374
+ })
3375
+ .catch(() => {
3376
+ this.$message({
3377
+ type: 'info',
3378
+ message: '已取消复制',
3379
+ })
3380
+ })
3381
+ },
3382
+ tempScript(script, row) {
3383
+ if (script == undefined || script == '') {
3384
+ return true
3385
+ }
3386
+ let _this = this
3387
+ let _req = req
3388
+ let _rows = this.rows
3389
+ let _row = row
3390
+ function evil() {
3391
+ let Fn = Function('_req', '_this', '_rows', '_row', script) //一个变量指向Function,防止有些前端编译工具报错
3392
+ let result = Fn(_req, _this, _rows, _row)
3393
+ return result
3394
+ }
3395
+ let resultValue = evil()
3396
+ return resultValue
3397
+ },
3398
+
3399
+ async beforeScript(diyScript, row) {
3400
+ if (diyScript) {
3401
+ let script = Base64.decode(diyScript)
3402
+ let scriptResult = await this.tempScript(script, row)
3403
+ return scriptResult
3404
+ } else {
3405
+ return true
3406
+ }
3407
+ },
3408
+ //过滤树默认展开操作
3409
+ setDefaultExpand() {
3410
+ let defaultExpand = '1'
3411
+ let elTree = null
3412
+ try {
3413
+ let treeField = JSON.parse(this.templateInfo.treeField)
3414
+ defaultExpand = treeField.defaultExpand
3415
+ //如果未配置字段映射字段,过滤树不会加载,这里会抛异常
3416
+ elTree = this.$refs.filterTree.$refs.elTree
3417
+ } catch (error) {
3418
+ return
3419
+ }
3420
+ if (defaultExpand == '0') {
3421
+ return
3422
+ }
3423
+ //根节点, 表单列表中的根节点实际是该节点的第一个child
3424
+
3425
+ let store = elTree.store
3426
+ let root = store.root.childNodes[0] || store.root
3427
+ //递归展开,node为当前node
3428
+ function setExpand(node, defaultExpand) {
3429
+ elTree.load(node, (data) => {
3430
+ //为了减少改动,这里进行了手动懒加载,具体方法看element源码
3431
+ node.doCreateChildren(data)
3432
+ store._initDefaultCheckedNodes()
3433
+ node.expanded = true
3434
+ })
3435
+ if (!node.childNodes || node.childNodes.length == 0) {
3436
+ node.isLeaf = true
3437
+ return
3438
+ }
3439
+ if (node.level >= defaultExpand && defaultExpand != '-1') {
3440
+ return
3441
+ }
3442
+ node.childNodes.forEach((item) => {
3443
+ setExpand(item, defaultExpand)
3444
+ })
3445
+ }
3446
+ setExpand(root, parseInt(defaultExpand))
3447
+ },
3448
+ getTreeBindValue(field, pid, node, treeField) {
3449
+ let idVal = treeField.idVal
3450
+ let resultArr = [node[field]]
3451
+ let treeList = this.treeList
3452
+ //递归查找该节点的下属节点
3453
+ function getCurAndSub(node) {
3454
+ treeList.forEach((item) => {
3455
+ if (item[pid] == node[idVal]) {
3456
+ resultArr.push(item[field])
3457
+ getCurAndSub(item)
3458
+ }
3459
+ })
3460
+ }
3461
+ getCurAndSub(node)
3462
+ return resultArr
3463
+ },
3464
+ //检查流程权限
3465
+ checkFlowPermission() {
3466
+ let flowBtns = [
3467
+ 'approval',
3468
+ 'taskDetail',
3469
+ 'taskImage',
3470
+ 'history',
3471
+ 'revoke',
3472
+ 'phyDelete',
3473
+ 'logicDelete',
3474
+ 'taskToRead',
3475
+ ]
3476
+ if (this.templateInfo && this.templateInfo.manageField) {
3477
+ let btns = JSON.parse(this.templateInfo.manageField).filter((item) => {
3478
+ return flowBtns.includes(item.name)
3479
+ })
3480
+ if (!btns || btns.length == 0) {
3481
+ return
3482
+ }
3483
+ let permissionTypes = btns
3484
+ .map((item) => {
3485
+ return item.name
3486
+ })
3487
+ .join(',')
3488
+ let instIds = []
3489
+ this.rows.forEach((item) => {
3490
+ if (
3491
+ item['bpm_proc_inst_id_'] &&
3492
+ !this.flowBtnPermission.hasOwnProperty(item['bpm_proc_inst_id_'])
3493
+ ) {
3494
+ instIds.push(item['bpm_proc_inst_id_'])
3495
+ }
3496
+ })
3497
+ if (permissionTypes && instIds && instIds.length > 0) {
3498
+ this.$requestConfig
3499
+ .getDataTemplateButtonPermission(instIds, permissionTypes)
3500
+ .then((resp) => {
3501
+ resp.value.forEach((item) => {
3502
+ let { instId } = item
3503
+ this.$set(this.flowBtnPermission, instId, item)
3504
+ })
3505
+ })
3506
+ }
3507
+ }
3508
+ },
3509
+ //审批任务
3510
+ handleApproval(row, type) {
3511
+ let { taskId } = this.flowBtnPermission[row['bpm_proc_inst_id_']]
3512
+ let url = `/matter/approvalForm/?taskId=${taskId}&instId=${row['bpm_proc_inst_id_']}&isGetApprovalBtn=true`
3513
+ //判断当前在哪个端
3514
+ if (!window.context || !window.context.front) {
3515
+ this.$message.error('应用端未配置')
3516
+ return
3517
+ }
3518
+ if (
3519
+ !window.context.front.startsWith(window.location.origin) ||
3520
+ 'new' === type
3521
+ ) {
3522
+ let currentUser = sessionStorage.getItem('currentUser')
3523
+ let token = null
3524
+ try {
3525
+ let obj = JSON.parse(currentUser)
3526
+ token = obj.token
3527
+ } catch (e) {
3528
+ console.log(`sessionStorage.currentUser中未配置token,${e}`)
3529
+ }
3530
+ url = `${window.context.front}${url}${token ? '&token=' + token : ''}`
3531
+ window.open(url, '_blank')
3532
+ } else if (type == 'old') {
3533
+ this.$router.push(url)
3534
+ }
3535
+ },
3536
+ //打开流程图
3537
+ showTaskImage(row) {
3538
+ this.selectedDefId = row['bpm_proc_def_id_']
3539
+ this.selectedInstId = row['bpm_proc_inst_id_']
3540
+ let taskId = this.flowBtnPermission[this.selectedInstId].taskId
3541
+ if (taskId) {
3542
+ this.selectedTaskId = taskId
3543
+ }
3544
+ this.$nextTick(() => {
3545
+ this.$refs.taskImage.handleOpen()
3546
+ })
3547
+ },
3548
+ //打开审批记录
3549
+ showInstHistory(row) {
3550
+ this.selectedDefId = row['bpm_proc_def_id_']
3551
+ this.selectedInstId = row['bpm_proc_inst_id_']
3552
+ this.$nextTick(() => {
3553
+ this.$refs['processRecord'].showDialog()
3554
+ })
3555
+ },
3556
+ //处理撤回
3557
+ handleRevoke(row) {
3558
+ let instId = row['bpm_proc_inst_id_']
3559
+ let status = row['bpm_status_']
3560
+ if (status == 'revokeToStart') {
3561
+ this.$message.warning('已撤回, 不能再撤回')
3562
+ return
3563
+ }
3564
+ this.selectedInstId = instId
3565
+ let data = {
3566
+ instanceId: instId,
3567
+ isHandRevoke: false,
3568
+ }
3569
+ this.$prompt('请输入撤回原因', '提示')
3570
+ .then(({ value }) => {
3571
+ data.cause = value
3572
+ this.$requestConfig.saveRevoke(data).then((response) => {
3573
+ this.$message.success(response.message)
3574
+ this.search('find')
3575
+ })
3576
+ })
3577
+ .catch(() => {})
3578
+ },
3579
+ //任务明细
3580
+ showTaskDetail(row, openType) {
3581
+ let instId = row['bpm_proc_inst_id_']
3582
+ let url = `/matter/approvalForm?instId=${instId}`
3583
+ const basePath = this.$router.resolve('/').href
3584
+ if (
3585
+ !window.context.front.startsWith(window.location.origin + basePath) ||
3586
+ 'new' === openType
3587
+ ) {
3588
+ let currentUser = sessionStorage.getItem('currentUser')
3589
+ let token = null
3590
+ try {
3591
+ let obj = JSON.parse(currentUser)
3592
+ token = obj.token
3593
+ } catch (e) {
3594
+ console.log(`sessionStorage.currentUser中未配置token,${e}`)
3595
+ }
3596
+ url = `${window.context.front}${url}${token ? '&token=' + token : ''}`
3597
+ window.open(url, '_blank')
3598
+ } else if ('old' == openType) {
3599
+ this.$router.push(url)
3600
+ }
3601
+ },
3602
+ taskToRead(row) {
3603
+ this.$refs['templateTaskCirculate'].showDialog(
3604
+ row,
3605
+ this.flowBtnPermission
3606
+ )
3607
+ },
3608
+ //物理删除(草稿),会把表单数据也删除
3609
+ phyDelete(row) {
3610
+ let this_ = this
3611
+ this.$confirm('删除后无法恢复,是否确定该流程草稿?', '提示')
3612
+ .then(() => {
3613
+ let id = row['bpm_proc_inst_id_']
3614
+ this.$requestConfig.removeFlowDraftById(id).then((response) => {
3615
+ this.$message.success(response.message)
3616
+ this_.search('find')
3617
+ })
3618
+ })
3619
+ .catch(() => {})
3620
+ },
3621
+ //逻辑删除流程实例
3622
+ logicDelete(row) {
3623
+ let instId = row['bpm_proc_inst_id_']
3624
+ this.$confirm('确认删除此流程?', '提示', {
3625
+ cancelButtonText: '取消',
3626
+ confirmButtonText: '确定',
3627
+ type: 'warning',
3628
+ closeOnClickModal: false,
3629
+ }).then(() => {
3630
+ this.$requestConfig.removeFlowDraftById(instId).then((response) => {
3631
+ this.$message.success(response.message)
3632
+ this.search('find')
3633
+ })
3634
+ })
3635
+ },
3636
+ },
3637
+ // asyncComputed: {
3638
+ // showDraftList() {
3639
+ // //如果当前页面被嵌入iframe里面不显示草稿
3640
+ // return !this.isJoinFlow
3641
+ // },
3642
+ // showScriptButton: {
3643
+ // get() {
3644
+ // let obj = {
3645
+ // print: true,
3646
+ // add: true,
3647
+ // edit: true,
3648
+ // del: true,
3649
+ // batchUpdate: true,
3650
+ // export: true,
3651
+ // import: true,
3652
+ // switch: true,
3653
+ // url: true,
3654
+ // copy: true,
3655
+ // }
3656
+ // if (this.templateInfo && this.templateInfo.manageField) {
3657
+ // let manageField = JSON.parse(this.templateInfo.manageField)
3658
+ // let this_ = this
3659
+ // manageField.forEach((item) => {
3660
+ // if (item.beforeScriptValue) {
3661
+ // let promise = this_.beforeScript(item.beforeScriptValue)
3662
+ // promise.then((res) => {
3663
+ // obj[item.name] = res
3664
+ // })
3665
+ // }
3666
+ // })
3667
+ // }
3668
+ // return obj
3669
+ // },
3670
+ // lazy: true,
3671
+ // },
3672
+ // },
3673
+ }