vue2-client 1.15.26-1 → 1.15.26

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/.history/public/his/editor/editor_20250606134713.html +51 -0
  2. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +509 -0
  3. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +524 -0
  4. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +524 -0
  5. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +524 -0
  6. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +207 -0
  7. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +211 -0
  8. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +212 -0
  9. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +212 -0
  10. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +1320 -0
  11. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +1332 -0
  12. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +1331 -0
  13. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +1331 -0
  14. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +1331 -0
  15. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +1339 -0
  16. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +731 -0
  17. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +748 -0
  18. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +748 -0
  19. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +1071 -0
  20. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +1078 -0
  21. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +1077 -0
  22. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +1077 -0
  23. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +1077 -0
  24. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +442 -0
  25. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +442 -0
  26. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +442 -0
  27. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +475 -0
  28. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +475 -0
  29. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +475 -0
  30. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +477 -0
  31. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +477 -0
  32. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +477 -0
  33. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +473 -0
  34. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +473 -0
  35. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +473 -0
  36. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +473 -0
  37. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +473 -0
  38. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +473 -0
  39. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +473 -0
  40. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +473 -0
  41. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +473 -0
  42. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +473 -0
  43. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +474 -0
  44. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +474 -0
  45. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +474 -0
  46. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +472 -0
  47. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +472 -0
  48. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +472 -0
  49. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +472 -0
  50. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +472 -0
  51. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +472 -0
  52. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +501 -0
  53. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +501 -0
  54. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +501 -0
  55. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +504 -0
  56. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +504 -0
  57. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +504 -0
  58. package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +131 -0
  59. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +160 -0
  60. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +160 -0
  61. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +160 -0
  62. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +158 -0
  63. package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +173 -0
  64. package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +222 -0
  65. package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +229 -0
  66. package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +229 -0
  67. package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +229 -0
  68. package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +241 -0
  69. package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +241 -0
  70. package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +241 -0
  71. package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +245 -0
  72. package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +245 -0
  73. package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +245 -0
  74. package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +255 -0
  75. package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +255 -0
  76. package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +255 -0
  77. package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +270 -0
  78. package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +270 -0
  79. package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +270 -0
  80. package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +270 -0
  81. package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +294 -0
  82. package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +294 -0
  83. package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +294 -0
  84. package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +303 -0
  85. package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +303 -0
  86. package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +303 -0
  87. package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +288 -0
  88. package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +288 -0
  89. package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +288 -0
  90. package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +317 -0
  91. package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +306 -0
  92. package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +306 -0
  93. package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +306 -0
  94. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +222 -0
  95. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +183 -0
  96. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +183 -0
  97. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +183 -0
  98. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +206 -0
  99. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +209 -0
  100. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +242 -0
  101. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +242 -0
  102. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +242 -0
  103. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +251 -0
  104. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +251 -0
  105. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +250 -0
  106. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +250 -0
  107. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +250 -0
  108. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +250 -0
  109. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140844.vue +238 -0
  110. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140910.vue +238 -0
  111. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140912.vue +238 -0
  112. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +36 -0
  113. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +1 -0
  114. package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +4 -2
  115. package/package.json +1 -1
  116. package/src/base-client/components/TreeList/TreeList.vue +91 -0
  117. package/src/base-client/components/TreeList/TreeNode.vue +81 -0
  118. package/src/base-client/components/common/XCardSet/XTiltle.vue +191 -0
  119. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +174 -174
  120. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +314 -314
  121. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  122. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  123. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  124. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  125. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  126. package/src/components/HeightScanner/index.vue +10 -54
  127. package/src/config/CreateQueryConfig.js +325 -325
  128. package/src/pages/XTreeOneProExample/index.vue +67 -67
@@ -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>