vue2-client 1.10.6 → 1.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/.env +19 -19
  2. package/.env.gaslink +19 -19
  3. package/.env.his +19 -19
  4. package/.env.liuli +19 -19
  5. package/.env.revenue +19 -19
  6. package/.env.scada +19 -19
  7. package/.eslintrc.js +90 -90
  8. package/CHANGELOG.md +824 -824
  9. package/Components.md +60 -60
  10. package/babel.config.js +21 -21
  11. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +45 -45
  12. package/docs/LowCode/lowcode.md +155 -155
  13. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  14. package/docs/index.md +30 -30
  15. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +174 -174
  16. package/index.js +31 -31
  17. package/jest-transform-stub.js +8 -8
  18. package/jest.config.js +21 -21
  19. package/jest.setup.js +7 -7
  20. package/jsconfig.json +19 -19
  21. package/package.json +107 -107
  22. package/public/his/editor/editor.html +51 -51
  23. package/public/his/editor/mock/bind_data.html +779 -779
  24. package/public/his/editor/mock/data_table.html +40 -40
  25. package/public/his/editor/mock/sign.html +75 -75
  26. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  27. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  28. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  29. package/public/his/editor/vender/date97/calendar.js +4 -4
  30. package/public/his/editor/vender/date97/lang/en.js +13 -13
  31. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  32. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  33. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  34. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  35. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  36. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  37. package/public/his/editor/vender/diff.js +1627 -1627
  38. package/public/his/editor/vender/editor.js +1 -1
  39. package/public/his/editor/vender/fabric.js +31187 -31187
  40. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  41. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  42. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  43. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  44. package/public/his/editor/vender/mui/mui.min.css +4 -4
  45. package/public/his/editor/vender/mui/mui.min.js +5 -5
  46. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  47. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  48. package/public/his/editor/vender/qrcode.js +7 -7
  49. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  50. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  51. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  52. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  53. package/public/his/editor/vender/validator.js +5094 -5094
  54. package/public/his/editor/vender/weui/weui.css +5659 -5659
  55. package/public/his/editor/vender/weui/weui.min.css +4 -4
  56. package/public/his/editor/vender/weui/weui.min.js +11 -11
  57. package/src/App.vue +196 -196
  58. package/src/ReportView.js +19 -19
  59. package/src/assets/img/querySlotDemo.svg +15 -15
  60. package/src/assets/svg/badtwo.svg +1 -1
  61. package/src/assets/svg/goodtwo.svg +1 -1
  62. package/src/base-client/components/AI/AskAiBtn.vue +136 -136
  63. package/src/base-client/components/AI/demo.vue +31 -31
  64. package/src/base-client/components/common/AMisRender/index.js +3 -3
  65. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  66. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +470 -470
  67. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  68. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  69. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  70. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  71. package/src/base-client/components/common/CitySelect/CitySelect.vue +342 -342
  72. package/src/base-client/components/common/CitySelect/index.js +3 -3
  73. package/src/base-client/components/common/CitySelect/index.md +109 -109
  74. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  75. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  76. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  77. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  78. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  79. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  80. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  81. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  82. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  83. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  84. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  85. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  86. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  87. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  88. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  89. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  90. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  91. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  92. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  93. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  94. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  95. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  96. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  97. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  98. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  99. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  100. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  101. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  102. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  103. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  104. package/src/base-client/components/common/Recording/Recording.vue +243 -243
  105. package/src/base-client/components/common/Recording/index.js +3 -3
  106. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  107. package/src/base-client/components/common/Tree/index.js +2 -2
  108. package/src/base-client/components/common/Upload/Upload.vue +239 -239
  109. package/src/base-client/components/common/Upload/index.js +3 -3
  110. package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
  111. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +1069 -1066
  112. package/src/base-client/components/common/XAddNativeForm/demo.vue +36 -35
  113. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  114. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  115. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  116. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  117. package/src/base-client/components/common/XAddReport/XAddReport.vue +207 -207
  118. package/src/base-client/components/common/XAddReport/index.js +3 -3
  119. package/src/base-client/components/common/XAddReport/index.md +56 -56
  120. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  121. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  122. package/src/base-client/components/common/XButtons/XButtons.vue +71 -71
  123. package/src/base-client/components/common/XButtons/index.js +3 -3
  124. package/src/base-client/components/common/XButtons/index.md +61 -61
  125. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  126. package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
  127. package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
  128. package/src/base-client/components/common/XConversation/XConversation.vue +263 -263
  129. package/src/base-client/components/common/XConversation/XConversationDemo.vue +28 -28
  130. package/src/base-client/components/common/XDataCard/XDataCard.vue +411 -411
  131. package/src/base-client/components/common/XDataCard/index.js +3 -3
  132. package/src/base-client/components/common/XDataCard/index.md +1 -1
  133. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  134. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  135. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  136. package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
  137. package/src/base-client/components/common/XDatePicker/index.vue +259 -259
  138. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +169 -169
  139. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +304 -304
  140. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  141. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  142. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  143. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  144. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  145. package/src/base-client/components/common/XForm/XForm.vue +393 -393
  146. package/src/base-client/components/common/XForm/XFormItem.vue +1286 -1263
  147. package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
  148. package/src/base-client/components/common/XForm/XTreeSelect.vue +250 -250
  149. package/src/base-client/components/common/XForm/index.md +178 -178
  150. package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
  151. package/src/base-client/components/common/XFormCol/XFormCol.vue +157 -146
  152. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +295 -295
  153. package/src/base-client/components/common/XFormGroup/demo.vue +45 -45
  154. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  155. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  156. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  157. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  158. package/src/base-client/components/common/XFormTable/XFormTable.vue +854 -854
  159. package/src/base-client/components/common/XFormTable/demo.vue +60 -60
  160. package/src/base-client/components/common/XFormTable/index.md +92 -92
  161. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +167 -167
  162. package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
  163. package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
  164. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  165. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  166. package/src/base-client/components/common/XPrint/Demo.vue +41 -41
  167. package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
  168. package/src/base-client/components/common/XPrint/PrintBill.vue +302 -302
  169. package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
  170. package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
  171. package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
  172. package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
  173. package/src/base-client/components/common/XPrint/index.vue +97 -97
  174. package/src/base-client/components/common/XReport/XReport.vue +892 -892
  175. package/src/base-client/components/common/XReport/XReportDemo.vue +304 -304
  176. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  177. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  178. package/src/base-client/components/common/XReport/XReportTrGroup.vue +808 -808
  179. package/src/base-client/components/common/XReport/index.js +3 -3
  180. package/src/base-client/components/common/XReport/index.md +44 -44
  181. package/src/base-client/components/common/XReport/print.js +186 -186
  182. package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +201 -201
  183. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  184. package/src/base-client/components/common/XReportGrid/XReport.vue +1070 -1070
  185. package/src/base-client/components/common/XReportGrid/XReportDemo.vue +47 -47
  186. package/src/base-client/components/common/XReportGrid/XReportDesign.vue +628 -628
  187. package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
  188. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +1104 -1104
  189. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  190. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  191. package/src/base-client/components/common/XReportGrid/print.js +184 -184
  192. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  193. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  194. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  195. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  196. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  197. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  198. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  199. package/src/base-client/components/common/XStepView/index.js +3 -3
  200. package/src/base-client/components/common/XStepView/index.md +31 -31
  201. package/src/base-client/components/common/XTab/XTab.vue +201 -201
  202. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  203. package/src/base-client/components/common/XTab/index.js +3 -3
  204. package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
  205. package/src/base-client/components/common/XTable/ExportExcel.vue +284 -284
  206. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  207. package/src/base-client/components/common/XTable/XTable.vue +1415 -1415
  208. package/src/base-client/components/common/XTable/index.md +255 -255
  209. package/src/base-client/components/common/XTagGroup/index.vue +52 -52
  210. package/src/base-client/components/common/XTree/XTree.vue +423 -423
  211. package/src/base-client/components/common/XTree/XTreePro.vue +451 -451
  212. package/src/base-client/components/common/XTree/index.js +3 -3
  213. package/src/base-client/components/common/XTree/index.md +36 -36
  214. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  215. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  216. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  217. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  218. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +359 -359
  219. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  220. package/src/base-client/components/index.js +51 -51
  221. package/src/base-client/components/layout/XPageView/RenderRow.vue +63 -63
  222. package/src/base-client/components/layout/XPageView/XErrorView.vue +11 -11
  223. package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
  224. package/src/base-client/components/layout/XPageView/index.js +3 -3
  225. package/src/base-client/components/layout/XPageView/index.md +38 -38
  226. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  227. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  228. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  229. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  230. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  231. package/src/base-client/plugins/AppData.js +121 -121
  232. package/src/base-client/plugins/Config.js +19 -19
  233. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  234. package/src/base-client/plugins/Recording.js +258 -258
  235. package/src/base-client/plugins/index.js +23 -23
  236. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  237. package/src/bootstrap.js +42 -42
  238. package/src/components/Charts/Bar.vue +62 -62
  239. package/src/components/Charts/ChartCard.vue +134 -134
  240. package/src/components/Charts/Liquid.vue +67 -67
  241. package/src/components/Charts/MiniArea.vue +39 -39
  242. package/src/components/Charts/MiniBar.vue +39 -39
  243. package/src/components/Charts/MiniProgress.vue +75 -75
  244. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  245. package/src/components/Charts/Radar.vue +68 -68
  246. package/src/components/Charts/RankList.vue +77 -77
  247. package/src/components/Charts/TagCloud.vue +113 -113
  248. package/src/components/Charts/TransferBar.vue +64 -64
  249. package/src/components/Charts/Trend.vue +82 -82
  250. package/src/components/Charts/chart.less +12 -12
  251. package/src/components/Charts/smooth.area.less +13 -13
  252. package/src/components/CodeMirror/inedx.vue +118 -118
  253. package/src/components/CodeMirror/setting.js +40 -40
  254. package/src/components/FilePreview/FilePreview.vue +166 -166
  255. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  256. package/src/components/NumberInfo/index.js +3 -3
  257. package/src/components/NumberInfo/index.less +54 -54
  258. package/src/components/NumberInfo/index.md +43 -43
  259. package/src/components/STable/index.js +390 -390
  260. package/src/components/card/ChartCard.vue +79 -79
  261. package/src/components/chart/Bar.vue +60 -60
  262. package/src/components/chart/MiniArea.vue +67 -67
  263. package/src/components/chart/MiniBar.vue +59 -59
  264. package/src/components/chart/MiniProgress.vue +57 -57
  265. package/src/components/chart/Radar.vue +80 -80
  266. package/src/components/chart/RankingList.vue +60 -60
  267. package/src/components/chart/Trend.vue +79 -79
  268. package/src/components/chart/index.less +9 -9
  269. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  270. package/src/components/checkbox/ImgCheckbox.vue +117 -117
  271. package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
  272. package/src/components/checkbox/index.js +9 -9
  273. package/src/components/exception/ExceptionPage.vue +70 -70
  274. package/src/components/g2Charts/constants.js +202 -202
  275. package/src/components/g2Charts/demo.vue +808 -808
  276. package/src/components/g2Charts/designer.vue +228 -228
  277. package/src/components/g2Charts/designerBaseConfig.vue +61 -61
  278. package/src/components/g2Charts/designerDataConfig.vue +259 -259
  279. package/src/components/g2Charts/designerStyleConfig.vue +16 -16
  280. package/src/components/g2Charts/index.vue +397 -397
  281. package/src/components/index.js +36 -36
  282. package/src/components/input/IInput.vue +66 -66
  283. package/src/components/menu/SideMenu.vue +75 -75
  284. package/src/components/menu/menu.js +273 -273
  285. package/src/components/setting/Setting.vue +234 -234
  286. package/src/components/tool/AStepItem.vue +60 -60
  287. package/src/config/CreateQueryConfig.js +325 -325
  288. package/src/config/default/antd.config.js +89 -89
  289. package/src/config/default/setting.config.js +55 -55
  290. package/src/font-style/font.css +4 -4
  291. package/src/layouts/CommonLayout.vue +56 -56
  292. package/src/layouts/GridView.vue +45 -45
  293. package/src/layouts/PageLayout.vue +151 -151
  294. package/src/layouts/SinglePageView.vue +136 -136
  295. package/src/layouts/header/AdminHeader.vue +132 -132
  296. package/src/layouts/header/HeaderNotice.vue +177 -177
  297. package/src/layouts/header/InstitutionDetail.vue +181 -181
  298. package/src/layouts/tabs/TabsHead.vue +189 -189
  299. package/src/layouts/tabs/TabsView.vue +390 -390
  300. package/src/lib.js +1 -1
  301. package/src/main.js +34 -34
  302. package/src/mock/extend/index.js +84 -84
  303. package/src/mock/goods/index.js +108 -108
  304. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  305. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  306. package/src/pages/DefaultExample/index.vue +77 -77
  307. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  308. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  309. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  310. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  311. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  312. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  313. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  314. package/src/pages/DynamicStatistics/index.vue +282 -282
  315. package/src/pages/Example/childIndex.vue +15 -15
  316. package/src/pages/Example/index.vue +30 -30
  317. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  318. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  319. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  320. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  321. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  322. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  323. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  324. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  325. package/src/pages/Recording/index.vue +77 -77
  326. package/src/pages/ReportGrid/index.vue +76 -76
  327. package/src/pages/ServiceReview/index.vue +284 -284
  328. package/src/pages/SubExample/index.vue +26 -26
  329. package/src/pages/WorkflowDetail/WorkFlowDemo.vue +32 -32
  330. package/src/pages/WorkflowDetail/WorkflowDetail.vue +230 -230
  331. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +131 -131
  332. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  333. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformation.vue +302 -302
  334. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformationDetails.vue +276 -276
  335. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +864 -864
  336. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandleReso.vue +997 -997
  337. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +222 -222
  338. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkOrderParentDetails.vue +233 -233
  339. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowDetailResso.vue +261 -261
  340. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowListResolution.vue +248 -248
  341. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +73 -73
  342. package/src/pages/XPageViewExample/index.vue +38 -38
  343. package/src/pages/XReportView/index.vue +64 -64
  344. package/src/pages/XTreeOneProExample/index.vue +67 -67
  345. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  346. package/src/pages/login/Login.vue +378 -378
  347. package/src/pages/login/LoginV3.vue +389 -389
  348. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  349. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  350. package/src/pages/report/ReportTable.js +124 -124
  351. package/src/pages/resourceManage/orgListManage.vue +98 -98
  352. package/src/pages/system/dictionary/index.vue +44 -44
  353. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  354. package/src/pages/system/monitor/operLog/index.vue +37 -37
  355. package/src/pages/system/settings/modifyPassword.vue +117 -117
  356. package/src/pages/system/ticket/index.vue +480 -480
  357. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  358. package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
  359. package/src/pages/userInfoDetailManage/FillCardRecordQuery/index.vue +76 -76
  360. package/src/pages/userInfoDetailManage/FillGasRecordQuery/index.vue +74 -74
  361. package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
  362. package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
  363. package/src/pages/userInfoDetailManage/MachineRecordQuery/index.vue +74 -74
  364. package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
  365. package/src/pages/userInfoDetailManage/OtherChargeRecordQuery/index.vue +74 -74
  366. package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
  367. package/src/pages/userInfoDetailManage/UserChargeRecordQuery/index.vue +92 -92
  368. package/src/pages/userInfoDetailManage/UserHandRecordQuery/index.vue +86 -86
  369. package/src/pages/userInfoDetailManage/UserRecordQuery/index.vue +73 -73
  370. package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
  371. package/src/pages/userInfoDetailManage/index.vue +82 -82
  372. package/src/pages/userInfoDetailManage/userInfoDetailQueryTabs.vue +132 -132
  373. package/src/plugins/EventLogPlugin.js +33 -33
  374. package/src/plugins/FindParentsData.js +17 -17
  375. package/src/plugins/HiPrintPlugin.js +124 -124
  376. package/src/router/async/config.async.js +35 -35
  377. package/src/router/async/router.map.js +188 -188
  378. package/src/router/guards.js +263 -263
  379. package/src/router/index.js +27 -27
  380. package/src/router.js +19 -19
  381. package/src/services/DataModel.js +30 -30
  382. package/src/services/LodopFuncs.js +137 -137
  383. package/src/services/api/TicketDetailsViewApi.js +46 -46
  384. package/src/services/api/cas.js +79 -79
  385. package/src/services/api/common.js +346 -346
  386. package/src/services/api/entity.js +18 -18
  387. package/src/services/api/index.js +17 -17
  388. package/src/services/api/restTools.js +145 -145
  389. package/src/services/apiService.js +15 -15
  390. package/src/services/user.js +90 -90
  391. package/src/services/v3Api.js +116 -116
  392. package/src/store/modules/account.js +115 -115
  393. package/src/store/modules/index.js +5 -5
  394. package/src/store/modules/lowCode.js +33 -33
  395. package/src/store/modules/setting.js +119 -119
  396. package/src/theme/default/style.less +58 -58
  397. package/src/theme/global.less +159 -159
  398. package/src/utils/authority-utils.js +85 -85
  399. package/src/utils/errorCode.js +6 -6
  400. package/src/utils/formatter.js +74 -74
  401. package/src/utils/htmlToPDF.js +108 -108
  402. package/src/utils/htmlToPDFApi.js +5 -5
  403. package/src/utils/indexedDB.js +263 -263
  404. package/src/utils/login.js +188 -188
  405. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  406. package/src/utils/lowcode/lowcodeLog.js +29 -29
  407. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  408. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  409. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  410. package/src/utils/map-utils.js +47 -47
  411. package/src/utils/microAppUtils.js +40 -40
  412. package/src/utils/reg.js +95 -95
  413. package/src/utils/request.js +362 -362
  414. package/src/utils/routerUtil.js +450 -450
  415. package/src/utils/runEvalFunction.js +14 -14
  416. package/src/utils/util.js +310 -310
  417. package/src/utils/waterMark.js +31 -31
  418. package/test/Amis.spec.js +163 -163
  419. package/test/Tree.spec.js +167 -167
  420. package/test/myDialog.spec.js +46 -46
  421. package/test/util.test.js +52 -52
  422. package/test/v3Api.test.js +1983 -1983
  423. package/vue.config.js +213 -213
  424. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,1415 +1,1415 @@
1
- <template>
2
- <div v-show="tableColumns.length > 0">
3
- <a-row :gutter="48">
4
- <a-col v-show="showLeftOperaBtn">
5
- <span :style="{ float: 'left', overflow: 'hidden', marginBottom: '8px' }">
6
- <a-space>
7
- <!-- <a-button v-if="eventState.customDelete" type="primary" @click="custom('customDelete')">-->
8
- <!-- <a-icon type="delete"/>删除-->
9
- <!-- </a-button>-->
10
- <!-- <a-button v-if="eventState.customSave" type="primary" @click="custom('customSave')">-->
11
- <!-- <a-icon type="save"/>保存-->
12
- <!-- </a-button>-->
13
- <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
14
- <a-button v-if="buttonState.add && buttonRendering('add')" type="primary" @click="add">
15
- <a-icon type="plus"/>新增
16
- </a-button>
17
- <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
18
- <a-icon type="plus"/>添加
19
- </a-button>
20
- <a-button
21
- v-if="buttonState.choose && buttonRendering('choose')"
22
- :disabled="!isChoose"
23
- type="primary"
24
- @click="choose">
25
- <a-icon type="check-square"/>选择
26
- </a-button>
27
- <a-button
28
- v-if="buttonState.edit && buttonRendering('edit')"
29
- :disabled="!isModify"
30
- :loading="editLoading"
31
- class="btn-success"
32
- type="dashed"
33
- @click="edit()">
34
- <a-icon :style="iconStyle" type="form"/>修改
35
- </a-button>
36
- <template
37
- v-if="buttonState.editRow && buttonRendering('editRow')">
38
- <a-button
39
- v-if="isEditMode"
40
- class="ant-btn-hover"
41
- @click="editRowSave">
42
- <a-icon :style="iconStyle" type="save"/>保存
43
- </a-button>
44
- <a-button
45
- v-else
46
- @click="openEditMode">
47
- <a-icon :style="iconStyle" type="edit"/>行编辑
48
- </a-button>
49
- </template>
50
- <a-button
51
- v-if="buttonState.delete && buttonRendering('delete')"
52
- :disabled="!isDelete"
53
- type="danger"
54
- @click="deleteItem">
55
- <a-icon :style="iconStyle" type="delete"/>删除
56
- </a-button>
57
- <a-button
58
- v-if="buttonState.import && buttonRendering('import')"
59
- type="dashed"
60
- @click="importData">
61
- <a-icon :style="iconStyle" type="import"/>导入
62
- </a-button>
63
- <a-dropdown v-if="!buttonState || buttonState.export && buttonRendering('export')">
64
- <a-menu slot="overlay">
65
- <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handleExport('selected')"><a-icon
66
- :style="iconStyle"
67
- type="ordered-list"/>导出选中数据</a-menu-item>
68
- <a-menu-item key="2" @click="handleExport('curPage')"><a-icon :style="iconStyle" type="snippets"/>导出本页数据</a-menu-item>
69
- <a-menu-item key="3" @click="handleExport('exportByQuery')"><a-icon :style="iconStyle" type="download"/>导出所有符合条件的数据</a-menu-item>
70
- </a-menu>
71
- <a-button>导出 <a-icon type="down" :style="iconStyle"/> </a-button>
72
- </a-dropdown>
73
- <a-dropdown v-if="!buttonState || buttonState.print && buttonRendering('print')">
74
- <a-menu slot="overlay">
75
- <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handlePrint('selected')"><a-icon
76
- :style="iconStyle"
77
- type="ordered-list"/>打印选中数据</a-menu-item>
78
- <a-menu-item key="2" @click="handlePrint('curPage')"><a-icon :style="iconStyle" type="snippets"/>打印本页数据</a-menu-item>
79
- <a-menu-item key="3" @click="handlePrint('exportByQuery')"><a-icon :style="iconStyle" type="download"/>打印所有符合条件的数据</a-menu-item>
80
- </a-menu>
81
- <a-button>打印 <a-icon type="printer" :style="iconStyle"/> </a-button>
82
- </a-dropdown>
83
- <!-- 遍历按钮配置数组,动态生成按钮 -->
84
- <a-button
85
- v-for="(button, index) in editButtonStateData"
86
- :key="index"
87
- :type="button.type || 'dashed'"
88
- @click="editButtonStateDataClick(index)"
89
- class="btn-success"
90
- >
91
- <a-icon type="dashed" :style="iconStyle"/>
92
- {{ button.buttonName }}
93
- </a-button>
94
- <a-button
95
- v-if="allowedCardMode && !simpleMode"
96
- @click="changeViewMode"
97
- :type="isTableMode ? '' : 'primary'">
98
- 看板模式
99
- </a-button>
100
- <!-- 头部附加栅格 -->
101
- <x-report
102
- v-if="attachGrid"
103
- :env="env"
104
- :isWidget="true"
105
- :use-oss-for-img="false"
106
- :config-name="attachGrid"
107
- :show-img-in-cell="true"
108
- :display-only="true"
109
- :edit-mode="false"
110
- :show-save-button="false"
111
- :dont-format="true"/>
112
-
113
- <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
114
- </a-space>
115
-
116
- </span>
117
- </a-col>
118
- <a-col v-show="showRightTools && !simpleMode">
119
- <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
120
- <a-button-group>
121
- <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
122
- <a-tooltip title="汇总" placement="bottom">
123
- <a-button @click="showDrawer">
124
- <a-icon :style="iconStyle" type="project"/>
125
- </a-button>
126
- </a-tooltip>
127
- <a-tooltip title="重新查询" placement="bottom">
128
- <a-button @click="refresh(true)">
129
- <a-icon :style="iconStyle" type="reload"/>
130
- </a-button>
131
- </a-tooltip>
132
- <a-tooltip title="列展示/排序" placement="bottom">
133
- <table-setting v-if="columnSelectLoaded" v-model="tableColumns"/>
134
- </a-tooltip>
135
- </a-button-group>
136
- </span>
137
- </a-col>
138
- </a-row>
139
- <!-- 如果当前是表格模式 -->
140
- <template v-if="isTableMode">
141
- <s-table
142
- ref="table"
143
- :id="uniqueId"
144
- :alert="true"
145
- :columns="tableColumns"
146
- :data="loadData"
147
- :rowKey="rowKey"
148
- :showSummary="showSummary"
149
- :rowSelection="rowSelection"
150
- :scroll="{ x: scrollXWidth, y: scrollYHeight }"
151
- :showPagination="showPagination"
152
- :hidePagination="simpleMode"
153
- :showSelected="!simpleMode"
154
- :pageSize="simpleMode ? 1000 : undefined"
155
- :setScrollYHeight="setScrollYHeight"
156
- size="default"
157
- >
158
- <template
159
- v-for="(item, c_index) in tableColumns"
160
- :slot="item.dataIndex"
161
- slot-scope="text, record, index">
162
- <template v-if="isEditMode && getFromItem(item.dataIndex,text, record, index)">
163
- <x-form-item
164
- class="innerTable"
165
- :style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
166
- :form="record"
167
- :attr="getFromItem(item.dataIndex,text, record, index)"
168
- :service-name="serviceName"
169
- mode="新增/修改"
170
- :env="env"
171
- :setForm="(obj)=>setForm(record,obj)"
172
- @rowChoose="(row, attr, callback) => rowChoose(row, attr, callback, record)"
173
- :showLabel="false"
174
- :key="'editRow-' + c_index"
175
- />
176
- </template>
177
- <!-- 序号列 -->
178
- <span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
179
- {{ index + 1 }}
180
- </span>
181
- <CustomFuncCel
182
- :text="text"
183
- :record="text"
184
- :index="index"
185
- :item="item"
186
- :localDataSource=" $refs.table.localDataSource"
187
- v-else-if="item.slotCustomFunction"
188
- :key="'customJs-' + c_index"></CustomFuncCel>
189
- <!-- 行链接 -->
190
- <span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
191
- <a @click="columnClick(item.dataIndex,text,record)">{{ text }}</a>
192
- </span>
193
- <!-- 跳转用户详情 -->
194
- <span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
195
- <a @click="gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
196
- </span>
197
- <!-- 文本溢出省略(ellipsis) -->
198
- <span v-else-if="item.slotType === 'ellipsis'" :key="'ellipsis-' + c_index">
199
- <ellipsis :length="item.slotValue" tooltip>{{ text === '' ? '--' : text }}</ellipsis>
200
- </span>
201
- <!-- 徽标(badge) -->
202
- <span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
203
- <x-badge
204
- :service-name="serviceName"
205
- :env="env"
206
- v-if="text !== null && text !== undefined"
207
- :badge-key="item.slotKeyMap"
208
- :value="text"/>
209
- </span>
210
- <!-- 日期(date) -->
211
- <span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
212
- {{ format(text, 'yyyy-MM-dd') }}
213
- </span>
214
- <!-- 日期时间(datetime) -->
215
- <span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
216
- {{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
217
- </span>
218
- <!-- 两位小数 -->
219
- <span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
220
- {{ numberFormat(text, 2) }}
221
- </span>
222
- <!-- 四位小数 -->
223
- <span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
224
- {{ numberFormat(text, 4) }}
225
- </span>
226
- <!-- 整数 -->
227
- <span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
228
- {{ numberFormat(text, 0) }}
229
- </span>
230
- <!-- 操作列(action) -->
231
- <span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
232
- <template v-if="item.actionArr && item.actionArr.length > 0">
233
- <a-dropdown>
234
- <a class="ant-dropdown-link" @click="e => e.preventDefault()">
235
- {{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
236
- </a>
237
- <a-menu slot="overlay" style="min-width: 60px">
238
- <a-menu-item
239
- v-for="(action_item, actionIndex) in item.actionArr"
240
- :key="actionIndex"
241
- v-show="!action_item.customFunction || customFunctionShow(action_item.customFunction,record,c_index)">
242
- <a
243
- style="text-align: center"
244
- @click="action(record, item.dataIndex, action_item.func)"
245
- >{{ action_item.text }}</a>
246
- </a-menu-item>
247
- </a-menu>
248
- </a-dropdown>
249
- </template>
250
- <template v-if="!item.actionArr || item.actionArr.length === 0">
251
- <a @click="action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
252
- </template>
253
- </span>
254
- </template>
255
- <template slot="footer">
256
- <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
257
- </template>
258
- </s-table>
259
- </template>
260
- <!-- 如果当前是看板模式 -->
261
- <template v-else>
262
- <XDataCard
263
- ref="table"
264
- @cardEmit="handleCardEmit"
265
- :tableColumns="tableColumns"
266
- :card-config="cardModeConfig"
267
- :show-pagination="!simpleMode"
268
- :prePageSize="simpleMode ? 1000 : undefined"
269
- :serviceName="serviceName"
270
- :card-data="loadData"
271
- :env="env"
272
- :createdQuery="createdQuery"
273
- :simple-mode="simpleMode"/>
274
- </template>
275
- <!-- 上传文件 -->
276
- <a-drawer
277
- title="汇总信息"
278
- placement="right"
279
- :closable="false"
280
- :visible="summaryDrawerVisible"
281
- :z-index="2000"
282
- :width="`${summaryDrawerWidth}vw`"
283
- :after-visible-change="afterVisibleChange"
284
- @close="onClose"
285
- >
286
- <template>
287
- <a-row>
288
- <a-col :span="8" v-for="(f,index) in summaryData" :key="index">
289
- <a-statistic
290
- :title="f.title + ':'"
291
- :value="f.value"
292
- :precision="2">
293
- <template #prefix>
294
- <a-spin :spinning="f.loading">
295
- </a-spin>
296
- </template>
297
- <template #suffix>
298
- <a-icon
299
- v-show="!f.loading"
300
- :type="f.success !== false ? 'check-circle' : 'close-circle'"
301
- :style="{color: f.success !== false ? 'green' : 'red'}"/>
302
- </template>
303
- </a-statistic>
304
- </a-col>
305
- <a-col
306
- :span="item.span"
307
- v-for="(item,index) in chartsConfigArray"
308
- :key="index"
309
- style="height: 20rem; margin-bottom: 3rem">
310
- <div class="custom-chart-title" v-if="item.config.title">{{ item.config.title }}</div>
311
- <div class="custom-chart-desc" v-if="item.config.description">{{ item.config.description }}</div>
312
- <g2Charts
313
- :key="index"
314
- :chatsKey="index"
315
- :is-dev="env === 'dev'"
316
- :config="item.config"
317
- :requestParameters="requestParameters"/>
318
- </a-col>
319
- </a-row>
320
- </template>
321
- </a-drawer>
322
- <x-import-excel
323
- ref="importExcel"
324
- @ok="importExcelOk"
325
- :title="title"
326
- :service-name="serviceName"
327
- :env="env"
328
- :query-params-name="queryParamsName"
329
- >
330
- <template #importExcelSlot>
331
- <slot name="importExcelSlot"></slot>
332
- </template>
333
- </x-import-excel>
334
- <ExportExcel
335
- ref="exportExcel"
336
- />
337
- </div>
338
- </template>
339
- <script>
340
- import { Ellipsis, STable } from '@vue2-client/components'
341
- import { formatDate, getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
342
- import * as util from '@vue2-client/utils/util'
343
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
344
- import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
345
- import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
346
- import {
347
- query,
348
- querySummary,
349
- queryWithResource,
350
- remove,
351
- getConfigByNameAsync,
352
- editRowSave,
353
- runLogic
354
- } from '@vue2-client/services/api/common'
355
- import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
356
- import { Modal } from 'ant-design-vue'
357
- import { mapState } from 'vuex'
358
- import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
359
- import debounce from 'lodash.debounce'
360
- import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
361
- import { getRealKeyData } from '@vue2-client/utils/formatter'
362
- import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
363
- import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
364
- import ExportExcel from '@vue2-client/base-client/components/common/XTable/ExportExcel.vue'
365
- import g2Charts from '@vue2-client/components/g2Charts/index.vue'
366
- import moment from 'moment/moment'
367
-
368
- export default {
369
- name: 'XTable',
370
- components: {
371
- ExportExcel,
372
- CustomFuncCel,
373
- XDataCard,
374
- TableSetting,
375
- STable,
376
- Ellipsis,
377
- XBadge,
378
- XImportExcel,
379
- XFormItem,
380
- g2Charts,
381
- XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
382
- ReportTableHome
383
- },
384
- inject: ['getSelf'],
385
- provide () {
386
- return {
387
- tableContext: this
388
- }
389
- },
390
- data () {
391
- return {
392
- uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
393
- // 筛选列加载状态
394
- columnSelectLoaded: false,
395
- // 预览模式
396
- viewMode: false,
397
- // 本地编辑模式
398
- localEditMode: false,
399
- // 本地编辑表单提交方式
400
- formSubmitTypeInLocalEditMode: 'cover',
401
- // 本地编辑模式所用数据源
402
- localEditModeDataSource: [],
403
- // 本地编辑模式数据源是否已由外部加载
404
- isLocalDataSourceLoadedExternally: false,
405
- // 行选择模式
406
- rowSelectMode: false,
407
- // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
408
- allowSelectRowNum: 0,
409
- // 头部附件的栅格配置名
410
- attachGrid: '',
411
- // 是否展示右侧工具栏
412
- showRightTools: true,
413
- // 是否展示左边按钮栏
414
- showLeftOperaBtn: true,
415
- // 加载数据方法 必须为 Promise 对象
416
- loadData: parameter => {
417
- // 取到表格携带的表单参数
418
- const requestParameters = Object.assign({}, parameter)
419
- // 取到父组件传入的表单参数
420
- const conditionParams = {}
421
- Object.assign(conditionParams, this.fixedQueryForm)
422
- Object.assign(conditionParams, this.form)
423
- // 如果传了燃气公司字段,则进行数据处理
424
- if (conditionParams.orgName) {
425
- requestParameters.orgName = conditionParams.orgName
426
- delete conditionParams.orgName
427
- }
428
- Object.keys(conditionParams).forEach(key => {
429
- if (Array.isArray(conditionParams[key])) {
430
- // 检查数组中是否包含 null
431
- const hasNull = conditionParams[key].every(item => item === '') || conditionParams[key].length === 0
432
- // 如果包含 null,则删除该属性
433
- if (hasNull) {
434
- delete conditionParams[key]
435
- }
436
- }
437
- })
438
- requestParameters.conditionParams = conditionParams
439
- requestParameters.queryParamsName = this.queryParamsName
440
- requestParameters.queryParams = this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined
441
- this.requestParameters = requestParameters
442
- // 加载数据
443
- return this.loadTableData(requestParameters)
444
- },
445
- requestParameters: {},
446
- rowKey: undefined,
447
- // x滚动条宽度
448
- scrollXWidth: 1600,
449
- // y滚动条高度
450
- scrollYHeight: 'calc(100vh - 31rem)',
451
- // 表格选择列Key集合
452
- selectedRowKeys: [],
453
- // 表格选择Row集合
454
- selectedRows: [],
455
- // 禁止表格选择Row集合
456
- selectedDisableRows: [],
457
- // 业务标题
458
- title: '',
459
- // 数据列
460
- tableColumns: [],
461
- // 查询用表单
462
- form: {},
463
- oldForm: {},
464
- // 是否允许修改
465
- isModify: false,
466
- // 是否允许删除
467
- isDelete: false,
468
- // 是否允许选择
469
- isChoose: false,
470
- // 选中用于修改的id
471
- selectId: undefined,
472
- // 是否显示展示列抽屉
473
- visible: false,
474
- // 编辑按钮加载状态
475
- editLoading: false,
476
- // 按钮状态
477
- buttonState: {},
478
- // eventBtnState
479
- eventState: {},
480
- // 自定义按钮数组
481
- editButtonStateData: [],
482
- // 按钮权限
483
- buttonPermissions: [],
484
- // 是否展示汇总
485
- showSummary: false,
486
- // 自定义汇总
487
- showCustomSummary: false,
488
- summaryData: [],
489
- // 图标样式
490
- iconStyle: {
491
- position: 'relative',
492
- top: '1px'
493
- },
494
- // 当前环境
495
- env: 'prod',
496
- // 预览模式(表格 or 看板)
497
- isTableMode: true,
498
- // 汇总抽屉是否显示
499
- summaryDrawerVisible: false,
500
- // 汇总更新标志
501
- summaryUpdate: false,
502
- customSummaryArray: [],
503
- formItems: [],
504
- // 是否为行编辑模式
505
- isEditMode: false,
506
- // 定义主键
507
- primaryKey: '',
508
- // 是否进行初始化查询
509
- createdQuery: false,
510
- // 允许看板模式
511
- allowedCardMode: false,
512
- // 看板模式配置
513
- cardModeConfig: undefined,
514
- // 暂存行编辑前数据 用于比较哪些变化了才需要保存
515
- editRowBeforeData: [],
516
- // 是否简易模式
517
- simpleMode: false,
518
- // crud打印模板配置
519
- printTemplate: false,
520
- queryParams: {},
521
- // 定义总行数
522
- totalCount: 0,
523
- user: {},
524
- chartsConfigArray: [],
525
- summaryDrawerWidth: 35
526
- }
527
- },
528
- props: {
529
- // 查询配置文件名
530
- queryParamsName: {
531
- type: String,
532
- default: () => {
533
- return ''
534
- }
535
- },
536
- // 查询配置文件名
537
- serviceName: {
538
- type: String,
539
- default: () => {
540
- return ''
541
- }
542
- },
543
- // 查询配置文件Json
544
- queryParamsJson: {
545
- type: Object,
546
- default: null
547
- },
548
- // 固定查询表单
549
- fixedQueryForm: {
550
- type: Object,
551
- default: () => {
552
- return {}
553
- }
554
- },
555
- // 数据只有一页时是否展示分页,true:展示,auto:隐藏
556
- showPagination: {
557
- type: Boolean,
558
- default: true
559
- },
560
- // 是否自定义删除功能
561
- customDelete: {
562
- type: Boolean,
563
- default: false
564
- },
565
- // 自适应底部编剧
566
- extraHeight: {
567
- type: Number,
568
- default: 80
569
- }
570
- },
571
- computed: {
572
- rowSelection () {
573
- return {
574
- selectedRowKeys: this.selectedRowKeys,
575
- onChange: this.onSelectChange,
576
- getCheckboxProps: record => ({
577
- props: {
578
- disabled: this.selectedDisableRows.includes(record[this.rowKey]), // Column configuration not to be checked
579
- name: record.name,
580
- },
581
- }),
582
- }
583
- },
584
- ...mapState('account', { currUser: 'user' }),
585
- ...mapState('setting', ['compatible'])
586
- },
587
- mounted () {
588
- window.addEventListener('resize', this.handleResize)
589
- },
590
- beforeDestroy () {
591
- // 销毁页面查询定时器
592
- if (this.queryTimer) {
593
- clearInterval(this.queryTimer)
594
- }
595
- window.removeEventListener('resize', this.handleResize)
596
- },
597
- methods: {
598
- customFunctionShow (customFunction, record, cIndex) {
599
- return executeStrFunctionByContext(this, customFunction, [record, cIndex])
600
- },
601
- getConfigByNameAsync,
602
- runLogic,
603
- executeStrFunctionByContext,
604
- columnClick (key, value, record) {
605
- this.$emit('columnClick', key, value, record)
606
- },
607
- gotoUserDetail (key, value, record) {
608
- this.$emit('gotoUserDetail', key, value, record)
609
- },
610
- getFromItem (model, text, record, index) {
611
- const aa = this.formItems.reduce((acc, item) => {
612
- if (item.type === 'group') {
613
- const foundItem = item.groupItems.find(_item => _item.model === model && _item.editRow)
614
- if (foundItem) {
615
- acc = foundItem
616
- }
617
- } else if (item.model === model && item.editRow) {
618
- acc = item
619
- }
620
- return acc
621
- }, null)
622
- if (aa) {
623
- const tempConfig = JSON.parse(JSON.stringify(aa))
624
- // 如果找到了字段
625
- const ColumnIndex = this.tableColumns.findIndex(item => item.dataIndex === model)
626
- // 并且表单项是日期框
627
- if (ColumnIndex !== -1 && ['yearPicker', 'monthPicker', 'datePicker', 'rangePicker'].includes(tempConfig.type)) {
628
- // 修改他的列宽
629
- this.tableColumns[ColumnIndex].width = 220
630
- }
631
- // 如果有检验规则检验是数字
632
- if (ColumnIndex !== -1 && ['number', 'integer', 'float'].includes(tempConfig?.rule?.type)) {
633
- // 修改他的列宽
634
- tempConfig.numberInput = true
635
- }
636
- if (tempConfig.editRowShowFunc) {
637
- if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
638
- return tempConfig
639
- }
640
- } else {
641
- return tempConfig
642
- }
643
- }
644
- return false
645
- },
646
- // 打开行编辑
647
- openEditMode () {
648
- this.isEditMode = true
649
- this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
650
- },
651
- // 标记行保存
652
- editRowSave () {
653
- // 获取最新数据
654
- const editRowAfterData = this.getTableData()
655
- const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
656
- if (this.eventState?.customSave) {
657
- this.custom('customSave', {
658
- tableData: editRowAfterData,
659
- changeData
660
- })
661
- return
662
- }
663
- if (changeData.length === 0) {
664
- this.$message.info('没有数据发生变化')
665
- } else {
666
- Modal.confirm({
667
- title: '是否确认保存?',
668
- content: `此操作将保存当前行编辑的数据,共修改${changeData.length}条数据`,
669
- zIndex: 1001,
670
- onOk: () => {
671
- return new Promise((resolve, reject) => {
672
- const requestParameters = {
673
- queryParamsName: this.queryParamsName,
674
- changeData: changeData.map(h => getRealKeyData(h)),
675
- operaInfo: this.currUser.operaInfo
676
- }
677
- editRowSave(requestParameters, this.serviceName, this.env === 'dev').then(res => {
678
- this.$message.success('行内数据保存成功')
679
- this.isEditMode = false
680
- this.refresh()
681
- resolve(res)
682
- }).catch(e => {
683
- reject(e)
684
- this.$message.error('保存失败!')
685
- })
686
- })
687
- },
688
- onCancel () {
689
- }
690
- })
691
- }
692
- },
693
- importExcelOk (data) {
694
- this.refresh(true)
695
- this.$emit('importExcelOk', data)
696
- },
697
- /**
698
- * 行选择事件
699
- * @param row 选中行集合
700
- * @param attr 表单项属性
701
- */
702
- async rowChoose (row, attr, callback, record) {
703
- // 如果配置了自定义函数
704
- if (attr.dataChangeFunc) {
705
- await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
706
- ...attr,
707
- selectRows: row
708
- }, util, this.getSelf(), this.mode, runLogic, getConfigByNameAsync])
709
- } else {
710
- // 默认填充选中行数据到当前表单
711
- setDataByRealKey(record, row[0])
712
- }
713
- if (callback) {
714
- callback()
715
- }
716
- },
717
- setForm (record, obj) {
718
- Object.assign(record, obj)
719
- this.$forceUpdate()
720
- },
721
- handleResize () {
722
- debounce(() => {
723
- this.setScrollYHeight({})
724
- }, 100)()
725
- },
726
- isInAModal () {
727
- let parent = this.$parent
728
- while (parent) {
729
- // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
730
- if (parent.$options.name === 'AModal') {
731
- return true
732
- }
733
- parent = parent.$parent
734
- }
735
- return false
736
- },
737
- executeStrFunction,
738
- // 切换看板模式和表格模式
739
- changeViewMode () {
740
- this.isTableMode = !this.isTableMode
741
- // 看板切换回表格模式 刷新列表
742
- this.refresh(true)
743
- },
744
- /**
745
- * 初始化表格参数
746
- */
747
- init (params) {
748
- const {
749
- // 查询参数对象, 用于没有对应查询配置文件名时
750
- queryParams,
751
- tableColumns,
752
- attachGrid,
753
- buttonState,
754
- eventState = {},
755
- buttonPermissions,
756
- editButtonStateData = [],
757
- title,
758
- form,
759
- tableSummaryMap = {},
760
- customTableSummaryArray = [],
761
- viewMode,
762
- localEditMode,
763
- formSubmitTypeInLocalEditMode = 'cover',
764
- rowSelectMode,
765
- allowSelectRowNum = 0,
766
- formItems,
767
- env = 'prod',
768
- createdQuery = true,
769
- createdEditMode = false,
770
- primaryKey,
771
- allowedCardMode = false,
772
- simpleMode = false,
773
- showRightTools = true,
774
- cardModeConfig,
775
- summaryUpdate,
776
- summaryDrawerWidth = 35,
777
- chartsConfigArray = [],
778
- printTemplate = 'DEFAULT_CRUD_PRINT_TEMPLATE',
779
- } = params
780
- this.showSummary = Object.keys(tableSummaryMap).length > 0
781
- if (this.showSummary) {
782
- Object.keys(tableSummaryMap).forEach(item => {
783
- this.summaryData.push({
784
- key: item,
785
- title: tableSummaryMap[item],
786
- value: ' ',
787
- loading: true,
788
- success: false
789
- })
790
- })
791
- }
792
- if (customTableSummaryArray.length > 0) {
793
- customTableSummaryArray.forEach(item => {
794
- this.summaryData.push({
795
- key: item.key,
796
- title: item.title,
797
- value: ' ',
798
- loading: true,
799
- success: false
800
- })
801
- })
802
- this.showCustomSummary = true
803
- this.customSummaryArray = customTableSummaryArray
804
- }
805
- this.queryParams = queryParams
806
- this.tableColumns = JSON.parse(JSON.stringify(tableColumns))
807
- if (this.tableColumns.length === 0) {
808
- return
809
- }
810
- this.attachGrid = attachGrid
811
- this.viewMode = viewMode
812
- this.localEditMode = localEditMode
813
- this.formSubmitTypeInLocalEditMode = formSubmitTypeInLocalEditMode
814
- this.rowSelectMode = rowSelectMode
815
- this.allowSelectRowNum = allowSelectRowNum
816
- this.simpleMode = simpleMode
817
- this.formItems = formItems
818
- this.user = this.currUser
819
- this.createdQuery = createdQuery
820
- this.primaryKey = primaryKey
821
- this.buttonState = buttonState
822
- this.eventState = eventState
823
- this.showRightTools = showRightTools
824
- this.printTemplate = printTemplate
825
- this.summaryDrawerWidth = summaryDrawerWidth
826
- this.chartsConfigArray = chartsConfigArray
827
- if (this.chartsConfigArray.length > 0) {
828
- // 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
829
- this.chartsConfigArray.forEach(item => {
830
- item.config.queryParams = JSON.parse(JSON.stringify(this.queryParams))
831
- item.config.queryParamsName = this.queryParamsName
832
- })
833
- }
834
- if (this.localEditMode) {
835
- this.localEditModeDataSource = []
836
- if (this.formSubmitTypeInLocalEditMode === 'append') {
837
- this.isLocalDataSourceLoadedExternally = true
838
- const defaultItem = {}
839
- defaultItem['序号'] = 0
840
- this.localEditModeDataSource.push(defaultItem)
841
- } else {
842
- this.isLocalDataSourceLoadedExternally = false
843
- }
844
- this.buttonState.import = false
845
- this.buttonState.export = false
846
- this.showRightTools = false
847
- }
848
- if (this.rowSelectMode) {
849
- this.buttonState = {
850
- choose: true
851
- }
852
- this.showRightTools = false
853
- }
854
- this.buttonPermissions = buttonPermissions
855
- this.editButtonStateData = editButtonStateData
856
- this.title = title
857
- this.env = env
858
- this.rowKey = this.getPrimaryKeyName()
859
- this.allowedCardMode = allowedCardMode
860
- this.cardModeConfig = cardModeConfig
861
- this.summaryUpdate = summaryUpdate
862
- this.isEditMode = createdEditMode
863
- let totalWidth = 0
864
- for (let i = 0; i < this.tableColumns.length; i++) {
865
- const item = this.tableColumns[i]
866
- // 设置操作列
867
- if (item.slotType === 'action') {
868
- item.fixed = 'right'
869
- item.width = 70
870
- }
871
- // 设置表格宽度
872
- if (item.width) {
873
- totalWidth = totalWidth + item.width
874
- } else {
875
- totalWidth = totalWidth + 180
876
- }
877
- }
878
- // 横向滚动长度大于所有宽度,才能实现固定表头
879
- this.scrollXWidth = totalWidth
880
- // 加载筛选列完成
881
- this.columnSelectLoaded = true
882
- this.setQueryForm(form || {})
883
- // 简易模式,并且是看板模式,默认直接进入看板模式
884
- if (this.allowedCardMode && this.simpleMode) {
885
- this.isTableMode = false
886
- }
887
- if (params.queryInterval) {
888
- this.queryTimer = setInterval(() => {
889
- this.refresh()
890
- }, params.queryInterval * 1000)
891
- }
892
- },
893
- // 操作面板按钮渲染
894
- buttonRendering (button) {
895
- if (!this.buttonPermissions) {
896
- return true
897
- }
898
- try {
899
- const existingItem = this.buttonPermissions.find(item => item.btnName === button)
900
- const rolestr = this.currUser.rolestr?.split(',')
901
- if (existingItem?.state) {
902
- const currUserRole = existingItem.roleStr
903
- return rolestr.some(item => currUserRole && currUserRole.includes(item))
904
- } else {
905
- return true
906
- }
907
- } catch (e) {
908
- console.error(e)
909
- return false
910
- }
911
- },
912
- // 防止查询多次点击处理
913
- loadTableData (requestParameters) {
914
- if (this.queryPromise) {
915
- return this.queryPromise
916
- }
917
- this.queryPromise = this.loadTableDataGen(requestParameters).finally(() => {
918
- this.queryPromise = undefined
919
- })
920
- return this.queryPromise
921
- },
922
- /**
923
- * 加载表格数据
924
- * @param requestParameters 请求参数
925
- */
926
- async loadTableDataGen (requestParameters) {
927
- let result
928
- if (this.localEditMode) {
929
- if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
930
- const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
931
- this.serviceName, this.env === 'dev')
932
- if (result.data) {
933
- let no = 0
934
- this.localEditModeDataSource = result.data.map(item => {
935
- item['序号'] = no
936
- no++
937
- return item
938
- })
939
- }
940
- this.isLocalDataSourceLoadedExternally = true
941
- }
942
- result = new Promise((resolve) => {
943
- resolve({
944
- data: this.localEditModeDataSource
945
- })
946
- })
947
- } else {
948
- result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
949
- result.then(res => {
950
- this.totalCount = res.totalCount || 0
951
- })
952
- }
953
- if (this.isTableMode && !this.simpleMode) {
954
- this.clearRowKeys()
955
- }
956
- this.$emit('afterQuery', result, requestParameters.conditionParams)
957
- return result
958
- },
959
- /**
960
- * 操作列事件
961
- * @param record 本条数据
962
- * @param actionType 操作类型
963
- * @param func 事件默认 action
964
- * @param index 行下标
965
- */
966
- action (record, actionType, func = 'action', index) {
967
- this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func, index)
968
- },
969
- // 看板点击事件
970
- handleCardEmit (data, eventName) {
971
- this.action(data, undefined, eventName)
972
- },
973
- /**
974
- * 选择列事件
975
- * @param selectedRowKeys 被选择的列Key集合
976
- * @param selectedRows 被选择的列集合
977
- */
978
- onSelectChange (selectedRowKeys, selectedRows) {
979
- this.selectedRowKeys = selectedRowKeys
980
- this.selectedRows = selectedRows
981
- this.isModify = this.selectedRowKeys.length === 1
982
- this.isDelete = this.selectedRowKeys.length > 0
983
- this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
984
- this.$emit('selectRow', selectedRowKeys, selectedRows)
985
- },
986
- /**
987
- * 清除表格选中项
988
- */
989
- clearRowKeys () {
990
- this.$refs.table.clearSelected()
991
- },
992
- /**
993
- * 为表格附加查询条件
994
- */
995
- setQueryForm (form = {}) {
996
- this.form = form
997
- if (this.createdQuery) {
998
- this.refresh(true)
999
- } else {
1000
- this.createdQuery = true
1001
- }
1002
- },
1003
- /**
1004
- * 表格重新加载方法
1005
- * 如果参数为 true, 则强制刷新到第一页
1006
- */
1007
- refresh (bool) {
1008
- this.$nextTick(() => {
1009
- this.$refs.table.refresh(bool)
1010
- })
1011
- },
1012
- setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
1013
- this.$nextTick(() => {
1014
- setTimeout(() => {
1015
- const curDocument = window?.rawDocument || document
1016
- const innerHeight = window?.rawWindow?.innerHeight || window.innerHeight || 0
1017
- if (typeof extraHeight == 'undefined') {
1018
- // 默认底部分页32 + 边距48
1019
- extraHeight = 48 + 32
1020
- }
1021
- let tHeader = null
1022
- if (id) {
1023
- tHeader = curDocument.getElementById(id) ? curDocument.getElementById(id).getElementsByClassName('ant-table-thead')[0] : null
1024
- } else {
1025
- tHeader = curDocument.getElementsByClassName('ant-table-thead')[0]
1026
- }
1027
- // 表格内容距离顶部的距离
1028
- let tHeaderBottom = 0
1029
- if (tHeader) {
1030
- tHeaderBottom = tHeader.getBoundingClientRect().bottom
1031
- }
1032
- if (tHeaderBottom === 0) {
1033
- this.scrollYHeight = 'calc(100vh - 31rem)'
1034
- if (window.__MICRO_APP_ENVIRONMENT__) {
1035
- this.scrollYHeight = 'calc(100vh - 28.5rem)'
1036
- }
1037
- return
1038
- }
1039
-
1040
- // 判断是否在 modal 中
1041
- if (this.isInAModal()) {
1042
- let modalElement = null
1043
- if (tHeader) {
1044
- modalElement = tHeader.closest('.ant-modal-body')
1045
- } else {
1046
- modalElement = curDocument.querySelector('.ant-modal-body')
1047
- }
1048
- if (modalElement) {
1049
- const modalRect = modalElement.getBoundingClientRect()
1050
- // 48 是 modal 通常的边距 32 是分页
1051
- extraHeight = innerHeight - modalRect.bottom + 32 + 48
1052
- }
1053
- }
1054
- if (innerHeight - (tHeaderBottom + extraHeight) < 210) {
1055
- this.scrollYHeight = 'calc(100vh - 31rem)'
1056
- return
1057
- }
1058
- // 窗体高度-表格内容顶部的高度-表格内容底部的高度
1059
- // this.scrollYHeight = document.body.clientHeight - tHeaderBottom - extraHeight
1060
- this.scrollYHeight = `calc(100vh - ${tHeaderBottom + extraHeight}px)`
1061
- }, 60)
1062
- })
1063
- },
1064
- /**
1065
- * 格式化日期
1066
- * @param date 日期字符串
1067
- * @param format 格式化方式
1068
- */
1069
- format (date, format) {
1070
- return formatDate(date, format)
1071
- },
1072
- /**
1073
- * 格式化数字
1074
- * @param number string 或者 number
1075
- * @param decimalPlaces 小数位数
1076
- */
1077
- numberFormat (number, decimalPlaces = 2) {
1078
- const value = parseFloat(number)
1079
- if (!isNaN(value)) {
1080
- return value.toFixed(decimalPlaces)
1081
- } else {
1082
- return ''
1083
- }
1084
- },
1085
- /**
1086
- * 获取主键列名称
1087
- */
1088
- getPrimaryKeyName () {
1089
- if (this.primaryKey) {
1090
- return this.primaryKey
1091
- }
1092
- const indexColumn = this.tableColumns.find(i => i?.slotType === 'index')
1093
- return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
1094
- },
1095
- handleExport (type) {
1096
- this.$refs.exportExcel.handleExport(type)
1097
- },
1098
- handlePrint (type) {
1099
- const printData = {
1100
- title: this.title,
1101
- form: this.form,
1102
- operaInfo: this.currUser.operaInfo,
1103
- operaTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1104
- summary: this.retrieveSummaryData
1105
- }
1106
- this.$refs.exportExcel.handlePrint(type, printData)
1107
- },
1108
- validateTableAndSyncData (currRow, defaultAppendRowData) {
1109
- let isLastRow = false
1110
- if (this.localEditModeDataSource.length === 0) {
1111
- isLastRow = true
1112
- } else if (currRow['序号'] === this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号']) {
1113
- isLastRow = true
1114
- }
1115
- if (isLastRow) {
1116
- this.appendLocalData(defaultAppendRowData)
1117
- }
1118
- },
1119
- // 新增业务
1120
- add () {
1121
- if (this.eventState?.customAdd) {
1122
- this.custom('customAdd', {})
1123
- return
1124
- }
1125
- if (this.localEditMode && this.isEditMode) {
1126
- this.appendLocalData({})
1127
- } else {
1128
- this.$emit('add')
1129
- }
1130
- },
1131
- // 添加业务
1132
- move () {
1133
- this.$emit('move')
1134
- },
1135
- // 通用事件业务
1136
- custom (func) {
1137
- this.$emit('customEvent', func)
1138
- },
1139
- // 编辑业务
1140
- edit (id) {
1141
- this.editLoading = true
1142
- this.getEditData(id).then(modifyModelData => {
1143
- if (this.eventState?.customEdit) {
1144
- this.custom('customEdit', { id, modifyModelData })
1145
- return
1146
- }
1147
- this.$emit('edit', modifyModelData)
1148
- this.editLoading = false
1149
- })
1150
- },
1151
- // 行选择业务
1152
- choose () {
1153
- if (this.isChoose) {
1154
- // 如果配置了自定义函数
1155
- this.$emit('rowChoose', this.selectedRows)
1156
- } else {
1157
- this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1158
- }
1159
- },
1160
- // 自定义按钮点击
1161
- editButtonStateDataClick (index) {
1162
- this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1163
- },
1164
- // 获取被编辑的数据
1165
- getEditData (id) {
1166
- if (!id) {
1167
- this.selectId = this.selectedRowKeys[0]
1168
- } else {
1169
- this.selectId = id
1170
- }
1171
- const primaryKeyName = this.getPrimaryKeyName()
1172
- if (this.tableColumns[0].dataIndex !== primaryKeyName) {
1173
- this.selectId = this.selectedRows[0][primaryKeyName]
1174
- }
1175
- // 将更新需要的主键值加入到primaryKeyData中
1176
- const primaryKeyData = {}
1177
- primaryKeyData[primaryKeyName] = this.selectId
1178
- if (this.localEditMode) {
1179
- return new Promise((resolve) => {
1180
- const modifyData = this.getDataByRowKeyValue(this.selectId)
1181
- resolve({
1182
- data: modifyData,
1183
- primaryKeyData: primaryKeyData
1184
- })
1185
- })
1186
- }
1187
- const requestParameters = {
1188
- queryParamsName: this.queryParamsName,
1189
- queryParams: this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined,
1190
- conditionParams: {},
1191
- pageNo: 1,
1192
- pageSize: 1
1193
- }
1194
- requestParameters.conditionParams[primaryKeyName] = this.selectId
1195
- requestParameters.f_businessid = this.selectId
1196
- return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1197
- return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1198
- })
1199
- },
1200
- // 删除业务
1201
- deleteItem () {
1202
- if (this.viewMode) {
1203
- this.$message.info('预览模式禁止删除')
1204
- return
1205
- }
1206
- Modal.confirm({
1207
- title: '提示',
1208
- content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
1209
- zIndex: 1001,
1210
- onOk: () => {
1211
- const requestParameters = {
1212
- queryParamsName: this.queryParamsName,
1213
- idList: this.selectedRowKeys
1214
- }
1215
- if (this.eventState?.customDelete) {
1216
- this.custom('customDelete', {
1217
- selectedRowKeys: this.selectedRowKeys,
1218
- selectedRows: this.selectedRows
1219
- })
1220
- return
1221
- }
1222
- return new Promise((resolve, reject) => {
1223
- if (this.localEditMode) {
1224
- this.localEditModeDataSource = this.getLocalData().filter(item => !this.selectedRowKeys.includes(item[this.rowKey]))
1225
- resolve(200)
1226
- this.$message.success('删除成功!')
1227
- this.refresh(true)
1228
- // afterDelete
1229
- this.$emit('afterDelete', requestParameters)
1230
- } else if (this.customDelete) {
1231
- this.$emit('del', this.selectedRows, resolve)
1232
- } else {
1233
- remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1234
- resolve(res)
1235
- this.$message.success('删除成功!')
1236
- this.refresh(true)
1237
- // afterDelete
1238
- this.$emit('afterDelete', requestParameters)
1239
- }).catch(e => {
1240
- reject(e)
1241
- this.$message.error('删除失败!')
1242
- })
1243
- }
1244
- })
1245
- },
1246
- onCancel () {
1247
- }
1248
- })
1249
- },
1250
- // 导入业务
1251
- importData () {
1252
- this.$refs.importExcel.importExcelHandleOpen()
1253
- },
1254
- afterVisibleChange (val) {
1255
- if (val) {
1256
- this.retrieveSummaryData()
1257
- }
1258
- },
1259
- async retrieveSummaryData () {
1260
- const promises = []
1261
-
1262
- if (this.requestParameters.querySummary) {
1263
- const querySummaryPromise = querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1264
- .then(res => {
1265
- if (this.compatible === 'V3') {
1266
- res = res.data
1267
- }
1268
- if (res.length > 0) {
1269
- this.summaryData.forEach(item => {
1270
- res.forEach(summary => {
1271
- if (item.title === summary.title) {
1272
- item.value = summary.value
1273
- item.success = true
1274
- item.loading = false
1275
- }
1276
- })
1277
- })
1278
- }
1279
- })
1280
- promises.push(querySummaryPromise)
1281
- }
1282
-
1283
- if (this.showCustomSummary) {
1284
- this.customSummaryArray.forEach(item => {
1285
- const runLogicPromise = runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1286
- .then(res => {
1287
- this.summaryData.forEach(summary => {
1288
- if (item.key === summary.key) {
1289
- summary.value = res.value
1290
- summary.success = true
1291
- summary.loading = false
1292
- }
1293
- })
1294
- })
1295
- .catch(e => {
1296
- this.summaryData.forEach(summary => {
1297
- if (item.key === summary.key) {
1298
- summary.value = 0
1299
- summary.success = false
1300
- summary.loading = false
1301
- }
1302
- })
1303
- })
1304
- promises.push(runLogicPromise)
1305
- })
1306
- }
1307
-
1308
- await Promise.all(promises)
1309
- return this.summaryData
1310
- },
1311
- showDrawer () {
1312
- if (this.summaryUpdate) {
1313
- this.summaryData.forEach(item => {
1314
- item.loading = true
1315
- item.success = false
1316
- item.value = ' '
1317
- })
1318
- this.summaryDrawerVisible = true
1319
- } else {
1320
- this.$message.warning('请查询后再来查看')
1321
- }
1322
- },
1323
- onClose () {
1324
- this.summaryDrawerVisible = false
1325
- },
1326
- // 获取表格内所有数据
1327
- getTableData () {
1328
- return this.$refs.table.localDataSource
1329
- },
1330
- // 设置表格内数据
1331
- setTableData (data) {
1332
- Object.assign(this.$refs.table, { localDataSource: data })
1333
- },
1334
- // 获取所有本地数据
1335
- getLocalData () {
1336
- return this.localEditModeDataSource
1337
- },
1338
- // 获取指定rowKey的value的本地数据
1339
- getDataByRowKeyValue (rowKeyValue) {
1340
- return this.getLocalData().find(item => {
1341
- return item[this.rowKey] === rowKeyValue
1342
- })
1343
- },
1344
- // 修改本地数据
1345
- modifyLocalData (rowKeyValue, data) {
1346
- const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1347
- if (modifyItem) {
1348
- Object.assign(modifyItem, data)
1349
- }
1350
- },
1351
- // 追加本地数据
1352
- appendLocalData (item) {
1353
- if (this.localEditModeDataSource.length === 0) {
1354
- item['序号'] = 1
1355
- } else {
1356
- item['序号'] = this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号'] + 1
1357
- }
1358
- this.localEditModeDataSource.push(item)
1359
- }
1360
- }
1361
- }
1362
- </script>
1363
- <style lang="less" scoped>
1364
-
1365
- .custom-chart-title {
1366
- font-size: 16px;
1367
- font-weight: 700;
1368
- margin-bottom: 8px;
1369
- }
1370
-
1371
- .custom-chart-desc {
1372
- font-size: 12px;
1373
- color: rgba(0, 0, 0, .45);
1374
- margin-bottom: 16px;
1375
- }
1376
-
1377
- :deep(.ant-table-thead > tr > th) {
1378
- font-weight: 600;
1379
- }
1380
-
1381
- :deep(.table-wrapper .ant-pagination) {
1382
- display: flex;
1383
- flex-direction: row;
1384
- align-items: center;
1385
- padding: 0;
1386
- }
1387
-
1388
- :deep(.table-wrapper .ant-pagination .ant-pagination-total-text) {
1389
- white-space: nowrap;
1390
- }
1391
-
1392
- :deep(.ant-table td) {
1393
- white-space: nowrap;
1394
- }
1395
-
1396
- .footer_sum_title {
1397
- color: @primary-color;
1398
- font-weight: bold;
1399
- }
1400
-
1401
- .footer_sum_item {
1402
- white-space: nowrap;
1403
- }
1404
-
1405
- .ant-btn-hover {
1406
- border-color: @primary-color;
1407
- color: @primary-color;
1408
- }
1409
-
1410
- .innerTable {
1411
- :deep(.ant-form-item) {
1412
- margin: 0;
1413
- }
1414
- }
1415
- </style>
1
+ <template>
2
+ <div v-show="tableColumns.length > 0">
3
+ <a-row :gutter="48">
4
+ <a-col v-show="showLeftOperaBtn">
5
+ <span :style="{ float: 'left', overflow: 'hidden', marginBottom: '8px' }">
6
+ <a-space>
7
+ <!-- <a-button v-if="eventState.customDelete" type="primary" @click="custom('customDelete')">-->
8
+ <!-- <a-icon type="delete"/>删除-->
9
+ <!-- </a-button>-->
10
+ <!-- <a-button v-if="eventState.customSave" type="primary" @click="custom('customSave')">-->
11
+ <!-- <a-icon type="save"/>保存-->
12
+ <!-- </a-button>-->
13
+ <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
14
+ <a-button v-if="buttonState.add && buttonRendering('add')" type="primary" @click="add">
15
+ <a-icon type="plus"/>新增
16
+ </a-button>
17
+ <a-button v-if="buttonState.move && buttonRendering('move')" type="primary" @click="move">
18
+ <a-icon type="plus"/>添加
19
+ </a-button>
20
+ <a-button
21
+ v-if="buttonState.choose && buttonRendering('choose')"
22
+ :disabled="!isChoose"
23
+ type="primary"
24
+ @click="choose">
25
+ <a-icon type="check-square"/>选择
26
+ </a-button>
27
+ <a-button
28
+ v-if="buttonState.edit && buttonRendering('edit')"
29
+ :disabled="!isModify"
30
+ :loading="editLoading"
31
+ class="btn-success"
32
+ type="dashed"
33
+ @click="edit()">
34
+ <a-icon :style="iconStyle" type="form"/>修改
35
+ </a-button>
36
+ <template
37
+ v-if="buttonState.editRow && buttonRendering('editRow')">
38
+ <a-button
39
+ v-if="isEditMode"
40
+ class="ant-btn-hover"
41
+ @click="editRowSave">
42
+ <a-icon :style="iconStyle" type="save"/>保存
43
+ </a-button>
44
+ <a-button
45
+ v-else
46
+ @click="openEditMode">
47
+ <a-icon :style="iconStyle" type="edit"/>行编辑
48
+ </a-button>
49
+ </template>
50
+ <a-button
51
+ v-if="buttonState.delete && buttonRendering('delete')"
52
+ :disabled="!isDelete"
53
+ type="danger"
54
+ @click="deleteItem">
55
+ <a-icon :style="iconStyle" type="delete"/>删除
56
+ </a-button>
57
+ <a-button
58
+ v-if="buttonState.import && buttonRendering('import')"
59
+ type="dashed"
60
+ @click="importData">
61
+ <a-icon :style="iconStyle" type="import"/>导入
62
+ </a-button>
63
+ <a-dropdown v-if="!buttonState || buttonState.export && buttonRendering('export')">
64
+ <a-menu slot="overlay">
65
+ <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handleExport('selected')"><a-icon
66
+ :style="iconStyle"
67
+ type="ordered-list"/>导出选中数据</a-menu-item>
68
+ <a-menu-item key="2" @click="handleExport('curPage')"><a-icon :style="iconStyle" type="snippets"/>导出本页数据</a-menu-item>
69
+ <a-menu-item key="3" @click="handleExport('exportByQuery')"><a-icon :style="iconStyle" type="download"/>导出所有符合条件的数据</a-menu-item>
70
+ </a-menu>
71
+ <a-button>导出 <a-icon type="down" :style="iconStyle"/> </a-button>
72
+ </a-dropdown>
73
+ <a-dropdown v-if="!buttonState || buttonState.print && buttonRendering('print')">
74
+ <a-menu slot="overlay">
75
+ <a-menu-item :disabled="selectedRowKeys.length === 0" key="1" @click="handlePrint('selected')"><a-icon
76
+ :style="iconStyle"
77
+ type="ordered-list"/>打印选中数据</a-menu-item>
78
+ <a-menu-item key="2" @click="handlePrint('curPage')"><a-icon :style="iconStyle" type="snippets"/>打印本页数据</a-menu-item>
79
+ <a-menu-item key="3" @click="handlePrint('exportByQuery')"><a-icon :style="iconStyle" type="download"/>打印所有符合条件的数据</a-menu-item>
80
+ </a-menu>
81
+ <a-button>打印 <a-icon type="printer" :style="iconStyle"/> </a-button>
82
+ </a-dropdown>
83
+ <!-- 遍历按钮配置数组,动态生成按钮 -->
84
+ <a-button
85
+ v-for="(button, index) in editButtonStateData"
86
+ :key="index"
87
+ :type="button.type || 'dashed'"
88
+ @click="editButtonStateDataClick(index)"
89
+ class="btn-success"
90
+ >
91
+ <a-icon type="dashed" :style="iconStyle"/>
92
+ {{ button.buttonName }}
93
+ </a-button>
94
+ <a-button
95
+ v-if="allowedCardMode && !simpleMode"
96
+ @click="changeViewMode"
97
+ :type="isTableMode ? '' : 'primary'">
98
+ 看板模式
99
+ </a-button>
100
+ <!-- 头部附加栅格 -->
101
+ <x-report
102
+ v-if="attachGrid"
103
+ :env="env"
104
+ :isWidget="true"
105
+ :use-oss-for-img="false"
106
+ :config-name="attachGrid"
107
+ :show-img-in-cell="true"
108
+ :display-only="true"
109
+ :edit-mode="false"
110
+ :show-save-button="false"
111
+ :dont-format="true"/>
112
+
113
+ <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
114
+ </a-space>
115
+
116
+ </span>
117
+ </a-col>
118
+ <a-col v-show="showRightTools && !simpleMode">
119
+ <span :style="{ float: 'right', overflow: 'hidden', marginBottom: '8px' }">
120
+ <a-button-group>
121
+ <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
122
+ <a-tooltip title="汇总" placement="bottom">
123
+ <a-button @click="showDrawer">
124
+ <a-icon :style="iconStyle" type="project"/>
125
+ </a-button>
126
+ </a-tooltip>
127
+ <a-tooltip title="重新查询" placement="bottom">
128
+ <a-button @click="refresh(true)">
129
+ <a-icon :style="iconStyle" type="reload"/>
130
+ </a-button>
131
+ </a-tooltip>
132
+ <a-tooltip title="列展示/排序" placement="bottom">
133
+ <table-setting v-if="columnSelectLoaded" v-model="tableColumns"/>
134
+ </a-tooltip>
135
+ </a-button-group>
136
+ </span>
137
+ </a-col>
138
+ </a-row>
139
+ <!-- 如果当前是表格模式 -->
140
+ <template v-if="isTableMode">
141
+ <s-table
142
+ ref="table"
143
+ :id="uniqueId"
144
+ :alert="true"
145
+ :columns="tableColumns"
146
+ :data="loadData"
147
+ :rowKey="rowKey"
148
+ :showSummary="showSummary"
149
+ :rowSelection="rowSelection"
150
+ :scroll="{ x: scrollXWidth, y: scrollYHeight }"
151
+ :showPagination="showPagination"
152
+ :hidePagination="simpleMode"
153
+ :showSelected="!simpleMode"
154
+ :pageSize="simpleMode ? 1000 : undefined"
155
+ :setScrollYHeight="setScrollYHeight"
156
+ size="default"
157
+ >
158
+ <template
159
+ v-for="(item, c_index) in tableColumns"
160
+ :slot="item.dataIndex"
161
+ slot-scope="text, record, index">
162
+ <template v-if="isEditMode && getFromItem(item.dataIndex,text, record, index)">
163
+ <x-form-item
164
+ class="innerTable"
165
+ :style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
166
+ :form="record"
167
+ :attr="getFromItem(item.dataIndex,text, record, index)"
168
+ :service-name="serviceName"
169
+ mode="新增/修改"
170
+ :env="env"
171
+ :setForm="(obj)=>setForm(record,obj)"
172
+ @rowChoose="(row, attr, callback) => rowChoose(row, attr, callback, record)"
173
+ :showLabel="false"
174
+ :key="'editRow-' + c_index"
175
+ />
176
+ </template>
177
+ <!-- 序号列 -->
178
+ <span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
179
+ {{ index + 1 }}
180
+ </span>
181
+ <CustomFuncCel
182
+ :text="text"
183
+ :record="text"
184
+ :index="index"
185
+ :item="item"
186
+ :localDataSource=" $refs.table.localDataSource"
187
+ v-else-if="item.slotCustomFunction"
188
+ :key="'customJs-' + c_index"></CustomFuncCel>
189
+ <!-- 行链接 -->
190
+ <span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
191
+ <a @click="columnClick(item.dataIndex,text,record)">{{ text }}</a>
192
+ </span>
193
+ <!-- 跳转用户详情 -->
194
+ <span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
195
+ <a @click="gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
196
+ </span>
197
+ <!-- 文本溢出省略(ellipsis) -->
198
+ <span v-else-if="item.slotType === 'ellipsis'" :key="'ellipsis-' + c_index">
199
+ <ellipsis :length="item.slotValue" tooltip>{{ text === '' ? '--' : text }}</ellipsis>
200
+ </span>
201
+ <!-- 徽标(badge) -->
202
+ <span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
203
+ <x-badge
204
+ :service-name="serviceName"
205
+ :env="env"
206
+ v-if="text !== null && text !== undefined"
207
+ :badge-key="item.slotKeyMap"
208
+ :value="text"/>
209
+ </span>
210
+ <!-- 日期(date) -->
211
+ <span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
212
+ {{ format(text, 'yyyy-MM-dd') }}
213
+ </span>
214
+ <!-- 日期时间(datetime) -->
215
+ <span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
216
+ {{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
217
+ </span>
218
+ <!-- 两位小数 -->
219
+ <span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
220
+ {{ numberFormat(text, 2) }}
221
+ </span>
222
+ <!-- 四位小数 -->
223
+ <span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
224
+ {{ numberFormat(text, 4) }}
225
+ </span>
226
+ <!-- 整数 -->
227
+ <span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
228
+ {{ numberFormat(text, 0) }}
229
+ </span>
230
+ <!-- 操作列(action) -->
231
+ <span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
232
+ <template v-if="item.actionArr && item.actionArr.length > 0">
233
+ <a-dropdown>
234
+ <a class="ant-dropdown-link" @click="e => e.preventDefault()">
235
+ {{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
236
+ </a>
237
+ <a-menu slot="overlay" style="min-width: 60px">
238
+ <a-menu-item
239
+ v-for="(action_item, actionIndex) in item.actionArr"
240
+ :key="actionIndex"
241
+ v-show="!action_item.customFunction || customFunctionShow(action_item.customFunction,record,c_index)">
242
+ <a
243
+ style="text-align: center"
244
+ @click="action(record, item.dataIndex, action_item.func)"
245
+ >{{ action_item.text }}</a>
246
+ </a-menu-item>
247
+ </a-menu>
248
+ </a-dropdown>
249
+ </template>
250
+ <template v-if="!item.actionArr || item.actionArr.length === 0">
251
+ <a @click="action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
252
+ </template>
253
+ </span>
254
+ </template>
255
+ <template slot="footer">
256
+ <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
257
+ </template>
258
+ </s-table>
259
+ </template>
260
+ <!-- 如果当前是看板模式 -->
261
+ <template v-else>
262
+ <XDataCard
263
+ ref="table"
264
+ @cardEmit="handleCardEmit"
265
+ :tableColumns="tableColumns"
266
+ :card-config="cardModeConfig"
267
+ :show-pagination="!simpleMode"
268
+ :prePageSize="simpleMode ? 1000 : undefined"
269
+ :serviceName="serviceName"
270
+ :card-data="loadData"
271
+ :env="env"
272
+ :createdQuery="createdQuery"
273
+ :simple-mode="simpleMode"/>
274
+ </template>
275
+ <!-- 上传文件 -->
276
+ <a-drawer
277
+ title="汇总信息"
278
+ placement="right"
279
+ :closable="false"
280
+ :visible="summaryDrawerVisible"
281
+ :z-index="2000"
282
+ :width="`${summaryDrawerWidth}vw`"
283
+ :after-visible-change="afterVisibleChange"
284
+ @close="onClose"
285
+ >
286
+ <template>
287
+ <a-row>
288
+ <a-col :span="8" v-for="(f,index) in summaryData" :key="index">
289
+ <a-statistic
290
+ :title="f.title + ':'"
291
+ :value="f.value"
292
+ :precision="2">
293
+ <template #prefix>
294
+ <a-spin :spinning="f.loading">
295
+ </a-spin>
296
+ </template>
297
+ <template #suffix>
298
+ <a-icon
299
+ v-show="!f.loading"
300
+ :type="f.success !== false ? 'check-circle' : 'close-circle'"
301
+ :style="{color: f.success !== false ? 'green' : 'red'}"/>
302
+ </template>
303
+ </a-statistic>
304
+ </a-col>
305
+ <a-col
306
+ :span="item.span"
307
+ v-for="(item,index) in chartsConfigArray"
308
+ :key="index"
309
+ style="height: 20rem; margin-bottom: 3rem">
310
+ <div class="custom-chart-title" v-if="item.config.title">{{ item.config.title }}</div>
311
+ <div class="custom-chart-desc" v-if="item.config.description">{{ item.config.description }}</div>
312
+ <g2Charts
313
+ :key="index"
314
+ :chatsKey="index"
315
+ :is-dev="env === 'dev'"
316
+ :config="item.config"
317
+ :requestParameters="requestParameters"/>
318
+ </a-col>
319
+ </a-row>
320
+ </template>
321
+ </a-drawer>
322
+ <x-import-excel
323
+ ref="importExcel"
324
+ @ok="importExcelOk"
325
+ :title="title"
326
+ :service-name="serviceName"
327
+ :env="env"
328
+ :query-params-name="queryParamsName"
329
+ >
330
+ <template #importExcelSlot>
331
+ <slot name="importExcelSlot"></slot>
332
+ </template>
333
+ </x-import-excel>
334
+ <ExportExcel
335
+ ref="exportExcel"
336
+ />
337
+ </div>
338
+ </template>
339
+ <script>
340
+ import { Ellipsis, STable } from '@vue2-client/components'
341
+ import { formatDate, getChangedData, setDataByRealKey } from '@vue2-client/utils/util'
342
+ import * as util from '@vue2-client/utils/util'
343
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
344
+ import TableSetting from '@vue2-client/components/TableSetting/TableSetting'
345
+ import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
346
+ import {
347
+ query,
348
+ querySummary,
349
+ queryWithResource,
350
+ remove,
351
+ getConfigByNameAsync,
352
+ editRowSave,
353
+ runLogic
354
+ } from '@vue2-client/services/api/common'
355
+ import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
356
+ import { Modal } from 'ant-design-vue'
357
+ import { mapState } from 'vuex'
358
+ import { executeStrFunction, executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
359
+ import debounce from 'lodash.debounce'
360
+ import XDataCard from '@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'
361
+ import { getRealKeyData } from '@vue2-client/utils/formatter'
362
+ import ReportTableHome from '../../../../pages/report/ReportTableHome.vue'
363
+ import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
364
+ import ExportExcel from '@vue2-client/base-client/components/common/XTable/ExportExcel.vue'
365
+ import g2Charts from '@vue2-client/components/g2Charts/index.vue'
366
+ import moment from 'moment/moment'
367
+
368
+ export default {
369
+ name: 'XTable',
370
+ components: {
371
+ ExportExcel,
372
+ CustomFuncCel,
373
+ XDataCard,
374
+ TableSetting,
375
+ STable,
376
+ Ellipsis,
377
+ XBadge,
378
+ XImportExcel,
379
+ XFormItem,
380
+ g2Charts,
381
+ XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
382
+ ReportTableHome
383
+ },
384
+ inject: ['getSelf'],
385
+ provide () {
386
+ return {
387
+ tableContext: this
388
+ }
389
+ },
390
+ data () {
391
+ return {
392
+ uniqueId: `x-table-${this._uid}`, // 使用 _uid 生成唯一 ID
393
+ // 筛选列加载状态
394
+ columnSelectLoaded: false,
395
+ // 预览模式
396
+ viewMode: false,
397
+ // 本地编辑模式
398
+ localEditMode: false,
399
+ // 本地编辑表单提交方式
400
+ formSubmitTypeInLocalEditMode: 'cover',
401
+ // 本地编辑模式所用数据源
402
+ localEditModeDataSource: [],
403
+ // 本地编辑模式数据源是否已由外部加载
404
+ isLocalDataSourceLoadedExternally: false,
405
+ // 行选择模式
406
+ rowSelectMode: false,
407
+ // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
408
+ allowSelectRowNum: 0,
409
+ // 头部附件的栅格配置名
410
+ attachGrid: '',
411
+ // 是否展示右侧工具栏
412
+ showRightTools: true,
413
+ // 是否展示左边按钮栏
414
+ showLeftOperaBtn: true,
415
+ // 加载数据方法 必须为 Promise 对象
416
+ loadData: parameter => {
417
+ // 取到表格携带的表单参数
418
+ const requestParameters = Object.assign({}, parameter)
419
+ // 取到父组件传入的表单参数
420
+ const conditionParams = {}
421
+ Object.assign(conditionParams, this.fixedQueryForm)
422
+ Object.assign(conditionParams, this.form)
423
+ // 如果传了燃气公司字段,则进行数据处理
424
+ if (conditionParams.orgName) {
425
+ requestParameters.orgName = conditionParams.orgName
426
+ delete conditionParams.orgName
427
+ }
428
+ Object.keys(conditionParams).forEach(key => {
429
+ if (Array.isArray(conditionParams[key])) {
430
+ // 检查数组中是否包含 null
431
+ const hasNull = conditionParams[key].every(item => item === '') || conditionParams[key].length === 0
432
+ // 如果包含 null,则删除该属性
433
+ if (hasNull) {
434
+ delete conditionParams[key]
435
+ }
436
+ }
437
+ })
438
+ requestParameters.conditionParams = conditionParams
439
+ requestParameters.queryParamsName = this.queryParamsName
440
+ requestParameters.queryParams = this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined
441
+ this.requestParameters = requestParameters
442
+ // 加载数据
443
+ return this.loadTableData(requestParameters)
444
+ },
445
+ requestParameters: {},
446
+ rowKey: undefined,
447
+ // x滚动条宽度
448
+ scrollXWidth: 1600,
449
+ // y滚动条高度
450
+ scrollYHeight: 'calc(100vh - 31rem)',
451
+ // 表格选择列Key集合
452
+ selectedRowKeys: [],
453
+ // 表格选择Row集合
454
+ selectedRows: [],
455
+ // 禁止表格选择Row集合
456
+ selectedDisableRows: [],
457
+ // 业务标题
458
+ title: '',
459
+ // 数据列
460
+ tableColumns: [],
461
+ // 查询用表单
462
+ form: {},
463
+ oldForm: {},
464
+ // 是否允许修改
465
+ isModify: false,
466
+ // 是否允许删除
467
+ isDelete: false,
468
+ // 是否允许选择
469
+ isChoose: false,
470
+ // 选中用于修改的id
471
+ selectId: undefined,
472
+ // 是否显示展示列抽屉
473
+ visible: false,
474
+ // 编辑按钮加载状态
475
+ editLoading: false,
476
+ // 按钮状态
477
+ buttonState: {},
478
+ // eventBtnState
479
+ eventState: {},
480
+ // 自定义按钮数组
481
+ editButtonStateData: [],
482
+ // 按钮权限
483
+ buttonPermissions: [],
484
+ // 是否展示汇总
485
+ showSummary: false,
486
+ // 自定义汇总
487
+ showCustomSummary: false,
488
+ summaryData: [],
489
+ // 图标样式
490
+ iconStyle: {
491
+ position: 'relative',
492
+ top: '1px'
493
+ },
494
+ // 当前环境
495
+ env: 'prod',
496
+ // 预览模式(表格 or 看板)
497
+ isTableMode: true,
498
+ // 汇总抽屉是否显示
499
+ summaryDrawerVisible: false,
500
+ // 汇总更新标志
501
+ summaryUpdate: false,
502
+ customSummaryArray: [],
503
+ formItems: [],
504
+ // 是否为行编辑模式
505
+ isEditMode: false,
506
+ // 定义主键
507
+ primaryKey: '',
508
+ // 是否进行初始化查询
509
+ createdQuery: false,
510
+ // 允许看板模式
511
+ allowedCardMode: false,
512
+ // 看板模式配置
513
+ cardModeConfig: undefined,
514
+ // 暂存行编辑前数据 用于比较哪些变化了才需要保存
515
+ editRowBeforeData: [],
516
+ // 是否简易模式
517
+ simpleMode: false,
518
+ // crud打印模板配置
519
+ printTemplate: false,
520
+ queryParams: {},
521
+ // 定义总行数
522
+ totalCount: 0,
523
+ user: {},
524
+ chartsConfigArray: [],
525
+ summaryDrawerWidth: 35
526
+ }
527
+ },
528
+ props: {
529
+ // 查询配置文件名
530
+ queryParamsName: {
531
+ type: String,
532
+ default: () => {
533
+ return ''
534
+ }
535
+ },
536
+ // 查询配置文件名
537
+ serviceName: {
538
+ type: String,
539
+ default: () => {
540
+ return ''
541
+ }
542
+ },
543
+ // 查询配置文件Json
544
+ queryParamsJson: {
545
+ type: Object,
546
+ default: null
547
+ },
548
+ // 固定查询表单
549
+ fixedQueryForm: {
550
+ type: Object,
551
+ default: () => {
552
+ return {}
553
+ }
554
+ },
555
+ // 数据只有一页时是否展示分页,true:展示,auto:隐藏
556
+ showPagination: {
557
+ type: Boolean,
558
+ default: true
559
+ },
560
+ // 是否自定义删除功能
561
+ customDelete: {
562
+ type: Boolean,
563
+ default: false
564
+ },
565
+ // 自适应底部编剧
566
+ extraHeight: {
567
+ type: Number,
568
+ default: 80
569
+ }
570
+ },
571
+ computed: {
572
+ rowSelection () {
573
+ return {
574
+ selectedRowKeys: this.selectedRowKeys,
575
+ onChange: this.onSelectChange,
576
+ getCheckboxProps: record => ({
577
+ props: {
578
+ disabled: this.selectedDisableRows.includes(record[this.rowKey]), // Column configuration not to be checked
579
+ name: record.name,
580
+ },
581
+ }),
582
+ }
583
+ },
584
+ ...mapState('account', { currUser: 'user' }),
585
+ ...mapState('setting', ['compatible'])
586
+ },
587
+ mounted () {
588
+ window.addEventListener('resize', this.handleResize)
589
+ },
590
+ beforeDestroy () {
591
+ // 销毁页面查询定时器
592
+ if (this.queryTimer) {
593
+ clearInterval(this.queryTimer)
594
+ }
595
+ window.removeEventListener('resize', this.handleResize)
596
+ },
597
+ methods: {
598
+ customFunctionShow (customFunction, record, cIndex) {
599
+ return executeStrFunctionByContext(this, customFunction, [record, cIndex])
600
+ },
601
+ getConfigByNameAsync,
602
+ runLogic,
603
+ executeStrFunctionByContext,
604
+ columnClick (key, value, record) {
605
+ this.$emit('columnClick', key, value, record)
606
+ },
607
+ gotoUserDetail (key, value, record) {
608
+ this.$emit('gotoUserDetail', key, value, record)
609
+ },
610
+ getFromItem (model, text, record, index) {
611
+ const aa = this.formItems.reduce((acc, item) => {
612
+ if (item.type === 'group') {
613
+ const foundItem = item.groupItems.find(_item => _item.model === model && _item.editRow)
614
+ if (foundItem) {
615
+ acc = foundItem
616
+ }
617
+ } else if (item.model === model && item.editRow) {
618
+ acc = item
619
+ }
620
+ return acc
621
+ }, null)
622
+ if (aa) {
623
+ const tempConfig = JSON.parse(JSON.stringify(aa))
624
+ // 如果找到了字段
625
+ const ColumnIndex = this.tableColumns.findIndex(item => item.dataIndex === model)
626
+ // 并且表单项是日期框
627
+ if (ColumnIndex !== -1 && ['yearPicker', 'monthPicker', 'datePicker', 'rangePicker'].includes(tempConfig.type)) {
628
+ // 修改他的列宽
629
+ this.tableColumns[ColumnIndex].width = 220
630
+ }
631
+ // 如果有检验规则检验是数字
632
+ if (ColumnIndex !== -1 && ['number', 'integer', 'float'].includes(tempConfig?.rule?.type)) {
633
+ // 修改他的列宽
634
+ tempConfig.numberInput = true
635
+ }
636
+ if (tempConfig.editRowShowFunc) {
637
+ if (executeStrFunctionByContext(this, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
638
+ return tempConfig
639
+ }
640
+ } else {
641
+ return tempConfig
642
+ }
643
+ }
644
+ return false
645
+ },
646
+ // 打开行编辑
647
+ openEditMode () {
648
+ this.isEditMode = true
649
+ this.editRowBeforeData = JSON.parse(JSON.stringify(this.getTableData()))
650
+ },
651
+ // 标记行保存
652
+ editRowSave () {
653
+ // 获取最新数据
654
+ const editRowAfterData = this.getTableData()
655
+ const changeData = getChangedData(this.editRowBeforeData, editRowAfterData)
656
+ if (this.eventState?.customSave) {
657
+ this.custom('customSave', {
658
+ tableData: editRowAfterData,
659
+ changeData
660
+ })
661
+ return
662
+ }
663
+ if (changeData.length === 0) {
664
+ this.$message.info('没有数据发生变化')
665
+ } else {
666
+ Modal.confirm({
667
+ title: '是否确认保存?',
668
+ content: `此操作将保存当前行编辑的数据,共修改${changeData.length}条数据`,
669
+ zIndex: 1001,
670
+ onOk: () => {
671
+ return new Promise((resolve, reject) => {
672
+ const requestParameters = {
673
+ queryParamsName: this.queryParamsName,
674
+ changeData: changeData.map(h => getRealKeyData(h)),
675
+ operaInfo: this.currUser.operaInfo
676
+ }
677
+ editRowSave(requestParameters, this.serviceName, this.env === 'dev').then(res => {
678
+ this.$message.success('行内数据保存成功')
679
+ this.isEditMode = false
680
+ this.refresh()
681
+ resolve(res)
682
+ }).catch(e => {
683
+ reject(e)
684
+ this.$message.error('保存失败!')
685
+ })
686
+ })
687
+ },
688
+ onCancel () {
689
+ }
690
+ })
691
+ }
692
+ },
693
+ importExcelOk (data) {
694
+ this.refresh(true)
695
+ this.$emit('importExcelOk', data)
696
+ },
697
+ /**
698
+ * 行选择事件
699
+ * @param row 选中行集合
700
+ * @param attr 表单项属性
701
+ */
702
+ async rowChoose (row, attr, callback, record) {
703
+ // 如果配置了自定义函数
704
+ if (attr.dataChangeFunc) {
705
+ await executeStrFunction(attr.dataChangeFunc, [record, this.setForm, {
706
+ ...attr,
707
+ selectRows: row
708
+ }, util, this.getSelf(), this.mode, runLogic, getConfigByNameAsync])
709
+ } else {
710
+ // 默认填充选中行数据到当前表单
711
+ setDataByRealKey(record, row[0])
712
+ }
713
+ if (callback) {
714
+ callback()
715
+ }
716
+ },
717
+ setForm (record, obj) {
718
+ Object.assign(record, obj)
719
+ this.$forceUpdate()
720
+ },
721
+ handleResize () {
722
+ debounce(() => {
723
+ this.setScrollYHeight({})
724
+ }, 100)()
725
+ },
726
+ isInAModal () {
727
+ let parent = this.$parent
728
+ while (parent) {
729
+ // 检查组件名称,这里假设a-modal组件的名称为AModal,根据实际情况可能需要调整
730
+ if (parent.$options.name === 'AModal') {
731
+ return true
732
+ }
733
+ parent = parent.$parent
734
+ }
735
+ return false
736
+ },
737
+ executeStrFunction,
738
+ // 切换看板模式和表格模式
739
+ changeViewMode () {
740
+ this.isTableMode = !this.isTableMode
741
+ // 看板切换回表格模式 刷新列表
742
+ this.refresh(true)
743
+ },
744
+ /**
745
+ * 初始化表格参数
746
+ */
747
+ init (params) {
748
+ const {
749
+ // 查询参数对象, 用于没有对应查询配置文件名时
750
+ queryParams,
751
+ tableColumns,
752
+ attachGrid,
753
+ buttonState,
754
+ eventState = {},
755
+ buttonPermissions,
756
+ editButtonStateData = [],
757
+ title,
758
+ form,
759
+ tableSummaryMap = {},
760
+ customTableSummaryArray = [],
761
+ viewMode,
762
+ localEditMode,
763
+ formSubmitTypeInLocalEditMode = 'cover',
764
+ rowSelectMode,
765
+ allowSelectRowNum = 0,
766
+ formItems,
767
+ env = 'prod',
768
+ createdQuery = true,
769
+ createdEditMode = false,
770
+ primaryKey,
771
+ allowedCardMode = false,
772
+ simpleMode = false,
773
+ showRightTools = true,
774
+ cardModeConfig,
775
+ summaryUpdate,
776
+ summaryDrawerWidth = 35,
777
+ chartsConfigArray = [],
778
+ printTemplate = 'DEFAULT_CRUD_PRINT_TEMPLATE',
779
+ } = params
780
+ this.showSummary = Object.keys(tableSummaryMap).length > 0
781
+ if (this.showSummary) {
782
+ Object.keys(tableSummaryMap).forEach(item => {
783
+ this.summaryData.push({
784
+ key: item,
785
+ title: tableSummaryMap[item],
786
+ value: ' ',
787
+ loading: true,
788
+ success: false
789
+ })
790
+ })
791
+ }
792
+ if (customTableSummaryArray.length > 0) {
793
+ customTableSummaryArray.forEach(item => {
794
+ this.summaryData.push({
795
+ key: item.key,
796
+ title: item.title,
797
+ value: ' ',
798
+ loading: true,
799
+ success: false
800
+ })
801
+ })
802
+ this.showCustomSummary = true
803
+ this.customSummaryArray = customTableSummaryArray
804
+ }
805
+ this.queryParams = queryParams
806
+ this.tableColumns = JSON.parse(JSON.stringify(tableColumns))
807
+ if (this.tableColumns.length === 0) {
808
+ return
809
+ }
810
+ this.attachGrid = attachGrid
811
+ this.viewMode = viewMode
812
+ this.localEditMode = localEditMode
813
+ this.formSubmitTypeInLocalEditMode = formSubmitTypeInLocalEditMode
814
+ this.rowSelectMode = rowSelectMode
815
+ this.allowSelectRowNum = allowSelectRowNum
816
+ this.simpleMode = simpleMode
817
+ this.formItems = formItems
818
+ this.user = this.currUser
819
+ this.createdQuery = createdQuery
820
+ this.primaryKey = primaryKey
821
+ this.buttonState = buttonState
822
+ this.eventState = eventState
823
+ this.showRightTools = showRightTools
824
+ this.printTemplate = printTemplate
825
+ this.summaryDrawerWidth = summaryDrawerWidth
826
+ this.chartsConfigArray = chartsConfigArray
827
+ if (this.chartsConfigArray.length > 0) {
828
+ // 循环chartsConfigArray,将每个配置的数据请求参数赋值给requestParameters
829
+ this.chartsConfigArray.forEach(item => {
830
+ item.config.queryParams = JSON.parse(JSON.stringify(this.queryParams))
831
+ item.config.queryParamsName = this.queryParamsName
832
+ })
833
+ }
834
+ if (this.localEditMode) {
835
+ this.localEditModeDataSource = []
836
+ if (this.formSubmitTypeInLocalEditMode === 'append') {
837
+ this.isLocalDataSourceLoadedExternally = true
838
+ const defaultItem = {}
839
+ defaultItem['序号'] = 0
840
+ this.localEditModeDataSource.push(defaultItem)
841
+ } else {
842
+ this.isLocalDataSourceLoadedExternally = false
843
+ }
844
+ this.buttonState.import = false
845
+ this.buttonState.export = false
846
+ this.showRightTools = false
847
+ }
848
+ if (this.rowSelectMode) {
849
+ this.buttonState = {
850
+ choose: true
851
+ }
852
+ this.showRightTools = false
853
+ }
854
+ this.buttonPermissions = buttonPermissions
855
+ this.editButtonStateData = editButtonStateData
856
+ this.title = title
857
+ this.env = env
858
+ this.rowKey = this.getPrimaryKeyName()
859
+ this.allowedCardMode = allowedCardMode
860
+ this.cardModeConfig = cardModeConfig
861
+ this.summaryUpdate = summaryUpdate
862
+ this.isEditMode = createdEditMode
863
+ let totalWidth = 0
864
+ for (let i = 0; i < this.tableColumns.length; i++) {
865
+ const item = this.tableColumns[i]
866
+ // 设置操作列
867
+ if (item.slotType === 'action') {
868
+ item.fixed = 'right'
869
+ item.width = 70
870
+ }
871
+ // 设置表格宽度
872
+ if (item.width) {
873
+ totalWidth = totalWidth + item.width
874
+ } else {
875
+ totalWidth = totalWidth + 180
876
+ }
877
+ }
878
+ // 横向滚动长度大于所有宽度,才能实现固定表头
879
+ this.scrollXWidth = totalWidth
880
+ // 加载筛选列完成
881
+ this.columnSelectLoaded = true
882
+ this.setQueryForm(form || {})
883
+ // 简易模式,并且是看板模式,默认直接进入看板模式
884
+ if (this.allowedCardMode && this.simpleMode) {
885
+ this.isTableMode = false
886
+ }
887
+ if (params.queryInterval) {
888
+ this.queryTimer = setInterval(() => {
889
+ this.refresh()
890
+ }, params.queryInterval * 1000)
891
+ }
892
+ },
893
+ // 操作面板按钮渲染
894
+ buttonRendering (button) {
895
+ if (!this.buttonPermissions) {
896
+ return true
897
+ }
898
+ try {
899
+ const existingItem = this.buttonPermissions.find(item => item.btnName === button)
900
+ const rolestr = this.currUser.rolestr?.split(',')
901
+ if (existingItem?.state) {
902
+ const currUserRole = existingItem.roleStr
903
+ return rolestr.some(item => currUserRole && currUserRole.includes(item))
904
+ } else {
905
+ return true
906
+ }
907
+ } catch (e) {
908
+ console.error(e)
909
+ return false
910
+ }
911
+ },
912
+ // 防止查询多次点击处理
913
+ loadTableData (requestParameters) {
914
+ if (this.queryPromise) {
915
+ return this.queryPromise
916
+ }
917
+ this.queryPromise = this.loadTableDataGen(requestParameters).finally(() => {
918
+ this.queryPromise = undefined
919
+ })
920
+ return this.queryPromise
921
+ },
922
+ /**
923
+ * 加载表格数据
924
+ * @param requestParameters 请求参数
925
+ */
926
+ async loadTableDataGen (requestParameters) {
927
+ let result
928
+ if (this.localEditMode) {
929
+ if (!this.isLocalDataSourceLoadedExternally && requestParameters?.conditionParams && Object.keys(requestParameters?.conditionParams).length > 0) {
930
+ const result = await query(Object.assign(requestParameters, { userId: this.currUser?.id }),
931
+ this.serviceName, this.env === 'dev')
932
+ if (result.data) {
933
+ let no = 0
934
+ this.localEditModeDataSource = result.data.map(item => {
935
+ item['序号'] = no
936
+ no++
937
+ return item
938
+ })
939
+ }
940
+ this.isLocalDataSourceLoadedExternally = true
941
+ }
942
+ result = new Promise((resolve) => {
943
+ resolve({
944
+ data: this.localEditModeDataSource
945
+ })
946
+ })
947
+ } else {
948
+ result = query(Object.assign(requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
949
+ result.then(res => {
950
+ this.totalCount = res.totalCount || 0
951
+ })
952
+ }
953
+ if (this.isTableMode && !this.simpleMode) {
954
+ this.clearRowKeys()
955
+ }
956
+ this.$emit('afterQuery', result, requestParameters.conditionParams)
957
+ return result
958
+ },
959
+ /**
960
+ * 操作列事件
961
+ * @param record 本条数据
962
+ * @param actionType 操作类型
963
+ * @param func 事件默认 action
964
+ * @param index 行下标
965
+ */
966
+ action (record, actionType, func = 'action', index) {
967
+ this.$emit('action', record, record[this.getPrimaryKeyName()], actionType, func, index)
968
+ },
969
+ // 看板点击事件
970
+ handleCardEmit (data, eventName) {
971
+ this.action(data, undefined, eventName)
972
+ },
973
+ /**
974
+ * 选择列事件
975
+ * @param selectedRowKeys 被选择的列Key集合
976
+ * @param selectedRows 被选择的列集合
977
+ */
978
+ onSelectChange (selectedRowKeys, selectedRows) {
979
+ this.selectedRowKeys = selectedRowKeys
980
+ this.selectedRows = selectedRows
981
+ this.isModify = this.selectedRowKeys.length === 1
982
+ this.isDelete = this.selectedRowKeys.length > 0
983
+ this.isChoose = this.allowSelectRowNum === 0 ? this.selectedRowKeys.length > 0 : this.selectedRowKeys.length === this.allowSelectRowNum
984
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
985
+ },
986
+ /**
987
+ * 清除表格选中项
988
+ */
989
+ clearRowKeys () {
990
+ this.$refs.table.clearSelected()
991
+ },
992
+ /**
993
+ * 为表格附加查询条件
994
+ */
995
+ setQueryForm (form = {}) {
996
+ this.form = form
997
+ if (this.createdQuery) {
998
+ this.refresh(true)
999
+ } else {
1000
+ this.createdQuery = true
1001
+ }
1002
+ },
1003
+ /**
1004
+ * 表格重新加载方法
1005
+ * 如果参数为 true, 则强制刷新到第一页
1006
+ */
1007
+ refresh (bool) {
1008
+ this.$nextTick(() => {
1009
+ this.$refs.table.refresh(bool)
1010
+ })
1011
+ },
1012
+ setScrollYHeight ({ extraHeight = this.extraHeight, id = this.uniqueId, type = '' }) {
1013
+ this.$nextTick(() => {
1014
+ setTimeout(() => {
1015
+ const curDocument = window?.rawDocument || document
1016
+ const innerHeight = window?.rawWindow?.innerHeight || window.innerHeight || 0
1017
+ if (typeof extraHeight == 'undefined') {
1018
+ // 默认底部分页32 + 边距48
1019
+ extraHeight = 48 + 32
1020
+ }
1021
+ let tHeader = null
1022
+ if (id) {
1023
+ tHeader = curDocument.getElementById(id) ? curDocument.getElementById(id).getElementsByClassName('ant-table-thead')[0] : null
1024
+ } else {
1025
+ tHeader = curDocument.getElementsByClassName('ant-table-thead')[0]
1026
+ }
1027
+ // 表格内容距离顶部的距离
1028
+ let tHeaderBottom = 0
1029
+ if (tHeader) {
1030
+ tHeaderBottom = tHeader.getBoundingClientRect().bottom
1031
+ }
1032
+ if (tHeaderBottom === 0) {
1033
+ this.scrollYHeight = 'calc(100vh - 31rem)'
1034
+ if (window.__MICRO_APP_ENVIRONMENT__) {
1035
+ this.scrollYHeight = 'calc(100vh - 28.5rem)'
1036
+ }
1037
+ return
1038
+ }
1039
+
1040
+ // 判断是否在 modal 中
1041
+ if (this.isInAModal()) {
1042
+ let modalElement = null
1043
+ if (tHeader) {
1044
+ modalElement = tHeader.closest('.ant-modal-body')
1045
+ } else {
1046
+ modalElement = curDocument.querySelector('.ant-modal-body')
1047
+ }
1048
+ if (modalElement) {
1049
+ const modalRect = modalElement.getBoundingClientRect()
1050
+ // 48 是 modal 通常的边距 32 是分页
1051
+ extraHeight = innerHeight - modalRect.bottom + 32 + 48
1052
+ }
1053
+ }
1054
+ if (innerHeight - (tHeaderBottom + extraHeight) < 210) {
1055
+ this.scrollYHeight = 'calc(100vh - 31rem)'
1056
+ return
1057
+ }
1058
+ // 窗体高度-表格内容顶部的高度-表格内容底部的高度
1059
+ // this.scrollYHeight = document.body.clientHeight - tHeaderBottom - extraHeight
1060
+ this.scrollYHeight = `calc(100vh - ${tHeaderBottom + extraHeight}px)`
1061
+ }, 60)
1062
+ })
1063
+ },
1064
+ /**
1065
+ * 格式化日期
1066
+ * @param date 日期字符串
1067
+ * @param format 格式化方式
1068
+ */
1069
+ format (date, format) {
1070
+ return formatDate(date, format)
1071
+ },
1072
+ /**
1073
+ * 格式化数字
1074
+ * @param number string 或者 number
1075
+ * @param decimalPlaces 小数位数
1076
+ */
1077
+ numberFormat (number, decimalPlaces = 2) {
1078
+ const value = parseFloat(number)
1079
+ if (!isNaN(value)) {
1080
+ return value.toFixed(decimalPlaces)
1081
+ } else {
1082
+ return ''
1083
+ }
1084
+ },
1085
+ /**
1086
+ * 获取主键列名称
1087
+ */
1088
+ getPrimaryKeyName () {
1089
+ if (this.primaryKey) {
1090
+ return this.primaryKey
1091
+ }
1092
+ const indexColumn = this.tableColumns.find(i => i?.slotType === 'index')
1093
+ return indexColumn ? indexColumn.dataIndex : this.tableColumns[0].dataIndex
1094
+ },
1095
+ handleExport (type) {
1096
+ this.$refs.exportExcel.handleExport(type)
1097
+ },
1098
+ handlePrint (type) {
1099
+ const printData = {
1100
+ title: this.title,
1101
+ form: this.form,
1102
+ operaInfo: this.currUser.operaInfo,
1103
+ operaTime: moment().format('YYYY-MM-DD HH:mm:ss'),
1104
+ summary: this.retrieveSummaryData
1105
+ }
1106
+ this.$refs.exportExcel.handlePrint(type, printData)
1107
+ },
1108
+ validateTableAndSyncData (currRow, defaultAppendRowData) {
1109
+ let isLastRow = false
1110
+ if (this.localEditModeDataSource.length === 0) {
1111
+ isLastRow = true
1112
+ } else if (currRow['序号'] === this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号']) {
1113
+ isLastRow = true
1114
+ }
1115
+ if (isLastRow) {
1116
+ this.appendLocalData(defaultAppendRowData)
1117
+ }
1118
+ },
1119
+ // 新增业务
1120
+ add () {
1121
+ if (this.eventState?.customAdd) {
1122
+ this.custom('customAdd', {})
1123
+ return
1124
+ }
1125
+ if (this.localEditMode && this.isEditMode) {
1126
+ this.appendLocalData({})
1127
+ } else {
1128
+ this.$emit('add')
1129
+ }
1130
+ },
1131
+ // 添加业务
1132
+ move () {
1133
+ this.$emit('move')
1134
+ },
1135
+ // 通用事件业务
1136
+ custom (func) {
1137
+ this.$emit('customEvent', func)
1138
+ },
1139
+ // 编辑业务
1140
+ edit (id) {
1141
+ this.editLoading = true
1142
+ this.getEditData(id).then(modifyModelData => {
1143
+ if (this.eventState?.customEdit) {
1144
+ this.custom('customEdit', { id, modifyModelData })
1145
+ return
1146
+ }
1147
+ this.$emit('edit', modifyModelData)
1148
+ this.editLoading = false
1149
+ })
1150
+ },
1151
+ // 行选择业务
1152
+ choose () {
1153
+ if (this.isChoose) {
1154
+ // 如果配置了自定义函数
1155
+ this.$emit('rowChoose', this.selectedRows)
1156
+ } else {
1157
+ this.$message.warning(this.allowSelectRowNum === 0 ? '请选择数据' : `请选择${this.allowSelectRowNum}条数据`)
1158
+ }
1159
+ },
1160
+ // 自定义按钮点击
1161
+ editButtonStateDataClick (index) {
1162
+ this.$emit('editButtonStateDataClick', this.editButtonStateData[index].functionName, this.selectedRows)
1163
+ },
1164
+ // 获取被编辑的数据
1165
+ getEditData (id) {
1166
+ if (!id) {
1167
+ this.selectId = this.selectedRowKeys[0]
1168
+ } else {
1169
+ this.selectId = id
1170
+ }
1171
+ const primaryKeyName = this.getPrimaryKeyName()
1172
+ if (this.tableColumns[0].dataIndex !== primaryKeyName) {
1173
+ this.selectId = this.selectedRows[0][primaryKeyName]
1174
+ }
1175
+ // 将更新需要的主键值加入到primaryKeyData中
1176
+ const primaryKeyData = {}
1177
+ primaryKeyData[primaryKeyName] = this.selectId
1178
+ if (this.localEditMode) {
1179
+ return new Promise((resolve) => {
1180
+ const modifyData = this.getDataByRowKeyValue(this.selectId)
1181
+ resolve({
1182
+ data: modifyData,
1183
+ primaryKeyData: primaryKeyData
1184
+ })
1185
+ })
1186
+ }
1187
+ const requestParameters = {
1188
+ queryParamsName: this.queryParamsName,
1189
+ queryParams: this.queryParams && Object.keys(this.queryParams).length > 0 ? this.queryParams : undefined,
1190
+ conditionParams: {},
1191
+ pageNo: 1,
1192
+ pageSize: 1
1193
+ }
1194
+ requestParameters.conditionParams[primaryKeyName] = this.selectId
1195
+ requestParameters.f_businessid = this.selectId
1196
+ return queryWithResource(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1197
+ return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
1198
+ })
1199
+ },
1200
+ // 删除业务
1201
+ deleteItem () {
1202
+ if (this.viewMode) {
1203
+ this.$message.info('预览模式禁止删除')
1204
+ return
1205
+ }
1206
+ Modal.confirm({
1207
+ title: '提示',
1208
+ content: '您本次要删除共' + this.selectedRowKeys.length + '条数据,确定操作吗?',
1209
+ zIndex: 1001,
1210
+ onOk: () => {
1211
+ const requestParameters = {
1212
+ queryParamsName: this.queryParamsName,
1213
+ idList: this.selectedRowKeys
1214
+ }
1215
+ if (this.eventState?.customDelete) {
1216
+ this.custom('customDelete', {
1217
+ selectedRowKeys: this.selectedRowKeys,
1218
+ selectedRows: this.selectedRows
1219
+ })
1220
+ return
1221
+ }
1222
+ return new Promise((resolve, reject) => {
1223
+ if (this.localEditMode) {
1224
+ this.localEditModeDataSource = this.getLocalData().filter(item => !this.selectedRowKeys.includes(item[this.rowKey]))
1225
+ resolve(200)
1226
+ this.$message.success('删除成功!')
1227
+ this.refresh(true)
1228
+ // afterDelete
1229
+ this.$emit('afterDelete', requestParameters)
1230
+ } else if (this.customDelete) {
1231
+ this.$emit('del', this.selectedRows, resolve)
1232
+ } else {
1233
+ remove(requestParameters, this.serviceName, this.env === 'dev').then(res => {
1234
+ resolve(res)
1235
+ this.$message.success('删除成功!')
1236
+ this.refresh(true)
1237
+ // afterDelete
1238
+ this.$emit('afterDelete', requestParameters)
1239
+ }).catch(e => {
1240
+ reject(e)
1241
+ this.$message.error('删除失败!')
1242
+ })
1243
+ }
1244
+ })
1245
+ },
1246
+ onCancel () {
1247
+ }
1248
+ })
1249
+ },
1250
+ // 导入业务
1251
+ importData () {
1252
+ this.$refs.importExcel.importExcelHandleOpen()
1253
+ },
1254
+ afterVisibleChange (val) {
1255
+ if (val) {
1256
+ this.retrieveSummaryData()
1257
+ }
1258
+ },
1259
+ async retrieveSummaryData () {
1260
+ const promises = []
1261
+
1262
+ if (this.requestParameters.querySummary) {
1263
+ const querySummaryPromise = querySummary(Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1264
+ .then(res => {
1265
+ if (this.compatible === 'V3') {
1266
+ res = res.data
1267
+ }
1268
+ if (res.length > 0) {
1269
+ this.summaryData.forEach(item => {
1270
+ res.forEach(summary => {
1271
+ if (item.title === summary.title) {
1272
+ item.value = summary.value
1273
+ item.success = true
1274
+ item.loading = false
1275
+ }
1276
+ })
1277
+ })
1278
+ }
1279
+ })
1280
+ promises.push(querySummaryPromise)
1281
+ }
1282
+
1283
+ if (this.showCustomSummary) {
1284
+ this.customSummaryArray.forEach(item => {
1285
+ const runLogicPromise = runLogic(item.source, Object.assign(this.requestParameters, { userId: this.currUser?.id }), this.serviceName, this.env === 'dev')
1286
+ .then(res => {
1287
+ this.summaryData.forEach(summary => {
1288
+ if (item.key === summary.key) {
1289
+ summary.value = res.value
1290
+ summary.success = true
1291
+ summary.loading = false
1292
+ }
1293
+ })
1294
+ })
1295
+ .catch(e => {
1296
+ this.summaryData.forEach(summary => {
1297
+ if (item.key === summary.key) {
1298
+ summary.value = 0
1299
+ summary.success = false
1300
+ summary.loading = false
1301
+ }
1302
+ })
1303
+ })
1304
+ promises.push(runLogicPromise)
1305
+ })
1306
+ }
1307
+
1308
+ await Promise.all(promises)
1309
+ return this.summaryData
1310
+ },
1311
+ showDrawer () {
1312
+ if (this.summaryUpdate) {
1313
+ this.summaryData.forEach(item => {
1314
+ item.loading = true
1315
+ item.success = false
1316
+ item.value = ' '
1317
+ })
1318
+ this.summaryDrawerVisible = true
1319
+ } else {
1320
+ this.$message.warning('请查询后再来查看')
1321
+ }
1322
+ },
1323
+ onClose () {
1324
+ this.summaryDrawerVisible = false
1325
+ },
1326
+ // 获取表格内所有数据
1327
+ getTableData () {
1328
+ return this.$refs.table.localDataSource
1329
+ },
1330
+ // 设置表格内数据
1331
+ setTableData (data) {
1332
+ Object.assign(this.$refs.table, { localDataSource: data })
1333
+ },
1334
+ // 获取所有本地数据
1335
+ getLocalData () {
1336
+ return this.localEditModeDataSource
1337
+ },
1338
+ // 获取指定rowKey的value的本地数据
1339
+ getDataByRowKeyValue (rowKeyValue) {
1340
+ return this.getLocalData().find(item => {
1341
+ return item[this.rowKey] === rowKeyValue
1342
+ })
1343
+ },
1344
+ // 修改本地数据
1345
+ modifyLocalData (rowKeyValue, data) {
1346
+ const modifyItem = this.getDataByRowKeyValue(rowKeyValue)
1347
+ if (modifyItem) {
1348
+ Object.assign(modifyItem, data)
1349
+ }
1350
+ },
1351
+ // 追加本地数据
1352
+ appendLocalData (item) {
1353
+ if (this.localEditModeDataSource.length === 0) {
1354
+ item['序号'] = 1
1355
+ } else {
1356
+ item['序号'] = this.localEditModeDataSource[this.localEditModeDataSource.length - 1]['序号'] + 1
1357
+ }
1358
+ this.localEditModeDataSource.push(item)
1359
+ }
1360
+ }
1361
+ }
1362
+ </script>
1363
+ <style lang="less" scoped>
1364
+
1365
+ .custom-chart-title {
1366
+ font-size: 16px;
1367
+ font-weight: 700;
1368
+ margin-bottom: 8px;
1369
+ }
1370
+
1371
+ .custom-chart-desc {
1372
+ font-size: 12px;
1373
+ color: rgba(0, 0, 0, .45);
1374
+ margin-bottom: 16px;
1375
+ }
1376
+
1377
+ :deep(.ant-table-thead > tr > th) {
1378
+ font-weight: 600;
1379
+ }
1380
+
1381
+ :deep(.table-wrapper .ant-pagination) {
1382
+ display: flex;
1383
+ flex-direction: row;
1384
+ align-items: center;
1385
+ padding: 0;
1386
+ }
1387
+
1388
+ :deep(.table-wrapper .ant-pagination .ant-pagination-total-text) {
1389
+ white-space: nowrap;
1390
+ }
1391
+
1392
+ :deep(.ant-table td) {
1393
+ white-space: nowrap;
1394
+ }
1395
+
1396
+ .footer_sum_title {
1397
+ color: @primary-color;
1398
+ font-weight: bold;
1399
+ }
1400
+
1401
+ .footer_sum_item {
1402
+ white-space: nowrap;
1403
+ }
1404
+
1405
+ .ant-btn-hover {
1406
+ border-color: @primary-color;
1407
+ color: @primary-color;
1408
+ }
1409
+
1410
+ .innerTable {
1411
+ :deep(.ant-form-item) {
1412
+ margin: 0;
1413
+ }
1414
+ }
1415
+ </style>