vue2-client 1.18.3 → 1.18.5

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 (244) hide show
  1. package/.claude/settings.local.json +20 -20
  2. package/.cursorrules +19 -19
  3. package/.env.apply +19 -19
  4. package/.env.gaslink +19 -19
  5. package/.env.his +19 -19
  6. package/.env.liuli +20 -20
  7. package/.env.scada +19 -19
  8. package/.serena/memories/code_style_conventions.md +217 -217
  9. package/.serena/memories/project_overview.md +54 -54
  10. package/.serena/memories/project_structure.md +329 -329
  11. package/.serena/memories/suggested_commands.md +127 -127
  12. package/.serena/memories/task_completion_checklist.md +183 -183
  13. package/.serena/memories/tech_stack.md +94 -94
  14. package/CHANGELOG.md +830 -830
  15. package/CLAUDE.md +97 -97
  16. package/docs/LowCode/lowcode.md +155 -155
  17. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  18. package/jsconfig.json +19 -19
  19. package/package.json +1 -1
  20. package/public/his/editor/editor.html +51 -51
  21. package/public/his/editor/mock/bind_data.html +779 -779
  22. package/public/his/editor/mock/data_table.html +40 -40
  23. package/public/his/editor/mock/sign.html +75 -75
  24. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  25. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  26. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  27. package/public/his/editor/vender/date97/calendar.js +4 -4
  28. package/public/his/editor/vender/date97/lang/en.js +13 -13
  29. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  30. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  31. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  32. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  33. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  34. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  35. package/public/his/editor/vender/diff.js +1627 -1627
  36. package/public/his/editor/vender/editor.js +1 -1
  37. package/public/his/editor/vender/fabric.js +31187 -31187
  38. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  39. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  40. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  41. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  42. package/public/his/editor/vender/mui/mui.min.css +4 -4
  43. package/public/his/editor/vender/mui/mui.min.js +5 -5
  44. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  45. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  46. package/public/his/editor/vender/qrcode.js +7 -7
  47. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  48. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  49. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  50. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  51. package/public/his/editor/vender/validator.js +5094 -5094
  52. package/public/his/editor/vender/weui/weui.css +5659 -5659
  53. package/public/his/editor/vender/weui/weui.min.css +4 -4
  54. package/public/his/editor/vender/weui/weui.min.js +11 -11
  55. package/src/assets/img/paymentMethod/package.info +1 -1
  56. package/src/assets/svg/badtwo.svg +1 -1
  57. package/src/assets/svg/goodtwo.svg +1 -1
  58. package/src/base-client/components/AI/AskAiBtn.vue +136 -136
  59. package/src/base-client/components/AI/demo.vue +31 -31
  60. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  61. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  62. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  63. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  64. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  65. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  66. package/src/base-client/components/common/HIS/demo.vue +61 -61
  67. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  68. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  69. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  70. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  71. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  72. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  73. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  74. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  75. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  76. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  77. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  78. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  79. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  80. package/src/base-client/components/common/Recording/Recording.vue +243 -243
  81. package/src/base-client/components/common/Recording/index.js +3 -3
  82. package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
  83. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +304 -304
  84. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  85. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  86. package/src/base-client/components/common/XAddReport/index.js +3 -3
  87. package/src/base-client/components/common/XAddReport/index.md +56 -56
  88. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  89. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  90. package/src/base-client/components/common/XButtons/index.js +3 -3
  91. package/src/base-client/components/common/XButtons/index.md +61 -61
  92. package/src/base-client/components/common/XCalendar/XCalendar.vue +4 -4
  93. package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
  94. package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
  95. package/src/base-client/components/common/XDataCard/index.js +3 -3
  96. package/src/base-client/components/common/XDataCard/index.md +1 -1
  97. package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
  98. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  99. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  100. package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
  101. package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
  102. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  103. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  104. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  105. package/src/base-client/components/common/XFormTable/XFormTable.vue +1258 -1257
  106. package/src/base-client/components/common/XFormTable/index.md +92 -92
  107. package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
  108. package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
  109. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  110. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  111. package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
  112. package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
  113. package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
  114. package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
  115. package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
  116. package/src/base-client/components/common/XPrint/index.vue +97 -97
  117. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  118. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  119. package/src/base-client/components/common/XReport/index.js +3 -3
  120. package/src/base-client/components/common/XReport/print.js +186 -186
  121. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  122. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  123. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  124. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  125. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  126. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  127. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  128. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  129. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  130. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  131. package/src/base-client/components/common/XTab/index.js +3 -3
  132. package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
  133. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  134. package/src/base-client/components/common/XTable/XTableWrapper.vue +1 -1
  135. package/src/base-client/components/common/XTagGroup/index.vue +52 -52
  136. package/src/base-client/components/common/XTree/XTree.vue +424 -424
  137. package/src/base-client/components/common/XTree/index.js +3 -3
  138. package/src/base-client/components/common/XTree/index.md +36 -36
  139. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  140. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  141. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  142. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  143. package/src/base-client/components/his/XCharge/XChargeDemo.vue +145 -145
  144. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  145. package/src/base-client/components/index.js +51 -51
  146. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  147. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  148. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  149. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  150. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  151. package/src/base-client/plugins/Recording.js +258 -258
  152. package/src/base-client/plugins/index.js +23 -23
  153. package/src/components/CodeMirror/inedx.vue +118 -118
  154. package/src/components/CodeMirror/setting.js +40 -40
  155. package/src/components/checkbox/ImgCheckbox.vue +117 -117
  156. package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
  157. package/src/components/checkbox/index.js +9 -9
  158. package/src/components/exception/ExceptionPage.vue +70 -70
  159. package/src/components/g2Charts/constants.js +202 -202
  160. package/src/components/g2Charts/demo.vue +808 -808
  161. package/src/components/g2Charts/designer.vue +228 -228
  162. package/src/components/g2Charts/designerBaseConfig.vue +61 -61
  163. package/src/components/g2Charts/designerDataConfig.vue +259 -259
  164. package/src/components/g2Charts/designerStyleConfig.vue +16 -16
  165. package/src/components/g2Charts/index.vue +397 -397
  166. package/src/components/setting/Setting.vue +234 -234
  167. package/src/config/CreateQueryConfig.js +325 -325
  168. package/src/config/default/antd.config.js +89 -89
  169. package/src/config/default/setting.config.js +55 -55
  170. package/src/font-style/font.css +60 -60
  171. package/src/layouts/PageLayout.vue +151 -151
  172. package/src/layouts/SinglePageView.vue +136 -136
  173. package/src/layouts/header/AdminHeader.vue +132 -132
  174. package/src/layouts/header/InstitutionDetail.vue +181 -181
  175. package/src/layouts/tabs/TabsHead.vue +189 -189
  176. package/src/pages/DefaultExample/index.vue +77 -77
  177. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  178. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  179. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  180. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  181. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  182. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  183. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  184. package/src/pages/DynamicStatistics/index.vue +282 -282
  185. package/src/pages/Example/childIndex.vue +15 -15
  186. package/src/pages/Example/index.vue +30 -30
  187. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  188. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  189. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  190. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  191. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  192. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  193. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  194. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  195. package/src/pages/Recording/index.vue +77 -77
  196. package/src/pages/ServiceReview/index.vue +284 -284
  197. package/src/pages/SubExample/index.vue +26 -26
  198. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  199. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +1815 -1815
  200. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +1014 -1014
  201. package/src/pages/XReportView/index.vue +64 -64
  202. package/src/pages/XTreeOneProExample/index.vue +67 -67
  203. package/src/pages/login/Login.vue +379 -379
  204. package/src/pages/login/LoginV3.vue +389 -389
  205. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  206. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  207. package/src/pages/report/ReportTable.js +124 -124
  208. package/src/pages/resourceManage/orgListManage.vue +98 -98
  209. package/src/pages/system/settings/modifyPassword.vue +117 -117
  210. package/src/pages/system/ticket/index.vue +480 -480
  211. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  212. package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
  213. package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
  214. package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
  215. package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
  216. package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
  217. package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
  218. package/src/plugins/EventLogPlugin.js +33 -33
  219. package/src/plugins/FindParentsData.js +17 -17
  220. package/src/services/DataModel.js +30 -30
  221. package/src/services/LodopFuncs.js +137 -137
  222. package/src/services/api/TicketDetailsViewApi.js +46 -46
  223. package/src/services/api/entity.js +18 -18
  224. package/src/services/api/index.js +17 -17
  225. package/src/store/modules/account.js +121 -121
  226. package/src/store/modules/index.js +5 -5
  227. package/src/store/modules/lowCode.js +33 -33
  228. package/src/theme/default/style.less +58 -58
  229. package/src/theme/global.less +313 -313
  230. package/src/utils/formatter.js +74 -74
  231. package/src/utils/htmlToPDF.js +108 -108
  232. package/src/utils/htmlToPDFApi.js +5 -5
  233. package/src/utils/login.js +188 -188
  234. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  235. package/src/utils/lowcode/lowcodeLog.js +29 -29
  236. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  237. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  238. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  239. package/src/utils/map-utils.js +47 -47
  240. package/src/utils/reg.js +95 -95
  241. package/src/utils/runEvalFunction.js +14 -14
  242. package/src/utils/theme-color-replacer-extend.js +92 -92
  243. package/src/utils/util.js +329 -329
  244. package/src/utils/waterMark.js +31 -31
@@ -1,1257 +1,1258 @@
1
- <template>
2
- <splitpanes
3
- class="default-theme"
4
- :horizontal="false"
5
- @resized="storePaneSize"
6
- >
7
- <pane
8
- :size="treeSize"
9
- :min-size="15"
10
- :max-size="40"
11
- v-if="xTreeConfigName">
12
- <x-tree-pro
13
- :config-name="xTreeConfigName"
14
- :env="env"
15
- @action="action"
16
- @btnFuncClick="treeBtnFuncClick"
17
- @treeOnChecked="treeOnChecked"
18
- ref="xtree"
19
- ></x-tree-pro>
20
- </pane>
21
- <pane
22
- :size="100 - treeSize"
23
- >
24
- <a-skeleton :loading="loading" :paragraph="{ rows: 4 }"/>
25
- <a-row style="height: 12px" v-if="xTreeConfigName"></a-row>
26
- <div v-show="!loading">
27
- <template v-if="!loadError">
28
- <x-add-form
29
- ref="xAddForm"
30
- @onLocalSubmit="onLocalSubmit"
31
- @x-form-item-emit-func="emitFunc"
32
- @afterSubmit="onAddOrEditSubmitAfterSubmit"
33
- >
34
- <template slot="groupFormItems" slot-scope="{form, model, rules, modifyModelData}">
35
- <slot
36
- name="groupFormItems"
37
- :form="form"
38
- :model="model"
39
- :rules="rules"
40
- :modifyModelData="modifyModelData"></slot>
41
- </template>
42
- </x-add-form>
43
- <x-add-report
44
- v-if="moveType"
45
- ref="xAddReport"
46
- >
47
- </x-add-report>
48
- <div v-if="crudTitle" class="crud_title">
49
- {{ crudTitle }}
50
- </div>
51
- <x-form
52
- ref="xForm"
53
- @x-form-item-emit-func="emitFunc"
54
- @toggleAdvanced="toggleAdvanced"
55
- @onSubmit="onSearchSubmit">
56
- <slot name="formBtnExpand"></slot>
57
- </x-form>
58
- <!-- 默认模式:直接展示表格 -->
59
- <x-table
60
- v-if="tableShowMode === 'default'"
61
- ref="xTable"
62
- :fixedQueryForm="fixedQueryForm"
63
- :queryParamsName="queryParamsName"
64
- :query-params-json="queryParamsJson"
65
- :show-pagination="showPagination"
66
- :customDelete="customDelete"
67
- :extraHeight="extraHeight"
68
- :serviceName="serviceName"
69
- :pageMaxSize="realQueryConfig.queryPagesSize"
70
- :externalSelectedRowKeys="externalSelectedRowKeys"
71
- :customPagination="customPagination"
72
- :hiddenFunctionalArea="hiddenFunctionalArea"
73
- @x-form-item-emit-func="emitFunc"
74
- @add="add"
75
- @move="move"
76
- @edit="edit"
77
- @del="del"
78
- @rowChoose="rowChoose"
79
- @customEvent="customEvent"
80
- @afterDelete="afterDelete"
81
- @action="action"
82
- @selectRow="selectRow"
83
- @afterQuery="afterQuery"
84
- @columnClick="columnClick"
85
- @gotoUserDetail="gotoUserDetail"
86
- @editButtonStateDataClick="editButtonStateDataClick"
87
- @importExcelOk="importExcelOk"
88
- @rowClick="handleRowClick"
89
- @rowDblClick="handleRowDblClick"
90
- @beforeDataChange="beforeDataChange"
91
- @expand="onExpand">
92
- <template slot="leftButton" slot-scope="{selectedRowKeys, selectedRows}">
93
- <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
94
- </template>
95
- <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
96
- <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
97
- </template>
98
- <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
99
- <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
100
- <a-tooltip title="收起查询条件" placement="bottom">
101
- <a-button @click="toggleIsFormShow">
102
- <a-icon :style="iconStyle" :type="toggleIsFormIcon"/>
103
- </a-button>
104
- </a-tooltip>
105
- </template>
106
- <!-- 底部插槽 -->
107
- <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
108
- <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
109
- </template>
110
- <!-- excel导入说明插槽 -->
111
- <template #importExcelSlot>
112
- <slot name="importExcelSlot"></slot>
113
- </template>
114
- </x-table>
115
- <!-- 弹框模式:在 Modal 中展示表格 -->
116
- <a-modal
117
- v-if="tableShowMode === 'popup'"
118
- v-model="tableModalVisible"
119
- :title="realQueryConfig.popupTitle || title || realQueryConfig.title || '数据列表'"
120
- width="75%"
121
- :bodyStyle="{ padding: '12px' }"
122
- :footer="null"
123
- :destroyOnClose="false"
124
- >
125
- <x-table
126
- ref="xTable"
127
- :fixedQueryForm="fixedQueryForm"
128
- :queryParamsName="queryParamsName"
129
- :query-params-json="queryParamsJson"
130
- :show-pagination="showPagination"
131
- :customDelete="customDelete"
132
- :extraHeight="extraHeight"
133
- :serviceName="serviceName"
134
- :pageMaxSize="realQueryConfig.queryPagesSize"
135
- :externalSelectedRowKeys="externalSelectedRowKeys"
136
- :customPagination="customPagination"
137
- :hiddenFunctionalArea="hiddenFunctionalArea"
138
- @x-form-item-emit-func="emitFunc"
139
- @add="add"
140
- @move="move"
141
- @edit="edit"
142
- @del="del"
143
- @rowChoose="rowChoose"
144
- @customEvent="customEvent"
145
- @afterDelete="afterDelete"
146
- @action="action"
147
- @selectRow="selectRow"
148
- @afterQuery="afterQuery"
149
- @columnClick="columnClick"
150
- @gotoUserDetail="gotoUserDetail"
151
- @editButtonStateDataClick="editButtonStateDataClick"
152
- @importExcelOk="importExcelOk"
153
- @rowClick="handleRowClick"
154
- @rowDblClick="handleRowDblClick"
155
- @beforeDataChange="beforeDataChange"
156
- @expand="onExpand">
157
- <template slot="leftButton" slot-scope="{selectedRowKeys, selectedRows}">
158
- <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
159
- </template>
160
- <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
161
- <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
162
- </template>
163
- <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
164
- <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
165
- <a-tooltip title="关闭弹窗" placement="bottom">
166
- <a-button @click="closeTableModal">
167
- <a-icon :style="iconStyle" type="close"/>
168
- </a-button>
169
- </a-tooltip>
170
- </template>
171
- <!-- 底部插槽 -->
172
- <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
173
- <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
174
- </template>
175
- <!-- excel导入说明插槽 -->
176
- <template #importExcelSlot>
177
- <slot name="importExcelSlot"></slot>
178
- </template>
179
- <!-- 固定底部提示(与分页在同一行) -->
180
- <template slot="fixedfooter">
181
- <span v-if="realQueryConfig.popupFooterTip" class="popup-footer-tip">
182
- {{ realQueryConfig.popupFooterTip }}
183
- </span>
184
- </template>
185
- </x-table>
186
- </a-modal>
187
- </template>
188
- <template v-else>
189
- <a-empty>
190
- <span slot="description"> 页面配置不存在,请联系系统管理员</span>
191
- </a-empty>
192
- </template>
193
- </div>
194
- </pane>
195
- <UserInfoDetailManage ref="userInfo" @close="refresh(false)"/>
196
- </splitpanes>
197
- </template>
198
- <script>
199
- import XForm from '@vue2-client/base-client/components/common/XForm'
200
- import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
201
- import XAddReport from '@vue2-client/base-client/components/common/XAddReport'
202
- import XTable from '@vue2-client/base-client/components/common/XTable'
203
- import XTree from '@vue2-client/base-client/components/common/XTree'
204
- import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
205
- import { Splitpanes, Pane } from 'splitpanes'
206
- import 'splitpanes/dist/splitpanes.css'
207
- import {
208
- getConfigByName,
209
- getConfigByLogic,
210
- parseConfig, runLogic, getConfigByNameAsync,
211
- } from '@vue2-client/services/api/common'
212
- import { mapState } from 'vuex'
213
- import XTreePro from '@vue2-client/base-client/components/common/XTree/XTreePro.vue'
214
- import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
215
- import { getRealKeyData } from '@vue2-client/utils/util'
216
- import * as util from '@vue2-client/utils/util'
217
- import UserInfoDetailManage from '@vue2-client/pages/userInfoDetailManage/index.vue'
218
-
219
- export default {
220
- name: 'XFormTable',
221
- components: {
222
- UserInfoDetailManage,
223
- XTreePro,
224
- XTable,
225
- XForm,
226
- XTree,
227
- XAddForm,
228
- XAddReport,
229
- XImportExcel,
230
- Splitpanes,
231
- Pane
232
- },
233
- provide () {
234
- return {
235
- getSelf: () => this,
236
- emitEvent: this.emitEvent.bind(this)
237
- }
238
- },
239
- inject: {
240
- getSelectedId: {
241
- default: () => () => {
242
- console.warn('getSelectedId is not provided.')
243
- return null
244
- },
245
- },
246
- setGlobalData: {
247
- default: () => () => {
248
- console.warn('setGlobalData is not provided.')
249
- return null
250
- },
251
- },
252
- getGlobalData: {
253
- default: () => () => {
254
- console.warn('getGlobalData is not provided.')
255
- return null
256
- },
257
- },
258
- getSelectedData: {
259
- default: () => () => {
260
- console.warn('getSelectedData is not provided.')
261
- return null
262
- },
263
- },
264
- getMixinData: {
265
- default: () => () => {
266
- console.warn('getMixinData is not provided.')
267
- return {}
268
- },
269
- },
270
- getOutEnv: {
271
- default: () => () => {
272
- console.warn('getOutEnv is not provided.')
273
- return {}
274
- },
275
- },
276
- currUser: {
277
- default: () => {
278
- console.warn('currUser is not provided.')
279
- return { id: null, name: 'Guest' }
280
- },
281
- },
282
-
283
- /**
284
- * 祖先组件注入的自定义函数对象
285
- * 此对象包含祖先组件通过provide/inject机制注入的各种自定义函数
286
- * 子组件可以通过this.generalFunction来访问这些函数
287
- * 使用示例:
288
- * - this.generalFunction.handleCustomEvent(data)
289
- * - this.generalFunction.submitForm(formData)
290
- * - this.generalFunction.validateData(data)
291
- */
292
- generalFunction: {
293
- default: () => {
294
- console.warn('generalFunction is not provided.')
295
- return null
296
- }
297
- }
298
- },
299
- data () {
300
- return {
301
- // 加载状态
302
- loading: false,
303
- // 图标样式
304
- iconStyle: {
305
- position: 'relative',
306
- top: '1px'
307
- },
308
- loadError: false,
309
- moveType: false,
310
- // 添加按钮对应的配置名
311
- moveconfig: '',
312
- // 实际查询配置内容
313
- realQueryConfig: {},
314
- toggleIsFormIcon: 'vertical-align-top',
315
- table_selectedRowKeys: [],
316
- table_selectedRows: [],
317
- // 数据只有一页时是否展示分页,true:展示,auto:隐藏
318
- showPagination: true,
319
- isMounted: false,
320
- treeSize: localStorage.getItem('CURD::' + this.xTreeConfigName + '::TreeSize') ?? 25,
321
- // 表格展示模式:default popup
322
- tableShowMode: 'default',
323
- // Modal 弹框显示状态
324
- tableModalVisible: false,
325
- // 弹框模式下待初始化的表格配置
326
- pendingTableInit: null
327
- }
328
- },
329
- computed: {
330
- ...mapState('setting', ['isMobile'])
331
- },
332
- props: {
333
- // 业务名称
334
- title: {
335
- type: String,
336
- default: ''
337
- },
338
- // 外部传入的选中行keys
339
- externalSelectedRowKeys: {
340
- type: Array,
341
- default: () => []
342
- },
343
- // 卡片标题
344
- crudTitle: {
345
- type: String,
346
- default: null
347
- },
348
- // 查询配置文件名
349
- queryParamsName: {
350
- type: String,
351
- default: null
352
- },
353
- // 配置所属命名空间
354
- serviceName: {
355
- type: String,
356
- default: process.env.VUE_APP_SYSTEM_NAME
357
- },
358
- // 查询配置文件Json,用于查询配置生成器的预览
359
- queryParamsJson: {
360
- type: Object,
361
- default: null
362
- },
363
- // xTree 配置
364
- xTreeConfigName: {
365
- type: String,
366
- default: null
367
- },
368
- // 业务逻辑名称, 通过logic获取表单表格配置
369
- logicName: {
370
- type: String,
371
- default: null
372
- },
373
- // 执行logic传递的参数
374
- logicParam: {
375
- type: Object,
376
- default: () => {
377
- }
378
- },
379
- // 固定新增表单
380
- fixedAddForm: {
381
- type: Object,
382
- default: () => {
383
- return {}
384
- }
385
- },
386
- // 固定查询表单(隐藏条件,不显示在表单上)
387
- fixedQueryForm: {
388
- type: Object,
389
- default: () => {
390
- return {}
391
- }
392
- },
393
- // 默认查询表单(显示在表单上的默认值,用户可修改)
394
- defaultQueryForm: {
395
- type: Object,
396
- default: () => {
397
- return {}
398
- }
399
- },
400
- // 预览模式
401
- viewMode: {
402
- type: Boolean,
403
- default: () => {
404
- return false
405
- }
406
- },
407
- // 本地编辑模式
408
- localEditMode: {
409
- type: Boolean,
410
- default: () => {
411
- return false
412
- }
413
- },
414
- // 行选择模式
415
- rowSelectMode: {
416
- type: Boolean,
417
- default: () => {
418
- return false
419
- }
420
- },
421
- // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
422
- allowSelectRowNum: {
423
- type: Number,
424
- default: () => {
425
- return 0
426
- }
427
- },
428
- // 环境
429
- env: {
430
- type: String,
431
- default: () => {
432
- return 'prod'
433
- }
434
- },
435
- // 调用logic获取数据源的追加参数
436
- getDataParams: {
437
- type: Object,
438
- default: undefined
439
- },
440
- // 可以控制组件中导出等按钮的隐藏
441
- buttonState: {
442
- type: Object,
443
- default: undefined
444
- },
445
- // 是否自定义新增按钮的功能
446
- customAdd: {
447
- type: Boolean,
448
- default: false
449
- },
450
- reportQueryName: {
451
- type: String,
452
- default: undefined,
453
- },
454
- // 是否自定义删除按钮的功能
455
- customDelete: {
456
- type: Boolean,
457
- default: false
458
- },
459
- // 是否自定义修改按钮的功能
460
- customEdit: {
461
- type: Boolean,
462
- default: false
463
- },
464
- // 是否自定义增加按钮
465
- customMove: {
466
- type: Boolean,
467
- default: false
468
- },
469
- // 自适应底部边距
470
- extraHeight: {
471
- type: Number,
472
- default: 80
473
- },
474
- // 是否禁用右侧操作行为
475
- disableAction: {
476
- type: Boolean,
477
- default: false
478
- },
479
- // 额外参数,用于控制组件行为
480
- extraParams: {
481
- type: Object,
482
- default: () => {
483
- return {}
484
- }
485
- },
486
- /**
487
- * 额外数据对象
488
- * 类型:Object
489
- * 默认值:返回一个空对象
490
- * 用途:用于传递组件需要的额外数据参数,此参数在点击导入时会将对象传入到自定义前后置插槽业务中
491
- */
492
- extraData: {
493
- type: Object,
494
- default: () => {
495
- return {}
496
- }
497
- },
498
- // 是否使用自定义分页样式
499
- customPagination: {
500
- type: Boolean,
501
- default: false
502
- },
503
- // 是否隐藏顶部功能区域
504
- hiddenFunctionalArea: {
505
- type: Boolean,
506
- default: false
507
- }
508
- },
509
- watch: {
510
- logicParam: {
511
- handler () {
512
- this.initConfig()
513
- },
514
- deep: true
515
- },
516
- queryParamsJson: {
517
- handler () {
518
- this.initConfig()
519
- },
520
- deep: true
521
- },
522
- queryParamsName: {
523
- handler () {
524
- this.initConfig()
525
- }
526
- },
527
- serviceName: {
528
- handler () {
529
- this.initConfig()
530
- }
531
- }
532
- },
533
- methods: {
534
- runLogic,
535
- getRealKeyData,
536
- getConfigByNameAsync,
537
- getConfigByName,
538
- storePaneSize (treeSize) {
539
- localStorage.setItem('CURD::' + this.xTreeConfigName + '::TreeSize', treeSize[0].size)
540
- },
541
- customEvent (func, data) {
542
- this.$emit(func, data)
543
- },
544
- columnClick (key, value, record) {
545
- this.$emit('columnClick', key, value, record)
546
- },
547
- gotoUserDetail (key, value, record) {
548
- this.$refs.userInfo.init(getRealKeyData(record))
549
- },
550
- // 获取主表的数据内容,去掉主表别名
551
- getPrimaryData (rows) {
552
- const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
553
- const prefix = `${alias}_` // 构建前缀
554
- const result = []
555
-
556
- // 遍历 rows 的每一项,提取符合条件的数据
557
- rows.forEach(row => {
558
- const itemResult = {}
559
- Object.keys(row).forEach(key => {
560
- if (key.startsWith(prefix)) {
561
- const newKey = key.slice(prefix.length) // 去掉前缀
562
- itemResult[newKey] = row[key] // 添加到结果对象中
563
- }
564
- })
565
- result.push(itemResult) // 将处理后的项添加到结果数组中
566
- })
567
-
568
- return result // 返回去掉前缀后的对象数组
569
- },
570
-
571
- // 给数据区域添加主表数据,给的数据没有主表别名,放着时添加主表别名
572
- pushPrimaryData (rows) {
573
- const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
574
- const prefix = `${alias}_` // 构建前缀
575
- const result = rows.map(row => {
576
- const itemResult = {}
577
- Object.keys(row).forEach(key => {
578
- itemResult[prefix + key] = row[key] // 复制原始数据
579
- })
580
- return itemResult // 返回添加了主表别名的数据
581
- })
582
- // 把结果添加到数据区
583
- this.getTableData().push(...result)
584
- },
585
-
586
- // 设置固定查询条件,主表别名自动带
587
- setFixedQueryForm (data) {
588
- const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
589
- const prefixedData = {}
590
-
591
- // 为每个键添加主表别名
592
- Object.keys(data).forEach(key => {
593
- prefixedData[`${alias}_${key}`] = data[key]
594
- })
595
-
596
- Object.assign(this.fixedQueryForm, prefixedData)
597
- },
598
-
599
- importExcelOk (data) {
600
- this.$emit('importExcelOk', data)
601
- },
602
- initConfig () {
603
- this.loading = true
604
- this.loadError = false
605
- if (this.queryParamsName) {
606
- this.getConfig()
607
- } else if (this.queryParamsJson) {
608
- this.getConfigBySource()
609
- } else if (this.logicName && this.logicParam) {
610
- this.getColumnJsonByLogic()
611
- } else {
612
- this.loading = false
613
- this.loadError = true
614
- }
615
- },
616
-
617
- getConfig () {
618
- getConfigByName(this.queryParamsName, this.serviceName, (res) => {
619
- if (!res) {
620
- this.loading = false
621
- this.loadError = true
622
- return
623
- }
624
- this.updateComponents(res)
625
- }, this.env === 'dev')
626
- },
627
- getConfigBySource () {
628
- parseConfig(this.queryParamsJson, 'CRUD_FORM', this.serviceName, this.env === 'dev').then(res => {
629
- if (!res) {
630
- this.loading = false
631
- this.loadError = true
632
- return
633
- }
634
- this.updateComponents(res, true)
635
- })
636
- },
637
- getColumnJsonByLogic () {
638
- getConfigByLogic(this.logicName, this.logicParam, this.serviceName, (res) => {
639
- if (!res) {
640
- this.loading = false
641
- this.loadError = true
642
- return
643
- }
644
- this.updateComponents(res, true)
645
- }, this.env === 'dev')
646
- },
647
-
648
- /**
649
- * 更新子组件
650
- * @param res 参数
651
- * @param setQueryParams 是否设置queryParams参数
652
- */
653
- updateComponents (res, setQueryParams) {
654
- this.realQueryConfig = res
655
- // 读取表格展示模式配置
656
- this.tableShowMode = res.tableShowMode || 'default'
657
-
658
- // 弹框模式下,xTable 可能还未渲染,需要特殊处理
659
- const hasRequiredRefs = this.tableShowMode === 'popup'
660
- ? (this.$refs.xForm && this.$refs.xAddForm)
661
- : (this.$refs.xTable && this.$refs.xForm && this.$refs.xAddForm)
662
-
663
- if (hasRequiredRefs) {
664
- // 设置添加按钮对应的配置名
665
- this.moveconfig = res.moveconfig
666
- this.showPagination = res.showPagination === null ? true : res.showPagination
667
- // 是否展示排序按钮控制
668
- if (res.showSortIcon !== null && !res.showSortIcon) {
669
- res.columnJson.forEach(item => {
670
- item.sorter = false
671
- })
672
- }
673
- const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
674
- const initTable = () => {
675
- // 弹框模式下,如果 xTable 还未渲染,保存初始化配置供后续使用
676
- if (this.tableShowMode === 'popup' && !this.$refs.xTable) {
677
- // 保存初始化配置
678
- this.pendingTableInit = {
679
- formItems: res.formJson,
680
- queryParams: setQueryParams ? res : null,
681
- realQueryParams: res,
682
- tableColumns: res.columnJson,
683
- buttonState: Object.assign(res.buttonState, this.buttonState),
684
- title: this.title || res.title,
685
- viewMode: this.viewMode,
686
- localEditMode: localEditMode,
687
- rowSelectMode: this.rowSelectMode,
688
- allowSelectRowNum: this.allowSelectRowNum,
689
- tableSummaryMap: res.tableSummaryMap,
690
- serviceName: this.serviceName,
691
- env: this.env,
692
- form: this.$refs.xForm.form,
693
- summaryUpdate: true,
694
- disableAction: this.disableAction,
695
- extraData: this.extraData,
696
- rowStyleFunction: res.rowStyleFunction,
697
- ...res
698
- }
699
- return
700
- }
701
-
702
- // 初始化 xTable 子组件
703
- if (this.$refs.xTable) {
704
- this.$refs.xTable.init({
705
- formItems: res.formJson,
706
- queryParams: setQueryParams ? res : null,
707
- realQueryParams: res,
708
- tableColumns: res.columnJson,
709
- buttonState: Object.assign(res.buttonState, this.buttonState),
710
- title: this.title || res.title,
711
- viewMode: this.viewMode,
712
- localEditMode: localEditMode,
713
- rowSelectMode: this.rowSelectMode,
714
- allowSelectRowNum: this.allowSelectRowNum,
715
- tableSummaryMap: res.tableSummaryMap,
716
- serviceName: this.serviceName,
717
- env: this.env,
718
- form: this.$refs.xForm.form,
719
- summaryUpdate: true,
720
- disableAction: this.disableAction,
721
- extraData: this.extraData,
722
- rowStyleFunction: res.rowStyleFunction,
723
- ...res
724
- })
725
- if (this.realQueryConfig?.funcData?.pageMounted) {
726
- executeStrFunctionByContext(this, this.realQueryConfig.funcData.pageMounted, [util, runLogic, getConfigByNameAsync])
727
- }
728
- this.$emit('afterTableInit')
729
- }
730
- }
731
- // 初始化 xForm 子组件
732
- if (!localEditMode && !this.rowSelectMode) {
733
- this.$refs.xForm.init({
734
- queryParamsName: this.queryParamsName || 'localConfig',
735
- formItems: res.formJson,
736
- serviceName: this.serviceName,
737
- getDataParams: this.getDataParams,
738
- simpleMode: res.simpleMode,
739
- funcData: res.funcData,
740
- env: this.env,
741
- defaultQueryForm: this.defaultQueryForm
742
- })
743
- } else {
744
- // TODO 此处应删除
745
- initTable()
746
- }
747
- // 初始化 xTable 子组件
748
- // 等待 x-from-item 的 mounted 完成
749
- this.$refs.xForm.$on('itemsMounted', initTable)
750
- }
751
- this.loading = false
752
- },
753
- // 自定义按钮
754
- editButtonStateDataClick (functionName, rows) {
755
- console.log('functionName', functionName)
756
- console.log('rows', rows)
757
- this.$emit(functionName, rows)
758
- },
759
-
760
- /**
761
- * 提交查询表单事件
762
- * @param res 参数
763
- */
764
- onSearchSubmit (res) {
765
- if (res.valid) {
766
- // 如果是弹框模式,先打开 Modal,等待 DOM 更新后再设置查询表单
767
- if (this.tableShowMode === 'popup') {
768
- this.tableModalVisible = true
769
- this.$nextTick(() => {
770
- // 等待 Modal 中的 x-table 渲染完成
771
- if (this.$refs.xTable) {
772
- // 如果有待初始化的配置,先初始化表格
773
- if (this.pendingTableInit) {
774
- this.$refs.xTable.init(this.pendingTableInit)
775
- this.$emit('afterTableInit')
776
- this.pendingTableInit = null
777
- }
778
- // 设置查询表单
779
- this.$refs.xTable.setQueryForm(res.form)
780
- this.$refs.xTable.summaryUpdate = true
781
- }
782
- })
783
- } else {
784
- // 默认模式:直接设置查询表单
785
- this.$refs.xTable.setQueryForm(res.form)
786
- this.$refs.xTable.summaryUpdate = true
787
- }
788
-
789
- // commit
790
- this.$emit('afterSearchSubmit', res)
791
- } else {
792
- return false
793
- }
794
- },
795
-
796
- /**
797
- * 关闭表格弹框
798
- */
799
- closeTableModal () {
800
- this.tableModalVisible = false
801
- },
802
-
803
- active (props) {
804
- let num = false
805
- for (const key in props) {
806
- // eslint-disable-next-line no-prototype-builtins
807
- if (this.$props.hasOwnProperty(key)) {
808
- if (this.$props[key] instanceof Object) {
809
- this.$props[key] = JSON.parse(props[key])
810
- } else {
811
- this.$props[key] = props[key]
812
- }
813
- num = true
814
- }
815
- }
816
- if (num) {
817
- this.initConfig()
818
- }
819
- },
820
- /**
821
- * 提交新增/修改表单后事件
822
- */
823
- onAddOrEditSubmitAfterSubmit (res) {
824
- this.refreshTable(res.businessType === '新增')
825
- // commit
826
- this.$emit('afterSubmit', res)
827
- },
828
- /**
829
- * 表格查询后事件
830
- * @param res 参数
831
- * @param conditionParams 查询条件
832
- */
833
- afterQuery (res, conditionParams) {
834
- this.$emit('afterQuery', res, conditionParams)
835
- },
836
- /**
837
- * 详情按钮事件
838
- * @param record 本条数据
839
- * @param id 数据标识
840
- * @param actionType 操作类型
841
- * @param fun 向上级传递的事件
842
- */
843
- action (record, id, actionType, fun = 'action', index) {
844
- this.$emit('innerXFormTableEmit', fun, record, id, actionType, index, this)
845
- this.$emit(fun, record, id, actionType, index, this)
846
- },
847
- treeOnChecked (checkedKeys, deepNodes, deepKeys) {
848
- this.$emit('treeOnChecked', checkedKeys, deepNodes, deepKeys)
849
- },
850
- treeBtnFuncClick (index, func) {
851
- this.$emit('treeBtnFuncClick', index, func)
852
- },
853
- /**
854
- * 新增按钮事件
855
- */
856
- add () {
857
- if (this.customAdd) {
858
- this.$emit('add')
859
- } else {
860
- if (this.$listeners.curdAddBefore) {
861
- this.$emit('curdAddBefore', this.addFormInit)
862
- } else {
863
- this.addFormInit()
864
- }
865
- }
866
- },
867
- addFormInit () {
868
- const res = this.realQueryConfig
869
- const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
870
- this.$refs.xAddForm.init({
871
- businessType: '新增',
872
- title: this.title || res.title,
873
- isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
874
- configName: this.queryParamsName,
875
- configContent: this.queryParamsJson,
876
- formItems: res.formJson,
877
- viewMode: this.viewMode,
878
- localEditMode: localEditMode,
879
- isKeyHandle: !Boolean(localEditMode),
880
- serviceName: this.serviceName,
881
- fixedAddForm: this.fixedAddForm,
882
- getDataParams: this.getDataParams,
883
- layout: res.xAddFormLayout || 'horizontal',
884
- xAddFormLayoutWidth: res.xAddFormLayoutWidth,
885
- formItemLayout: res.formItemLayout || {},
886
- env: this.env
887
- })
888
- },
889
- /**
890
- * 添加按钮事件
891
- */
892
- move () {
893
- this.moveType = true
894
- this.$nextTick(
895
- () => {
896
- this.$refs.xAddReport.init({
897
- configName: this.moveconfig,
898
- selectedId: this.fixedAddForm.selected_id
899
- })
900
- }
901
- )
902
- },
903
- /**
904
- * 修改按钮事件
905
- * @param modifyModelData 修改表单数据
906
- */
907
- edit (modifyModelData) {
908
- if (this.customEdit) {
909
- this.$emit('edit')
910
- } else {
911
- const res = this.realQueryConfig
912
- const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
913
- this.$refs.xAddForm.init({
914
- businessType: '修改',
915
- title: this.title || res.title,
916
- isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
917
- configName: this.queryParamsName,
918
- configContent: this.queryParamsJson,
919
- formItems: res.formJson,
920
- viewMode: this.viewMode,
921
- localEditMode: localEditMode,
922
- isKeyHandle: !Boolean(localEditMode),
923
- serviceName: this.serviceName,
924
- fixedAddForm: this.fixedAddForm,
925
- getDataParams: this.getDataParams,
926
- modifyModelData: modifyModelData,
927
- layout: res.xAddFormLayout || 'horizontal',
928
- env: this.env
929
- })
930
- }
931
- },
932
- /**
933
- * 删除按钮事件
934
- */
935
- del (keys, callback) {
936
- if (this.customDelete) {
937
- this.$emit('del', keys, callback)
938
- }
939
- },
940
- /**
941
- * 删除后事件
942
- * @param res
943
- */
944
- afterDelete (res) {
945
- this.$emit('afterDelete', res)
946
- },
947
- /**
948
- * 行选择事件
949
- * @param row 选中行
950
- */
951
- rowChoose (row) {
952
- this.$emit('rowChoose', row)
953
- },
954
- /**
955
- * 本地编辑模式下校验表格并同步本地数据
956
- * @param currRow 当前行
957
- * @param defaultAppendRowData 默认追加的行数据
958
- */
959
- validateTableAndSyncData (currRow, defaultAppendRowData) {
960
- this.$refs.xTable.validateTableAndSyncData(currRow, defaultAppendRowData)
961
- },
962
- /**
963
- * 更多条件是否展示
964
- */
965
- toggleAdvanced () {
966
- this.$refs.xTable.setScrollYHeight({})
967
- },
968
- /**
969
- * 查询表单部分显示/隐藏切换
970
- */
971
- toggleIsFormShow () {
972
- this.toggleIsFormIcon = this.toggleIsFormIcon === 'vertical-align-top' ? 'vertical-align-bottom' : 'vertical-align-top'
973
- this.$refs.xForm.toggleVisible()
974
- this.$refs.xTable.setScrollYHeight({})
975
- },
976
- /**
977
- * 选择列事件
978
- * @param selectedRowKeys 选中列Key集合
979
- * @param selectedRows 选中列
980
- */
981
- selectRow (selectedRowKeys, selectedRows) {
982
- this.table_selectedRowKeys = selectedRowKeys
983
- this.table_selectedRows = selectedRows
984
- this.$emit('selectRow', selectedRowKeys, selectedRows)
985
- },
986
- /**
987
- * 清除勾选数据
988
- */
989
- clearRowKeys () {
990
- this.$refs.xTable.clearRowKeys()
991
- },
992
- /**
993
- * 刷新表格
994
- * @param toFirstPage 是否到第一页
995
- */
996
- refreshTable (toFirstPage = true) {
997
- this.$refs.xTable.refresh(toFirstPage)
998
- },
999
- /**
1000
- * 刷新表格
1001
- * @param toFirstPage 是否到第一页
1002
- */
1003
- refresh (toFirstPage = true) {
1004
- this.$refs.xTable.refresh(toFirstPage)
1005
- },
1006
- /**
1007
- * 获取表格数据
1008
- */
1009
- getTableData () {
1010
- return this.$refs.xTable.getTableData()
1011
- },
1012
- // 在行编辑等情况下,让界面生效
1013
- update () {
1014
- this.getTableData().push(...[])
1015
- },
1016
-
1017
- /**
1018
- * 设置表格数据
1019
- */
1020
- setTableData (data) {
1021
- this.$refs.xTable.setTableData(data)
1022
- },
1023
- /**
1024
- * 表单本地提交
1025
- */
1026
- onLocalSubmit (res, callback) {
1027
- const form = res.realForm
1028
- if (res.businessType === '新增') {
1029
- this.$refs.xTable.appendLocalData(form)
1030
- } else {
1031
- this.$refs.xTable.modifyLocalData(form['序号'], form)
1032
- }
1033
- this.$message.success(res.businessType + '成功!')
1034
- this.onAddOrEditSubmitAfterSubmit(res, callback)
1035
- if (callback) {
1036
- callback()
1037
- }
1038
- },
1039
- emitFunc (func, ...args) {
1040
- this.$emit(func, ...args)
1041
- this.$emit('getEmitFuncData', func, ...args)
1042
- },
1043
- // 直接转发事件的函数
1044
- emitEvent (event, ...args) {
1045
- this.$emit(event, ...args)
1046
- },
1047
- // 添加处理 rowClick 的方法
1048
- handleRowClick (record) {
1049
- this.$emit('rowClick', record)
1050
- },
1051
- handleRowDblClick (record) {
1052
- this.$emit('rowDblClick', record)
1053
- },
1054
- beforeDataChange (record) {
1055
- this.$emit('beforeDataChange', record)
1056
- },
1057
- onExpand (expanded, record) {
1058
- this.$emit('expand', expanded, record)
1059
- }
1060
- },
1061
- action: {
1062
- /**
1063
- * 实现doAction方法
1064
- */
1065
- doAction (actionType, args, data) {
1066
- switch (actionType) {
1067
- case 'refreshTable':
1068
- for (const item in args) {
1069
- console.log('item', item)
1070
- }
1071
- break
1072
- default:
1073
- break
1074
- }
1075
- }
1076
- },
1077
- mounted () {
1078
- if (!this.isMounted) {
1079
- // 防止多次调用
1080
- // 不知道为啥他会执行两次 mounted 暂时处理方式
1081
- this.initConfig()
1082
- this.isMounted = true
1083
- }
1084
- if (this.getSelectedData && typeof this.getSelectedData === 'function') {
1085
- const selectedId = this.getSelectedData()
1086
- if (!selectedId) {
1087
- return
1088
- }
1089
- if (typeof selectedId === 'object') {
1090
- const data = JSON.parse(JSON.stringify(selectedId))
1091
- if (data.selectedId) {
1092
- data.selected_id = data.selectedId
1093
- delete data.selectedId
1094
- }
1095
- Object.assign(this.fixedAddForm, data)
1096
- Object.assign(this.fixedQueryForm, data)
1097
- } else {
1098
- Object.assign(this.fixedAddForm, { selected_id: selectedId })
1099
- Object.assign(this.fixedQueryForm, { selected_id: selectedId })
1100
- }
1101
- }
1102
- }
1103
- }
1104
- </script>
1105
- <style lang="less" scoped>
1106
- .crud_title {
1107
- height: 32px;
1108
- font-size: 16px;
1109
- font-weight: 500;
1110
- color: #000000d9;
1111
- line-height: 32px;
1112
- margin-bottom: 12px;
1113
- }
1114
- // 表格行样式类型
1115
- .ant-table-tbody {
1116
- // 成功样式 - 绿色 (#52c41a)
1117
- .ant-table-row-success {
1118
- background-color: rgba(82, 196, 26, 0.2);
1119
-
1120
- &:hover {
1121
- background-color: rgba(82, 196, 26, 0.3) !important;
1122
-
1123
- td {
1124
- background-color: transparent;
1125
- }
1126
- }
1127
-
1128
- // 选中状态
1129
- &.ant-table-row-selected {
1130
- background-color: rgba(82, 196, 26, 0.4);
1131
-
1132
- td {
1133
- background-color: transparent;
1134
- }
1135
- }
1136
-
1137
- td {
1138
- background-color: transparent;
1139
- }
1140
- }
1141
-
1142
- // 警告样式 - 黄色 (#faad14)
1143
- .ant-table-row-warning {
1144
- background-color: rgba(250, 173, 20, 0.1) ;
1145
-
1146
- &:hover {
1147
- background-color: rgba(250, 173, 20, 0.15) ;
1148
-
1149
- td {
1150
- background-color: transparent ;
1151
- }
1152
- }
1153
-
1154
- // 选中状态
1155
- &.ant-table-row-selected {
1156
- background-color: rgba(250, 173, 20, 0.2);
1157
-
1158
- td {
1159
- background-color: transparent;
1160
- }
1161
- }
1162
-
1163
- td {
1164
- background-color: transparent ;
1165
- }
1166
- }
1167
-
1168
- // 错误样式 - 红色 (#f5222f)
1169
- .ant-table-row-error {
1170
- background-color: rgba(245, 34, 47, 0.1) ;
1171
-
1172
- &:hover {
1173
- background-color: rgba(245, 34, 47, 0.15) ;
1174
-
1175
- td {
1176
- background-color: transparent ;
1177
- }
1178
- }
1179
-
1180
- // 选中状态
1181
- &.ant-table-row-selected {
1182
- background-color: rgba(245, 34, 47, 0.2) ;
1183
-
1184
- td {
1185
- background-color: transparent ;
1186
- }
1187
- }
1188
-
1189
- td {
1190
- background-color: transparent ;
1191
- }
1192
- }
1193
-
1194
- // 魔法样式 - 紫色
1195
- .ant-table-row-magic {
1196
- background-color: rgba(114, 46, 209, 0.1) ;
1197
-
1198
- &:hover {
1199
- background-color: rgba(114, 46, 209, 0.15) ;
1200
-
1201
- td {
1202
- background-color: transparent ;
1203
- }
1204
- }
1205
-
1206
- // 选中状态
1207
- &.ant-table-row-selected {
1208
- background-color: rgba(114, 46, 209, 0.2) ;
1209
-
1210
- td {
1211
- background-color: transparent ;
1212
- }
1213
- }
1214
-
1215
- td {
1216
- background-color: transparent ;
1217
- }
1218
- }
1219
-
1220
- // 默认选中状态(没有特殊行样式时)
1221
- .ant-table-row-selected:not(.ant-table-row-success):not(.ant-table-row-warning):not(.ant-table-row-error):not(.ant-table-row-magic) {
1222
- background-color: rgba(24, 144, 255, 0.1) ;
1223
- }
1224
- }
1225
- </style>
1226
- <style>
1227
-
1228
- .splitpanes.default-theme .splitpanes__splitter {
1229
- border: 0;
1230
- width: 1rem;
1231
- position: relative;
1232
-
1233
- &:before {
1234
- content: '';
1235
- position: absolute;
1236
- left: 50%;
1237
- top: 50%;
1238
- transform: translate(-50%, -50%);
1239
- width: 2px;
1240
- height: 30px;
1241
- border-radius: 1px;
1242
- }
1243
- }
1244
-
1245
- .splitpanes.default-theme .splitpanes__pane {
1246
- overflow: visible;
1247
- background-color: transparent;
1248
- }
1249
-
1250
- /* 弹框底部提示样式(与分页在同一行) */
1251
- .popup-footer-tip {
1252
- color: rgba(0, 0, 0, 0.45);
1253
- font-size: 12px;
1254
- line-height: 1.5;
1255
- }
1256
-
1257
- </style>
1
+ <template>
2
+ <splitpanes
3
+ class="default-theme"
4
+ :horizontal="false"
5
+ @resized="storePaneSize"
6
+ >
7
+ <pane
8
+ :size="treeSize"
9
+ :min-size="15"
10
+ :max-size="40"
11
+ v-if="xTreeConfigName">
12
+ <x-tree-pro
13
+ :config-name="xTreeConfigName"
14
+ :env="env"
15
+ @action="action"
16
+ @btnFuncClick="treeBtnFuncClick"
17
+ @treeOnChecked="treeOnChecked"
18
+ ref="xtree"
19
+ ></x-tree-pro>
20
+ </pane>
21
+ <pane
22
+ :size="100 - treeSize"
23
+ >
24
+ <a-skeleton :loading="loading" :paragraph="{ rows: 4 }"/>
25
+ <a-row style="height: 12px" v-if="xTreeConfigName"></a-row>
26
+ <div v-show="!loading">
27
+ <template v-if="!loadError">
28
+ <x-add-form
29
+ ref="xAddForm"
30
+ @onLocalSubmit="onLocalSubmit"
31
+ @x-form-item-emit-func="emitFunc"
32
+ @afterSubmit="onAddOrEditSubmitAfterSubmit"
33
+ >
34
+ <template slot="groupFormItems" slot-scope="{form, model, rules, modifyModelData}">
35
+ <slot
36
+ name="groupFormItems"
37
+ :form="form"
38
+ :model="model"
39
+ :rules="rules"
40
+ :modifyModelData="modifyModelData"></slot>
41
+ </template>
42
+ </x-add-form>
43
+ <x-add-report
44
+ v-if="moveType"
45
+ ref="xAddReport"
46
+ >
47
+ </x-add-report>
48
+ <div v-if="crudTitle" class="crud_title">
49
+ {{ crudTitle }}
50
+ </div>
51
+ <x-form
52
+ ref="xForm"
53
+ @x-form-item-emit-func="emitFunc"
54
+ @toggleAdvanced="toggleAdvanced"
55
+ @onSubmit="onSearchSubmit">
56
+ <slot name="formBtnExpand"></slot>
57
+ </x-form>
58
+ <!-- 默认模式:直接展示表格 -->
59
+ <x-table
60
+ v-if="tableShowMode === 'default'"
61
+ ref="xTable"
62
+ :fixedQueryForm="fixedQueryForm"
63
+ :queryParamsName="queryParamsName"
64
+ :query-params-json="queryParamsJson"
65
+ :show-pagination="showPagination"
66
+ :customDelete="customDelete"
67
+ :extraHeight="extraHeight"
68
+ :serviceName="serviceName"
69
+ :pageMaxSize="realQueryConfig.queryPagesSize"
70
+ :externalSelectedRowKeys="externalSelectedRowKeys"
71
+ :customPagination="customPagination"
72
+ :hiddenFunctionalArea="hiddenFunctionalArea"
73
+ @x-form-item-emit-func="emitFunc"
74
+ @add="add"
75
+ @move="move"
76
+ @edit="edit"
77
+ @del="del"
78
+ @rowChoose="rowChoose"
79
+ @customEvent="customEvent"
80
+ @afterDelete="afterDelete"
81
+ @action="action"
82
+ @selectRow="selectRow"
83
+ @afterQuery="afterQuery"
84
+ @columnClick="columnClick"
85
+ @gotoUserDetail="gotoUserDetail"
86
+ @editButtonStateDataClick="editButtonStateDataClick"
87
+ @importExcelOk="importExcelOk"
88
+ @rowClick="handleRowClick"
89
+ @rowDblClick="handleRowDblClick"
90
+ @beforeDataChange="beforeDataChange"
91
+ @expand="onExpand">
92
+ <template slot="leftButton" slot-scope="{selectedRowKeys, selectedRows}">
93
+ <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
94
+ </template>
95
+ <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
96
+ <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
97
+ </template>
98
+ <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
99
+ <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
100
+ <a-tooltip title="收起查询条件" placement="bottom">
101
+ <a-button @click="toggleIsFormShow">
102
+ <a-icon :style="iconStyle" :type="toggleIsFormIcon"/>
103
+ </a-button>
104
+ </a-tooltip>
105
+ </template>
106
+ <!-- 底部插槽 -->
107
+ <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
108
+ <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
109
+ </template>
110
+ <!-- excel导入说明插槽 -->
111
+ <template #importExcelSlot>
112
+ <slot name="importExcelSlot"></slot>
113
+ </template>
114
+ </x-table>
115
+ <!-- 弹框模式:在 Modal 中展示表格 -->
116
+ <a-modal
117
+ v-if="tableShowMode === 'popup'"
118
+ v-model="tableModalVisible"
119
+ :title="realQueryConfig.popupTitle || title || realQueryConfig.title || '数据列表'"
120
+ width="75%"
121
+ :bodyStyle="{ padding: '12px' }"
122
+ :footer="null"
123
+ :destroyOnClose="false"
124
+ :z-index="1005"
125
+ >
126
+ <x-table
127
+ ref="xTable"
128
+ :fixedQueryForm="fixedQueryForm"
129
+ :queryParamsName="queryParamsName"
130
+ :query-params-json="queryParamsJson"
131
+ :show-pagination="showPagination"
132
+ :customDelete="customDelete"
133
+ :extraHeight="extraHeight"
134
+ :serviceName="serviceName"
135
+ :pageMaxSize="realQueryConfig.queryPagesSize"
136
+ :externalSelectedRowKeys="externalSelectedRowKeys"
137
+ :customPagination="customPagination"
138
+ :hiddenFunctionalArea="hiddenFunctionalArea"
139
+ @x-form-item-emit-func="emitFunc"
140
+ @add="add"
141
+ @move="move"
142
+ @edit="edit"
143
+ @del="del"
144
+ @rowChoose="rowChoose"
145
+ @customEvent="customEvent"
146
+ @afterDelete="afterDelete"
147
+ @action="action"
148
+ @selectRow="selectRow"
149
+ @afterQuery="afterQuery"
150
+ @columnClick="columnClick"
151
+ @gotoUserDetail="gotoUserDetail"
152
+ @editButtonStateDataClick="editButtonStateDataClick"
153
+ @importExcelOk="importExcelOk"
154
+ @rowClick="handleRowClick"
155
+ @rowDblClick="handleRowDblClick"
156
+ @beforeDataChange="beforeDataChange"
157
+ @expand="onExpand">
158
+ <template slot="leftButton" slot-scope="{selectedRowKeys, selectedRows}">
159
+ <slot name="leftButton" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
160
+ </template>
161
+ <template slot="button" slot-scope="{selectedRowKeys, selectedRows}">
162
+ <slot name="button" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
163
+ </template>
164
+ <template slot="rightBtnExpand" slot-scope="{selectedRowKeys, selectedRows}">
165
+ <slot name="rightBtnExpand" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
166
+ <a-tooltip title="关闭弹窗" placement="bottom">
167
+ <a-button @click="closeTableModal">
168
+ <a-icon :style="iconStyle" type="close"/>
169
+ </a-button>
170
+ </a-tooltip>
171
+ </template>
172
+ <!-- 底部插槽 -->
173
+ <template slot="footer" slot-scope="{selectedRowKeys, selectedRows}">
174
+ <slot name="footer" :selectedRowKeys="selectedRowKeys" :selectedRows="selectedRows"></slot>
175
+ </template>
176
+ <!-- excel导入说明插槽 -->
177
+ <template #importExcelSlot>
178
+ <slot name="importExcelSlot"></slot>
179
+ </template>
180
+ <!-- 固定底部提示(与分页在同一行) -->
181
+ <template slot="fixedfooter">
182
+ <span v-if="realQueryConfig.popupFooterTip" class="popup-footer-tip">
183
+ {{ realQueryConfig.popupFooterTip }}
184
+ </span>
185
+ </template>
186
+ </x-table>
187
+ </a-modal>
188
+ </template>
189
+ <template v-else>
190
+ <a-empty>
191
+ <span slot="description"> 页面配置不存在,请联系系统管理员</span>
192
+ </a-empty>
193
+ </template>
194
+ </div>
195
+ </pane>
196
+ <UserInfoDetailManage ref="userInfo" @close="refresh(false)"/>
197
+ </splitpanes>
198
+ </template>
199
+ <script>
200
+ import XForm from '@vue2-client/base-client/components/common/XForm'
201
+ import XAddForm from '@vue2-client/base-client/components/common/XAddForm'
202
+ import XAddReport from '@vue2-client/base-client/components/common/XAddReport'
203
+ import XTable from '@vue2-client/base-client/components/common/XTable'
204
+ import XTree from '@vue2-client/base-client/components/common/XTree'
205
+ import XImportExcel from '@vue2-client/base-client/components/common/XImportExcel'
206
+ import { Splitpanes, Pane } from 'splitpanes'
207
+ import 'splitpanes/dist/splitpanes.css'
208
+ import {
209
+ getConfigByName,
210
+ getConfigByLogic,
211
+ parseConfig, runLogic, getConfigByNameAsync,
212
+ } from '@vue2-client/services/api/common'
213
+ import { mapState } from 'vuex'
214
+ import XTreePro from '@vue2-client/base-client/components/common/XTree/XTreePro.vue'
215
+ import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
216
+ import { getRealKeyData } from '@vue2-client/utils/util'
217
+ import * as util from '@vue2-client/utils/util'
218
+ import UserInfoDetailManage from '@vue2-client/pages/userInfoDetailManage/index.vue'
219
+
220
+ export default {
221
+ name: 'XFormTable',
222
+ components: {
223
+ UserInfoDetailManage,
224
+ XTreePro,
225
+ XTable,
226
+ XForm,
227
+ XTree,
228
+ XAddForm,
229
+ XAddReport,
230
+ XImportExcel,
231
+ Splitpanes,
232
+ Pane
233
+ },
234
+ provide () {
235
+ return {
236
+ getSelf: () => this,
237
+ emitEvent: this.emitEvent.bind(this)
238
+ }
239
+ },
240
+ inject: {
241
+ getSelectedId: {
242
+ default: () => () => {
243
+ console.warn('getSelectedId is not provided.')
244
+ return null
245
+ },
246
+ },
247
+ setGlobalData: {
248
+ default: () => () => {
249
+ console.warn('setGlobalData is not provided.')
250
+ return null
251
+ },
252
+ },
253
+ getGlobalData: {
254
+ default: () => () => {
255
+ console.warn('getGlobalData is not provided.')
256
+ return null
257
+ },
258
+ },
259
+ getSelectedData: {
260
+ default: () => () => {
261
+ console.warn('getSelectedData is not provided.')
262
+ return null
263
+ },
264
+ },
265
+ getMixinData: {
266
+ default: () => () => {
267
+ console.warn('getMixinData is not provided.')
268
+ return {}
269
+ },
270
+ },
271
+ getOutEnv: {
272
+ default: () => () => {
273
+ console.warn('getOutEnv is not provided.')
274
+ return {}
275
+ },
276
+ },
277
+ currUser: {
278
+ default: () => {
279
+ console.warn('currUser is not provided.')
280
+ return { id: null, name: 'Guest' }
281
+ },
282
+ },
283
+
284
+ /**
285
+ * 祖先组件注入的自定义函数对象
286
+ * 此对象包含祖先组件通过provide/inject机制注入的各种自定义函数
287
+ * 子组件可以通过this.generalFunction来访问这些函数
288
+ * 使用示例:
289
+ * - this.generalFunction.handleCustomEvent(data)
290
+ * - this.generalFunction.submitForm(formData)
291
+ * - this.generalFunction.validateData(data)
292
+ */
293
+ generalFunction: {
294
+ default: () => {
295
+ console.warn('generalFunction is not provided.')
296
+ return null
297
+ }
298
+ }
299
+ },
300
+ data () {
301
+ return {
302
+ // 加载状态
303
+ loading: false,
304
+ // 图标样式
305
+ iconStyle: {
306
+ position: 'relative',
307
+ top: '1px'
308
+ },
309
+ loadError: false,
310
+ moveType: false,
311
+ // 添加按钮对应的配置名
312
+ moveconfig: '',
313
+ // 实际查询配置内容
314
+ realQueryConfig: {},
315
+ toggleIsFormIcon: 'vertical-align-top',
316
+ table_selectedRowKeys: [],
317
+ table_selectedRows: [],
318
+ // 数据只有一页时是否展示分页,true:展示,auto:隐藏
319
+ showPagination: true,
320
+ isMounted: false,
321
+ treeSize: localStorage.getItem('CURD::' + this.xTreeConfigName + '::TreeSize') ?? 25,
322
+ // 表格展示模式:default 或 popup
323
+ tableShowMode: 'default',
324
+ // Modal 弹框显示状态
325
+ tableModalVisible: false,
326
+ // 弹框模式下待初始化的表格配置
327
+ pendingTableInit: null
328
+ }
329
+ },
330
+ computed: {
331
+ ...mapState('setting', ['isMobile'])
332
+ },
333
+ props: {
334
+ // 业务名称
335
+ title: {
336
+ type: String,
337
+ default: ''
338
+ },
339
+ // 外部传入的选中行keys
340
+ externalSelectedRowKeys: {
341
+ type: Array,
342
+ default: () => []
343
+ },
344
+ // 卡片标题
345
+ crudTitle: {
346
+ type: String,
347
+ default: null
348
+ },
349
+ // 查询配置文件名
350
+ queryParamsName: {
351
+ type: String,
352
+ default: null
353
+ },
354
+ // 配置所属命名空间
355
+ serviceName: {
356
+ type: String,
357
+ default: process.env.VUE_APP_SYSTEM_NAME
358
+ },
359
+ // 查询配置文件Json,用于查询配置生成器的预览
360
+ queryParamsJson: {
361
+ type: Object,
362
+ default: null
363
+ },
364
+ // xTree 配置
365
+ xTreeConfigName: {
366
+ type: String,
367
+ default: null
368
+ },
369
+ // 业务逻辑名称, 通过logic获取表单表格配置
370
+ logicName: {
371
+ type: String,
372
+ default: null
373
+ },
374
+ // 执行logic传递的参数
375
+ logicParam: {
376
+ type: Object,
377
+ default: () => {
378
+ }
379
+ },
380
+ // 固定新增表单
381
+ fixedAddForm: {
382
+ type: Object,
383
+ default: () => {
384
+ return {}
385
+ }
386
+ },
387
+ // 固定查询表单(隐藏条件,不显示在表单上)
388
+ fixedQueryForm: {
389
+ type: Object,
390
+ default: () => {
391
+ return {}
392
+ }
393
+ },
394
+ // 默认查询表单(显示在表单上的默认值,用户可修改)
395
+ defaultQueryForm: {
396
+ type: Object,
397
+ default: () => {
398
+ return {}
399
+ }
400
+ },
401
+ // 预览模式
402
+ viewMode: {
403
+ type: Boolean,
404
+ default: () => {
405
+ return false
406
+ }
407
+ },
408
+ // 本地编辑模式
409
+ localEditMode: {
410
+ type: Boolean,
411
+ default: () => {
412
+ return false
413
+ }
414
+ },
415
+ // 行选择模式
416
+ rowSelectMode: {
417
+ type: Boolean,
418
+ default: () => {
419
+ return false
420
+ }
421
+ },
422
+ // 行选择模式-允许选中行数量,0:任意数量行,大于0:指定值数量的行
423
+ allowSelectRowNum: {
424
+ type: Number,
425
+ default: () => {
426
+ return 0
427
+ }
428
+ },
429
+ // 环境
430
+ env: {
431
+ type: String,
432
+ default: () => {
433
+ return 'prod'
434
+ }
435
+ },
436
+ // 调用logic获取数据源的追加参数
437
+ getDataParams: {
438
+ type: Object,
439
+ default: undefined
440
+ },
441
+ // 可以控制组件中导出等按钮的隐藏
442
+ buttonState: {
443
+ type: Object,
444
+ default: undefined
445
+ },
446
+ // 是否自定义新增按钮的功能
447
+ customAdd: {
448
+ type: Boolean,
449
+ default: false
450
+ },
451
+ reportQueryName: {
452
+ type: String,
453
+ default: undefined,
454
+ },
455
+ // 是否自定义删除按钮的功能
456
+ customDelete: {
457
+ type: Boolean,
458
+ default: false
459
+ },
460
+ // 是否自定义修改按钮的功能
461
+ customEdit: {
462
+ type: Boolean,
463
+ default: false
464
+ },
465
+ // 是否自定义增加按钮
466
+ customMove: {
467
+ type: Boolean,
468
+ default: false
469
+ },
470
+ // 自适应底部边距
471
+ extraHeight: {
472
+ type: Number,
473
+ default: 80
474
+ },
475
+ // 是否禁用右侧操作行为
476
+ disableAction: {
477
+ type: Boolean,
478
+ default: false
479
+ },
480
+ // 额外参数,用于控制组件行为
481
+ extraParams: {
482
+ type: Object,
483
+ default: () => {
484
+ return {}
485
+ }
486
+ },
487
+ /**
488
+ * 额外数据对象
489
+ * 类型:Object
490
+ * 默认值:返回一个空对象
491
+ * 用途:用于传递组件需要的额外数据参数,此参数在点击导入时会将对象传入到自定义前后置插槽业务中
492
+ */
493
+ extraData: {
494
+ type: Object,
495
+ default: () => {
496
+ return {}
497
+ }
498
+ },
499
+ // 是否使用自定义分页样式
500
+ customPagination: {
501
+ type: Boolean,
502
+ default: false
503
+ },
504
+ // 是否隐藏顶部功能区域
505
+ hiddenFunctionalArea: {
506
+ type: Boolean,
507
+ default: false
508
+ }
509
+ },
510
+ watch: {
511
+ logicParam: {
512
+ handler () {
513
+ this.initConfig()
514
+ },
515
+ deep: true
516
+ },
517
+ queryParamsJson: {
518
+ handler () {
519
+ this.initConfig()
520
+ },
521
+ deep: true
522
+ },
523
+ queryParamsName: {
524
+ handler () {
525
+ this.initConfig()
526
+ }
527
+ },
528
+ serviceName: {
529
+ handler () {
530
+ this.initConfig()
531
+ }
532
+ }
533
+ },
534
+ methods: {
535
+ runLogic,
536
+ getRealKeyData,
537
+ getConfigByNameAsync,
538
+ getConfigByName,
539
+ storePaneSize (treeSize) {
540
+ localStorage.setItem('CURD::' + this.xTreeConfigName + '::TreeSize', treeSize[0].size)
541
+ },
542
+ customEvent (func, data) {
543
+ this.$emit(func, data)
544
+ },
545
+ columnClick (key, value, record) {
546
+ this.$emit('columnClick', key, value, record)
547
+ },
548
+ gotoUserDetail (key, value, record) {
549
+ this.$refs.userInfo.init(getRealKeyData(record))
550
+ },
551
+ // 获取主表的数据内容,去掉主表别名
552
+ getPrimaryData (rows) {
553
+ const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
554
+ const prefix = `${alias}_` // 构建前缀
555
+ const result = []
556
+
557
+ // 遍历 rows 的每一项,提取符合条件的数据
558
+ rows.forEach(row => {
559
+ const itemResult = {}
560
+ Object.keys(row).forEach(key => {
561
+ if (key.startsWith(prefix)) {
562
+ const newKey = key.slice(prefix.length) // 去掉前缀
563
+ itemResult[newKey] = row[key] // 添加到结果对象中
564
+ }
565
+ })
566
+ result.push(itemResult) // 将处理后的项添加到结果数组中
567
+ })
568
+
569
+ return result // 返回去掉前缀后的对象数组
570
+ },
571
+
572
+ // 给数据区域添加主表数据,给的数据没有主表别名,放着时添加主表别名
573
+ pushPrimaryData (rows) {
574
+ const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
575
+ const prefix = `${alias}_` // 构建前缀
576
+ const result = rows.map(row => {
577
+ const itemResult = {}
578
+ Object.keys(row).forEach(key => {
579
+ itemResult[prefix + key] = row[key] // 复制原始数据
580
+ })
581
+ return itemResult // 返回添加了主表别名的数据
582
+ })
583
+ // 把结果添加到数据区
584
+ this.getTableData().push(...result)
585
+ },
586
+
587
+ // 设置固定查询条件,主表别名自动带
588
+ setFixedQueryForm (data) {
589
+ const alias = this.realQueryConfig.tableAliasName // 获取主表的别名
590
+ const prefixedData = {}
591
+
592
+ // 为每个键添加主表别名
593
+ Object.keys(data).forEach(key => {
594
+ prefixedData[`${alias}_${key}`] = data[key]
595
+ })
596
+
597
+ Object.assign(this.fixedQueryForm, prefixedData)
598
+ },
599
+
600
+ importExcelOk (data) {
601
+ this.$emit('importExcelOk', data)
602
+ },
603
+ initConfig () {
604
+ this.loading = true
605
+ this.loadError = false
606
+ if (this.queryParamsName) {
607
+ this.getConfig()
608
+ } else if (this.queryParamsJson) {
609
+ this.getConfigBySource()
610
+ } else if (this.logicName && this.logicParam) {
611
+ this.getColumnJsonByLogic()
612
+ } else {
613
+ this.loading = false
614
+ this.loadError = true
615
+ }
616
+ },
617
+
618
+ getConfig () {
619
+ getConfigByName(this.queryParamsName, this.serviceName, (res) => {
620
+ if (!res) {
621
+ this.loading = false
622
+ this.loadError = true
623
+ return
624
+ }
625
+ this.updateComponents(res)
626
+ }, this.env === 'dev')
627
+ },
628
+ getConfigBySource () {
629
+ parseConfig(this.queryParamsJson, 'CRUD_FORM', this.serviceName, this.env === 'dev').then(res => {
630
+ if (!res) {
631
+ this.loading = false
632
+ this.loadError = true
633
+ return
634
+ }
635
+ this.updateComponents(res, true)
636
+ })
637
+ },
638
+ getColumnJsonByLogic () {
639
+ getConfigByLogic(this.logicName, this.logicParam, this.serviceName, (res) => {
640
+ if (!res) {
641
+ this.loading = false
642
+ this.loadError = true
643
+ return
644
+ }
645
+ this.updateComponents(res, true)
646
+ }, this.env === 'dev')
647
+ },
648
+
649
+ /**
650
+ * 更新子组件
651
+ * @param res 参数
652
+ * @param setQueryParams 是否设置queryParams参数
653
+ */
654
+ updateComponents (res, setQueryParams) {
655
+ this.realQueryConfig = res
656
+ // 读取表格展示模式配置
657
+ this.tableShowMode = res.tableShowMode || 'default'
658
+
659
+ // 弹框模式下,xTable 可能还未渲染,需要特殊处理
660
+ const hasRequiredRefs = this.tableShowMode === 'popup'
661
+ ? (this.$refs.xForm && this.$refs.xAddForm)
662
+ : (this.$refs.xTable && this.$refs.xForm && this.$refs.xAddForm)
663
+
664
+ if (hasRequiredRefs) {
665
+ // 设置添加按钮对应的配置名
666
+ this.moveconfig = res.moveconfig
667
+ this.showPagination = res.showPagination === null ? true : res.showPagination
668
+ // 是否展示排序按钮控制
669
+ if (res.showSortIcon !== null && !res.showSortIcon) {
670
+ res.columnJson.forEach(item => {
671
+ item.sorter = false
672
+ })
673
+ }
674
+ const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
675
+ const initTable = () => {
676
+ // 弹框模式下,如果 xTable 还未渲染,保存初始化配置供后续使用
677
+ if (this.tableShowMode === 'popup' && !this.$refs.xTable) {
678
+ // 保存初始化配置
679
+ this.pendingTableInit = {
680
+ formItems: res.formJson,
681
+ queryParams: setQueryParams ? res : null,
682
+ realQueryParams: res,
683
+ tableColumns: res.columnJson,
684
+ buttonState: Object.assign(res.buttonState, this.buttonState),
685
+ title: this.title || res.title,
686
+ viewMode: this.viewMode,
687
+ localEditMode: localEditMode,
688
+ rowSelectMode: this.rowSelectMode,
689
+ allowSelectRowNum: this.allowSelectRowNum,
690
+ tableSummaryMap: res.tableSummaryMap,
691
+ serviceName: this.serviceName,
692
+ env: this.env,
693
+ form: this.$refs.xForm.form,
694
+ summaryUpdate: true,
695
+ disableAction: this.disableAction,
696
+ extraData: this.extraData,
697
+ rowStyleFunction: res.rowStyleFunction,
698
+ ...res
699
+ }
700
+ return
701
+ }
702
+
703
+ // 初始化 xTable 子组件
704
+ if (this.$refs.xTable) {
705
+ this.$refs.xTable.init({
706
+ formItems: res.formJson,
707
+ queryParams: setQueryParams ? res : null,
708
+ realQueryParams: res,
709
+ tableColumns: res.columnJson,
710
+ buttonState: Object.assign(res.buttonState, this.buttonState),
711
+ title: this.title || res.title,
712
+ viewMode: this.viewMode,
713
+ localEditMode: localEditMode,
714
+ rowSelectMode: this.rowSelectMode,
715
+ allowSelectRowNum: this.allowSelectRowNum,
716
+ tableSummaryMap: res.tableSummaryMap,
717
+ serviceName: this.serviceName,
718
+ env: this.env,
719
+ form: this.$refs.xForm.form,
720
+ summaryUpdate: true,
721
+ disableAction: this.disableAction,
722
+ extraData: this.extraData,
723
+ rowStyleFunction: res.rowStyleFunction,
724
+ ...res
725
+ })
726
+ if (this.realQueryConfig?.funcData?.pageMounted) {
727
+ executeStrFunctionByContext(this, this.realQueryConfig.funcData.pageMounted, [util, runLogic, getConfigByNameAsync])
728
+ }
729
+ this.$emit('afterTableInit')
730
+ }
731
+ }
732
+ // 初始化 xForm 子组件
733
+ if (!localEditMode && !this.rowSelectMode) {
734
+ this.$refs.xForm.init({
735
+ queryParamsName: this.queryParamsName || 'localConfig',
736
+ formItems: res.formJson,
737
+ serviceName: this.serviceName,
738
+ getDataParams: this.getDataParams,
739
+ simpleMode: res.simpleMode,
740
+ funcData: res.funcData,
741
+ env: this.env,
742
+ defaultQueryForm: this.defaultQueryForm
743
+ })
744
+ } else {
745
+ // TODO 此处应删除
746
+ initTable()
747
+ }
748
+ // 初始化 xTable 子组件
749
+ // 等待 x-from-item 的 mounted 完成
750
+ this.$refs.xForm.$on('itemsMounted', initTable)
751
+ }
752
+ this.loading = false
753
+ },
754
+ // 自定义按钮
755
+ editButtonStateDataClick (functionName, rows) {
756
+ console.log('functionName', functionName)
757
+ console.log('rows', rows)
758
+ this.$emit(functionName, rows)
759
+ },
760
+
761
+ /**
762
+ * 提交查询表单事件
763
+ * @param res 参数
764
+ */
765
+ onSearchSubmit (res) {
766
+ if (res.valid) {
767
+ // 如果是弹框模式,先打开 Modal,等待 DOM 更新后再设置查询表单
768
+ if (this.tableShowMode === 'popup') {
769
+ this.tableModalVisible = true
770
+ this.$nextTick(() => {
771
+ // 等待 Modal 中的 x-table 渲染完成
772
+ if (this.$refs.xTable) {
773
+ // 如果有待初始化的配置,先初始化表格
774
+ if (this.pendingTableInit) {
775
+ this.$refs.xTable.init(this.pendingTableInit)
776
+ this.$emit('afterTableInit')
777
+ this.pendingTableInit = null
778
+ }
779
+ // 设置查询表单
780
+ this.$refs.xTable.setQueryForm(res.form)
781
+ this.$refs.xTable.summaryUpdate = true
782
+ }
783
+ })
784
+ } else {
785
+ // 默认模式:直接设置查询表单
786
+ this.$refs.xTable.setQueryForm(res.form)
787
+ this.$refs.xTable.summaryUpdate = true
788
+ }
789
+
790
+ // commit
791
+ this.$emit('afterSearchSubmit', res)
792
+ } else {
793
+ return false
794
+ }
795
+ },
796
+
797
+ /**
798
+ * 关闭表格弹框
799
+ */
800
+ closeTableModal () {
801
+ this.tableModalVisible = false
802
+ },
803
+
804
+ active (props) {
805
+ let num = false
806
+ for (const key in props) {
807
+ // eslint-disable-next-line no-prototype-builtins
808
+ if (this.$props.hasOwnProperty(key)) {
809
+ if (this.$props[key] instanceof Object) {
810
+ this.$props[key] = JSON.parse(props[key])
811
+ } else {
812
+ this.$props[key] = props[key]
813
+ }
814
+ num = true
815
+ }
816
+ }
817
+ if (num) {
818
+ this.initConfig()
819
+ }
820
+ },
821
+ /**
822
+ * 提交新增/修改表单后事件
823
+ */
824
+ onAddOrEditSubmitAfterSubmit (res) {
825
+ this.refreshTable(res.businessType === '新增')
826
+ // commit
827
+ this.$emit('afterSubmit', res)
828
+ },
829
+ /**
830
+ * 表格查询后事件
831
+ * @param res 参数
832
+ * @param conditionParams 查询条件
833
+ */
834
+ afterQuery (res, conditionParams) {
835
+ this.$emit('afterQuery', res, conditionParams)
836
+ },
837
+ /**
838
+ * 详情按钮事件
839
+ * @param record 本条数据
840
+ * @param id 数据标识
841
+ * @param actionType 操作类型
842
+ * @param fun 向上级传递的事件
843
+ */
844
+ action (record, id, actionType, fun = 'action', index) {
845
+ this.$emit('innerXFormTableEmit', fun, record, id, actionType, index, this)
846
+ this.$emit(fun, record, id, actionType, index, this)
847
+ },
848
+ treeOnChecked (checkedKeys, deepNodes, deepKeys) {
849
+ this.$emit('treeOnChecked', checkedKeys, deepNodes, deepKeys)
850
+ },
851
+ treeBtnFuncClick (index, func) {
852
+ this.$emit('treeBtnFuncClick', index, func)
853
+ },
854
+ /**
855
+ * 新增按钮事件
856
+ */
857
+ add () {
858
+ if (this.customAdd) {
859
+ this.$emit('add')
860
+ } else {
861
+ if (this.$listeners.curdAddBefore) {
862
+ this.$emit('curdAddBefore', this.addFormInit)
863
+ } else {
864
+ this.addFormInit()
865
+ }
866
+ }
867
+ },
868
+ addFormInit () {
869
+ const res = this.realQueryConfig
870
+ const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
871
+ this.$refs.xAddForm.init({
872
+ businessType: '新增',
873
+ title: this.title || res.title,
874
+ isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
875
+ configName: this.queryParamsName,
876
+ configContent: this.queryParamsJson,
877
+ formItems: res.formJson,
878
+ viewMode: this.viewMode,
879
+ localEditMode: localEditMode,
880
+ isKeyHandle: !Boolean(localEditMode),
881
+ serviceName: this.serviceName,
882
+ fixedAddForm: this.fixedAddForm,
883
+ getDataParams: this.getDataParams,
884
+ layout: res.xAddFormLayout || 'horizontal',
885
+ xAddFormLayoutWidth: res.xAddFormLayoutWidth,
886
+ formItemLayout: res.formItemLayout || {},
887
+ env: this.env
888
+ })
889
+ },
890
+ /**
891
+ * 添加按钮事件
892
+ */
893
+ move () {
894
+ this.moveType = true
895
+ this.$nextTick(
896
+ () => {
897
+ this.$refs.xAddReport.init({
898
+ configName: this.moveconfig,
899
+ selectedId: this.fixedAddForm.selected_id
900
+ })
901
+ }
902
+ )
903
+ },
904
+ /**
905
+ * 修改按钮事件
906
+ * @param modifyModelData 修改表单数据
907
+ */
908
+ edit (modifyModelData) {
909
+ if (this.customEdit) {
910
+ this.$emit('edit')
911
+ } else {
912
+ const res = this.realQueryConfig
913
+ const localEditMode = !this.localEditMode ? res.localEditMode : this.localEditMode
914
+ this.$refs.xAddForm.init({
915
+ businessType: '修改',
916
+ title: this.title || res.title,
917
+ isShow: !res.buttonState || res.buttonState.add || res.buttonState.edit,
918
+ configName: this.queryParamsName,
919
+ configContent: this.queryParamsJson,
920
+ formItems: res.formJson,
921
+ viewMode: this.viewMode,
922
+ localEditMode: localEditMode,
923
+ isKeyHandle: !Boolean(localEditMode),
924
+ serviceName: this.serviceName,
925
+ fixedAddForm: this.fixedAddForm,
926
+ getDataParams: this.getDataParams,
927
+ modifyModelData: modifyModelData,
928
+ layout: res.xAddFormLayout || 'horizontal',
929
+ env: this.env
930
+ })
931
+ }
932
+ },
933
+ /**
934
+ * 删除按钮事件
935
+ */
936
+ del (keys, callback) {
937
+ if (this.customDelete) {
938
+ this.$emit('del', keys, callback)
939
+ }
940
+ },
941
+ /**
942
+ * 删除后事件
943
+ * @param res
944
+ */
945
+ afterDelete (res) {
946
+ this.$emit('afterDelete', res)
947
+ },
948
+ /**
949
+ * 行选择事件
950
+ * @param row 选中行
951
+ */
952
+ rowChoose (row) {
953
+ this.$emit('rowChoose', row)
954
+ },
955
+ /**
956
+ * 本地编辑模式下校验表格并同步本地数据
957
+ * @param currRow 当前行
958
+ * @param defaultAppendRowData 默认追加的行数据
959
+ */
960
+ validateTableAndSyncData (currRow, defaultAppendRowData) {
961
+ this.$refs.xTable.validateTableAndSyncData(currRow, defaultAppendRowData)
962
+ },
963
+ /**
964
+ * 更多条件是否展示
965
+ */
966
+ toggleAdvanced () {
967
+ this.$refs.xTable.setScrollYHeight({})
968
+ },
969
+ /**
970
+ * 查询表单部分显示/隐藏切换
971
+ */
972
+ toggleIsFormShow () {
973
+ this.toggleIsFormIcon = this.toggleIsFormIcon === 'vertical-align-top' ? 'vertical-align-bottom' : 'vertical-align-top'
974
+ this.$refs.xForm.toggleVisible()
975
+ this.$refs.xTable.setScrollYHeight({})
976
+ },
977
+ /**
978
+ * 选择列事件
979
+ * @param selectedRowKeys 选中列Key集合
980
+ * @param selectedRows 选中列
981
+ */
982
+ selectRow (selectedRowKeys, selectedRows) {
983
+ this.table_selectedRowKeys = selectedRowKeys
984
+ this.table_selectedRows = selectedRows
985
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
986
+ },
987
+ /**
988
+ * 清除勾选数据
989
+ */
990
+ clearRowKeys () {
991
+ this.$refs.xTable.clearRowKeys()
992
+ },
993
+ /**
994
+ * 刷新表格
995
+ * @param toFirstPage 是否到第一页
996
+ */
997
+ refreshTable (toFirstPage = true) {
998
+ this.$refs.xTable.refresh(toFirstPage)
999
+ },
1000
+ /**
1001
+ * 刷新表格
1002
+ * @param toFirstPage 是否到第一页
1003
+ */
1004
+ refresh (toFirstPage = true) {
1005
+ this.$refs.xTable.refresh(toFirstPage)
1006
+ },
1007
+ /**
1008
+ * 获取表格数据
1009
+ */
1010
+ getTableData () {
1011
+ return this.$refs.xTable.getTableData()
1012
+ },
1013
+ // 在行编辑等情况下,让界面生效
1014
+ update () {
1015
+ this.getTableData().push(...[])
1016
+ },
1017
+
1018
+ /**
1019
+ * 设置表格数据
1020
+ */
1021
+ setTableData (data) {
1022
+ this.$refs.xTable.setTableData(data)
1023
+ },
1024
+ /**
1025
+ * 表单本地提交
1026
+ */
1027
+ onLocalSubmit (res, callback) {
1028
+ const form = res.realForm
1029
+ if (res.businessType === '新增') {
1030
+ this.$refs.xTable.appendLocalData(form)
1031
+ } else {
1032
+ this.$refs.xTable.modifyLocalData(form['序号'], form)
1033
+ }
1034
+ this.$message.success(res.businessType + '成功!')
1035
+ this.onAddOrEditSubmitAfterSubmit(res, callback)
1036
+ if (callback) {
1037
+ callback()
1038
+ }
1039
+ },
1040
+ emitFunc (func, ...args) {
1041
+ this.$emit(func, ...args)
1042
+ this.$emit('getEmitFuncData', func, ...args)
1043
+ },
1044
+ // 直接转发事件的函数
1045
+ emitEvent (event, ...args) {
1046
+ this.$emit(event, ...args)
1047
+ },
1048
+ // 添加处理 rowClick 的方法
1049
+ handleRowClick (record) {
1050
+ this.$emit('rowClick', record)
1051
+ },
1052
+ handleRowDblClick (record) {
1053
+ this.$emit('rowDblClick', record)
1054
+ },
1055
+ beforeDataChange (record) {
1056
+ this.$emit('beforeDataChange', record)
1057
+ },
1058
+ onExpand (expanded, record) {
1059
+ this.$emit('expand', expanded, record)
1060
+ }
1061
+ },
1062
+ action: {
1063
+ /**
1064
+ * 实现doAction方法
1065
+ */
1066
+ doAction (actionType, args, data) {
1067
+ switch (actionType) {
1068
+ case 'refreshTable':
1069
+ for (const item in args) {
1070
+ console.log('item', item)
1071
+ }
1072
+ break
1073
+ default:
1074
+ break
1075
+ }
1076
+ }
1077
+ },
1078
+ mounted () {
1079
+ if (!this.isMounted) {
1080
+ // 防止多次调用
1081
+ // 不知道为啥他会执行两次 mounted 暂时处理方式
1082
+ this.initConfig()
1083
+ this.isMounted = true
1084
+ }
1085
+ if (this.getSelectedData && typeof this.getSelectedData === 'function') {
1086
+ const selectedId = this.getSelectedData()
1087
+ if (!selectedId) {
1088
+ return
1089
+ }
1090
+ if (typeof selectedId === 'object') {
1091
+ const data = JSON.parse(JSON.stringify(selectedId))
1092
+ if (data.selectedId) {
1093
+ data.selected_id = data.selectedId
1094
+ delete data.selectedId
1095
+ }
1096
+ Object.assign(this.fixedAddForm, data)
1097
+ Object.assign(this.fixedQueryForm, data)
1098
+ } else {
1099
+ Object.assign(this.fixedAddForm, { selected_id: selectedId })
1100
+ Object.assign(this.fixedQueryForm, { selected_id: selectedId })
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ </script>
1106
+ <style lang="less" scoped>
1107
+ .crud_title {
1108
+ height: 32px;
1109
+ font-size: 16px;
1110
+ font-weight: 500;
1111
+ color: #000000d9;
1112
+ line-height: 32px;
1113
+ margin-bottom: 12px;
1114
+ }
1115
+ // 表格行样式类型
1116
+ .ant-table-tbody {
1117
+ // 成功样式 - 绿色 (#52c41a)
1118
+ .ant-table-row-success {
1119
+ background-color: rgba(82, 196, 26, 0.2);
1120
+
1121
+ &:hover {
1122
+ background-color: rgba(82, 196, 26, 0.3) !important;
1123
+
1124
+ td {
1125
+ background-color: transparent;
1126
+ }
1127
+ }
1128
+
1129
+ // 选中状态
1130
+ &.ant-table-row-selected {
1131
+ background-color: rgba(82, 196, 26, 0.4);
1132
+
1133
+ td {
1134
+ background-color: transparent;
1135
+ }
1136
+ }
1137
+
1138
+ td {
1139
+ background-color: transparent;
1140
+ }
1141
+ }
1142
+
1143
+ // 警告样式 - 黄色 (#faad14)
1144
+ .ant-table-row-warning {
1145
+ background-color: rgba(250, 173, 20, 0.1) ;
1146
+
1147
+ &:hover {
1148
+ background-color: rgba(250, 173, 20, 0.15) ;
1149
+
1150
+ td {
1151
+ background-color: transparent ;
1152
+ }
1153
+ }
1154
+
1155
+ // 选中状态
1156
+ &.ant-table-row-selected {
1157
+ background-color: rgba(250, 173, 20, 0.2);
1158
+
1159
+ td {
1160
+ background-color: transparent;
1161
+ }
1162
+ }
1163
+
1164
+ td {
1165
+ background-color: transparent ;
1166
+ }
1167
+ }
1168
+
1169
+ // 错误样式 - 红色 (#f5222f)
1170
+ .ant-table-row-error {
1171
+ background-color: rgba(245, 34, 47, 0.1) ;
1172
+
1173
+ &:hover {
1174
+ background-color: rgba(245, 34, 47, 0.15) ;
1175
+
1176
+ td {
1177
+ background-color: transparent ;
1178
+ }
1179
+ }
1180
+
1181
+ // 选中状态
1182
+ &.ant-table-row-selected {
1183
+ background-color: rgba(245, 34, 47, 0.2) ;
1184
+
1185
+ td {
1186
+ background-color: transparent ;
1187
+ }
1188
+ }
1189
+
1190
+ td {
1191
+ background-color: transparent ;
1192
+ }
1193
+ }
1194
+
1195
+ // 魔法样式 - 紫色
1196
+ .ant-table-row-magic {
1197
+ background-color: rgba(114, 46, 209, 0.1) ;
1198
+
1199
+ &:hover {
1200
+ background-color: rgba(114, 46, 209, 0.15) ;
1201
+
1202
+ td {
1203
+ background-color: transparent ;
1204
+ }
1205
+ }
1206
+
1207
+ // 选中状态
1208
+ &.ant-table-row-selected {
1209
+ background-color: rgba(114, 46, 209, 0.2) ;
1210
+
1211
+ td {
1212
+ background-color: transparent ;
1213
+ }
1214
+ }
1215
+
1216
+ td {
1217
+ background-color: transparent ;
1218
+ }
1219
+ }
1220
+
1221
+ // 默认选中状态(没有特殊行样式时)
1222
+ .ant-table-row-selected:not(.ant-table-row-success):not(.ant-table-row-warning):not(.ant-table-row-error):not(.ant-table-row-magic) {
1223
+ background-color: rgba(24, 144, 255, 0.1) ;
1224
+ }
1225
+ }
1226
+ </style>
1227
+ <style>
1228
+
1229
+ .splitpanes.default-theme .splitpanes__splitter {
1230
+ border: 0;
1231
+ width: 1rem;
1232
+ position: relative;
1233
+
1234
+ &:before {
1235
+ content: '';
1236
+ position: absolute;
1237
+ left: 50%;
1238
+ top: 50%;
1239
+ transform: translate(-50%, -50%);
1240
+ width: 2px;
1241
+ height: 30px;
1242
+ border-radius: 1px;
1243
+ }
1244
+ }
1245
+
1246
+ .splitpanes.default-theme .splitpanes__pane {
1247
+ overflow: visible;
1248
+ background-color: transparent;
1249
+ }
1250
+
1251
+ /* 弹框底部提示样式(与分页在同一行) */
1252
+ .popup-footer-tip {
1253
+ color: rgba(0, 0, 0, 0.45);
1254
+ font-size: 12px;
1255
+ line-height: 1.5;
1256
+ }
1257
+
1258
+ </style>