vue2-client 1.10.13 → 1.10.15

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