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