vue2-client 1.15.26 → 1.15.27

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 (128) hide show
  1. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +0 -1
  2. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -4
  3. package/package.json +1 -1
  4. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +174 -174
  5. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +314 -314
  6. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  7. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  8. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  9. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  10. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  11. package/src/components/HeightScanner/index.vue +54 -10
  12. package/src/config/CreateQueryConfig.js +325 -325
  13. package/src/pages/XTreeOneProExample/index.vue +67 -67
  14. package/.history/public/his/editor/editor_20250606134713.html +0 -51
  15. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +0 -509
  16. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +0 -524
  17. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +0 -524
  18. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +0 -524
  19. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +0 -207
  20. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +0 -211
  21. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +0 -212
  22. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +0 -212
  23. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +0 -1320
  24. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +0 -1332
  25. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +0 -1331
  26. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +0 -1331
  27. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +0 -1331
  28. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +0 -1339
  29. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +0 -731
  30. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +0 -748
  31. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +0 -748
  32. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +0 -1071
  33. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +0 -1078
  34. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +0 -1077
  35. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +0 -1077
  36. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +0 -1077
  37. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +0 -442
  38. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +0 -442
  39. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +0 -442
  40. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +0 -475
  41. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +0 -475
  42. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +0 -475
  43. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +0 -477
  44. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +0 -477
  45. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +0 -477
  46. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +0 -473
  47. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +0 -473
  48. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +0 -473
  49. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +0 -473
  50. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +0 -473
  51. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +0 -473
  52. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +0 -473
  53. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +0 -473
  54. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +0 -473
  55. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +0 -473
  56. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +0 -474
  57. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +0 -474
  58. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +0 -474
  59. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +0 -472
  60. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +0 -472
  61. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +0 -472
  62. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +0 -472
  63. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +0 -472
  64. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +0 -472
  65. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +0 -501
  66. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +0 -501
  67. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +0 -501
  68. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +0 -504
  69. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +0 -504
  70. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +0 -504
  71. package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +0 -131
  72. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +0 -160
  73. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +0 -160
  74. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +0 -160
  75. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +0 -158
  76. package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +0 -173
  77. package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +0 -222
  78. package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +0 -229
  79. package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +0 -229
  80. package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +0 -229
  81. package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +0 -241
  82. package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +0 -241
  83. package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +0 -241
  84. package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +0 -245
  85. package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +0 -245
  86. package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +0 -245
  87. package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +0 -255
  88. package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +0 -255
  89. package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +0 -255
  90. package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +0 -270
  91. package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +0 -270
  92. package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +0 -270
  93. package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +0 -270
  94. package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +0 -294
  95. package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +0 -294
  96. package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +0 -294
  97. package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +0 -303
  98. package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +0 -303
  99. package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +0 -303
  100. package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +0 -288
  101. package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +0 -288
  102. package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +0 -288
  103. package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +0 -317
  104. package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +0 -306
  105. package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +0 -306
  106. package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +0 -306
  107. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +0 -222
  108. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +0 -183
  109. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +0 -183
  110. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +0 -183
  111. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +0 -206
  112. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +0 -209
  113. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +0 -242
  114. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +0 -242
  115. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +0 -242
  116. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +0 -251
  117. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +0 -251
  118. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +0 -250
  119. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +0 -250
  120. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +0 -250
  121. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +0 -250
  122. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140844.vue +0 -238
  123. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140910.vue +0 -238
  124. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140912.vue +0 -238
  125. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +0 -36
  126. package/src/base-client/components/TreeList/TreeList.vue +0 -91
  127. package/src/base-client/components/TreeList/TreeNode.vue +0 -81
  128. package/src/base-client/components/common/XCardSet/XTiltle.vue +0 -191
@@ -1,314 +1,314 @@
1
- <template>
2
- <a-row id="XDescriptionGroup" :gutter="24">
3
- <a-col :span="4" v-if="showLeftTab && realData.length">
4
- <a-tabs tab-position="left" v-model="activeTab" @change="scrollToGroup">
5
- <template v-for="(item,index) in realData">
6
- <a-tab-pane
7
- :tab="item.title"
8
- :key="index"
9
- v-if="item.title">
10
- </a-tab-pane>
11
- </template>
12
- </a-tabs>
13
- </a-col>
14
- <a-col :span="showLeftTab ? 20 : 24" ref="descriptionsGroupContext" class="descriptionsGroupContext">
15
- <div
16
- class="descriptions-item"
17
- :ref="`descriptions-item-${realDataIndex}`"
18
- :key="realDataIndex"
19
- v-for="(realDataItem, realDataIndex) in realData">
20
- <template v-if="!loadError">
21
- <!-- 带有子的详情 -->
22
- <template
23
- v-if="realDataItem.title && groups[realDataItem.title]?.type ==='array'"
24
- >
25
- <div class="ant-descriptions-title">{{ realDataItem.title }}</div>
26
- <div class="descriptions-array-item">
27
- <a-descriptions
28
- v-for="(arrayItem,arrayIndex) in realDataItem.column"
29
- :column="isMobile ? 1 : column"
30
- size="small"
31
- :key="arrayIndex"
32
- :title="arrayItem.title">
33
- {{ arrayItem }}
34
- <template v-for="(item, index) in arrayItem.column">
35
- <!-- 大多数情况 循环下 空值省略不展示,todo 后期可能加配置处理 -->
36
- <a-descriptions-item
37
- :key="index"
38
- v-if="item.value"
39
- :label="item.key">
40
- {{ formatText(item.value) }}
41
- </a-descriptions-item>
42
- </template>
43
- </a-descriptions>
44
- </div>
45
- </template>
46
- <a-descriptions
47
- v-else-if="realDataItem.title"
48
- :column="isMobile ? 1 : column"
49
- :title="realDataItem.title">
50
- <a-descriptions-item
51
- v-for="(item, index) in realDataItem.column"
52
- :key="index"
53
- :span="item.span || 1"
54
- :label="item.key">
55
- <nobr>{{ item.value || '--' }}</nobr>
56
- </a-descriptions-item>
57
- </a-descriptions>
58
- </template>
59
- </div>
60
- </a-col>
61
- </a-row>
62
- </template>
63
- <script>
64
-
65
- import { mapState } from 'vuex'
66
- import { getRealKeyData } from '@vue2-client/utils/formatter'
67
- import { getConfigByName } from '@vue2-client/services/api/common'
68
- import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
69
-
70
- export default {
71
- name: 'XDescriptionsGroup',
72
- components: {
73
- XAddNativeForm
74
- },
75
- props: {
76
- // 内容
77
- data: {
78
- type: Object,
79
- required: true,
80
- default: undefined
81
- },
82
- // 展示列配置 格式 {title:[{key,name}]} {描述列表标题:[{字段名,字段中文名}]}
83
- // {
84
- // "groups": {
85
- // "表具信息": {
86
- // "f_gasbrand": "气表品牌"
87
- // },
88
- // "客户信息": {
89
- // "f_userinfo_code": "用户编号"
90
- // },
91
- // "设备信息":{
92
- // "type": "array",
93
- // "value": {
94
- // "f_devices_num": "设备数量",
95
- // "f_devices_type": "设备类型",
96
- // },
97
- // "key": "devices"
98
- // }
99
- // }
100
- // }
101
- // 数据模式结构
102
- // "groups": [{
103
- // "name": "客户信息",
104
- // "fields": [
105
- // {
106
- // "name": "备注",
107
- // "key": "f_comments",
108
- // "span": 3
109
- // },
110
- // {
111
- // "name": "地址",
112
- // "key": "f_address",
113
- // "span": 3
114
- // }]
115
- // }]
116
- configName: {
117
- type: String,
118
- required: true,
119
- default: ''
120
- },
121
- // 配置所属命名空间
122
- serviceName: {
123
- type: String,
124
- default: process.env.VUE_APP_SYSTEM_NAME
125
- },
126
- // 每列显示数量
127
- column: {
128
- type: Number,
129
- default: 3
130
- },
131
- // 处理 key tuf_f_userinfo_id -> f_userinfo_id
132
- getRealData: {
133
- type: Boolean,
134
- default: false
135
- },
136
- // 是否展示左侧tab
137
- showLeftTab: {
138
- type: Boolean,
139
- default: false
140
- }
141
- },
142
- mounted () {
143
- },
144
- beforeDestroy () {
145
- const formGroupContext = this.$refs.formGroupContext?.$el
146
- if (formGroupContext && formGroupContext.removeEventListener) {
147
- formGroupContext.removeEventListener('scroll', this.onScroll)
148
- }
149
- },
150
- created () {
151
- this.initConfig()
152
- },
153
- data () {
154
- return {
155
- // 加载状态
156
- loading: false,
157
- loadError: false,
158
- realData: [],
159
- // 获取到的配置组
160
- groups: {},
161
- activeTab: 0
162
- }
163
- },
164
- computed: {
165
- ...mapState('setting', { isMobile: 'isMobile' })
166
- },
167
- methods: {
168
- initConfig () {
169
- this.loading = true
170
- if (this.configName) {
171
- this.getConfig()
172
- this.$nextTick(() => {
173
- const formGroupContext = this.$refs.descriptionsGroupContext?.$el
174
- if (formGroupContext && formGroupContext.addEventListener) {
175
- formGroupContext.addEventListener('scroll', this.onScroll)
176
- }
177
- })
178
- } else {
179
- this.loading = false
180
- this.loadError = true
181
- }
182
- },
183
- scrollToGroup (index) {
184
- const groupElement = this.$refs[`descriptions-item-${index}`][0]
185
- if (groupElement) {
186
- groupElement.scrollIntoView({ behavior: 'smooth' })
187
- }
188
- },
189
- getConfig () {
190
- getConfigByName(this.configName, this.serviceName, (res) => {
191
- if (res.groups) {
192
- const groups = Array.isArray(res.groups)
193
- ? res.groups
194
- : Object.entries(res.groups).map(([groupName, groupConfig]) => {
195
- if (groupConfig.type === 'array') {
196
- return {
197
- name: groupName,
198
- type: 'array',
199
- key: groupConfig.key,
200
- fields: Object.entries(groupConfig.value || {}).map(([k, v]) => ({
201
- key: k,
202
- name: v
203
- }))
204
- }
205
- }
206
-
207
- // 处理普通旧格式配置
208
- return {
209
- name: groupName,
210
- fields: Object.entries(groupConfig).map(([fieldKey, fieldValue]) => ({
211
- key: fieldKey,
212
- name: typeof fieldValue === 'string' ? fieldValue : fieldValue.name,
213
- ...(typeof fieldValue === 'object' ? fieldValue : {})
214
- }))
215
- }
216
- })
217
-
218
- this.groups = groups
219
- this.realData = groups.map(group => {
220
- const dataItem = { title: group.name }
221
-
222
- if (group.type === 'array') {
223
- // 处理数组类型数据
224
- const arrayData = this.data[group.key] || []
225
- dataItem.column = arrayData.map((item, index) => ({
226
- title: `${group.name} ${index + 1}`,
227
- column: group.fields.map(field => ({
228
- key: field.name,
229
- value: item[field.key]
230
- }))
231
- })).filter(Boolean)
232
- } else {
233
- dataItem.column = group.fields.map(field => ({
234
- key: field.name,
235
- value: this.getRealKeyData(this.data, field.key),
236
- span: field.span
237
- }))
238
- }
239
-
240
- return dataItem.column.length > 0 ? dataItem : null
241
- }).filter(Boolean)
242
- }
243
- })
244
- },
245
- // 文字格式化
246
- formatText (value) {
247
- return value ?? '--'
248
- },
249
- getRealKeyData (data, key) {
250
- if (this.getRealData) {
251
- return getRealKeyData(data)[key] || ''
252
- } else {
253
- return this.data[key] || ''
254
- }
255
- },
256
- onScroll () {
257
- const formGroupContext = this.$refs.descriptionsGroupContext.$el
258
- let groupItems = []
259
- if (formGroupContext && formGroupContext.querySelectorAll) {
260
- groupItems = formGroupContext.querySelectorAll('.descriptions-item')
261
- }
262
- let activeIndex = this.activeTab
263
-
264
- groupItems.forEach((item, index) => {
265
- const rect = item.getBoundingClientRect()
266
- if (rect.top <= 205 && rect.bottom > 200) {
267
- activeIndex = index
268
- }
269
- })
270
- this.activeTab = activeIndex
271
- }
272
- },
273
- watch: {
274
- content: {
275
- handler () {
276
- this.initConfig()
277
- }
278
- },
279
- configName: {
280
- handler () {
281
- this.initConfig()
282
- }
283
- },
284
- serviceName: {
285
- handler () {
286
- this.initConfig()
287
- }
288
- }
289
- }
290
- }
291
- </script>
292
-
293
- <style lang="less" scoped>
294
- #XDescriptionGroup {
295
- height: 100%;
296
-
297
- :deep(.ant-descriptions-title) {
298
- color: @primary-color;
299
- }
300
-
301
- .descriptions-item {
302
- margin-bottom: 8px;
303
- }
304
-
305
- .descriptions-array-item {
306
- padding-left: 1rem;
307
- }
308
-
309
- .descriptionsGroupContext {
310
- height: 100%;
311
- overflow-y: scroll;
312
- }
313
- }
314
- </style>
1
+ <template>
2
+ <a-row id="XDescriptionGroup" :gutter="24">
3
+ <a-col :span="4" v-if="showLeftTab && realData.length">
4
+ <a-tabs tab-position="left" v-model="activeTab" @change="scrollToGroup">
5
+ <template v-for="(item,index) in realData">
6
+ <a-tab-pane
7
+ :tab="item.title"
8
+ :key="index"
9
+ v-if="item.title">
10
+ </a-tab-pane>
11
+ </template>
12
+ </a-tabs>
13
+ </a-col>
14
+ <a-col :span="showLeftTab ? 20 : 24" ref="descriptionsGroupContext" class="descriptionsGroupContext">
15
+ <div
16
+ class="descriptions-item"
17
+ :ref="`descriptions-item-${realDataIndex}`"
18
+ :key="realDataIndex"
19
+ v-for="(realDataItem, realDataIndex) in realData">
20
+ <template v-if="!loadError">
21
+ <!-- 带有子的详情 -->
22
+ <template
23
+ v-if="realDataItem.title && groups[realDataItem.title]?.type ==='array'"
24
+ >
25
+ <div class="ant-descriptions-title">{{ realDataItem.title }}</div>
26
+ <div class="descriptions-array-item">
27
+ <a-descriptions
28
+ v-for="(arrayItem,arrayIndex) in realDataItem.column"
29
+ :column="isMobile ? 1 : column"
30
+ size="small"
31
+ :key="arrayIndex"
32
+ :title="arrayItem.title">
33
+ {{ arrayItem }}
34
+ <template v-for="(item, index) in arrayItem.column">
35
+ <!-- 大多数情况 循环下 空值省略不展示,todo 后期可能加配置处理 -->
36
+ <a-descriptions-item
37
+ :key="index"
38
+ v-if="item.value"
39
+ :label="item.key">
40
+ {{ formatText(item.value) }}
41
+ </a-descriptions-item>
42
+ </template>
43
+ </a-descriptions>
44
+ </div>
45
+ </template>
46
+ <a-descriptions
47
+ v-else-if="realDataItem.title"
48
+ :column="isMobile ? 1 : column"
49
+ :title="realDataItem.title">
50
+ <a-descriptions-item
51
+ v-for="(item, index) in realDataItem.column"
52
+ :key="index"
53
+ :span="item.span || 1"
54
+ :label="item.key">
55
+ <nobr>{{ item.value || '--' }}</nobr>
56
+ </a-descriptions-item>
57
+ </a-descriptions>
58
+ </template>
59
+ </div>
60
+ </a-col>
61
+ </a-row>
62
+ </template>
63
+ <script>
64
+
65
+ import { mapState } from 'vuex'
66
+ import { getRealKeyData } from '@vue2-client/utils/formatter'
67
+ import { getConfigByName } from '@vue2-client/services/api/common'
68
+ import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
69
+
70
+ export default {
71
+ name: 'XDescriptionsGroup',
72
+ components: {
73
+ XAddNativeForm
74
+ },
75
+ props: {
76
+ // 内容
77
+ data: {
78
+ type: Object,
79
+ required: true,
80
+ default: undefined
81
+ },
82
+ // 展示列配置 格式 {title:[{key,name}]} {描述列表标题:[{字段名,字段中文名}]}
83
+ // {
84
+ // "groups": {
85
+ // "表具信息": {
86
+ // "f_gasbrand": "气表品牌"
87
+ // },
88
+ // "客户信息": {
89
+ // "f_userinfo_code": "用户编号"
90
+ // },
91
+ // "设备信息":{
92
+ // "type": "array",
93
+ // "value": {
94
+ // "f_devices_num": "设备数量",
95
+ // "f_devices_type": "设备类型",
96
+ // },
97
+ // "key": "devices"
98
+ // }
99
+ // }
100
+ // }
101
+ // 数据模式结构
102
+ // "groups": [{
103
+ // "name": "客户信息",
104
+ // "fields": [
105
+ // {
106
+ // "name": "备注",
107
+ // "key": "f_comments",
108
+ // "span": 3
109
+ // },
110
+ // {
111
+ // "name": "地址",
112
+ // "key": "f_address",
113
+ // "span": 3
114
+ // }]
115
+ // }]
116
+ configName: {
117
+ type: String,
118
+ required: true,
119
+ default: ''
120
+ },
121
+ // 配置所属命名空间
122
+ serviceName: {
123
+ type: String,
124
+ default: process.env.VUE_APP_SYSTEM_NAME
125
+ },
126
+ // 每列显示数量
127
+ column: {
128
+ type: Number,
129
+ default: 3
130
+ },
131
+ // 处理 key tuf_f_userinfo_id -> f_userinfo_id
132
+ getRealData: {
133
+ type: Boolean,
134
+ default: false
135
+ },
136
+ // 是否展示左侧tab
137
+ showLeftTab: {
138
+ type: Boolean,
139
+ default: false
140
+ }
141
+ },
142
+ mounted () {
143
+ },
144
+ beforeDestroy () {
145
+ const formGroupContext = this.$refs.formGroupContext?.$el
146
+ if (formGroupContext && formGroupContext.removeEventListener) {
147
+ formGroupContext.removeEventListener('scroll', this.onScroll)
148
+ }
149
+ },
150
+ created () {
151
+ this.initConfig()
152
+ },
153
+ data () {
154
+ return {
155
+ // 加载状态
156
+ loading: false,
157
+ loadError: false,
158
+ realData: [],
159
+ // 获取到的配置组
160
+ groups: {},
161
+ activeTab: 0
162
+ }
163
+ },
164
+ computed: {
165
+ ...mapState('setting', { isMobile: 'isMobile' })
166
+ },
167
+ methods: {
168
+ initConfig () {
169
+ this.loading = true
170
+ if (this.configName) {
171
+ this.getConfig()
172
+ this.$nextTick(() => {
173
+ const formGroupContext = this.$refs.descriptionsGroupContext?.$el
174
+ if (formGroupContext && formGroupContext.addEventListener) {
175
+ formGroupContext.addEventListener('scroll', this.onScroll)
176
+ }
177
+ })
178
+ } else {
179
+ this.loading = false
180
+ this.loadError = true
181
+ }
182
+ },
183
+ scrollToGroup (index) {
184
+ const groupElement = this.$refs[`descriptions-item-${index}`][0]
185
+ if (groupElement) {
186
+ groupElement.scrollIntoView({ behavior: 'smooth' })
187
+ }
188
+ },
189
+ getConfig () {
190
+ getConfigByName(this.configName, this.serviceName, (res) => {
191
+ if (res.groups) {
192
+ const groups = Array.isArray(res.groups)
193
+ ? res.groups
194
+ : Object.entries(res.groups).map(([groupName, groupConfig]) => {
195
+ if (groupConfig.type === 'array') {
196
+ return {
197
+ name: groupName,
198
+ type: 'array',
199
+ key: groupConfig.key,
200
+ fields: Object.entries(groupConfig.value || {}).map(([k, v]) => ({
201
+ key: k,
202
+ name: v
203
+ }))
204
+ }
205
+ }
206
+
207
+ // 处理普通旧格式配置
208
+ return {
209
+ name: groupName,
210
+ fields: Object.entries(groupConfig).map(([fieldKey, fieldValue]) => ({
211
+ key: fieldKey,
212
+ name: typeof fieldValue === 'string' ? fieldValue : fieldValue.name,
213
+ ...(typeof fieldValue === 'object' ? fieldValue : {})
214
+ }))
215
+ }
216
+ })
217
+
218
+ this.groups = groups
219
+ this.realData = groups.map(group => {
220
+ const dataItem = { title: group.name }
221
+
222
+ if (group.type === 'array') {
223
+ // 处理数组类型数据
224
+ const arrayData = this.data[group.key] || []
225
+ dataItem.column = arrayData.map((item, index) => ({
226
+ title: `${group.name} ${index + 1}`,
227
+ column: group.fields.map(field => ({
228
+ key: field.name,
229
+ value: item[field.key]
230
+ }))
231
+ })).filter(Boolean)
232
+ } else {
233
+ dataItem.column = group.fields.map(field => ({
234
+ key: field.name,
235
+ value: this.getRealKeyData(this.data, field.key),
236
+ span: field.span
237
+ }))
238
+ }
239
+
240
+ return dataItem.column.length > 0 ? dataItem : null
241
+ }).filter(Boolean)
242
+ }
243
+ })
244
+ },
245
+ // 文字格式化
246
+ formatText (value) {
247
+ return value ?? '--'
248
+ },
249
+ getRealKeyData (data, key) {
250
+ if (this.getRealData) {
251
+ return getRealKeyData(data)[key] || ''
252
+ } else {
253
+ return this.data[key] || ''
254
+ }
255
+ },
256
+ onScroll () {
257
+ const formGroupContext = this.$refs.descriptionsGroupContext.$el
258
+ let groupItems = []
259
+ if (formGroupContext && formGroupContext.querySelectorAll) {
260
+ groupItems = formGroupContext.querySelectorAll('.descriptions-item')
261
+ }
262
+ let activeIndex = this.activeTab
263
+
264
+ groupItems.forEach((item, index) => {
265
+ const rect = item.getBoundingClientRect()
266
+ if (rect.top <= 205 && rect.bottom > 200) {
267
+ activeIndex = index
268
+ }
269
+ })
270
+ this.activeTab = activeIndex
271
+ }
272
+ },
273
+ watch: {
274
+ content: {
275
+ handler () {
276
+ this.initConfig()
277
+ }
278
+ },
279
+ configName: {
280
+ handler () {
281
+ this.initConfig()
282
+ }
283
+ },
284
+ serviceName: {
285
+ handler () {
286
+ this.initConfig()
287
+ }
288
+ }
289
+ }
290
+ }
291
+ </script>
292
+
293
+ <style lang="less" scoped>
294
+ #XDescriptionGroup {
295
+ height: 100%;
296
+
297
+ :deep(.ant-descriptions-title) {
298
+ color: @primary-color;
299
+ }
300
+
301
+ .descriptions-item {
302
+ margin-bottom: 8px;
303
+ }
304
+
305
+ .descriptions-array-item {
306
+ padding-left: 1rem;
307
+ }
308
+
309
+ .descriptionsGroupContext {
310
+ height: 100%;
311
+ overflow-y: scroll;
312
+ }
313
+ }
314
+ </style>