vue2-client 1.14.83 → 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/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095553.vue +242 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095610.vue +242 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613095612.vue +242 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100041.vue +251 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100047.vue +251 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100054.vue +250 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100105.vue +250 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100107.vue +250 -0
- package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue +250 -0
- 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 +49 -31
- 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/src/router/async/router.map.js +1 -1
package/.history/src/base-client/components/his/XShiftSchedule/XShiftSchedule_20250613100114.vue
ADDED
@@ -0,0 +1,250 @@
|
|
1
|
+
<template>
|
2
|
+
<a-table
|
3
|
+
:columns="columns"
|
4
|
+
:data-source="data"
|
5
|
+
:rowSelection="rowSelection"
|
6
|
+
:scroll="{ y: '75vh' }">
|
7
|
+
<span slot="time" class="time-title">
|
8
|
+
<span v-for="(item, index) in configData.timePeriod" :key="index">{{ item }}</span>
|
9
|
+
</span>
|
10
|
+
<a-button slot="lastWeek" icon="left" size="large" @click="handleLastWeek" />
|
11
|
+
<div v-for="(item, index) in weekDays" :key="index" :slot="item.key" class="time-title">
|
12
|
+
<span>{{item.title}}</span>
|
13
|
+
<span>{{ currentWeekDates[index].toLocaleDateString() }}</span>
|
14
|
+
</div>
|
15
|
+
<template :slot="day.key" slot-scope="text, record" v-for="day in shiftTable">
|
16
|
+
<div class="time-title" :key="day.key">
|
17
|
+
<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
|
+
</div>
|
19
|
+
</template>
|
20
|
+
<a-button slot="nextWeek" icon="right" size="large" @click="handleNextWeek" />
|
21
|
+
<template slot="sk_limit" slot-scope="text, record">
|
22
|
+
<a-input-number id="inputNumber" v-model="record.sk_limit" :min="configData.sk_limitMin" :max="configData.sk_limitMax" />
|
23
|
+
</template>
|
24
|
+
</a-table>
|
25
|
+
</template>
|
26
|
+
<script>
|
27
|
+
import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
|
28
|
+
|
29
|
+
export default {
|
30
|
+
data () {
|
31
|
+
return {
|
32
|
+
data: [],
|
33
|
+
// 列配置
|
34
|
+
columns: [],
|
35
|
+
// 列名
|
36
|
+
columnNames: [],
|
37
|
+
// 选中的行键值集合
|
38
|
+
selectedRows: [],
|
39
|
+
// 选中的行信息集合
|
40
|
+
selectedRowKeys: [],
|
41
|
+
// 原始数据备份
|
42
|
+
originalData: [],
|
43
|
+
// 配置参数
|
44
|
+
configData: {},
|
45
|
+
// 当前显示的周次日期
|
46
|
+
currentWeekDates: [],
|
47
|
+
weekDays: [...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
48
|
+
const key = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][index]
|
49
|
+
return { title, key }
|
50
|
+
})],
|
51
|
+
// 排班时间表
|
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) => {
|
62
|
+
const key = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][index]
|
63
|
+
return {
|
64
|
+
key, dataIndex: key, scopedSlots: { customRender: key }, slots: { title: key }, align: 'center', width: 120
|
65
|
+
}
|
66
|
+
}),
|
67
|
+
{
|
68
|
+
dataIndex: 'nextWeek',
|
69
|
+
key: 'nextWeek',
|
70
|
+
slots: { title: 'nextWeek' },
|
71
|
+
scopedSlots: { customRender: 'nextWeekTitle' },
|
72
|
+
align: 'center',
|
73
|
+
width: 80
|
74
|
+
},
|
75
|
+
{
|
76
|
+
title: '排班数',
|
77
|
+
key: 'sk_limit',
|
78
|
+
dataIndex: 'sk_limit',
|
79
|
+
scopedSlots: { customRender: 'sk_limit' },
|
80
|
+
align: 'center'
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
},
|
85
|
+
props: {
|
86
|
+
// 配置名
|
87
|
+
queryParamsName: {
|
88
|
+
type: String,
|
89
|
+
default: ''
|
90
|
+
},
|
91
|
+
// 服务名
|
92
|
+
serviceName: {
|
93
|
+
type: String,
|
94
|
+
default: 'af-his'
|
95
|
+
}
|
96
|
+
},
|
97
|
+
computed: {
|
98
|
+
rowSelection () {
|
99
|
+
return {
|
100
|
+
selectedRowKeys: this.selectedRowKeys,
|
101
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
102
|
+
this.onSelectChange(selectedRowKeys, selectedRows)
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
},
|
107
|
+
mounted () {
|
108
|
+
this.initWeekDates()
|
109
|
+
},
|
110
|
+
methods: {
|
111
|
+
handleShiftChange (day, index, record) {
|
112
|
+
// 找到当前记录在data中的索引
|
113
|
+
const dataIndex = this.data.findIndex(item => item.id === record.id)
|
114
|
+
if (dataIndex === -1) return
|
115
|
+
// 获取当前状态
|
116
|
+
const currentValue = record[day][index]
|
117
|
+
const newValue = currentValue === 1 || currentValue === '1' ? 0 : 1
|
118
|
+
// 更新按钮显示
|
119
|
+
this.$set(record[day], index, newValue)
|
120
|
+
// 同步更新data中的数据
|
121
|
+
this.$set(this.data[dataIndex][day], index, newValue)
|
122
|
+
},
|
123
|
+
onSelectChange (selectedRowKeys, selectedRows) {
|
124
|
+
this.selectedRowKeys = selectedRowKeys
|
125
|
+
this.selectedRows = selectedRows
|
126
|
+
},
|
127
|
+
// 获取选中的行数据
|
128
|
+
getSelectedRowData () {
|
129
|
+
return this.selectedRows
|
130
|
+
},
|
131
|
+
// 获取全部数据
|
132
|
+
getAllTable () {
|
133
|
+
return this.data
|
134
|
+
},
|
135
|
+
// 初始化数据
|
136
|
+
async init (queryParamsName) {
|
137
|
+
getConfigByName(queryParamsName, this.serviceName, result => {
|
138
|
+
this.configData = result
|
139
|
+
runLogic(result.dataSource, {}, this.serviceName).then(res => {
|
140
|
+
this.columns = []
|
141
|
+
this.columns = JSON.parse(JSON.stringify(this.configData.columns))
|
142
|
+
for (let i = 0; i < this.shiftTable.length; i++) {
|
143
|
+
this.columns.push(this.shiftTable[i])
|
144
|
+
}
|
145
|
+
if (res && Array.isArray(res)) {
|
146
|
+
const weekDays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
|
147
|
+
const shifts = ['am', 'pm', 'evening']
|
148
|
+
let key = 0
|
149
|
+
this.data = res.map(item => {
|
150
|
+
const scheduleData = {
|
151
|
+
key: key++
|
152
|
+
}
|
153
|
+
this.configData.columnsName.forEach(columnName => { scheduleData[columnName] = item[columnName] })
|
154
|
+
weekDays.forEach(day => {
|
155
|
+
scheduleData[day.charAt(0).toUpperCase() + day.slice(1)] = shifts.map(shift => item[`f_${day}_${shift}`] === '1' ? 1 : 0)
|
156
|
+
})
|
157
|
+
return scheduleData
|
158
|
+
})
|
159
|
+
// 保存原始数据
|
160
|
+
this.originalData = JSON.parse(JSON.stringify(this.data))
|
161
|
+
}
|
162
|
+
})
|
163
|
+
})
|
164
|
+
},
|
165
|
+
// 查询数据函数
|
166
|
+
filterTableData (filters) {
|
167
|
+
if (!filters || Object.keys(filters).length === 0) {
|
168
|
+
// 如果没有过滤条件,恢复原始数据
|
169
|
+
this.data = JSON.parse(JSON.stringify(this.originalData))
|
170
|
+
return
|
171
|
+
}
|
172
|
+
// 从原始数据开始过滤
|
173
|
+
this.data = this.originalData.filter(item => {
|
174
|
+
// 检查每一项是否满足所有过滤条件
|
175
|
+
return Object.entries(filters).every(([key, value]) => {
|
176
|
+
// 如果过滤值是字符串,进行模糊匹配
|
177
|
+
if (typeof value === 'string') {
|
178
|
+
return item[key] && item[key].toString().toLowerCase().includes(value.toLowerCase())
|
179
|
+
}
|
180
|
+
// 如果过滤值是数字,进行精确匹配
|
181
|
+
return item[key] === value
|
182
|
+
})
|
183
|
+
})
|
184
|
+
},
|
185
|
+
// 初始化周次日期
|
186
|
+
initWeekDates () {
|
187
|
+
const today = new Date()
|
188
|
+
const currentDay = today.getDay() || 7 // 将周日的0转换为7
|
189
|
+
const monday = new Date(today)
|
190
|
+
monday.setDate(today.getDate() - currentDay + 1) // 设置为本周一
|
191
|
+
|
192
|
+
this.currentWeekDates = Array.from({ length: 7 }, (_, index) => {
|
193
|
+
const date = new Date(monday)
|
194
|
+
date.setDate(monday.getDate() + index)
|
195
|
+
return date
|
196
|
+
})
|
197
|
+
},
|
198
|
+
// 切换到上一周
|
199
|
+
handleLastWeek () {
|
200
|
+
const monday = new Date(this.currentWeekDates[0])
|
201
|
+
monday.setDate(monday.getDate() - 7)
|
202
|
+
this.updateWeekDates(monday)
|
203
|
+
},
|
204
|
+
// 切换到下一周
|
205
|
+
handleNextWeek () {
|
206
|
+
const monday = new Date(this.currentWeekDates[0])
|
207
|
+
monday.setDate(monday.getDate() + 7)
|
208
|
+
this.updateWeekDates(monday)
|
209
|
+
},
|
210
|
+
// 更新周次日期
|
211
|
+
updateWeekDates (monday) {
|
212
|
+
this.currentWeekDates = Array.from({ length: 7 }, (_, index) => {
|
213
|
+
const date = new Date(monday)
|
214
|
+
date.setDate(monday.getDate() + index)
|
215
|
+
return date
|
216
|
+
})
|
217
|
+
}
|
218
|
+
},
|
219
|
+
watch: {
|
220
|
+
queryParamsName: {
|
221
|
+
handler (newValue) {
|
222
|
+
this.init(newValue)
|
223
|
+
},
|
224
|
+
deep: true,
|
225
|
+
immediate: true
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
</script>
|
230
|
+
|
231
|
+
<style scoped>
|
232
|
+
.time-title {
|
233
|
+
display: flex !important;
|
234
|
+
flex-direction: column !important;
|
235
|
+
align-items: center !important;
|
236
|
+
}
|
237
|
+
::v-deep .ant-table-thead > tr > th,
|
238
|
+
::v-deep .ant-table-tbody > tr > td {
|
239
|
+
padding: 8px 16px !important;
|
240
|
+
overflow-wrap: break-word;
|
241
|
+
}
|
242
|
+
|
243
|
+
::v-deep .ant-table-thead > tr > th .ant-btn {
|
244
|
+
margin: 0 4px;
|
245
|
+
}
|
246
|
+
|
247
|
+
::v-deep .ant-table-thead > tr > th .time-title {
|
248
|
+
margin: 0 -4px;
|
249
|
+
}
|
250
|
+
</style>
|
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
|
|
@@ -3,20 +3,23 @@
|
|
3
3
|
:columns="columns"
|
4
4
|
:data-source="data"
|
5
5
|
:rowSelection="rowSelection"
|
6
|
-
:scroll="{ y: '
|
6
|
+
:scroll="{ y: '70vh' }">
|
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
|
-
<
|
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 == '周日'"/>
|
13
17
|
</div>
|
14
18
|
<template :slot="day.key" slot-scope="text, record" v-for="day in shiftTable">
|
15
19
|
<div class="time-title" :key="day.key">
|
16
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>
|
17
21
|
</div>
|
18
22
|
</template>
|
19
|
-
<a-button slot="nextWeek" icon="right" size="large" />
|
20
23
|
<template slot="sk_limit" slot-scope="text, record">
|
21
24
|
<a-input-number id="inputNumber" v-model="record.sk_limit" :min="configData.sk_limitMin" :max="configData.sk_limitMax" />
|
22
25
|
</template>
|
@@ -41,39 +44,19 @@ export default {
|
|
41
44
|
originalData: [],
|
42
45
|
// 配置参数
|
43
46
|
configData: {},
|
47
|
+
// 当前显示的周次日期
|
48
|
+
currentWeekDates: [],
|
44
49
|
weekDays: [...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
45
50
|
const key = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][index]
|
46
51
|
return { title, key }
|
47
52
|
})],
|
48
53
|
// 排班时间表
|
49
|
-
shiftTable: [
|
50
|
-
{
|
51
|
-
dataIndex: 'lastWeek',
|
52
|
-
key: 'lastWeek',
|
53
|
-
slots: { title: 'lastWeek' },
|
54
|
-
scopedSlots: { customRender: 'lastWeekTitle' },
|
55
|
-
align: 'center',
|
56
|
-
width: 80
|
57
|
-
},
|
58
|
-
...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
54
|
+
shiftTable: [...['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((title, index) => {
|
59
55
|
const key = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'][index]
|
60
56
|
return {
|
61
|
-
title,
|
62
|
-
key,
|
63
|
-
dataIndex: key,
|
64
|
-
scopedSlots: { customRender: key },
|
65
|
-
slots: { title: key },
|
66
|
-
align: 'center'
|
57
|
+
key, dataIndex: key, scopedSlots: { customRender: key }, slots: { title: key }, align: 'center', width: key === 'Monday' || key === 'Sunday' ? 150 : 120
|
67
58
|
}
|
68
59
|
}),
|
69
|
-
{
|
70
|
-
dataIndex: 'nextWeek',
|
71
|
-
key: 'nextWeek',
|
72
|
-
slots: { title: 'nextWeek' },
|
73
|
-
scopedSlots: { customRender: 'nextWeekTitle' },
|
74
|
-
align: 'center',
|
75
|
-
width: 80
|
76
|
-
},
|
77
60
|
{
|
78
61
|
title: '排班数',
|
79
62
|
key: 'sk_limit',
|
@@ -106,7 +89,9 @@ export default {
|
|
106
89
|
}
|
107
90
|
}
|
108
91
|
},
|
109
|
-
mounted () {
|
92
|
+
mounted () {
|
93
|
+
this.initWeekDates()
|
94
|
+
},
|
110
95
|
methods: {
|
111
96
|
handleShiftChange (day, index, record) {
|
112
97
|
// 找到当前记录在data中的索引
|
@@ -181,6 +166,39 @@ export default {
|
|
181
166
|
return item[key] === value
|
182
167
|
})
|
183
168
|
})
|
169
|
+
},
|
170
|
+
// 初始化周次日期
|
171
|
+
initWeekDates () {
|
172
|
+
const today = new Date()
|
173
|
+
const currentDay = today.getDay() || 7 // 将周日的0转换为7
|
174
|
+
const monday = new Date(today)
|
175
|
+
monday.setDate(today.getDate() - currentDay + 1) // 设置为本周一
|
176
|
+
|
177
|
+
this.currentWeekDates = Array.from({ length: 7 }, (_, index) => {
|
178
|
+
const date = new Date(monday)
|
179
|
+
date.setDate(monday.getDate() + index)
|
180
|
+
return date
|
181
|
+
})
|
182
|
+
},
|
183
|
+
// 切换到上一周
|
184
|
+
handleLastWeek () {
|
185
|
+
const monday = new Date(this.currentWeekDates[0])
|
186
|
+
monday.setDate(monday.getDate() - 7)
|
187
|
+
this.updateWeekDates(monday)
|
188
|
+
},
|
189
|
+
// 切换到下一周
|
190
|
+
handleNextWeek () {
|
191
|
+
const monday = new Date(this.currentWeekDates[0])
|
192
|
+
monday.setDate(monday.getDate() + 7)
|
193
|
+
this.updateWeekDates(monday)
|
194
|
+
},
|
195
|
+
// 更新周次日期
|
196
|
+
updateWeekDates (monday) {
|
197
|
+
this.currentWeekDates = Array.from({ length: 7 }, (_, index) => {
|
198
|
+
const date = new Date(monday)
|
199
|
+
date.setDate(monday.getDate() + index)
|
200
|
+
return date
|
201
|
+
})
|
184
202
|
}
|
185
203
|
},
|
186
204
|
watch: {
|
@@ -195,7 +213,7 @@ export default {
|
|
195
213
|
}
|
196
214
|
</script>
|
197
215
|
|
198
|
-
<style scoped
|
216
|
+
<style scoped>
|
199
217
|
.time-title {
|
200
218
|
display: flex !important;
|
201
219
|
flex-direction: column !important;
|
@@ -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>
|