vue2-client 1.9.78 → 1.9.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/.env +19 -19
  2. package/.env.gaslink +19 -19
  3. package/.env.his +19 -19
  4. package/.env.revenue +19 -19
  5. package/.eslintrc.js +90 -90
  6. package/CHANGELOG.md +824 -824
  7. package/Components.md +60 -60
  8. package/babel.config.js +21 -21
  9. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +45 -45
  10. package/docs/LowCode/lowcode.md +155 -155
  11. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  12. package/docs/index.md +30 -30
  13. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +143 -143
  14. package/index.js +31 -31
  15. package/jest-transform-stub.js +8 -8
  16. package/jest.config.js +21 -21
  17. package/jest.setup.js +7 -7
  18. package/package.json +1 -1
  19. package/public/his/editor/editor.html +51 -51
  20. package/public/his/editor/mock/bind_data.html +779 -779
  21. package/public/his/editor/mock/data_table.html +40 -40
  22. package/public/his/editor/mock/sign.html +75 -75
  23. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  24. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  25. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  26. package/public/his/editor/vender/date97/calendar.js +4 -4
  27. package/public/his/editor/vender/date97/lang/en.js +13 -13
  28. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  29. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  30. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  31. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  32. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  33. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  34. package/public/his/editor/vender/diff.js +1627 -1627
  35. package/public/his/editor/vender/editor.js +1 -1
  36. package/public/his/editor/vender/fabric.js +31187 -31187
  37. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  38. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  39. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  40. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  41. package/public/his/editor/vender/mui/mui.min.css +4 -4
  42. package/public/his/editor/vender/mui/mui.min.js +5 -5
  43. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  44. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  45. package/public/his/editor/vender/qrcode.js +7 -7
  46. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  47. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  48. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  49. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  50. package/public/his/editor/vender/validator.js +5094 -5094
  51. package/public/his/editor/vender/weui/weui.css +5659 -5659
  52. package/public/his/editor/vender/weui/weui.min.css +4 -4
  53. package/public/his/editor/vender/weui/weui.min.js +11 -11
  54. package/public/index.html +27 -27
  55. package/src/App.vue +192 -192
  56. package/src/ReportView.js +19 -19
  57. package/src/assets/img/querySlotDemo.svg +15 -15
  58. package/src/assets/svg/badtwo.svg +1 -1
  59. package/src/assets/svg/goodtwo.svg +1 -1
  60. package/src/base-client/components/common/AMisRender/index.js +3 -3
  61. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  62. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +470 -470
  63. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  64. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  65. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  66. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  67. package/src/base-client/components/common/CitySelect/CitySelect.vue +342 -342
  68. package/src/base-client/components/common/CitySelect/index.js +3 -3
  69. package/src/base-client/components/common/CitySelect/index.md +109 -109
  70. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  71. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  72. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  73. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  74. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  75. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  76. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  77. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  78. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  79. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  80. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  81. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  82. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  83. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  84. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  85. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  86. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  87. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  88. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  89. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  90. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  91. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  92. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  93. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  94. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  95. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  96. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  97. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  98. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  99. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  100. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  101. package/src/base-client/components/common/Tree/index.js +2 -2
  102. package/src/base-client/components/common/Upload/Upload.vue +239 -239
  103. package/src/base-client/components/common/Upload/index.js +3 -3
  104. package/src/base-client/components/common/XAddForm/XAddForm.vue +107 -107
  105. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +868 -868
  106. package/src/base-client/components/common/XAddNativeForm/demo.vue +30 -30
  107. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  108. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  109. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  110. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  111. package/src/base-client/components/common/XAddReport/XAddReport.vue +207 -207
  112. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  113. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  114. package/src/base-client/components/common/XButtons/XButtons.vue +71 -71
  115. package/src/base-client/components/common/XButtons/index.js +3 -3
  116. package/src/base-client/components/common/XButtons/index.md +61 -61
  117. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  118. package/src/base-client/components/common/XConversation/XConversation.vue +140 -140
  119. package/src/base-client/components/common/XConversation/XConversationDemo.vue +28 -28
  120. package/src/base-client/components/common/XDataCard/XDataCard.vue +420 -420
  121. package/src/base-client/components/common/XDataCard/index.js +3 -3
  122. package/src/base-client/components/common/XDataCard/index.md +1 -1
  123. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  124. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  125. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  126. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +169 -169
  127. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +304 -304
  128. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  129. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  130. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  131. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  132. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  133. package/src/base-client/components/common/XForm/XForm.vue +340 -340
  134. package/src/base-client/components/common/XForm/XFormItem.vue +4 -3
  135. package/src/base-client/components/common/XForm/XTreeSelect.vue +250 -250
  136. package/src/base-client/components/common/XForm/index.md +178 -178
  137. package/src/base-client/components/common/XFormCol/XFormCol.vue +96 -96
  138. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +261 -261
  139. package/src/base-client/components/common/XFormGroup/demo.vue +45 -45
  140. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  141. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  142. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  143. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  144. package/src/base-client/components/common/XFormTable/XFormTable.vue +713 -713
  145. package/src/base-client/components/common/XFormTable/demo.vue +76 -76
  146. package/src/base-client/components/common/XFormTable/index.md +92 -92
  147. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +162 -162
  148. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  149. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  150. package/src/base-client/components/common/XReport/XReport.vue +892 -892
  151. package/src/base-client/components/common/XReport/XReportDemo.vue +304 -304
  152. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  153. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  154. package/src/base-client/components/common/XReport/XReportTrGroup.vue +808 -808
  155. package/src/base-client/components/common/XReport/index.js +3 -3
  156. package/src/base-client/components/common/XReport/index.md +44 -44
  157. package/src/base-client/components/common/XReport/print.js +186 -186
  158. package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +201 -201
  159. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  160. package/src/base-client/components/common/XReportGrid/XReport.vue +995 -959
  161. package/src/base-client/components/common/XReportGrid/XReportDemo.vue +42 -42
  162. package/src/base-client/components/common/XReportGrid/XReportDesign.vue +557 -557
  163. package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
  164. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +999 -999
  165. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  166. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  167. package/src/base-client/components/common/XReportGrid/print.js +184 -184
  168. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  169. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  170. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  171. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  172. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  173. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  174. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  175. package/src/base-client/components/common/XStepView/index.js +3 -3
  176. package/src/base-client/components/common/XStepView/index.md +31 -31
  177. package/src/base-client/components/common/XTab/XTab.vue +201 -201
  178. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  179. package/src/base-client/components/common/XTab/index.js +3 -3
  180. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  181. package/src/base-client/components/common/XTable/XTable.vue +1191 -1191
  182. package/src/base-client/components/common/XTable/index.md +255 -255
  183. package/src/base-client/components/common/XTree/XTree.vue +423 -423
  184. package/src/base-client/components/common/XTree/XTreePro.vue +434 -434
  185. package/src/base-client/components/common/XTree/index.js +3 -3
  186. package/src/base-client/components/common/XTree/index.md +36 -36
  187. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  188. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  189. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  190. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  191. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +203 -203
  192. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  193. package/src/base-client/components/index.js +51 -51
  194. package/src/base-client/components/layout/XPageView/RenderRow.vue +63 -63
  195. package/src/base-client/components/layout/XPageView/XErrorView.vue +11 -11
  196. package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
  197. package/src/base-client/components/layout/XPageView/index.js +3 -3
  198. package/src/base-client/components/layout/XPageView/index.md +38 -38
  199. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  200. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  201. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  202. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  203. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  204. package/src/base-client/plugins/AppData.js +121 -121
  205. package/src/base-client/plugins/Config.js +19 -19
  206. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  207. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  208. package/src/bootstrap.js +39 -39
  209. package/src/components/CodeMirror/inedx.vue +118 -118
  210. package/src/components/CodeMirror/setting.js +40 -40
  211. package/src/components/FilePreview/FilePreview.vue +166 -166
  212. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  213. package/src/components/STable/index.js +380 -380
  214. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  215. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  216. package/src/components/exception/ExceptionPage.vue +70 -70
  217. package/src/components/menu/SideMenu.vue +75 -75
  218. package/src/components/menu/menu.js +273 -273
  219. package/src/components/tool/AStepItem.vue +60 -60
  220. package/src/config/default/antd.config.js +89 -89
  221. package/src/config/default/setting.config.js +55 -55
  222. package/src/font-style/font.css +4 -4
  223. package/src/layouts/CommonLayout.vue +56 -56
  224. package/src/layouts/GridView.vue +45 -45
  225. package/src/layouts/PageLayout.vue +151 -151
  226. package/src/layouts/SinglePageView.vue +136 -136
  227. package/src/layouts/header/AdminHeader.vue +132 -132
  228. package/src/layouts/header/HeaderNotice.vue +177 -177
  229. package/src/layouts/tabs/TabsHead.vue +189 -189
  230. package/src/layouts/tabs/TabsView.vue +389 -389
  231. package/src/lib.js +1 -1
  232. package/src/main.js +30 -30
  233. package/src/mock/extend/index.js +84 -84
  234. package/src/mock/goods/index.js +108 -108
  235. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  236. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  237. package/src/pages/DefaultExample/index.vue +77 -77
  238. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  239. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  240. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  241. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  242. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  243. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  244. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  245. package/src/pages/DynamicStatistics/index.vue +282 -282
  246. package/src/pages/Example/childIndex.vue +15 -15
  247. package/src/pages/Example/index.vue +30 -30
  248. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  249. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  250. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  251. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  252. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  253. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  254. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  255. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  256. package/src/pages/Recording/index.vue +76 -0
  257. package/src/pages/ReportGrid/index.vue +76 -76
  258. package/src/pages/ServiceReview/index.vue +284 -284
  259. package/src/pages/SubExample/index.vue +26 -26
  260. package/src/pages/WorkflowDetail/WorkFlowDemo.vue +32 -32
  261. package/src/pages/WorkflowDetail/WorkflowDetail.vue +230 -230
  262. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +131 -131
  263. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  264. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformation.vue +302 -302
  265. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformationDetails.vue +276 -276
  266. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +864 -864
  267. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandleReso.vue +997 -997
  268. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +222 -222
  269. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkOrderParentDetails.vue +233 -233
  270. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowDetailResso.vue +261 -261
  271. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowListResolution.vue +248 -248
  272. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +73 -73
  273. package/src/pages/XPageViewExample/index.vue +38 -38
  274. package/src/pages/XReportView/index.vue +64 -64
  275. package/src/pages/XTreeOneProExample/index.vue +67 -67
  276. package/src/pages/login/Login.vue +378 -378
  277. package/src/pages/login/LoginV3.vue +389 -389
  278. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  279. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  280. package/src/pages/resourceManage/orgListManage.vue +98 -98
  281. package/src/pages/system/dictionary/index.vue +44 -44
  282. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  283. package/src/pages/system/monitor/operLog/index.vue +37 -37
  284. package/src/pages/system/settings/modifyPassword.vue +117 -117
  285. package/src/pages/system/ticket/index.vue +480 -480
  286. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  287. package/src/plugins/EventLogPlugin.js +33 -33
  288. package/src/plugins/FindParentsData.js +17 -17
  289. package/src/router/async/config.async.js +1 -0
  290. package/src/router/async/router.map.js +183 -183
  291. package/src/router/guards.js +263 -263
  292. package/src/router/index.js +27 -27
  293. package/src/router.js +19 -19
  294. package/src/services/api/TicketDetailsViewApi.js +46 -46
  295. package/src/services/api/cas.js +79 -79
  296. package/src/services/api/common.js +329 -329
  297. package/src/services/api/entity.js +18 -18
  298. package/src/services/api/index.js +17 -17
  299. package/src/services/api/restTools.js +67 -67
  300. package/src/services/api/workFlow.js +63 -63
  301. package/src/services/apiService.js +15 -15
  302. package/src/services/user.js +90 -90
  303. package/src/services/v3Api.js +116 -116
  304. package/src/store/modules/account.js +115 -115
  305. package/src/store/modules/index.js +5 -5
  306. package/src/store/modules/lowCode.js +33 -33
  307. package/src/store/modules/setting.js +119 -119
  308. package/src/theme/default/style.less +58 -58
  309. package/src/theme/global.less +159 -159
  310. package/src/utils/authority-utils.js +85 -85
  311. package/src/utils/errorCode.js +6 -6
  312. package/src/utils/formatter.js +74 -74
  313. package/src/utils/htmlToPDF.js +108 -108
  314. package/src/utils/htmlToPDFApi.js +5 -5
  315. package/src/utils/indexedDB.js +263 -263
  316. package/src/utils/login.js +188 -188
  317. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  318. package/src/utils/lowcode/lowcodeLog.js +29 -29
  319. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  320. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  321. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  322. package/src/utils/map-utils.js +47 -47
  323. package/src/utils/microAppUtils.js +40 -40
  324. package/src/utils/reg.js +95 -95
  325. package/src/utils/request.js +362 -362
  326. package/src/utils/routerUtil.js +450 -450
  327. package/src/utils/runEvalFunction.js +14 -14
  328. package/src/utils/util.js +313 -313
  329. package/src/utils/waterMark.js +31 -31
  330. package/test/Amis.spec.js +163 -163
  331. package/test/Tree.spec.js +167 -167
  332. package/test/myDialog.spec.js +46 -46
  333. package/test/util.test.js +36 -36
  334. package/test/v3Api.test.js +1983 -1983
  335. package/vue.config.js +199 -199
  336. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
  337. /package/src/base-client/components/common/Recording/{Recoding.vue → Recording.vue} +0 -0
@@ -1,999 +1,999 @@
1
- <template>
2
- <a-row type="flex" :gutter="gutter" style="margin-bottom: 20px;">
3
- <!-- 预览页展示 -->
4
- <template v-if="display">
5
- <template v-if="!inputColumns">
6
- <a-col
7
- name="trGroup"
8
- style="flex: 1;"
9
- v-for="(cell, cellIndex) in columns"
10
- v-if="!cell.dontShowRow"
11
- :key="cellIndex"
12
- :style="determineCellStyle(cell)"
13
- :span="cell.colSpan ? cell.colSpan * 2 : undefined">
14
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
15
- <!-- 插槽渲染 -->
16
- <template v-if="cell.type === 'slot'">
17
- <template
18
- v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group', 'x-report', 'x-buttons'].includes(cell.slotType)">
19
- <component
20
- :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
21
- :key="cellIndex"
22
- :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
23
- :serviceName="cell.serviceName"
24
- :serverName="cell.serviceName"
25
- v-on="getEventHandlers(cell)"
26
- @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
27
- :queryParamsName="cell.slotConfig"
28
- :configName="cell.slotConfig"
29
- :countVisible="false"
30
- :env="env"
31
- />
32
- </template>
33
- </template>
34
- <!-- button 按钮渲染 -->
35
- <template v-else-if="cell.type === 'button'">
36
- <a-button v-on="getEventHandlers(cell)">
37
- {{ cell.buttonName }}
38
- </a-button>
39
- </template>
40
- <template v-else-if="cell.type === 'column'">
41
- <template v-if="cell.customFunction">
42
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
43
- </template>
44
- <template v-else>
45
- {{ cell.text }}
46
- </template>
47
- </template>
48
- <!-- 占位 -->
49
- <template v-else-if="cell.type === 'placeHolderColumn'">
50
- </template>
51
- <template v-else-if="cell.type === 'value'">
52
- <template v-if="cell.customFunction === undefined">
53
- {{ cell.value }}
54
- </template>
55
- <template v-else>
56
- {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
57
- </template>
58
- </template>
59
- <template v-else-if="cell.type === 'input'">
60
- <template v-if="cell.customFunction === undefined">
61
- {{ getDeepObject(configData, cell.dataIndex) }}
62
- </template>
63
- <template v-else>
64
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
65
- </template>
66
- </template>
67
- <template v-else-if="cell.type === 'inputs'">
68
- <template v-if="cell.customFunction === undefined">
69
- {{ showSubRowValue(cell) }}
70
- </template>
71
- <template v-else>
72
- {{ deserializeFunctionAndRun(cell.customFunction, showSubRowValue(cell), config) }}
73
- </template>
74
- </template>
75
- <template v-else-if="cell.type === 'list'">
76
- <template v-if="listIndex === 0">
77
- <span style="font-weight: bold">{{ cell.listHead }}</span>
78
- </template>
79
- <template v-else-if="cell.listType === 'input'">
80
- {{ getDeepObject(configData, cell.dataIndex)[listIndex] }}
81
- </template>
82
- <template v-else-if="cell.listType === 'value'">
83
- {{ cell.content[listIndex] }}
84
- </template>
85
- <template v-else-if="cell.listType === 'variable'">
86
- {{ configData[cell.dataIndex][listIndex - 1][cell.listDataIndex] }}
87
- </template>
88
- </template>
89
- <template v-else-if="cell.type === 'images'">
90
- <template
91
- v-if="getDeepObject(configData.images, cell.dataIndex) === undefined || getDeepObject(configData.images, cell.dataIndex).length === 0">
92
- <template
93
- v-if="getDeepObject(configData, cell.dataIndex) === undefined || getDeepObject(configData, cell.dataIndex).length === 0">
94
- <span>无</span>
95
- </template>
96
- <template v-else>
97
- <template v-if="typeof getDeepObject(configData, cell.dataIndex) === 'object'">
98
- <div style="display: flex; align-items: end; justify-content: space-evenly; flex-wrap: wrap">
99
- <template v-for="(img,imgIndex) in getDeepObject(configData, cell.dataIndex)">
100
- <template v-if="showImgInCell">
101
- <div :key="imgIndex">
102
- <img :src="img.url" alt="图片"/>
103
- <p>{{ img.name }}</p>
104
- </div>
105
- </template>
106
- <template v-else>
107
- <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
108
- </template>
109
- </template>
110
- </div>
111
- </template>
112
- <template v-else>
113
- <img :src="getDeepObject(configData, cell.dataIndex)" alt="图片"/>
114
- <p style="margin-right: 5%">{{ formatImgStr(getDeepObject(configData, cell.dataIndex))[0].name }}</p>
115
- </template>
116
- </template>
117
- </template>
118
- <span v-else v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)" :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
119
- </template>
120
- </a-card>
121
- </a-col>
122
- </template>
123
- <template v-else>
124
- <a-col
125
- v-for="(cell, cellIndex) in columns"
126
- :key="cellIndex"
127
- :class=" calcTDBorder(cell.noBoarder) "
128
- :span="cell.colSpan ? cell.colSpan * 2 : undefined"
129
- :style="determineCellStyle(cell)"
130
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
131
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
132
- <template v-if="cell.type === 'column'">
133
- {{ cell.text }}
134
- </template>
135
- <template v-else-if="cell.type === 'value'">
136
- <template v-if="cell.customFunction === undefined">
137
- {{ cell.value }}
138
- </template>
139
- <template v-else>
140
- {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
141
- </template>
142
- </template>
143
- <template v-else-if="cell.type === 'increment'">
144
- <template v-if="cell.customFunction === undefined">
145
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
146
- </template>
147
- <template v-else>
148
- {{
149
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
150
- }}
151
- </template>
152
- </template>
153
- <template v-else-if="cell.type === 'input'">
154
- <template v-if="cell.customFunction === undefined">
155
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
156
- </template>
157
- <template v-else>
158
- {{
159
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
160
- }}
161
- </template>
162
- </template>
163
- <template v-else-if="cell.type === 'inputs'">
164
- <template v-if="cell.customFunction === undefined">
165
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
166
- </template>
167
- <template v-else>
168
- {{
169
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
170
- }}
171
- </template>
172
- </template>
173
- </a-card>
174
- </a-col>
175
- </template>
176
- </template>
177
- <!-- 不是动态行 -->
178
- <template v-else-if="!inputColumns">
179
- <a-col
180
- v-for="(cell, cellIndex) in columns"
181
- :key="cellIndex"
182
- :class=" calcTDBorder(cell.noBoarder) "
183
- :span="cell.colSpan ? cell.colSpan * 2 : undefined"
184
- :style="determineCellStyle(cell)"
185
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
186
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
187
- <template v-if="cell.type === 'column'">
188
- <template v-if="cell.customFunction">
189
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
190
- </template>
191
- <template v-else>
192
- {{ cell.text }}
193
- </template>
194
- </template>
195
- <template v-else-if="cell.type === 'placeHolderColumn'">
196
- <!-- 占位 -->
197
- </template>
198
- <template v-else-if="cell.type === 'value'">
199
- {{ cell.value }}
200
- </template>
201
- <template v-else-if="cell.type === 'curDateInput'">
202
- <a-button type="dashed" v-if="configData[cell.dataIndex]">
203
- {{ configData[cell.dataIndex] }}
204
- </a-button>
205
- <a-button
206
- v-if="!configData[cell.dataIndex]"
207
- type="primary"
208
- @click="getNowDate(cell.dataIndex)"
209
- >{{ cell.text || '确认' }}
210
- </a-button>
211
- </template>
212
- <template v-else-if="cell.type === 'input'">
213
- <template v-if="cell.inputReadOnly === true">
214
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
215
- <a-input
216
- @change="handleInputDeepChange($event, cell.dataIndex)"
217
- v-model="config.tempData[cell.dataIndex]"
218
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
219
- :disabled="true"/>
220
- </template>
221
- <template v-else>
222
- <a-input
223
- v-model="configData[cell.dataIndex]"
224
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
225
- :disabled="true"/>
226
- </template>
227
- </template>
228
- <template v-else>
229
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
230
- <a-input
231
- @change="handleInputDeepChange($event, cell.dataIndex)"
232
- v-model="config.tempData[cell.dataIndex]"
233
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
234
- </template>
235
- <template v-else>
236
- <a-input
237
- v-model="configData[cell.dataIndex]"
238
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
239
- </template>
240
- </template>
241
- </template>
242
- <template v-else-if="cell.type === 'inputs'">
243
- <template v-if="cell.inputReadOnly === true">
244
- <div class="inputsDiv">
245
- <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
246
- <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
247
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
248
- <a-input
249
- @change="handleInputDeepChange($event, cell.dataIndex)"
250
- v-model="config.tempData[cell.dataIndex][index]"
251
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
252
- :disabled="true"/>
253
- </template>
254
- <template v-else>
255
- <a-input
256
- v-model="configData[cell.dataIndex][index]"
257
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
258
- :disabled="true"/>
259
- </template>
260
- <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
261
- </div>
262
- </div>
263
- </template>
264
- <template v-else>
265
- <div class="inputsDiv">
266
- <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
267
- <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
268
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
269
- <a-input
270
- @change="handleInputDeepChange($event, cell.dataIndex)"
271
- v-model="config.tempData[cell.dataIndex][index]"
272
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
273
- </template>
274
- <template v-else>
275
- <a-input
276
- v-model="configData[cell.dataIndex][index]"
277
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
278
- </template>
279
- <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
280
- </div>
281
- </div>
282
- </template>
283
- </template>
284
- <template v-else-if="cell.type === 'list'">
285
- <template v-if="cell.listType === 'input'">
286
- <a-input
287
- v-model="configData[cell.dataIndex][listIndex]"
288
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
289
- </template>
290
- <template v-else-if="cell.listType === 'value'">
291
- {{ cell.content[listIndex] }}
292
- </template>
293
- </template>
294
- <template v-else-if="cell.type === 'images'">
295
- <div>
296
- <template v-if="configData.images[cell.dataIndex]?.length > 0">
297
- <upload
298
- :model="uploadParams"
299
- :img-prefix="imgPrefix"
300
- :service-name="serverName"
301
- :images="checkImg(cell.dataIndex, 'configData')"
302
- :outer-container-index="cell.dataIndex"
303
- @setFiles="(...args) => {setImages(args, 'configData')}"
304
- :upload-style="'simple'"
305
- />
306
- </template>
307
- <template v-else>
308
- <upload
309
- :model="uploadParams"
310
- :img-prefix="imgPrefix"
311
- :service-name="serverName"
312
- :images="checkImg(cell.dataIndex, 'config')"
313
- :outer-container-index="cell.dataIndex"
314
- @setFiles="(...args) => {setImages(args, 'config', cell.dataIndex)}"
315
- :upload-style="'simple'"
316
- />
317
- </template>
318
- </div>
319
- </template>
320
- </a-card>
321
- </a-col>
322
- </template>
323
- <!-- 动态行插入按钮 -->
324
- <template v-else-if="inputColumnsButton">
325
- <a-col :span="maxColSpan" :class="calcTDBorder()">
326
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
327
- <a-button-group>
328
- <a-button @click="addData(columns[0].dataIndex, columns)">
329
- <a-icon type="plus"/>
330
- </a-button>
331
- <a-button @click="removeData(columns[0].dataIndex)">
332
- <a-icon type="minus"/>
333
- </a-button>
334
- </a-button-group>
335
- </a-card>
336
- </a-col>
337
- </template>
338
- <!-- 其他行 -->
339
- <template v-else>
340
- <a-col
341
- v-for="(cell, cellIndex) in columns"
342
- :key="cellIndex"
343
- :class=" calcTDBorder(cell.noBoarder) "
344
- :span="cell.colSpan ? cell.colSpan * 2 : undefined"
345
- :style="determineCellStyle(cell)"
346
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
347
- <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
348
- <template v-if="cell.type === 'column'">
349
- {{ cell.text }}
350
- </template>
351
- <template v-else-if="cell.type === 'value'">
352
- {{ cell.value }}
353
- </template>
354
- <template v-else-if="cell.type === 'curDateInput'">
355
- <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
356
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
357
- </a-button>
358
- <a-button
359
- v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
360
- type="primary"
361
- @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
362
- >{{ cell.text || '确认' }}
363
- </a-button>
364
- </template>
365
- <template v-else-if="cell.type === 'increment'">
366
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
367
- </template>
368
- <template v-else-if="cell.type === 'input'">
369
- <template v-if="cell.inputReadOnly === true">
370
- <a-input
371
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
372
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
373
- :disabled="true"/>
374
- </template>
375
- <template v-else>
376
- <a-input
377
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
378
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
379
- </template>
380
- </template>
381
- <template v-else-if="cell.type === 'inputs'">
382
- <template v-if="cell.inputReadOnly === true">
383
- <a-input
384
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
385
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
386
- :disabled="true"/>
387
- </template>
388
- <template v-else>
389
- <a-input
390
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
391
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
392
- </template>
393
- </template>
394
- </a-card>
395
- </a-col>
396
- </template>
397
- </a-row>
398
- </template>
399
-
400
- <script>
401
- import Upload from '@vue2-client/base-client/components/common/Upload'
402
- import { formatDate, getRealKeyData } from '@vue2-client/utils/util'
403
- import { nanoid } from 'nanoid'
404
- import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
405
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
406
- import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
407
-
408
- export default {
409
- name: 'XReportTrGroup',
410
- components: {
411
- Upload,
412
- XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
413
- XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
414
- XFormGroup: () => import('@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'),
415
- XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
416
- XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
417
- XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
418
- XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue'),
419
- XButtons: () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue')
420
- },
421
- props: {
422
- // 每一行的配置
423
- columns: {
424
- type: Array,
425
- required: true
426
- },
427
- showImgInCell: {
428
- type: Boolean,
429
- default: false
430
- },
431
- config: {
432
- type: Object,
433
- default: function () {
434
- return {}
435
- }
436
- },
437
- // 命名空间
438
- serverName: {
439
- type: String,
440
- default: 'af-system'
441
- },
442
- // 环境
443
- env: {
444
- type: String,
445
- default: 'prod'
446
- },
447
- // 原始配置
448
- configData: {
449
- type: Object,
450
- required: true
451
- },
452
- // 是否为动态行
453
- inputColumns: {
454
- type: Boolean,
455
- default: false
456
- },
457
- // 是否为动态行按钮
458
- inputColumnsButton: {
459
- type: Boolean,
460
- default: false
461
- },
462
- // 动态行的Index
463
- inputColumnsDefinitionIndex: {
464
- type: Number,
465
- default: undefined
466
- },
467
- // 是否为展示行
468
- display: {
469
- type: Boolean,
470
- default: false
471
- },
472
- // list类型的下标,用于遍历列表时,获取对应的数据
473
- listIndex: {
474
- type: Number,
475
- default: undefined
476
- },
477
- // 表格没有上边框
478
- noTopBorder: {
479
- type: Boolean,
480
- default: false
481
- },
482
- // 图片是否使用OSS来保存
483
- useOssForImg: {
484
- type: Boolean,
485
- default: true
486
- },
487
- // 图片上传后添加前缀
488
- imgPrefix: {
489
- type: String,
490
- default: undefined
491
- }
492
- },
493
- data () {
494
- return {
495
- gutter: [8, { xs: 8, sm: 16, md: 24, lg: 32 }], // 设置水槽大小
496
- maxColSpan: 12,
497
- uploadParams: {
498
- type: 'image',
499
- accept: ['*'],
500
- resUploadStock: 1,
501
- pathKey: 'cs'
502
- },
503
- mixinData: {},
504
- flexItemBodyState: {}
505
- // tableConfig: {}
506
- }
507
- },
508
- inject: ['openDialog', 'registerComponent', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser'],
509
- methods: {
510
- getWindow,
511
- isMicroAppEnv,
512
- microDispatch,
513
- getMicroData,
514
- getRealKeyData,
515
- onComponentMounted (h, cell, cellIndex) {
516
- if (this.getMixinData && this.getMixinData()) {
517
- this.mixinData = this.getMixinData()
518
- }
519
- if (cell.slotRef) {
520
- this.registerComponent(cell.slotRef, this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0])
521
- }
522
- // 传递给祖先组件
523
- console.log(`插槽组件已经初始化 slotType ${cell.slotType},ref= dynamicComponent_${cell.slotRef || cellIndex} , serviceName = ${cell.serviceName}`)
524
- const shouldInit = cell.shouldInit == null ? true : cell.shouldInit
525
- if (shouldInit) {
526
- if (cell.slotType === 'x-add-native-form') {
527
- // 简易表单需要主动调用初始化方法
528
- getConfigByName(cell.slotConfig, cell.serviceName, async (res) => {
529
- // 如果配置了 表单初始化logic
530
- // 调用 logic 获取参数
531
- let param = { ...this.mixinData }
532
- let selectedId
533
- if (res.paramLogicName) {
534
- if (!!this.getSelectedId) {
535
- selectedId = this.getSelectedId()
536
- if (typeof selectedId !== 'object') {
537
- selectedId = { selectedId: selectedId }
538
- }
539
- }
540
- param = Object.assign(param, await runLogic(res.paramLogicName, selectedId, cell.serviceName))
541
- }
542
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
543
- serviceName: cell.serviceName,
544
- formItems: res.formJson,
545
- showSubmitBtn: !this.isInAModal,
546
- businessType: param.businessType || '新增',
547
- layout: res.xAddFormLayout,
548
- ...res,
549
- fixedAddForm: param,
550
- modifyModelData: {
551
- files: param.files,
552
- images: param.images
553
- }
554
- })
555
- }, this.env === 'dev')
556
- } else if (cell.slotType === 'x-form-group') {
557
- // 简易表单需要主动调用初始化方法
558
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
559
- // 如果配置了 表单初始化logic
560
- // 调用 logic 获取参数
561
- const param = { ...this.mixinData }
562
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
563
- ...res,
564
- serviceName: cell.serviceName,
565
- showSubmitBtn: !this.isInAModal,
566
- businessType: param.businessType || '新增',
567
- modifyModelData: param,
568
- showLeftTab: true,
569
- })
570
- }, this.env === 'dev')
571
- } else if (cell.slotType === 'x-buttons') {
572
- // 按钮组需要主动调用初始化方法
573
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
574
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
575
- ...res,
576
- serviceName: cell.serviceName,
577
- })
578
- }, this.env === 'dev')
579
- }
580
- }
581
- if (cell.slotType === 'x-report') {
582
- const param = { ...this.mixinData }
583
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init(param)
584
- }
585
- },
586
- getEventHandlers (cell) {
587
- const handlers = {}
588
- if (!cell?.events || cell?.events?.length === 0) {
589
- return handlers
590
- }
591
- cell.events.forEach(event => {
592
- handlers[event.type] = async (...args) => {
593
- console.info('Event handled:', event.type, args)
594
- let func = event.customFunction
595
- if (func && func.startsWith('function')) {
596
- func = func.replace('function', 'async function')
597
- }
598
- const result = await executeStrFunctionByContext(this, func, args)
599
- if (result instanceof Promise) {
600
- result.then((res) => {
601
- if (!res) return
602
- let messageType = 'success'
603
- // 如果传递了组件名字 自动调用刷新
604
- if (res?.name) {
605
- const waitRefreshRef = this.getComponentByName(res.name)
606
- if (waitRefreshRef) {
607
- waitRefreshRef.refresh()
608
- } else {
609
- console.warn(`未找到组件${res.name}无法刷新`)
610
- }
611
- }
612
- // 如果传递消息类型 自动调用消息
613
- if (res?.messageType) {
614
- messageType = res.messageType
615
- }
616
- // 如果传递了提示信息自动调用提示
617
- if (res?.message) {
618
- this.$message[messageType](res?.message)
619
- }
620
- })
621
- }
622
- }
623
- })
624
- return handlers
625
- },
626
- getComponentName (queryParamsName, serviceName, componentName) {
627
- // const config = await getConfigByName(queryParamsName, serviceName)
628
- // const componentName = config.$globalProp.type
629
- return componentName
630
- },
631
- updateImg (data) {
632
- this.$emit('updateImg', data)
633
- },
634
- formatImgStr (str) {
635
- const result = []
636
- if (str !== '') {
637
- const arr = str.split('/')
638
- result.push({
639
- uid: nanoid(6),
640
- url: str,
641
- name: arr[arr.length - 1],
642
- status: 'done'
643
- })
644
- }
645
- this.uploadParams.acceptCount = 1
646
- return result
647
- },
648
- checkImg (index, type) {
649
- let target
650
- if (type === 'configData') {
651
- target = this.configData.images[index]
652
- } else {
653
- target = this.config.tempData[index]
654
- }
655
- if (typeof target !== 'object') {
656
- return this.formatImgStr(target)
657
- }
658
- target.forEach(obj => {
659
- if (obj.uid === undefined) {
660
- obj.uid = obj.id.toString()
661
- }
662
- if (obj.url === undefined) {
663
- if (obj.path) {
664
- obj.url = obj.path
665
- }
666
- }
667
- if (obj.name === undefined) {
668
- const withOutEndFix = obj.url.split('.')[0]
669
- const temp = withOutEndFix.split('/')
670
- obj.name = temp[temp.length - 1]
671
- }
672
- if (obj.status === undefined) {
673
- obj.status = 'done'
674
- }
675
- })
676
- return target
677
- },
678
- // 判断单元格样式
679
- determineCellStyle (cell, color = '#000', borderWidth = '1px') {
680
- // 如果声明了borderColor
681
- if (this.config.style.borderColor) {
682
- color = this.config.style.borderColor
683
- }
684
- // // 如果声明了borderWidth
685
- // if (this.config.style.borderWidth) {
686
- // borderWidth = this.config.style.borderWidth
687
- // }
688
- // // 普通带边框单元格
689
- // const withBorder = {
690
- // border: borderWidth + ' solid ' + color,
691
- // padding: '8px'
692
- // }
693
- // // 只有左右边框的单元格
694
- // const noBorder = {
695
- // borderLeft: borderWidth + ' solid ' + color,
696
- // borderRight: borderWidth + ' solid ' + color,
697
- // padding: '8px'
698
- // }
699
- // // 只没有上边框的单元格
700
- // const NoTopBorder = {
701
- // borderTopStyle: 'none',
702
- // borderLeft: borderWidth + ' solid ' + color,
703
- // borderRight: borderWidth + ' solid ' + color,
704
- // borderBottom: borderWidth + ' solid ' + color,
705
- // padding: '8px'
706
- // }
707
- let result = {}
708
- // 如果表格也声明了样式,用表格样式将样式覆盖
709
- if (cell.style) {
710
- if (cell.noBorder) {
711
- result = { ...cell.style }
712
- } else {
713
- if (this.noTopBorder) {
714
- result = { ...cell.style }
715
- } else {
716
- result = { ...cell.style }
717
- }
718
- }
719
- return result
720
- }
721
- return result
722
- },
723
- // 表格中数据key含有@@@,需要手动触发更新
724
- handleInputDeepChange () {
725
- this.$forceUpdate()
726
- },
727
- // 路径中含有@@@的key,将其解析,并返回其数据
728
- getDeepObject (obj, strPath) {
729
- if (!strPath) {
730
- return ''
731
- }
732
- const arr = strPath.split('@@@')
733
- let result = obj[arr[0]]
734
- arr.shift()
735
- try {
736
- while (arr.length > 0) {
737
- result = result[arr[0]]
738
- arr.shift()
739
- }
740
- } catch (e) {
741
- result = undefined
742
- }
743
- return result
744
- },
745
- // 获取当前日期
746
- getNowDate (index1, index2) {
747
- if (index2) {
748
- // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
749
- this.configData.arr[index1][index2] = formatDate('now')
750
- } else {
751
- this.configData[index1] = formatDate('now')
752
- }
753
- this.configData = Object.assign({}, this.configData)
754
- },
755
- // 反序列化函数并执行
756
- deserializeFunctionAndRun (functionStr, value) {
757
- // eslint-disable-next-line no-eval
758
- const fun = eval('(' + functionStr + ')')
759
- return fun(value, this.config)
760
- },
761
- // 基础上传组件,图片改动后触发
762
- setImages (args, type, index = undefined) {
763
- // 如果基础上传组件在初始化完成后,就调用emit了setImage,此时图片并没有变化,直接返回
764
- if (args[2] === 'created') {
765
- return
766
- }
767
- if (type === 'configData') {
768
- this.configData.images[args[1]] = args[0]
769
- } else {
770
- this.config.tempData[args[1]] = args[0]
771
- if (index) {
772
- this.$emit('updateImg', this.config.tempData[index])
773
- }
774
- }
775
- },
776
- // 动态行删除
777
- removeData (index) {
778
- if (this.configData[index].length === 0) {
779
- this.$message.warn('已经没有更多了')
780
- return
781
- }
782
- this.configData[index].pop()
783
- },
784
- // 添加一行
785
- addData (index, row) {
786
- // 获取定义
787
- const defs = row[0].definition
788
-
789
- // 获取外层对象名
790
- const dataName = row[0].dataIndex
791
- const temp = {}
792
-
793
- defs.forEach(def => {
794
- // 找到数组中最后一个数据的值
795
- let lastDataNo = 0
796
- if (this.configData[dataName][this.configData[dataName].length - 1]) {
797
- lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
798
- }
799
-
800
- // 如果没有值,检查是否声明了初始值
801
- if (lastDataNo === 0 && def.initialValue) {
802
- lastDataNo = def.initialValue
803
- }
804
-
805
- // 检查是否有步长
806
- let step = 1
807
- if (def.step) {
808
- step = def.step
809
- }
810
-
811
- // 如果单元格类型为increment,则进行自增
812
- if (def.type === 'increment') {
813
- temp[def.dataIndex] = lastDataNo + step
814
- }
815
- })
816
- this.configData[index].push(temp)
817
- },
818
- // 根据format计算需要多少个输入框
819
- calcFormatInputNum (formatStr) {
820
- let count = 0
821
- for (let i = 0; i < formatStr.length; i++) {
822
- if (formatStr[i] === '{') {
823
- count++
824
- }
825
- }
826
- return count
827
- },
828
- // 根据format计算输入框之后的文字显示
829
- displayFormatText (formatStr, num) {
830
- let start = 0
831
- let count = 0
832
- num++
833
- for (let i = 0; i < formatStr.length; i++) {
834
- if (formatStr[i] === '}') {
835
- start = i
836
- count++
837
- }
838
- if (count === num) {
839
- for (let j = start + 1; j < formatStr.length; j++) {
840
- if (formatStr[j] === '{') {
841
- return formatStr.slice(start + 1, j)
842
- }
843
- if (j === formatStr.length - 1 && formatStr[j] !== '}') {
844
- return formatStr[j]
845
- }
846
- }
847
- }
848
- }
849
- },
850
- calcTDBorder (cellNoBorder = false) {
851
- if (cellNoBorder) {
852
- return 'tdNoBorder'
853
- } else {
854
- if (this.noTopBorder) {
855
- return 'tdWithNoTopBorder'
856
- } else {
857
- return 'tdWithBorder'
858
- }
859
- }
860
- },
861
- // 根据format计算输入框之前的文字显示
862
- displayFormatStartText (formatStr) {
863
- let count = 0
864
- for (let i = 0; i < formatStr.length; i++) {
865
- if (formatStr[i] === '{') {
866
- break
867
- } else {
868
- count++
869
- }
870
- }
871
- return formatStr.slice(0, count)
872
- },
873
- // 拼接被自动拆分的单元格内容
874
- showSubRowValue (cell) {
875
- const dataName = cell.dataIndex
876
- const formatArr = []
877
- const dataArr = []
878
-
879
- // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
880
- this.config.columns.forEach(row => row.forEach(cell => {
881
- if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
882
- formatArr.push(cell.format)
883
- dataArr.push(this.configData[cell.dataIndex])
884
- }
885
- }))
886
-
887
- const text = []
888
- const data = []
889
-
890
- formatArr.forEach(word => {
891
- const temp = word.split('{}')
892
- temp.forEach(char => {
893
- if (char !== '') {
894
- text.push(char)
895
- }
896
- })
897
- })
898
-
899
- dataArr.forEach(item => {
900
- item.forEach(num => {
901
- data.push(num)
902
- })
903
- })
904
-
905
- let result = ''
906
- for (let i = 0; i < data.length; i++) {
907
- result += data[i]
908
- result += text[i]
909
- }
910
-
911
- return result
912
- },
913
- // 把用户定义的组件,传递到整个杉格中,方便调用
914
- passComponentNamesToAncestor (refs) {
915
- console.log('组件的keys', Object.entries(refs), refs)
916
- // 遍历所有 refs
917
- Object.entries(refs).forEach(([refKey, refValue]) => {
918
- // 检查 ref 是否以 dynamicComponent_ 开头
919
- if (refKey.startsWith('dynamicComponent_')) {
920
- console.log('组件名存在')
921
- const componentRef = refValue[0]
922
- if (componentRef) {
923
- // 去掉前缀并获取组件名字
924
- const index = refKey.replace('dynamicComponent_', '') // 去掉前缀
925
- console.log('注册组件', index)
926
- // 传递给祖先组件
927
- this.registerComponent(index, componentRef)
928
- }
929
- }
930
- })
931
- }
932
- },
933
- beforeMount () {
934
- if (this.useOssForImg) {
935
- this.uploadParams.resUploadMode = 'oss'
936
- }
937
- },
938
- mounted () {
939
- },
940
- }
941
-
942
- </script>
943
-
944
- <style scoped lang="less">
945
- .inputsDiv {
946
- display: flex;
947
- justify-content: space-between;
948
-
949
- .inputsDivItem {
950
- display: flex;
951
- align-items: center;
952
- padding: 0 4px;
953
- white-space: nowrap;
954
-
955
- .inputsDivItemLabel {
956
- padding: 0 4px;
957
- }
958
- }
959
- }
960
-
961
- .tdNoBorder {
962
- border-left: 1px solid #000;
963
- border-right: 1px solid #000;
964
- padding: 8px;
965
- }
966
-
967
- .tdWithBorder {
968
- border: 1px solid #000;
969
- padding: 8px;
970
- }
971
-
972
- .tdWithNoTopBorder {
973
- border-top-style: none;
974
- border-left: 1px solid #000;
975
- border-right: 1px solid #000;
976
- border-bottom: 1px solid #000;
977
- padding: 8px;
978
- }
979
-
980
- .grid-content {
981
- border-radius: 4px;
982
- min-height: 36px;
983
- text-align: center;
984
- color: #fff;
985
- background-color: #606266;
986
- }
987
-
988
- .bg-purple {
989
- background: #9254de;
990
- }
991
-
992
- .bg-purple-light {
993
- background: #b37feb;
994
- }
995
- .flexItem {
996
- border-radius: 8px;
997
- height: 100%;
998
- }
999
- </style>
1
+ <template>
2
+ <a-row type="flex" :gutter="gutter" style="margin-bottom: 20px;">
3
+ <!-- 预览页展示 -->
4
+ <template v-if="display">
5
+ <template v-if="!inputColumns">
6
+ <a-col
7
+ name="trGroup"
8
+ style="flex: 1;"
9
+ v-for="(cell, cellIndex) in columns"
10
+ v-if="!cell.dontShowRow"
11
+ :key="cellIndex"
12
+ :style="determineCellStyle(cell)"
13
+ :span="cell.colSpan ? cell.colSpan * 2 : undefined">
14
+ <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
15
+ <!-- 插槽渲染 -->
16
+ <template v-if="cell.type === 'slot'">
17
+ <template
18
+ v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group', 'x-report', 'x-buttons'].includes(cell.slotType)">
19
+ <component
20
+ :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
21
+ :key="cellIndex"
22
+ :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
23
+ :serviceName="cell.serviceName"
24
+ :serverName="cell.serviceName"
25
+ v-on="getEventHandlers(cell)"
26
+ @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
27
+ :queryParamsName="cell.slotConfig"
28
+ :configName="cell.slotConfig"
29
+ :countVisible="false"
30
+ :env="env"
31
+ />
32
+ </template>
33
+ </template>
34
+ <!-- button 按钮渲染 -->
35
+ <template v-else-if="cell.type === 'button'">
36
+ <a-button v-on="getEventHandlers(cell)">
37
+ {{ cell.buttonName }}
38
+ </a-button>
39
+ </template>
40
+ <template v-else-if="cell.type === 'column'">
41
+ <template v-if="cell.customFunction">
42
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
43
+ </template>
44
+ <template v-else>
45
+ {{ cell.text }}
46
+ </template>
47
+ </template>
48
+ <!-- 占位 -->
49
+ <template v-else-if="cell.type === 'placeHolderColumn'">
50
+ </template>
51
+ <template v-else-if="cell.type === 'value'">
52
+ <template v-if="cell.customFunction === undefined">
53
+ {{ cell.value }}
54
+ </template>
55
+ <template v-else>
56
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
57
+ </template>
58
+ </template>
59
+ <template v-else-if="cell.type === 'input'">
60
+ <template v-if="cell.customFunction === undefined">
61
+ {{ getDeepObject(configData, cell.dataIndex) }}
62
+ </template>
63
+ <template v-else>
64
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
65
+ </template>
66
+ </template>
67
+ <template v-else-if="cell.type === 'inputs'">
68
+ <template v-if="cell.customFunction === undefined">
69
+ {{ showSubRowValue(cell) }}
70
+ </template>
71
+ <template v-else>
72
+ {{ deserializeFunctionAndRun(cell.customFunction, showSubRowValue(cell), config) }}
73
+ </template>
74
+ </template>
75
+ <template v-else-if="cell.type === 'list'">
76
+ <template v-if="listIndex === 0">
77
+ <span style="font-weight: bold">{{ cell.listHead }}</span>
78
+ </template>
79
+ <template v-else-if="cell.listType === 'input'">
80
+ {{ getDeepObject(configData, cell.dataIndex)[listIndex] }}
81
+ </template>
82
+ <template v-else-if="cell.listType === 'value'">
83
+ {{ cell.content[listIndex] }}
84
+ </template>
85
+ <template v-else-if="cell.listType === 'variable'">
86
+ {{ configData[cell.dataIndex][listIndex - 1][cell.listDataIndex] }}
87
+ </template>
88
+ </template>
89
+ <template v-else-if="cell.type === 'images'">
90
+ <template
91
+ v-if="getDeepObject(configData.images, cell.dataIndex) === undefined || getDeepObject(configData.images, cell.dataIndex).length === 0">
92
+ <template
93
+ v-if="getDeepObject(configData, cell.dataIndex) === undefined || getDeepObject(configData, cell.dataIndex).length === 0">
94
+ <span>无</span>
95
+ </template>
96
+ <template v-else>
97
+ <template v-if="typeof getDeepObject(configData, cell.dataIndex) === 'object'">
98
+ <div style="display: flex; align-items: end; justify-content: space-evenly; flex-wrap: wrap">
99
+ <template v-for="(img,imgIndex) in getDeepObject(configData, cell.dataIndex)">
100
+ <template v-if="showImgInCell">
101
+ <div :key="imgIndex">
102
+ <img :src="img.url" alt="图片"/>
103
+ <p>{{ img.name }}</p>
104
+ </div>
105
+ </template>
106
+ <template v-else>
107
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
108
+ </template>
109
+ </template>
110
+ </div>
111
+ </template>
112
+ <template v-else>
113
+ <img :src="getDeepObject(configData, cell.dataIndex)" alt="图片"/>
114
+ <p style="margin-right: 5%">{{ formatImgStr(getDeepObject(configData, cell.dataIndex))[0].name }}</p>
115
+ </template>
116
+ </template>
117
+ </template>
118
+ <span v-else v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)" :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
119
+ </template>
120
+ </a-card>
121
+ </a-col>
122
+ </template>
123
+ <template v-else>
124
+ <a-col
125
+ v-for="(cell, cellIndex) in columns"
126
+ :key="cellIndex"
127
+ :class=" calcTDBorder(cell.noBoarder) "
128
+ :span="cell.colSpan ? cell.colSpan * 2 : undefined"
129
+ :style="determineCellStyle(cell)"
130
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
131
+ <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
132
+ <template v-if="cell.type === 'column'">
133
+ {{ cell.text }}
134
+ </template>
135
+ <template v-else-if="cell.type === 'value'">
136
+ <template v-if="cell.customFunction === undefined">
137
+ {{ cell.value }}
138
+ </template>
139
+ <template v-else>
140
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
141
+ </template>
142
+ </template>
143
+ <template v-else-if="cell.type === 'increment'">
144
+ <template v-if="cell.customFunction === undefined">
145
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
146
+ </template>
147
+ <template v-else>
148
+ {{
149
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
150
+ }}
151
+ </template>
152
+ </template>
153
+ <template v-else-if="cell.type === 'input'">
154
+ <template v-if="cell.customFunction === undefined">
155
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
156
+ </template>
157
+ <template v-else>
158
+ {{
159
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
160
+ }}
161
+ </template>
162
+ </template>
163
+ <template v-else-if="cell.type === 'inputs'">
164
+ <template v-if="cell.customFunction === undefined">
165
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
166
+ </template>
167
+ <template v-else>
168
+ {{
169
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
170
+ }}
171
+ </template>
172
+ </template>
173
+ </a-card>
174
+ </a-col>
175
+ </template>
176
+ </template>
177
+ <!-- 不是动态行 -->
178
+ <template v-else-if="!inputColumns">
179
+ <a-col
180
+ v-for="(cell, cellIndex) in columns"
181
+ :key="cellIndex"
182
+ :class=" calcTDBorder(cell.noBoarder) "
183
+ :span="cell.colSpan ? cell.colSpan * 2 : undefined"
184
+ :style="determineCellStyle(cell)"
185
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
186
+ <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
187
+ <template v-if="cell.type === 'column'">
188
+ <template v-if="cell.customFunction">
189
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
190
+ </template>
191
+ <template v-else>
192
+ {{ cell.text }}
193
+ </template>
194
+ </template>
195
+ <template v-else-if="cell.type === 'placeHolderColumn'">
196
+ <!-- 占位 -->
197
+ </template>
198
+ <template v-else-if="cell.type === 'value'">
199
+ {{ cell.value }}
200
+ </template>
201
+ <template v-else-if="cell.type === 'curDateInput'">
202
+ <a-button type="dashed" v-if="configData[cell.dataIndex]">
203
+ {{ configData[cell.dataIndex] }}
204
+ </a-button>
205
+ <a-button
206
+ v-if="!configData[cell.dataIndex]"
207
+ type="primary"
208
+ @click="getNowDate(cell.dataIndex)"
209
+ >{{ cell.text || '确认' }}
210
+ </a-button>
211
+ </template>
212
+ <template v-else-if="cell.type === 'input'">
213
+ <template v-if="cell.inputReadOnly === true">
214
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
215
+ <a-input
216
+ @change="handleInputDeepChange($event, cell.dataIndex)"
217
+ v-model="config.tempData[cell.dataIndex]"
218
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
219
+ :disabled="true"/>
220
+ </template>
221
+ <template v-else>
222
+ <a-input
223
+ v-model="configData[cell.dataIndex]"
224
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
225
+ :disabled="true"/>
226
+ </template>
227
+ </template>
228
+ <template v-else>
229
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
230
+ <a-input
231
+ @change="handleInputDeepChange($event, cell.dataIndex)"
232
+ v-model="config.tempData[cell.dataIndex]"
233
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
234
+ </template>
235
+ <template v-else>
236
+ <a-input
237
+ v-model="configData[cell.dataIndex]"
238
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
239
+ </template>
240
+ </template>
241
+ </template>
242
+ <template v-else-if="cell.type === 'inputs'">
243
+ <template v-if="cell.inputReadOnly === true">
244
+ <div class="inputsDiv">
245
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
246
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
247
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
248
+ <a-input
249
+ @change="handleInputDeepChange($event, cell.dataIndex)"
250
+ v-model="config.tempData[cell.dataIndex][index]"
251
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
252
+ :disabled="true"/>
253
+ </template>
254
+ <template v-else>
255
+ <a-input
256
+ v-model="configData[cell.dataIndex][index]"
257
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
258
+ :disabled="true"/>
259
+ </template>
260
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
261
+ </div>
262
+ </div>
263
+ </template>
264
+ <template v-else>
265
+ <div class="inputsDiv">
266
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
267
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
268
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
269
+ <a-input
270
+ @change="handleInputDeepChange($event, cell.dataIndex)"
271
+ v-model="config.tempData[cell.dataIndex][index]"
272
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
273
+ </template>
274
+ <template v-else>
275
+ <a-input
276
+ v-model="configData[cell.dataIndex][index]"
277
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
278
+ </template>
279
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
280
+ </div>
281
+ </div>
282
+ </template>
283
+ </template>
284
+ <template v-else-if="cell.type === 'list'">
285
+ <template v-if="cell.listType === 'input'">
286
+ <a-input
287
+ v-model="configData[cell.dataIndex][listIndex]"
288
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
289
+ </template>
290
+ <template v-else-if="cell.listType === 'value'">
291
+ {{ cell.content[listIndex] }}
292
+ </template>
293
+ </template>
294
+ <template v-else-if="cell.type === 'images'">
295
+ <div>
296
+ <template v-if="configData.images[cell.dataIndex]?.length > 0">
297
+ <upload
298
+ :model="uploadParams"
299
+ :img-prefix="imgPrefix"
300
+ :service-name="serverName"
301
+ :images="checkImg(cell.dataIndex, 'configData')"
302
+ :outer-container-index="cell.dataIndex"
303
+ @setFiles="(...args) => {setImages(args, 'configData')}"
304
+ :upload-style="'simple'"
305
+ />
306
+ </template>
307
+ <template v-else>
308
+ <upload
309
+ :model="uploadParams"
310
+ :img-prefix="imgPrefix"
311
+ :service-name="serverName"
312
+ :images="checkImg(cell.dataIndex, 'config')"
313
+ :outer-container-index="cell.dataIndex"
314
+ @setFiles="(...args) => {setImages(args, 'config', cell.dataIndex)}"
315
+ :upload-style="'simple'"
316
+ />
317
+ </template>
318
+ </div>
319
+ </template>
320
+ </a-card>
321
+ </a-col>
322
+ </template>
323
+ <!-- 动态行插入按钮 -->
324
+ <template v-else-if="inputColumnsButton">
325
+ <a-col :span="maxColSpan" :class="calcTDBorder()">
326
+ <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
327
+ <a-button-group>
328
+ <a-button @click="addData(columns[0].dataIndex, columns)">
329
+ <a-icon type="plus"/>
330
+ </a-button>
331
+ <a-button @click="removeData(columns[0].dataIndex)">
332
+ <a-icon type="minus"/>
333
+ </a-button>
334
+ </a-button-group>
335
+ </a-card>
336
+ </a-col>
337
+ </template>
338
+ <!-- 其他行 -->
339
+ <template v-else>
340
+ <a-col
341
+ v-for="(cell, cellIndex) in columns"
342
+ :key="cellIndex"
343
+ :class=" calcTDBorder(cell.noBoarder) "
344
+ :span="cell.colSpan ? cell.colSpan * 2 : undefined"
345
+ :style="determineCellStyle(cell)"
346
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
347
+ <a-card class="flexItem" :bordered="false" :body-style="flexItemBodyState">
348
+ <template v-if="cell.type === 'column'">
349
+ {{ cell.text }}
350
+ </template>
351
+ <template v-else-if="cell.type === 'value'">
352
+ {{ cell.value }}
353
+ </template>
354
+ <template v-else-if="cell.type === 'curDateInput'">
355
+ <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
356
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
357
+ </a-button>
358
+ <a-button
359
+ v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
360
+ type="primary"
361
+ @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
362
+ >{{ cell.text || '确认' }}
363
+ </a-button>
364
+ </template>
365
+ <template v-else-if="cell.type === 'increment'">
366
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
367
+ </template>
368
+ <template v-else-if="cell.type === 'input'">
369
+ <template v-if="cell.inputReadOnly === true">
370
+ <a-input
371
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
372
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
373
+ :disabled="true"/>
374
+ </template>
375
+ <template v-else>
376
+ <a-input
377
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
378
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
379
+ </template>
380
+ </template>
381
+ <template v-else-if="cell.type === 'inputs'">
382
+ <template v-if="cell.inputReadOnly === true">
383
+ <a-input
384
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
385
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
386
+ :disabled="true"/>
387
+ </template>
388
+ <template v-else>
389
+ <a-input
390
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
391
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
392
+ </template>
393
+ </template>
394
+ </a-card>
395
+ </a-col>
396
+ </template>
397
+ </a-row>
398
+ </template>
399
+
400
+ <script>
401
+ import Upload from '@vue2-client/base-client/components/common/Upload'
402
+ import { formatDate, getRealKeyData } from '@vue2-client/utils/util'
403
+ import { nanoid } from 'nanoid'
404
+ import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
405
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
406
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
407
+
408
+ export default {
409
+ name: 'XReportTrGroup',
410
+ components: {
411
+ Upload,
412
+ XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
413
+ XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
414
+ XFormGroup: () => import('@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'),
415
+ XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
416
+ XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
417
+ XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
418
+ XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue'),
419
+ XButtons: () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue')
420
+ },
421
+ props: {
422
+ // 每一行的配置
423
+ columns: {
424
+ type: Array,
425
+ required: true
426
+ },
427
+ showImgInCell: {
428
+ type: Boolean,
429
+ default: false
430
+ },
431
+ config: {
432
+ type: Object,
433
+ default: function () {
434
+ return {}
435
+ }
436
+ },
437
+ // 命名空间
438
+ serverName: {
439
+ type: String,
440
+ default: 'af-system'
441
+ },
442
+ // 环境
443
+ env: {
444
+ type: String,
445
+ default: 'prod'
446
+ },
447
+ // 原始配置
448
+ configData: {
449
+ type: Object,
450
+ required: true
451
+ },
452
+ // 是否为动态行
453
+ inputColumns: {
454
+ type: Boolean,
455
+ default: false
456
+ },
457
+ // 是否为动态行按钮
458
+ inputColumnsButton: {
459
+ type: Boolean,
460
+ default: false
461
+ },
462
+ // 动态行的Index
463
+ inputColumnsDefinitionIndex: {
464
+ type: Number,
465
+ default: undefined
466
+ },
467
+ // 是否为展示行
468
+ display: {
469
+ type: Boolean,
470
+ default: false
471
+ },
472
+ // list类型的下标,用于遍历列表时,获取对应的数据
473
+ listIndex: {
474
+ type: Number,
475
+ default: undefined
476
+ },
477
+ // 表格没有上边框
478
+ noTopBorder: {
479
+ type: Boolean,
480
+ default: false
481
+ },
482
+ // 图片是否使用OSS来保存
483
+ useOssForImg: {
484
+ type: Boolean,
485
+ default: true
486
+ },
487
+ // 图片上传后添加前缀
488
+ imgPrefix: {
489
+ type: String,
490
+ default: undefined
491
+ }
492
+ },
493
+ data () {
494
+ return {
495
+ gutter: [8, { xs: 8, sm: 16, md: 24, lg: 32 }], // 设置水槽大小
496
+ maxColSpan: 12,
497
+ uploadParams: {
498
+ type: 'image',
499
+ accept: ['*'],
500
+ resUploadStock: 1,
501
+ pathKey: 'cs'
502
+ },
503
+ mixinData: {},
504
+ flexItemBodyState: {}
505
+ // tableConfig: {}
506
+ }
507
+ },
508
+ inject: ['openDialog', 'registerComponent', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser'],
509
+ methods: {
510
+ getWindow,
511
+ isMicroAppEnv,
512
+ microDispatch,
513
+ getMicroData,
514
+ getRealKeyData,
515
+ onComponentMounted (h, cell, cellIndex) {
516
+ if (this.getMixinData && this.getMixinData()) {
517
+ this.mixinData = this.getMixinData()
518
+ }
519
+ if (cell.slotRef) {
520
+ this.registerComponent(cell.slotRef, this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0])
521
+ }
522
+ // 传递给祖先组件
523
+ console.log(`插槽组件已经初始化 slotType ${cell.slotType},ref= dynamicComponent_${cell.slotRef || cellIndex} , serviceName = ${cell.serviceName}`)
524
+ const shouldInit = cell.shouldInit == null ? true : cell.shouldInit
525
+ if (shouldInit) {
526
+ if (cell.slotType === 'x-add-native-form') {
527
+ // 简易表单需要主动调用初始化方法
528
+ getConfigByName(cell.slotConfig, cell.serviceName, async (res) => {
529
+ // 如果配置了 表单初始化logic
530
+ // 调用 logic 获取参数
531
+ let param = { ...this.mixinData }
532
+ let selectedId
533
+ if (res.paramLogicName) {
534
+ if (!!this.getSelectedId) {
535
+ selectedId = this.getSelectedId()
536
+ if (typeof selectedId !== 'object') {
537
+ selectedId = { selectedId: selectedId }
538
+ }
539
+ }
540
+ param = Object.assign(param, await runLogic(res.paramLogicName, selectedId, cell.serviceName))
541
+ }
542
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
543
+ serviceName: cell.serviceName,
544
+ formItems: res.formJson,
545
+ showSubmitBtn: !this.isInAModal,
546
+ businessType: param.businessType || '新增',
547
+ layout: res.xAddFormLayout,
548
+ ...res,
549
+ fixedAddForm: param,
550
+ modifyModelData: {
551
+ files: param.files,
552
+ images: param.images
553
+ }
554
+ })
555
+ }, this.env === 'dev')
556
+ } else if (cell.slotType === 'x-form-group') {
557
+ // 简易表单需要主动调用初始化方法
558
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
559
+ // 如果配置了 表单初始化logic
560
+ // 调用 logic 获取参数
561
+ const param = { ...this.mixinData }
562
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
563
+ ...res,
564
+ serviceName: cell.serviceName,
565
+ showSubmitBtn: !this.isInAModal,
566
+ businessType: param.businessType || '新增',
567
+ modifyModelData: param,
568
+ showLeftTab: true,
569
+ })
570
+ }, this.env === 'dev')
571
+ } else if (cell.slotType === 'x-buttons') {
572
+ // 按钮组需要主动调用初始化方法
573
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
574
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
575
+ ...res,
576
+ serviceName: cell.serviceName,
577
+ })
578
+ }, this.env === 'dev')
579
+ }
580
+ }
581
+ if (cell.slotType === 'x-report') {
582
+ const param = { ...this.mixinData }
583
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init(param)
584
+ }
585
+ },
586
+ getEventHandlers (cell) {
587
+ const handlers = {}
588
+ if (!cell?.events || cell?.events?.length === 0) {
589
+ return handlers
590
+ }
591
+ cell.events.forEach(event => {
592
+ handlers[event.type] = async (...args) => {
593
+ console.info('Event handled:', event.type, args)
594
+ let func = event.customFunction
595
+ if (func && func.startsWith('function')) {
596
+ func = func.replace('function', 'async function')
597
+ }
598
+ const result = await executeStrFunctionByContext(this, func, args)
599
+ if (result instanceof Promise) {
600
+ result.then((res) => {
601
+ if (!res) return
602
+ let messageType = 'success'
603
+ // 如果传递了组件名字 自动调用刷新
604
+ if (res?.name) {
605
+ const waitRefreshRef = this.getComponentByName(res.name)
606
+ if (waitRefreshRef) {
607
+ waitRefreshRef.refresh()
608
+ } else {
609
+ console.warn(`未找到组件${res.name}无法刷新`)
610
+ }
611
+ }
612
+ // 如果传递消息类型 自动调用消息
613
+ if (res?.messageType) {
614
+ messageType = res.messageType
615
+ }
616
+ // 如果传递了提示信息自动调用提示
617
+ if (res?.message) {
618
+ this.$message[messageType](res?.message)
619
+ }
620
+ })
621
+ }
622
+ }
623
+ })
624
+ return handlers
625
+ },
626
+ getComponentName (queryParamsName, serviceName, componentName) {
627
+ // const config = await getConfigByName(queryParamsName, serviceName)
628
+ // const componentName = config.$globalProp.type
629
+ return componentName
630
+ },
631
+ updateImg (data) {
632
+ this.$emit('updateImg', data)
633
+ },
634
+ formatImgStr (str) {
635
+ const result = []
636
+ if (str !== '') {
637
+ const arr = str.split('/')
638
+ result.push({
639
+ uid: nanoid(6),
640
+ url: str,
641
+ name: arr[arr.length - 1],
642
+ status: 'done'
643
+ })
644
+ }
645
+ this.uploadParams.acceptCount = 1
646
+ return result
647
+ },
648
+ checkImg (index, type) {
649
+ let target
650
+ if (type === 'configData') {
651
+ target = this.configData.images[index]
652
+ } else {
653
+ target = this.config.tempData[index]
654
+ }
655
+ if (typeof target !== 'object') {
656
+ return this.formatImgStr(target)
657
+ }
658
+ target.forEach(obj => {
659
+ if (obj.uid === undefined) {
660
+ obj.uid = obj.id.toString()
661
+ }
662
+ if (obj.url === undefined) {
663
+ if (obj.path) {
664
+ obj.url = obj.path
665
+ }
666
+ }
667
+ if (obj.name === undefined) {
668
+ const withOutEndFix = obj.url.split('.')[0]
669
+ const temp = withOutEndFix.split('/')
670
+ obj.name = temp[temp.length - 1]
671
+ }
672
+ if (obj.status === undefined) {
673
+ obj.status = 'done'
674
+ }
675
+ })
676
+ return target
677
+ },
678
+ // 判断单元格样式
679
+ determineCellStyle (cell, color = '#000', borderWidth = '1px') {
680
+ // 如果声明了borderColor
681
+ if (this.config.style.borderColor) {
682
+ color = this.config.style.borderColor
683
+ }
684
+ // // 如果声明了borderWidth
685
+ // if (this.config.style.borderWidth) {
686
+ // borderWidth = this.config.style.borderWidth
687
+ // }
688
+ // // 普通带边框单元格
689
+ // const withBorder = {
690
+ // border: borderWidth + ' solid ' + color,
691
+ // padding: '8px'
692
+ // }
693
+ // // 只有左右边框的单元格
694
+ // const noBorder = {
695
+ // borderLeft: borderWidth + ' solid ' + color,
696
+ // borderRight: borderWidth + ' solid ' + color,
697
+ // padding: '8px'
698
+ // }
699
+ // // 只没有上边框的单元格
700
+ // const NoTopBorder = {
701
+ // borderTopStyle: 'none',
702
+ // borderLeft: borderWidth + ' solid ' + color,
703
+ // borderRight: borderWidth + ' solid ' + color,
704
+ // borderBottom: borderWidth + ' solid ' + color,
705
+ // padding: '8px'
706
+ // }
707
+ let result = {}
708
+ // 如果表格也声明了样式,用表格样式将样式覆盖
709
+ if (cell.style) {
710
+ if (cell.noBorder) {
711
+ result = { ...cell.style }
712
+ } else {
713
+ if (this.noTopBorder) {
714
+ result = { ...cell.style }
715
+ } else {
716
+ result = { ...cell.style }
717
+ }
718
+ }
719
+ return result
720
+ }
721
+ return result
722
+ },
723
+ // 表格中数据key含有@@@,需要手动触发更新
724
+ handleInputDeepChange () {
725
+ this.$forceUpdate()
726
+ },
727
+ // 路径中含有@@@的key,将其解析,并返回其数据
728
+ getDeepObject (obj, strPath) {
729
+ if (!strPath) {
730
+ return ''
731
+ }
732
+ const arr = strPath.split('@@@')
733
+ let result = obj[arr[0]]
734
+ arr.shift()
735
+ try {
736
+ while (arr.length > 0) {
737
+ result = result[arr[0]]
738
+ arr.shift()
739
+ }
740
+ } catch (e) {
741
+ result = undefined
742
+ }
743
+ return result
744
+ },
745
+ // 获取当前日期
746
+ getNowDate (index1, index2) {
747
+ if (index2) {
748
+ // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
749
+ this.configData.arr[index1][index2] = formatDate('now')
750
+ } else {
751
+ this.configData[index1] = formatDate('now')
752
+ }
753
+ this.configData = Object.assign({}, this.configData)
754
+ },
755
+ // 反序列化函数并执行
756
+ deserializeFunctionAndRun (functionStr, value) {
757
+ // eslint-disable-next-line no-eval
758
+ const fun = eval('(' + functionStr + ')')
759
+ return fun(value, this.config)
760
+ },
761
+ // 基础上传组件,图片改动后触发
762
+ setImages (args, type, index = undefined) {
763
+ // 如果基础上传组件在初始化完成后,就调用emit了setImage,此时图片并没有变化,直接返回
764
+ if (args[2] === 'created') {
765
+ return
766
+ }
767
+ if (type === 'configData') {
768
+ this.configData.images[args[1]] = args[0]
769
+ } else {
770
+ this.config.tempData[args[1]] = args[0]
771
+ if (index) {
772
+ this.$emit('updateImg', this.config.tempData[index])
773
+ }
774
+ }
775
+ },
776
+ // 动态行删除
777
+ removeData (index) {
778
+ if (this.configData[index].length === 0) {
779
+ this.$message.warn('已经没有更多了')
780
+ return
781
+ }
782
+ this.configData[index].pop()
783
+ },
784
+ // 添加一行
785
+ addData (index, row) {
786
+ // 获取定义
787
+ const defs = row[0].definition
788
+
789
+ // 获取外层对象名
790
+ const dataName = row[0].dataIndex
791
+ const temp = {}
792
+
793
+ defs.forEach(def => {
794
+ // 找到数组中最后一个数据的值
795
+ let lastDataNo = 0
796
+ if (this.configData[dataName][this.configData[dataName].length - 1]) {
797
+ lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
798
+ }
799
+
800
+ // 如果没有值,检查是否声明了初始值
801
+ if (lastDataNo === 0 && def.initialValue) {
802
+ lastDataNo = def.initialValue
803
+ }
804
+
805
+ // 检查是否有步长
806
+ let step = 1
807
+ if (def.step) {
808
+ step = def.step
809
+ }
810
+
811
+ // 如果单元格类型为increment,则进行自增
812
+ if (def.type === 'increment') {
813
+ temp[def.dataIndex] = lastDataNo + step
814
+ }
815
+ })
816
+ this.configData[index].push(temp)
817
+ },
818
+ // 根据format计算需要多少个输入框
819
+ calcFormatInputNum (formatStr) {
820
+ let count = 0
821
+ for (let i = 0; i < formatStr.length; i++) {
822
+ if (formatStr[i] === '{') {
823
+ count++
824
+ }
825
+ }
826
+ return count
827
+ },
828
+ // 根据format计算输入框之后的文字显示
829
+ displayFormatText (formatStr, num) {
830
+ let start = 0
831
+ let count = 0
832
+ num++
833
+ for (let i = 0; i < formatStr.length; i++) {
834
+ if (formatStr[i] === '}') {
835
+ start = i
836
+ count++
837
+ }
838
+ if (count === num) {
839
+ for (let j = start + 1; j < formatStr.length; j++) {
840
+ if (formatStr[j] === '{') {
841
+ return formatStr.slice(start + 1, j)
842
+ }
843
+ if (j === formatStr.length - 1 && formatStr[j] !== '}') {
844
+ return formatStr[j]
845
+ }
846
+ }
847
+ }
848
+ }
849
+ },
850
+ calcTDBorder (cellNoBorder = false) {
851
+ if (cellNoBorder) {
852
+ return 'tdNoBorder'
853
+ } else {
854
+ if (this.noTopBorder) {
855
+ return 'tdWithNoTopBorder'
856
+ } else {
857
+ return 'tdWithBorder'
858
+ }
859
+ }
860
+ },
861
+ // 根据format计算输入框之前的文字显示
862
+ displayFormatStartText (formatStr) {
863
+ let count = 0
864
+ for (let i = 0; i < formatStr.length; i++) {
865
+ if (formatStr[i] === '{') {
866
+ break
867
+ } else {
868
+ count++
869
+ }
870
+ }
871
+ return formatStr.slice(0, count)
872
+ },
873
+ // 拼接被自动拆分的单元格内容
874
+ showSubRowValue (cell) {
875
+ const dataName = cell.dataIndex
876
+ const formatArr = []
877
+ const dataArr = []
878
+
879
+ // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
880
+ this.config.columns.forEach(row => row.forEach(cell => {
881
+ if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
882
+ formatArr.push(cell.format)
883
+ dataArr.push(this.configData[cell.dataIndex])
884
+ }
885
+ }))
886
+
887
+ const text = []
888
+ const data = []
889
+
890
+ formatArr.forEach(word => {
891
+ const temp = word.split('{}')
892
+ temp.forEach(char => {
893
+ if (char !== '') {
894
+ text.push(char)
895
+ }
896
+ })
897
+ })
898
+
899
+ dataArr.forEach(item => {
900
+ item.forEach(num => {
901
+ data.push(num)
902
+ })
903
+ })
904
+
905
+ let result = ''
906
+ for (let i = 0; i < data.length; i++) {
907
+ result += data[i]
908
+ result += text[i]
909
+ }
910
+
911
+ return result
912
+ },
913
+ // 把用户定义的组件,传递到整个杉格中,方便调用
914
+ passComponentNamesToAncestor (refs) {
915
+ console.log('组件的keys', Object.entries(refs), refs)
916
+ // 遍历所有 refs
917
+ Object.entries(refs).forEach(([refKey, refValue]) => {
918
+ // 检查 ref 是否以 dynamicComponent_ 开头
919
+ if (refKey.startsWith('dynamicComponent_')) {
920
+ console.log('组件名存在')
921
+ const componentRef = refValue[0]
922
+ if (componentRef) {
923
+ // 去掉前缀并获取组件名字
924
+ const index = refKey.replace('dynamicComponent_', '') // 去掉前缀
925
+ console.log('注册组件', index)
926
+ // 传递给祖先组件
927
+ this.registerComponent(index, componentRef)
928
+ }
929
+ }
930
+ })
931
+ }
932
+ },
933
+ beforeMount () {
934
+ if (this.useOssForImg) {
935
+ this.uploadParams.resUploadMode = 'oss'
936
+ }
937
+ },
938
+ mounted () {
939
+ },
940
+ }
941
+
942
+ </script>
943
+
944
+ <style scoped lang="less">
945
+ .inputsDiv {
946
+ display: flex;
947
+ justify-content: space-between;
948
+
949
+ .inputsDivItem {
950
+ display: flex;
951
+ align-items: center;
952
+ padding: 0 4px;
953
+ white-space: nowrap;
954
+
955
+ .inputsDivItemLabel {
956
+ padding: 0 4px;
957
+ }
958
+ }
959
+ }
960
+
961
+ .tdNoBorder {
962
+ border-left: 1px solid #000;
963
+ border-right: 1px solid #000;
964
+ padding: 8px;
965
+ }
966
+
967
+ .tdWithBorder {
968
+ border: 1px solid #000;
969
+ padding: 8px;
970
+ }
971
+
972
+ .tdWithNoTopBorder {
973
+ border-top-style: none;
974
+ border-left: 1px solid #000;
975
+ border-right: 1px solid #000;
976
+ border-bottom: 1px solid #000;
977
+ padding: 8px;
978
+ }
979
+
980
+ .grid-content {
981
+ border-radius: 4px;
982
+ min-height: 36px;
983
+ text-align: center;
984
+ color: #fff;
985
+ background-color: #606266;
986
+ }
987
+
988
+ .bg-purple {
989
+ background: #9254de;
990
+ }
991
+
992
+ .bg-purple-light {
993
+ background: #b37feb;
994
+ }
995
+ .flexItem {
996
+ border-radius: 8px;
997
+ height: 100%;
998
+ }
999
+ </style>