vue2-client 1.16.20 → 1.16.21

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 (331) hide show
  1. package/.cursorrules +19 -19
  2. package/.env.apply +19 -19
  3. package/.env.gaslink +19 -19
  4. package/.env.his +19 -19
  5. package/.env.liuli +20 -20
  6. package/.env.scada +19 -19
  7. package/.eslintrc.js +90 -90
  8. package/CHANGELOG.md +824 -824
  9. package/Components.md +60 -60
  10. package/docs/LowCode/lowcode.md +155 -155
  11. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  12. package/docs/index.md +30 -30
  13. package/index.js +31 -31
  14. package/jest-transform-stub.js +8 -8
  15. package/jest.setup.js +7 -7
  16. package/jsconfig.json +19 -19
  17. package/package.json +112 -112
  18. package/public/his/editor/editor.html +51 -51
  19. package/public/his/editor/mock/bind_data.html +779 -779
  20. package/public/his/editor/mock/data_table.html +40 -40
  21. package/public/his/editor/mock/sign.html +75 -75
  22. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  23. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  24. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  25. package/public/his/editor/vender/date97/calendar.js +4 -4
  26. package/public/his/editor/vender/date97/lang/en.js +13 -13
  27. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  28. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  29. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  30. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  31. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  32. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  33. package/public/his/editor/vender/diff.js +1627 -1627
  34. package/public/his/editor/vender/editor.js +1 -1
  35. package/public/his/editor/vender/fabric.js +31187 -31187
  36. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  37. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  38. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  39. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  40. package/public/his/editor/vender/mui/mui.min.css +4 -4
  41. package/public/his/editor/vender/mui/mui.min.js +5 -5
  42. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  43. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  44. package/public/his/editor/vender/qrcode.js +7 -7
  45. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  46. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  47. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  48. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  49. package/public/his/editor/vender/validator.js +5094 -5094
  50. package/public/his/editor/vender/weui/weui.css +5659 -5659
  51. package/public/his/editor/vender/weui/weui.min.css +4 -4
  52. package/public/his/editor/vender/weui/weui.min.js +11 -11
  53. package/src/assets/img/querySlotDemo.svg +15 -15
  54. package/src/assets/svg/badtwo.svg +1 -1
  55. package/src/assets/svg/goodtwo.svg +1 -1
  56. package/src/base-client/components/AI/AskAiBtn.vue +136 -136
  57. package/src/base-client/components/AI/demo.vue +31 -31
  58. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  59. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  60. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  61. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  62. package/src/base-client/components/common/CitySelect/index.js +3 -3
  63. package/src/base-client/components/common/CitySelect/index.md +109 -109
  64. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  65. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  66. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  67. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  68. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  69. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  70. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  71. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  72. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  73. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  74. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  75. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  76. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  77. package/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue +478 -466
  78. package/src/base-client/components/common/HIS/HAddNativeForm/index.js +3 -3
  79. package/src/base-client/components/common/HIS/HButtons/HButtons.vue +365 -365
  80. package/src/base-client/components/common/HIS/HFormTable/HFormTable.vue +219 -219
  81. package/src/base-client/components/common/HIS/HTab/HTab.vue +293 -293
  82. package/src/base-client/components/common/HIS/demo.vue +54 -54
  83. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  84. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  85. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  86. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  87. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  88. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  89. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  90. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  91. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  92. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  93. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  94. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  95. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  96. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  97. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  98. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  99. package/src/base-client/components/common/Recording/Recording.vue +243 -243
  100. package/src/base-client/components/common/Recording/index.js +3 -3
  101. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  102. package/src/base-client/components/common/Tree/index.js +2 -2
  103. package/src/base-client/components/common/Upload/index.js +3 -3
  104. package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
  105. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  106. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  107. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  108. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  109. package/src/base-client/components/common/XAddReport/index.js +3 -3
  110. package/src/base-client/components/common/XAddReport/index.md +56 -56
  111. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  112. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  113. package/src/base-client/components/common/XButtons/index.js +3 -3
  114. package/src/base-client/components/common/XButtons/index.md +61 -61
  115. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  116. package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
  117. package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
  118. package/src/base-client/components/common/XDataCard/index.js +3 -3
  119. package/src/base-client/components/common/XDataCard/index.md +1 -1
  120. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  121. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  122. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  123. package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
  124. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  125. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  126. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  127. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  128. package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
  129. package/src/base-client/components/common/XForm/index.md +178 -178
  130. package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
  131. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  132. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  133. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  134. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  135. package/src/base-client/components/common/XFormTable/index.md +92 -92
  136. package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
  137. package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
  138. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  139. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  140. package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
  141. package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
  142. package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
  143. package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
  144. package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
  145. package/src/base-client/components/common/XPrint/index.vue +97 -97
  146. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  147. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  148. package/src/base-client/components/common/XReport/index.js +3 -3
  149. package/src/base-client/components/common/XReport/print.js +186 -186
  150. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  151. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +813 -813
  152. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  153. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  154. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  155. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  156. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  157. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  158. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  159. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  160. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  161. package/src/base-client/components/common/XStepView/index.js +3 -3
  162. package/src/base-client/components/common/XStepView/index.md +31 -31
  163. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  164. package/src/base-client/components/common/XTab/index.js +3 -3
  165. package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
  166. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  167. package/src/base-client/components/common/XTable/index.md +255 -255
  168. package/src/base-client/components/common/XTagGroup/index.vue +52 -52
  169. package/src/base-client/components/common/XTree/XTree.vue +424 -424
  170. package/src/base-client/components/common/XTree/index.js +3 -3
  171. package/src/base-client/components/common/XTree/index.md +36 -36
  172. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  173. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  174. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  175. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  176. package/src/base-client/components/his/XCharge/XCharge.vue +610 -610
  177. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  178. package/src/base-client/components/his/XSidebar/XSidebar.vue +283 -283
  179. package/src/base-client/components/his/XSimpleTable/XSimpleTable.vue +119 -119
  180. package/src/base-client/components/his/threeTestOrders/threeTestOrders.vue +481 -481
  181. package/src/base-client/components/index.js +51 -51
  182. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  183. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  184. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  185. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  186. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  187. package/src/base-client/plugins/Config.js +19 -19
  188. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  189. package/src/base-client/plugins/Recording.js +258 -258
  190. package/src/base-client/plugins/index.js +23 -23
  191. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  192. package/src/components/Charts/Bar.vue +62 -62
  193. package/src/components/Charts/ChartCard.vue +134 -134
  194. package/src/components/Charts/Liquid.vue +67 -67
  195. package/src/components/Charts/MiniArea.vue +39 -39
  196. package/src/components/Charts/MiniBar.vue +39 -39
  197. package/src/components/Charts/MiniProgress.vue +75 -75
  198. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  199. package/src/components/Charts/Radar.vue +68 -68
  200. package/src/components/Charts/RankList.vue +77 -77
  201. package/src/components/Charts/TagCloud.vue +113 -113
  202. package/src/components/Charts/TransferBar.vue +64 -64
  203. package/src/components/Charts/Trend.vue +82 -82
  204. package/src/components/Charts/chart.less +12 -12
  205. package/src/components/Charts/smooth.area.less +13 -13
  206. package/src/components/CodeMirror/inedx.vue +118 -118
  207. package/src/components/CodeMirror/setting.js +40 -40
  208. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  209. package/src/components/NumberInfo/index.js +3 -3
  210. package/src/components/NumberInfo/index.less +54 -54
  211. package/src/components/NumberInfo/index.md +43 -43
  212. package/src/components/card/ChartCard.vue +79 -79
  213. package/src/components/chart/Bar.vue +60 -60
  214. package/src/components/chart/MiniArea.vue +67 -67
  215. package/src/components/chart/MiniBar.vue +59 -59
  216. package/src/components/chart/MiniProgress.vue +57 -57
  217. package/src/components/chart/Radar.vue +80 -80
  218. package/src/components/chart/RankingList.vue +60 -60
  219. package/src/components/chart/Trend.vue +79 -79
  220. package/src/components/chart/index.less +9 -9
  221. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  222. package/src/components/checkbox/ImgCheckbox.vue +117 -117
  223. package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
  224. package/src/components/checkbox/index.js +9 -9
  225. package/src/components/exception/ExceptionPage.vue +70 -70
  226. package/src/components/g2Charts/constants.js +202 -202
  227. package/src/components/g2Charts/demo.vue +808 -808
  228. package/src/components/g2Charts/designer.vue +228 -228
  229. package/src/components/g2Charts/designerBaseConfig.vue +61 -61
  230. package/src/components/g2Charts/designerDataConfig.vue +259 -259
  231. package/src/components/g2Charts/designerStyleConfig.vue +16 -16
  232. package/src/components/g2Charts/index.vue +397 -397
  233. package/src/components/index.js +36 -36
  234. package/src/components/input/IInput.vue +66 -66
  235. package/src/components/menu/SideMenu.vue +75 -75
  236. package/src/components/menu/menu.js +273 -273
  237. package/src/components/setting/Setting.vue +234 -234
  238. package/src/components/tool/AStepItem.vue +60 -60
  239. package/src/config/CreateQueryConfig.js +325 -325
  240. package/src/config/default/antd.config.js +89 -89
  241. package/src/config/default/setting.config.js +55 -55
  242. package/src/font-style/font.css +60 -60
  243. package/src/layouts/CommonLayout.vue +56 -56
  244. package/src/layouts/PageLayout.vue +151 -151
  245. package/src/layouts/SinglePageView.vue +136 -136
  246. package/src/layouts/header/AdminHeader.vue +132 -132
  247. package/src/layouts/header/HeaderNotice.vue +177 -177
  248. package/src/layouts/header/InstitutionDetail.vue +181 -181
  249. package/src/layouts/tabs/TabsHead.vue +189 -189
  250. package/src/lib.js +1 -1
  251. package/src/mock/extend/index.js +84 -84
  252. package/src/mock/goods/index.js +108 -108
  253. package/src/pages/DefaultExample/index.vue +77 -77
  254. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  255. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  256. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  257. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  258. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  259. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  260. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  261. package/src/pages/DynamicStatistics/index.vue +282 -282
  262. package/src/pages/Example/childIndex.vue +15 -15
  263. package/src/pages/Example/index.vue +30 -30
  264. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  265. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  266. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  267. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  268. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  269. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  270. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  271. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  272. package/src/pages/Recording/index.vue +77 -77
  273. package/src/pages/ServiceReview/index.vue +284 -284
  274. package/src/pages/SubExample/index.vue +26 -26
  275. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  276. package/src/pages/XReportView/index.vue +64 -64
  277. package/src/pages/XTreeOneProExample/index.vue +67 -67
  278. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  279. package/src/pages/login/Login.vue +379 -379
  280. package/src/pages/login/LoginV3.vue +389 -389
  281. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  282. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  283. package/src/pages/report/ReportTable.js +124 -124
  284. package/src/pages/resourceManage/orgListManage.vue +98 -98
  285. package/src/pages/system/dictionary/index.vue +44 -44
  286. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  287. package/src/pages/system/monitor/operLog/index.vue +37 -37
  288. package/src/pages/system/settings/modifyPassword.vue +117 -117
  289. package/src/pages/system/ticket/index.vue +480 -480
  290. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  291. package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
  292. package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
  293. package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
  294. package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
  295. package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
  296. package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
  297. package/src/plugins/EventLogPlugin.js +33 -33
  298. package/src/plugins/FindParentsData.js +17 -17
  299. package/src/router/async/config.async.js +35 -35
  300. package/src/router/async/router.map.js +129 -129
  301. package/src/router/index.js +27 -27
  302. package/src/services/DataModel.js +30 -30
  303. package/src/services/LodopFuncs.js +137 -137
  304. package/src/services/api/TicketDetailsViewApi.js +46 -46
  305. package/src/services/api/cas.js +79 -79
  306. package/src/services/api/common.js +346 -346
  307. package/src/services/api/entity.js +18 -18
  308. package/src/services/api/index.js +17 -17
  309. package/src/store/modules/account.js +115 -115
  310. package/src/store/modules/index.js +5 -5
  311. package/src/store/modules/lowCode.js +33 -33
  312. package/src/store/modules/setting.js +119 -119
  313. package/src/theme/default/style.less +58 -58
  314. package/src/utils/authority-utils.js +85 -85
  315. package/src/utils/errorCode.js +6 -6
  316. package/src/utils/formatter.js +74 -74
  317. package/src/utils/htmlToPDF.js +108 -108
  318. package/src/utils/htmlToPDFApi.js +5 -5
  319. package/src/utils/login.js +188 -188
  320. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  321. package/src/utils/lowcode/lowcodeLog.js +29 -29
  322. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  323. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  324. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  325. package/src/utils/map-utils.js +47 -47
  326. package/src/utils/reg.js +95 -95
  327. package/src/utils/runEvalFunction.js +14 -14
  328. package/src/utils/theme-color-replacer-extend.js +92 -92
  329. package/src/utils/util.js +329 -329
  330. package/src/utils/waterMark.js +31 -31
  331. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,813 +1,813 @@
1
- <template>
2
- <a-row id="has_row" type="flex" :gutter="gutter" :style="isWidget ? {margin: '0px'} : {'margin-bottom': '.5rem'}">
3
- <template v-for="(cell, cellIndex) in columns">
4
- <a-col
5
- name="trGroup"
6
- v-if="Array.isArray(cell) || !cell.dontShowRow"
7
- :key="cellIndex"
8
- :ref="`trGroup_${ cell.slotRef || cellIndex}`"
9
- @hook:mounted="(h)=>applyAllStyles(cell,cellIndex)"
10
- :span="calculateColSpan(cell)">
11
- <div id="report_widget" v-if="isWidget">
12
- <!-- 插槽渲染 -->
13
- <template v-if="Array.isArray(cell)">
14
- <!-- 处理 cell 是数组的情况 -->
15
- <div v-for="(item, index) in cell" :key="index">
16
- <x-report-tr-group
17
- :env="env"
18
- :key="index"
19
- :columns="recalculateItem(item)"
20
- :config-data="configData"
21
- :config="config"
22
- :display="true">
23
- </x-report-tr-group>
24
- </div>
25
- </template>
26
- <template v-else-if="cell.type === 'slot'">
27
- <template
28
- v-if="[
29
- 'x-form-table',
30
- 'h-form-table',
31
- 'x-add-native-form',
32
- 'h-add-native-form',
33
- 'x-tree-pro',
34
- 'x-his-editor',
35
- 'x-tab',
36
- 'h-tab',
37
- 'x-form-group',
38
- 'x-report',
39
- 'x-buttons',
40
- 'h-buttons',
41
- 'x-label-select',
42
- 'x-conversation',
43
- 'x-check-list',
44
- 'x-cardSet',
45
- 'x-collapse',
46
- 'x-h-descriptions',
47
- 'x-sidebar',
48
- 'x-list',
49
- 'x-input',
50
- 'x-time-line',
51
- 'x-radio',
52
- 'x-calendar',
53
- 'x-time-select',
54
- 'x-checkbox',
55
- 'x-title',
56
- 'x-select',
57
- 'x-tree-rows',
58
- 'x-three-test-orders',
59
- 'x-shift-schedule',
60
- 'x-charge',
61
- 'x-questionnaire',
62
- 'x-import-excel-button',
63
- 'x-chart'
64
- ].includes(cell.slotType)">
65
- <component
66
- :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
67
- :key="cellIndex"
68
- :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
69
- v-bind="cell.attrs"
70
- :serviceName="cell.serviceName"
71
- :serverName="cell.serviceName"
72
- v-on="getEventHandlers(cell)"
73
- @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
74
- @beforeDataChange="beforeDataChange"
75
- @rowClick="handleRowClick"
76
- @onExpand="onExpand"
77
- :queryParamsName="cell.slotConfig"
78
- :configName="cell.slotConfig"
79
- :countVisible="false"
80
- :env="env"
81
- />
82
- </template>
83
- </template>
84
- </div>
85
- <a-card v-else class="flexItem" :bordered="false">
86
- <!-- 插槽渲染 -->
87
- <template v-if="Array.isArray(cell)">
88
- <!-- 处理 cell 是数组的情况 -->
89
- <div v-for="(item, index) in cell" :key="index">
90
- <x-report-tr-group
91
- :server-name="serverName"
92
- :env="env"
93
- :key="index"
94
- :columns="recalculateItem(item)"
95
- :config-data="configData"
96
- :config="config"
97
- :display="true">
98
- </x-report-tr-group>
99
- </div>
100
- </template>
101
- <template v-else-if="cell.type === 'slot'">
102
- <template
103
- v-if="[
104
- 'x-form-table',
105
- 'h-form-table',
106
- 'x-add-native-form',
107
- 'h-add-native-form',
108
- 'x-tree-pro',
109
- 'x-his-editor',
110
- 'x-tab',
111
- 'h-tab',
112
- 'x-form-group',
113
- 'x-report',
114
- 'x-buttons',
115
- 'h-buttons',
116
- 'x-label-select',
117
- 'x-conversation',
118
- 'x-check-list',
119
- 'x-cardSet',
120
- 'x-collapse',
121
- 'x-h-descriptions',
122
- 'x-sidebar',
123
- 'x-list',
124
- 'x-input',
125
- 'x-time-line',
126
- 'x-radio',
127
- 'x-calendar',
128
- 'x-time-select',
129
- 'x-checkbox',
130
- 'x-title',
131
- 'x-select',
132
- 'x-tree-rows',
133
- 'x-three-test-orders',
134
- 'x-shift-schedule',
135
- 'x-charge',
136
- 'x-questionnaire',
137
- 'x-import-excel-button',
138
- 'x-chart'
139
- ].includes(cell.slotType)">
140
- <component
141
- :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
142
- :key="cellIndex"
143
- :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
144
- v-bind="cell.attrs"
145
- :serviceName="cell.serviceName"
146
- :serverName="cell.serviceName"
147
- v-on="getEventHandlers(cell)"
148
- @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
149
- @beforeDataChange="beforeDataChange"
150
- @rowClick="handleRowClick"
151
- @onExpand="onExpand"
152
- :queryParamsName="cell.slotConfig"
153
- :configName="cell.slotConfig"
154
- :countVisible="false"
155
- :env="env"
156
- />
157
- </template>
158
- </template>
159
- </a-card>
160
- </a-col>
161
- </template>
162
- </a-row>
163
- </template>
164
-
165
- <script>
166
- import Upload from '@vue2-client/base-client/components/common/Upload'
167
- import { getRealKeyData } from '@vue2-client/utils/util'
168
- import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
169
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
170
- import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
171
-
172
- export default {
173
- name: 'XReportTrGroup',
174
- components: {
175
- Upload,
176
- XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
177
- HFormTable: () => import('@vue2-client/base-client/components/common/HIS/HFormTable/HFormTable.vue'),
178
- XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
179
- HAddNativeForm: () => import('@vue2-client/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue'),
180
- XFormGroup: () => import('@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'),
181
- XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
182
- XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
183
- XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
184
- HTab: () => import('@vue2-client/base-client/components/common/HIS/HTab/HTab.vue'),
185
- XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue'),
186
- XButtons: () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue'),
187
- HButtons: () => import('@vue2-client/base-client/components/common/HIS/HButtons/HButtons.vue'),
188
- XLabelSelect: () => import('@vue2-client/base-client/components/common/XLabelSelect/XLabelSelect.vue'),
189
- XConversation: () => import('@vue2-client/base-client/components/common/XConversation/XConversation.vue'),
190
- XCheckList: () => import('@vue2-client/base-client/components/common/XCheckList/XCheckList.vue'),
191
- XCardSet: () => import('@vue2-client/base-client/components/common/XCardSet/XCardSet.vue'),
192
- XCollapse: () => import('@vue2-client/base-client/components/common/XCollapse/XCollapse.vue'),
193
- XHDescriptions: () => import('@vue2-client/base-client/components/his/XHDescriptions/XHDescriptions.vue'),
194
- XSidebar: () => import('@vue2-client/base-client/components/his/XSidebar/XSidebar.vue'),
195
- XList: () => import('@vue2-client/base-client/components/his/XList/XList.vue'),
196
- XInput: () => import('@vue2-client/base-client/components/common/XInput/XInput.vue'),
197
- XTimeLine: () => import('@vue2-client/base-client/components/common/XTimeline/XTimeline.vue'),
198
- XRadio: () => import('@vue2-client/base-client/components/his/XRadio/XRadio.vue'),
199
- XCalendar: () => import('@vue2-client/base-client/components/common/XCalendar/XCalendar.vue'),
200
- XTimeSelect: () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
201
- XCheckbox: () => import('@vue2-client/base-client/components/his/XCheckbox/XCheckbox.vue'),
202
- XTitle: () => import('@vue2-client/base-client/components/his/XTitle/XTitle.vue'),
203
- XSelect: () => import('@vue2-client/base-client/components/his/XSelect/XSelect.vue'),
204
- XTreeRows: () => import('@vue2-client/base-client/components/his/XTreeRows/XTreeRows.vue'),
205
- XThreeTestOrders: () => import('@vue2-client/base-client/components/his/threeTestOrders/threeTestOrders.vue'),
206
- XShiftSchedule: () => import('@vue2-client/base-client/components/his/XShiftSchedule/XShiftSchedule.vue'),
207
- XCharge: () => import('@vue2-client/base-client/components/his/XCharge/XCharge.vue'),
208
- XQuestionnaire: () => import('@vue2-client/base-client/components/his/XQuestionnaire/XQuestionnaire.vue'),
209
- XImportExcelButton: () => import('@vue2-client/base-client/components/his/XImportExcelButton/XImportExcelButton.vue'),
210
- XChart: () => import('@vue2-client/base-client/components/his/XChart/XChart.vue')
211
- },
212
- props: {
213
- // 每一行的配置
214
- columns: {
215
- type: Array,
216
- required: true
217
- },
218
- showImgInCell: {
219
- type: Boolean,
220
- default: false
221
- },
222
- config: {
223
- type: Object,
224
- default: function () {
225
- return {}
226
- }
227
- },
228
- // 命名空间
229
- serverName: {
230
- type: String,
231
- default: 'af-system'
232
- },
233
- // 环境
234
- env: {
235
- type: String,
236
- default: 'prod'
237
- },
238
- // 原始配置
239
- configData: {
240
- type: Object,
241
- required: true
242
- },
243
- // 是否为展示行
244
- display: {
245
- type: Boolean,
246
- default: false
247
- },
248
- },
249
- computed: {
250
- allSlotSum () {
251
- // 计算总共有多少个Slot
252
- let sum = 0
253
- this.columns.forEach((item) => {
254
- if (Array.isArray(item)) {
255
- item.forEach((cell) => {
256
- if (cell.type === 'slot') {
257
- sum++
258
- }
259
- })
260
- } else if (item.type && item.type === 'slot') {
261
- sum++
262
- }
263
- })
264
- return sum
265
- }
266
- },
267
- data () {
268
- return {
269
- gutter: [8, { xs: 8, sm: 16, md: 24, lg: 32 }], // 设置水槽大小
270
- maxColSpan: 12,
271
- uploadParams: {
272
- type: 'image',
273
- accept: ['*'],
274
- resUploadStock: 1,
275
- pathKey: 'cs'
276
- },
277
- mixinData: {},
278
- flexItemBodyState: {},
279
- // 已经渲染得插槽得数量
280
- slotRendered: 0,
281
- // tableConfig: {}
282
- }
283
- },
284
- watch: {
285
- columns: {
286
- deep: true,
287
- immediate: true,
288
- handler (newVal) {
289
- // 使用nextTick确保DOM更新
290
- this.$nextTick(() => {
291
- this.$forceUpdate()
292
- })
293
- }
294
- }
295
- },
296
- inject: {
297
- openDialog: { default: false },
298
- emitEvent: { default: false },
299
- registerComponent: { default: false },
300
- setColSpanByName: { default: false },
301
- setGlobalData: { default: false },
302
- getGlobalData: { default: false },
303
- getComponentByName: { default: false },
304
- runLogic: { default: false },
305
- getMixinData: { default: false },
306
- getSelectedId: { default: false },
307
- isInAModal: { default: false },
308
- getConfigByName: { default: false },
309
- getSelectedData: { default: false },
310
- getOutEnv: { default: false },
311
- currUser: { default: false },
312
- isWidget: { default: false },
313
- findComponentByName: { default: false },
314
- closeAddReport: { default: false }
315
- },
316
- methods: {
317
- getWindow,
318
- isMicroAppEnv,
319
- microDispatch,
320
- getMicroData,
321
- getRealKeyData,
322
- handleRowClick (record) {
323
- this.$emit('rowClick', record)
324
- },
325
- beforeDataChange (record) {
326
- this.$emit('beforeDataChange', record)
327
- },
328
- onExpand (expanded, record) {
329
- this.$emit('expand', expanded, record)
330
- },
331
- listClick (data) {
332
- this.$emit('listClick', data)
333
- },
334
- calculateColSpan (cell) {
335
- return Array.isArray(cell)
336
- ? cell[0][0]?.colSpan * 2
337
- : (cell?.colSpan ?? cell?.def?.colSpan ?? 1) * 2
338
- },
339
- applyAllStyles (cell, cellIndex) {
340
- // 应用组件样式
341
- const component = this.$refs[`trGroup_${ cell.slotRef || cellIndex}`][0]
342
- // 确保组件已经完全挂载
343
- this.$nextTick(() => {
344
- this.applyComponentStyles(component, cell, cellIndex)
345
- })
346
- },
347
- onComponentMounted (h, cell, cellIndex) {
348
- this.slotRendered += 1
349
- if (this.slotRendered >= this.allSlotSum) {
350
- this.$emit('slotRendered')
351
- }
352
- if (this.getMixinData && this.getMixinData()) {
353
- this.mixinData = this.getMixinData()
354
- }
355
- if (cell.slotRef) {
356
- this.registerComponent(cell.slotRef, this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0])
357
- }
358
- // 传递给祖先组件
359
- const shouldInit = cell.shouldInit == null ? true : cell.shouldInit
360
- if (shouldInit) {
361
- if (cell.slotType === 'x-add-native-form') {
362
- // 简易表单需要主动调用初始化方法
363
- getConfigByName(cell.slotConfig, cell.serviceName, async (res) => {
364
- // 如果配置了 表单初始化logic
365
- // 调用 logic 获取参数
366
- let param = { ...this.mixinData }
367
- let selectedId
368
- if (res.paramLogicName) {
369
- if (!!this.getSelectedId) {
370
- selectedId = this.getSelectedId()
371
- if (typeof selectedId !== 'object') {
372
- selectedId = { selectedId: selectedId }
373
- }
374
- }
375
- param = Object.assign(param, await runLogic(res.paramLogicName, selectedId, cell.serviceName))
376
- }
377
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
378
- serviceName: cell.serviceName,
379
- configName: cell.slotConfig,
380
- formItems: res.formJson,
381
- showSubmitBtn: !this.isInAModal,
382
- businessType: param.businessType || '新增',
383
- layout: res.xAddFormLayout,
384
- primaryKey: res.primaryKey,
385
- ...res,
386
- fixedAddForm: param,
387
- modifyModelData: {
388
- files: param.files,
389
- images: param.images
390
- }
391
- })
392
- }, this.env === 'dev')
393
- } else if (cell.slotType === 'x-form-group') {
394
- // 简易表单需要主动调用初始化方法
395
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
396
- // 如果配置了 表单初始化logic
397
- // 调用 logic 获取参数
398
- const param = { ...this.mixinData }
399
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
400
- ...res,
401
- serviceName: cell.serviceName,
402
- showSubmitBtn: !this.isInAModal,
403
- businessType: param.businessType || '新增',
404
- modifyModelData: param,
405
- showLeftTab: true,
406
- })
407
- }, this.env === 'dev')
408
- } else if (cell.slotType === 'x-label-select') {
409
- // 按钮组需要主动调用初始化方法
410
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
411
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
412
- ...res,
413
- serviceName: cell.serviceName,
414
- })
415
- }, this.env === 'dev')
416
- }
417
- }
418
- if (cell.slotType === 'x-report') {
419
- const param = { ...this.mixinData }
420
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init(param)
421
- }
422
- if (cell.slotType === 'x-conversation') {
423
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
424
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
425
- serviceName: cell.serviceName,
426
- ...res,
427
- })
428
- }, this.env === 'dev')
429
- }
430
- if (cell.slotType === 'x-check-list') {
431
- getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
432
- this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
433
- serviceName: cell.serviceName,
434
- ...res,
435
- })
436
- }, this.env === 'dev')
437
- }
438
- },
439
- recalculateItem (item) {
440
- const totalColSpan = item.reduce((sum, cell) => {
441
- // 保留手动设置的colSpan
442
- return sum + (cell._isManualColSpan ? 0 : (cell.colSpan || 1))
443
- }, 0)
444
- return item.map(cell => {
445
- // 跳过已手动设置的单元格
446
- if (cell._isManualColSpan) return cell
447
- const newColSpan = Math.round((cell.colSpan || 1) / totalColSpan * 12)
448
- return {
449
- ...cell,
450
- colSpan: newColSpan,
451
- // 标记自动计算的单元格
452
- _isAutoCalculated: true
453
- }
454
- })
455
- },
456
-
457
- getEventHandlers (cell) {
458
- const handlers = {}
459
- if (!cell?.events || cell?.events?.length === 0) {
460
- return handlers
461
- }
462
- cell.events.forEach(event => {
463
- handlers[event.type] = async (...args) => {
464
- let func = event.customFunction
465
- if (func && func.startsWith('function')) {
466
- func = func.replace('function', 'async function')
467
- }
468
- const result = await executeStrFunctionByContext(this, func, args)
469
- if (result instanceof Promise) {
470
- result.then((res) => {
471
- if (!res) return
472
- let messageType = 'success'
473
- // 如果传递了组件名字 自动调用刷新
474
- if (res?.name) {
475
- const waitRefreshRef = this.getComponentByName(res.name)
476
- if (waitRefreshRef) {
477
- waitRefreshRef.refresh()
478
- } else {
479
- console.warn(`未找到组件${res.name}无法刷新`)
480
- }
481
- }
482
- // 如果传递消息类型 自动调用消息
483
- if (res?.messageType) {
484
- messageType = res.messageType
485
- }
486
- // 如果传递了提示信息自动调用提示
487
- if (res?.message) {
488
- this.$message[messageType](res?.message)
489
- }
490
- })
491
- }
492
- }
493
- })
494
- return handlers
495
- },
496
- getComponentName (queryParamsName, serviceName, componentName) {
497
- return componentName
498
- },
499
- // 判断单元格样式
500
- determineCellStyle (cell, color = '#000', borderWidth = '1px') {
501
- // 如果声明了borderColor
502
- if (this.config.style.borderColor) {
503
- color = this.config.style.borderColor
504
- }
505
- let result = {}
506
- // 如果表格也声明了样式,用表格样式将样式覆盖
507
- if (cell.style) {
508
- if (cell.noBorder) {
509
- result = { ...cell.style }
510
- } else {
511
- if (this.noTopBorder) {
512
- result = { ...cell.style }
513
- } else {
514
- result = { ...cell.style }
515
- }
516
- }
517
- return result
518
- }
519
- return result
520
- },
521
- // 把用户定义的组件,传递到整个杉格中,方便调用
522
- passComponentNamesToAncestor (refs) {
523
- // 遍历所有 refs
524
- Object.entries(refs).forEach(([refKey, refValue]) => {
525
- // 检查 ref 是否以 dynamicComponent_ 开头
526
- if (refKey.startsWith('dynamicComponent_')) {
527
- const componentRef = refValue[0]
528
- if (componentRef) {
529
- // 去掉前缀并获取组件名字
530
- const index = refKey.replace('dynamicComponent_', '') // 去掉前缀
531
- // 传递给祖先组件
532
- this.registerComponent(index, componentRef)
533
- }
534
- }
535
- })
536
- },
537
- // 获取组件样式配置
538
- async getComponentStyleConfig (componentType) {
539
- try {
540
- // 从配置中获取样式定义
541
- const styleConfig = this.$appdata.getStylesByKey(componentType)
542
- return styleConfig || {}
543
- } catch (error) {
544
- console.error('获取组件样式配置失败:', error)
545
- return {}
546
- }
547
- },
548
-
549
- // 解析组件样式配置
550
- async parseComponentStyles (cell) {
551
- if (!cell.class) return { rootStyles: {}, childStyles: {} }
552
-
553
- const styleConfig = await this.getComponentStyleConfig(cell.slotType)
554
- if (!styleConfig) return { rootStyles: {}, childStyles: {} }
555
-
556
- const rootStyles = {}
557
- const childStyles = new Map()
558
-
559
- // 处理每个class配置
560
- cell.class.split(' ').forEach(className => {
561
- const classConfig = styleConfig[className]
562
- if (!classConfig) return
563
-
564
- // 处理根节点样式
565
- Object.entries(classConfig).forEach(([key, value]) => {
566
- if (!key.startsWith('*') && typeof key !== 'object') {
567
- rootStyles[key] = value
568
- }
569
- })
570
-
571
- // 处理子节点样式
572
- this.parseNestedStyles(classConfig, childStyles)
573
- })
574
- return {
575
- rootStyles,
576
- childStyles
577
- }
578
- },
579
-
580
- // 递归解析嵌套的样式配置
581
- parseNestedStyles (config, styleMap, parentKey = '') {
582
- Object.entries(config).forEach(([key, value]) => {
583
- if (!key.startsWith('*')) return
584
-
585
- const className = key.replace('*', '.')
586
-
587
- // 如果值是对象,检查是否包含样式和子节点
588
- if (typeof value === 'object') {
589
- const { style = {}, children = {} } = this.separateStyleAndChildren(value)
590
-
591
- // 创建或获取当前节点的样式配置
592
- if (!styleMap.has(className)) {
593
- styleMap.set(className, {
594
- styles: {},
595
- children: new Map()
596
- })
597
- }
598
-
599
- const nodeData = styleMap.get(className)
600
-
601
- // 合并样式
602
- Object.assign(nodeData.styles, style)
603
-
604
- // 递归处理子节点
605
- this.parseNestedStyles(children, nodeData.children, className)
606
- }
607
- })
608
- },
609
-
610
- // 分离样式属性和子节点配置
611
- separateStyleAndChildren (obj) {
612
- const style = {}
613
- const children = {}
614
-
615
- Object.entries(obj).forEach(([key, value]) => {
616
- if (key.startsWith('*')) {
617
- // 子节点配置
618
- children[key] = value
619
- } else {
620
- // 样式属性
621
- style[key] = value
622
- }
623
- })
624
-
625
- return { style, children }
626
- },
627
-
628
- // 应用组件样式
629
- async applyComponentStyles (component, cell, cellIndex) {
630
- if (!component || !component.$el) return
631
-
632
- const { rootStyles, childStyles } = await this.parseComponentStyles(cell)
633
-
634
- // 应用根节点样式
635
- if (Object.keys(rootStyles).length > 0) {
636
- Object.entries(rootStyles).forEach(([property, value]) => {
637
- component.$el.style.setProperty(property, value, 'important')
638
- })
639
- }
640
-
641
- // 如果没有子节点样式,直接返回
642
- if (childStyles.size === 0) return
643
-
644
- let retryCount = 0
645
- const maxRetries = 5
646
- const retryInterval = 100 // 100ms
647
-
648
- const applyStyles = () => {
649
- this.applyChildStylesOptimized(component.$el, childStyles)
650
- }
651
-
652
- // 首次应用样式
653
- applyStyles()
654
-
655
- // 创建重试机制
656
- const retryApplyStyles = () => {
657
- if (retryCount >= maxRetries) return
658
-
659
- setTimeout(() => {
660
- applyStyles()
661
- retryCount++
662
- retryApplyStyles()
663
- }, retryInterval)
664
- }
665
-
666
- // 开始重试
667
- retryApplyStyles()
668
-
669
- // 创建 MutationObserver 用于动态内容
670
- const observer = new MutationObserver((mutations) => {
671
- // 检查是否有新增节点
672
- const hasNewNodes = mutations.some(mutation =>
673
- mutation.type === 'childList' && mutation.addedNodes.length > 0
674
- )
675
-
676
- if (hasNewNodes) {
677
- applyStyles()
678
- }
679
- })
680
-
681
- // 配置 observer
682
- observer.observe(component.$el, {
683
- childList: true,
684
- subtree: true,
685
- attributes: false
686
- })
687
-
688
- // 3秒后停止观察
689
- // setTimeout(() => {
690
- // observer.disconnect()
691
- // }, 3000)
692
-
693
- // 组件销毁时清理
694
- this.$once('hook:beforeDestroy', () => {
695
- observer.disconnect()
696
- })
697
- },
698
-
699
- // 优化后的子节点样式应用方法
700
- applyChildStylesOptimized (rootElement, styleMap, parentSelector = '') {
701
- if (!rootElement) return
702
-
703
- // 处理样式映射
704
- try {
705
- for (const [selector, data] of styleMap.entries()) {
706
- const currentSelector = parentSelector ? `${parentSelector} ${selector}` : selector
707
-
708
- try {
709
- // 查找匹配的元素
710
- const elements = Array.from(rootElement.querySelectorAll(currentSelector))
711
-
712
- if (!elements.length) continue
713
-
714
- // 应用当前层级样式
715
- if (data.styles) {
716
- elements.forEach(element => {
717
- if (!element) return
718
-
719
- // 应用每个样式属性
720
- Object.entries(data.styles).forEach(([property, value]) => {
721
- try {
722
- element.style.setProperty(property, value, 'important')
723
- } catch (err) {
724
- console.warn(`设置样式失败: ${property}=${value}`, err)
725
- }
726
- })
727
- })
728
- }
729
-
730
- // 处理子层级
731
- if (data.children && data.children.size > 0) {
732
- elements.forEach(element => {
733
- if (element) {
734
- this.applyChildStylesOptimized(element, data.children, currentSelector)
735
- }
736
- })
737
- }
738
- } catch (err) {
739
- console.warn(`处理选择器失败: ${currentSelector}`, err)
740
- continue
741
- }
742
- }
743
- } catch (err) {}
744
- }
745
- },
746
- beforeMount () {
747
- if (this.useOssForImg) {
748
- this.uploadParams.resUploadMode = 'oss'
749
- }
750
- },
751
- mounted () {
752
- },
753
- }
754
-
755
- </script>
756
-
757
- <style scoped lang="less">
758
- .inputsDiv {
759
- display: flex;
760
- justify-content: space-between;
761
-
762
- .inputsDivItem {
763
- display: flex;
764
- align-items: center;
765
- padding: 0 4px;
766
- white-space: nowrap;
767
-
768
- .inputsDivItemLabel {
769
- padding: 0 4px;
770
- }
771
- }
772
- }
773
-
774
- .tdNoBorder {
775
- border-left: 1px solid #000;
776
- border-right: 1px solid #000;
777
- padding: 8px;
778
- }
779
-
780
- .tdWithBorder {
781
- border: 1px solid #000;
782
- padding: 8px;
783
- }
784
-
785
- .tdWithNoTopBorder {
786
- border-top-style: none;
787
- border-left: 1px solid #000;
788
- border-right: 1px solid #000;
789
- border-bottom: 1px solid #000;
790
- padding: 8px;
791
- }
792
-
793
- .grid-content {
794
- border-radius: 4px;
795
- min-height: 36px;
796
- text-align: center;
797
- color: #fff;
798
- background-color: #606266;
799
- }
800
-
801
- .bg-purple {
802
- background: #9254de;
803
- }
804
-
805
- .bg-purple-light {
806
- background: #b37feb;
807
- }
808
-
809
- .flexItem {
810
- border-radius: 8px;
811
- height: 100%;
812
- }
813
- </style>
1
+ <template>
2
+ <a-row id="has_row" type="flex" :gutter="gutter" :style="isWidget ? {margin: '0px'} : {'margin-bottom': '.5rem'}">
3
+ <template v-for="(cell, cellIndex) in columns">
4
+ <a-col
5
+ name="trGroup"
6
+ v-if="Array.isArray(cell) || !cell.dontShowRow"
7
+ :key="cellIndex"
8
+ :ref="`trGroup_${ cell.slotRef || cellIndex}`"
9
+ @hook:mounted="(h)=>applyAllStyles(cell,cellIndex)"
10
+ :span="calculateColSpan(cell)">
11
+ <div id="report_widget" v-if="isWidget">
12
+ <!-- 插槽渲染 -->
13
+ <template v-if="Array.isArray(cell)">
14
+ <!-- 处理 cell 是数组的情况 -->
15
+ <div v-for="(item, index) in cell" :key="index">
16
+ <x-report-tr-group
17
+ :env="env"
18
+ :key="index"
19
+ :columns="recalculateItem(item)"
20
+ :config-data="configData"
21
+ :config="config"
22
+ :display="true">
23
+ </x-report-tr-group>
24
+ </div>
25
+ </template>
26
+ <template v-else-if="cell.type === 'slot'">
27
+ <template
28
+ v-if="[
29
+ 'x-form-table',
30
+ 'h-form-table',
31
+ 'x-add-native-form',
32
+ 'h-add-native-form',
33
+ 'x-tree-pro',
34
+ 'x-his-editor',
35
+ 'x-tab',
36
+ 'h-tab',
37
+ 'x-form-group',
38
+ 'x-report',
39
+ 'x-buttons',
40
+ 'h-buttons',
41
+ 'x-label-select',
42
+ 'x-conversation',
43
+ 'x-check-list',
44
+ 'x-cardSet',
45
+ 'x-collapse',
46
+ 'x-h-descriptions',
47
+ 'x-sidebar',
48
+ 'x-list',
49
+ 'x-input',
50
+ 'x-time-line',
51
+ 'x-radio',
52
+ 'x-calendar',
53
+ 'x-time-select',
54
+ 'x-checkbox',
55
+ 'x-title',
56
+ 'x-select',
57
+ 'x-tree-rows',
58
+ 'x-three-test-orders',
59
+ 'x-shift-schedule',
60
+ 'x-charge',
61
+ 'x-questionnaire',
62
+ 'x-import-excel-button',
63
+ 'x-chart'
64
+ ].includes(cell.slotType)">
65
+ <component
66
+ :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
67
+ :key="cellIndex"
68
+ :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
69
+ v-bind="cell.attrs"
70
+ :serviceName="cell.serviceName"
71
+ :serverName="cell.serviceName"
72
+ v-on="getEventHandlers(cell)"
73
+ @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
74
+ @beforeDataChange="beforeDataChange"
75
+ @rowClick="handleRowClick"
76
+ @onExpand="onExpand"
77
+ :queryParamsName="cell.slotConfig"
78
+ :configName="cell.slotConfig"
79
+ :countVisible="false"
80
+ :env="env"
81
+ />
82
+ </template>
83
+ </template>
84
+ </div>
85
+ <a-card v-else class="flexItem" :bordered="false">
86
+ <!-- 插槽渲染 -->
87
+ <template v-if="Array.isArray(cell)">
88
+ <!-- 处理 cell 是数组的情况 -->
89
+ <div v-for="(item, index) in cell" :key="index">
90
+ <x-report-tr-group
91
+ :server-name="serverName"
92
+ :env="env"
93
+ :key="index"
94
+ :columns="recalculateItem(item)"
95
+ :config-data="configData"
96
+ :config="config"
97
+ :display="true">
98
+ </x-report-tr-group>
99
+ </div>
100
+ </template>
101
+ <template v-else-if="cell.type === 'slot'">
102
+ <template
103
+ v-if="[
104
+ 'x-form-table',
105
+ 'h-form-table',
106
+ 'x-add-native-form',
107
+ 'h-add-native-form',
108
+ 'x-tree-pro',
109
+ 'x-his-editor',
110
+ 'x-tab',
111
+ 'h-tab',
112
+ 'x-form-group',
113
+ 'x-report',
114
+ 'x-buttons',
115
+ 'h-buttons',
116
+ 'x-label-select',
117
+ 'x-conversation',
118
+ 'x-check-list',
119
+ 'x-cardSet',
120
+ 'x-collapse',
121
+ 'x-h-descriptions',
122
+ 'x-sidebar',
123
+ 'x-list',
124
+ 'x-input',
125
+ 'x-time-line',
126
+ 'x-radio',
127
+ 'x-calendar',
128
+ 'x-time-select',
129
+ 'x-checkbox',
130
+ 'x-title',
131
+ 'x-select',
132
+ 'x-tree-rows',
133
+ 'x-three-test-orders',
134
+ 'x-shift-schedule',
135
+ 'x-charge',
136
+ 'x-questionnaire',
137
+ 'x-import-excel-button',
138
+ 'x-chart'
139
+ ].includes(cell.slotType)">
140
+ <component
141
+ :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
142
+ :key="cellIndex"
143
+ :ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
144
+ v-bind="cell.attrs"
145
+ :serviceName="cell.serviceName"
146
+ :serverName="cell.serviceName"
147
+ v-on="getEventHandlers(cell)"
148
+ @hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
149
+ @beforeDataChange="beforeDataChange"
150
+ @rowClick="handleRowClick"
151
+ @onExpand="onExpand"
152
+ :queryParamsName="cell.slotConfig"
153
+ :configName="cell.slotConfig"
154
+ :countVisible="false"
155
+ :env="env"
156
+ />
157
+ </template>
158
+ </template>
159
+ </a-card>
160
+ </a-col>
161
+ </template>
162
+ </a-row>
163
+ </template>
164
+
165
+ <script>
166
+ import Upload from '@vue2-client/base-client/components/common/Upload'
167
+ import { getRealKeyData } from '@vue2-client/utils/util'
168
+ import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
169
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
170
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
171
+
172
+ export default {
173
+ name: 'XReportTrGroup',
174
+ components: {
175
+ Upload,
176
+ XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
177
+ HFormTable: () => import('@vue2-client/base-client/components/common/HIS/HFormTable/HFormTable.vue'),
178
+ XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
179
+ HAddNativeForm: () => import('@vue2-client/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue'),
180
+ XFormGroup: () => import('@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'),
181
+ XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
182
+ XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
183
+ XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
184
+ HTab: () => import('@vue2-client/base-client/components/common/HIS/HTab/HTab.vue'),
185
+ XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue'),
186
+ XButtons: () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue'),
187
+ HButtons: () => import('@vue2-client/base-client/components/common/HIS/HButtons/HButtons.vue'),
188
+ XLabelSelect: () => import('@vue2-client/base-client/components/common/XLabelSelect/XLabelSelect.vue'),
189
+ XConversation: () => import('@vue2-client/base-client/components/common/XConversation/XConversation.vue'),
190
+ XCheckList: () => import('@vue2-client/base-client/components/common/XCheckList/XCheckList.vue'),
191
+ XCardSet: () => import('@vue2-client/base-client/components/common/XCardSet/XCardSet.vue'),
192
+ XCollapse: () => import('@vue2-client/base-client/components/common/XCollapse/XCollapse.vue'),
193
+ XHDescriptions: () => import('@vue2-client/base-client/components/his/XHDescriptions/XHDescriptions.vue'),
194
+ XSidebar: () => import('@vue2-client/base-client/components/his/XSidebar/XSidebar.vue'),
195
+ XList: () => import('@vue2-client/base-client/components/his/XList/XList.vue'),
196
+ XInput: () => import('@vue2-client/base-client/components/common/XInput/XInput.vue'),
197
+ XTimeLine: () => import('@vue2-client/base-client/components/common/XTimeline/XTimeline.vue'),
198
+ XRadio: () => import('@vue2-client/base-client/components/his/XRadio/XRadio.vue'),
199
+ XCalendar: () => import('@vue2-client/base-client/components/common/XCalendar/XCalendar.vue'),
200
+ XTimeSelect: () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
201
+ XCheckbox: () => import('@vue2-client/base-client/components/his/XCheckbox/XCheckbox.vue'),
202
+ XTitle: () => import('@vue2-client/base-client/components/his/XTitle/XTitle.vue'),
203
+ XSelect: () => import('@vue2-client/base-client/components/his/XSelect/XSelect.vue'),
204
+ XTreeRows: () => import('@vue2-client/base-client/components/his/XTreeRows/XTreeRows.vue'),
205
+ XThreeTestOrders: () => import('@vue2-client/base-client/components/his/threeTestOrders/threeTestOrders.vue'),
206
+ XShiftSchedule: () => import('@vue2-client/base-client/components/his/XShiftSchedule/XShiftSchedule.vue'),
207
+ XCharge: () => import('@vue2-client/base-client/components/his/XCharge/XCharge.vue'),
208
+ XQuestionnaire: () => import('@vue2-client/base-client/components/his/XQuestionnaire/XQuestionnaire.vue'),
209
+ XImportExcelButton: () => import('@vue2-client/base-client/components/his/XImportExcelButton/XImportExcelButton.vue'),
210
+ XChart: () => import('@vue2-client/base-client/components/his/XChart/XChart.vue')
211
+ },
212
+ props: {
213
+ // 每一行的配置
214
+ columns: {
215
+ type: Array,
216
+ required: true
217
+ },
218
+ showImgInCell: {
219
+ type: Boolean,
220
+ default: false
221
+ },
222
+ config: {
223
+ type: Object,
224
+ default: function () {
225
+ return {}
226
+ }
227
+ },
228
+ // 命名空间
229
+ serverName: {
230
+ type: String,
231
+ default: 'af-system'
232
+ },
233
+ // 环境
234
+ env: {
235
+ type: String,
236
+ default: 'prod'
237
+ },
238
+ // 原始配置
239
+ configData: {
240
+ type: Object,
241
+ required: true
242
+ },
243
+ // 是否为展示行
244
+ display: {
245
+ type: Boolean,
246
+ default: false
247
+ },
248
+ },
249
+ computed: {
250
+ allSlotSum () {
251
+ // 计算总共有多少个Slot
252
+ let sum = 0
253
+ this.columns.forEach((item) => {
254
+ if (Array.isArray(item)) {
255
+ item.forEach((cell) => {
256
+ if (cell.type === 'slot') {
257
+ sum++
258
+ }
259
+ })
260
+ } else if (item.type && item.type === 'slot') {
261
+ sum++
262
+ }
263
+ })
264
+ return sum
265
+ }
266
+ },
267
+ data () {
268
+ return {
269
+ gutter: [8, { xs: 8, sm: 16, md: 24, lg: 32 }], // 设置水槽大小
270
+ maxColSpan: 12,
271
+ uploadParams: {
272
+ type: 'image',
273
+ accept: ['*'],
274
+ resUploadStock: 1,
275
+ pathKey: 'cs'
276
+ },
277
+ mixinData: {},
278
+ flexItemBodyState: {},
279
+ // 已经渲染得插槽得数量
280
+ slotRendered: 0,
281
+ // tableConfig: {}
282
+ }
283
+ },
284
+ watch: {
285
+ columns: {
286
+ deep: true,
287
+ immediate: true,
288
+ handler (newVal) {
289
+ // 使用nextTick确保DOM更新
290
+ this.$nextTick(() => {
291
+ this.$forceUpdate()
292
+ })
293
+ }
294
+ }
295
+ },
296
+ inject: {
297
+ openDialog: { default: false },
298
+ emitEvent: { default: false },
299
+ registerComponent: { default: false },
300
+ setColSpanByName: { default: false },
301
+ setGlobalData: { default: false },
302
+ getGlobalData: { default: false },
303
+ getComponentByName: { default: false },
304
+ runLogic: { default: false },
305
+ getMixinData: { default: false },
306
+ getSelectedId: { default: false },
307
+ isInAModal: { default: false },
308
+ getConfigByName: { default: false },
309
+ getSelectedData: { default: false },
310
+ getOutEnv: { default: false },
311
+ currUser: { default: false },
312
+ isWidget: { default: false },
313
+ findComponentByName: { default: false },
314
+ closeAddReport: { default: false }
315
+ },
316
+ methods: {
317
+ getWindow,
318
+ isMicroAppEnv,
319
+ microDispatch,
320
+ getMicroData,
321
+ getRealKeyData,
322
+ handleRowClick (record) {
323
+ this.$emit('rowClick', record)
324
+ },
325
+ beforeDataChange (record) {
326
+ this.$emit('beforeDataChange', record)
327
+ },
328
+ onExpand (expanded, record) {
329
+ this.$emit('expand', expanded, record)
330
+ },
331
+ listClick (data) {
332
+ this.$emit('listClick', data)
333
+ },
334
+ calculateColSpan (cell) {
335
+ return Array.isArray(cell)
336
+ ? cell[0][0]?.colSpan * 2
337
+ : (cell?.colSpan ?? cell?.def?.colSpan ?? 1) * 2
338
+ },
339
+ applyAllStyles (cell, cellIndex) {
340
+ // 应用组件样式
341
+ const component = this.$refs[`trGroup_${ cell.slotRef || cellIndex}`][0]
342
+ // 确保组件已经完全挂载
343
+ this.$nextTick(() => {
344
+ this.applyComponentStyles(component, cell, cellIndex)
345
+ })
346
+ },
347
+ onComponentMounted (h, cell, cellIndex) {
348
+ this.slotRendered += 1
349
+ if (this.slotRendered >= this.allSlotSum) {
350
+ this.$emit('slotRendered')
351
+ }
352
+ if (this.getMixinData && this.getMixinData()) {
353
+ this.mixinData = this.getMixinData()
354
+ }
355
+ if (cell.slotRef) {
356
+ this.registerComponent(cell.slotRef, this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0])
357
+ }
358
+ // 传递给祖先组件
359
+ const shouldInit = cell.shouldInit == null ? true : cell.shouldInit
360
+ if (shouldInit) {
361
+ if (cell.slotType === 'x-add-native-form') {
362
+ // 简易表单需要主动调用初始化方法
363
+ getConfigByName(cell.slotConfig, cell.serviceName, async (res) => {
364
+ // 如果配置了 表单初始化logic
365
+ // 调用 logic 获取参数
366
+ let param = { ...this.mixinData }
367
+ let selectedId
368
+ if (res.paramLogicName) {
369
+ if (!!this.getSelectedId) {
370
+ selectedId = this.getSelectedId()
371
+ if (typeof selectedId !== 'object') {
372
+ selectedId = { selectedId: selectedId }
373
+ }
374
+ }
375
+ param = Object.assign(param, await runLogic(res.paramLogicName, selectedId, cell.serviceName))
376
+ }
377
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
378
+ serviceName: cell.serviceName,
379
+ configName: cell.slotConfig,
380
+ formItems: res.formJson,
381
+ showSubmitBtn: !this.isInAModal,
382
+ businessType: param.businessType || '新增',
383
+ layout: res.xAddFormLayout,
384
+ primaryKey: res.primaryKey,
385
+ ...res,
386
+ fixedAddForm: param,
387
+ modifyModelData: {
388
+ files: param.files,
389
+ images: param.images
390
+ }
391
+ })
392
+ }, this.env === 'dev')
393
+ } else if (cell.slotType === 'x-form-group') {
394
+ // 简易表单需要主动调用初始化方法
395
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
396
+ // 如果配置了 表单初始化logic
397
+ // 调用 logic 获取参数
398
+ const param = { ...this.mixinData }
399
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
400
+ ...res,
401
+ serviceName: cell.serviceName,
402
+ showSubmitBtn: !this.isInAModal,
403
+ businessType: param.businessType || '新增',
404
+ modifyModelData: param,
405
+ showLeftTab: true,
406
+ })
407
+ }, this.env === 'dev')
408
+ } else if (cell.slotType === 'x-label-select') {
409
+ // 按钮组需要主动调用初始化方法
410
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
411
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
412
+ ...res,
413
+ serviceName: cell.serviceName,
414
+ })
415
+ }, this.env === 'dev')
416
+ }
417
+ }
418
+ if (cell.slotType === 'x-report') {
419
+ const param = { ...this.mixinData }
420
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init(param)
421
+ }
422
+ if (cell.slotType === 'x-conversation') {
423
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
424
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
425
+ serviceName: cell.serviceName,
426
+ ...res,
427
+ })
428
+ }, this.env === 'dev')
429
+ }
430
+ if (cell.slotType === 'x-check-list') {
431
+ getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
432
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
433
+ serviceName: cell.serviceName,
434
+ ...res,
435
+ })
436
+ }, this.env === 'dev')
437
+ }
438
+ },
439
+ recalculateItem (item) {
440
+ const totalColSpan = item.reduce((sum, cell) => {
441
+ // 保留手动设置的colSpan
442
+ return sum + (cell._isManualColSpan ? 0 : (cell.colSpan || 1))
443
+ }, 0)
444
+ return item.map(cell => {
445
+ // 跳过已手动设置的单元格
446
+ if (cell._isManualColSpan) return cell
447
+ const newColSpan = Math.round((cell.colSpan || 1) / totalColSpan * 12)
448
+ return {
449
+ ...cell,
450
+ colSpan: newColSpan,
451
+ // 标记自动计算的单元格
452
+ _isAutoCalculated: true
453
+ }
454
+ })
455
+ },
456
+
457
+ getEventHandlers (cell) {
458
+ const handlers = {}
459
+ if (!cell?.events || cell?.events?.length === 0) {
460
+ return handlers
461
+ }
462
+ cell.events.forEach(event => {
463
+ handlers[event.type] = async (...args) => {
464
+ let func = event.customFunction
465
+ if (func && func.startsWith('function')) {
466
+ func = func.replace('function', 'async function')
467
+ }
468
+ const result = await executeStrFunctionByContext(this, func, args)
469
+ if (result instanceof Promise) {
470
+ result.then((res) => {
471
+ if (!res) return
472
+ let messageType = 'success'
473
+ // 如果传递了组件名字 自动调用刷新
474
+ if (res?.name) {
475
+ const waitRefreshRef = this.getComponentByName(res.name)
476
+ if (waitRefreshRef) {
477
+ waitRefreshRef.refresh()
478
+ } else {
479
+ console.warn(`未找到组件${res.name}无法刷新`)
480
+ }
481
+ }
482
+ // 如果传递消息类型 自动调用消息
483
+ if (res?.messageType) {
484
+ messageType = res.messageType
485
+ }
486
+ // 如果传递了提示信息自动调用提示
487
+ if (res?.message) {
488
+ this.$message[messageType](res?.message)
489
+ }
490
+ })
491
+ }
492
+ }
493
+ })
494
+ return handlers
495
+ },
496
+ getComponentName (queryParamsName, serviceName, componentName) {
497
+ return componentName
498
+ },
499
+ // 判断单元格样式
500
+ determineCellStyle (cell, color = '#000', borderWidth = '1px') {
501
+ // 如果声明了borderColor
502
+ if (this.config.style.borderColor) {
503
+ color = this.config.style.borderColor
504
+ }
505
+ let result = {}
506
+ // 如果表格也声明了样式,用表格样式将样式覆盖
507
+ if (cell.style) {
508
+ if (cell.noBorder) {
509
+ result = { ...cell.style }
510
+ } else {
511
+ if (this.noTopBorder) {
512
+ result = { ...cell.style }
513
+ } else {
514
+ result = { ...cell.style }
515
+ }
516
+ }
517
+ return result
518
+ }
519
+ return result
520
+ },
521
+ // 把用户定义的组件,传递到整个杉格中,方便调用
522
+ passComponentNamesToAncestor (refs) {
523
+ // 遍历所有 refs
524
+ Object.entries(refs).forEach(([refKey, refValue]) => {
525
+ // 检查 ref 是否以 dynamicComponent_ 开头
526
+ if (refKey.startsWith('dynamicComponent_')) {
527
+ const componentRef = refValue[0]
528
+ if (componentRef) {
529
+ // 去掉前缀并获取组件名字
530
+ const index = refKey.replace('dynamicComponent_', '') // 去掉前缀
531
+ // 传递给祖先组件
532
+ this.registerComponent(index, componentRef)
533
+ }
534
+ }
535
+ })
536
+ },
537
+ // 获取组件样式配置
538
+ async getComponentStyleConfig (componentType) {
539
+ try {
540
+ // 从配置中获取样式定义
541
+ const styleConfig = this.$appdata.getStylesByKey(componentType)
542
+ return styleConfig || {}
543
+ } catch (error) {
544
+ console.error('获取组件样式配置失败:', error)
545
+ return {}
546
+ }
547
+ },
548
+
549
+ // 解析组件样式配置
550
+ async parseComponentStyles (cell) {
551
+ if (!cell.class) return { rootStyles: {}, childStyles: {} }
552
+
553
+ const styleConfig = await this.getComponentStyleConfig(cell.slotType)
554
+ if (!styleConfig) return { rootStyles: {}, childStyles: {} }
555
+
556
+ const rootStyles = {}
557
+ const childStyles = new Map()
558
+
559
+ // 处理每个class配置
560
+ cell.class.split(' ').forEach(className => {
561
+ const classConfig = styleConfig[className]
562
+ if (!classConfig) return
563
+
564
+ // 处理根节点样式
565
+ Object.entries(classConfig).forEach(([key, value]) => {
566
+ if (!key.startsWith('*') && typeof key !== 'object') {
567
+ rootStyles[key] = value
568
+ }
569
+ })
570
+
571
+ // 处理子节点样式
572
+ this.parseNestedStyles(classConfig, childStyles)
573
+ })
574
+ return {
575
+ rootStyles,
576
+ childStyles
577
+ }
578
+ },
579
+
580
+ // 递归解析嵌套的样式配置
581
+ parseNestedStyles (config, styleMap, parentKey = '') {
582
+ Object.entries(config).forEach(([key, value]) => {
583
+ if (!key.startsWith('*')) return
584
+
585
+ const className = key.replace('*', '.')
586
+
587
+ // 如果值是对象,检查是否包含样式和子节点
588
+ if (typeof value === 'object') {
589
+ const { style = {}, children = {} } = this.separateStyleAndChildren(value)
590
+
591
+ // 创建或获取当前节点的样式配置
592
+ if (!styleMap.has(className)) {
593
+ styleMap.set(className, {
594
+ styles: {},
595
+ children: new Map()
596
+ })
597
+ }
598
+
599
+ const nodeData = styleMap.get(className)
600
+
601
+ // 合并样式
602
+ Object.assign(nodeData.styles, style)
603
+
604
+ // 递归处理子节点
605
+ this.parseNestedStyles(children, nodeData.children, className)
606
+ }
607
+ })
608
+ },
609
+
610
+ // 分离样式属性和子节点配置
611
+ separateStyleAndChildren (obj) {
612
+ const style = {}
613
+ const children = {}
614
+
615
+ Object.entries(obj).forEach(([key, value]) => {
616
+ if (key.startsWith('*')) {
617
+ // 子节点配置
618
+ children[key] = value
619
+ } else {
620
+ // 样式属性
621
+ style[key] = value
622
+ }
623
+ })
624
+
625
+ return { style, children }
626
+ },
627
+
628
+ // 应用组件样式
629
+ async applyComponentStyles (component, cell, cellIndex) {
630
+ if (!component || !component.$el) return
631
+
632
+ const { rootStyles, childStyles } = await this.parseComponentStyles(cell)
633
+
634
+ // 应用根节点样式
635
+ if (Object.keys(rootStyles).length > 0) {
636
+ Object.entries(rootStyles).forEach(([property, value]) => {
637
+ component.$el.style.setProperty(property, value, 'important')
638
+ })
639
+ }
640
+
641
+ // 如果没有子节点样式,直接返回
642
+ if (childStyles.size === 0) return
643
+
644
+ let retryCount = 0
645
+ const maxRetries = 5
646
+ const retryInterval = 100 // 100ms
647
+
648
+ const applyStyles = () => {
649
+ this.applyChildStylesOptimized(component.$el, childStyles)
650
+ }
651
+
652
+ // 首次应用样式
653
+ applyStyles()
654
+
655
+ // 创建重试机制
656
+ const retryApplyStyles = () => {
657
+ if (retryCount >= maxRetries) return
658
+
659
+ setTimeout(() => {
660
+ applyStyles()
661
+ retryCount++
662
+ retryApplyStyles()
663
+ }, retryInterval)
664
+ }
665
+
666
+ // 开始重试
667
+ retryApplyStyles()
668
+
669
+ // 创建 MutationObserver 用于动态内容
670
+ const observer = new MutationObserver((mutations) => {
671
+ // 检查是否有新增节点
672
+ const hasNewNodes = mutations.some(mutation =>
673
+ mutation.type === 'childList' && mutation.addedNodes.length > 0
674
+ )
675
+
676
+ if (hasNewNodes) {
677
+ applyStyles()
678
+ }
679
+ })
680
+
681
+ // 配置 observer
682
+ observer.observe(component.$el, {
683
+ childList: true,
684
+ subtree: true,
685
+ attributes: false
686
+ })
687
+
688
+ // 3秒后停止观察
689
+ // setTimeout(() => {
690
+ // observer.disconnect()
691
+ // }, 3000)
692
+
693
+ // 组件销毁时清理
694
+ this.$once('hook:beforeDestroy', () => {
695
+ observer.disconnect()
696
+ })
697
+ },
698
+
699
+ // 优化后的子节点样式应用方法
700
+ applyChildStylesOptimized (rootElement, styleMap, parentSelector = '') {
701
+ if (!rootElement) return
702
+
703
+ // 处理样式映射
704
+ try {
705
+ for (const [selector, data] of styleMap.entries()) {
706
+ const currentSelector = parentSelector ? `${parentSelector} ${selector}` : selector
707
+
708
+ try {
709
+ // 查找匹配的元素
710
+ const elements = Array.from(rootElement.querySelectorAll(currentSelector))
711
+
712
+ if (!elements.length) continue
713
+
714
+ // 应用当前层级样式
715
+ if (data.styles) {
716
+ elements.forEach(element => {
717
+ if (!element) return
718
+
719
+ // 应用每个样式属性
720
+ Object.entries(data.styles).forEach(([property, value]) => {
721
+ try {
722
+ element.style.setProperty(property, value, 'important')
723
+ } catch (err) {
724
+ console.warn(`设置样式失败: ${property}=${value}`, err)
725
+ }
726
+ })
727
+ })
728
+ }
729
+
730
+ // 处理子层级
731
+ if (data.children && data.children.size > 0) {
732
+ elements.forEach(element => {
733
+ if (element) {
734
+ this.applyChildStylesOptimized(element, data.children, currentSelector)
735
+ }
736
+ })
737
+ }
738
+ } catch (err) {
739
+ console.warn(`处理选择器失败: ${currentSelector}`, err)
740
+ continue
741
+ }
742
+ }
743
+ } catch (err) {}
744
+ }
745
+ },
746
+ beforeMount () {
747
+ if (this.useOssForImg) {
748
+ this.uploadParams.resUploadMode = 'oss'
749
+ }
750
+ },
751
+ mounted () {
752
+ },
753
+ }
754
+
755
+ </script>
756
+
757
+ <style scoped lang="less">
758
+ .inputsDiv {
759
+ display: flex;
760
+ justify-content: space-between;
761
+
762
+ .inputsDivItem {
763
+ display: flex;
764
+ align-items: center;
765
+ padding: 0 4px;
766
+ white-space: nowrap;
767
+
768
+ .inputsDivItemLabel {
769
+ padding: 0 4px;
770
+ }
771
+ }
772
+ }
773
+
774
+ .tdNoBorder {
775
+ border-left: 1px solid #000;
776
+ border-right: 1px solid #000;
777
+ padding: 8px;
778
+ }
779
+
780
+ .tdWithBorder {
781
+ border: 1px solid #000;
782
+ padding: 8px;
783
+ }
784
+
785
+ .tdWithNoTopBorder {
786
+ border-top-style: none;
787
+ border-left: 1px solid #000;
788
+ border-right: 1px solid #000;
789
+ border-bottom: 1px solid #000;
790
+ padding: 8px;
791
+ }
792
+
793
+ .grid-content {
794
+ border-radius: 4px;
795
+ min-height: 36px;
796
+ text-align: center;
797
+ color: #fff;
798
+ background-color: #606266;
799
+ }
800
+
801
+ .bg-purple {
802
+ background: #9254de;
803
+ }
804
+
805
+ .bg-purple-light {
806
+ background: #b37feb;
807
+ }
808
+
809
+ .flexItem {
810
+ border-radius: 8px;
811
+ height: 100%;
812
+ }
813
+ </style>