Skip to content

Commit 7b1449f

Browse files
authored
fix: 修复选项卡提交后设置为禁用 (#1748)
1 parent 289e12c commit 7b1449f

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

ui/src/components/dynamics-form/items/radio/RadioCard.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
:key="item.value"
66
class="item"
77
shadow="never"
8-
:class="[modelValue == item[valueField] ? 'active' : '']"
9-
@click="selected(item[valueField])"
8+
:class="[inputDisabled ? 'is-disabled' : '', modelValue == item[valueField] ? 'active' : '']"
9+
@click="inputDisabled ? () => {} : selected(item[valueField])"
1010
>
1111
{{ item[textField] }}
1212
</el-card>
@@ -15,6 +15,9 @@
1515
<script lang="ts" setup>
1616
import { computed, ref } from 'vue'
1717
import type { FormField } from '@/components/dynamics-form/type'
18+
import { useFormDisabled } from 'element-plus'
19+
const inputDisabled = useFormDisabled()
20+
1821
const props = defineProps<{
1922
formValue?: any
2023
formfieldList?: Array<FormField>
@@ -24,6 +27,7 @@ const props = defineProps<{
2427
view?: boolean
2528
// 选中的值
2629
modelValue?: any
30+
disabled?: boolean
2731
}>()
2832
2933
const selected = (activeValue: string | number) => {
@@ -66,6 +70,16 @@ const option_list = computed(() => {
6670
flex-wrap: wrap;
6771
justify-content: flex-start;
6872
width: 100%;
73+
74+
.is-disabled {
75+
border: 1px solid var(--el-card-border-color);
76+
background-color: var(--el-fill-color-light);
77+
color: var(--el-text-color-placeholder);
78+
cursor: not-allowed;
79+
&:hover {
80+
cursor: not-allowed;
81+
}
82+
}
6983
.active {
7084
border: 1px solid var(--el-color-primary);
7185
color: var(--el-color-primary);

ui/src/components/dynamics-form/items/radio/RadioRow.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
v-for="item in option_list"
55
:key="item.value"
66
class="item"
7-
:class="[modelValue == item[valueField] ? 'active' : '']"
7+
:class="[inputDisabled ? 'is-disabled' : '', modelValue == item[valueField] ? 'active' : '']"
88
@click="selected(item[valueField])"
99
>
1010
{{ item[textField] }}
@@ -14,6 +14,8 @@
1414
<script lang="ts" setup>
1515
import { computed } from 'vue'
1616
import type { FormField } from '@/components/dynamics-form/type'
17+
import { useFormDisabled } from 'element-plus'
18+
const inputDisabled = useFormDisabled()
1719
const props = defineProps<{
1820
formValue?: any
1921
formfieldList?: Array<FormField>
@@ -54,7 +56,15 @@ const option_list = computed(() => {
5456
padding: 3px 4px;
5557
box-sizing: border-box;
5658
white-space: nowrap;
57-
59+
.is-disabled {
60+
border: 1px solid var(--el-card-border-color);
61+
background-color: var(--el-fill-color-light);
62+
color: var(--el-text-color-placeholder);
63+
cursor: not-allowed;
64+
&:hover {
65+
cursor: not-allowed;
66+
}
67+
}
5868
.active {
5969
border-radius: 4px;
6070
background: var(--el-color-primary-light-9);

0 commit comments

Comments
 (0)