vue2-client 1.18.32 → 1.18.33

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 (105) hide show
  1. package/.eslintrc.js +90 -90
  2. package/Components.md +60 -60
  3. package/docs/index.md +30 -30
  4. package/index.js +31 -31
  5. package/jest-transform-stub.js +8 -8
  6. package/jest.setup.js +7 -7
  7. package/package.json +1 -1
  8. package/src/assets/img/querySlotDemo.svg +15 -15
  9. package/src/assets/svg/female.svg +1 -1
  10. package/src/assets/svg/male.svg +1 -1
  11. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  12. package/src/base-client/components/common/CitySelect/index.js +3 -3
  13. package/src/base-client/components/common/CitySelect/index.md +109 -109
  14. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  15. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  16. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  17. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  18. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  19. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  20. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  21. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  22. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  23. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  24. package/src/base-client/components/common/HIS/HFormGroup/index.js +3 -3
  25. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  26. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  27. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  28. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  29. package/src/base-client/components/common/Tree/index.js +2 -2
  30. package/src/base-client/components/common/Upload/index.js +3 -3
  31. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  32. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  33. package/src/base-client/components/common/XCollapse/XCollapse.vue +830 -830
  34. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  35. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  36. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  37. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  38. package/src/base-client/components/common/XDescriptions/index.md +322 -322
  39. package/src/base-client/components/common/XForm/index.md +178 -178
  40. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +6 -3
  41. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  42. package/src/base-client/components/common/XStepView/index.js +3 -3
  43. package/src/base-client/components/common/XStepView/index.md +31 -31
  44. package/src/base-client/components/common/XTable/XTable.vue +1715 -1715
  45. package/src/base-client/components/common/XTable/index.md +255 -255
  46. package/src/base-client/components/common/XTimeline/XTimeline.vue +477 -477
  47. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +705 -705
  48. package/src/base-client/components/his/XList/XList.vue +938 -938
  49. package/src/base-client/components/his/XSimpleTable/XSimpleTable.vue +443 -44
  50. package/src/base-client/components/his/XTimeSelect/XTimeSelect.vue +354 -354
  51. package/src/base-client/components/his/XTitle/XTitle.vue +314 -314
  52. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +341 -341
  53. package/src/base-client/components/his/threeTestOrders/editor.vue +113 -113
  54. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  55. package/src/base-client/plugins/Config.js +19 -19
  56. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  57. package/src/components/Charts/Bar.vue +62 -62
  58. package/src/components/Charts/ChartCard.vue +134 -134
  59. package/src/components/Charts/Liquid.vue +67 -67
  60. package/src/components/Charts/MiniArea.vue +39 -39
  61. package/src/components/Charts/MiniBar.vue +39 -39
  62. package/src/components/Charts/MiniProgress.vue +75 -75
  63. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  64. package/src/components/Charts/Radar.vue +68 -68
  65. package/src/components/Charts/RankList.vue +77 -77
  66. package/src/components/Charts/TagCloud.vue +113 -113
  67. package/src/components/Charts/TransferBar.vue +64 -64
  68. package/src/components/Charts/Trend.vue +82 -82
  69. package/src/components/Charts/chart.less +12 -12
  70. package/src/components/Charts/smooth.area.less +13 -13
  71. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  72. package/src/components/NumberInfo/index.js +3 -3
  73. package/src/components/NumberInfo/index.less +54 -54
  74. package/src/components/NumberInfo/index.md +43 -43
  75. package/src/components/card/ChartCard.vue +79 -79
  76. package/src/components/chart/Bar.vue +60 -60
  77. package/src/components/chart/MiniArea.vue +67 -67
  78. package/src/components/chart/MiniBar.vue +59 -59
  79. package/src/components/chart/MiniProgress.vue +57 -57
  80. package/src/components/chart/Radar.vue +80 -80
  81. package/src/components/chart/RankingList.vue +60 -60
  82. package/src/components/chart/Trend.vue +79 -79
  83. package/src/components/chart/index.less +9 -9
  84. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  85. package/src/components/input/IInput.vue +66 -66
  86. package/src/components/menu/SideMenu.vue +75 -75
  87. package/src/components/menu/menu.js +273 -273
  88. package/src/components/tool/AStepItem.vue +60 -60
  89. package/src/layouts/CommonLayout.vue +56 -56
  90. package/src/layouts/header/HeaderNotice.vue +177 -177
  91. package/src/lib.js +1 -1
  92. package/src/mock/extend/index.js +84 -84
  93. package/src/mock/goods/index.js +108 -108
  94. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  95. package/src/pages/system/dictionary/index.vue +44 -44
  96. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  97. package/src/pages/system/monitor/operLog/index.vue +37 -37
  98. package/src/pages/userInfoDetailManage/ExceptionRecordQuery/index.vue +45 -45
  99. package/src/services/api/cas.js +79 -79
  100. package/src/store/modules/setting.js +119 -119
  101. package/src/utils/authority-utils.js +85 -85
  102. package/src/utils/errorCode.js +6 -6
  103. package/src-base-client/components/common/HIS/HForm/HForm.vue +347 -0
  104. package/src-base-client/components/common/XCollapse/XCollapse.vue +0 -0
  105. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,341 +1,341 @@
1
- <template>
2
- <div class="tree-container x-tree-rows-wrapper" :class="wrapperClassObject" :style="config?.componentStyle || ''">
3
- <div class="tree-header">
4
- <span class="tree-title" :style="config.style">{{ title }}</span>
5
- <span class="tree-expand-all" @click="isToOpenAll" v-if="isShowOpen">
6
- {{ isExpanded ? '收起' : '全部展开' }}
7
- </span>
8
- </div>
9
- <div class="tree-list">
10
- <tree-node
11
- v-for="node in showData"
12
- :key="node.id"
13
- :node="node"
14
- :selected="node.selected"
15
- @toggle="toggleNode"/>
16
- </div>
17
- </div>
18
- </template>
19
-
20
- <script>
21
- import TreeNode from '@vue2-client/base-client/components/his/XTreeRows/TreeNode.vue'
22
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
23
-
24
- export default {
25
- name: 'XTreeRows',
26
- components: {
27
- TreeNode
28
- },
29
- props: {
30
- queryParamsName: {
31
- type: String,
32
- default: ''
33
- },
34
- isOpenAll: {
35
- type: Boolean,
36
- default: false
37
- },
38
- parameter: {
39
- type: Object,
40
- default: () => {
41
- return {}
42
- }
43
- },
44
- // 父组件索引
45
- ipanelIndex: {
46
- type: Number,
47
- default: ''
48
- }
49
- },
50
- data () {
51
- return {
52
- treeData: [
53
- // {
54
- // id: '1',
55
- // title: '体征',
56
- // expanded: false,
57
- // children: [
58
- // {
59
- // id: '1-1',
60
- // title: '一般情况'
61
- // },
62
- // {
63
- // id: '1-2',
64
- // title: '皮肤粘膜'
65
- // },
66
- // {
67
- // id: '1-3',
68
- // title: '头颈',
69
- // expanded: false,
70
- // children: [
71
- // {
72
- // id: '1-3-1',
73
- // title: '头部头部头部头部头部头部头部头部头部头部头部头部头部头部',
74
- // expanded: false,
75
- // children: [
76
- // {
77
- // id: '1-3-1-1',
78
- // title: '123456'
79
- // }
80
- // ]
81
- // },
82
- // {
83
- // id: '1-2-2',
84
- // title: '颈部'
85
- // }
86
- // ]
87
- // },
88
- // {
89
- // id: '1-4',
90
- // title: '胸部'
91
- // },
92
- // ]
93
- // }
94
- ],
95
- isExpanded: false,
96
- showData: [],
97
- isShowOpen: true,
98
- title: '标题',
99
- config: {},
100
- lastSelectedNode: null // 记录最后选中的节点
101
- }
102
- },
103
- computed: {
104
- // 基于 $attrs 的样式类开关(参考 XInput.vue 模式)
105
- wrapperClassObject () {
106
- const attrs = this.$attrs || {}
107
- const classes = {}
108
- const booleanStyleKeys = [
109
- 'user-entry'
110
- ]
111
- booleanStyleKeys.forEach(key => {
112
- const val = attrs[key]
113
- const truthy = val === true || val === '' || val === 'true'
114
- if (truthy) classes[`xtreerows-${key}`] = true
115
- })
116
- const size = attrs.size
117
- if (size && typeof size === 'string') classes[`xtreerows-size-${size}`] = true
118
- return classes
119
- }
120
- },
121
- mounted () {
122
- console.log('实例化')
123
- this.$emit('component-mounted', this) // 向父组件发送实例
124
- },
125
- methods: {
126
- /**
127
- * 递归查找匹配 title 的节点及其路径
128
- * @param {Array} nodes 要搜索的节点数组
129
- * @param {string} title 要匹配的标题
130
- * @param {Array} path 当前路径
131
- * @returns {Object|null} 包含节点和路径的对象
132
- */
133
- findNodeAndPathByTitle (nodes, title, path = []) {
134
- for (const node of nodes) {
135
- const currentPath = [...path, node]
136
- if (node.title === title) {
137
- return { node, path: currentPath }
138
- }
139
- if (node.children && node.children.length) {
140
- const found = this.findNodeAndPathByTitle(node.children, title, currentPath)
141
- if (found) return found
142
- }
143
- }
144
- return null
145
- },
146
-
147
- /**
148
- * 展开节点路径
149
- * @param {Array} path 节点路径
150
- */
151
- expandNodePath (path) {
152
- // 展开除最后一个节点外的所有节点(即所有父节点)
153
- for (let i = 0; i < path.length - 1; i++) {
154
- path[i].expanded = true
155
- }
156
- },
157
- searchTitleToggle (title) {
158
- // 清除之前选中的节点
159
- if (this.lastSelectedNode) {
160
- this.$set(this.lastSelectedNode, 'selected', false) // 改用Vue.set
161
- }
162
- const result = this.findNodeAndPathByTitle(this.showData, title)
163
- if (result) {
164
- if (result.node.children.length > 0) {
165
- this.toggleNode(result.node)
166
- } else {
167
- this.expandNodePath(result.path)
168
- }
169
- this.$set(result.node, 'selected', true) // 使用Vue.set确保响应性
170
- this.lastSelectedNode = result.node
171
- this.$emit('search-complete', {
172
- hasMatch: true,
173
- panelIndex: this.ipanelIndex // 接收父组件传入的面板索引
174
- })
175
- // 滚动到目标节点
176
- this.$nextTick(() => {
177
- this.scrollToNode(result.node.id)
178
- })
179
- } else {
180
- this.$emit('search-complete', { hasMatch: false })
181
- }
182
- },
183
- /**
184
- * 滚动到指定节点
185
- * @param {string} nodeId 节点ID
186
- */
187
- scrollToNode (nodeId) {
188
- const nodeElement = document.querySelector(`[data-node-id="${nodeId}"]`)
189
- if (nodeElement) {
190
- nodeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
191
- }
192
- },
193
- toggleNode (node) {
194
- node.expanded = !node.expanded
195
- this.$emit('node-toggle', node)
196
- },
197
- isToOpenAll () {
198
- this.isExpanded = !this.isExpanded
199
- this.expandAllNodes(this.showData, this.isExpanded)
200
- this.$emit('isOpenAll', this.isExpanded)
201
- },
202
- expandAllNodes (nodes, expand) {
203
- nodes.forEach(node => {
204
- if (node.children && node.children.length > 0) {
205
- node.expanded = expand
206
- this.expandAllNodes(node.children, expand)
207
- }
208
- })
209
- },
210
- /**
211
- * 构建树数据
212
- * @param allData 子节点所有数据
213
- * @param gid 根节点id
214
- * @returns {*|*[]}
215
- */
216
- buildTreeByRootId (allData, gid) {
217
- // 1. 找到所有直接子节点
218
- const directChildren = allData.filter(item => item.pid === gid)
219
- if (directChildren.length === 0) return [] // 如果没有子节点,返回空数组
220
- // 2. 递归构建子树
221
- const buildTree = (parentId) => {
222
- const children = allData.filter(item => item.pid === parentId)
223
- return children.map(child => ({
224
- title: child.label,
225
- id: child.value,
226
- children: buildTree(child.value), // 递归处理子节点
227
- }))
228
- }
229
- // 3. 返回直接子节点的完整子树
230
- return directChildren.map(child => ({
231
- title: child.label,
232
- id: child.value,
233
- children: buildTree(child.value),
234
- expanded: false
235
- }))
236
- },
237
- init (config, parameterData) {
238
- getConfigByName(config, 'af-his', res => {
239
- this.isShowOpen = res.isShowOpen
240
- this.title = res.title
241
- this.config = res
242
- if (!res.isCheck) {
243
- this.showData = res.showData
244
- return
245
- }
246
- const parameter = { ...parameterData, ...this.parameter }
247
- runLogic(res.logicName, parameter, 'af-his').then(result => {
248
- if (result.isConstruction) { // 对数据重新构造
249
- this.showData = this.buildTreeByRootId(result.allData, result.gId)
250
- } else {
251
- this.showData = result
252
- }
253
- })
254
- })
255
- }
256
- },
257
- watch: {
258
- queryParamsName: {
259
- immediate: true,
260
- handler (newValue) {
261
- console.log(newValue)
262
- this.init(newValue, {})
263
- },
264
- deep: true
265
- }
266
- }
267
- }
268
- </script>
269
-
270
- <style scoped lang="less">
271
- .tree-container {
272
- width: 100%;
273
- height: 320px;
274
- overflow-y: auto;
275
- overflow-x: auto;
276
- padding: 6px;
277
- box-sizing: border-box;
278
- }
279
- /* 自定义滚动条样式 */
280
- .tree-container::-webkit-scrollbar {
281
- width: 4px;
282
- height: 4px;
283
- }
284
- .tree-container::-webkit-scrollbar-thumb {
285
- background-color: #ccc;
286
- border-radius: 2px;
287
- }
288
- .tree-container::-webkit-scrollbar-track {
289
- background-color: #f5f5f5;
290
- }
291
- .tree-list {
292
- font-size: 14px;
293
- min-width: 100%;
294
- }
295
-
296
- .tree-header {
297
- padding: 8px 4px;
298
- border-bottom: 1px solid #e8e8e8;
299
- margin-bottom: 8px;
300
- position: sticky;
301
- top: 0;
302
- background-color: #fff;
303
- z-index: 1;
304
- }
305
-
306
- .tree-title {
307
- font-size: 16px;
308
- font-weight: 700;
309
- color:#5D5C5C;
310
- }
311
-
312
- .tree-expand-all {
313
- float: right;
314
- margin-right: 15px;
315
- font-size: 14px;
316
- font-weight: 400;
317
- color: #5D5C5C;
318
- cursor: pointer;
319
- user-select: none;
320
- }
321
-
322
- .tree-expand-all:hover {
323
- color: #989a9a;
324
- }
325
-
326
- /* user-entry 样式:字体与内容区域边距(参考需求) */
327
- .x-tree-rows-wrapper {
328
- &.xtreerows-user-entry{
329
- padding: 14px 0 20px 47px;
330
- .tree-list {
331
- font-family: 'Source Han Sans', sans-serif;
332
- font-size: 16px;
333
- font-weight: normal;
334
- line-height: 18px;
335
- letter-spacing: 0em;
336
- font-feature-settings: "kern" on;
337
- color: #313131;
338
- }
339
- }
340
- }
341
- </style>
1
+ <template>
2
+ <div class="tree-container x-tree-rows-wrapper" :class="wrapperClassObject" :style="config?.componentStyle || ''">
3
+ <div class="tree-header">
4
+ <span class="tree-title" :style="config.style">{{ title }}</span>
5
+ <span class="tree-expand-all" @click="isToOpenAll" v-if="isShowOpen">
6
+ {{ isExpanded ? '收起' : '全部展开' }}
7
+ </span>
8
+ </div>
9
+ <div class="tree-list">
10
+ <tree-node
11
+ v-for="node in showData"
12
+ :key="node.id"
13
+ :node="node"
14
+ :selected="node.selected"
15
+ @toggle="toggleNode"/>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import TreeNode from '@vue2-client/base-client/components/his/XTreeRows/TreeNode.vue'
22
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
23
+
24
+ export default {
25
+ name: 'XTreeRows',
26
+ components: {
27
+ TreeNode
28
+ },
29
+ props: {
30
+ queryParamsName: {
31
+ type: String,
32
+ default: ''
33
+ },
34
+ isOpenAll: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ parameter: {
39
+ type: Object,
40
+ default: () => {
41
+ return {}
42
+ }
43
+ },
44
+ // 父组件索引
45
+ ipanelIndex: {
46
+ type: Number,
47
+ default: ''
48
+ }
49
+ },
50
+ data () {
51
+ return {
52
+ treeData: [
53
+ // {
54
+ // id: '1',
55
+ // title: '体征',
56
+ // expanded: false,
57
+ // children: [
58
+ // {
59
+ // id: '1-1',
60
+ // title: '一般情况'
61
+ // },
62
+ // {
63
+ // id: '1-2',
64
+ // title: '皮肤粘膜'
65
+ // },
66
+ // {
67
+ // id: '1-3',
68
+ // title: '头颈',
69
+ // expanded: false,
70
+ // children: [
71
+ // {
72
+ // id: '1-3-1',
73
+ // title: '头部头部头部头部头部头部头部头部头部头部头部头部头部头部',
74
+ // expanded: false,
75
+ // children: [
76
+ // {
77
+ // id: '1-3-1-1',
78
+ // title: '123456'
79
+ // }
80
+ // ]
81
+ // },
82
+ // {
83
+ // id: '1-2-2',
84
+ // title: '颈部'
85
+ // }
86
+ // ]
87
+ // },
88
+ // {
89
+ // id: '1-4',
90
+ // title: '胸部'
91
+ // },
92
+ // ]
93
+ // }
94
+ ],
95
+ isExpanded: false,
96
+ showData: [],
97
+ isShowOpen: true,
98
+ title: '标题',
99
+ config: {},
100
+ lastSelectedNode: null // 记录最后选中的节点
101
+ }
102
+ },
103
+ computed: {
104
+ // 基于 $attrs 的样式类开关(参考 XInput.vue 模式)
105
+ wrapperClassObject () {
106
+ const attrs = this.$attrs || {}
107
+ const classes = {}
108
+ const booleanStyleKeys = [
109
+ 'user-entry'
110
+ ]
111
+ booleanStyleKeys.forEach(key => {
112
+ const val = attrs[key]
113
+ const truthy = val === true || val === '' || val === 'true'
114
+ if (truthy) classes[`xtreerows-${key}`] = true
115
+ })
116
+ const size = attrs.size
117
+ if (size && typeof size === 'string') classes[`xtreerows-size-${size}`] = true
118
+ return classes
119
+ }
120
+ },
121
+ mounted () {
122
+ console.log('实例化')
123
+ this.$emit('component-mounted', this) // 向父组件发送实例
124
+ },
125
+ methods: {
126
+ /**
127
+ * 递归查找匹配 title 的节点及其路径
128
+ * @param {Array} nodes 要搜索的节点数组
129
+ * @param {string} title 要匹配的标题
130
+ * @param {Array} path 当前路径
131
+ * @returns {Object|null} 包含节点和路径的对象
132
+ */
133
+ findNodeAndPathByTitle (nodes, title, path = []) {
134
+ for (const node of nodes) {
135
+ const currentPath = [...path, node]
136
+ if (node.title === title) {
137
+ return { node, path: currentPath }
138
+ }
139
+ if (node.children && node.children.length) {
140
+ const found = this.findNodeAndPathByTitle(node.children, title, currentPath)
141
+ if (found) return found
142
+ }
143
+ }
144
+ return null
145
+ },
146
+
147
+ /**
148
+ * 展开节点路径
149
+ * @param {Array} path 节点路径
150
+ */
151
+ expandNodePath (path) {
152
+ // 展开除最后一个节点外的所有节点(即所有父节点)
153
+ for (let i = 0; i < path.length - 1; i++) {
154
+ path[i].expanded = true
155
+ }
156
+ },
157
+ searchTitleToggle (title) {
158
+ // 清除之前选中的节点
159
+ if (this.lastSelectedNode) {
160
+ this.$set(this.lastSelectedNode, 'selected', false) // 改用Vue.set
161
+ }
162
+ const result = this.findNodeAndPathByTitle(this.showData, title)
163
+ if (result) {
164
+ if (result.node.children.length > 0) {
165
+ this.toggleNode(result.node)
166
+ } else {
167
+ this.expandNodePath(result.path)
168
+ }
169
+ this.$set(result.node, 'selected', true) // 使用Vue.set确保响应性
170
+ this.lastSelectedNode = result.node
171
+ this.$emit('search-complete', {
172
+ hasMatch: true,
173
+ panelIndex: this.ipanelIndex // 接收父组件传入的面板索引
174
+ })
175
+ // 滚动到目标节点
176
+ this.$nextTick(() => {
177
+ this.scrollToNode(result.node.id)
178
+ })
179
+ } else {
180
+ this.$emit('search-complete', { hasMatch: false })
181
+ }
182
+ },
183
+ /**
184
+ * 滚动到指定节点
185
+ * @param {string} nodeId 节点ID
186
+ */
187
+ scrollToNode (nodeId) {
188
+ const nodeElement = document.querySelector(`[data-node-id="${nodeId}"]`)
189
+ if (nodeElement) {
190
+ nodeElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
191
+ }
192
+ },
193
+ toggleNode (node) {
194
+ node.expanded = !node.expanded
195
+ this.$emit('node-toggle', node)
196
+ },
197
+ isToOpenAll () {
198
+ this.isExpanded = !this.isExpanded
199
+ this.expandAllNodes(this.showData, this.isExpanded)
200
+ this.$emit('isOpenAll', this.isExpanded)
201
+ },
202
+ expandAllNodes (nodes, expand) {
203
+ nodes.forEach(node => {
204
+ if (node.children && node.children.length > 0) {
205
+ node.expanded = expand
206
+ this.expandAllNodes(node.children, expand)
207
+ }
208
+ })
209
+ },
210
+ /**
211
+ * 构建树数据
212
+ * @param allData 子节点所有数据
213
+ * @param gid 根节点id
214
+ * @returns {*|*[]}
215
+ */
216
+ buildTreeByRootId (allData, gid) {
217
+ // 1. 找到所有直接子节点
218
+ const directChildren = allData.filter(item => item.pid === gid)
219
+ if (directChildren.length === 0) return [] // 如果没有子节点,返回空数组
220
+ // 2. 递归构建子树
221
+ const buildTree = (parentId) => {
222
+ const children = allData.filter(item => item.pid === parentId)
223
+ return children.map(child => ({
224
+ title: child.label,
225
+ id: child.value,
226
+ children: buildTree(child.value), // 递归处理子节点
227
+ }))
228
+ }
229
+ // 3. 返回直接子节点的完整子树
230
+ return directChildren.map(child => ({
231
+ title: child.label,
232
+ id: child.value,
233
+ children: buildTree(child.value),
234
+ expanded: false
235
+ }))
236
+ },
237
+ init (config, parameterData) {
238
+ getConfigByName(config, 'af-his', res => {
239
+ this.isShowOpen = res.isShowOpen
240
+ this.title = res.title
241
+ this.config = res
242
+ if (!res.isCheck) {
243
+ this.showData = res.showData
244
+ return
245
+ }
246
+ const parameter = { ...parameterData, ...this.parameter }
247
+ runLogic(res.logicName, parameter, 'af-his').then(result => {
248
+ if (result.isConstruction) { // 对数据重新构造
249
+ this.showData = this.buildTreeByRootId(result.allData, result.gId)
250
+ } else {
251
+ this.showData = result
252
+ }
253
+ })
254
+ })
255
+ }
256
+ },
257
+ watch: {
258
+ queryParamsName: {
259
+ immediate: true,
260
+ handler (newValue) {
261
+ console.log(newValue)
262
+ this.init(newValue, {})
263
+ },
264
+ deep: true
265
+ }
266
+ }
267
+ }
268
+ </script>
269
+
270
+ <style scoped lang="less">
271
+ .tree-container {
272
+ width: 100%;
273
+ height: 320px;
274
+ overflow-y: auto;
275
+ overflow-x: auto;
276
+ padding: 6px;
277
+ box-sizing: border-box;
278
+ }
279
+ /* 自定义滚动条样式 */
280
+ .tree-container::-webkit-scrollbar {
281
+ width: 4px;
282
+ height: 4px;
283
+ }
284
+ .tree-container::-webkit-scrollbar-thumb {
285
+ background-color: #ccc;
286
+ border-radius: 2px;
287
+ }
288
+ .tree-container::-webkit-scrollbar-track {
289
+ background-color: #f5f5f5;
290
+ }
291
+ .tree-list {
292
+ font-size: 14px;
293
+ min-width: 100%;
294
+ }
295
+
296
+ .tree-header {
297
+ padding: 8px 4px;
298
+ border-bottom: 1px solid #e8e8e8;
299
+ margin-bottom: 8px;
300
+ position: sticky;
301
+ top: 0;
302
+ background-color: #fff;
303
+ z-index: 1;
304
+ }
305
+
306
+ .tree-title {
307
+ font-size: 16px;
308
+ font-weight: 700;
309
+ color:#5D5C5C;
310
+ }
311
+
312
+ .tree-expand-all {
313
+ float: right;
314
+ margin-right: 15px;
315
+ font-size: 14px;
316
+ font-weight: 400;
317
+ color: #5D5C5C;
318
+ cursor: pointer;
319
+ user-select: none;
320
+ }
321
+
322
+ .tree-expand-all:hover {
323
+ color: #989a9a;
324
+ }
325
+
326
+ /* user-entry 样式:字体与内容区域边距(参考需求) */
327
+ .x-tree-rows-wrapper {
328
+ &.xtreerows-user-entry{
329
+ padding: 14px 0 20px 47px;
330
+ .tree-list {
331
+ font-family: 'Source Han Sans', sans-serif;
332
+ font-size: 16px;
333
+ font-weight: normal;
334
+ line-height: 18px;
335
+ letter-spacing: 0em;
336
+ font-feature-settings: "kern" on;
337
+ color: #313131;
338
+ }
339
+ }
340
+ }
341
+ </style>