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.
- package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +0 -1
- package/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -4
- package/package.json +1 -1
- package/src/base-client/components/common/XFormTable/XFormTable.vue +7 -0
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.vue +20 -7
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaireDemo.vue +10 -1
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaireItem.vue +0 -3
- package/src/base-client/components/his/XTextCard/XTextCard.vue +207 -207
- package/src/base-client/components/his/XTreeRows/TreeNode.vue +100 -100
- package/src/base-client/components/his/XTreeRows/XTreeRows.vue +197 -197
- package/src/base-client/components/his/threeTestOrders/editor.vue +111 -111
- package/src/base-client/components/layout/XPageView/RenderRow.vue +57 -31
- package/src/base-client/components/layout/XPageView/XErrorView.vue +14 -3
- package/src/base-client/components/layout/XPageView/XPageView.vue +138 -71
- package/src/base-client/components/layout/XPageView/index.js +1 -3
- package/src/base-client/components/layout/XPageView/index.md +65 -26
- package/src/pages/WorkflowDetail/WorkFlowDemo2.vue +90 -0
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +13 -1
- package/src/pages/XPageViewExample/index.vue +41 -8
- package/src/pages/addressSelect/addressDemo.vue +24 -24
- package/src/pages/addressSelect/index.vue +6 -12
- package/src/router/async/router.map.js +4 -2
- package/.history/public/his/editor/editor_20250606134713.html +0 -51
- package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527173925.vue +0 -509
- package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174316.vue +0 -524
- package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174419.vue +0 -524
- package/.history/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox_20250527174422.vue +0 -524
- package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172825.vue +0 -207
- package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172945.vue +0 -211
- package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611172949.vue +0 -212
- package/.history/src/base-client/components/common/XAddReport/XAddReport_20250611173010.vue +0 -212
- package/.history/src/base-client/components/common/XForm/XFormItem_20250508134122.vue +0 -1320
- package/.history/src/base-client/components/common/XForm/XFormItem_20250527171604.vue +0 -1332
- package/.history/src/base-client/components/common/XForm/XFormItem_20250527171613.vue +0 -1331
- package/.history/src/base-client/components/common/XForm/XFormItem_20250527171703.vue +0 -1331
- package/.history/src/base-client/components/common/XForm/XFormItem_20250527171720.vue +0 -1331
- package/.history/src/base-client/components/common/XForm/XFormItem_20250527174327.vue +0 -1339
- package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612092804.vue +0 -731
- package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612112546.vue +0 -748
- package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20250612113808.vue +0 -748
- package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115237.vue +0 -1071
- package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115346.vue +0 -1078
- package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115350.vue +0 -1077
- package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115415.vue +0 -1077
- package/.history/src/base-client/components/common/XReportGrid/XReport_20250612115429.vue +0 -1077
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611091619.vue +0 -442
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092547.vue +0 -442
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092552.vue +0 -442
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092744.vue +0 -475
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092955.vue +0 -475
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611092957.vue +0 -475
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095652.vue +0 -477
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095701.vue +0 -477
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611095704.vue +0 -477
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100005.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100011.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100014.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100833.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100853.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611100940.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101011.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101013.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101014.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101159.vue +0 -473
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101238.vue +0 -474
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101240.vue +0 -474
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101242.vue +0 -474
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101404.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101410.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101459.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101500.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101502.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101504.vue +0 -472
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101610.vue +0 -501
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101700.vue +0 -501
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101702.vue +0 -501
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101741.vue +0 -504
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101749.vue +0 -504
- package/.history/src/base-client/components/his/XHisEditor/XHisEditor_20250611101759.vue +0 -504
- package/.history/src/base-client/components/his/XHisEditor/dome_20250611091349.vue +0 -131
- package/.history/src/base-client/components/his/XHisEditor/dome_20250611105854.vue +0 -160
- package/.history/src/base-client/components/his/XHisEditor/dome_20250611105902.vue +0 -160
- package/.history/src/base-client/components/his/XHisEditor/dome_20250611105924.vue +0 -160
- package/.history/src/base-client/components/his/XHisEditor/dome_20250611105932.vue +0 -158
- package/.history/src/base-client/components/his/XList/XList_20250609135848.vue +0 -173
- package/.history/src/base-client/components/his/XList/XList_20250609141026.vue +0 -222
- package/.history/src/base-client/components/his/XList/XList_20250609141035.vue +0 -229
- package/.history/src/base-client/components/his/XList/XList_20250609141103.vue +0 -229
- package/.history/src/base-client/components/his/XList/XList_20250609141105.vue +0 -229
- package/.history/src/base-client/components/his/XList/XList_20250609141334.vue +0 -241
- package/.history/src/base-client/components/his/XList/XList_20250609141404.vue +0 -241
- package/.history/src/base-client/components/his/XList/XList_20250609141406.vue +0 -241
- package/.history/src/base-client/components/his/XList/XList_20250609141801.vue +0 -245
- package/.history/src/base-client/components/his/XList/XList_20250609142033.vue +0 -245
- package/.history/src/base-client/components/his/XList/XList_20250609142038.vue +0 -245
- package/.history/src/base-client/components/his/XList/XList_20250609142435.vue +0 -255
- package/.history/src/base-client/components/his/XList/XList_20250609142503.vue +0 -255
- package/.history/src/base-client/components/his/XList/XList_20250609142504.vue +0 -255
- package/.history/src/base-client/components/his/XList/XList_20250609143012.vue +0 -270
- package/.history/src/base-client/components/his/XList/XList_20250609143044.vue +0 -270
- package/.history/src/base-client/components/his/XList/XList_20250609143046.vue +0 -270
- package/.history/src/base-client/components/his/XList/XList_20250609143210.vue +0 -270
- package/.history/src/base-client/components/his/XList/XList_20250609144339.vue +0 -294
- package/.history/src/base-client/components/his/XList/XList_20250609144410.vue +0 -294
- package/.history/src/base-client/components/his/XList/XList_20250609144412.vue +0 -294
- package/.history/src/base-client/components/his/XList/XList_20250609144647.vue +0 -303
- package/.history/src/base-client/components/his/XList/XList_20250609144716.vue +0 -303
- package/.history/src/base-client/components/his/XList/XList_20250609144729.vue +0 -303
- package/.history/src/base-client/components/his/XList/XList_20250609151232.vue +0 -288
- package/.history/src/base-client/components/his/XList/XList_20250609151247.vue +0 -288
- package/.history/src/base-client/components/his/XList/XList_20250609151252.vue +0 -288
- package/.history/src/base-client/components/his/XList/XList_20250609161220.vue +0 -317
- package/.history/src/base-client/components/his/XList/XList_20250609161258.vue +0 -306
- package/.history/src/base-client/components/his/XList/XList_20250609161319.vue +0 -306
- package/.history/src/base-client/components/his/XList/XList_20250609161320.vue +0 -306
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250609151519.vue +0 -222
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155514.vue +0 -183
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155556.vue +0 -183
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612155600.vue +0 -183
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181609.vue +0 -206
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250612181629.vue +0 -209
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +0 -242
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +0 -242
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +0 -242
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +0 -251
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +0 -251
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +0 -250
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +0 -250
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +0 -250
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +0 -250
- package/Users/objecrt/af-vue2-client/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +0 -36
- package/src/base-client/components/TreeList/TreeList.vue +0 -91
- package/src/base-client/components/TreeList/TreeNode.vue +0 -81
- 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
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
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="`
|
40
|
+
:key="`comp-child-${col.id}-${index}`"
|
41
|
+
/>
|
22
42
|
</template>
|
23
43
|
</component>
|
24
|
-
</
|
25
|
-
</a-
|
26
|
-
</
|
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
|
-
|
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
|
-
|
62
|
+
// 定义属性
|
63
|
+
const props = defineProps({
|
41
64
|
row: {
|
42
65
|
type: Object,
|
43
66
|
required: true
|
44
67
|
}
|
45
68
|
})
|
46
69
|
|
47
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
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
|
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
|
-
//
|
10
|
-
const
|
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
|
25
|
+
// 数据上下文
|
26
|
+
const dataContext = reactive({
|
23
27
|
comps: componentRefMap,
|
24
28
|
func: {
|
25
|
-
getConfigByName
|
29
|
+
getConfigByName
|
26
30
|
}
|
27
|
-
}
|
31
|
+
})
|
28
32
|
|
29
33
|
/**
|
30
34
|
* 初始化构建页面组件
|
31
|
-
* @param params
|
32
35
|
*/
|
33
|
-
|
34
|
-
const {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
46
|
-
|
50
|
+
|
51
|
+
layout.value = config
|
47
52
|
setComponentTotal(layout.value.children)
|
48
|
-
loaded.value =
|
53
|
+
loaded.value = loadingStatus.LOADED
|
49
54
|
}
|
55
|
+
|
50
56
|
if (configName) {
|
51
|
-
getConfigByName(configName, serviceName,
|
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
|
-
|
67
|
+
loaded.value = loadingStatus.ERROR
|
54
68
|
}
|
55
69
|
}
|
56
70
|
|
57
71
|
/**
|
58
72
|
* 注册组件
|
59
|
-
* @param name 组件名称
|
60
|
-
* @param vm 组件实例
|
61
73
|
*/
|
62
|
-
|
74
|
+
const registerComponent = (name, vm) => {
|
75
|
+
if (!vm) return
|
76
|
+
|
63
77
|
componentRefMap[name] = vm
|
64
|
-
registerComponentTotal.value
|
65
|
-
console.
|
78
|
+
registerComponentTotal.value++
|
79
|
+
console.debug(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
|
80
|
+
|
66
81
|
// 初始化页面
|
67
|
-
|
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
|
-
|
79
|
-
if (layout.value
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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
|
-
|
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
|
-
|
134
|
-
|
135
|
-
})
|
136
|
-
|
162
|
+
// 导出组件接口
|
163
|
+
defineExpose({ init })
|
137
164
|
</script>
|
138
165
|
|
139
166
|
<template>
|
140
|
-
<
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
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>
|