vue2-client 1.14.94 → 1.14.97
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 +6 -0
- package/src/base-client/components/common/XTab/XTab.vue +40 -8
- package/src/base-client/components/common/XTable/XTable.vue +30 -23
- package/src/base-client/components/common/XTable/XTableWrapper.vue +13 -6
- package/src/base-client/components/common/XUploadFilesView/index.vue +485 -485
- package/src/base-client/components/his/XList/XList.vue +35 -35
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.json +0 -34
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaire.vue +51 -23
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaireDemo.vue +19 -2
- package/src/base-client/components/his/XQuestionnaire/XQuestionnaireItem.vue +39 -56
- package/src/base-client/components/his/XShiftSchedule/XShiftSchedule.vue +1 -1
- 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 +88 -90
- package/src/base-client/components/layout/XPageView/XPageRowTemplate.vue +37 -0
- package/src/base-client/components/layout/XPageView/XPageView.vue +223 -222
- package/src/base-client/components/layout/XPageView/XTab/XTab.vue +96 -0
- package/src/base-client/components/layout/XPageView/XTab/index.js +3 -0
- package/src/base-client/components/layout/XPageView/componentTypes.js +22 -0
- package/src/base-client/components/layout/XPageView/index.js +1 -0
- package/src/base-client/components/layout/XPageView/index.md +19 -0
- package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +388 -388
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +10 -4
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +1 -1
- package/src/pages/XPageViewExample/index.vue +149 -71
- 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/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140844.vue +0 -238
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140910.vue +0 -238
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613140912.vue +0 -238
- 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,90 +1,88 @@
|
|
1
|
-
<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
|
-
<
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<style scoped lang="less">
|
90
|
-
</style>
|
1
|
+
<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
|
+
<x-page-row-template :template="col.template">
|
22
|
+
<render-row
|
23
|
+
v-for="(nestedRow, index) in col.children"
|
24
|
+
:row="nestedRow"
|
25
|
+
:key="`nested-row-${col.id}-${index}`"
|
26
|
+
/>
|
27
|
+
</x-page-row-template>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<!-- 组件类型,渲染动态组件 -->
|
31
|
+
<template v-else>
|
32
|
+
<x-page-row-template :template="col.template">
|
33
|
+
<component
|
34
|
+
:ref="(el) => registerComponentRef(col.id, el)"
|
35
|
+
:is="resolveComponentType(col.type)"
|
36
|
+
v-bind="col.props"
|
37
|
+
>
|
38
|
+
<!-- 如果组件有子组件,递归渲染子行 -->
|
39
|
+
<template v-if="col.children && col.children.length">
|
40
|
+
<!-- 处理纯文本节点 -->
|
41
|
+
<template v-for="(nestedItem, index) in col.children">
|
42
|
+
<template v-if="nestedItem.text">{{ nestedItem.text }}</template>
|
43
|
+
<render-row
|
44
|
+
v-else
|
45
|
+
:row="nestedItem"
|
46
|
+
:key="`comp-child-${col.id}-${index}`"
|
47
|
+
/>
|
48
|
+
</template>
|
49
|
+
</template>
|
50
|
+
</component>
|
51
|
+
</x-page-row-template>
|
52
|
+
</template>
|
53
|
+
</a-col>
|
54
|
+
</a-row>
|
55
|
+
</template>
|
56
|
+
|
57
|
+
<script setup>
|
58
|
+
import { defineProps, inject, computed } from 'vue'
|
59
|
+
import XPageRowTemplate from './XPageRowTemplate.vue'
|
60
|
+
|
61
|
+
import { resolveComponentType } from './componentTypes'
|
62
|
+
|
63
|
+
// 注入注册组件方法
|
64
|
+
const registerComponent = inject('registerComponent')
|
65
|
+
|
66
|
+
// 定义属性
|
67
|
+
const props = defineProps({
|
68
|
+
row: {
|
69
|
+
type: Object,
|
70
|
+
required: true
|
71
|
+
}
|
72
|
+
})
|
73
|
+
|
74
|
+
// 获取列数组
|
75
|
+
const getColumns = computed(() => {
|
76
|
+
return props.row.type === 'row' ? props.row.children : [props.row]
|
77
|
+
})
|
78
|
+
|
79
|
+
// 注册组件引用
|
80
|
+
const registerComponentRef = (id, el) => {
|
81
|
+
if (el) {
|
82
|
+
registerComponent(id, el)
|
83
|
+
}
|
84
|
+
}
|
85
|
+
</script>
|
86
|
+
|
87
|
+
<style scoped lang="less">
|
88
|
+
</style>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<template v-if="finalTemplate === 'card'">
|
4
|
+
<a-card :bordered="false" class="x-page-row-template-card">
|
5
|
+
<slot></slot>
|
6
|
+
</a-card>
|
7
|
+
</template>
|
8
|
+
<template v-else>
|
9
|
+
<div class="simple-template-card">
|
10
|
+
<slot></slot>
|
11
|
+
</div>
|
12
|
+
</template>
|
13
|
+
</div>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script setup>
|
17
|
+
import { computed } from 'vue'
|
18
|
+
|
19
|
+
// 定义组件属性
|
20
|
+
const props = defineProps({
|
21
|
+
template: {
|
22
|
+
type: String,
|
23
|
+
default: 'card'
|
24
|
+
}
|
25
|
+
})
|
26
|
+
|
27
|
+
// 计算最终使用的模板类型
|
28
|
+
const finalTemplate = computed(() => {
|
29
|
+
return props.template || 'card'
|
30
|
+
})
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<style scoped lang="less">
|
34
|
+
.x-page-row-template-card {
|
35
|
+
border-radius: 8px;
|
36
|
+
}
|
37
|
+
</style>
|
@@ -1,222 +1,223 @@
|
|
1
|
-
<script setup>
|
2
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
3
|
-
import { reactive, ref, provide } from 'vue'
|
4
|
-
import RenderRow from './RenderRow'
|
5
|
-
import XErrorView from '@vue2-client/base-client/components/layout/XPageView/XErrorView.vue'
|
6
|
-
|
7
|
-
// 页面布局配置
|
8
|
-
const layout = ref(null)
|
9
|
-
|
10
|
-
// 加载状态:0-加载中,1-已加载,2-出现错误
|
11
|
-
const loadingStatus = {
|
12
|
-
LOADING: 0,
|
13
|
-
LOADED: 1,
|
14
|
-
ERROR: 2
|
15
|
-
}
|
16
|
-
const loaded = ref(loadingStatus.LOADING)
|
17
|
-
|
18
|
-
// 组件计数
|
19
|
-
const componentTotal = ref(0)
|
20
|
-
const registerComponentTotal = ref(0)
|
21
|
-
|
22
|
-
// 组件注册集合
|
23
|
-
const componentRefMap = reactive({})
|
24
|
-
|
25
|
-
// 数据上下文
|
26
|
-
const dataContext = reactive({
|
27
|
-
comps: componentRefMap,
|
28
|
-
func: {
|
29
|
-
getConfigByName
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
provide('
|
92
|
-
|
93
|
-
/**
|
94
|
-
* 初始化页面
|
95
|
-
*/
|
96
|
-
const initPage = () => {
|
97
|
-
if (!layout.value?.onMounted) return
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
//
|
102
|
-
|
103
|
-
onMountedFun(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
//
|
141
|
-
|
142
|
-
const
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
:
|
171
|
-
:
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
</
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
}
|
222
|
-
|
1
|
+
<script setup>
|
2
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
3
|
+
import { reactive, ref, provide } from 'vue'
|
4
|
+
import RenderRow from './RenderRow'
|
5
|
+
import XErrorView from '@vue2-client/base-client/components/layout/XPageView/XErrorView.vue'
|
6
|
+
|
7
|
+
// 页面布局配置
|
8
|
+
const layout = ref(null)
|
9
|
+
|
10
|
+
// 加载状态:0-加载中,1-已加载,2-出现错误
|
11
|
+
const loadingStatus = {
|
12
|
+
LOADING: 0,
|
13
|
+
LOADED: 1,
|
14
|
+
ERROR: 2
|
15
|
+
}
|
16
|
+
const loaded = ref(loadingStatus.LOADING)
|
17
|
+
|
18
|
+
// 组件计数
|
19
|
+
const componentTotal = ref(0)
|
20
|
+
const registerComponentTotal = ref(0)
|
21
|
+
|
22
|
+
// 组件注册集合
|
23
|
+
const componentRefMap = reactive({})
|
24
|
+
|
25
|
+
// 数据上下文
|
26
|
+
const dataContext = reactive({
|
27
|
+
comps: componentRefMap,
|
28
|
+
func: {
|
29
|
+
getConfigByName
|
30
|
+
},
|
31
|
+
data: {}
|
32
|
+
})
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 初始化构建页面组件
|
36
|
+
*/
|
37
|
+
const init = (params) => {
|
38
|
+
const { configName, configValue, serviceName } = params
|
39
|
+
|
40
|
+
// 重置状态
|
41
|
+
loaded.value = loadingStatus.LOADING
|
42
|
+
componentTotal.value = 0
|
43
|
+
registerComponentTotal.value = 0
|
44
|
+
Object.keys(componentRefMap).forEach(key => delete componentRefMap[key])
|
45
|
+
|
46
|
+
const processConfig = (config) => {
|
47
|
+
if (!config) {
|
48
|
+
loaded.value = loadingStatus.ERROR
|
49
|
+
return
|
50
|
+
}
|
51
|
+
|
52
|
+
layout.value = config
|
53
|
+
setComponentTotal(layout.value.children)
|
54
|
+
loaded.value = loadingStatus.LOADED
|
55
|
+
}
|
56
|
+
|
57
|
+
if (configName) {
|
58
|
+
getConfigByName(configName, serviceName, processConfig)
|
59
|
+
} else if (configValue) {
|
60
|
+
try {
|
61
|
+
const config = typeof configValue === 'string' ? JSON.parse(configValue) : configValue
|
62
|
+
processConfig(config)
|
63
|
+
} catch (error) {
|
64
|
+
console.error('配置解析错误:', error)
|
65
|
+
loaded.value = loadingStatus.ERROR
|
66
|
+
}
|
67
|
+
} else {
|
68
|
+
loaded.value = loadingStatus.ERROR
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* 注册组件
|
74
|
+
*/
|
75
|
+
const registerComponent = (name, vm) => {
|
76
|
+
if (!vm) return
|
77
|
+
|
78
|
+
componentRefMap[name] = vm
|
79
|
+
registerComponentTotal.value++
|
80
|
+
console.debug(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
|
81
|
+
|
82
|
+
// 所有组件都已注册完成
|
83
|
+
if (registerComponentTotal.value >= componentTotal.value) {
|
84
|
+
registerEvents(layout.value.children)
|
85
|
+
// 初始化页面
|
86
|
+
initPage()
|
87
|
+
}
|
88
|
+
}
|
89
|
+
provide('registerComponent', registerComponent)
|
90
|
+
// 提供数据上下文给子组件
|
91
|
+
provide('dataContext', dataContext)
|
92
|
+
|
93
|
+
/**
|
94
|
+
* 初始化页面
|
95
|
+
*/
|
96
|
+
const initPage = () => {
|
97
|
+
if (!layout.value?.onMounted) return
|
98
|
+
|
99
|
+
console.info('开始初始化页面')
|
100
|
+
try {
|
101
|
+
// 使用 Function 构造函数替代 eval
|
102
|
+
// eslint-disable-next-line no-new-func
|
103
|
+
const onMountedFun = new Function('data', `return (${layout.value.onMounted})(data)`)
|
104
|
+
onMountedFun(dataContext)
|
105
|
+
} catch (error) {
|
106
|
+
console.error('页面初始化错误:', error)
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* 设置需要注册的组件总数
|
112
|
+
*/
|
113
|
+
const setComponentTotal = (children) => {
|
114
|
+
if (!children?.length) return
|
115
|
+
|
116
|
+
children.forEach((child) => {
|
117
|
+
// 如果不是row和text类型,追加组件数量
|
118
|
+
if (child.type !== 'row' && child.type !== 'text') {
|
119
|
+
componentTotal.value++
|
120
|
+
}
|
121
|
+
|
122
|
+
// 递归追加子组件数量
|
123
|
+
if (child.children?.length) {
|
124
|
+
setComponentTotal(child.children)
|
125
|
+
}
|
126
|
+
})
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* 注册组件事件
|
131
|
+
*/
|
132
|
+
const registerEvents = (children) => {
|
133
|
+
if (!children?.length) return
|
134
|
+
|
135
|
+
children.forEach((child) => {
|
136
|
+
// 如果有事件,注册它们
|
137
|
+
if (child.event) {
|
138
|
+
Object.entries(child.event).forEach(([eventName, handler]) => {
|
139
|
+
try {
|
140
|
+
// 使用 Function 构造函数替代 eval
|
141
|
+
// eslint-disable-next-line no-new-func
|
142
|
+
const eventHandler = new Function('...args', `return (${handler})(...args)`)
|
143
|
+
const componentInstance = componentRefMap[child.id]
|
144
|
+
|
145
|
+
if (componentInstance) {
|
146
|
+
componentInstance.$on(eventName, (...args) => {
|
147
|
+
eventHandler.call(componentInstance, ...args, dataContext)
|
148
|
+
})
|
149
|
+
}
|
150
|
+
} catch (error) {
|
151
|
+
console.error(`注册事件 ${eventName} 错误:`, error)
|
152
|
+
}
|
153
|
+
})
|
154
|
+
}
|
155
|
+
|
156
|
+
// 递归注册子组件的事件
|
157
|
+
if (child.children?.length) {
|
158
|
+
registerEvents(child.children)
|
159
|
+
}
|
160
|
+
})
|
161
|
+
}
|
162
|
+
|
163
|
+
// 导出组件接口
|
164
|
+
defineExpose({ init })
|
165
|
+
</script>
|
166
|
+
|
167
|
+
<template>
|
168
|
+
<a-row
|
169
|
+
type="flex"
|
170
|
+
:gutter="layout?.gutter || 0"
|
171
|
+
:align="layout?.align || 'top'"
|
172
|
+
:justify="layout?.justify || 'start'"
|
173
|
+
class="liuli-page">
|
174
|
+
<template v-if="loaded === loadingStatus.LOADED">
|
175
|
+
<template v-if="layout.children?.length">
|
176
|
+
<a-col v-for="row in layout.children" :key="`page-col-${row.id}`" :span="24">
|
177
|
+
<render-row :row="row"/>
|
178
|
+
</a-col>
|
179
|
+
</template>
|
180
|
+
<template v-else>
|
181
|
+
<div class="liuli-page__empty">
|
182
|
+
<a-empty description="无页面内容" />
|
183
|
+
</div>
|
184
|
+
</template>
|
185
|
+
</template>
|
186
|
+
|
187
|
+
<template v-else-if="loaded === loadingStatus.LOADING">
|
188
|
+
<div class="liuli-page__loading">
|
189
|
+
<a-spin tip="页面加载中..." />
|
190
|
+
</div>
|
191
|
+
</template>
|
192
|
+
|
193
|
+
<template v-else>
|
194
|
+
<div class="liuli-page__error">
|
195
|
+
<XErrorView />
|
196
|
+
</div>
|
197
|
+
</template>
|
198
|
+
</a-row>
|
199
|
+
</template>
|
200
|
+
|
201
|
+
<style scoped lang="less">
|
202
|
+
.liuli-page {
|
203
|
+
position: relative;
|
204
|
+
width: 100%;
|
205
|
+
height: 100%;
|
206
|
+
|
207
|
+
&__content {
|
208
|
+
min-height: 100px;
|
209
|
+
}
|
210
|
+
|
211
|
+
&__loading, &__error, &__empty {
|
212
|
+
display: flex;
|
213
|
+
width: 100%;
|
214
|
+
justify-content: center;
|
215
|
+
align-items: center;
|
216
|
+
min-height: 200px;
|
217
|
+
}
|
218
|
+
|
219
|
+
&__error {
|
220
|
+
width: 100%;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
</style>
|