fix: 修复表单枚举类型的选项因为类型不匹配点击失败的问题

This commit is contained in:
valarchie
2023-02-19 21:07:32 +08:00
parent 67a1629d7f
commit 43c406cce5
5 changed files with 34 additions and 33 deletions

View File

@@ -7,15 +7,17 @@
:key="item.value"
:index="index"
:class="item.elTagType"
>{{ item.label }}</span>
>{{ item.label }}</span
>
<el-tag
v-else
:disable-transitions="true"
:key="item.value + ''"
:key="item.value"
:index="index"
:type="item.elTagType === 'primary' ? '' : item.elTagType"
:class="item.elTagType"
>{{ item.label }}</el-tag>
>{{ item.label }}</el-tag
>
</template>
</template>
</div>
@@ -34,11 +36,10 @@ const props = defineProps({
const values = computed(() => {
if (props.value !== null && typeof props.value !== 'undefined') {
return Array.isArray(props.value) ? props.value : [String(props.value)];
return Array.isArray(props.value) ? props.value : [props.value];
}
return [];
});
</script>
<style scoped>

View File

@@ -99,13 +99,13 @@
<el-col :span="24">
<el-form-item label="菜单类型" prop="menuType">
<el-radio-group v-model="form.menuType">
<el-radio label="1">目录</el-radio>
<el-radio label="2">菜单</el-radio>
<el-radio label="3">按钮</el-radio>
<el-radio :label="1">目录</el-radio>
<el-radio :label="2">菜单</el-radio>
<el-radio :label="3">按钮</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" v-if="form.menuType != '3'">
<el-col :span="24" v-if="form.menuType != 3">
<el-form-item label="菜单图标" prop="icon">
<el-popover
placement="bottom-start"
@@ -141,7 +141,7 @@
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType != '3'">
<el-col :span="12" v-if="form.menuType != 3">
<el-form-item>
<template #label>
<span>
@@ -156,7 +156,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType != '3'">
<el-col :span="12" v-if="form.menuType != 3">
<el-form-item prop="path">
<template #label>
<span>
@@ -172,7 +172,7 @@
<el-input v-model="form.path" placeholder="请输入路由地址" />
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType == '2'">
<el-col :span="12" v-if="form.menuType == 2">
<el-form-item prop="component">
<template #label>
<span>
@@ -201,7 +201,7 @@
</template>
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType == '2'">
<el-col :span="12" v-if="form.menuType == 2">
<el-form-item>
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
<template #label>
@@ -233,7 +233,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType != '3'">
<el-col :span="12" v-if="form.menuType != 3">
<el-form-item>
<template #label>
<span>
@@ -248,7 +248,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="form.menuType != '3'">
<el-col :span="12" v-if="form.menuType != 3">
<el-form-item>
<template #label>
<span>
@@ -344,7 +344,7 @@ function reset() {
parentId: 0,
menuName: undefined,
icon: undefined,
menuType: '1',
menuType: 1,
orderNum: undefined,
isExternal: 0,
isCache: 0,

View File

@@ -205,7 +205,7 @@ function reset() {
noticeTitle: undefined,
noticeType: undefined,
noticeContent: undefined,
status: '0',
status: 0,
};
proxy.resetForm('noticeRef');
}

View File

@@ -87,8 +87,8 @@
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="1"
inactive-value="0"
:active-value="1"
:inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
@@ -288,11 +288,11 @@ const deptRef = ref(null);
/** 数据范围选项 */
const dataScopeOptions = ref([
{ value: '1', label: '全部数据权限' },
{ value: '2', label: '自定数据权限' },
{ value: '3', label: '本部门数据权限' },
{ value: '4', label: '本部门及以下数据权限' },
{ value: '5', label: '仅本人数据权限' },
{ value: 1, label: '全部数据权限' },
{ value: 2, label: '自定数据权限' },
{ value: 3, label: '本部门数据权限' },
{ value: 4, label: '本部门及以下数据权限' },
{ value: 5, label: '仅本人数据权限' },
]);
const data = reactive({
@@ -367,7 +367,7 @@ function handleSelectionChange(selection) {
}
/** 角色状态修改 */
function handleStatusChange(row) {
const text = row.status === '1' ? '启用' : '停用';
const text = row.status === 1 ? '启用' : '停用';
proxy.$modal
.confirm(`确认要"${text}""${row.roleName}"角色吗?`)
.then(() => roleApi.changeRoleStatus(row.roleId, row.status))
@@ -375,7 +375,7 @@ function handleStatusChange(row) {
proxy.$modal.msgSuccess(`${text}成功`);
})
.catch(() => {
row.status = row.status === '0' ? '1' : '0';
row.status = row.status === 0 ? 1 : 0;
});
}
/** 更多操作 */
@@ -424,7 +424,7 @@ function reset() {
roleName: undefined,
roleKey: undefined,
roleSort: 0,
status: '0',
status: 0,
menuIds: [],
deptIds: [],
menuCheckStrictly: true,

View File

@@ -152,9 +152,9 @@
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="1"
inactive-value="0"
v-model.number="scope.row.status"
:active-value="1"
:inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
@@ -529,7 +529,7 @@ function handleExport() {
}
/** 用户状态修改 */
function handleStatusChange(row) {
const text = row.status === '0' ? '停用' : '启用';
const text = row.status === 0 ? '停用' : '启用';
proxy.$modal
.confirm(`确认要"${text}""${row.username}"用户吗?`)
.then(() => userApi.changeUserStatus(row.userId, row.status))
@@ -537,7 +537,7 @@ function handleStatusChange(row) {
proxy.$modal.msgSuccess(`${text}成功`);
})
.catch(() => {
row.status = row.status === '0' ? '1' : '0';
row.status = row.status === 0 ? 1 : 0;
});
}
/** 更多操作 */
@@ -630,7 +630,7 @@ function reset() {
phoneNumber: undefined,
email: undefined,
sex: undefined,
status: '0',
status: 0,
remark: undefined,
postId: undefined,
roleId: undefined,