vue2-client 1.9.78 → 1.9.79

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 (337) hide show
  1. package/.env +19 -19
  2. package/.env.gaslink +19 -19
  3. package/.env.his +19 -19
  4. package/.env.revenue +19 -19
  5. package/.eslintrc.js +90 -90
  6. package/CHANGELOG.md +824 -824
  7. package/Components.md +60 -60
  8. package/babel.config.js +21 -21
  9. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +45 -45
  10. package/docs/LowCode/lowcode.md +155 -155
  11. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  12. package/docs/index.md +30 -30
  13. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +143 -143
  14. package/index.js +31 -31
  15. package/jest-transform-stub.js +8 -8
  16. package/jest.config.js +21 -21
  17. package/jest.setup.js +7 -7
  18. package/package.json +1 -1
  19. package/public/his/editor/editor.html +51 -51
  20. package/public/his/editor/mock/bind_data.html +779 -779
  21. package/public/his/editor/mock/data_table.html +40 -40
  22. package/public/his/editor/mock/sign.html +75 -75
  23. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  24. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  25. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  26. package/public/his/editor/vender/date97/calendar.js +4 -4
  27. package/public/his/editor/vender/date97/lang/en.js +13 -13
  28. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  29. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  30. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  31. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  32. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  33. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  34. package/public/his/editor/vender/diff.js +1627 -1627
  35. package/public/his/editor/vender/editor.js +1 -1
  36. package/public/his/editor/vender/fabric.js +31187 -31187
  37. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  38. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  39. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  40. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  41. package/public/his/editor/vender/mui/mui.min.css +4 -4
  42. package/public/his/editor/vender/mui/mui.min.js +5 -5
  43. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  44. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  45. package/public/his/editor/vender/qrcode.js +7 -7
  46. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  47. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  48. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  49. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  50. package/public/his/editor/vender/validator.js +5094 -5094
  51. package/public/his/editor/vender/weui/weui.css +5659 -5659
  52. package/public/his/editor/vender/weui/weui.min.css +4 -4
  53. package/public/his/editor/vender/weui/weui.min.js +11 -11
  54. package/public/index.html +27 -27
  55. package/src/App.vue +192 -192
  56. package/src/ReportView.js +19 -19
  57. package/src/assets/img/querySlotDemo.svg +15 -15
  58. package/src/assets/svg/badtwo.svg +1 -1
  59. package/src/assets/svg/goodtwo.svg +1 -1
  60. package/src/base-client/components/common/AMisRender/index.js +3 -3
  61. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  62. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +470 -470
  63. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  64. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  65. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  66. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  67. package/src/base-client/components/common/CitySelect/CitySelect.vue +342 -342
  68. package/src/base-client/components/common/CitySelect/index.js +3 -3
  69. package/src/base-client/components/common/CitySelect/index.md +109 -109
  70. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  71. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  72. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  73. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  74. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  75. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  76. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  77. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  78. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  79. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  80. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  81. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  82. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  83. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  84. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  85. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  86. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  87. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  88. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  89. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  90. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  91. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  92. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  93. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  94. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  95. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  96. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  97. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  98. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  99. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  100. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  101. package/src/base-client/components/common/Tree/index.js +2 -2
  102. package/src/base-client/components/common/Upload/Upload.vue +239 -239
  103. package/src/base-client/components/common/Upload/index.js +3 -3
  104. package/src/base-client/components/common/XAddForm/XAddForm.vue +107 -107
  105. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +868 -868
  106. package/src/base-client/components/common/XAddNativeForm/demo.vue +30 -30
  107. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  108. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  109. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  110. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  111. package/src/base-client/components/common/XAddReport/XAddReport.vue +207 -207
  112. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  113. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  114. package/src/base-client/components/common/XButtons/XButtons.vue +71 -71
  115. package/src/base-client/components/common/XButtons/index.js +3 -3
  116. package/src/base-client/components/common/XButtons/index.md +61 -61
  117. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  118. package/src/base-client/components/common/XConversation/XConversation.vue +140 -140
  119. package/src/base-client/components/common/XConversation/XConversationDemo.vue +28 -28
  120. package/src/base-client/components/common/XDataCard/XDataCard.vue +420 -420
  121. package/src/base-client/components/common/XDataCard/index.js +3 -3
  122. package/src/base-client/components/common/XDataCard/index.md +1 -1
  123. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  124. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  125. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  126. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +169 -169
  127. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +304 -304
  128. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  129. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  130. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  131. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  132. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  133. package/src/base-client/components/common/XForm/XForm.vue +340 -340
  134. package/src/base-client/components/common/XForm/XFormItem.vue +4 -3
  135. package/src/base-client/components/common/XForm/XTreeSelect.vue +250 -250
  136. package/src/base-client/components/common/XForm/index.md +178 -178
  137. package/src/base-client/components/common/XFormCol/XFormCol.vue +96 -96
  138. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +261 -261
  139. package/src/base-client/components/common/XFormGroup/demo.vue +45 -45
  140. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  141. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  142. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  143. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  144. package/src/base-client/components/common/XFormTable/XFormTable.vue +713 -713
  145. package/src/base-client/components/common/XFormTable/demo.vue +76 -76
  146. package/src/base-client/components/common/XFormTable/index.md +92 -92
  147. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +162 -162
  148. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  149. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  150. package/src/base-client/components/common/XReport/XReport.vue +892 -892
  151. package/src/base-client/components/common/XReport/XReportDemo.vue +304 -304
  152. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  153. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  154. package/src/base-client/components/common/XReport/XReportTrGroup.vue +808 -808
  155. package/src/base-client/components/common/XReport/index.js +3 -3
  156. package/src/base-client/components/common/XReport/index.md +44 -44
  157. package/src/base-client/components/common/XReport/print.js +186 -186
  158. package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +201 -201
  159. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  160. package/src/base-client/components/common/XReportGrid/XReport.vue +995 -959
  161. package/src/base-client/components/common/XReportGrid/XReportDemo.vue +42 -42
  162. package/src/base-client/components/common/XReportGrid/XReportDesign.vue +557 -557
  163. package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
  164. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +999 -999
  165. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  166. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  167. package/src/base-client/components/common/XReportGrid/print.js +184 -184
  168. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  169. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  170. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  171. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  172. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  173. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  174. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  175. package/src/base-client/components/common/XStepView/index.js +3 -3
  176. package/src/base-client/components/common/XStepView/index.md +31 -31
  177. package/src/base-client/components/common/XTab/XTab.vue +201 -201
  178. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  179. package/src/base-client/components/common/XTab/index.js +3 -3
  180. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  181. package/src/base-client/components/common/XTable/XTable.vue +1191 -1191
  182. package/src/base-client/components/common/XTable/index.md +255 -255
  183. package/src/base-client/components/common/XTree/XTree.vue +423 -423
  184. package/src/base-client/components/common/XTree/XTreePro.vue +434 -434
  185. package/src/base-client/components/common/XTree/index.js +3 -3
  186. package/src/base-client/components/common/XTree/index.md +36 -36
  187. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  188. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  189. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  190. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  191. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +203 -203
  192. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  193. package/src/base-client/components/index.js +51 -51
  194. package/src/base-client/components/layout/XPageView/RenderRow.vue +63 -63
  195. package/src/base-client/components/layout/XPageView/XErrorView.vue +11 -11
  196. package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
  197. package/src/base-client/components/layout/XPageView/index.js +3 -3
  198. package/src/base-client/components/layout/XPageView/index.md +38 -38
  199. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  200. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  201. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  202. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  203. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  204. package/src/base-client/plugins/AppData.js +121 -121
  205. package/src/base-client/plugins/Config.js +19 -19
  206. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  207. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  208. package/src/bootstrap.js +39 -39
  209. package/src/components/CodeMirror/inedx.vue +118 -118
  210. package/src/components/CodeMirror/setting.js +40 -40
  211. package/src/components/FilePreview/FilePreview.vue +166 -166
  212. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  213. package/src/components/STable/index.js +380 -380
  214. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  215. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  216. package/src/components/exception/ExceptionPage.vue +70 -70
  217. package/src/components/menu/SideMenu.vue +75 -75
  218. package/src/components/menu/menu.js +273 -273
  219. package/src/components/tool/AStepItem.vue +60 -60
  220. package/src/config/default/antd.config.js +89 -89
  221. package/src/config/default/setting.config.js +55 -55
  222. package/src/font-style/font.css +4 -4
  223. package/src/layouts/CommonLayout.vue +56 -56
  224. package/src/layouts/GridView.vue +45 -45
  225. package/src/layouts/PageLayout.vue +151 -151
  226. package/src/layouts/SinglePageView.vue +136 -136
  227. package/src/layouts/header/AdminHeader.vue +132 -132
  228. package/src/layouts/header/HeaderNotice.vue +177 -177
  229. package/src/layouts/tabs/TabsHead.vue +189 -189
  230. package/src/layouts/tabs/TabsView.vue +389 -389
  231. package/src/lib.js +1 -1
  232. package/src/main.js +30 -30
  233. package/src/mock/extend/index.js +84 -84
  234. package/src/mock/goods/index.js +108 -108
  235. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  236. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  237. package/src/pages/DefaultExample/index.vue +77 -77
  238. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  239. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  240. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  241. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  242. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  243. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  244. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  245. package/src/pages/DynamicStatistics/index.vue +282 -282
  246. package/src/pages/Example/childIndex.vue +15 -15
  247. package/src/pages/Example/index.vue +30 -30
  248. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  249. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  250. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  251. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  252. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  253. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  254. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  255. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  256. package/src/pages/Recording/index.vue +76 -0
  257. package/src/pages/ReportGrid/index.vue +76 -76
  258. package/src/pages/ServiceReview/index.vue +284 -284
  259. package/src/pages/SubExample/index.vue +26 -26
  260. package/src/pages/WorkflowDetail/WorkFlowDemo.vue +32 -32
  261. package/src/pages/WorkflowDetail/WorkflowDetail.vue +230 -230
  262. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +131 -131
  263. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  264. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformation.vue +302 -302
  265. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformationDetails.vue +276 -276
  266. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +864 -864
  267. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandleReso.vue +997 -997
  268. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +222 -222
  269. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkOrderParentDetails.vue +233 -233
  270. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowDetailResso.vue +261 -261
  271. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowListResolution.vue +248 -248
  272. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +73 -73
  273. package/src/pages/XPageViewExample/index.vue +38 -38
  274. package/src/pages/XReportView/index.vue +64 -64
  275. package/src/pages/XTreeOneProExample/index.vue +67 -67
  276. package/src/pages/login/Login.vue +378 -378
  277. package/src/pages/login/LoginV3.vue +389 -389
  278. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  279. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  280. package/src/pages/resourceManage/orgListManage.vue +98 -98
  281. package/src/pages/system/dictionary/index.vue +44 -44
  282. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  283. package/src/pages/system/monitor/operLog/index.vue +37 -37
  284. package/src/pages/system/settings/modifyPassword.vue +117 -117
  285. package/src/pages/system/ticket/index.vue +480 -480
  286. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  287. package/src/plugins/EventLogPlugin.js +33 -33
  288. package/src/plugins/FindParentsData.js +17 -17
  289. package/src/router/async/config.async.js +1 -0
  290. package/src/router/async/router.map.js +183 -183
  291. package/src/router/guards.js +263 -263
  292. package/src/router/index.js +27 -27
  293. package/src/router.js +19 -19
  294. package/src/services/api/TicketDetailsViewApi.js +46 -46
  295. package/src/services/api/cas.js +79 -79
  296. package/src/services/api/common.js +329 -329
  297. package/src/services/api/entity.js +18 -18
  298. package/src/services/api/index.js +17 -17
  299. package/src/services/api/restTools.js +67 -67
  300. package/src/services/api/workFlow.js +63 -63
  301. package/src/services/apiService.js +15 -15
  302. package/src/services/user.js +90 -90
  303. package/src/services/v3Api.js +116 -116
  304. package/src/store/modules/account.js +115 -115
  305. package/src/store/modules/index.js +5 -5
  306. package/src/store/modules/lowCode.js +33 -33
  307. package/src/store/modules/setting.js +119 -119
  308. package/src/theme/default/style.less +58 -58
  309. package/src/theme/global.less +159 -159
  310. package/src/utils/authority-utils.js +85 -85
  311. package/src/utils/errorCode.js +6 -6
  312. package/src/utils/formatter.js +74 -74
  313. package/src/utils/htmlToPDF.js +108 -108
  314. package/src/utils/htmlToPDFApi.js +5 -5
  315. package/src/utils/indexedDB.js +263 -263
  316. package/src/utils/login.js +188 -188
  317. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  318. package/src/utils/lowcode/lowcodeLog.js +29 -29
  319. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  320. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  321. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  322. package/src/utils/map-utils.js +47 -47
  323. package/src/utils/microAppUtils.js +40 -40
  324. package/src/utils/reg.js +95 -95
  325. package/src/utils/request.js +362 -362
  326. package/src/utils/routerUtil.js +450 -450
  327. package/src/utils/runEvalFunction.js +14 -14
  328. package/src/utils/util.js +313 -313
  329. package/src/utils/waterMark.js +31 -31
  330. package/test/Amis.spec.js +163 -163
  331. package/test/Tree.spec.js +167 -167
  332. package/test/myDialog.spec.js +46 -46
  333. package/test/util.test.js +36 -36
  334. package/test/v3Api.test.js +1983 -1983
  335. package/vue.config.js +199 -199
  336. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
  337. /package/src/base-client/components/common/Recording/{Recoding.vue → Recording.vue} +0 -0
@@ -1,959 +1,995 @@
1
- <template>
2
- <div>
3
- <!-- 骨架屏 -->
4
- <a-card v-if="showSkeleton">
5
- <a-skeleton active/>
6
- </a-card>
7
- <template v-if="noPadding">
8
- <!-- 主体表格 -->
9
- <XReportDesign
10
- @updateImg="updateImg"
11
- @selectRow="selectRow"
12
- v-if="scanFinish"
13
- :show-img-in-cell="showImgInCell"
14
- :img-prefix="imgPrefix"
15
- :use-oss-for-img="useOssForImg"
16
- :display-only="displayOnly"
17
- :config="type === 'display' ? originalConfig : activeConfig"
18
- :slot-config-name="type === 'display' ? undefined : activatedSlotName"
19
- :for-display="type === 'display'"
20
- ref="XReportDesign"
21
- id="printReady"
22
- :server-name="serverName"
23
- :env="env"
24
- :show-title="showTitle"
25
- :no-padding="noPadding"
26
- :no-top-border="noTopBorder"
27
- :show-images="hasImages"
28
- :image-list="imageList">
29
- </XReportDesign>
30
- </template>
31
- <template v-else>
32
- <!-- 用以包裹整个页面 -->
33
- <div v-if="!showSkeleton">
34
- <!-- 切换菜单 -->
35
- <a-radio-group
36
- v-model="type"
37
- default-value="a"
38
- button-style="solid"
39
- @change="tabChanged"
40
- v-show="!onlyDisplay && editMode">
41
- <a-radio-button value="design" v-if="!onlyDisplay">
42
- 设计
43
- </a-radio-button>
44
- <a-radio-button value="display" style="border-radius: 0">
45
- 预览
46
- </a-radio-button>
47
- </a-radio-group>
48
- <a-radio-button @click="saveConfig" style="border-radius: 0 4px 4px 0" v-if="showSaveButton">
49
- 保存
50
- </a-radio-button>
51
- <!-- 主体表格 -->
52
- <XReportDesign
53
- v-if="scanFinish"
54
- @updateImg="updateImg"
55
- @selectRow="selectRow"
56
- :show-img-in-cell="showImgInCell"
57
- :img-prefix="imgPrefix"
58
- :use-oss-for-img="useOssForImg"
59
- :display-only="displayOnly"
60
- :config="type === 'display' ? originalConfig : activeConfig"
61
- :slot-config-name="type === 'display' ? undefined : activatedSlotName"
62
- :for-display="type === 'display'"
63
- :no-padding="noPadding"
64
- :no-top-border="noTopBorder"
65
- :show-title="showTitle"
66
- ref="XReportDesign"
67
- id="printReady"
68
- :server-name="serverName"
69
- :env="env"
70
- :show-images="hasImages"
71
- :image-list="imageList">
72
- </XReportDesign>
73
- </div>
74
- </template>
75
- <!-- 弹出框 -->
76
- <x-add-report
77
- :env="env"
78
- ref="xAddReport"
79
- />
80
- <!-- 弹出框 -->
81
- <x-report-drawer
82
- :env="env"
83
- ref="xReportDrawer"
84
- />
85
- </div>
86
- </template>
87
-
88
- <script>
89
- // 转PDF用
90
- import HtmlToPdf from '@vue2-client/utils/htmlToPDF'
91
- import { mapState } from 'vuex'
92
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
93
- import XReportDesign from './XReportDesign.vue'
94
- import { printElement } from './print'
95
- // import XAddReport from '@vue2-client/base-client/components/common/XAddReport'
96
-
97
- export default {
98
- name: 'XReport',
99
- props: {
100
- files: {
101
- type: Array,
102
- default: () => {
103
- return []
104
- }
105
- },
106
- // 控制用户权限,user和admin
107
- authority: {
108
- type: String,
109
- default: 'user'
110
- },
111
- // 是否为编辑模式
112
- editMode: {
113
- type: Boolean,
114
- default: true
115
- },
116
- // 配置名
117
- configName: {
118
- type: String,
119
- required: true
120
- },
121
- // 插槽名
122
- activatedSlotName: {
123
- type: String,
124
- default: undefined
125
- },
126
- // 本地配置,调试用
127
- localConfig: {
128
- type: Object,
129
- default: undefined
130
- },
131
- // 兼容老版本配置
132
- dontFormat: {
133
- type: Boolean,
134
- default: true
135
- },
136
- showImgInCell: {
137
- type: Boolean,
138
- default: false
139
- },
140
- // 数据
141
- configData: {
142
- type: Object,
143
- default: undefined
144
- },
145
- // 命名空间
146
- serverName: {
147
- type: String,
148
- default: process.env.VUE_APP_SYSTEM_NAME
149
- },
150
- // 环境
151
- env: {
152
- type: String,
153
- default: 'prod'
154
- },
155
- // 只做展示
156
- displayOnly: {
157
- type: Boolean,
158
- default: true
159
- },
160
- // 表格没有边距
161
- noPadding: {
162
- type: Boolean,
163
- default: false
164
- },
165
- // 表格没有上边框,与noPadding搭配可以实现连续表格
166
- noTopBorder: {
167
- type: Boolean,
168
- default: false
169
- },
170
- // 是否展示标题
171
- showTitle: {
172
- type: Boolean,
173
- default: true
174
- },
175
- // 是否展示保存按钮
176
- showSaveButton: {
177
- type: Boolean,
178
- default: false
179
- },
180
- // 是否将组件注册到外层提供的容器中,方便外侧统一保存
181
- registerMap: {
182
- type: Array,
183
- default: undefined
184
- },
185
- // 图片是否使用OSS来保存
186
- useOssForImg: {
187
- type: Boolean,
188
- default: true
189
- },
190
- // 图片上传后添加前缀
191
- imgPrefix: {
192
- type: String,
193
- default: undefined
194
- }
195
- },
196
- components: {
197
- XAddReport: () => import('@vue2-client/base-client/components/common/XAddReport'),
198
- XReportDrawer: () => import('@vue2-client/base-client/components/common/XReportDrawer'),
199
- XReportDesign
200
- },
201
- data () {
202
- return {
203
- // 控制骨架屏显隐
204
- showSkeleton: true,
205
- // 配置
206
- config: undefined,
207
- // 当前显示模式,编辑模式,预览模式
208
- type: 'design',
209
- // 仅供展示,不可编辑
210
- onlyDisplay: false,
211
- // 每行最大列数,非必要请勿更改,现在的设计器完全是基于每行12列来设计的
212
- maxColSpan: 12,
213
- // 定义是否完成配置的扫描,未完成不要渲染子组件
214
- scanFinish: false,
215
- // 当前激活的配置文件
216
- activeConfig: null,
217
- // 原始配置文件
218
- // 用于展示。某些情况下“设计页”中的内容仅为“预览页”表格其中的一部分
219
- originalConfig: null,
220
- // 扫描到的配置
221
- configFromWeb: {},
222
- // 用于获取配置的锁
223
- timer: undefined,
224
- // 是否包含图片
225
- hasImages: false,
226
- // 图片列表
227
- imageList: [],
228
- // 保存最原始的数据,用于判断哪些数据被更改了
229
- dataCache: undefined,
230
- // 判断哪些数据被更改了,存储对应的key
231
- diff: [],
232
- }
233
- },
234
- beforeDestroy () {
235
- clearInterval(this.timer)
236
- },
237
- watch: {
238
- // 如果配置名更改了,重新获取配置
239
- configName (val) {
240
- if (val) {
241
- getConfigByName(this.configName, undefined, res => {
242
- this.config = res
243
- this.configInit()
244
- }, this.env === 'dev')
245
- }
246
- },
247
- // 如果本地配置更改了,重新初始化
248
- localConfig: {
249
- deep: true,
250
- immediate: true,
251
- handler (val) {
252
- if (val) {
253
- this.config = val
254
- this.configInit()
255
- }
256
- }
257
- },
258
- },
259
- provide () {
260
- return {
261
- runLogic: runLogic,
262
- openDialog: this.openDialog,
263
- registerComponent: this.registerComponent,
264
- getComponentByName: this.getComponentByName,
265
- getParentComponentByName: this.getComponentByName,
266
- getConfigByName: getConfigByName,
267
- currUser: this.currUser
268
- }
269
- },
270
- methods: {
271
- // 把组件注册到refs中,方便调用
272
- registerComponent (componentName, component) {
273
- console.log('内部注册', this.$options.name, componentName)
274
- this.$refs[componentName] = component
275
- console.log('内部注册完成', this.$refs)
276
- },
277
- // 根据名字从注册到组件中获取组件
278
- getComponentByName (componentName) {
279
- console.log('内部取组件', this.$options.name, componentName)
280
- console.log('内部组件内容', this.$refs)
281
- return this.$refs[componentName]
282
- },
283
- /**
284
- * @param configName 栅格配置名称
285
- * @param selectedId 选中得id
286
- * @param mixinData 需要混入得数据
287
- * @param outEnv 其他传递给打开窗口的数据
288
- * @param attr 传递给Modal弹框用的信息
289
- */
290
- openDialog (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
291
- console.log('openDialog', configName, selectedId)
292
- this.$refs.xAddReport.init({
293
- configName: configName,
294
- selectedId: selectedId,
295
- mixinData: mixinData,
296
- outEnv: outEnv,
297
- attr
298
- })
299
- },
300
- openDrawer (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
301
- console.log('openDialog', configName, selectedId)
302
- this.$refs.xReportDrawer.init({
303
- configName,
304
- selectedId,
305
- mixinData,
306
- outEnv,
307
- attr
308
- })
309
- },
310
- // 向外暴露图片修改后的数据,某些外部需要自己管理图片的保存与修改
311
- updateImg (data) {
312
- this.$emit('updateImg', data)
313
- },
314
- // 导出数据,某些外部需要统一控制数据的变动
315
- exportData () {
316
- // 获取当前修改后的数据
317
- let tempData
318
- if (this.activeConfig === undefined || this.activeConfig === null) {
319
- tempData = this.originalConfig.data
320
- } else {
321
- const tempDataKeys = Object.keys(this.activeConfig.tempData)
322
- tempDataKeys.forEach(key => {
323
- this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
324
- })
325
- tempData = this.activeConfig.data
326
- }
327
- // 对比数据的差异
328
- this.diff = []
329
- this.compareProps(tempData, this.dataCache)
330
- this.diff.forEach(eachDiff => {
331
- const arr = eachDiff.split('.')
332
- let targetData = tempData[arr[0]]
333
- if (arr.length !== 1) {
334
- for (let i = 1; i < arr.length - 1; i++) {
335
- const path = arr[i]
336
- targetData = targetData[path]
337
- }
338
- }
339
- // 将修改的数据,添加update = true属性
340
- targetData.update = true
341
- })
342
- return tempData
343
- },
344
- // 对比两个obj有哪里不同
345
- compareProps (obj1, obj2, path = '') {
346
- for (const key in obj1) {
347
- // 如果一个是undefined
348
- if (typeof obj2[key] === 'undefined') {
349
- this.diff.push(path + key)
350
- // 如果是数组长度不一样
351
- } else if (Array.isArray(obj1) && Array.isArray(obj2)) {
352
- if (obj1[key].length !== obj2[key].length) {
353
- this.diff.push(path + key)
354
- }
355
- // 如果都是对象,并且存在同样的key,递归子key
356
- } else if (typeof obj1[key] === 'object' && typeof obj2[key] === 'object') {
357
- this.compareProps(obj1[key], obj2[key], path + key + '.')
358
- // 如果不是obj,对比其数据
359
- } else if (obj1[key] !== obj2[key]) {
360
- this.diff.push(path + key)
361
- }
362
- }
363
- },
364
- selectRow (selectedRowKeys, selectedRows) {
365
- this.table_selectedRowKeys = selectedRowKeys
366
- this.table_selectedRows = selectedRows
367
- console.log('')
368
- this.$emit('selectRow', selectedRowKeys, selectedRows)
369
- },
370
- // 注册组件到$refs中
371
- registerComponentToRefs (componentName, component) {
372
- this.$refs[componentName] = component
373
- },
374
-
375
- // 正常的保存方法,当前修改内容会直接全部导出到外部
376
- saveConfig () {
377
- if (this.activeConfig === undefined || this.activeConfig === null) {
378
- return this.originalConfig.data
379
- } else {
380
- const tempDataKeys = Object.keys(this.activeConfig.tempData)
381
- tempDataKeys.forEach(key => {
382
- this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
383
- })
384
- this.$emit('saveConfig', this.$refs.XReportDesign.activatedConfig)
385
- }
386
- },
387
- // 通过@@@分割临时变量,找到对应的key,并修改它的值
388
- changeDeepObject (obj, strPath, newVal) {
389
- const arr = strPath.split('@@@')
390
- if (obj[arr[0]] === undefined) {
391
- obj = obj.images
392
- }
393
- if (arr.length === 1) {
394
- obj[arr[0]] = newVal
395
- } else {
396
- let result = obj[arr[0]]
397
- arr.shift()
398
- while (arr.length > 1) {
399
- result = result[arr[0]]
400
- arr.shift()
401
- }
402
- if (result) {
403
- result[arr[0]] = newVal
404
- }
405
- }
406
- },
407
- // 检查slot是否在配置文件中包含,如果没有包含,则视为非法获取
408
- checkSlotDefine (config) {
409
- const slotsDeclare = config.slotsDeclare
410
- const total = slotsDeclare.length
411
- let count = 0
412
- slotsDeclare.forEach(declare => {
413
- config.columns.forEach(row => {
414
- row.forEach(cell => {
415
- if (cell.slotConfig === declare) {
416
- count++
417
- }
418
- })
419
- })
420
- })
421
-
422
- return count === total
423
- },
424
- // 切换了标签页
425
- tabChanged (key) {
426
- this.scanFinish = false
427
- this.originalConfig.data = { ...this.originalConfig.data, ...this.config.data }
428
- this.config.data = this.originalConfig.data
429
- if (this.type === 'display') {
430
- const tempDataKeys = Object.keys(this.activeConfig.tempData)
431
- tempDataKeys.forEach(key => {
432
- this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
433
- })
434
- let count = 0
435
- this.imageList = []
436
- const keys = Object.keys(this.config.data.images)
437
- keys.forEach(key => {
438
- if (this.config.data.images[key].length > 0) {
439
- this.imageList = [...this.imageList, ...this.config.data.images[key]]
440
- count++
441
- }
442
- })
443
- this.hasImages = count > 0
444
- } else {
445
- this.hasImages = false
446
- }
447
- this.$nextTick(() => {
448
- this.scanFinish = true
449
- })
450
- },
451
- // 获取当前日期,为保存文件命名用
452
- getDate () {
453
- const currentDate = new Date()
454
-
455
- const year = currentDate.getFullYear()
456
- const month = String(currentDate.getMonth() + 1).padStart(2, '0')
457
- const day = String(currentDate.getDate()).padStart(2, '0')
458
-
459
- const formattedDate = `${year}_${month}_${day}`
460
-
461
- return formattedDate
462
- },
463
- // 打印
464
- printDocument () {
465
- // x-report
466
- const printContent = window.rawDocument.getElementById('printReady')
467
- printElement(printContent)
468
- this.$message.success('操作成功!')
469
- },
470
- // 导出PDF
471
- exportPDF () {
472
- const date = this.getDate()
473
- let title = this.config.title
474
- title = title.replace(/<[^>]+>/g, '')
475
- const fileName = date + '' + title
476
- HtmlToPdf.getPdf(fileName, '#printReady')
477
- },
478
- // 用于分割配置中的colums,将需要处理的数组提取出来
479
- formatConfigRow () {
480
- for (let i = 0; i < this.config.columns.length; i++) {
481
- // 对原始数组进行递归,依次将该位置拆分为三个部分,当前处理位置之前的,当前处理位置,当前处理位置之后的
482
- const before = this.config.columns.slice(0, i)
483
- const after = this.config.columns.slice(i + 1, this.config.columns.length)
484
-
485
- // 将当前处理的数组交给处理的方法
486
- const x = this.checkRow(this.config.columns[i])
487
-
488
- const newArr = []
489
-
490
- // 拼接之前的数组
491
- if (before.length > 0) {
492
- if (before.length >= 1) {
493
- before.forEach(item => {
494
- newArr.push(item)
495
- })
496
- } else {
497
- newArr.push(before)
498
- }
499
- }
500
-
501
- // 拼接不需要更改当前节点处理完成的数组
502
- newArr.push(x.old)
503
-
504
- // 如果处理了新加的数据,拼接
505
- if (x.add.length > 0) {
506
- for (let j = 0; j < x.add.length; j++) {
507
- if (x.add[j]) {
508
- newArr.push(x.add[j])
509
- i++
510
- }
511
- }
512
- }
513
-
514
- // 拼接之后的数组
515
- if (after.length > 0) {
516
- if (after.length >= 1) {
517
- after.forEach(item => {
518
- newArr.push(item)
519
- })
520
- } else {
521
- newArr.push(after)
522
- }
523
- }
524
-
525
- this.config.columns = newArr
526
- }
527
- },
528
- // 路径中含有@@@的key,将其解析,并返回其数据
529
- getDeepObject (obj, strPath) {
530
- const arr = strPath.split('@@@')
531
- let result = obj[arr[0]]
532
- arr.shift()
533
- try {
534
- while (arr.length > 0) {
535
- result = result[arr[0]]
536
- arr.shift()
537
- }
538
- } catch (e) {
539
- result = undefined
540
- }
541
- return result
542
- },
543
- // 处理colums数组,为声明了rowspan的单元格,自动匹配格式
544
- checkRow (rowArr) {
545
- // 不需要更改的数据
546
- const original = []
547
- // 需要更改新加的数据
548
- const addArr = []
549
- // 统计rowspan出现的总和
550
- let count = 0
551
- // 统计声明列需要的rowspan总数
552
- let total = 0
553
- // 是否为声明行
554
- let titleCellFlag = false
555
- // 是否为声明行后第一行
556
- let firstSubLine = false
557
- // 需要处理的行,新的index值
558
- let subRowIndex = 0
559
- // 新生成的行,临时存储
560
- const waitForAddArr = []
561
- // 用于记录声明行的colspan避免格式错误
562
- let preColSpan = 0
563
- // 用于统计循环次数,判断是否是最后一次
564
- let forEachCount = 0
565
-
566
- // 标记所有数据
567
- rowArr.forEach(cell => {
568
- forEachCount++
569
- // 如果该行没有rowspan则默认其为1,不要影响统计结果
570
- if (!cell.rowSpan) {
571
- cell.rowSpan = 0
572
- }
573
-
574
- if (cell.text && total !== 0) { // 如果遇到了下一个声明行,证明rowspan少了一行,需要补充一个占位格
575
- const nullObj = {
576
- type: 'placeHolderColumn',
577
- order: subRowIndex,
578
- noBoarder: true,
579
- needSplit: true,
580
- colSpan: preColSpan,
581
- dontShowRow: true
582
- }
583
- subRowIndex++
584
- waitForAddArr.push(nullObj)
585
- total = 0
586
- count = 0
587
- titleCellFlag = false
588
- firstSubLine = false
589
- } else if ((total !== count + cell.rowSpan) && forEachCount === rowArr.length) {
590
- // 如果没有遇到了下一个声明行,但已经是当前行最后一个数据,也证明rowspan少了一行,需要补充一个占位格
591
- const nullObj = {
592
- type: 'placeHolderColumn',
593
- order: subRowIndex,
594
- noBoarder: true,
595
- needSplit: true,
596
- colSpan: preColSpan,
597
- dontShowRow: true
598
- }
599
- subRowIndex++
600
- waitForAddArr.push(nullObj)
601
- total = 0
602
- count = 0
603
- titleCellFlag = false
604
- firstSubLine = false
605
- }
606
-
607
- // 判断是否为声明行
608
- if (cell.text && total === 0) {
609
- // 将声明行声明的rowspan作为总数,判断下方rowspan相加是否等于声明行声明的数量
610
- total = cell.rowSpan
611
- titleCellFlag = false
612
- firstSubLine = true
613
- subRowIndex = 1
614
- cell.show = true
615
- cell.showRowSpan = total
616
- } else if (cell.rowSpan > 0 && !titleCellFlag && firstSubLine) { // 判断是否为声明行后首行,因为首行不需要移动
617
- count += cell.rowSpan
618
- firstSubLine = false
619
- cell.noBoarder = true
620
- cell.show = true
621
- cell.showRowSpan = total
622
- } else if (cell.rowSpan > 0 && !titleCellFlag && !firstSubLine) { // 既非声明行,也非首行,需要移动
623
- count += cell.rowSpan
624
- // cell.type = 'notShow'
625
- cell.needSplit = true
626
- cell.order = subRowIndex
627
- cell.dontShowRow = true
628
- subRowIndex++
629
-
630
- // 如果之前添加过空行补充位置,刚好最后一位还有内容,将其互换
631
- if (forEachCount === rowArr.length && !waitForAddArr[waitForAddArr.length - 1].dataIndex) {
632
- waitForAddArr[waitForAddArr.length - 1].order += 1
633
- cell.order -= 1
634
- waitForAddArr.push(cell)
635
- } else {
636
- waitForAddArr.push(cell)
637
- }
638
- }
639
-
640
- // 如果count和total相等了,证明已经处理完成。将计数器还原
641
- if (count === total) {
642
- total = 0
643
- count = 0
644
- titleCellFlag = false
645
- firstSubLine = false
646
- }
647
- // 保存上一个的colspan,保持生成的格子与原格式一致
648
- preColSpan = cell.colSpan
649
- })
650
-
651
- // 将所有不需要移动的放入original
652
- rowArr.forEach(cell => {
653
- if (cell.needSplit !== true) {
654
- original.push(cell)
655
- }
656
- })
657
-
658
- // 增加新的数组
659
- waitForAddArr.forEach(cell => {
660
- const target = cell.order
661
- // if (cell.type === 'notShow') {
662
- // cell.type = 'inputs'
663
- // }
664
- cell.noBoarder = true
665
- if (addArr[target] === undefined) {
666
- const temp = []
667
- temp.push(cell)
668
- addArr[target] = temp
669
- } else if (addArr[target].length > 0) {
670
- addArr[target].push(cell)
671
- }
672
- })
673
-
674
- // 如果没有新增,将单元格边框设置为显示
675
- if (addArr.length < 1) {
676
- original.forEach(cell => {
677
- if (cell.type === 'input' || cell.type === 'inputs') {
678
- cell.noBoarder = false
679
- }
680
- })
681
- }
682
-
683
- return {
684
- old: original,
685
- add: addArr
686
- }
687
- },
688
- // 扫描配置,如果有插槽则拼接插槽
689
- scanConfigSlot (config) {
690
- const columnsArr = config.columns
691
- for (let i = 0; i < columnsArr.length; i++) {
692
- for (let j = 0; j < columnsArr[i].length; j++) {
693
- // 如果发现type为slot,开始匹配对应的slot配置文件
694
- if (columnsArr[i][j].type === 'slot') {
695
- const targetName = columnsArr[i][j].slotConfig
696
- // 找不到目标插槽配置
697
- if (!this.configFromWeb[targetName] || !this.configFromWeb[targetName].columns) {
698
- console.error('无法找到目标插槽的配置!')
699
- return
700
- }
701
-
702
- // 替换columns,合并data
703
- config.columns[i] = []
704
- const before = config.columns.slice(0, i)
705
- let after = config.columns.slice(i + 1, config.columns.length)
706
-
707
- const addArr = []
708
- for (let k = 0; k < this.configFromWeb[targetName].columns.length; k++) {
709
- const temp = []
710
- this.configFromWeb[targetName].columns[k].forEach(cell => {
711
- temp.push(cell)
712
- })
713
- addArr.push(temp)
714
- }
715
-
716
- const newArr = []
717
- // 拼接之前的数组
718
- if (before.length > 0) {
719
- if (before.length >= 1) {
720
- before.forEach(item => {
721
- newArr.push(item)
722
- })
723
- } else {
724
- newArr.push(before)
725
- }
726
- }
727
-
728
- addArr.forEach(arr => {
729
- newArr.push(arr)
730
- })
731
-
732
- // 拼接之后的数组
733
- if (after.length === 1) {
734
- if (after[0].type === 'slot' || after[0][0].type === 'slot') {
735
- after = []
736
- }
737
- }
738
- if (after.length > 0) {
739
- if (after.length >= 1) {
740
- after.forEach(item => {
741
- newArr.push(item)
742
- })
743
- } else {
744
- newArr.push(after)
745
- }
746
- }
747
-
748
- config.columns = newArr
749
- if (this.configFromWeb[targetName].slotsDeclare) {
750
- config.slotsDeclare = this.configFromWeb[targetName].slotsDeclare
751
- } else {
752
- config.slotsDeclare = []
753
- }
754
-
755
- if (config.data.images && this.configFromWeb[targetName].data.images) {
756
- config.data.images = { ...config.data.images, ...this.configFromWeb[targetName].data.images }
757
- delete this.configFromWeb[targetName].data.images
758
- }
759
- config.data = { ...config.data, ...this.configFromWeb[targetName].data }
760
- }
761
- }
762
- }
763
- this.config = config
764
- },
765
- // 扫描所有插槽名
766
- scanConfigName (config, resut) {
767
- if (config.slotsDeclare) {
768
- config.slotsDeclare.forEach(name => {
769
- resut.push(name)
770
- })
771
- }
772
- },
773
- // 获取插槽
774
- getConfigAndJoin (config, outerLock) {
775
- // 检查主配置插槽声明是否合法
776
- const check = this.checkSlotDefine(config)
777
- const waitForDownloadSlotName = []
778
- if (check) {
779
- // 扫描主配置中声明的插槽名
780
- this.scanConfigName(config, waitForDownloadSlotName)
781
-
782
- const total = waitForDownloadSlotName.length
783
- let count = 0
784
-
785
- // 挨个获取插槽
786
- waitForDownloadSlotName.forEach(configName => {
787
- getConfigByName(configName, this.serverName, res => {
788
- this.configFromWeb[configName] = res
789
- count++
790
- }, this.env === 'dev')
791
- })
792
-
793
- // 使用定时器循环判断锁状态,用于多个插槽,要等待统一获取完成之后,再进行下一步初始化
794
- const timer = setInterval(() => {
795
- console.log('插槽下载进度,当前:' + count + '/' + total)
796
- if (count >= total) {
797
- clearInterval(timer)
798
- this.scanConfigSlot(config)
799
- if (config.slotsDeclare.length > 0) {
800
- const lock = { status: true }
801
- this.getConfigAndJoin(config, lock)
802
- const innerTimer = setInterval(() => {
803
- if (!lock.status) {
804
- clearInterval(innerTimer)
805
- outerLock.status = false
806
- }
807
- }, 100)
808
- } else {
809
- outerLock.status = false
810
- }
811
- }
812
- }, 100)
813
- } else {
814
- console.error('插槽配置有误!')
815
- outerLock.status = false
816
- }
817
- },
818
- // 获取配置之后的初始化
819
- configInit () {
820
- console.log('拼接完成', this.config)
821
- // 将初始化好的配置拷贝一份留存
822
- this.originalConfig = Object.assign({}, this.config)
823
- if (!this.dontFormat) {
824
- // 扫描配置文件中有没有rowSpan,进行格式化调整
825
- this.formatConfigRow(this.config)
826
- }
827
- this.activeConfig = this.config
828
- this.showSkeleton = false
829
- // 判断是否有动态Index
830
- this.activeConfig.columns.forEach(row => {
831
- row.forEach(cell => {
832
- if (cell.dynamicDataIndex === true) {
833
- // 如果有动态index,取其函数,运行函数得到真实index保存
834
- // eslint-disable-next-line no-eval
835
- const func = eval('(' + cell.customFunctionForDynamicDataIndex + ')')
836
- cell.dataIndex = func(this.config)
837
- }
838
- // 处理 自定义函数的旧逻辑
839
- if (['action', 'click'].includes(cell.eventType) && cell.customFunction && !cell.events) {
840
- cell.events = []
841
- cell.events.push({
842
- type: cell.eventType,
843
- customFunction: cell.customFunction
844
- })
845
- }
846
- })
847
- })
848
- // 将数据复制到临时数据中,带有@@@的数据,我们将其整体作为一个key保存,当编辑完成后,再将其解析,回填到需要的数据中
849
- this.activeConfig.tempData = {}
850
- // 是否有@@@深层引用
851
- this.activeConfig.columns.forEach(row => {
852
- row.forEach(cell => {
853
- // 将@@@解析
854
- if (cell.dataIndex !== undefined && cell.dataIndex.indexOf('@@@') !== -1) {
855
- this.activeConfig.tempData[cell.dataIndex] = this.getDeepObject(this.activeConfig.data, cell.dataIndex)
856
- }
857
- })
858
- })
859
- this.$nextTick(() => {
860
- this.scanFinish = true
861
- })
862
- },
863
- // 初始化JSON配置
864
- jsonConfigInit () {
865
- if (this.configData === undefined) {
866
- console.error('未找到数据!')
867
- } else {
868
- this.originalConfig = Object.assign({}, this.config)
869
- this.originalConfig.data = JSON.parse(JSON.stringify(this.configData))
870
- this.type = 'display'
871
- // this.onlyDisplay = true
872
- this.showSkeleton = false
873
- this.$nextTick(() => {
874
- this.scanFinish = true
875
- })
876
- }
877
- },
878
- onSubmit () {
879
- console.log('this.table_selectedRowKeys', this.table_selectedRowKeys)
880
- console.log('this.table_selectedRows', this.table_selectedRows)
881
- },
882
- },
883
- beforeMount () {
884
- // 如果只是展示
885
- if (this.displayOnly) {
886
- this.onlyDisplay = true
887
- this.type = 'display'
888
- }
889
- // 如果有本地配置,优先使用本地配置
890
- if (this.localConfig) {
891
- // 如果配置是json渲染器
892
- if (this.localConfig.designMode === 'json') {
893
- this.config = this.localConfig
894
- if (this.configData !== undefined) {
895
- this.config.data = this.configData
896
- }
897
- this.jsonConfigInit()
898
- } else {
899
- // 如果配置是普通渲染器
900
- this.config = this.localConfig
901
- if (this.configData !== undefined) {
902
- this.config.data = this.configData
903
- }
904
- if (this.config.data.images === undefined) {
905
- this.config.data.images = {}
906
- }
907
- this.configInit()
908
- }
909
- } else {
910
- // 如果本地配置没有值,则从琉璃中获取
911
- getConfigByName(this.configName, this.serverName, res => {
912
- this.config = res
913
- if (this.config.designMode === 'json') {
914
- if (this.configData !== undefined) {
915
- this.config.data = this.configData
916
- }
917
- this.jsonConfigInit()
918
- } else {
919
- if (this.configData !== undefined) {
920
- this.config.data = this.configData
921
- }
922
- if (this.config.data.images === undefined) {
923
- this.config.data.images = {}
924
- }
925
- this.configInit()
926
- }
927
- }, this.env === 'dev')
928
- }
929
- },
930
- computed: {
931
- ...mapState('account', { currUser: 'user' })
932
- },
933
- mounted () {
934
- // 如果外界传来了registerMap,我们将本VM对象注册到map中
935
- if (this.registerMap !== undefined) {
936
- this.registerMap.push(this)
937
- }
938
- // 将原始数据备份保存
939
- if (this.configData) {
940
- this.dataCache = JSON.parse(JSON.stringify(this.configData))
941
- } else {
942
- if (this.config?.data) {
943
- this.dataCache = JSON.parse(JSON.stringify(this.config.data))
944
- }
945
- }
946
- }
947
- }
948
- </script>
949
-
950
- <style lang="less" scoped>
951
- .tools {
952
- text-align: center;
953
- cursor: pointer;
954
-
955
- .toolsItem {
956
- display: inline-block;
957
- }
958
- }
959
- </style>
1
+ <template>
2
+ <div>
3
+ <!-- 骨架屏 -->
4
+ <a-card v-if="showSkeleton">
5
+ <a-skeleton active/>
6
+ </a-card>
7
+ <template v-if="noPadding">
8
+ <!-- 主体表格 -->
9
+ <XReportDesign
10
+ @updateImg="updateImg"
11
+ @selectRow="selectRow"
12
+ v-if="scanFinish"
13
+ :show-img-in-cell="showImgInCell"
14
+ :img-prefix="imgPrefix"
15
+ :use-oss-for-img="useOssForImg"
16
+ :display-only="displayOnly"
17
+ :config="type === 'display' ? originalConfig : activeConfig"
18
+ :slot-config-name="type === 'display' ? undefined : activatedSlotName"
19
+ :for-display="type === 'display'"
20
+ ref="XReportDesign"
21
+ id="printReady"
22
+ :server-name="serverName"
23
+ :env="env"
24
+ :show-title="showTitle"
25
+ :no-padding="noPadding"
26
+ :no-top-border="noTopBorder"
27
+ :show-images="hasImages"
28
+ :image-list="imageList">
29
+ </XReportDesign>
30
+ </template>
31
+ <template v-else>
32
+ <!-- 用以包裹整个页面 -->
33
+ <div v-if="!showSkeleton">
34
+ <!-- 切换菜单 -->
35
+ <a-radio-group
36
+ v-model="type"
37
+ default-value="a"
38
+ button-style="solid"
39
+ @change="tabChanged"
40
+ v-show="!onlyDisplay && editMode">
41
+ <a-radio-button value="design" v-if="!onlyDisplay">
42
+ 设计
43
+ </a-radio-button>
44
+ <a-radio-button value="display" style="border-radius: 0">
45
+ 预览
46
+ </a-radio-button>
47
+ </a-radio-group>
48
+ <a-radio-button @click="saveConfig" style="border-radius: 0 4px 4px 0" v-if="showSaveButton">
49
+ 保存
50
+ </a-radio-button>
51
+ <!-- 主体表格 -->
52
+ <XReportDesign
53
+ v-if="scanFinish"
54
+ @updateImg="updateImg"
55
+ @selectRow="selectRow"
56
+ :show-img-in-cell="showImgInCell"
57
+ :img-prefix="imgPrefix"
58
+ :use-oss-for-img="useOssForImg"
59
+ :display-only="displayOnly"
60
+ :config="type === 'display' ? originalConfig : activeConfig"
61
+ :slot-config-name="type === 'display' ? undefined : activatedSlotName"
62
+ :for-display="type === 'display'"
63
+ :no-padding="noPadding"
64
+ :no-top-border="noTopBorder"
65
+ :show-title="showTitle"
66
+ ref="XReportDesign"
67
+ id="printReady"
68
+ :server-name="serverName"
69
+ :env="env"
70
+ :show-images="hasImages"
71
+ :image-list="imageList">
72
+ </XReportDesign>
73
+ </div>
74
+ </template>
75
+ <!-- 弹出框 -->
76
+ <x-add-report
77
+ :env="env"
78
+ ref="xAddReport"
79
+ />
80
+ <!-- 弹出框 -->
81
+ <x-report-drawer
82
+ :env="env"
83
+ ref="xReportDrawer"
84
+ />
85
+ </div>
86
+ </template>
87
+
88
+ <script>
89
+ // 转PDF用
90
+ import HtmlToPdf from '@vue2-client/utils/htmlToPDF'
91
+ import { mapState } from 'vuex'
92
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
93
+ import XReportDesign from './XReportDesign.vue'
94
+ import { printElement } from './print'
95
+ // import XAddReport from '@vue2-client/base-client/components/common/XAddReport'
96
+
97
+ export default {
98
+ name: 'XReport',
99
+ props: {
100
+ files: {
101
+ type: Array,
102
+ default: () => {
103
+ return []
104
+ }
105
+ },
106
+ // 控制用户权限,user和admin
107
+ authority: {
108
+ type: String,
109
+ default: 'user'
110
+ },
111
+ // 是否为编辑模式
112
+ editMode: {
113
+ type: Boolean,
114
+ default: true
115
+ },
116
+ // 配置名
117
+ configName: {
118
+ type: String,
119
+ required: true
120
+ },
121
+ // 插槽名
122
+ activatedSlotName: {
123
+ type: String,
124
+ default: undefined
125
+ },
126
+ // 本地配置,调试用
127
+ localConfig: {
128
+ type: Object,
129
+ default: undefined
130
+ },
131
+ // 兼容老版本配置
132
+ dontFormat: {
133
+ type: Boolean,
134
+ default: true
135
+ },
136
+ showImgInCell: {
137
+ type: Boolean,
138
+ default: false
139
+ },
140
+ // 数据
141
+ configData: {
142
+ type: Object,
143
+ default: undefined
144
+ },
145
+ // 命名空间
146
+ serverName: {
147
+ type: String,
148
+ default: process.env.VUE_APP_SYSTEM_NAME
149
+ },
150
+ // 环境
151
+ env: {
152
+ type: String,
153
+ default: 'prod'
154
+ },
155
+ // 只做展示
156
+ displayOnly: {
157
+ type: Boolean,
158
+ default: true
159
+ },
160
+ // 表格没有边距
161
+ noPadding: {
162
+ type: Boolean,
163
+ default: false
164
+ },
165
+ // 表格没有上边框,与noPadding搭配可以实现连续表格
166
+ noTopBorder: {
167
+ type: Boolean,
168
+ default: false
169
+ },
170
+ // 是否展示标题
171
+ showTitle: {
172
+ type: Boolean,
173
+ default: true
174
+ },
175
+ // 是否展示保存按钮
176
+ showSaveButton: {
177
+ type: Boolean,
178
+ default: false
179
+ },
180
+ // 是否将组件注册到外层提供的容器中,方便外侧统一保存
181
+ registerMap: {
182
+ type: Array,
183
+ default: undefined
184
+ },
185
+ // 图片是否使用OSS来保存
186
+ useOssForImg: {
187
+ type: Boolean,
188
+ default: true
189
+ },
190
+ // 图片上传后添加前缀
191
+ imgPrefix: {
192
+ type: String,
193
+ default: undefined
194
+ }
195
+ },
196
+ components: {
197
+ XAddReport: () => import('@vue2-client/base-client/components/common/XAddReport'),
198
+ XReportDrawer: () => import('@vue2-client/base-client/components/common/XReportDrawer'),
199
+ XReportDesign
200
+ },
201
+ data () {
202
+ return {
203
+ // 控制骨架屏显隐
204
+ showSkeleton: true,
205
+ // 配置
206
+ config: undefined,
207
+ // 当前显示模式,编辑模式,预览模式
208
+ type: 'design',
209
+ // 仅供展示,不可编辑
210
+ onlyDisplay: false,
211
+ // 每行最大列数,非必要请勿更改,现在的设计器完全是基于每行12列来设计的
212
+ maxColSpan: 12,
213
+ // 定义是否完成配置的扫描,未完成不要渲染子组件
214
+ scanFinish: false,
215
+ // 当前激活的配置文件
216
+ activeConfig: null,
217
+ // 原始配置文件
218
+ // 用于展示。某些情况下“设计页”中的内容仅为“预览页”表格其中的一部分
219
+ originalConfig: null,
220
+ // 扫描到的配置
221
+ configFromWeb: {},
222
+ // 用于获取配置的锁
223
+ timer: undefined,
224
+ // 是否包含图片
225
+ hasImages: false,
226
+ // 图片列表
227
+ imageList: [],
228
+ // 保存最原始的数据,用于判断哪些数据被更改了
229
+ dataCache: undefined,
230
+ // 判断哪些数据被更改了,存储对应的key
231
+ diff: [],
232
+ }
233
+ },
234
+ beforeDestroy () {
235
+ clearInterval(this.timer)
236
+ },
237
+ watch: {
238
+ // 如果配置名更改了,重新获取配置
239
+ configName (val) {
240
+ if (val) {
241
+ getConfigByName(this.configName, undefined, res => {
242
+ this.config = res
243
+ this.configInit()
244
+ }, this.env === 'dev')
245
+ }
246
+ },
247
+ // 如果本地配置更改了,重新初始化
248
+ localConfig: {
249
+ deep: true,
250
+ immediate: true,
251
+ handler (val) {
252
+ if (val) {
253
+ this.config = val
254
+ this.configInit()
255
+ }
256
+ }
257
+ },
258
+ },
259
+ provide () {
260
+ return {
261
+ runLogic: runLogic,
262
+ openDialog: this.openDialog,
263
+ registerComponent: this.registerComponent,
264
+ getComponentByName: this.getComponentByName,
265
+ getParentComponentByName: this.getComponentByName,
266
+ getConfigByName: getConfigByName,
267
+ currUser: this.currUser
268
+ }
269
+ },
270
+ methods: {
271
+ // 把组件注册到refs中,方便调用
272
+ registerComponent (componentName, component) {
273
+ console.log('内部注册', this.$options.name, componentName)
274
+ this.$refs[componentName] = component
275
+ console.log('内部注册完成', this.$refs)
276
+ },
277
+
278
+ transformArray (data) {
279
+ const result = []
280
+ const currentRow = []
281
+ let tempGroup = [] // Temporary group for combining cells
282
+
283
+ data.forEach(row => {
284
+ row.forEach(cell => {
285
+ // Check if the current cell should be part of the temporary group
286
+ if (cell.rowSpan === 1) {
287
+ tempGroup.push(cell) // Add to temporary group
288
+ } else {
289
+ // Push the temporary group if it has accumulated cells
290
+ if (tempGroup.length > 0) {
291
+ currentRow.push(tempGroup)
292
+ tempGroup = []
293
+ }
294
+ currentRow.push(cell)
295
+ }
296
+ })
297
+ })
298
+
299
+ // Add remaining temporary group to the row
300
+ if (tempGroup.length > 0) {
301
+ currentRow.push(tempGroup)
302
+ }
303
+
304
+ result.push(currentRow)
305
+ return result
306
+ },
307
+
308
+ // 根据名字从注册到组件中获取组件
309
+ getComponentByName (componentName) {
310
+ console.log('内部取组件', this.$options.name, componentName)
311
+ console.log('内部组件内容', this.$refs)
312
+ return this.$refs[componentName]
313
+ },
314
+ /**
315
+ * @param configName 栅格配置名称
316
+ * @param selectedId 选中得id
317
+ * @param mixinData 需要混入得数据
318
+ * @param outEnv 其他传递给打开窗口的数据
319
+ * @param attr 传递给Modal弹框用的信息
320
+ */
321
+ openDialog (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
322
+ console.log('openDialog', configName, selectedId)
323
+ this.$refs.xAddReport.init({
324
+ configName: configName,
325
+ selectedId: selectedId,
326
+ mixinData: mixinData,
327
+ outEnv: outEnv,
328
+ attr
329
+ })
330
+ },
331
+ openDrawer (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
332
+ console.log('openDialog', configName, selectedId)
333
+ this.$refs.xReportDrawer.init({
334
+ configName,
335
+ selectedId,
336
+ mixinData,
337
+ outEnv,
338
+ attr
339
+ })
340
+ },
341
+ // 向外暴露图片修改后的数据,某些外部需要自己管理图片的保存与修改
342
+ updateImg (data) {
343
+ this.$emit('updateImg', data)
344
+ },
345
+ // 导出数据,某些外部需要统一控制数据的变动
346
+ exportData () {
347
+ // 获取当前修改后的数据
348
+ let tempData
349
+ if (this.activeConfig === undefined || this.activeConfig === null) {
350
+ tempData = this.originalConfig.data
351
+ } else {
352
+ const tempDataKeys = Object.keys(this.activeConfig.tempData)
353
+ tempDataKeys.forEach(key => {
354
+ this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
355
+ })
356
+ tempData = this.activeConfig.data
357
+ }
358
+ // 对比数据的差异
359
+ this.diff = []
360
+ this.compareProps(tempData, this.dataCache)
361
+ this.diff.forEach(eachDiff => {
362
+ const arr = eachDiff.split('.')
363
+ let targetData = tempData[arr[0]]
364
+ if (arr.length !== 1) {
365
+ for (let i = 1; i < arr.length - 1; i++) {
366
+ const path = arr[i]
367
+ targetData = targetData[path]
368
+ }
369
+ }
370
+ // 将修改的数据,添加update = true属性
371
+ targetData.update = true
372
+ })
373
+ return tempData
374
+ },
375
+ // 对比两个obj有哪里不同
376
+ compareProps (obj1, obj2, path = '') {
377
+ for (const key in obj1) {
378
+ // 如果一个是undefined
379
+ if (typeof obj2[key] === 'undefined') {
380
+ this.diff.push(path + key)
381
+ // 如果是数组长度不一样
382
+ } else if (Array.isArray(obj1) && Array.isArray(obj2)) {
383
+ if (obj1[key].length !== obj2[key].length) {
384
+ this.diff.push(path + key)
385
+ }
386
+ // 如果都是对象,并且存在同样的key,递归子key
387
+ } else if (typeof obj1[key] === 'object' && typeof obj2[key] === 'object') {
388
+ this.compareProps(obj1[key], obj2[key], path + key + '.')
389
+ // 如果不是obj,对比其数据
390
+ } else if (obj1[key] !== obj2[key]) {
391
+ this.diff.push(path + key)
392
+ }
393
+ }
394
+ },
395
+ selectRow (selectedRowKeys, selectedRows) {
396
+ this.table_selectedRowKeys = selectedRowKeys
397
+ this.table_selectedRows = selectedRows
398
+ console.log('')
399
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
400
+ },
401
+ // 注册组件到$refs中
402
+ registerComponentToRefs (componentName, component) {
403
+ this.$refs[componentName] = component
404
+ },
405
+
406
+ // 正常的保存方法,当前修改内容会直接全部导出到外部
407
+ saveConfig () {
408
+ if (this.activeConfig === undefined || this.activeConfig === null) {
409
+ return this.originalConfig.data
410
+ } else {
411
+ const tempDataKeys = Object.keys(this.activeConfig.tempData)
412
+ tempDataKeys.forEach(key => {
413
+ this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
414
+ })
415
+ this.$emit('saveConfig', this.$refs.XReportDesign.activatedConfig)
416
+ }
417
+ },
418
+ // 通过@@@分割临时变量,找到对应的key,并修改它的值
419
+ changeDeepObject (obj, strPath, newVal) {
420
+ const arr = strPath.split('@@@')
421
+ if (obj[arr[0]] === undefined) {
422
+ obj = obj.images
423
+ }
424
+ if (arr.length === 1) {
425
+ obj[arr[0]] = newVal
426
+ } else {
427
+ let result = obj[arr[0]]
428
+ arr.shift()
429
+ while (arr.length > 1) {
430
+ result = result[arr[0]]
431
+ arr.shift()
432
+ }
433
+ if (result) {
434
+ result[arr[0]] = newVal
435
+ }
436
+ }
437
+ },
438
+ // 检查slot是否在配置文件中包含,如果没有包含,则视为非法获取
439
+ checkSlotDefine (config) {
440
+ const slotsDeclare = config.slotsDeclare
441
+ const total = slotsDeclare.length
442
+ let count = 0
443
+ slotsDeclare.forEach(declare => {
444
+ config.columns.forEach(row => {
445
+ row.forEach(cell => {
446
+ if (cell.slotConfig === declare) {
447
+ count++
448
+ }
449
+ })
450
+ })
451
+ })
452
+
453
+ return count === total
454
+ },
455
+ // 切换了标签页
456
+ tabChanged (key) {
457
+ this.scanFinish = false
458
+ this.originalConfig.data = { ...this.originalConfig.data, ...this.config.data }
459
+ this.config.data = this.originalConfig.data
460
+ if (this.type === 'display') {
461
+ const tempDataKeys = Object.keys(this.activeConfig.tempData)
462
+ tempDataKeys.forEach(key => {
463
+ this.changeDeepObject(this.activeConfig.data, key, this.activeConfig.tempData[key])
464
+ })
465
+ let count = 0
466
+ this.imageList = []
467
+ const keys = Object.keys(this.config.data.images)
468
+ keys.forEach(key => {
469
+ if (this.config.data.images[key].length > 0) {
470
+ this.imageList = [...this.imageList, ...this.config.data.images[key]]
471
+ count++
472
+ }
473
+ })
474
+ this.hasImages = count > 0
475
+ } else {
476
+ this.hasImages = false
477
+ }
478
+ this.$nextTick(() => {
479
+ this.scanFinish = true
480
+ })
481
+ },
482
+ // 获取当前日期,为保存文件命名用
483
+ getDate () {
484
+ const currentDate = new Date()
485
+
486
+ const year = currentDate.getFullYear()
487
+ const month = String(currentDate.getMonth() + 1).padStart(2, '0')
488
+ const day = String(currentDate.getDate()).padStart(2, '0')
489
+
490
+ const formattedDate = `${year}_${month}_${day}`
491
+
492
+ return formattedDate
493
+ },
494
+ // 打印
495
+ printDocument () {
496
+ // x-report
497
+ const printContent = window.rawDocument.getElementById('printReady')
498
+ printElement(printContent)
499
+ this.$message.success('操作成功!')
500
+ },
501
+ // 导出PDF
502
+ exportPDF () {
503
+ const date = this.getDate()
504
+ let title = this.config.title
505
+ title = title.replace(/<[^>]+>/g, '')
506
+ const fileName = date + '' + title
507
+ HtmlToPdf.getPdf(fileName, '#printReady')
508
+ },
509
+ // 用于分割配置中的colums,将需要处理的数组提取出来
510
+ formatConfigRow () {
511
+ for (let i = 0; i < this.config.columns.length; i++) {
512
+ // 对原始数组进行递归,依次将该位置拆分为三个部分,当前处理位置之前的,当前处理位置,当前处理位置之后的
513
+ const before = this.config.columns.slice(0, i)
514
+ const after = this.config.columns.slice(i + 1, this.config.columns.length)
515
+
516
+ // 将当前处理的数组交给处理的方法
517
+ const x = this.checkRow(this.config.columns[i])
518
+
519
+ const newArr = []
520
+
521
+ // 拼接之前的数组
522
+ if (before.length > 0) {
523
+ if (before.length >= 1) {
524
+ before.forEach(item => {
525
+ newArr.push(item)
526
+ })
527
+ } else {
528
+ newArr.push(before)
529
+ }
530
+ }
531
+
532
+ // 拼接不需要更改当前节点处理完成的数组
533
+ newArr.push(x.old)
534
+
535
+ // 如果处理了新加的数据,拼接
536
+ if (x.add.length > 0) {
537
+ for (let j = 0; j < x.add.length; j++) {
538
+ if (x.add[j]) {
539
+ newArr.push(x.add[j])
540
+ i++
541
+ }
542
+ }
543
+ }
544
+
545
+ // 拼接之后的数组
546
+ if (after.length > 0) {
547
+ if (after.length >= 1) {
548
+ after.forEach(item => {
549
+ newArr.push(item)
550
+ })
551
+ } else {
552
+ newArr.push(after)
553
+ }
554
+ }
555
+
556
+ this.config.columns = newArr
557
+ }
558
+ },
559
+ // 路径中含有@@@的key,将其解析,并返回其数据
560
+ getDeepObject (obj, strPath) {
561
+ const arr = strPath.split('@@@')
562
+ let result = obj[arr[0]]
563
+ arr.shift()
564
+ try {
565
+ while (arr.length > 0) {
566
+ result = result[arr[0]]
567
+ arr.shift()
568
+ }
569
+ } catch (e) {
570
+ result = undefined
571
+ }
572
+ return result
573
+ },
574
+ // 处理colums数组,为声明了rowspan的单元格,自动匹配格式
575
+ checkRow (rowArr) {
576
+ // 不需要更改的数据
577
+ const original = []
578
+ // 需要更改新加的数据
579
+ const addArr = []
580
+ // 统计rowspan出现的总和
581
+ let count = 0
582
+ // 统计声明列需要的rowspan总数
583
+ let total = 0
584
+ // 是否为声明行
585
+ let titleCellFlag = false
586
+ // 是否为声明行后第一行
587
+ let firstSubLine = false
588
+ // 需要处理的行,新的index值
589
+ let subRowIndex = 0
590
+ // 新生成的行,临时存储
591
+ const waitForAddArr = []
592
+ // 用于记录声明行的colspan避免格式错误
593
+ let preColSpan = 0
594
+ // 用于统计循环次数,判断是否是最后一次
595
+ let forEachCount = 0
596
+
597
+ // 标记所有数据
598
+ rowArr.forEach(cell => {
599
+ forEachCount++
600
+ // 如果该行没有rowspan则默认其为1,不要影响统计结果
601
+ if (!cell.rowSpan) {
602
+ cell.rowSpan = 0
603
+ }
604
+
605
+ if (cell.text && total !== 0) { // 如果遇到了下一个声明行,证明rowspan少了一行,需要补充一个占位格
606
+ const nullObj = {
607
+ type: 'placeHolderColumn',
608
+ order: subRowIndex,
609
+ noBoarder: true,
610
+ needSplit: true,
611
+ colSpan: preColSpan,
612
+ dontShowRow: true
613
+ }
614
+ subRowIndex++
615
+ waitForAddArr.push(nullObj)
616
+ total = 0
617
+ count = 0
618
+ titleCellFlag = false
619
+ firstSubLine = false
620
+ } else if ((total !== count + cell.rowSpan) && forEachCount === rowArr.length) {
621
+ // 如果没有遇到了下一个声明行,但已经是当前行最后一个数据,也证明rowspan少了一行,需要补充一个占位格
622
+ const nullObj = {
623
+ type: 'placeHolderColumn',
624
+ order: subRowIndex,
625
+ noBoarder: true,
626
+ needSplit: true,
627
+ colSpan: preColSpan,
628
+ dontShowRow: true
629
+ }
630
+ subRowIndex++
631
+ waitForAddArr.push(nullObj)
632
+ total = 0
633
+ count = 0
634
+ titleCellFlag = false
635
+ firstSubLine = false
636
+ }
637
+
638
+ // 判断是否为声明行
639
+ if (cell.text && total === 0) {
640
+ // 将声明行声明的rowspan作为总数,判断下方rowspan相加是否等于声明行声明的数量
641
+ total = cell.rowSpan
642
+ titleCellFlag = false
643
+ firstSubLine = true
644
+ subRowIndex = 1
645
+ cell.show = true
646
+ cell.showRowSpan = total
647
+ } else if (cell.rowSpan > 0 && !titleCellFlag && firstSubLine) { // 判断是否为声明行后首行,因为首行不需要移动
648
+ count += cell.rowSpan
649
+ firstSubLine = false
650
+ cell.noBoarder = true
651
+ cell.show = true
652
+ cell.showRowSpan = total
653
+ } else if (cell.rowSpan > 0 && !titleCellFlag && !firstSubLine) { // 既非声明行,也非首行,需要移动
654
+ count += cell.rowSpan
655
+ // cell.type = 'notShow'
656
+ cell.needSplit = true
657
+ cell.order = subRowIndex
658
+ cell.dontShowRow = true
659
+ subRowIndex++
660
+
661
+ // 如果之前添加过空行补充位置,刚好最后一位还有内容,将其互换
662
+ if (forEachCount === rowArr.length && !waitForAddArr[waitForAddArr.length - 1].dataIndex) {
663
+ waitForAddArr[waitForAddArr.length - 1].order += 1
664
+ cell.order -= 1
665
+ waitForAddArr.push(cell)
666
+ } else {
667
+ waitForAddArr.push(cell)
668
+ }
669
+ }
670
+
671
+ // 如果count和total相等了,证明已经处理完成。将计数器还原
672
+ if (count === total) {
673
+ total = 0
674
+ count = 0
675
+ titleCellFlag = false
676
+ firstSubLine = false
677
+ }
678
+ // 保存上一个的colspan,保持生成的格子与原格式一致
679
+ preColSpan = cell.colSpan
680
+ })
681
+
682
+ // 将所有不需要移动的放入original
683
+ rowArr.forEach(cell => {
684
+ if (cell.needSplit !== true) {
685
+ original.push(cell)
686
+ }
687
+ })
688
+
689
+ // 增加新的数组
690
+ waitForAddArr.forEach(cell => {
691
+ const target = cell.order
692
+ // if (cell.type === 'notShow') {
693
+ // cell.type = 'inputs'
694
+ // }
695
+ cell.noBoarder = true
696
+ if (addArr[target] === undefined) {
697
+ const temp = []
698
+ temp.push(cell)
699
+ addArr[target] = temp
700
+ } else if (addArr[target].length > 0) {
701
+ addArr[target].push(cell)
702
+ }
703
+ })
704
+
705
+ // 如果没有新增,将单元格边框设置为显示
706
+ if (addArr.length < 1) {
707
+ original.forEach(cell => {
708
+ if (cell.type === 'input' || cell.type === 'inputs') {
709
+ cell.noBoarder = false
710
+ }
711
+ })
712
+ }
713
+
714
+ return {
715
+ old: original,
716
+ add: addArr
717
+ }
718
+ },
719
+ // 扫描配置,如果有插槽则拼接插槽
720
+ scanConfigSlot (config) {
721
+ const columnsArr = config.columns
722
+ for (let i = 0; i < columnsArr.length; i++) {
723
+ for (let j = 0; j < columnsArr[i].length; j++) {
724
+ // 如果发现type为slot,开始匹配对应的slot配置文件
725
+ if (columnsArr[i][j].type === 'slot') {
726
+ const targetName = columnsArr[i][j].slotConfig
727
+ // 找不到目标插槽配置
728
+ if (!this.configFromWeb[targetName] || !this.configFromWeb[targetName].columns) {
729
+ console.error('无法找到目标插槽的配置!')
730
+ return
731
+ }
732
+
733
+ // 替换columns,合并data
734
+ config.columns[i] = []
735
+ const before = config.columns.slice(0, i)
736
+ let after = config.columns.slice(i + 1, config.columns.length)
737
+
738
+ const addArr = []
739
+ for (let k = 0; k < this.configFromWeb[targetName].columns.length; k++) {
740
+ const temp = []
741
+ this.configFromWeb[targetName].columns[k].forEach(cell => {
742
+ temp.push(cell)
743
+ })
744
+ addArr.push(temp)
745
+ }
746
+
747
+ const newArr = []
748
+ // 拼接之前的数组
749
+ if (before.length > 0) {
750
+ if (before.length >= 1) {
751
+ before.forEach(item => {
752
+ newArr.push(item)
753
+ })
754
+ } else {
755
+ newArr.push(before)
756
+ }
757
+ }
758
+
759
+ addArr.forEach(arr => {
760
+ newArr.push(arr)
761
+ })
762
+
763
+ // 拼接之后的数组
764
+ if (after.length === 1) {
765
+ if (after[0].type === 'slot' || after[0][0].type === 'slot') {
766
+ after = []
767
+ }
768
+ }
769
+ if (after.length > 0) {
770
+ if (after.length >= 1) {
771
+ after.forEach(item => {
772
+ newArr.push(item)
773
+ })
774
+ } else {
775
+ newArr.push(after)
776
+ }
777
+ }
778
+
779
+ config.columns = newArr
780
+ if (this.configFromWeb[targetName].slotsDeclare) {
781
+ config.slotsDeclare = this.configFromWeb[targetName].slotsDeclare
782
+ } else {
783
+ config.slotsDeclare = []
784
+ }
785
+
786
+ if (config.data.images && this.configFromWeb[targetName].data.images) {
787
+ config.data.images = { ...config.data.images, ...this.configFromWeb[targetName].data.images }
788
+ delete this.configFromWeb[targetName].data.images
789
+ }
790
+ config.data = { ...config.data, ...this.configFromWeb[targetName].data }
791
+ }
792
+ }
793
+ }
794
+ this.config = config
795
+ },
796
+ // 扫描所有插槽名
797
+ scanConfigName (config, resut) {
798
+ if (config.slotsDeclare) {
799
+ config.slotsDeclare.forEach(name => {
800
+ resut.push(name)
801
+ })
802
+ }
803
+ },
804
+ // 获取插槽
805
+ getConfigAndJoin (config, outerLock) {
806
+ // 检查主配置插槽声明是否合法
807
+ const check = this.checkSlotDefine(config)
808
+ const waitForDownloadSlotName = []
809
+ if (check) {
810
+ // 扫描主配置中声明的插槽名
811
+ this.scanConfigName(config, waitForDownloadSlotName)
812
+
813
+ const total = waitForDownloadSlotName.length
814
+ let count = 0
815
+
816
+ // 挨个获取插槽
817
+ waitForDownloadSlotName.forEach(configName => {
818
+ getConfigByName(configName, this.serverName, res => {
819
+ this.configFromWeb[configName] = res
820
+ count++
821
+ }, this.env === 'dev')
822
+ })
823
+
824
+ // 使用定时器循环判断锁状态,用于多个插槽,要等待统一获取完成之后,再进行下一步初始化
825
+ const timer = setInterval(() => {
826
+ console.log('插槽下载进度,当前:' + count + '/' + total)
827
+ if (count >= total) {
828
+ clearInterval(timer)
829
+ this.scanConfigSlot(config)
830
+ if (config.slotsDeclare.length > 0) {
831
+ const lock = { status: true }
832
+ this.getConfigAndJoin(config, lock)
833
+ const innerTimer = setInterval(() => {
834
+ if (!lock.status) {
835
+ clearInterval(innerTimer)
836
+ outerLock.status = false
837
+ }
838
+ }, 100)
839
+ } else {
840
+ outerLock.status = false
841
+ }
842
+ }
843
+ }, 100)
844
+ } else {
845
+ console.error('插槽配置有误!')
846
+ outerLock.status = false
847
+ }
848
+ },
849
+ // 获取配置之后的初始化
850
+ configInit () {
851
+ console.log('拼接完成', this.config)
852
+ // 将初始化好的配置拷贝一份留存
853
+ this.originalConfig = Object.assign({}, this.config)
854
+ if (!this.dontFormat) {
855
+ // 扫描配置文件中有没有rowSpan,进行格式化调整
856
+ this.formatConfigRow(this.config)
857
+ }
858
+ this.activeConfig = this.config
859
+ this.showSkeleton = false
860
+ // 判断是否有动态Index
861
+ this.activeConfig.columns.forEach(row => {
862
+ row.forEach(cell => {
863
+ if (cell.dynamicDataIndex === true) {
864
+ // 如果有动态index,取其函数,运行函数得到真实index保存
865
+ // eslint-disable-next-line no-eval
866
+ const func = eval('(' + cell.customFunctionForDynamicDataIndex + ')')
867
+ cell.dataIndex = func(this.config)
868
+ }
869
+ // 处理 自定义函数的旧逻辑
870
+ if (['action', 'click'].includes(cell.eventType) && cell.customFunction && !cell.events) {
871
+ cell.events = []
872
+ cell.events.push({
873
+ type: cell.eventType,
874
+ customFunction: cell.customFunction
875
+ })
876
+ }
877
+ })
878
+ })
879
+ // 将数据复制到临时数据中,带有@@@的数据,我们将其整体作为一个key保存,当编辑完成后,再将其解析,回填到需要的数据中
880
+ this.activeConfig.tempData = {}
881
+ // 是否有@@@深层引用
882
+ this.activeConfig.columns.forEach(row => {
883
+ row.forEach(cell => {
884
+ // 将@@@解析
885
+ if (cell.dataIndex !== undefined && cell.dataIndex.indexOf('@@@') !== -1) {
886
+ this.activeConfig.tempData[cell.dataIndex] = this.getDeepObject(this.activeConfig.data, cell.dataIndex)
887
+ }
888
+ })
889
+ })
890
+ this.$nextTick(() => {
891
+ this.scanFinish = true
892
+ })
893
+
894
+ // 对配置进行转换
895
+ console.log('转换前配置', this.config)
896
+ const newColumns = this.transformArray(this.config.columns)
897
+ console.log('转换后的列描述', newColumns)
898
+ },
899
+ // 初始化JSON配置
900
+ jsonConfigInit () {
901
+ if (this.configData === undefined) {
902
+ console.error('未找到数据!')
903
+ } else {
904
+ this.originalConfig = Object.assign({}, this.config)
905
+ this.originalConfig.data = JSON.parse(JSON.stringify(this.configData))
906
+ this.type = 'display'
907
+ // this.onlyDisplay = true
908
+ this.showSkeleton = false
909
+ this.$nextTick(() => {
910
+ this.scanFinish = true
911
+ })
912
+ }
913
+ },
914
+ onSubmit () {
915
+ console.log('this.table_selectedRowKeys', this.table_selectedRowKeys)
916
+ console.log('this.table_selectedRows', this.table_selectedRows)
917
+ },
918
+ },
919
+ beforeMount () {
920
+ // 如果只是展示
921
+ if (this.displayOnly) {
922
+ this.onlyDisplay = true
923
+ this.type = 'display'
924
+ }
925
+ // 如果有本地配置,优先使用本地配置
926
+ if (this.localConfig) {
927
+ // 如果配置是json渲染器
928
+ if (this.localConfig.designMode === 'json') {
929
+ this.config = this.localConfig
930
+ if (this.configData !== undefined) {
931
+ this.config.data = this.configData
932
+ }
933
+ this.jsonConfigInit()
934
+ } else {
935
+ // 如果配置是普通渲染器
936
+ this.config = this.localConfig
937
+ if (this.configData !== undefined) {
938
+ this.config.data = this.configData
939
+ }
940
+ if (this.config.data.images === undefined) {
941
+ this.config.data.images = {}
942
+ }
943
+ this.configInit()
944
+ }
945
+ } else {
946
+ // 如果本地配置没有值,则从琉璃中获取
947
+ getConfigByName(this.configName, this.serverName, res => {
948
+ this.config = res
949
+ if (this.config.designMode === 'json') {
950
+ if (this.configData !== undefined) {
951
+ this.config.data = this.configData
952
+ }
953
+ this.jsonConfigInit()
954
+ } else {
955
+ if (this.configData !== undefined) {
956
+ this.config.data = this.configData
957
+ }
958
+ if (this.config.data.images === undefined) {
959
+ this.config.data.images = {}
960
+ }
961
+ this.configInit()
962
+ }
963
+ }, this.env === 'dev')
964
+ }
965
+ },
966
+ computed: {
967
+ ...mapState('account', { currUser: 'user' })
968
+ },
969
+ mounted () {
970
+ // 如果外界传来了registerMap,我们将本VM对象注册到map中
971
+ if (this.registerMap !== undefined) {
972
+ this.registerMap.push(this)
973
+ }
974
+ // 将原始数据备份保存
975
+ if (this.configData) {
976
+ this.dataCache = JSON.parse(JSON.stringify(this.configData))
977
+ } else {
978
+ if (this.config?.data) {
979
+ this.dataCache = JSON.parse(JSON.stringify(this.config.data))
980
+ }
981
+ }
982
+ }
983
+ }
984
+ </script>
985
+
986
+ <style lang="less" scoped>
987
+ .tools {
988
+ text-align: center;
989
+ cursor: pointer;
990
+
991
+ .toolsItem {
992
+ display: inline-block;
993
+ }
994
+ }
995
+ </style>