vue2-client 1.10.26 → 1.10.29

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 (424) hide show
  1. package/.cursorrules +19 -19
  2. package/.env +19 -19
  3. package/.env.gaslink +19 -19
  4. package/.env.his +19 -19
  5. package/.env.liuli +19 -19
  6. package/.env.revenue +19 -19
  7. package/.env.scada +19 -19
  8. package/.eslintrc.js +90 -90
  9. package/CHANGELOG.md +824 -824
  10. package/Components.md +60 -60
  11. package/babel.config.js +21 -21
  12. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +45 -45
  13. package/docs/LowCode/lowcode.md +155 -155
  14. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  15. package/docs/index.md +30 -30
  16. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +174 -174
  17. package/index.js +31 -31
  18. package/jest-transform-stub.js +8 -8
  19. package/jest.config.js +21 -21
  20. package/jest.setup.js +7 -7
  21. package/jsconfig.json +19 -19
  22. package/package.json +1 -1
  23. package/public/his/editor/editor.html +51 -51
  24. package/public/his/editor/mock/bind_data.html +779 -779
  25. package/public/his/editor/mock/data_table.html +40 -40
  26. package/public/his/editor/mock/sign.html +75 -75
  27. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  28. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  29. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  30. package/public/his/editor/vender/date97/calendar.js +4 -4
  31. package/public/his/editor/vender/date97/lang/en.js +13 -13
  32. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  33. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  34. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  35. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  36. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  37. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  38. package/public/his/editor/vender/diff.js +1627 -1627
  39. package/public/his/editor/vender/editor.js +1 -1
  40. package/public/his/editor/vender/fabric.js +31187 -31187
  41. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  42. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  43. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  44. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  45. package/public/his/editor/vender/mui/mui.min.css +4 -4
  46. package/public/his/editor/vender/mui/mui.min.js +5 -5
  47. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  48. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  49. package/public/his/editor/vender/qrcode.js +7 -7
  50. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  51. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  52. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  53. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  54. package/public/his/editor/vender/validator.js +5094 -5094
  55. package/public/his/editor/vender/weui/weui.css +5659 -5659
  56. package/public/his/editor/vender/weui/weui.min.css +4 -4
  57. package/public/his/editor/vender/weui/weui.min.js +11 -11
  58. package/public/index.html +27 -27
  59. package/src/App.vue +196 -196
  60. package/src/ReportView.js +19 -19
  61. package/src/assets/img/querySlotDemo.svg +15 -15
  62. package/src/assets/svg/badtwo.svg +1 -1
  63. package/src/assets/svg/goodtwo.svg +1 -1
  64. package/src/base-client/components/AI/AskAiBtn.vue +136 -136
  65. package/src/base-client/components/AI/demo.vue +31 -31
  66. package/src/base-client/components/common/AMisRender/index.js +3 -3
  67. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  68. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +470 -470
  69. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  70. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  71. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  72. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  73. package/src/base-client/components/common/CitySelect/CitySelect.vue +342 -342
  74. package/src/base-client/components/common/CitySelect/index.js +3 -3
  75. package/src/base-client/components/common/CitySelect/index.md +109 -109
  76. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  77. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  78. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  79. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  80. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  81. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  82. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  83. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  84. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  85. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  86. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  87. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  88. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  89. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  90. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  91. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  92. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  93. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  94. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  95. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  96. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  97. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  98. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  99. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  100. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  101. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  102. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  103. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  104. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  105. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  106. package/src/base-client/components/common/Recording/Recording.vue +243 -243
  107. package/src/base-client/components/common/Recording/index.js +3 -3
  108. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  109. package/src/base-client/components/common/Tree/index.js +2 -2
  110. package/src/base-client/components/common/Upload/Upload.vue +322 -322
  111. package/src/base-client/components/common/Upload/index.js +3 -3
  112. package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
  113. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +1146 -1146
  114. package/src/base-client/components/common/XAddNativeForm/demo.vue +43 -43
  115. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  116. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  117. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  118. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  119. package/src/base-client/components/common/XAddReport/XAddReport.vue +207 -207
  120. package/src/base-client/components/common/XAddReport/index.js +3 -3
  121. package/src/base-client/components/common/XAddReport/index.md +56 -56
  122. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  123. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  124. package/src/base-client/components/common/XButtons/XButtons.vue +71 -71
  125. package/src/base-client/components/common/XButtons/index.js +3 -3
  126. package/src/base-client/components/common/XButtons/index.md +61 -61
  127. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  128. package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
  129. package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
  130. package/src/base-client/components/common/XConversation/XConversation.vue +263 -263
  131. package/src/base-client/components/common/XConversation/XConversationDemo.vue +28 -28
  132. package/src/base-client/components/common/XDataCard/XDataCard.vue +84 -89
  133. package/src/base-client/components/common/XDataCard/index.js +3 -3
  134. package/src/base-client/components/common/XDataCard/index.md +1 -1
  135. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  136. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  137. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  138. package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
  139. package/src/base-client/components/common/XDatePicker/index.vue +259 -259
  140. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +169 -169
  141. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +304 -304
  142. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  143. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  144. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  145. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  146. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  147. package/src/base-client/components/common/XForm/XForm.vue +393 -393
  148. package/src/base-client/components/common/XForm/XFormItem.vue +1286 -1286
  149. package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
  150. package/src/base-client/components/common/XForm/XTreeSelect.vue +250 -250
  151. package/src/base-client/components/common/XForm/index.md +178 -178
  152. package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
  153. package/src/base-client/components/common/XFormCol/XFormCol.vue +157 -157
  154. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +304 -304
  155. package/src/base-client/components/common/XFormGroup/demo.vue +46 -46
  156. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  157. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  158. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  159. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  160. package/src/base-client/components/common/XFormTable/XFormTable.vue +856 -856
  161. package/src/base-client/components/common/XFormTable/demo.vue +60 -60
  162. package/src/base-client/components/common/XFormTable/index.md +92 -92
  163. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +167 -167
  164. package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
  165. package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
  166. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  167. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  168. package/src/base-client/components/common/XPrint/Demo.vue +41 -41
  169. package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
  170. package/src/base-client/components/common/XPrint/PrintBill.vue +302 -302
  171. package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
  172. package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
  173. package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
  174. package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
  175. package/src/base-client/components/common/XPrint/index.vue +97 -97
  176. package/src/base-client/components/common/XReport/XReport.vue +892 -892
  177. package/src/base-client/components/common/XReport/XReportDemo.vue +71 -71
  178. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  179. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  180. package/src/base-client/components/common/XReport/XReportTrGroup.vue +816 -816
  181. package/src/base-client/components/common/XReport/index.js +3 -3
  182. package/src/base-client/components/common/XReport/index.md +44 -44
  183. package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +201 -201
  184. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  185. package/src/base-client/components/common/XReportGrid/XReport.vue +1070 -1070
  186. package/src/base-client/components/common/XReportGrid/XReportDemo.vue +47 -47
  187. package/src/base-client/components/common/XReportGrid/XReportDesign.vue +628 -628
  188. package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
  189. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +1104 -1104
  190. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  191. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  192. package/src/base-client/components/common/XReportGrid/print.js +184 -184
  193. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  194. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  195. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  196. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  197. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  198. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  199. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  200. package/src/base-client/components/common/XStepView/index.js +3 -3
  201. package/src/base-client/components/common/XStepView/index.md +31 -31
  202. package/src/base-client/components/common/XTab/XTab.vue +201 -201
  203. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  204. package/src/base-client/components/common/XTab/index.js +3 -3
  205. package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
  206. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  207. package/src/base-client/components/common/XTable/index.md +255 -255
  208. package/src/base-client/components/common/XTagGroup/index.vue +52 -52
  209. package/src/base-client/components/common/XTree/XTree.vue +424 -424
  210. package/src/base-client/components/common/XTree/XTreePro.vue +452 -452
  211. package/src/base-client/components/common/XTree/index.js +3 -3
  212. package/src/base-client/components/common/XTree/index.md +36 -36
  213. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  214. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  215. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  216. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  217. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +359 -359
  218. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  219. package/src/base-client/components/index.js +51 -51
  220. package/src/base-client/components/layout/XPageView/RenderRow.vue +63 -63
  221. package/src/base-client/components/layout/XPageView/XErrorView.vue +11 -11
  222. package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
  223. package/src/base-client/components/layout/XPageView/index.js +3 -3
  224. package/src/base-client/components/layout/XPageView/index.md +38 -38
  225. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  226. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  227. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  228. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  229. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  230. package/src/base-client/plugins/AppData.js +121 -121
  231. package/src/base-client/plugins/Config.js +19 -19
  232. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  233. package/src/base-client/plugins/Recording.js +258 -258
  234. package/src/base-client/plugins/index.js +23 -23
  235. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  236. package/src/bootstrap.js +42 -42
  237. package/src/components/Charts/Bar.vue +62 -62
  238. package/src/components/Charts/ChartCard.vue +134 -134
  239. package/src/components/Charts/Liquid.vue +67 -67
  240. package/src/components/Charts/MiniArea.vue +39 -39
  241. package/src/components/Charts/MiniBar.vue +39 -39
  242. package/src/components/Charts/MiniProgress.vue +75 -75
  243. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  244. package/src/components/Charts/Radar.vue +68 -68
  245. package/src/components/Charts/RankList.vue +77 -77
  246. package/src/components/Charts/TagCloud.vue +113 -113
  247. package/src/components/Charts/TransferBar.vue +64 -64
  248. package/src/components/Charts/Trend.vue +82 -82
  249. package/src/components/Charts/chart.less +12 -12
  250. package/src/components/Charts/smooth.area.less +13 -13
  251. package/src/components/CodeMirror/inedx.vue +118 -118
  252. package/src/components/CodeMirror/setting.js +40 -40
  253. package/src/components/FilePreview/FilePreview.vue +166 -166
  254. package/src/components/HeightScanner/index.vue +571 -571
  255. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  256. package/src/components/NumberInfo/index.js +3 -3
  257. package/src/components/NumberInfo/index.less +54 -54
  258. package/src/components/NumberInfo/index.md +43 -43
  259. package/src/components/STable/index.js +390 -390
  260. package/src/components/card/ChartCard.vue +79 -79
  261. package/src/components/chart/Bar.vue +60 -60
  262. package/src/components/chart/MiniArea.vue +67 -67
  263. package/src/components/chart/MiniBar.vue +59 -59
  264. package/src/components/chart/MiniProgress.vue +57 -57
  265. package/src/components/chart/Radar.vue +80 -80
  266. package/src/components/chart/RankingList.vue +60 -60
  267. package/src/components/chart/Trend.vue +79 -79
  268. package/src/components/chart/index.less +9 -9
  269. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  270. package/src/components/checkbox/ImgCheckbox.vue +117 -117
  271. package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
  272. package/src/components/checkbox/index.js +9 -9
  273. package/src/components/exception/ExceptionPage.vue +70 -70
  274. package/src/components/g2Charts/constants.js +202 -202
  275. package/src/components/g2Charts/demo.vue +808 -808
  276. package/src/components/g2Charts/designer.vue +228 -228
  277. package/src/components/g2Charts/designerBaseConfig.vue +61 -61
  278. package/src/components/g2Charts/designerDataConfig.vue +259 -259
  279. package/src/components/g2Charts/designerStyleConfig.vue +16 -16
  280. package/src/components/g2Charts/index.vue +397 -397
  281. package/src/components/index.js +36 -36
  282. package/src/components/input/IInput.vue +66 -66
  283. package/src/components/menu/SideMenu.vue +75 -75
  284. package/src/components/menu/menu.js +273 -273
  285. package/src/components/setting/Setting.vue +234 -234
  286. package/src/components/tool/AStepItem.vue +60 -60
  287. package/src/config/CreateQueryConfig.js +325 -325
  288. package/src/config/default/antd.config.js +89 -89
  289. package/src/config/default/setting.config.js +55 -55
  290. package/src/font-style/font.css +4 -4
  291. package/src/layouts/CommonLayout.vue +56 -56
  292. package/src/layouts/GridView.vue +45 -45
  293. package/src/layouts/PageLayout.vue +151 -151
  294. package/src/layouts/SinglePageView.vue +136 -136
  295. package/src/layouts/header/AdminHeader.vue +132 -132
  296. package/src/layouts/header/HeaderNotice.vue +177 -177
  297. package/src/layouts/header/InstitutionDetail.vue +181 -181
  298. package/src/layouts/tabs/TabsHead.vue +189 -189
  299. package/src/layouts/tabs/TabsView.vue +389 -389
  300. package/src/lib.js +1 -1
  301. package/src/main.js +34 -34
  302. package/src/mock/extend/index.js +84 -84
  303. package/src/mock/goods/index.js +108 -108
  304. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  305. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  306. package/src/pages/DefaultExample/index.vue +77 -77
  307. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  308. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  309. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  310. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  311. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  312. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  313. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  314. package/src/pages/DynamicStatistics/index.vue +282 -282
  315. package/src/pages/Example/childIndex.vue +15 -15
  316. package/src/pages/Example/index.vue +30 -30
  317. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  318. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  319. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  320. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  321. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  322. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  323. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  324. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  325. package/src/pages/Recording/index.vue +77 -77
  326. package/src/pages/ReportGrid/index.vue +76 -76
  327. package/src/pages/ServiceReview/index.vue +284 -284
  328. package/src/pages/SubExample/index.vue +26 -26
  329. package/src/pages/WorkflowDetail/WorkFlowDemo.vue +32 -32
  330. package/src/pages/WorkflowDetail/WorkflowDetail.vue +230 -230
  331. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +131 -131
  332. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  333. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformation.vue +302 -302
  334. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformationDetails.vue +276 -276
  335. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +864 -864
  336. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandleReso.vue +997 -997
  337. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +222 -222
  338. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkOrderParentDetails.vue +233 -233
  339. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowDetailResso.vue +261 -261
  340. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowListResolution.vue +248 -248
  341. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +73 -73
  342. package/src/pages/XPageViewExample/index.vue +38 -38
  343. package/src/pages/XReportView/index.vue +64 -64
  344. package/src/pages/XTreeOneProExample/index.vue +67 -67
  345. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  346. package/src/pages/login/Login.vue +378 -378
  347. package/src/pages/login/LoginV3.vue +389 -389
  348. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  349. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  350. package/src/pages/report/ReportTable.js +124 -124
  351. package/src/pages/resourceManage/orgListManage.vue +98 -98
  352. package/src/pages/system/dictionary/index.vue +44 -44
  353. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  354. package/src/pages/system/monitor/operLog/index.vue +37 -37
  355. package/src/pages/system/settings/modifyPassword.vue +117 -117
  356. package/src/pages/system/ticket/index.vue +480 -480
  357. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  358. package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
  359. package/src/pages/userInfoDetailManage/FillCardRecordQuery/index.vue +76 -76
  360. package/src/pages/userInfoDetailManage/FillGasRecordQuery/index.vue +74 -74
  361. package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
  362. package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
  363. package/src/pages/userInfoDetailManage/MachineRecordQuery/index.vue +74 -74
  364. package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
  365. package/src/pages/userInfoDetailManage/OtherChargeRecordQuery/index.vue +74 -74
  366. package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
  367. package/src/pages/userInfoDetailManage/UserChargeRecordQuery/index.vue +92 -92
  368. package/src/pages/userInfoDetailManage/UserHandRecordQuery/index.vue +86 -86
  369. package/src/pages/userInfoDetailManage/UserRecordQuery/index.vue +73 -73
  370. package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
  371. package/src/pages/userInfoDetailManage/index.vue +82 -82
  372. package/src/pages/userInfoDetailManage/userInfoDetailQueryTabs.vue +132 -132
  373. package/src/plugins/EventLogPlugin.js +33 -33
  374. package/src/plugins/FindParentsData.js +17 -17
  375. package/src/plugins/HiPrintPlugin.js +124 -124
  376. package/src/router/async/config.async.js +35 -35
  377. package/src/router/async/router.map.js +188 -188
  378. package/src/router/guards.js +263 -263
  379. package/src/router/index.js +27 -27
  380. package/src/router.js +19 -19
  381. package/src/services/DataModel.js +30 -30
  382. package/src/services/LodopFuncs.js +137 -137
  383. package/src/services/api/TicketDetailsViewApi.js +46 -46
  384. package/src/services/api/cas.js +79 -79
  385. package/src/services/api/common.js +346 -346
  386. package/src/services/api/entity.js +18 -18
  387. package/src/services/api/index.js +17 -17
  388. package/src/services/api/restTools.js +145 -145
  389. package/src/services/api/workFlow.js +63 -63
  390. package/src/services/apiService.js +15 -15
  391. package/src/services/user.js +90 -90
  392. package/src/services/v3Api.js +116 -116
  393. package/src/store/modules/account.js +115 -115
  394. package/src/store/modules/index.js +5 -5
  395. package/src/store/modules/lowCode.js +33 -33
  396. package/src/store/modules/setting.js +119 -119
  397. package/src/theme/default/style.less +58 -58
  398. package/src/theme/global.less +159 -159
  399. package/src/utils/authority-utils.js +85 -85
  400. package/src/utils/errorCode.js +6 -6
  401. package/src/utils/formatter.js +74 -74
  402. package/src/utils/htmlToPDF.js +108 -108
  403. package/src/utils/htmlToPDFApi.js +5 -5
  404. package/src/utils/indexedDB.js +263 -263
  405. package/src/utils/login.js +188 -188
  406. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  407. package/src/utils/lowcode/lowcodeLog.js +29 -29
  408. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  409. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  410. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  411. package/src/utils/microAppUtils.js +40 -40
  412. package/src/utils/reg.js +95 -95
  413. package/src/utils/request.js +362 -362
  414. package/src/utils/routerUtil.js +450 -450
  415. package/src/utils/runEvalFunction.js +14 -14
  416. package/src/utils/util.js +329 -329
  417. package/src/utils/waterMark.js +31 -31
  418. package/test/Amis.spec.js +163 -163
  419. package/test/Tree.spec.js +167 -167
  420. package/test/myDialog.spec.js +46 -46
  421. package/test/util.test.js +52 -52
  422. package/test/v3Api.test.js +1983 -1983
  423. package/vue.config.js +213 -213
  424. 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>