vue2-client 1.14.84 → 1.14.86

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 (134) 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/XFormTable/XFormTable.vue +7 -0
  5. package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.vue +20 -7
  6. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireDemo.vue +10 -1
  7. package/src/base-client/components/his/XQuestionnaire/XQuestionnaireItem.vue +0 -3
  8. package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
  9. package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
  10. package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
  11. package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
  12. package/src/base-client/components/layout/XPageView/RenderRow.vue +57 -31
  13. package/src/base-client/components/layout/XPageView/XErrorView.vue +14 -3
  14. package/src/base-client/components/layout/XPageView/XPageView.vue +138 -71
  15. package/src/base-client/components/layout/XPageView/index.js +1 -3
  16. package/src/base-client/components/layout/XPageView/index.md +65 -26
  17. package/src/pages/WorkflowDetail/WorkFlowDemo2.vue +90 -0
  18. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +13 -1
  19. package/src/pages/XPageViewExample/index.vue +41 -8
  20. package/src/pages/addressSelect/addressDemo.vue +24 -24
  21. package/src/pages/addressSelect/index.vue +6 -12
  22. package/src/router/async/router.map.js +4 -2
  23. package/.history/public/his/editor/editor_20250606134713.html +0 -51
  24. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +0 -509
  25. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +0 -524
  26. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +0 -524
  27. package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +0 -524
  28. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +0 -207
  29. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +0 -211
  30. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +0 -212
  31. package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +0 -212
  32. package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +0 -1320
  33. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +0 -1332
  34. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +0 -1331
  35. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +0 -1331
  36. package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +0 -1331
  37. package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +0 -1339
  38. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +0 -731
  39. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +0 -748
  40. package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +0 -748
  41. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +0 -1071
  42. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +0 -1078
  43. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +0 -1077
  44. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +0 -1077
  45. package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +0 -1077
  46. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +0 -442
  47. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +0 -442
  48. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +0 -442
  49. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +0 -475
  50. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +0 -475
  51. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +0 -475
  52. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +0 -477
  53. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +0 -477
  54. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +0 -477
  55. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +0 -473
  56. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +0 -473
  57. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +0 -473
  58. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +0 -473
  59. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +0 -473
  60. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +0 -473
  61. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +0 -473
  62. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +0 -473
  63. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +0 -473
  64. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +0 -473
  65. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +0 -474
  66. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +0 -474
  67. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +0 -474
  68. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +0 -472
  69. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +0 -472
  70. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +0 -472
  71. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +0 -472
  72. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +0 -472
  73. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +0 -472
  74. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +0 -501
  75. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +0 -501
  76. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +0 -501
  77. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +0 -504
  78. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +0 -504
  79. package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +0 -504
  80. package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +0 -131
  81. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +0 -160
  82. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +0 -160
  83. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +0 -160
  84. package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +0 -158
  85. package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +0 -173
  86. package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +0 -222
  87. package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +0 -229
  88. package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +0 -229
  89. package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +0 -229
  90. package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +0 -241
  91. package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +0 -241
  92. package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +0 -241
  93. package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +0 -245
  94. package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +0 -245
  95. package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +0 -245
  96. package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +0 -255
  97. package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +0 -255
  98. package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +0 -255
  99. package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +0 -270
  100. package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +0 -270
  101. package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +0 -270
  102. package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +0 -270
  103. package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +0 -294
  104. package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +0 -294
  105. package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +0 -294
  106. package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +0 -303
  107. package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +0 -303
  108. package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +0 -303
  109. package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +0 -288
  110. package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +0 -288
  111. package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +0 -288
  112. package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +0 -317
  113. package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +0 -306
  114. package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +0 -306
  115. package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +0 -306
  116. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +0 -222
  117. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +0 -183
  118. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +0 -183
  119. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +0 -183
  120. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +0 -206
  121. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +0 -209
  122. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +0 -242
  123. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +0 -242
  124. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +0 -242
  125. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +0 -251
  126. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +0 -251
  127. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +0 -250
  128. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +0 -250
  129. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +0 -250
  130. package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +0 -250
  131. package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +0 -36
  132. package/src/base-client/components/TreeList/TreeList.vue +0 -91
  133. package/src/base-client/components/TreeList/TreeNode.vue +0 -81
  134. package/src/base-client/components/common/XCardSet/XTiltle.vue +0 -191
@@ -1,111 +1,111 @@
1
- <template>
2
- <!-- 根据实际部署环境修改 editor.html 的路径 -->
3
- <iframe
4
- src="/his/editor/editor.html"
5
- width="100%"
6
- height="800"
7
- frameborder="0"
8
- @load="onIframeLoad"
9
- ref="editorIframe">
10
- </iframe>
11
- </template>
12
-
13
- <script setup>
14
-
15
- import { ref, onBeforeUnmount } from 'vue'
16
-
17
- const editorIframe = ref(null)
18
- const checkEditorTimer = ref(null)
19
- const checkCount = ref(0)
20
- const editor = ref(null)
21
- const iframeWindow = ref(null)
22
- // 对外暴露的获取editor方法
23
- const getEditor = () => {
24
- if (editor.value) {
25
- return editor.value
26
- }
27
- if (iframeWindow.value && iframeWindow.value.editor) {
28
- editor.value = iframeWindow.value.editor
29
- return editor.value
30
- }
31
- if (editorIframe.value && editorIframe.value.contentWindow && editorIframe.value.contentWindow.editor) {
32
- editor.value = editorIframe.value.contentWindow.editor
33
- return editor.value
34
- }
35
- return null
36
- }
37
- // 创建体温单方法
38
- const createVitalSigns = (data) => {
39
- const editorObj = getEditor()
40
- if (!editorObj) {
41
- throw new Error('editor对象未初始化,无法创建体温单')
42
- }
43
- if (typeof editorObj.createVitalSigns === 'function') {
44
- return editorObj.createVitalSigns(data)
45
- } else {
46
- throw new Error('editor对象未包含createVitalSigns方法')
47
- }
48
- }
49
-
50
- // 检查editor对象是否已初始化
51
- const startEditorCheck = (frameWindow, iframe) => {
52
- if (checkEditorTimer.value) {
53
- clearInterval(checkEditorTimer.value)
54
- }
55
- checkCount.value = 0
56
- checkEditorTimer.value = setInterval(() => {
57
- checkCount.value++
58
- try {
59
- const editorObj = frameWindow.editor
60
- if (editorObj && typeof editorObj.createVitalSigns === 'function') {
61
- clearInterval(checkEditorTimer.value)
62
- editor.value = editorObj
63
- // 将editor对象暴露到全局
64
- window.iframeEditor = editorObj
65
- window.iframeWindow = frameWindow
66
- // 触发事件
67
- emit('editor-ready', editorObj)
68
- emit('load', { target: iframe, editor: editorObj })
69
- // 发送消息通知
70
- window.parent.postMessage({ type: 'editorReady' }, '*')
71
- }
72
- } catch (err) {
73
- console.error('检查editor对象时出错:', err)
74
- }
75
- if (checkCount.value >= 20) {
76
- clearInterval(checkEditorTimer.value)
77
- console.error('Editor 对象加载失败')
78
- }
79
- }, 500)
80
- }
81
- // iframe加载完成的处理
82
- const onIframeLoad = (e) => {
83
- const iframe = e.target
84
- const frameWindow = iframe.contentWindow
85
- iframeWindow.value = frameWindow
86
- if (!frameWindow) {
87
- console.error('无法访问 iframe 内容')
88
- return
89
- }
90
- startEditorCheck(frameWindow, iframe)
91
- }
92
- // 组件销毁前清理
93
- onBeforeUnmount(() => {
94
- if (checkEditorTimer.value) {
95
- clearInterval(checkEditorTimer.value)
96
- }
97
- })
98
- // 暴露方法给父组件
99
- defineExpose({ getEditor, createVitalSigns })
100
-
101
- // 定义事件
102
- const emit = defineEmits(['editor-ready', 'load'])
103
- </script>
104
-
105
- <style scoped>
106
- iframe {
107
- border: none;
108
- width: 100%;
109
- min-height: 800px;
110
- }
111
- </style>
1
+ <template>
2
+ <!-- 根据实际部署环境修改 editor.html 的路径 -->
3
+ <iframe
4
+ src="/his/editor/editor.html"
5
+ width="100%"
6
+ height="800"
7
+ frameborder="0"
8
+ @load="onIframeLoad"
9
+ ref="editorIframe">
10
+ </iframe>
11
+ </template>
12
+
13
+ <script setup>
14
+
15
+ import { ref, onBeforeUnmount } from 'vue'
16
+
17
+ const editorIframe = ref(null)
18
+ const checkEditorTimer = ref(null)
19
+ const checkCount = ref(0)
20
+ const editor = ref(null)
21
+ const iframeWindow = ref(null)
22
+ // 对外暴露的获取editor方法
23
+ const getEditor = () => {
24
+ if (editor.value) {
25
+ return editor.value
26
+ }
27
+ if (iframeWindow.value && iframeWindow.value.editor) {
28
+ editor.value = iframeWindow.value.editor
29
+ return editor.value
30
+ }
31
+ if (editorIframe.value && editorIframe.value.contentWindow && editorIframe.value.contentWindow.editor) {
32
+ editor.value = editorIframe.value.contentWindow.editor
33
+ return editor.value
34
+ }
35
+ return null
36
+ }
37
+ // 创建体温单方法
38
+ const createVitalSigns = (data) => {
39
+ const editorObj = getEditor()
40
+ if (!editorObj) {
41
+ throw new Error('editor对象未初始化,无法创建体温单')
42
+ }
43
+ if (typeof editorObj.createVitalSigns === 'function') {
44
+ return editorObj.createVitalSigns(data)
45
+ } else {
46
+ throw new Error('editor对象未包含createVitalSigns方法')
47
+ }
48
+ }
49
+
50
+ // 检查editor对象是否已初始化
51
+ const startEditorCheck = (frameWindow, iframe) => {
52
+ if (checkEditorTimer.value) {
53
+ clearInterval(checkEditorTimer.value)
54
+ }
55
+ checkCount.value = 0
56
+ checkEditorTimer.value = setInterval(() => {
57
+ checkCount.value++
58
+ try {
59
+ const editorObj = frameWindow.editor
60
+ if (editorObj && typeof editorObj.createVitalSigns === 'function') {
61
+ clearInterval(checkEditorTimer.value)
62
+ editor.value = editorObj
63
+ // 将editor对象暴露到全局
64
+ window.iframeEditor = editorObj
65
+ window.iframeWindow = frameWindow
66
+ // 触发事件
67
+ emit('editor-ready', editorObj)
68
+ emit('load', { target: iframe, editor: editorObj })
69
+ // 发送消息通知
70
+ window.parent.postMessage({ type: 'editorReady' }, '*')
71
+ }
72
+ } catch (err) {
73
+ console.error('检查editor对象时出错:', err)
74
+ }
75
+ if (checkCount.value >= 20) {
76
+ clearInterval(checkEditorTimer.value)
77
+ console.error('Editor 对象加载失败')
78
+ }
79
+ }, 500)
80
+ }
81
+ // iframe加载完成的处理
82
+ const onIframeLoad = (e) => {
83
+ const iframe = e.target
84
+ const frameWindow = iframe.contentWindow
85
+ iframeWindow.value = frameWindow
86
+ if (!frameWindow) {
87
+ console.error('无法访问 iframe 内容')
88
+ return
89
+ }
90
+ startEditorCheck(frameWindow, iframe)
91
+ }
92
+ // 组件销毁前清理
93
+ onBeforeUnmount(() => {
94
+ if (checkEditorTimer.value) {
95
+ clearInterval(checkEditorTimer.value)
96
+ }
97
+ })
98
+ // 暴露方法给父组件
99
+ defineExpose({ getEditor, createVitalSigns })
100
+
101
+ // 定义事件
102
+ const emit = defineEmits(['editor-ready', 'load'])
103
+ </script>
104
+
105
+ <style scoped>
106
+ iframe {
107
+ border: none;
108
+ width: 100%;
109
+ min-height: 800px;
110
+ }
111
+ </style>
@@ -1,61 +1,87 @@
1
1
  <template>
2
- <div class="liuli_page_render_row">
3
- <a-row type="flex">
4
- <!-- 对于row类型,需要遍历children -->
5
- <a-col :key="`page-col-${col.id}`" v-for="col in (row.type === 'row' ? row.children : [row])" :span="col.span ? col.span : 24">
6
- <template v-if="col.type === 'row'">
7
- <render-row
8
- v-for="(nestedRow, index) in col.children"
9
- :row="nestedRow"
10
- :key="`page-col-${col.id}-${index}`" />
11
- </template>
2
+ <a-row
3
+ type="flex"
4
+ :gutter="row.gutter || 0"
5
+ :align="row.align || 'top'"
6
+ :justify="row.justify || 'start'"
7
+ >
8
+ <a-col
9
+ v-for="col in getColumns"
10
+ :key="`page-col-${col.id}`"
11
+ :span="col.span || 24"
12
+ :xs="col.xs"
13
+ :sm="col.sm"
14
+ :md="col.md"
15
+ :lg="col.lg"
16
+ :xl="col.xl"
17
+ :xxl="col.xxl"
18
+ >
19
+ <!-- 行类型,递归渲染子行 -->
20
+ <template v-if="col.type === 'row'">
21
+ <render-row
22
+ v-for="(nestedRow, index) in col.children"
23
+ :row="nestedRow"
24
+ :key="`nested-row-${col.id}-${index}`"
25
+ />
26
+ </template>
27
+
28
+ <!-- 组件类型,渲染动态组件 -->
29
+ <template v-else>
12
30
  <component
13
- v-if="col.type !== 'row'"
14
- :ref="setRef(col.id)"
15
- :is="getComponentType(col.type)"
16
- v-bind="col.props">
17
- <template v-if="col.children">
31
+ :ref="(el) => registerComponentRef(col.id, el)"
32
+ :is="resolveComponentType(col.type)"
33
+ v-bind="col.props"
34
+ >
35
+ <!-- 如果组件有子组件,递归渲染子行 -->
36
+ <template v-if="col.children?.length">
18
37
  <render-row
19
38
  v-for="(nestedRow, index) in col.children"
20
39
  :row="nestedRow"
21
- :key="`page-col-${col.id}-${index}`" />
40
+ :key="`comp-child-${col.id}-${index}`"
41
+ />
22
42
  </template>
23
43
  </component>
24
- </a-col>
25
- </a-row>
26
- </div>
44
+ </template>
45
+ </a-col>
46
+ </a-row>
27
47
  </template>
28
48
 
29
49
  <script setup>
30
- import { defineProps, inject } from 'vue'
50
+ import { defineProps, inject, computed } from 'vue'
31
51
 
52
+ // 注入注册组件方法
32
53
  const registerComponent = inject('registerComponent')
33
54
 
55
+ // 支持的组件类型映射
34
56
  const components = {
35
- XTreeView: () => import('@vue2-client/base-client/components/layout/XTreeView'),
57
+ XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable'),
36
58
  XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm'),
37
59
  XErrorView: () => import('@vue2-client/base-client/components/layout/XPageView/XErrorView')
38
60
  }
39
61
 
40
- defineProps({
62
+ // 定义属性
63
+ const props = defineProps({
41
64
  row: {
42
65
  type: Object,
43
66
  required: true
44
67
  }
45
68
  })
46
69
 
47
- const getComponentType = (type) => {
70
+ // 获取列数组
71
+ const getColumns = computed(() => {
72
+ return props.row.type === 'row' ? props.row.children : [props.row]
73
+ })
74
+
75
+ // 解析组件类型
76
+ const resolveComponentType = (type) => {
77
+ if (!type) return components.XErrorView
48
78
  return components[type] || components.XErrorView
49
79
  }
50
80
 
51
- const setRef = (id) => {
52
- return (el) => {
53
- if (el) {
54
- console.warn(id)
55
- console.warn(el)
56
- registerComponent(id, el)
57
- return id
58
- }
81
+ // 注册组件引用
82
+ const registerComponentRef = (id, el) => {
83
+ if (el) {
84
+ registerComponent(id, el)
59
85
  }
60
86
  }
61
87
  </script>
@@ -1,11 +1,22 @@
1
1
  <script setup>
2
-
2
+ // 无需使用 props
3
3
  </script>
4
4
 
5
5
  <template>
6
- <div>渲染失败</div>
6
+ <div class="liuli-error-view">
7
+ <a-result status="error" title="组件渲染失败">
8
+ <template #extra>
9
+ <a-button type="primary">重试</a-button>
10
+ </template>
11
+ </a-result>
12
+ </div>
7
13
  </template>
8
14
 
9
15
  <style scoped lang="less">
10
-
16
+ .liuli-error-view {
17
+ padding: 16px;
18
+ text-align: center;
19
+ color: #ff4d4f;
20
+ font-size: 14px;
21
+ }
11
22
  </style>
@@ -2,71 +2,89 @@
2
2
  import { getConfigByName } from '@vue2-client/services/api/common'
3
3
  import { reactive, ref, provide } from 'vue'
4
4
  import RenderRow from './RenderRow'
5
- import Exp500 from '@vue2-client/pages/exception/500.vue'
5
+ import XErrorView from '@vue2-client/base-client/components/layout/XPageView/XErrorView.vue'
6
6
 
7
+ // 页面布局配置
7
8
  const layout = ref(null)
8
9
 
9
- // 加载状态,0:加载中,1:已加载,2:出现错误
10
- const loaded = ref(0)
10
+ // 加载状态:0-加载中,1-已加载,2-出现错误
11
+ const loadingStatus = {
12
+ LOADING: 0,
13
+ LOADED: 1,
14
+ ERROR: 2
15
+ }
16
+ const loaded = ref(loadingStatus.LOADING)
11
17
 
12
- // 声明组件总数
18
+ // 组件计数
13
19
  const componentTotal = ref(0)
14
-
15
- // 注册组件总数
16
20
  const registerComponentTotal = ref(0)
17
21
 
18
- // 组件注册集
22
+ // 组件注册集合
19
23
  const componentRefMap = reactive({})
20
24
 
21
- // 通用参数
22
- const data = {
25
+ // 数据上下文
26
+ const dataContext = reactive({
23
27
  comps: componentRefMap,
24
28
  func: {
25
- getConfigByName: getConfigByName
29
+ getConfigByName
26
30
  }
27
- }
31
+ })
28
32
 
29
33
  /**
30
34
  * 初始化构建页面组件
31
- * @param params
32
35
  */
33
- function init (params) {
34
- const {
35
- configName,
36
- configValue,
37
- serviceName
38
- } = params
39
- loaded.value = 0
40
- const getConfigAfter = (res) => {
41
- if (res == null) {
42
- loaded.value = 2
36
+ const init = (params) => {
37
+ const { configName, configValue, serviceName } = params
38
+
39
+ // 重置状态
40
+ loaded.value = loadingStatus.LOADING
41
+ componentTotal.value = 0
42
+ registerComponentTotal.value = 0
43
+ Object.keys(componentRefMap).forEach(key => delete componentRefMap[key])
44
+
45
+ const processConfig = (config) => {
46
+ if (!config) {
47
+ loaded.value = loadingStatus.ERROR
43
48
  return
44
49
  }
45
- layout.value = res
46
- // 设置组件总量
50
+
51
+ layout.value = config
47
52
  setComponentTotal(layout.value.children)
48
- loaded.value = 1
53
+ loaded.value = loadingStatus.LOADED
49
54
  }
55
+
50
56
  if (configName) {
51
- getConfigByName(configName, serviceName, getConfigAfter)
57
+ getConfigByName(configName, serviceName, processConfig)
58
+ } else if (configValue) {
59
+ try {
60
+ const config = typeof configValue === 'string' ? JSON.parse(configValue) : configValue
61
+ processConfig(config)
62
+ } catch (error) {
63
+ console.error('配置解析错误:', error)
64
+ loaded.value = loadingStatus.ERROR
65
+ }
52
66
  } else {
53
- getConfigAfter(JSON.parse(configValue))
67
+ loaded.value = loadingStatus.ERROR
54
68
  }
55
69
  }
56
70
 
57
71
  /**
58
72
  * 注册组件
59
- * @param name 组件名称
60
- * @param vm 组件实例
61
73
  */
62
- function registerComponent (name, vm) {
74
+ const registerComponent = (name, vm) => {
75
+ if (!vm) return
76
+
63
77
  componentRefMap[name] = vm
64
- registerComponentTotal.value = registerComponentTotal.value + 1
65
- console.info(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
78
+ registerComponentTotal.value++
79
+ console.debug(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
80
+
66
81
  // 初始化页面
67
- initPage()
82
+ if (layout.value?.onMounted && registerComponentTotal.value === 1) {
83
+ initPage()
84
+ }
85
+
86
+ // 所有组件都已注册完成
68
87
  if (registerComponentTotal.value >= componentTotal.value) {
69
- // 注册事件
70
88
  registerEvents(layout.value.children)
71
89
  }
72
90
  }
@@ -75,26 +93,33 @@ provide('registerComponent', registerComponent)
75
93
  /**
76
94
  * 初始化页面
77
95
  */
78
- function initPage () {
79
- if (layout.value.onMounted) {
80
- // eslint-disable-next-line no-eval
81
- const onMountedFun = eval('(' + layout.value.onMounted + ')')
82
- onMountedFun(data)
96
+ const initPage = () => {
97
+ if (!layout.value?.onMounted) return
98
+
99
+ try {
100
+ // 使用 Function 构造函数替代 eval
101
+ // eslint-disable-next-line no-new-func
102
+ const onMountedFun = new Function('data', `return (${layout.value.onMounted})(data)`)
103
+ onMountedFun(dataContext)
104
+ } catch (error) {
105
+ console.error('页面初始化错误:', error)
83
106
  }
84
107
  }
85
108
 
86
109
  /**
87
110
  * 设置需要注册的组件总数
88
- * @param children 组件集合
89
111
  */
90
- function setComponentTotal (children) {
112
+ const setComponentTotal = (children) => {
113
+ if (!children?.length) return
114
+
91
115
  children.forEach((child) => {
92
116
  // 如果不是row类型,追加组件数量
93
117
  if (child.type !== 'row') {
94
- componentTotal.value = componentTotal.value + 1
118
+ componentTotal.value++
95
119
  }
120
+
96
121
  // 递归追加子组件数量
97
- if (child.children) {
122
+ if (child.children?.length) {
98
123
  setComponentTotal(child.children)
99
124
  }
100
125
  })
@@ -102,54 +127,96 @@ function setComponentTotal (children) {
102
127
 
103
128
  /**
104
129
  * 注册组件事件
105
- * @param children 组件集合
106
130
  */
107
- function registerEvents (children) {
131
+ const registerEvents = (children) => {
132
+ if (!children?.length) return
133
+
108
134
  children.forEach((child) => {
109
135
  // 如果有事件,注册它们
110
136
  if (child.event) {
111
137
  Object.entries(child.event).forEach(([eventName, handler]) => {
112
- // eslint-disable-next-line no-eval
113
- const eventHandler = eval('(' + handler + ')')
114
- const componentInstance = componentRefMap[child.id]
115
- if (componentInstance) {
116
- // 创建一个包装函数以传递额外参数
117
- const wrappedHandler = function (...args) {
118
- // 这里可以传递额外的参数,例如:
119
- eventHandler.call(componentInstance, ...args, data)
138
+ try {
139
+ // 使用 Function 构造函数替代 eval
140
+ // eslint-disable-next-line no-new-func
141
+ const eventHandler = new Function('...args', `return (${handler})(...args)`)
142
+ const componentInstance = componentRefMap[child.id]
143
+
144
+ if (componentInstance) {
145
+ componentInstance.$on(eventName, (...args) => {
146
+ eventHandler.call(componentInstance, ...args, dataContext)
147
+ })
120
148
  }
121
- componentInstance.$on(eventName, wrappedHandler)
149
+ } catch (error) {
150
+ console.error(`注册事件 ${eventName} 错误:`, error)
122
151
  }
123
152
  })
124
153
  }
125
154
 
126
155
  // 递归注册子组件的事件
127
- if (child.children) {
156
+ if (child.children?.length) {
128
157
  registerEvents(child.children)
129
158
  }
130
159
  })
131
160
  }
132
161
 
133
- defineExpose({
134
- init
135
- })
136
-
162
+ // 导出组件接口
163
+ defineExpose({ init })
137
164
  </script>
138
165
 
139
166
  <template>
140
- <div class="liuli_page">
141
- <div class="liuli_page_main" v-if="loaded === 1">
142
- <render-row
143
- v-for="row in layout.children"
144
- :key="row.id"
145
- :row="row"
146
- />
147
- </div>
148
- <div class="liuli_page_error" v-else-if="loaded === 2">
149
- <exp500></exp500>
150
- </div>
151
- </div>
167
+ <a-row
168
+ type="flex"
169
+ :gutter="layout?.gutter || 0"
170
+ :align="layout?.align || 'top'"
171
+ :justify="layout?.justify || 'start'"
172
+ class="liuli-page">
173
+ <template v-if="loaded === loadingStatus.LOADED">
174
+ <template v-if="layout.children?.length">
175
+ <a-col v-for="row in layout.children" :key="`page-col-${row.id}`">
176
+ <render-row :row="row"/>
177
+ </a-col>
178
+ </template>
179
+ <template v-else>
180
+ <div class="liuli-page__empty">
181
+ <a-empty description="无页面内容" />
182
+ </div>
183
+ </template>
184
+ </template>
185
+
186
+ <template v-else-if="loaded === loadingStatus.LOADING">
187
+ <div class="liuli-page__loading">
188
+ <a-spin tip="页面加载中..." />
189
+ </div>
190
+ </template>
191
+
192
+ <template v-else>
193
+ <div class="liuli-page__error">
194
+ <XErrorView />
195
+ </div>
196
+ </template>
197
+ </a-row>
152
198
  </template>
153
199
 
154
200
  <style scoped lang="less">
201
+ .liuli-page {
202
+ position: relative;
203
+ width: 100%;
204
+ height: 100%;
205
+
206
+ &__content {
207
+ min-height: 100px;
208
+ }
209
+
210
+ &__loading, &__error, &__empty {
211
+ display: flex;
212
+ width: 100%;
213
+ justify-content: center;
214
+ align-items: center;
215
+ min-height: 200px;
216
+ }
217
+
218
+ &__error {
219
+ width: 100%;
220
+ }
221
+ }
155
222
  </style>
@@ -1,3 +1 @@
1
- import XPageView from './XPageView'
2
-
3
- export default XPageView
1
+ export { default } from './XPageView'