数据定义bug修复

This commit is contained in:
Qi 2025-06-03 18:48:48 +08:00
parent feb87feb20
commit 13504e167b
5 changed files with 74 additions and 53 deletions

View File

@ -8,7 +8,7 @@ import { getOption } from 'showdown';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission(); const { hasPermission } = usePermission();
const groupOptions=ref() const groupOptions = ref();
// 创建一个简单的事件总线 // 创建一个简单的事件总线
export const updateGroupOptions = reactive({ export const updateGroupOptions = reactive({
updateGroupOptions(newOptions: any) { updateGroupOptions(newOptions: any) {
@ -50,7 +50,7 @@ export const columns: BasicColumn[] = [
if (!groupOptions.value) { if (!groupOptions.value) {
return '加载中...'; // 如果未加载,显示加载中 return '加载中...'; // 如果未加载,显示加载中
} }
const group = groupOptions.value.find(item => item.value === text.groupId); const group = groupOptions.value.find((item) => item.value === text.groupId);
if (group) { if (group) {
return group.label; return group.label;
} }
@ -96,8 +96,8 @@ export const searchFormSchema: FormSchema[] = [
}, },
ifShow: ({ values }) => { ifShow: ({ values }) => {
return hasPermission('student:majorId:select'); return hasPermission('student:majorId:select');
} },
} },
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [

View File

@ -35,8 +35,8 @@
<!--字段回显插槽--> <!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> <template #bodyCell="{ column, record, index, text }">
<span v-if="column.dataIndex === 'checked'"> <span v-if="column.dataIndex === 'checked'">
<a-tag v-if="record.checked === 0" color="green"></a-tag> <a-tag v-if="record.checked === 1" color="green"></a-tag>
<a-tag v-else-if="record.checked !== 0" color="red"></a-tag> <a-tag v-else-if="record.checked !== 1" color="red"></a-tag>
</span> </span>
<span v-if="column.dataIndex === 'status'"> <span v-if="column.dataIndex === 'status'">
<a-tag v-if="record.status === 0" color="green">正常</a-tag> <a-tag v-if="record.status === 0" color="green">正常</a-tag>

View File

@ -172,18 +172,18 @@ function validateIdCard(value: string) {
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{
title: '姓名',
align: 'center',
sorter: true,
dataIndex: 'userName',
},
{ {
title: '用户身份码 ', title: '用户身份码 ',
align: 'center', align: 'center',
sorter: true, sorter: true,
dataIndex: 'userId', dataIndex: 'userId',
}, },
{
title: '姓名',
align: 'center',
sorter: true,
dataIndex: 'userName',
},
{ {
title: '年龄', title: '年龄',
align: 'center', align: 'center',
@ -196,6 +196,12 @@ export const columns: BasicColumn[] = [
sorter: true, sorter: true,
dataIndex: 'sex', dataIndex: 'sex',
}, },
{
title: '用户专业ID ',
align: 'center',
sorter: true,
dataIndex: 'userMajorId',
},
{ {
title: '学科', title: '学科',
align: 'center', align: 'center',

View File

@ -64,25 +64,30 @@
<span>{{ record.majorIdDescription }}</span> <span>{{ record.majorIdDescription }}</span>
</span> </span>
<span v-if="column.dataIndex === 'dormitoryName'"> <span v-if="column.dataIndex === 'dormitoryName'">
<!-- 选择逻辑存在问题使placeholder没办法显示 -->
<a-select <a-select
placeholder="请选择" placeholder="请选择宿舍"
size="small" size="small"
style="width: 120px" style="width: 120px"
v-model:value="record.dormitoryName" v-model:value="record.dormitoryName"
:disabled="record.dormitoryName != null" :disabled="record.dormitoryStatus === 0 || record.dormitoryName != null"
@focus="handleFocus(record)" @focus="handleFocus(record)"
@change="handleChange(record.userId, record.dormitoryName, record)" @change="handleChange(record.userId, record.dormitoryName, record)"
filterables :show-arrow="record.dormitoryStatus !== 0"
> >
<template v-if="dormOptions.length === 0"> <!-- 禁用状态显示 -->
<a-option value="" label="加载中..." disabled /> <template v-if="record.dormitoryStatus === 0">
<a-select-option :value="null" disabled>该用户未住宿</a-select-option>
</template> </template>
<a-select-option v-for="item in dormOptions" :key="item.value" :label="item.label" :value="item.value">{{ item.label }}</a-select-option> <!-- 启用状态显示选项 -->
<template v-else>
<!-- 正常选项 -->
<a-select-option v-for="item in dormOptions" :key="item.value" :value="item.value">
{{ item.label }}
</a-select-option>
<template v-if="dormOptions.length === 0"> <!-- 无数据状态 -->
<a-option value="" label="暂无数据" disabled /> <a-select-option v-if="dormOptions.length === 0 && !loading" value="" disabled> 暂无宿舍数据 </a-select-option>
</template> </template>
</a-select> </a-select>
</span> </span>
@ -406,25 +411,35 @@
<select <select
className="custom-select" className="custom-select"
value={record.dormitoryName} value={record.dormitoryName}
onFocus={() => handleFocus(record)} disabled={record.dormitoryStatus === 0} // status
onFocus={() => record.dormitoryStatus !== 0 && handleFocus(record)} // focus
onChange={(e) => handleChange(record.userId, e.target.value, record)} onChange={(e) => handleChange(record.userId, e.target.value, record)}
> >
{/* 禁用状态显示提示 */}
{record.dormitoryStatus === 0 ? (
<option value="" disabled>
该用户未住宿
</option>
) : (
<>
<option value="" disabled hidden> <option value="" disabled hidden>
请选择宿舍 请选择宿舍
</option> </option>
{/* 添加兜底选项回显 */} {/* 兜底选项(仅当启用状态且当前值不在选项中时显示) */}
{!dormOptions.value.some((item) => item.value === record.dormitoryName) && record.dormitoryName && ( {!dormOptions.value.some((item) => item.value === record.dormitoryName) && record.dormitoryName && (
<option value={record.dormitoryName}>{record.dormitoryName}</option> <option value={record.dormitoryName}>{record.dormitoryName}</option>
)} )}
{/* 正常宿舍选项 */}
{dormOptions.value.map((item) => ( {dormOptions.value.map((item) => (
<option key={item.value} value={item.value}> <option key={item.value} value={item.value}>
{item.label} {item.label}
</option> </option>
))} ))}
</>
)}
</select> </select>
<span className="custom-arrow"></span> <span className="custom-arrow"></span>
</div> </div>
</Descriptions.Item> </Descriptions.Item>

View File

@ -33,7 +33,7 @@
> >
<template #title="{ slotTitle, ruleFlag }"> <template #title="{ slotTitle, ruleFlag }">
{{ slotTitle }} {{ slotTitle }}
<Icon v-if="ruleFlag" icon="ant-design:align-left-outlined" style="margin-left: 5px; color: red"></Icon> <Icon v-if="ruleFlag" icon="ant-design:align-left-outlined" style="margin-left: 5px; color: red" />
</template> </template>
</BasicTree> </BasicTree>
<!--右下角按钮--> <!--右下角按钮-->
@ -53,7 +53,7 @@
import { PopConfirmButton } from '/@/components/Button'; import { PopConfirmButton } from '/@/components/Button';
import RoleDataRuleDrawer from './RoleDataRuleDrawer.vue'; import RoleDataRuleDrawer from './RoleDataRuleDrawer.vue';
import { queryTreeListForRole, queryRolePermission, saveRolePermission } from '../role.api'; import { queryTreeListForRole, queryRolePermission, saveRolePermission } from '../role.api';
import { useI18n } from "/@/hooks/web/useI18n"; import { useI18n } from '/@/hooks/web/useI18n';
const emit = defineEmits(['register']); const emit = defineEmits(['register']);
// //
const treeData = ref<TreeItem[]>([]); const treeData = ref<TreeItem[]>([]);
@ -159,7 +159,7 @@
}; };
//update-begin-author:taoyan date:2023-2-11 for: issues/352 VUE //update-begin-author:taoyan date:2023-2-11 for: issues/352 VUE
if (loading.value === false) { if (loading.value === false) {
await doSave(params) await doSave(params);
} else { } else {
console.log('请等待上次执行完毕!'); console.log('请等待上次执行完毕!');
} }
@ -179,7 +179,7 @@
await saveRolePermission(params); await saveRolePermission(params);
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
}, 500) }, 500);
} }
//update-end-author:taoyan date:2023-2-11 for: issues/352 VUE //update-end-author:taoyan date:2023-2-11 for: issues/352 VUE