vue2-client 1.14.84 → 1.14.85
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/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/XShiftSchedule/XShiftSchedule.vue +9 -24
- 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/XPageViewExample/index.vue +41 -8
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="list-container" style="display: flex;">
|
3
3
|
<template v-for="(config, index) in configs">
|
4
|
-
<x-questionnaire-item :queryParamsName="config" :ref="el => setItemRef(el, index)" :key="`questionnaire-${index}`"></x-questionnaire-item>
|
4
|
+
<x-questionnaire-item :fixedQueryForm="conditions[index]" :queryParamsName="config" :ref="el => setItemRef(el, index)" :key="`questionnaire-${index}`"></x-questionnaire-item>
|
5
5
|
</template>
|
6
6
|
</div>
|
7
7
|
</template>
|
@@ -26,24 +26,37 @@ export default {
|
|
26
26
|
data () {
|
27
27
|
return {
|
28
28
|
configs: [],
|
29
|
-
questionnaireItemRefs: [] // 存储子组件实例
|
29
|
+
questionnaireItemRefs: [], // 存储子组件实例
|
30
|
+
conditions: []
|
30
31
|
}
|
31
32
|
},
|
32
|
-
created () {
|
33
|
-
this.getData(this.queryParamsName)
|
34
|
-
},
|
35
33
|
methods: {
|
36
34
|
// 获取配置
|
37
|
-
async getData (queryParamsName) {
|
35
|
+
async getData (queryParamsName, conditions) {
|
38
36
|
const that = this
|
39
37
|
getConfigByName(queryParamsName, 'af-his', res => {
|
40
|
-
|
38
|
+
if (res.configs) {
|
39
|
+
that.configs = []
|
40
|
+
}
|
41
|
+
for (let i = 0; i < res.configs.length; i++) {
|
42
|
+
const condition = i < conditions.length ? conditions[i] : {}
|
43
|
+
that.configs.push(res.configs[i])
|
44
|
+
that.conditions.push(condition)
|
45
|
+
}
|
41
46
|
})
|
42
47
|
},
|
43
48
|
setItemRef (el, index) {
|
44
49
|
if (el) {
|
45
50
|
this.questionnaireItemRefs[index] = el // 保存实例
|
46
51
|
}
|
52
|
+
},
|
53
|
+
init (conditions) {
|
54
|
+
this.getData(this.queryParamsName, conditions)
|
55
|
+
},
|
56
|
+
refreshList (index, condition) {
|
57
|
+
if (index < this.conditions.length) {
|
58
|
+
this.conditions[index] = condition
|
59
|
+
}
|
47
60
|
}
|
48
61
|
},
|
49
62
|
}
|
@@ -9,14 +9,23 @@ export default {
|
|
9
9
|
return {
|
10
10
|
queryParamsName: 'surgeryRiskAssessConfig'
|
11
11
|
}
|
12
|
+
},
|
13
|
+
methods: {
|
14
|
+
init () {
|
15
|
+
console.log(this)
|
16
|
+
this.$refs.questionnaireRef.init([{ id: 10 }, { id: 20 }, { id: 10 }])
|
17
|
+
}
|
12
18
|
}
|
13
19
|
}
|
14
20
|
</script>
|
15
21
|
|
16
22
|
<template>
|
17
23
|
<div style="display: flex">
|
18
|
-
<x-questionnaire :queryParamsName="queryParamsName">
|
24
|
+
<x-questionnaire ref="questionnaireRef" :queryParamsName="queryParamsName">
|
19
25
|
</x-questionnaire>
|
26
|
+
<a-button type="primary" @click="init">
|
27
|
+
初始化
|
28
|
+
</a-button>
|
20
29
|
</div>
|
21
30
|
</template>
|
22
31
|
|
@@ -7,17 +7,19 @@
|
|
7
7
|
<span slot="time" class="time-title">
|
8
8
|
<span v-for="(item, index) in configData.timePeriod" :key="index">{{ item }}</span>
|
9
9
|
</span>
|
10
|
-
<
|
11
|
-
|
12
|
-
<
|
13
|
-
|
10
|
+
<div v-for="(item, index) in weekDays" :key="index" :slot="item.key">
|
11
|
+
<a-button slot="lastWeek" icon="left" size="large" @click="handleLastWeek" v-if="item.title == '周一'" />
|
12
|
+
<div class="time-title">
|
13
|
+
<span>{{item.title}}</span>
|
14
|
+
<span>{{ currentWeekDates[index].toLocaleDateString() }}</span>
|
15
|
+
</div>
|
16
|
+
<a-button slot="nextWeek" icon="right" size="large" @click="handleNextWeek" v-if="item.title == '周日'"/>
|
14
17
|
</div>
|
15
18
|
<template :slot="day.key" slot-scope="text, record" v-for="day in shiftTable">
|
16
19
|
<div class="time-title" :key="day.key">
|
17
20
|
<a-button v-for="(item, index) in record[day.key]" :key="index" @click="handleShiftChange(day.key, index, record)">{{ item === 1 || item === '1' ? '坐诊' : '休息' }}</a-button>
|
18
21
|
</div>
|
19
22
|
</template>
|
20
|
-
<a-button slot="nextWeek" icon="right" size="large" @click="handleNextWeek" />
|
21
23
|
<template slot="sk_limit" slot-scope="text, record">
|
22
24
|
<a-input-number id="inputNumber" v-model="record.sk_limit" :min="configData.sk_limitMin" :max="configData.sk_limitMax" />
|
23
25
|
</template>
|
@@ -49,29 +51,12 @@ export default {
|
|
49
51
|
return { title, key }
|
50
52
|
})],
|
51
53
|
// 排班时间表
|
52
|
-
shiftTable: [
|
53
|
-
{
|
54
|
-
dataIndex: 'lastWeek',
|
55
|
-
key: 'lastWeek',
|
56
|
-
slots: { title: 'lastWeek' },
|
57
|
-
scopedSlots: { customRender: 'lastWeekTitle' },
|
58
|
-
align: 'center',
|
59
|
-
width: 80
|
60
|
-
},
|
61
|
-
...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
54
|
+
shiftTable: [...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
62
55
|
const key = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][index]
|
63
56
|
return {
|
64
|
-
key, dataIndex: key, scopedSlots: { customRender: key }, slots: { title: key }, align: 'center', width: 120
|
57
|
+
key, dataIndex: key, scopedSlots: { customRender: key }, slots: { title: key }, align: 'center', width: key === 'Monday' || key === 'Sunday' ? 150 : 120
|
65
58
|
}
|
66
59
|
}),
|
67
|
-
{
|
68
|
-
dataIndex: 'nextWeek',
|
69
|
-
key: 'nextWeek',
|
70
|
-
slots: { title: 'nextWeek' },
|
71
|
-
scopedSlots: { customRender: 'nextWeekTitle' },
|
72
|
-
align: 'center',
|
73
|
-
width: 80
|
74
|
-
},
|
75
60
|
{
|
76
61
|
title: '排班数',
|
77
62
|
key: 'sk_limit',
|
@@ -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>
|
@@ -1,38 +1,77 @@
|
|
1
1
|
# XPageView
|
2
2
|
|
3
|
-
JSON
|
3
|
+
基于 JSON 配置动态构建页面的容器组件,具有高度的灵活性和可扩展性。
|
4
4
|
|
5
|
-
|
5
|
+
## 使用方法
|
6
6
|
|
7
7
|
```vue
|
8
8
|
<template>
|
9
|
-
<x-page-view ref="
|
9
|
+
<x-page-view ref="pageView" />
|
10
10
|
</template>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
11
|
+
|
12
|
+
<script setup>
|
13
|
+
import { ref, onMounted } from 'vue'
|
14
|
+
import XPageView from '@vue2-client/base-client/components/layout/XPageView'
|
15
|
+
|
16
|
+
const pageView = ref(null)
|
17
|
+
|
18
|
+
onMounted(() => {
|
19
|
+
initView()
|
20
|
+
})
|
21
|
+
|
22
|
+
const initView = () => {
|
23
|
+
pageView.value.init({
|
24
|
+
configName: 'templateTreeConfig',
|
25
|
+
serviceName: 'af-his'
|
26
|
+
})
|
27
|
+
}
|
31
28
|
</script>
|
32
29
|
```
|
33
30
|
|
34
31
|
## API
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
|
33
|
+
### 属性
|
34
|
+
|
35
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
36
|
+
| --- | --- | --- | --- |
|
37
|
+
| - | - | - | - |
|
38
|
+
|
39
|
+
### 方法
|
40
|
+
|
41
|
+
| 方法名 | 说明 | 参数 |
|
42
|
+
| --- | --- | --- |
|
43
|
+
| init | 初始化页面组件 | `{ configName, configValue, serviceName }` |
|
44
|
+
|
45
|
+
### 参数说明
|
46
|
+
|
47
|
+
| 参数名 | 说明 | 类型 | 必填 |
|
48
|
+
| --- | --- | --- | --- |
|
49
|
+
| configName | 配置名称,用于从服务端获取配置 | String | 二选一 |
|
50
|
+
| configValue | 配置的JSON数据,可以是字符串或对象 | String/Object | 二选一 |
|
51
|
+
| serviceName | 服务名称 | String | 是 |
|
52
|
+
|
53
|
+
## 结构化配置项
|
54
|
+
|
55
|
+
```json
|
56
|
+
{
|
57
|
+
"children": [
|
58
|
+
{
|
59
|
+
"type": "row",
|
60
|
+
"id": "row1",
|
61
|
+
"gutter": 16,
|
62
|
+
"children": [
|
63
|
+
{
|
64
|
+
"type": "XFormTable",
|
65
|
+
"id": "table1",
|
66
|
+
"span": 24,
|
67
|
+
"props": { ... },
|
68
|
+
"event": {
|
69
|
+
"change": "function(val, data) { console.log(val) }"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"onMounted": "function(data) { console.log('页面已加载') }"
|
76
|
+
}
|
77
|
+
```
|
@@ -8,19 +8,52 @@ onMounted(() => {
|
|
8
8
|
xPageViewRef.value.init({
|
9
9
|
configValue: `{
|
10
10
|
"type": "page",
|
11
|
-
"onMounted": "function (data) {
|
11
|
+
"onMounted": "function (data) {}",
|
12
|
+
"gutter": [16, 16],
|
12
13
|
"children": [
|
13
14
|
{
|
14
|
-
"id": "
|
15
|
-
"type": "
|
15
|
+
"id": "row1",
|
16
|
+
"type": "row",
|
17
|
+
"gutter": 16,
|
18
|
+
"children": [
|
19
|
+
{
|
20
|
+
"id": "xFormTable2",
|
21
|
+
"span": "12",
|
22
|
+
"type": "XFormTable",
|
23
|
+
"event": {
|
24
|
+
},
|
25
|
+
"props": {
|
26
|
+
"serviceName": "af-system",
|
27
|
+
"queryParamsName": "crud_dictionary_manage"
|
28
|
+
},
|
29
|
+
"children": [
|
30
|
+
]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"id": "xFormTable3",
|
34
|
+
"span": "12",
|
35
|
+
"type": "XFormTable",
|
36
|
+
"event": {
|
37
|
+
},
|
38
|
+
"props": {
|
39
|
+
"serviceName": "af-system",
|
40
|
+
"queryParamsName": "crud_dictionary_manage"
|
41
|
+
},
|
42
|
+
"children": [
|
43
|
+
]
|
44
|
+
}
|
45
|
+
]
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": "xFormTable",
|
49
|
+
"type": "XFormTable",
|
16
50
|
"event": {
|
17
|
-
|
51
|
+
},
|
52
|
+
"props": {
|
53
|
+
"serviceName": "af-system",
|
54
|
+
"queryParamsName": "crud_dictionary_manage"
|
18
55
|
},
|
19
56
|
"children": [
|
20
|
-
{
|
21
|
-
"id": "xTreeViewAddNativeForm1",
|
22
|
-
"type": "XAddNativeForm"
|
23
|
-
}
|
24
57
|
]
|
25
58
|
}
|
26
59
|
]
|