vue2-client 1.16.85 → 1.16.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/package.json +112 -112
- package/src/assets/svg/female.svg +1 -1
- package/src/assets/svg/male.svg +1 -1
- package/src/base-client/components/common/HIS/HButtons/HButtons.vue +381 -381
- package/src/base-client/components/common/HIS/HForm/HForm.vue +492 -492
- package/src/base-client/components/common/HIS/HFormGroup/index.js +3 -3
- package/src/base-client/components/common/HIS/HTab/HTab.vue +443 -443
- package/src/base-client/components/common/XCollapse/XCollapse.vue +833 -833
- package/src/base-client/components/common/XInput/XInput.vue +194 -194
- package/src/base-client/components/common/XTable/XTable.vue +1610 -1610
- package/src/base-client/components/common/XTimeline/XTimeline.vue +478 -478
- package/src/base-client/components/his/XCheckbox/XCheckbox.vue +181 -181
- package/src/base-client/components/his/XHisEditor/XHisEditor.vue +705 -705
- package/src/base-client/components/his/XList/XList.vue +829 -829
- package/src/base-client/components/his/XRadio/XRadio.vue +389 -389
- package/src/base-client/components/his/XSimpleTable/XSimpleTable.vue +159 -159
- package/src/base-client/components/his/XTimeSelect/XTimeSelect.vue +306 -306
- package/src/base-client/components/his/XTitle/XTitle.vue +274 -274
- package/src/base-client/components/his/XTreeRows/XTreeRows.vue +341 -341
- package/src/base-client/components/his/threeTestOrders/editor.vue +113 -113
- package/src/pages/userInfoDetailManage/ExceptionRecordQuery/index.vue +45 -45
- package/src-base-client/components/common/HIS/HForm/HForm.vue +347 -0
- package/src-base-client/components/common/XCollapse/XCollapse.vue +0 -0
|
@@ -1,389 +1,389 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="x-radio-container" :class="wrapperClassObject()">
|
|
3
|
-
<a-radio-group v-model="innerValue" @change="onChange" :class="['x-radio-group', { 'x-radio-group-left': config.alignLeft }]">
|
|
4
|
-
<div
|
|
5
|
-
v-for="item in data"
|
|
6
|
-
:key="item.value"
|
|
7
|
-
class="x-radio-item-container"
|
|
8
|
-
:class="{
|
|
9
|
-
'x-radio-item-bordered': config.showBorder,
|
|
10
|
-
'x-radio-item-highlight': config.highlightBorder
|
|
11
|
-
}"
|
|
12
|
-
:style="getHighlightBorderStyle(item)">
|
|
13
|
-
<div class="x-radio-item-wrapper">
|
|
14
|
-
<div
|
|
15
|
-
v-if="config.showIndicator && item.bottomLine !== false"
|
|
16
|
-
class="x-radio-indicator-left"
|
|
17
|
-
:style="{
|
|
18
|
-
width: item.indicatorWidth || '4px',
|
|
19
|
-
backgroundColor: item.indicatorColor || config.indicatorActiveColor,
|
|
20
|
-
height: item.indicatorHeight || '16px'
|
|
21
|
-
}"
|
|
22
|
-
></div>
|
|
23
|
-
<a-radio
|
|
24
|
-
:value="item.value"
|
|
25
|
-
class="x-radio-item"
|
|
26
|
-
:class="{ 'x-radio-item-no-dot': config.highlightBorder }"
|
|
27
|
-
>
|
|
28
|
-
{{ item.label }}
|
|
29
|
-
</a-radio>
|
|
30
|
-
</div>
|
|
31
|
-
<div
|
|
32
|
-
v-if="config.showIndicator && item.bottomLine !== false && !config.showBorder && !config.highlightBorder"
|
|
33
|
-
class="x-radio-indicator-bottom"
|
|
34
|
-
:style="{
|
|
35
|
-
width: item.indicatorWidth || '100%',
|
|
36
|
-
backgroundColor: item.indicatorColor || config.indicatorActiveColor,
|
|
37
|
-
height: config.indicatorHeight + 'px'
|
|
38
|
-
}"
|
|
39
|
-
></div>
|
|
40
|
-
</div>
|
|
41
|
-
</a-radio-group>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<script>
|
|
46
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
47
|
-
|
|
48
|
-
export default {
|
|
49
|
-
name: 'XRadio',
|
|
50
|
-
inject: ['getComponentByName'],
|
|
51
|
-
props: {
|
|
52
|
-
queryParamsName: {
|
|
53
|
-
type: Object,
|
|
54
|
-
default: null
|
|
55
|
-
},
|
|
56
|
-
// eslint-disable-next-line vue/require-default-prop
|
|
57
|
-
value: [String, Number]
|
|
58
|
-
},
|
|
59
|
-
data () {
|
|
60
|
-
return {
|
|
61
|
-
data: [],
|
|
62
|
-
innerValue: null,
|
|
63
|
-
config: {
|
|
64
|
-
showIndicator: true,
|
|
65
|
-
indicatorHeight: 3,
|
|
66
|
-
indicatorActiveColor: '#1890ff',
|
|
67
|
-
alignLeft: false,
|
|
68
|
-
showBorder: false,
|
|
69
|
-
highlightBorder: false
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
created () {
|
|
74
|
-
this.getData(this.queryParamsName)
|
|
75
|
-
},
|
|
76
|
-
watch: {
|
|
77
|
-
value (val) {
|
|
78
|
-
this.innerValue = val
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
emits: ['change', 'init'],
|
|
82
|
-
methods: {
|
|
83
|
-
async getData (data) {
|
|
84
|
-
getConfigByName(data, 'af-his', res => {
|
|
85
|
-
// 1. 先加载选项
|
|
86
|
-
if (res.radio && Array.isArray(res.radio)) {
|
|
87
|
-
this.data = res.radio
|
|
88
|
-
// 2. 加载指示器配置
|
|
89
|
-
if (res.indicator !== undefined) {
|
|
90
|
-
// 如果indicator是布尔值,则只控制显示/隐藏
|
|
91
|
-
if (typeof res.indicator === 'boolean') {
|
|
92
|
-
this.config.showIndicator = res.indicator
|
|
93
|
-
} else if (typeof res.indicator === 'object') {
|
|
94
|
-
this.config = {
|
|
95
|
-
...this.config,
|
|
96
|
-
...res.indicator
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// 3. 加载布局配置
|
|
101
|
-
if (res.layout !== undefined) {
|
|
102
|
-
if (typeof res.layout === 'object') {
|
|
103
|
-
this.config = {
|
|
104
|
-
...this.config,
|
|
105
|
-
...res.layout
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// 4. 初始化默认值(优先级: 配置defaultValue > 第一个选项)
|
|
110
|
-
if (this.value !== undefined && this.value !== null) {
|
|
111
|
-
this.innerValue = this.value // 优先使用外部传入的 value
|
|
112
|
-
} else if (res.defaultValue !== undefined && res.defaultValue !== null) {
|
|
113
|
-
// 使用配置中的defaultValue
|
|
114
|
-
this.innerValue = res.defaultValue
|
|
115
|
-
} else if (this.data.length > 0) {
|
|
116
|
-
// 如果没有默认值但有选项,使用第一个选项
|
|
117
|
-
this.innerValue = this.data[0].value
|
|
118
|
-
}
|
|
119
|
-
// 5. 触发初始化事件
|
|
120
|
-
this.$emit('init', this.innerValue)
|
|
121
|
-
} else {
|
|
122
|
-
this.$message.error('配置错误,radio字段不是数组')
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
},
|
|
126
|
-
onChange (e) {
|
|
127
|
-
this.innerValue = e.target.value
|
|
128
|
-
this.$emit('change', e.target.value)
|
|
129
|
-
},
|
|
130
|
-
wrapperClassObject () {
|
|
131
|
-
const attrs = this.$attrs || {}
|
|
132
|
-
const classes = {}
|
|
133
|
-
const booleanStyleKeys = [
|
|
134
|
-
'item-0padding', 'compact', 'out-radio'
|
|
135
|
-
]
|
|
136
|
-
booleanStyleKeys.forEach(key => {
|
|
137
|
-
const val = attrs[key]
|
|
138
|
-
const truthy = val === true || val === '' || val === 'true'
|
|
139
|
-
if (truthy) classes[`x-radio-${key}`] = true
|
|
140
|
-
})
|
|
141
|
-
return classes
|
|
142
|
-
},
|
|
143
|
-
getHighlightBorderStyle (item) {
|
|
144
|
-
if (!this.config.highlightBorder) return {}
|
|
145
|
-
|
|
146
|
-
// 如果当前选项被选中且有边框颜色配置,使用配置的颜色
|
|
147
|
-
if (this.innerValue === item.value && item.borderColor) {
|
|
148
|
-
return {
|
|
149
|
-
borderColor: item.borderColor
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// 如果当前选项被选中且有indicatorColor配置,使用indicatorColor作为边框颜色
|
|
154
|
-
if (this.innerValue === item.value && item.indicatorColor) {
|
|
155
|
-
return {
|
|
156
|
-
borderColor: item.indicatorColor
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// 默认返回空对象,使用CSS中的默认灰色边框
|
|
161
|
-
return {}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
</script>
|
|
166
|
-
|
|
167
|
-
<style scoped lang="less">
|
|
168
|
-
.x-radio-container {
|
|
169
|
-
display: flex;
|
|
170
|
-
flex-direction: column;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.x-radio-group {
|
|
174
|
-
display: flex;
|
|
175
|
-
justify-content: space-around;
|
|
176
|
-
|
|
177
|
-
&.x-radio-group-left {
|
|
178
|
-
justify-content: flex-start;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.x-radio-item-container {
|
|
183
|
-
flex: 1;
|
|
184
|
-
display: flex;
|
|
185
|
-
flex-direction: column;
|
|
186
|
-
align-items: center;
|
|
187
|
-
text-align: center;
|
|
188
|
-
padding: 0 8px;
|
|
189
|
-
box-sizing: border-box;
|
|
190
|
-
|
|
191
|
-
.x-radio-group-left & {
|
|
192
|
-
flex: none;
|
|
193
|
-
align-items: flex-start;
|
|
194
|
-
text-align: left;
|
|
195
|
-
margin-right: 16px;
|
|
196
|
-
padding: 0 4px;
|
|
197
|
-
|
|
198
|
-
&:last-child {
|
|
199
|
-
margin-right: 0;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&.x-radio-item-bordered {
|
|
204
|
-
border: 1px solid #d9d9d9;
|
|
205
|
-
border-radius: 173px;
|
|
206
|
-
padding: 8px 12px;
|
|
207
|
-
margin-right: 8px;
|
|
208
|
-
background-color: #fff;
|
|
209
|
-
transition: all 0.3s;
|
|
210
|
-
|
|
211
|
-
&:hover {
|
|
212
|
-
border-color: #40a9ff;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&:last-child {
|
|
216
|
-
margin-right: 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.x-radio-group-left & {
|
|
220
|
-
margin-right: 8px;
|
|
221
|
-
|
|
222
|
-
&:last-child {
|
|
223
|
-
margin-right: 0;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
&.x-radio-item-highlight {
|
|
229
|
-
border: 2px solid #d9d9d9;
|
|
230
|
-
border-radius: 173px;
|
|
231
|
-
padding: 8px 12px;
|
|
232
|
-
margin-right: 8px;
|
|
233
|
-
background-color: #fff;
|
|
234
|
-
transition: all 0.3s;
|
|
235
|
-
position: relative;
|
|
236
|
-
|
|
237
|
-
&:last-child {
|
|
238
|
-
margin-right: 0;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.x-radio-group-left & {
|
|
242
|
-
margin-right: 8px;
|
|
243
|
-
|
|
244
|
-
&:last-child {
|
|
245
|
-
margin-right: 0;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// 动态边框颜色通过内联样式设置
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.x-radio-item-wrapper {
|
|
254
|
-
display: flex;
|
|
255
|
-
align-items: center;
|
|
256
|
-
width: 100%;
|
|
257
|
-
|
|
258
|
-
.x-radio-group-left & {
|
|
259
|
-
justify-content: flex-start;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.x-radio-item {
|
|
264
|
-
margin-bottom: 8px;
|
|
265
|
-
|
|
266
|
-
.x-radio-item-bordered & {
|
|
267
|
-
margin-bottom: 0;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
&.x-radio-item-no-dot {
|
|
271
|
-
:deep(.ant-radio) {
|
|
272
|
-
display: none;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
:deep(.ant-radio-wrapper) {
|
|
276
|
-
padding-left: 0;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.x-radio-indicator-left {
|
|
282
|
-
width: 4px;
|
|
283
|
-
height: 16px;
|
|
284
|
-
margin-right: 8px;
|
|
285
|
-
border-radius: 6px;
|
|
286
|
-
transition: all 0.3s;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.x-radio-indicator-bottom {
|
|
290
|
-
height: 3px;
|
|
291
|
-
transition: all 0.3s;
|
|
292
|
-
max-width: 100%;
|
|
293
|
-
}
|
|
294
|
-
.x-radio-description {
|
|
295
|
-
padding: 4px 4px 4px 4px;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.x-radio-item-0padding {
|
|
299
|
-
&.x-radio-container,
|
|
300
|
-
.x-radio-container {
|
|
301
|
-
:deep(.x-radio-item-container) {
|
|
302
|
-
padding: 0px;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
.x-radio-compact {
|
|
307
|
-
&.x-radio-container,
|
|
308
|
-
.x-radio-container {
|
|
309
|
-
:deep(.simple-inline-item){
|
|
310
|
-
padding: 0px !important;
|
|
311
|
-
}
|
|
312
|
-
:deep(.ant-radio-group){
|
|
313
|
-
display: flex;
|
|
314
|
-
justify-content: space-between;
|
|
315
|
-
}
|
|
316
|
-
:deep(.x-radio-item) > span:last-child {
|
|
317
|
-
padding-right: 2px;
|
|
318
|
-
padding-left: 2px;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
/* 门诊收费样式:字体规格与间距 42px */
|
|
323
|
-
.x-radio-out-radio {
|
|
324
|
-
&.x-radio-container,
|
|
325
|
-
.x-radio-container {
|
|
326
|
-
:deep(.x-radio-group) {
|
|
327
|
-
justify-content: flex-start !important; /* 覆盖默认的 space-around */
|
|
328
|
-
}
|
|
329
|
-
:deep(.ant-radio-wrapper) {
|
|
330
|
-
/* 仅归零内外边距,避免额外空隙 */
|
|
331
|
-
padding: 0;
|
|
332
|
-
margin: 0;
|
|
333
|
-
}
|
|
334
|
-
/* 确保文字本身也应用同样的字体样式(提高优先级并可视化高度) */
|
|
335
|
-
:deep(.ant-radio-wrapper > span:last-child) {
|
|
336
|
-
display: inline-block;
|
|
337
|
-
height: 23px !important;
|
|
338
|
-
line-height: 23px !important;
|
|
339
|
-
font-family: "Source Han Sans" !important;
|
|
340
|
-
font-size: 16px !important;
|
|
341
|
-
font-weight: normal !important;
|
|
342
|
-
letter-spacing: 0em !important;
|
|
343
|
-
color: #313131 !important;
|
|
344
|
-
}
|
|
345
|
-
/* 单选框与文字之间保持 5px 间距 */
|
|
346
|
-
:deep(.ant-radio) { margin-right: 0; }
|
|
347
|
-
:deep(.ant-radio + span) { padding: 0; margin-left: 5px; }
|
|
348
|
-
/* 单选框外圈视觉 16x16,边框 #CDCFD4,背景白色 */
|
|
349
|
-
:deep(.ant-radio-inner) {
|
|
350
|
-
width: 16px;
|
|
351
|
-
height: 16px;
|
|
352
|
-
background: #FFFFFF;
|
|
353
|
-
box-sizing: border-box;
|
|
354
|
-
border: 1px solid #CDCFD4;
|
|
355
|
-
}
|
|
356
|
-
/* 选中时内部实心点 10x10,背景 #0057FE */
|
|
357
|
-
:deep(.ant-radio-checked .ant-radio-inner::after) {
|
|
358
|
-
width: 10px;
|
|
359
|
-
height: 10px;
|
|
360
|
-
background: #0057FE;
|
|
361
|
-
margin: 0;
|
|
362
|
-
left: 50%;
|
|
363
|
-
top: 50%;
|
|
364
|
-
transform: translate(-50%, -50%) scale(1);
|
|
365
|
-
}
|
|
366
|
-
/* 保持外圈边框颜色不被默认覆盖 */
|
|
367
|
-
:deep(.ant-radio-checked .ant-radio-inner) {
|
|
368
|
-
border-color: #CDCFD4;
|
|
369
|
-
background: #FFFFFF;
|
|
370
|
-
}
|
|
371
|
-
:deep(.x-radio-item-container) {
|
|
372
|
-
margin-right: 42px; /* 直接设置42px间距,让第二个单选框与第一个文字距离为42px */
|
|
373
|
-
padding: 0 !important;
|
|
374
|
-
flex: none !important; /* 覆盖默认的 flex: 1 */
|
|
375
|
-
align-items: flex-start !important; /* 覆盖默认的 center */
|
|
376
|
-
text-align: left !important; /* 覆盖默认的 center */
|
|
377
|
-
}
|
|
378
|
-
:deep(.x-radio-item-wrapper) {
|
|
379
|
-
width: auto !important; /* 覆盖默认的 width: 100% */
|
|
380
|
-
}
|
|
381
|
-
:deep(.x-radio-item-container:first-child) {
|
|
382
|
-
margin-left: 4px;
|
|
383
|
-
}
|
|
384
|
-
:deep(.x-radio-item-container:last-child) {
|
|
385
|
-
margin-right: 0;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="x-radio-container" :class="wrapperClassObject()">
|
|
3
|
+
<a-radio-group v-model="innerValue" @change="onChange" :class="['x-radio-group', { 'x-radio-group-left': config.alignLeft }]">
|
|
4
|
+
<div
|
|
5
|
+
v-for="item in data"
|
|
6
|
+
:key="item.value"
|
|
7
|
+
class="x-radio-item-container"
|
|
8
|
+
:class="{
|
|
9
|
+
'x-radio-item-bordered': config.showBorder,
|
|
10
|
+
'x-radio-item-highlight': config.highlightBorder
|
|
11
|
+
}"
|
|
12
|
+
:style="getHighlightBorderStyle(item)">
|
|
13
|
+
<div class="x-radio-item-wrapper">
|
|
14
|
+
<div
|
|
15
|
+
v-if="config.showIndicator && item.bottomLine !== false"
|
|
16
|
+
class="x-radio-indicator-left"
|
|
17
|
+
:style="{
|
|
18
|
+
width: item.indicatorWidth || '4px',
|
|
19
|
+
backgroundColor: item.indicatorColor || config.indicatorActiveColor,
|
|
20
|
+
height: item.indicatorHeight || '16px'
|
|
21
|
+
}"
|
|
22
|
+
></div>
|
|
23
|
+
<a-radio
|
|
24
|
+
:value="item.value"
|
|
25
|
+
class="x-radio-item"
|
|
26
|
+
:class="{ 'x-radio-item-no-dot': config.highlightBorder }"
|
|
27
|
+
>
|
|
28
|
+
{{ item.label }}
|
|
29
|
+
</a-radio>
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
v-if="config.showIndicator && item.bottomLine !== false && !config.showBorder && !config.highlightBorder"
|
|
33
|
+
class="x-radio-indicator-bottom"
|
|
34
|
+
:style="{
|
|
35
|
+
width: item.indicatorWidth || '100%',
|
|
36
|
+
backgroundColor: item.indicatorColor || config.indicatorActiveColor,
|
|
37
|
+
height: config.indicatorHeight + 'px'
|
|
38
|
+
}"
|
|
39
|
+
></div>
|
|
40
|
+
</div>
|
|
41
|
+
</a-radio-group>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
name: 'XRadio',
|
|
50
|
+
inject: ['getComponentByName'],
|
|
51
|
+
props: {
|
|
52
|
+
queryParamsName: {
|
|
53
|
+
type: Object,
|
|
54
|
+
default: null
|
|
55
|
+
},
|
|
56
|
+
// eslint-disable-next-line vue/require-default-prop
|
|
57
|
+
value: [String, Number]
|
|
58
|
+
},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
data: [],
|
|
62
|
+
innerValue: null,
|
|
63
|
+
config: {
|
|
64
|
+
showIndicator: true,
|
|
65
|
+
indicatorHeight: 3,
|
|
66
|
+
indicatorActiveColor: '#1890ff',
|
|
67
|
+
alignLeft: false,
|
|
68
|
+
showBorder: false,
|
|
69
|
+
highlightBorder: false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
created () {
|
|
74
|
+
this.getData(this.queryParamsName)
|
|
75
|
+
},
|
|
76
|
+
watch: {
|
|
77
|
+
value (val) {
|
|
78
|
+
this.innerValue = val
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
emits: ['change', 'init'],
|
|
82
|
+
methods: {
|
|
83
|
+
async getData (data) {
|
|
84
|
+
getConfigByName(data, 'af-his', res => {
|
|
85
|
+
// 1. 先加载选项
|
|
86
|
+
if (res.radio && Array.isArray(res.radio)) {
|
|
87
|
+
this.data = res.radio
|
|
88
|
+
// 2. 加载指示器配置
|
|
89
|
+
if (res.indicator !== undefined) {
|
|
90
|
+
// 如果indicator是布尔值,则只控制显示/隐藏
|
|
91
|
+
if (typeof res.indicator === 'boolean') {
|
|
92
|
+
this.config.showIndicator = res.indicator
|
|
93
|
+
} else if (typeof res.indicator === 'object') {
|
|
94
|
+
this.config = {
|
|
95
|
+
...this.config,
|
|
96
|
+
...res.indicator
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// 3. 加载布局配置
|
|
101
|
+
if (res.layout !== undefined) {
|
|
102
|
+
if (typeof res.layout === 'object') {
|
|
103
|
+
this.config = {
|
|
104
|
+
...this.config,
|
|
105
|
+
...res.layout
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// 4. 初始化默认值(优先级: 配置defaultValue > 第一个选项)
|
|
110
|
+
if (this.value !== undefined && this.value !== null) {
|
|
111
|
+
this.innerValue = this.value // 优先使用外部传入的 value
|
|
112
|
+
} else if (res.defaultValue !== undefined && res.defaultValue !== null) {
|
|
113
|
+
// 使用配置中的defaultValue
|
|
114
|
+
this.innerValue = res.defaultValue
|
|
115
|
+
} else if (this.data.length > 0) {
|
|
116
|
+
// 如果没有默认值但有选项,使用第一个选项
|
|
117
|
+
this.innerValue = this.data[0].value
|
|
118
|
+
}
|
|
119
|
+
// 5. 触发初始化事件
|
|
120
|
+
this.$emit('init', this.innerValue)
|
|
121
|
+
} else {
|
|
122
|
+
this.$message.error('配置错误,radio字段不是数组')
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
},
|
|
126
|
+
onChange (e) {
|
|
127
|
+
this.innerValue = e.target.value
|
|
128
|
+
this.$emit('change', e.target.value)
|
|
129
|
+
},
|
|
130
|
+
wrapperClassObject () {
|
|
131
|
+
const attrs = this.$attrs || {}
|
|
132
|
+
const classes = {}
|
|
133
|
+
const booleanStyleKeys = [
|
|
134
|
+
'item-0padding', 'compact', 'out-radio'
|
|
135
|
+
]
|
|
136
|
+
booleanStyleKeys.forEach(key => {
|
|
137
|
+
const val = attrs[key]
|
|
138
|
+
const truthy = val === true || val === '' || val === 'true'
|
|
139
|
+
if (truthy) classes[`x-radio-${key}`] = true
|
|
140
|
+
})
|
|
141
|
+
return classes
|
|
142
|
+
},
|
|
143
|
+
getHighlightBorderStyle (item) {
|
|
144
|
+
if (!this.config.highlightBorder) return {}
|
|
145
|
+
|
|
146
|
+
// 如果当前选项被选中且有边框颜色配置,使用配置的颜色
|
|
147
|
+
if (this.innerValue === item.value && item.borderColor) {
|
|
148
|
+
return {
|
|
149
|
+
borderColor: item.borderColor
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// 如果当前选项被选中且有indicatorColor配置,使用indicatorColor作为边框颜色
|
|
154
|
+
if (this.innerValue === item.value && item.indicatorColor) {
|
|
155
|
+
return {
|
|
156
|
+
borderColor: item.indicatorColor
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 默认返回空对象,使用CSS中的默认灰色边框
|
|
161
|
+
return {}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<style scoped lang="less">
|
|
168
|
+
.x-radio-container {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.x-radio-group {
|
|
174
|
+
display: flex;
|
|
175
|
+
justify-content: space-around;
|
|
176
|
+
|
|
177
|
+
&.x-radio-group-left {
|
|
178
|
+
justify-content: flex-start;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.x-radio-item-container {
|
|
183
|
+
flex: 1;
|
|
184
|
+
display: flex;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
align-items: center;
|
|
187
|
+
text-align: center;
|
|
188
|
+
padding: 0 8px;
|
|
189
|
+
box-sizing: border-box;
|
|
190
|
+
|
|
191
|
+
.x-radio-group-left & {
|
|
192
|
+
flex: none;
|
|
193
|
+
align-items: flex-start;
|
|
194
|
+
text-align: left;
|
|
195
|
+
margin-right: 16px;
|
|
196
|
+
padding: 0 4px;
|
|
197
|
+
|
|
198
|
+
&:last-child {
|
|
199
|
+
margin-right: 0;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.x-radio-item-bordered {
|
|
204
|
+
border: 1px solid #d9d9d9;
|
|
205
|
+
border-radius: 173px;
|
|
206
|
+
padding: 8px 12px;
|
|
207
|
+
margin-right: 8px;
|
|
208
|
+
background-color: #fff;
|
|
209
|
+
transition: all 0.3s;
|
|
210
|
+
|
|
211
|
+
&:hover {
|
|
212
|
+
border-color: #40a9ff;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&:last-child {
|
|
216
|
+
margin-right: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.x-radio-group-left & {
|
|
220
|
+
margin-right: 8px;
|
|
221
|
+
|
|
222
|
+
&:last-child {
|
|
223
|
+
margin-right: 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&.x-radio-item-highlight {
|
|
229
|
+
border: 2px solid #d9d9d9;
|
|
230
|
+
border-radius: 173px;
|
|
231
|
+
padding: 8px 12px;
|
|
232
|
+
margin-right: 8px;
|
|
233
|
+
background-color: #fff;
|
|
234
|
+
transition: all 0.3s;
|
|
235
|
+
position: relative;
|
|
236
|
+
|
|
237
|
+
&:last-child {
|
|
238
|
+
margin-right: 0;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.x-radio-group-left & {
|
|
242
|
+
margin-right: 8px;
|
|
243
|
+
|
|
244
|
+
&:last-child {
|
|
245
|
+
margin-right: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// 动态边框颜色通过内联样式设置
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.x-radio-item-wrapper {
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
width: 100%;
|
|
257
|
+
|
|
258
|
+
.x-radio-group-left & {
|
|
259
|
+
justify-content: flex-start;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.x-radio-item {
|
|
264
|
+
margin-bottom: 8px;
|
|
265
|
+
|
|
266
|
+
.x-radio-item-bordered & {
|
|
267
|
+
margin-bottom: 0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&.x-radio-item-no-dot {
|
|
271
|
+
:deep(.ant-radio) {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
:deep(.ant-radio-wrapper) {
|
|
276
|
+
padding-left: 0;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.x-radio-indicator-left {
|
|
282
|
+
width: 4px;
|
|
283
|
+
height: 16px;
|
|
284
|
+
margin-right: 8px;
|
|
285
|
+
border-radius: 6px;
|
|
286
|
+
transition: all 0.3s;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.x-radio-indicator-bottom {
|
|
290
|
+
height: 3px;
|
|
291
|
+
transition: all 0.3s;
|
|
292
|
+
max-width: 100%;
|
|
293
|
+
}
|
|
294
|
+
.x-radio-description {
|
|
295
|
+
padding: 4px 4px 4px 4px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.x-radio-item-0padding {
|
|
299
|
+
&.x-radio-container,
|
|
300
|
+
.x-radio-container {
|
|
301
|
+
:deep(.x-radio-item-container) {
|
|
302
|
+
padding: 0px;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
.x-radio-compact {
|
|
307
|
+
&.x-radio-container,
|
|
308
|
+
.x-radio-container {
|
|
309
|
+
:deep(.simple-inline-item){
|
|
310
|
+
padding: 0px !important;
|
|
311
|
+
}
|
|
312
|
+
:deep(.ant-radio-group){
|
|
313
|
+
display: flex;
|
|
314
|
+
justify-content: space-between;
|
|
315
|
+
}
|
|
316
|
+
:deep(.x-radio-item) > span:last-child {
|
|
317
|
+
padding-right: 2px;
|
|
318
|
+
padding-left: 2px;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/* 门诊收费样式:字体规格与间距 42px */
|
|
323
|
+
.x-radio-out-radio {
|
|
324
|
+
&.x-radio-container,
|
|
325
|
+
.x-radio-container {
|
|
326
|
+
:deep(.x-radio-group) {
|
|
327
|
+
justify-content: flex-start !important; /* 覆盖默认的 space-around */
|
|
328
|
+
}
|
|
329
|
+
:deep(.ant-radio-wrapper) {
|
|
330
|
+
/* 仅归零内外边距,避免额外空隙 */
|
|
331
|
+
padding: 0;
|
|
332
|
+
margin: 0;
|
|
333
|
+
}
|
|
334
|
+
/* 确保文字本身也应用同样的字体样式(提高优先级并可视化高度) */
|
|
335
|
+
:deep(.ant-radio-wrapper > span:last-child) {
|
|
336
|
+
display: inline-block;
|
|
337
|
+
height: 23px !important;
|
|
338
|
+
line-height: 23px !important;
|
|
339
|
+
font-family: "Source Han Sans" !important;
|
|
340
|
+
font-size: 16px !important;
|
|
341
|
+
font-weight: normal !important;
|
|
342
|
+
letter-spacing: 0em !important;
|
|
343
|
+
color: #313131 !important;
|
|
344
|
+
}
|
|
345
|
+
/* 单选框与文字之间保持 5px 间距 */
|
|
346
|
+
:deep(.ant-radio) { margin-right: 0; }
|
|
347
|
+
:deep(.ant-radio + span) { padding: 0; margin-left: 5px; }
|
|
348
|
+
/* 单选框外圈视觉 16x16,边框 #CDCFD4,背景白色 */
|
|
349
|
+
:deep(.ant-radio-inner) {
|
|
350
|
+
width: 16px;
|
|
351
|
+
height: 16px;
|
|
352
|
+
background: #FFFFFF;
|
|
353
|
+
box-sizing: border-box;
|
|
354
|
+
border: 1px solid #CDCFD4;
|
|
355
|
+
}
|
|
356
|
+
/* 选中时内部实心点 10x10,背景 #0057FE */
|
|
357
|
+
:deep(.ant-radio-checked .ant-radio-inner::after) {
|
|
358
|
+
width: 10px;
|
|
359
|
+
height: 10px;
|
|
360
|
+
background: #0057FE;
|
|
361
|
+
margin: 0;
|
|
362
|
+
left: 50%;
|
|
363
|
+
top: 50%;
|
|
364
|
+
transform: translate(-50%, -50%) scale(1);
|
|
365
|
+
}
|
|
366
|
+
/* 保持外圈边框颜色不被默认覆盖 */
|
|
367
|
+
:deep(.ant-radio-checked .ant-radio-inner) {
|
|
368
|
+
border-color: #CDCFD4;
|
|
369
|
+
background: #FFFFFF;
|
|
370
|
+
}
|
|
371
|
+
:deep(.x-radio-item-container) {
|
|
372
|
+
margin-right: 42px; /* 直接设置42px间距,让第二个单选框与第一个文字距离为42px */
|
|
373
|
+
padding: 0 !important;
|
|
374
|
+
flex: none !important; /* 覆盖默认的 flex: 1 */
|
|
375
|
+
align-items: flex-start !important; /* 覆盖默认的 center */
|
|
376
|
+
text-align: left !important; /* 覆盖默认的 center */
|
|
377
|
+
}
|
|
378
|
+
:deep(.x-radio-item-wrapper) {
|
|
379
|
+
width: auto !important; /* 覆盖默认的 width: 100% */
|
|
380
|
+
}
|
|
381
|
+
:deep(.x-radio-item-container:first-child) {
|
|
382
|
+
margin-left: 4px;
|
|
383
|
+
}
|
|
384
|
+
:deep(.x-radio-item-container:last-child) {
|
|
385
|
+
margin-right: 0;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
</style>
|