vue2-client 1.22.2 → 1.22.3

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 (170) hide show
  1. package/.claude/settings.local.json +30 -30
  2. package/.env.his +19 -19
  3. package/.eslintrc.js +74 -74
  4. package/.history/.eslintrc_20260521171150.js +74 -0
  5. package/.history/.eslintrc_20260521171213.js +74 -0
  6. package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154443.vue +726 -0
  7. package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154700.vue +478 -0
  8. package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175435.vue +706 -0
  9. package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175450.vue +694 -0
  10. package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260611152602.vue +755 -0
  11. package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513145941.vue +524 -0
  12. package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513153133.vue +731 -0
  13. package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513160316.vue +525 -0
  14. package/.history/src/base-client/components/common/HIS/HForm/HForm_20260601144150.vue +1046 -0
  15. package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310142713.vue +512 -0
  16. package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310145118.vue +511 -0
  17. package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260311094834.vue +696 -0
  18. package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260320143028.vue +693 -0
  19. package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260409101450.vue +677 -0
  20. package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164645.vue +758 -0
  21. package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164714.vue +693 -0
  22. package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508171651.vue +716 -0
  23. package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509133717.vue +695 -0
  24. package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509171115.vue +664 -0
  25. package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140637.vue +1455 -0
  26. package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140935.vue +1441 -0
  27. package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513150818.vue +1441 -0
  28. package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153119.vue +1442 -0
  29. package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153126.vue +1486 -0
  30. package/.history/src/base-client/components/common/XForm/XFormItem_20260513140854.vue +1607 -0
  31. package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140403.vue +643 -0
  32. package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140829.vue +628 -0
  33. package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519142824.vue +104 -0
  34. package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519143155.vue +102 -0
  35. package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171231.vue +1241 -0
  36. package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171441.vue +1223 -0
  37. package/.history/src/base-client/components/his/HAi/HAi_20260612174826.vue +472 -0
  38. package/.history/src/base-client/components/his/HAi/HAi_20260612175839.vue +538 -0
  39. package/.history/src/base-client/components/his/HAi/HAi_20260615103331.vue +650 -0
  40. package/.history/src/base-client/components/his/XHDescriptions/XHDescriptions_20260424134504.vue +1469 -0
  41. package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171133.vue +788 -0
  42. package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171151.vue +780 -0
  43. package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511170841.vue +585 -0
  44. package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511171138.vue +787 -0
  45. package/.history/src/base-client/components/his/XTransfer/XTransfer_20260512141830.vue +739 -0
  46. package/.history/src/components/STable/index_20260409155138.js +806 -0
  47. package/.history/src/components/STable/index_20260409155218.js +814 -0
  48. package/.history/src/expression/core/Expression_20260305164427.js +1371 -0
  49. package/.history/src/expression/core/Expression_20260305170258.js +1358 -0
  50. package/.history/src/expression/core/Program_20260305111830.js +944 -0
  51. package/.history/src/expression/core/Program_20260305112041.js +931 -0
  52. package/.history/src/logic/LogicRunner_20260304154306.js +170 -0
  53. package/.history/src/logic/LogicRunner_20260304155553.js +112 -0
  54. package/.history/src/logic/LogicRunner_20260305105834.js +112 -0
  55. package/.history/src/logic/LogicRunner_20260305112718.js +129 -0
  56. package/.history/src/logic/LogicRunner_20260305182436.js +133 -0
  57. package/.history/src/logic/LogicRunner_20260306151301.js +213 -0
  58. package/.history/src/logic/LogicRunner_20260306152419.js +213 -0
  59. package/.history/src/logic/plugins/common/DateTools_20260305154159.js +61 -0
  60. package/.history/src/logic/plugins/common/DateTools_20260305154217.js +44 -0
  61. package/.history/src/logic/plugins/common/DateTools_20260305161014.js +44 -0
  62. package/.history/src/logic/plugins/common/HttpTools_20260305164352.js +80 -0
  63. package/.history/src/logic/plugins/common/HttpTools_20260305170258.js +75 -0
  64. package/.history/src/logic/plugins/common/HttpTools_20260305171634.js +75 -0
  65. package/.history/src/logic/plugins/common/HttpTools_20260306152419.js +72 -0
  66. package/.history/src/services/api/restTools_20260427142149.js +245 -0
  67. package/.history/src/services/api/restTools_20260427142853.js +230 -0
  68. package/.history/src/services/api/restTools_20260519135558.js +230 -0
  69. package/.history/src/services/api/restTools_20260519140825.js +230 -0
  70. package/.history/src/services/api/restTools_20260519151223.js +230 -0
  71. package/.history/src/utils/indexedDB_20260306150918.js +593 -0
  72. package/.history/src/utils/indexedDB_20260306151301.js +586 -0
  73. package/.idea/af-vue2-client.iml +9 -0
  74. package/.idea/codeStyles/Project.xml +62 -0
  75. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  76. package/.idea/misc.xml +6 -0
  77. package/.idea/modules.xml +1 -1
  78. package/Components.md +60 -60
  79. package/index.js +31 -31
  80. package/jest-transform-stub.js +8 -8
  81. package/jest.setup.js +7 -7
  82. package/package.json +1 -1
  83. package/preview-input-box.html +180 -0
  84. package/src/assets/img/querySlotDemo.svg +15 -15
  85. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  86. package/src/base-client/components/common/CitySelect/index.js +3 -3
  87. package/src/base-client/components/common/CitySelect/index.md +109 -109
  88. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  89. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  90. package/src/base-client/components/common/HIS/HButtons/HButtons.vue +55 -1
  91. package/src/base-client/components/common/HIS/HForm/HForm.vue +1186 -1186
  92. package/src/base-client/components/common/HIS/HTab/HTab.vue +88 -1
  93. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  94. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  95. package/src/base-client/components/common/Tree/index.js +2 -2
  96. package/src/base-client/components/common/Upload/index.js +3 -3
  97. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  98. package/src/base-client/components/common/XAddReport/XAddReport.vue +16 -1
  99. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  100. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  101. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  102. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  103. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  104. package/src/base-client/components/common/XDescriptions/index.md +382 -382
  105. package/src/base-client/components/common/XForm/index.md +178 -178
  106. package/src/base-client/components/common/XInput/XInput.vue +32 -1
  107. package/src/base-client/components/common/XInspectionDetailDrawer/index.vue +1 -1
  108. package/src/base-client/components/common/XMarkdownViewer/demo.vue +102 -102
  109. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  110. package/src/base-client/components/common/XStepView/index.js +3 -3
  111. package/src/base-client/components/common/XStepView/index.md +31 -31
  112. package/src/base-client/components/common/XTable/index.md +255 -255
  113. package/src/base-client/components/his/HAi/HAi.vue +1177 -436
  114. package/src/base-client/components/his/XList/XList.vue +337 -58
  115. package/src/base-client/components/his/XSidebar/XSidebar.vue +36 -12
  116. package/src/base-client/components/his/XTransfer/index.md +327 -327
  117. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  118. package/src/base-client/plugins/Config.js +19 -19
  119. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  120. package/src/components/Charts/Bar.vue +62 -62
  121. package/src/components/Charts/ChartCard.vue +134 -134
  122. package/src/components/Charts/Liquid.vue +67 -67
  123. package/src/components/Charts/MiniArea.vue +39 -39
  124. package/src/components/Charts/MiniBar.vue +39 -39
  125. package/src/components/Charts/MiniProgress.vue +75 -75
  126. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  127. package/src/components/Charts/Radar.vue +68 -68
  128. package/src/components/Charts/RankList.vue +77 -77
  129. package/src/components/Charts/TagCloud.vue +113 -113
  130. package/src/components/Charts/TransferBar.vue +64 -64
  131. package/src/components/Charts/Trend.vue +82 -82
  132. package/src/components/Charts/chart.less +12 -12
  133. package/src/components/Charts/smooth.area.less +13 -13
  134. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  135. package/src/components/NumberInfo/index.js +3 -3
  136. package/src/components/NumberInfo/index.less +54 -54
  137. package/src/components/NumberInfo/index.md +43 -43
  138. package/src/components/STable/index.js +953 -953
  139. package/src/components/card/ChartCard.vue +79 -79
  140. package/src/components/chart/Bar.vue +60 -60
  141. package/src/components/chart/MiniArea.vue +67 -67
  142. package/src/components/chart/MiniBar.vue +59 -59
  143. package/src/components/chart/MiniProgress.vue +57 -57
  144. package/src/components/chart/Radar.vue +80 -80
  145. package/src/components/chart/RankingList.vue +60 -60
  146. package/src/components/chart/Trend.vue +79 -79
  147. package/src/components/chart/index.less +9 -9
  148. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  149. package/src/components/input/IInput.vue +66 -66
  150. package/src/components/menu/SideMenu.vue +75 -75
  151. package/src/components/menu/menu.js +273 -273
  152. package/src/components/tool/AStepItem.vue +60 -60
  153. package/src/layouts/CommonLayout.vue +56 -56
  154. package/src/lib.js +1 -1
  155. package/src/mock/extend/index.js +84 -84
  156. package/src/mock/goods/index.js +108 -108
  157. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  158. package/src/pages/system/dictionary/index.vue +44 -44
  159. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  160. package/src/pages/system/monitor/operLog/index.vue +37 -37
  161. package/src/services/api/cas.js +79 -79
  162. package/src/store/modules/setting.js +119 -119
  163. package/src/utils/errorCode.js +6 -6
  164. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
  165. package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -7
  166. package/.idea/google-java-format.xml +0 -6
  167. package/.idea/inspectionProfiles/Project_Default.xml +0 -24
  168. package/.idea/jsLinters/eslint.xml +0 -6
  169. package/.idea/vue2-client.iml +0 -12
  170. package/.vscode/settings.json +0 -28
@@ -0,0 +1,693 @@
1
+ <script setup>
2
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
3
+ import { ref, computed, useAttrs, nextTick, onMounted, onBeforeUnmount } from 'vue'
4
+
5
+ // 常量配置
6
+ const ROW_HEIGHT_DEFAULT = '37px'
7
+ const BOOLEAN_STYLE_KEYS = [
8
+ 'button-row-0margin',
9
+ 'top-hidden',
10
+ 'dialog-style',
11
+ 'button-style',
12
+ 'header-center',
13
+ 'expanded-grid-white',
14
+ 'report-mode',
15
+ 'listview-hide-selected',
16
+ 'min-height-auto'
17
+ ]
18
+ const ALLOWED_PAGINATION_STYLES = ['pagination-center', 'custom-pagination']
19
+ const SYNC_DELAY_AFTER_PAGE = 80
20
+ const SYNC_DELAY_RETRY = 60
21
+ const SYNC_DELAY_EXPAND = 20
22
+
23
+ // 选择器常量
24
+ const MAIN_TABLE_SELECTORS = [
25
+ '.ant-table-tbody > tr.ant-table-row',
26
+ '.ant-table-body > table > tbody > tr.ant-table-row'
27
+ ]
28
+ const FIXED_TABLE_SELECTORS = [
29
+ '.ant-table-fixed-right .ant-table-tbody > tr',
30
+ '.ant-table-fixed-right .ant-table-body-inner > table > tbody > tr',
31
+ '.ant-table-fixed-right .ant-table-body > table > tbody > tr'
32
+ ]
33
+ const MAIN_TBODY_SELECTORS = ['.ant-table-body > table > tbody', '.ant-table-tbody']
34
+ const FIXED_TBODY_SELECTORS = [
35
+ '.ant-table-fixed-right .ant-table-body-inner > table > tbody',
36
+ '.ant-table-fixed-right .ant-table-body > table > tbody',
37
+ '.ant-table-fixed-right .ant-table-tbody'
38
+ ]
39
+ const TABLE_BODY_SELECTORS = ['.ant-table-body', '.ant-table-body-inner']
40
+
41
+ // 辅助函数
42
+ const getRowKey = (tr) => tr?.getAttribute?.('data-row-key') || tr?.dataset?.rowKey || ''
43
+
44
+ const cleanRowStyles = (element, isCollapse = false) => {
45
+ if (!element) return
46
+ element.removeAttribute('data-synced-height')
47
+ if (isCollapse) {
48
+ element.style.setProperty('height', '0', 'important')
49
+ element.style.setProperty('min-height', '0', 'important')
50
+ element.style.setProperty('max-height', '0', 'important')
51
+ element.style.setProperty('line-height', '0', 'important')
52
+ element.style.setProperty('overflow', 'hidden', 'important')
53
+ } else {
54
+ element.style.removeProperty('height')
55
+ element.style.removeProperty('min-height')
56
+ element.style.removeProperty('max-height')
57
+ element.style.removeProperty('line-height')
58
+ }
59
+ }
60
+
61
+ const cleanCellStyles = (td, isCollapse = false) => {
62
+ if (isCollapse) {
63
+ td.style.setProperty('height', '0', 'important')
64
+ td.style.setProperty('min-height', '0', 'important')
65
+ td.style.setProperty('max-height', '0', 'important')
66
+ td.style.setProperty('line-height', '0', 'important')
67
+ td.style.setProperty('padding', '0', 'important')
68
+ td.style.setProperty('border', 'none', 'important')
69
+ td.style.setProperty('overflow', 'hidden', 'important')
70
+ } else {
71
+ td.style.removeProperty('height')
72
+ td.style.removeProperty('min-height')
73
+ td.style.removeProperty('max-height')
74
+ td.style.removeProperty('line-height')
75
+ td.style.removeProperty('vertical-align')
76
+ }
77
+ }
78
+
79
+ const queryFirst = (container, selectors) => {
80
+ for (const sel of selectors) {
81
+ const el = container.querySelector(sel)
82
+ if (el) return el
83
+ }
84
+ return null
85
+ }
86
+
87
+ const props = defineProps({
88
+ tableStyle: {
89
+ type: String,
90
+ default: 'formtable-col1'
91
+ }
92
+ })
93
+
94
+ const attrs = useAttrs()
95
+
96
+ const wrapperClassObject = computed(() => {
97
+ const classes = {}
98
+
99
+ for (const key of BOOLEAN_STYLE_KEYS) {
100
+ const val = attrs[key]
101
+ const truthy = val === true || val === '' || val === 'true'
102
+ if (truthy) classes[`h-form-table-${key}`] = true
103
+ }
104
+
105
+ const paginationAttr = attrs?.paginationStyle
106
+ if (paginationAttr && ALLOWED_PAGINATION_STYLES.includes(paginationAttr)) {
107
+ classes[`h-form-table-${paginationAttr}`] = true
108
+ }
109
+ return classes
110
+ })
111
+
112
+ const wrapperStyleObject = computed(() => {
113
+ const rowHeight = attrs['row-height'] || attrs.rowHeight || ROW_HEIGHT_DEFAULT
114
+ const tableMinHeight = attrs['table-min-height'] || attrs.tableMinHeight || null
115
+ // 表格高度偏移量(分页器+边距等固定部分),配置600显示550,偏移50
116
+ const tableMinHeightOffset = 50
117
+ return {
118
+ '--row-height': rowHeight,
119
+ '--table-min-height': tableMinHeight ? `calc(${tableMinHeight} - ${tableMinHeightOffset}px)` : undefined
120
+ }
121
+ })
122
+
123
+ const xFormTableRef = ref()
124
+ const wrapperRef = ref()
125
+
126
+ // 状态变量
127
+ let observer = null
128
+ let resizeObserver = null
129
+ let isSyncing = false
130
+ let rafId = 0
131
+ let syncAfterPageChangeTimer = 0
132
+
133
+ const getWrapperEl = () => wrapperRef.value
134
+
135
+ const scheduleSync = () => {
136
+ if (isSyncing) return
137
+ if (rafId) cancelAnimationFrame(rafId)
138
+ rafId = requestAnimationFrame(() => {
139
+ rafId = 0
140
+ syncFixedExpandedHeights()
141
+ })
142
+ }
143
+
144
+ const clearAllFixedRowHeights = () => {
145
+ try {
146
+ const wrapper = getWrapperEl()
147
+ if (!wrapper) return
148
+ const fixedRows = wrapper.querySelectorAll(FIXED_TABLE_SELECTORS.join(', '))
149
+ fixedRows.forEach(f => {
150
+ if (!f) return
151
+ cleanRowStyles(f, true)
152
+ f.querySelectorAll('td').forEach(td => cleanCellStyles(td, true))
153
+ })
154
+ } catch (e) {
155
+ console.warn('[HFormTable] clearAllFixedRowHeights error:', e)
156
+ }
157
+ }
158
+
159
+ const scheduleSyncAfterPageChange = () => {
160
+ clearAllFixedRowHeights()
161
+ if (syncAfterPageChangeTimer) clearTimeout(syncAfterPageChangeTimer)
162
+ syncAfterPageChangeTimer = setTimeout(() => {
163
+ syncAfterPageChangeTimer = 0
164
+ scheduleSync()
165
+ setTimeout(scheduleSync, SYNC_DELAY_RETRY)
166
+ }, SYNC_DELAY_AFTER_PAGE)
167
+ }
168
+
169
+ const setupHeightSync = () => {
170
+ try {
171
+ const wrapper = getWrapperEl()
172
+ if (!wrapper || observer) return
173
+
174
+ const mainTable = queryFirst(wrapper, MAIN_TBODY_SELECTORS)
175
+ const fixedTbody = queryFirst(wrapper, FIXED_TBODY_SELECTORS)
176
+ const tableBody = queryFirst(wrapper, TABLE_BODY_SELECTORS)
177
+
178
+ const observerOptions = {
179
+ childList: true,
180
+ subtree: true,
181
+ attributes: true,
182
+ attributeFilter: ['style', 'class']
183
+ }
184
+
185
+ observer = new MutationObserver((mutations) => {
186
+ if (isSyncing) return
187
+ const hasChildList = mutations.some(m => m.type === 'childList')
188
+ const hasAttr = mutations.some(m =>
189
+ m.type === 'attributes' &&
190
+ (m.attributeName === 'style' || m.attributeName === 'class')
191
+ )
192
+ if (hasChildList) {
193
+ scheduleSyncAfterPageChange()
194
+ } else if (hasAttr) {
195
+ scheduleSync()
196
+ }
197
+ })
198
+
199
+ if (mainTable) observer.observe(mainTable, observerOptions)
200
+ if (fixedTbody) observer.observe(fixedTbody, observerOptions)
201
+
202
+ if (!resizeObserver && tableBody && typeof ResizeObserver !== 'undefined') {
203
+ resizeObserver = new ResizeObserver(() => scheduleSync())
204
+ resizeObserver.observe(tableBody)
205
+ }
206
+ } catch (e) {
207
+ console.warn('[HFormTable] setupHeightSync error:', e)
208
+ }
209
+ }
210
+
211
+ const syncFixedExpandedHeights = () => {
212
+ try {
213
+ const wrapper = getWrapperEl()
214
+ if (!wrapper) return
215
+ if (isSyncing) return
216
+ isSyncing = true
217
+
218
+ const mainRows = Array.from(wrapper.querySelectorAll(MAIN_TABLE_SELECTORS.join(', ')))
219
+ const fixedRows = Array.from(wrapper.querySelectorAll(FIXED_TABLE_SELECTORS.join(', ')))
220
+
221
+ // 只取有 key 的行进行顺序匹配
222
+ const mainRowsList = mainRows.filter(m => getRowKey(m))
223
+ const fixedRowsList = fixedRows.filter(f => getRowKey(f))
224
+ const count = Math.min(mainRowsList.length, fixedRowsList.length)
225
+
226
+ for (let i = 0; i < count; i++) {
227
+ const m = mainRowsList[i]
228
+ const f = fixedRowsList[i]
229
+ const key = getRowKey(m)
230
+ if (!key) continue
231
+
232
+ const h = Math.round(m.getBoundingClientRect().height)
233
+ if (!h) continue
234
+
235
+ const hs = String(h)
236
+ if (f.dataset.syncedHeight === hs) continue
237
+ f.dataset.syncedHeight = hs
238
+
239
+ f.style.cssText = ''
240
+ f.style.setProperty('height', h + 'px', 'important')
241
+ f.style.setProperty('min-height', h + 'px', 'important')
242
+ f.style.setProperty('max-height', h + 'px', 'important')
243
+ f.style.setProperty('line-height', 'normal', 'important')
244
+
245
+ f.querySelectorAll('td').forEach(td => {
246
+ td.style.cssText = ''
247
+ td.style.setProperty('height', h + 'px', 'important')
248
+ td.style.setProperty('min-height', h + 'px', 'important')
249
+ td.style.setProperty('max-height', h + 'px', 'important')
250
+ td.style.setProperty('line-height', 'normal', 'important')
251
+ td.style.setProperty('vertical-align', 'middle', 'important')
252
+ })
253
+ }
254
+
255
+ // 清理无对应主表 key 的固定列行
256
+ const mainKeys = new Set(mainRowsList.map(m => getRowKey(m)))
257
+ fixedRows.forEach(f => {
258
+ const key = getRowKey(f)
259
+ if (!mainKeys.has(key) && f.dataset.syncedHeight) {
260
+ cleanRowStyles(f, true)
261
+ f.querySelectorAll('td').forEach(td => cleanCellStyles(td, true))
262
+ }
263
+ })
264
+ } catch (e) {
265
+ console.warn('[HFormTable] syncFixedExpandedHeights error:', e)
266
+ } finally {
267
+ isSyncing = false
268
+ }
269
+ }
270
+
271
+ const onExpandLog = () => {
272
+ nextTick(() => {
273
+ if (!observer) {
274
+ setupHeightSync()
275
+ }
276
+ syncFixedExpandedHeights()
277
+ setTimeout(() => syncFixedExpandedHeights(), SYNC_DELAY_EXPAND)
278
+ })
279
+ }
280
+
281
+ onMounted(() => {
282
+ nextTick(() => {
283
+ setupHeightSync()
284
+ syncFixedExpandedHeights()
285
+ })
286
+ })
287
+
288
+ onBeforeUnmount(() => {
289
+ try {
290
+ observer?.disconnect?.()
291
+ resizeObserver?.disconnect?.()
292
+ if (rafId) cancelAnimationFrame(rafId)
293
+ if (syncAfterPageChangeTimer) clearTimeout(syncAfterPageChangeTimer)
294
+ } finally {
295
+ observer = null
296
+ resizeObserver = null
297
+ rafId = 0
298
+ syncAfterPageChangeTimer = 0
299
+ isSyncing = false
300
+ }
301
+ })
302
+
303
+ // 计算属性
304
+ const isCustomPagination = computed(() => {
305
+ const paginationAttr = attrs?.paginationStyle || ''
306
+ return props.tableStyle === 'custom-pagination' || paginationAttr === 'custom-pagination'
307
+ })
308
+
309
+ const isHiddenFunctionalArea = computed(() => {
310
+ return attrs?.hiddenFunctionalArea === 'true' || attrs?.hiddenFunctionalArea === true
311
+ })
312
+
313
+ const computedDefaultPageSize = computed(() => {
314
+ const pageMaxSize = attrs?.pageMaxSize
315
+ const numericPageSize = pageMaxSize ? Number(pageMaxSize) : null
316
+ return (numericPageSize && numericPageSize > 0) ? numericPageSize : 10
317
+ })
318
+
319
+ defineExpose({
320
+ getXFormTableInstance: () => xFormTableRef.value,
321
+ waitConfigEnd: () => xFormTableRef.value?.waitConfigEnd?.() ?? Promise.resolve()
322
+ })
323
+ </script>
324
+
325
+ <template>
326
+ <div
327
+ ref="wrapperRef"
328
+ class="h-form-table-wrapper"
329
+ :class="[
330
+ `h-form-table-${tableStyle}`,
331
+ wrapperClassObject
332
+ ]"
333
+ :style="wrapperStyleObject"
334
+ >
335
+ <x-form-table
336
+ ref="xFormTableRef"
337
+ v-bind="$attrs"
338
+ :defaultPageSize="computedDefaultPageSize"
339
+ :customPagination="isCustomPagination"
340
+ :hiddenFunctionalArea="isHiddenFunctionalArea"
341
+ @expand="onExpandLog"
342
+ @configEnd="$emit('configEnd')"
343
+ v-on="$listeners"
344
+ >
345
+ <template v-for="(_, name) in $slots" #[name]="slotData">
346
+ <slot :name="name" v-bind="slotData" />
347
+ </template>
348
+ </x-form-table>
349
+ </div>
350
+ </template>
351
+
352
+ <style scoped lang="less">
353
+ // 表格行高度变量,默认37px
354
+ @row-height: var(--row-height, 37px);
355
+
356
+ .h-form-table-wrapper {
357
+ // 基础样式
358
+ :deep(.table-wrapper) {
359
+ .ant-table {
360
+ .ant-table-row {
361
+ margin: 0 !important;
362
+ height: @row-height !important;
363
+ max-height: @row-height !important;
364
+ line-height: @row-height !important;
365
+
366
+ > td {
367
+ height: @row-height !important;
368
+ min-height: @row-height !important;
369
+ max-height: @row-height !important;
370
+ padding: 0 8px !important;
371
+ box-sizing: border-box !important;
372
+ vertical-align: middle !important;
373
+
374
+ // 去掉内部元素的 margin,防止带下拉框的行被撑高
375
+ .ant-form-item,
376
+ .ant-form-item-control {
377
+ margin-bottom: 0 !important;
378
+ margin-top: 0 !important;
379
+ }
380
+ .ant-select,
381
+ .ant-input,
382
+ .ant-picker {
383
+ margin-bottom: 0 !important;
384
+ margin-top: 0 !important;
385
+ height: @row-height !important;
386
+ max-height: @row-height !important;
387
+ line-height: @row-height !important;
388
+ width: 100% !important;
389
+ }
390
+ .ant-select-selection--single {
391
+ height: calc(@row-height - 2px) !important;
392
+ min-height: calc(@row-height - 2px) !important;
393
+ width: 100% !important;
394
+ }
395
+ .ant-select-selection__rendered {
396
+ line-height: calc(@row-height - 2px) !important;
397
+ }
398
+ // 确保下拉框组件及其选择器部分填满单元格宽度
399
+ .ant-select-selection {
400
+ width: 100% !important;
401
+ }
402
+ }
403
+ }
404
+ font-size: 16px;
405
+ }
406
+
407
+ .ant-alert-info {
408
+ display: none;
409
+ }
410
+ }
411
+
412
+ :deep(.ant-card) {
413
+ margin: -10px 0px 29px 0px;
414
+ }
415
+ :deep(.ant-space .ant-btn .anticon) {
416
+ display: none;
417
+ }
418
+ :deep(.ant-space .ant-btn) {
419
+ border: 0px;
420
+ box-shadow: none;
421
+ padding: 0px;
422
+ color: #5D5C5C;
423
+ font-weight: bold;
424
+ letter-spacing: 0em;
425
+ font-size: 18px;
426
+ line-height: normal;
427
+ background-color: transparent;
428
+ font-family: "Source Han Sans";
429
+ }
430
+
431
+ :deep(.ant-card-body) {
432
+ padding: 0 6px;
433
+ }
434
+
435
+ :deep(.ant-table-small) {
436
+ border-width: 0;
437
+
438
+ .ant-table-fixed {
439
+ border-radius: 0;
440
+ border-bottom: 1px solid #f0f0f0;
441
+ }
442
+ }
443
+
444
+ // 操作列(固定列)高度与主体一致,行内文字垂直居中
445
+ :deep(.ant-table-fixed-right .ant-table-body-inner) {
446
+ table tbody tr.ant-table-row {
447
+ height: @row-height !important;
448
+ max-height: @row-height !important;
449
+
450
+ > td {
451
+ height: @row-height !important;
452
+ min-height: @row-height !important;
453
+ max-height: @row-height !important;
454
+ padding: 0 8px !important;
455
+ box-sizing: border-box !important;
456
+ vertical-align: middle !important;
457
+ line-height: @row-height !important;
458
+
459
+ // 确保固定列中的下拉框组件填满单元格宽度
460
+ .ant-select,
461
+ .ant-input,
462
+ .ant-picker {
463
+ width: 100% !important;
464
+ }
465
+ .ant-select-selection {
466
+ width: 100% !important;
467
+ }
468
+ }
469
+ }
470
+ }
471
+ // 主表行高与固定列一致
472
+ :deep(.table-wrapper .ant-table-body > table > tbody > tr.ant-table-row) {
473
+ height: @row-height !important;
474
+ max-height: @row-height !important;
475
+ }
476
+
477
+ :deep(.ant-table-fixed-right .ant-btn),
478
+ :deep(.ant-table-fixed-right a) {
479
+ line-height: inherit !important;
480
+ vertical-align: middle !important;
481
+ padding: 0 4px;
482
+ }
483
+
484
+ // 表格高度样式
485
+ &.h-form-table-height {
486
+ :deep(.table-wrapper) {
487
+ .ant-select-open ~ .ant-table-content {
488
+ height: 500px !important;
489
+ }
490
+ }
491
+ }
492
+ // 表格最小高度自动
493
+ &.h-form-table-min-height-auto {
494
+ :deep(.table-wrapper) {
495
+ .ant-table:not(.ant-table-empty) {
496
+ .ant-table-content {
497
+ min-height: auto !important;
498
+ .ant-table-body {
499
+ min-height: auto !important;
500
+ }
501
+ }
502
+ }
503
+ }
504
+ }
505
+
506
+ // 自定义表格固定高度(通过 table-min-height 属性设置)
507
+ // 只在表格有数据时应用
508
+ :deep(.table-wrapper) {
509
+ .ant-table:not(.ant-table-empty) {
510
+ .ant-table-content {
511
+ .ant-table-body {
512
+ height: calc(var(--table-min-height, 300px) - 50px);
513
+ }
514
+ }
515
+ }
516
+ }
517
+
518
+ // 表格样式
519
+ &.h-form-table-table {
520
+ :deep(.ant-table-small .ant-table-fixed-header) {
521
+ .ant-table-content {
522
+ .ant-table-content {
523
+ .ant-table-body {
524
+ border-radius: 0 0 4px 4px;
525
+ // 修复展开行后固定列与主体错位:保持表体滚动容器为自动滚动
526
+ overflow: auto !important;
527
+ }
528
+ }
529
+ }
530
+ }
531
+ }
532
+ // 移除之前隐藏固定列占位行的样式,保持与主体行数一致
533
+ // 展开行单元格去除额外内边距,避免高度不一致
534
+ :deep(.ant-table-expanded-row > td) {
535
+ padding: 0 !important;
536
+ }
537
+ // 展开内容中的表单/控件去掉外边距,避免撑高
538
+ :deep(.ant-table-expanded-row .ant-form-item) {
539
+ margin-bottom: 0 !important;
540
+ }
541
+
542
+ // 移除之前的隐藏固定列样式,避免展开/合并后操作列消失
543
+ &.h-form-table-dialog-style {
544
+ /* 选择前面的兄弟元素 */
545
+ :global(.ant-col.ant-col-24[name="trGroup"]:has(+ .ant-card .ant-card-body .h-form-table-wrapper.h-form-table-dialog-style)) {
546
+ padding-top: 0px !important;
547
+ padding-left: 0px !important;
548
+ }
549
+
550
+ :global(.ant-card-body:has(.h-form-table-wrapper.h-form-table-dialog-style)) {
551
+ padding-top: 0px !important;
552
+ padding-left: 0px !important;
553
+ }
554
+ }
555
+ // 隐藏按钮区域
556
+ &.h-form-table-button-area-hide {
557
+ :deep(.ant-btn) {
558
+ display: none;
559
+ }
560
+
561
+ :deep(.table-wrapper) {
562
+ margin-top: -39px;
563
+ }
564
+ }
565
+
566
+ // 顶部区域隐藏(与按钮隐藏一致的视觉需求)
567
+ &.h-form-table-top-hidden {
568
+ :deep(.ant-btn) {
569
+ display: none;
570
+ }
571
+
572
+ :deep(.table-wrapper) {
573
+ margin-top: -39px;
574
+ }
575
+ }
576
+
577
+ // 列样式1
578
+ &.h-form-table-formtable-col1 {
579
+ :deep(.table-wrapper) {
580
+ .ant-row {
581
+ .ant-col span {
582
+ border: none;
583
+ width: auto;
584
+ margin-bottom: auto;
585
+ }
586
+ }
587
+
588
+ .ant-table {
589
+ .ant-table-body {
590
+ .ant-table-fixed colgroup col:nth-child(2) {
591
+ width: 50px;
592
+ min-width: 50px;
593
+ }
594
+ }
595
+
596
+ .ant-table-header {
597
+ .ant-table-fixed colgroup col:nth-child(2) {
598
+ width: 50px;
599
+ min-width: 50px;
600
+ }
601
+ }
602
+ }
603
+ }
604
+ }
605
+
606
+ // 底部分页居中 & 自定义分页样式(共用样式)
607
+ &.h-form-table-bottom-center,
608
+ &.h-form-table-custom-pagination {
609
+ :deep(.table-wrapper) {
610
+ .ant-row-flex-start {
611
+ position: relative;
612
+ display: flex;
613
+ align-items: center;
614
+ margin-top: 12px !important;
615
+ height: 32px;
616
+
617
+ // 防止第一个子元素无限拉伸,影响分页居中
618
+ > :first-child {
619
+ flex: 0 0 auto;
620
+ }
621
+
622
+ // 将第二个子元素(分页)绝对居中
623
+ > :nth-child(2) {
624
+ position: absolute;
625
+ left: 50%;
626
+ transform: translateX(-50%);
627
+ }
628
+ }
629
+ }
630
+ }
631
+
632
+ // 按钮行0margin
633
+ &.h-form-table-button-row-0margin {
634
+ :deep(.ant-row) {
635
+ margin: 0px;
636
+ }
637
+ }
638
+ // crud按钮样式
639
+ &.h-form-table-button-style {
640
+ :deep(.ant-btn){
641
+ border-radius: 6px;
642
+ background-color: #FFFFFF;
643
+ border: 1px solid #9499A0;
644
+ color: #313131;
645
+ font-weight: normal;
646
+ letter-spacing: 0em;
647
+ font-size: 16px;
648
+ font-family: "Source Han Sans";
649
+ line-height: normal;
650
+ }
651
+ }
652
+ // 表格内容全部居中样式
653
+ &.h-form-table-header-center {
654
+ :deep(.ant-table-thead > tr > th),
655
+ :deep(.ant-table-tbody > tr > td) {
656
+ text-align: center !important;
657
+ }
658
+ }
659
+ // 行展开白色背景
660
+ &.h-form-table-expanded-grid-white {
661
+ :deep(.ant-table-expanded-row){
662
+ background-color: white;
663
+ }
664
+ }
665
+ // listView模式下隐藏"已选择"按钮(该按钮包含 monitor 图标)
666
+ &.h-form-table-listview-hide-selected {
667
+ :deep(.ant-badge:has(.ant-btn .anticon-monitor)) {
668
+ display: none !important;
669
+ }
670
+ }
671
+ // 报表样式
672
+ @skip-cells: 2;
673
+ &.h-form-table-report-mode {
674
+ --skip-cells: 4;
675
+ :deep(.ant-table-header){
676
+ padding-bottom: 0px !important;
677
+ }
678
+ :deep(.ant-table-content){
679
+ border: 1px solid #E5E9F0;
680
+ }
681
+ :deep(.resize-table-th){
682
+ background-color: white !important;
683
+ }
684
+ :deep(.ant-table-row) {
685
+ .ant-table-row-cell-ellipsis {
686
+ &:nth-child(n + @{skip-cells}) {
687
+ color: #3362DA !important;
688
+ }
689
+ }
690
+ }
691
+ }
692
+ }
693
+ </style>