vue2-client 1.17.0 → 1.17.1

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.
@@ -1,553 +1,553 @@
1
- <template>
2
- <div class="x-radio-container" :class="wrapperClassObject()">
3
- <!-- 按钮模式 -->
4
- <a-radio-group
5
- v-if="config.buttonMode"
6
- v-model="innerValue"
7
- @change="onChange"
8
- :class="['x-radio-group', 'x-radio-group-button', { 'x-radio-group-left': config.alignLeft }]"
9
- button-style="solid">
10
- <a-radio-button
11
- v-for="item in data"
12
- :key="item.value"
13
- :value="item.value"
14
- class="x-radio-button-item"
15
- >
16
- {{ item.label }}
17
- </a-radio-button>
18
- </a-radio-group>
19
-
20
- <!-- 普通模式 -->
21
- <a-radio-group
22
- v-else
23
- v-model="innerValue"
24
- @change="onChange"
25
- :class="['x-radio-group', { 'x-radio-group-left': config.alignLeft }]">
26
- <div
27
- v-for="item in data"
28
- :key="item.value"
29
- class="x-radio-item-container"
30
- :class="{
31
- 'x-radio-item-bordered': config.showBorder,
32
- 'x-radio-item-highlight': config.highlightBorder
33
- }"
34
- :style="getHighlightBorderStyle(item)">
35
- <div class="x-radio-item-wrapper">
36
- <div
37
- v-if="config.showIndicator && item.bottomLine !== false"
38
- class="x-radio-indicator-left"
39
- :style="{
40
- width: item.indicatorWidth || '4px',
41
- backgroundColor: item.indicatorColor || config.indicatorActiveColor,
42
- height: item.indicatorHeight || '16px'
43
- }"
44
- ></div>
45
- <a-radio
46
- :value="item.value"
47
- class="x-radio-item"
48
- :class="{ 'x-radio-item-no-dot': config.highlightBorder }"
49
- >
50
- {{ item.label }}
51
- </a-radio>
52
- </div>
53
- <div
54
- v-if="config.showIndicator && item.bottomLine !== false && !config.showBorder && !config.highlightBorder"
55
- class="x-radio-indicator-bottom"
56
- :style="{
57
- width: item.indicatorWidth || '100%',
58
- backgroundColor: item.indicatorColor || config.indicatorActiveColor,
59
- height: config.indicatorHeight + 'px'
60
- }"
61
- ></div>
62
- </div>
63
- </a-radio-group>
64
- </div>
65
- </template>
66
-
67
- <script>
68
- import { getConfigByName } from '@vue2-client/services/api/common'
69
-
70
- export default {
71
- name: 'XRadio',
72
- inject: ['getComponentByName'],
73
- props: {
74
- queryParamsName: {
75
- type: Object,
76
- default: null
77
- },
78
- // eslint-disable-next-line vue/require-default-prop
79
- value: [String, Number]
80
- },
81
- data () {
82
- return {
83
- data: [],
84
- innerValue: null,
85
- config: {
86
- showIndicator: true,
87
- indicatorHeight: 3,
88
- indicatorActiveColor: '#1890ff',
89
- alignLeft: false,
90
- showBorder: false,
91
- highlightBorder: false,
92
- buttonMode: false
93
- }
94
- }
95
- },
96
- created () {
97
- this.getData(this.queryParamsName)
98
- },
99
- watch: {
100
- value (val) {
101
- this.innerValue = val
102
- }
103
- },
104
- emits: ['change', 'init'],
105
- methods: {
106
- async getData (data) {
107
- getConfigByName(data, 'af-his', res => {
108
- // 1. 先加载选项
109
- if (res.radio && Array.isArray(res.radio)) {
110
- this.data = res.radio
111
- // 2. 加载指示器配置
112
- if (res.indicator !== undefined) {
113
- // 如果indicator是布尔值,则只控制显示/隐藏
114
- if (typeof res.indicator === 'boolean') {
115
- this.config.showIndicator = res.indicator
116
- } else if (typeof res.indicator === 'object') {
117
- this.config = {
118
- ...this.config,
119
- ...res.indicator
120
- }
121
- }
122
- }
123
- // 3. 加载布局配置
124
- if (res.layout !== undefined) {
125
- if (typeof res.layout === 'object') {
126
- this.config = {
127
- ...this.config,
128
- ...res.layout
129
- }
130
- }
131
- }
132
- // 4. 加载按钮模式配置
133
- if (res.buttonMode !== undefined) {
134
- this.config.buttonMode = res.buttonMode
135
- }
136
- // 5. 初始化默认值(优先级: 配置defaultValue > 第一个选项)
137
- if (this.value !== undefined && this.value !== null) {
138
- this.innerValue = this.value // 优先使用外部传入的 value
139
- } else if (res.defaultValue !== undefined && res.defaultValue !== null) {
140
- // 使用配置中的defaultValue
141
- this.innerValue = res.defaultValue
142
- } else if (this.data.length > 0) {
143
- // 如果没有默认值但有选项,使用第一个选项
144
- this.innerValue = this.data[0].value
145
- }
146
- // 6. 触发初始化事件
147
- this.$emit('init', this.innerValue)
148
- } else {
149
- this.$message.error('配置错误,radio字段不是数组')
150
- }
151
- })
152
- },
153
- onChange (e) {
154
- this.innerValue = e.target.value
155
- this.$emit('change', e.target.value)
156
- },
157
- wrapperClassObject () {
158
- const attrs = this.$attrs || {}
159
- const classes = {}
160
- const booleanStyleKeys = [
161
- 'item-0padding', 'compact', 'out-radio', 'distributed'
162
- ]
163
- booleanStyleKeys.forEach(key => {
164
- const val = attrs[key]
165
- const truthy = val === true || val === '' || val === 'true'
166
- if (truthy) classes[`x-radio-${key}`] = true
167
- })
168
- return classes
169
- },
170
- getHighlightBorderStyle (item) {
171
- if (!this.config.highlightBorder) return {}
172
-
173
- // 如果当前选项被选中且有边框颜色配置,使用配置的颜色
174
- if (this.innerValue === item.value && item.borderColor) {
175
- return {
176
- borderColor: item.borderColor
177
- }
178
- }
179
-
180
- // 如果当前选项被选中且有indicatorColor配置,使用indicatorColor作为边框颜色
181
- if (this.innerValue === item.value && item.indicatorColor) {
182
- return {
183
- borderColor: item.indicatorColor
184
- }
185
- }
186
-
187
- // 默认返回空对象,使用CSS中的默认灰色边框
188
- return {}
189
- }
190
- }
191
- }
192
- </script>
193
-
194
- <style scoped lang="less">
195
- .x-radio-container {
196
- display: flex;
197
- flex-direction: column;
198
- }
199
-
200
- .x-radio-group {
201
- display: flex;
202
- justify-content: space-around;
203
-
204
- &.x-radio-group-left {
205
- justify-content: flex-start;
206
- }
207
-
208
- &.x-radio-group-button {
209
- display: flex;
210
- justify-content: flex-end; // 居右对齐
211
- gap: 0; // 移除间距,让按钮紧密相连
212
- &.x-radio-group-left {
213
- justify-content: flex-start;
214
- }
215
- :deep(.ant-radio-button-wrapper) {
216
- border-radius: 0; // 先移除所有圆角
217
- border: 1px solid #d9d9d9;
218
- background: #fff;
219
- color: #000;
220
- transition: all 0.3s;
221
- min-width: 80px;
222
- text-align: center;
223
- margin: 0; // 确保没有外边距
224
-
225
- &:hover {
226
- border-color: #40a9ff;
227
- color: #40a9ff;
228
- }
229
-
230
- &.ant-radio-button-wrapper-checked {
231
- background-color: #0057FE;
232
- border-color: #0057FE;
233
- color: #fff;
234
-
235
- &:hover {
236
- background-color: #0057FE;
237
- border-color: #0057FE;
238
- color: #fff;
239
- }
240
- }
241
- // 第一个按钮只保留左侧圆角
242
- &:first-child {
243
- border-top-left-radius: 6px;
244
- border-bottom-left-radius: 6px;
245
- border-right: none; // 移除右边框,与下一个按钮连接
246
- }
247
- // 最后一个按钮只保留右侧圆角
248
- &:last-child {
249
- border-top-right-radius: 6px;
250
- border-bottom-right-radius: 6px;
251
- }
252
- // 中间按钮(如果有)移除所有圆角和右边框
253
- &:not(:first-child):not(:last-child) {
254
- border-radius: 0;
255
- border-right: none;
256
- }
257
- // 除了最后一个按钮,其他按钮都移除右边框
258
- &:not(:last-child) {
259
- border-right: none;
260
- }
261
- }
262
- }
263
- }
264
-
265
- .x-radio-item-container {
266
- flex: 1;
267
- display: flex;
268
- flex-direction: column;
269
- align-items: center;
270
- text-align: center;
271
- padding: 0 8px;
272
- box-sizing: border-box;
273
-
274
- .x-radio-group-left & {
275
- flex: none;
276
- align-items: flex-start;
277
- text-align: left;
278
- margin-right: 16px;
279
- padding: 0 4px;
280
-
281
- &:last-child {
282
- margin-right: 0;
283
- }
284
- }
285
-
286
- &.x-radio-item-bordered {
287
- border: 1px solid #d9d9d9;
288
- border-radius: 173px;
289
- padding: 8px 12px;
290
- margin-right: 8px;
291
- background-color: #fff;
292
- transition: all 0.3s;
293
-
294
- &:hover {
295
- border-color: #40a9ff;
296
- }
297
-
298
- &:last-child {
299
- margin-right: 0;
300
- }
301
-
302
- .x-radio-group-left & {
303
- margin-right: 8px;
304
-
305
- &:last-child {
306
- margin-right: 0;
307
- }
308
- }
309
- }
310
-
311
- &.x-radio-item-highlight {
312
- border: 2px solid #d9d9d9;
313
- border-radius: 173px;
314
- padding: 8px 12px;
315
- margin-right: 8px;
316
- background-color: #fff;
317
- transition: all 0.3s;
318
- position: relative;
319
-
320
- &:last-child {
321
- margin-right: 0;
322
- }
323
-
324
- .x-radio-group-left & {
325
- margin-right: 8px;
326
-
327
- &:last-child {
328
- margin-right: 0;
329
- }
330
- }
331
-
332
- // 动态边框颜色通过内联样式设置
333
- }
334
- }
335
-
336
- .x-radio-item-wrapper {
337
- display: flex;
338
- align-items: center;
339
- width: 100%;
340
-
341
- .x-radio-group-left & {
342
- justify-content: flex-start;
343
- }
344
- }
345
-
346
- .x-radio-item {
347
- margin-bottom: 8px;
348
-
349
- .x-radio-item-bordered & {
350
- margin-bottom: 0;
351
- }
352
-
353
- &.x-radio-item-no-dot {
354
- :deep(.ant-radio) {
355
- display: none;
356
- }
357
-
358
- :deep(.ant-radio-wrapper) {
359
- padding-left: 0;
360
- }
361
- }
362
- }
363
-
364
- .x-radio-indicator-left {
365
- width: 4px;
366
- height: 16px;
367
- margin-right: 8px;
368
- border-radius: 6px;
369
- transition: all 0.3s;
370
- }
371
-
372
- .x-radio-indicator-bottom {
373
- height: 3px;
374
- transition: all 0.3s;
375
- max-width: 100%;
376
- }
377
-
378
- .x-radio-description {
379
- padding: 4px 4px 4px 4px;
380
- }
381
-
382
- .x-radio-item-0padding {
383
- &.x-radio-container,
384
- .x-radio-container {
385
- :deep(.x-radio-item-container) {
386
- padding: 0px;
387
- }
388
- }
389
- }
390
- .x-radio-compact {
391
- &.x-radio-container,
392
- .x-radio-container {
393
- :deep(.simple-inline-item){
394
- padding: 0px !important;
395
- }
396
- :deep(.ant-radio-group){
397
- display: flex;
398
- justify-content: space-between;
399
- }
400
- :deep(.x-radio-item) > span:last-child {
401
- padding-right: 2px;
402
- padding-left: 2px;
403
- }
404
- }
405
- }
406
- /* 门诊收费样式:字体规格与间距 42px */
407
- .x-radio-out-radio {
408
- &.x-radio-container,
409
- .x-radio-container {
410
- :deep(.x-radio-group) {
411
- justify-content: flex-start !important; /* 覆盖默认的 space-around */
412
- }
413
- :deep(.ant-radio-wrapper) {
414
- /* 仅归零内外边距,避免额外空隙 */
415
- padding: 0;
416
- margin: 0;
417
- }
418
- /* 确保文字本身也应用同样的字体样式(提高优先级并可视化高度) */
419
- :deep(.ant-radio-wrapper > span:last-child) {
420
- display: inline-block;
421
- height: 23px !important;
422
- line-height: 23px !important;
423
- font-family: "Source Han Sans" !important;
424
- font-size: 16px !important;
425
- font-weight: normal !important;
426
- letter-spacing: 0em !important;
427
- color: #313131 !important;
428
- }
429
- /* 单选框与文字之间保持 5px 间距 */
430
- :deep(.ant-radio) { margin-right: 0; }
431
- :deep(.ant-radio + span) { padding: 0; margin-left: 5px; }
432
- /* 单选框外圈视觉 16x16,边框 #CDCFD4,背景白色 */
433
- :deep(.ant-radio-inner) {
434
- width: 16px;
435
- height: 16px;
436
- background: #FFFFFF;
437
- box-sizing: border-box;
438
- border: 1px solid #CDCFD4;
439
- }
440
- /* 选中时内部实心点 10x10,背景 #0057FE */
441
- :deep(.ant-radio-checked .ant-radio-inner::after) {
442
- width: 10px;
443
- height: 10px;
444
- background: #0057FE;
445
- margin: 0;
446
- left: 50%;
447
- top: 50%;
448
- transform: translate(-50%, -50%) scale(1);
449
- }
450
- /* 保持外圈边框颜色不被默认覆盖 */
451
- :deep(.ant-radio-checked .ant-radio-inner) {
452
- border-color: #CDCFD4;
453
- background: #FFFFFF;
454
- }
455
- :deep(.x-radio-item-container) {
456
- margin-right: 42px; /* 直接设置42px间距,让第二个单选框与第一个文字距离为42px */
457
- padding: 0 !important;
458
- flex: none !important; /* 覆盖默认的 flex: 1 */
459
- align-items: flex-start !important; /* 覆盖默认的 center */
460
- text-align: left !important; /* 覆盖默认的 center */
461
- }
462
- :deep(.x-radio-item-wrapper) {
463
- width: auto !important; /* 覆盖默认的 width: 100% */
464
- }
465
- :deep(.x-radio-item-container:first-child) {
466
- margin-left: 4px;
467
- }
468
- :deep(.x-radio-item-container:last-child) {
469
- margin-right: 0;
470
- }
471
- }
472
- }
473
-
474
- /* 分布布局样式 */
475
- .x-radio-distributed {
476
- &.x-radio-container,
477
- .x-radio-container {
478
- width: 100%;
479
- :deep(.x-radio-group) {
480
- width: 100%;
481
- display: flex;
482
- justify-content: space-between;
483
- flex-wrap: nowrap;
484
- gap: 0;
485
- overflow: hidden;
486
- }
487
- :deep(.x-radio-item-container) {
488
- flex: 0 0 auto;
489
- display: flex;
490
- justify-content: center;
491
- align-items: center;
492
- padding: 0 2px;
493
- min-width: 0;
494
- }
495
- :deep(.x-radio-item-wrapper) {
496
- display: flex;
497
- align-items: center;
498
- justify-content: flex-start;
499
- }
500
- :deep(.ant-radio-wrapper) {
501
- padding: 0;
502
- margin: 0;
503
- display: flex;
504
- align-items: center;
505
- }
506
- :deep(.ant-radio) {
507
- margin-right: 0;
508
- }
509
- :deep(.ant-radio + span) {
510
- margin-left: 3px;
511
- padding: 0;
512
- }
513
- :deep(.ant-radio-inner) {
514
- width: 16px;
515
- height: 16px;
516
- opacity: 1;
517
- background: #FFFFFF;
518
- box-sizing: border-box;
519
- border: 1px solid #CDCFD4;
520
- transition: none !important;
521
- }
522
- :deep(.ant-radio-checked .ant-radio-inner::after) {
523
- width: 10px;
524
- height: 10px;
525
- opacity: 1;
526
- background: #0057FE;
527
- margin: 0;
528
- left: 50%;
529
- top: 50%;
530
- transform: translate(-50%, -50%) scale(1);
531
- transition: none !important;
532
- animation: none !important;
533
- }
534
- :deep(.ant-radio-checked .ant-radio-inner) {
535
- border-color: #CDCFD4;
536
- background: #FFFFFF;
537
- transition: none !important;
538
- }
539
- :deep(.ant-radio-wrapper > span:last-child) {
540
- height: 23px;
541
- opacity: 1;
542
- font-family: "Source Han Sans";
543
- font-size: 16px;
544
- font-weight: normal;
545
- line-height: normal;
546
- letter-spacing: 0em;
547
- color: #5D5C5C;
548
- white-space: nowrap;
549
- }
550
- /* 改为内容自适应宽度,父容器使用 space-between 保证等距 */
551
- }
552
- }
553
- </style>
1
+ <template>
2
+ <div class="x-radio-container" :class="wrapperClassObject()">
3
+ <!-- 按钮模式 -->
4
+ <a-radio-group
5
+ v-if="config.buttonMode"
6
+ v-model="innerValue"
7
+ @change="onChange"
8
+ :class="['x-radio-group', 'x-radio-group-button', { 'x-radio-group-left': config.alignLeft }]"
9
+ button-style="solid">
10
+ <a-radio-button
11
+ v-for="item in data"
12
+ :key="item.value"
13
+ :value="item.value"
14
+ class="x-radio-button-item"
15
+ >
16
+ {{ item.label }}
17
+ </a-radio-button>
18
+ </a-radio-group>
19
+
20
+ <!-- 普通模式 -->
21
+ <a-radio-group
22
+ v-else
23
+ v-model="innerValue"
24
+ @change="onChange"
25
+ :class="['x-radio-group', { 'x-radio-group-left': config.alignLeft }]">
26
+ <div
27
+ v-for="item in data"
28
+ :key="item.value"
29
+ class="x-radio-item-container"
30
+ :class="{
31
+ 'x-radio-item-bordered': config.showBorder,
32
+ 'x-radio-item-highlight': config.highlightBorder
33
+ }"
34
+ :style="getHighlightBorderStyle(item)">
35
+ <div class="x-radio-item-wrapper">
36
+ <div
37
+ v-if="config.showIndicator && item.bottomLine !== false"
38
+ class="x-radio-indicator-left"
39
+ :style="{
40
+ width: item.indicatorWidth || '4px',
41
+ backgroundColor: item.indicatorColor || config.indicatorActiveColor,
42
+ height: item.indicatorHeight || '16px'
43
+ }"
44
+ ></div>
45
+ <a-radio
46
+ :value="item.value"
47
+ class="x-radio-item"
48
+ :class="{ 'x-radio-item-no-dot': config.highlightBorder }"
49
+ >
50
+ {{ item.label }}
51
+ </a-radio>
52
+ </div>
53
+ <div
54
+ v-if="config.showIndicator && item.bottomLine !== false && !config.showBorder && !config.highlightBorder"
55
+ class="x-radio-indicator-bottom"
56
+ :style="{
57
+ width: item.indicatorWidth || '100%',
58
+ backgroundColor: item.indicatorColor || config.indicatorActiveColor,
59
+ height: config.indicatorHeight + 'px'
60
+ }"
61
+ ></div>
62
+ </div>
63
+ </a-radio-group>
64
+ </div>
65
+ </template>
66
+
67
+ <script>
68
+ import { getConfigByName } from '@vue2-client/services/api/common'
69
+
70
+ export default {
71
+ name: 'XRadio',
72
+ inject: ['getComponentByName'],
73
+ props: {
74
+ queryParamsName: {
75
+ type: Object,
76
+ default: null
77
+ },
78
+ // eslint-disable-next-line vue/require-default-prop
79
+ value: [String, Number]
80
+ },
81
+ data () {
82
+ return {
83
+ data: [],
84
+ innerValue: null,
85
+ config: {
86
+ showIndicator: true,
87
+ indicatorHeight: 3,
88
+ indicatorActiveColor: '#1890ff',
89
+ alignLeft: false,
90
+ showBorder: false,
91
+ highlightBorder: false,
92
+ buttonMode: false
93
+ }
94
+ }
95
+ },
96
+ created () {
97
+ this.getData(this.queryParamsName)
98
+ },
99
+ watch: {
100
+ value (val) {
101
+ this.innerValue = val
102
+ }
103
+ },
104
+ emits: ['change', 'init'],
105
+ methods: {
106
+ async getData (data) {
107
+ getConfigByName(data, 'af-his', res => {
108
+ // 1. 先加载选项
109
+ if (res.radio && Array.isArray(res.radio)) {
110
+ this.data = res.radio
111
+ // 2. 加载指示器配置
112
+ if (res.indicator !== undefined) {
113
+ // 如果indicator是布尔值,则只控制显示/隐藏
114
+ if (typeof res.indicator === 'boolean') {
115
+ this.config.showIndicator = res.indicator
116
+ } else if (typeof res.indicator === 'object') {
117
+ this.config = {
118
+ ...this.config,
119
+ ...res.indicator
120
+ }
121
+ }
122
+ }
123
+ // 3. 加载布局配置
124
+ if (res.layout !== undefined) {
125
+ if (typeof res.layout === 'object') {
126
+ this.config = {
127
+ ...this.config,
128
+ ...res.layout
129
+ }
130
+ }
131
+ }
132
+ // 4. 加载按钮模式配置
133
+ if (res.buttonMode !== undefined) {
134
+ this.config.buttonMode = res.buttonMode
135
+ }
136
+ // 5. 初始化默认值(优先级: 配置defaultValue > 第一个选项)
137
+ if (this.value !== undefined && this.value !== null) {
138
+ this.innerValue = this.value // 优先使用外部传入的 value
139
+ } else if (res.defaultValue !== undefined && res.defaultValue !== null) {
140
+ // 使用配置中的defaultValue
141
+ this.innerValue = res.defaultValue
142
+ } else if (this.data.length > 0) {
143
+ // 如果没有默认值但有选项,使用第一个选项
144
+ this.innerValue = this.data[0].value
145
+ }
146
+ // 6. 触发初始化事件
147
+ this.$emit('init', this.innerValue)
148
+ } else {
149
+ this.$message.error('配置错误,radio字段不是数组')
150
+ }
151
+ })
152
+ },
153
+ onChange (e) {
154
+ this.innerValue = e.target.value
155
+ this.$emit('change', e.target.value)
156
+ },
157
+ wrapperClassObject () {
158
+ const attrs = this.$attrs || {}
159
+ const classes = {}
160
+ const booleanStyleKeys = [
161
+ 'item-0padding', 'compact', 'out-radio', 'distributed'
162
+ ]
163
+ booleanStyleKeys.forEach(key => {
164
+ const val = attrs[key]
165
+ const truthy = val === true || val === '' || val === 'true'
166
+ if (truthy) classes[`x-radio-${key}`] = true
167
+ })
168
+ return classes
169
+ },
170
+ getHighlightBorderStyle (item) {
171
+ if (!this.config.highlightBorder) return {}
172
+
173
+ // 如果当前选项被选中且有边框颜色配置,使用配置的颜色
174
+ if (this.innerValue === item.value && item.borderColor) {
175
+ return {
176
+ borderColor: item.borderColor
177
+ }
178
+ }
179
+
180
+ // 如果当前选项被选中且有indicatorColor配置,使用indicatorColor作为边框颜色
181
+ if (this.innerValue === item.value && item.indicatorColor) {
182
+ return {
183
+ borderColor: item.indicatorColor
184
+ }
185
+ }
186
+
187
+ // 默认返回空对象,使用CSS中的默认灰色边框
188
+ return {}
189
+ }
190
+ }
191
+ }
192
+ </script>
193
+
194
+ <style scoped lang="less">
195
+ .x-radio-container {
196
+ display: flex;
197
+ flex-direction: column;
198
+ }
199
+
200
+ .x-radio-group {
201
+ display: flex;
202
+ justify-content: space-around;
203
+
204
+ &.x-radio-group-left {
205
+ justify-content: flex-start;
206
+ }
207
+
208
+ &.x-radio-group-button {
209
+ display: flex;
210
+ justify-content: flex-end; // 居右对齐
211
+ gap: 0; // 移除间距,让按钮紧密相连
212
+ &.x-radio-group-left {
213
+ justify-content: flex-start;
214
+ }
215
+ :deep(.ant-radio-button-wrapper) {
216
+ border-radius: 0; // 先移除所有圆角
217
+ border: 1px solid #d9d9d9;
218
+ background: #fff;
219
+ color: #000;
220
+ transition: all 0.3s;
221
+ min-width: 80px;
222
+ text-align: center;
223
+ margin: 0; // 确保没有外边距
224
+
225
+ &:hover {
226
+ border-color: #40a9ff;
227
+ color: #40a9ff;
228
+ }
229
+
230
+ &.ant-radio-button-wrapper-checked {
231
+ background-color: #0057FE;
232
+ border-color: #0057FE;
233
+ color: #fff;
234
+
235
+ &:hover {
236
+ background-color: #0057FE;
237
+ border-color: #0057FE;
238
+ color: #fff;
239
+ }
240
+ }
241
+ // 第一个按钮只保留左侧圆角
242
+ &:first-child {
243
+ border-top-left-radius: 6px;
244
+ border-bottom-left-radius: 6px;
245
+ border-right: none; // 移除右边框,与下一个按钮连接
246
+ }
247
+ // 最后一个按钮只保留右侧圆角
248
+ &:last-child {
249
+ border-top-right-radius: 6px;
250
+ border-bottom-right-radius: 6px;
251
+ }
252
+ // 中间按钮(如果有)移除所有圆角和右边框
253
+ &:not(:first-child):not(:last-child) {
254
+ border-radius: 0;
255
+ border-right: none;
256
+ }
257
+ // 除了最后一个按钮,其他按钮都移除右边框
258
+ &:not(:last-child) {
259
+ border-right: none;
260
+ }
261
+ }
262
+ }
263
+ }
264
+
265
+ .x-radio-item-container {
266
+ flex: 1;
267
+ display: flex;
268
+ flex-direction: column;
269
+ align-items: center;
270
+ text-align: center;
271
+ padding: 0 8px;
272
+ box-sizing: border-box;
273
+
274
+ .x-radio-group-left & {
275
+ flex: none;
276
+ align-items: flex-start;
277
+ text-align: left;
278
+ margin-right: 16px;
279
+ padding: 0 4px;
280
+
281
+ &:last-child {
282
+ margin-right: 0;
283
+ }
284
+ }
285
+
286
+ &.x-radio-item-bordered {
287
+ border: 1px solid #d9d9d9;
288
+ border-radius: 173px;
289
+ padding: 8px 12px;
290
+ margin-right: 8px;
291
+ background-color: #fff;
292
+ transition: all 0.3s;
293
+
294
+ &:hover {
295
+ border-color: #40a9ff;
296
+ }
297
+
298
+ &:last-child {
299
+ margin-right: 0;
300
+ }
301
+
302
+ .x-radio-group-left & {
303
+ margin-right: 8px;
304
+
305
+ &:last-child {
306
+ margin-right: 0;
307
+ }
308
+ }
309
+ }
310
+
311
+ &.x-radio-item-highlight {
312
+ border: 2px solid #d9d9d9;
313
+ border-radius: 173px;
314
+ padding: 8px 12px;
315
+ margin-right: 8px;
316
+ background-color: #fff;
317
+ transition: all 0.3s;
318
+ position: relative;
319
+
320
+ &:last-child {
321
+ margin-right: 0;
322
+ }
323
+
324
+ .x-radio-group-left & {
325
+ margin-right: 8px;
326
+
327
+ &:last-child {
328
+ margin-right: 0;
329
+ }
330
+ }
331
+
332
+ // 动态边框颜色通过内联样式设置
333
+ }
334
+ }
335
+
336
+ .x-radio-item-wrapper {
337
+ display: flex;
338
+ align-items: center;
339
+ width: 100%;
340
+
341
+ .x-radio-group-left & {
342
+ justify-content: flex-start;
343
+ }
344
+ }
345
+
346
+ .x-radio-item {
347
+ margin-bottom: 8px;
348
+
349
+ .x-radio-item-bordered & {
350
+ margin-bottom: 0;
351
+ }
352
+
353
+ &.x-radio-item-no-dot {
354
+ :deep(.ant-radio) {
355
+ display: none;
356
+ }
357
+
358
+ :deep(.ant-radio-wrapper) {
359
+ padding-left: 0;
360
+ }
361
+ }
362
+ }
363
+
364
+ .x-radio-indicator-left {
365
+ width: 4px;
366
+ height: 16px;
367
+ margin-right: 8px;
368
+ border-radius: 6px;
369
+ transition: all 0.3s;
370
+ }
371
+
372
+ .x-radio-indicator-bottom {
373
+ height: 3px;
374
+ transition: all 0.3s;
375
+ max-width: 100%;
376
+ }
377
+
378
+ .x-radio-description {
379
+ padding: 4px 4px 4px 4px;
380
+ }
381
+
382
+ .x-radio-item-0padding {
383
+ &.x-radio-container,
384
+ .x-radio-container {
385
+ :deep(.x-radio-item-container) {
386
+ padding: 0px;
387
+ }
388
+ }
389
+ }
390
+ .x-radio-compact {
391
+ &.x-radio-container,
392
+ .x-radio-container {
393
+ :deep(.simple-inline-item){
394
+ padding: 0px !important;
395
+ }
396
+ :deep(.ant-radio-group){
397
+ display: flex;
398
+ justify-content: space-between;
399
+ }
400
+ :deep(.x-radio-item) > span:last-child {
401
+ padding-right: 2px;
402
+ padding-left: 2px;
403
+ }
404
+ }
405
+ }
406
+ /* 门诊收费样式:字体规格与间距 42px */
407
+ .x-radio-out-radio {
408
+ &.x-radio-container,
409
+ .x-radio-container {
410
+ :deep(.x-radio-group) {
411
+ justify-content: flex-start !important; /* 覆盖默认的 space-around */
412
+ }
413
+ :deep(.ant-radio-wrapper) {
414
+ /* 仅归零内外边距,避免额外空隙 */
415
+ padding: 0;
416
+ margin: 0;
417
+ }
418
+ /* 确保文字本身也应用同样的字体样式(提高优先级并可视化高度) */
419
+ :deep(.ant-radio-wrapper > span:last-child) {
420
+ display: inline-block;
421
+ height: 23px !important;
422
+ line-height: 23px !important;
423
+ font-family: "Source Han Sans" !important;
424
+ font-size: 16px !important;
425
+ font-weight: normal !important;
426
+ letter-spacing: 0em !important;
427
+ color: #313131 !important;
428
+ }
429
+ /* 单选框与文字之间保持 5px 间距 */
430
+ :deep(.ant-radio) { margin-right: 0; }
431
+ :deep(.ant-radio + span) { padding: 0; margin-left: 5px; }
432
+ /* 单选框外圈视觉 16x16,边框 #CDCFD4,背景白色 */
433
+ :deep(.ant-radio-inner) {
434
+ width: 16px;
435
+ height: 16px;
436
+ background: #FFFFFF;
437
+ box-sizing: border-box;
438
+ border: 1px solid #CDCFD4;
439
+ }
440
+ /* 选中时内部实心点 10x10,背景 #0057FE */
441
+ :deep(.ant-radio-checked .ant-radio-inner::after) {
442
+ width: 10px;
443
+ height: 10px;
444
+ background: #0057FE;
445
+ margin: 0;
446
+ left: 50%;
447
+ top: 50%;
448
+ transform: translate(-50%, -50%) scale(1);
449
+ }
450
+ /* 保持外圈边框颜色不被默认覆盖 */
451
+ :deep(.ant-radio-checked .ant-radio-inner) {
452
+ border-color: #CDCFD4;
453
+ background: #FFFFFF;
454
+ }
455
+ :deep(.x-radio-item-container) {
456
+ margin-right: 42px; /* 直接设置42px间距,让第二个单选框与第一个文字距离为42px */
457
+ padding: 0 !important;
458
+ flex: none !important; /* 覆盖默认的 flex: 1 */
459
+ align-items: flex-start !important; /* 覆盖默认的 center */
460
+ text-align: left !important; /* 覆盖默认的 center */
461
+ }
462
+ :deep(.x-radio-item-wrapper) {
463
+ width: auto !important; /* 覆盖默认的 width: 100% */
464
+ }
465
+ :deep(.x-radio-item-container:first-child) {
466
+ margin-left: 4px;
467
+ }
468
+ :deep(.x-radio-item-container:last-child) {
469
+ margin-right: 0;
470
+ }
471
+ }
472
+ }
473
+
474
+ /* 分布布局样式 */
475
+ .x-radio-distributed {
476
+ &.x-radio-container,
477
+ .x-radio-container {
478
+ width: 100%;
479
+ :deep(.x-radio-group) {
480
+ width: 100%;
481
+ display: flex;
482
+ justify-content: space-between;
483
+ flex-wrap: nowrap;
484
+ gap: 0;
485
+ overflow: hidden;
486
+ }
487
+ :deep(.x-radio-item-container) {
488
+ flex: 0 0 auto;
489
+ display: flex;
490
+ justify-content: center;
491
+ align-items: center;
492
+ padding: 0 2px;
493
+ min-width: 0;
494
+ }
495
+ :deep(.x-radio-item-wrapper) {
496
+ display: flex;
497
+ align-items: center;
498
+ justify-content: flex-start;
499
+ }
500
+ :deep(.ant-radio-wrapper) {
501
+ padding: 0;
502
+ margin: 0;
503
+ display: flex;
504
+ align-items: center;
505
+ }
506
+ :deep(.ant-radio) {
507
+ margin-right: 0;
508
+ }
509
+ :deep(.ant-radio + span) {
510
+ margin-left: 3px;
511
+ padding: 0;
512
+ }
513
+ :deep(.ant-radio-inner) {
514
+ width: 16px;
515
+ height: 16px;
516
+ opacity: 1;
517
+ background: #FFFFFF;
518
+ box-sizing: border-box;
519
+ border: 1px solid #CDCFD4;
520
+ transition: none !important;
521
+ }
522
+ :deep(.ant-radio-checked .ant-radio-inner::after) {
523
+ width: 10px;
524
+ height: 10px;
525
+ opacity: 1;
526
+ background: #0057FE;
527
+ margin: 0;
528
+ left: 50%;
529
+ top: 50%;
530
+ transform: translate(-50%, -50%) scale(1);
531
+ transition: none !important;
532
+ animation: none !important;
533
+ }
534
+ :deep(.ant-radio-checked .ant-radio-inner) {
535
+ border-color: #CDCFD4;
536
+ background: #FFFFFF;
537
+ transition: none !important;
538
+ }
539
+ :deep(.ant-radio-wrapper > span:last-child) {
540
+ height: 23px;
541
+ opacity: 1;
542
+ font-family: "Source Han Sans";
543
+ font-size: 16px;
544
+ font-weight: normal;
545
+ line-height: normal;
546
+ letter-spacing: 0em;
547
+ color: #5D5C5C;
548
+ white-space: nowrap;
549
+ }
550
+ /* 改为内容自适应宽度,父容器使用 space-between 保证等距 */
551
+ }
552
+ }
553
+ </style>