数据定义bug修复
This commit is contained in:
parent
feb87feb20
commit
13504e167b
|
@ -1,14 +1,14 @@
|
|||
import { BasicColumn } from '/@/components/Table';
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { ref,reactive } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { getOption } from 'showdown';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
const { hasPermission } = usePermission();
|
||||
|
||||
const groupOptions=ref()
|
||||
const groupOptions = ref();
|
||||
// 创建一个简单的事件总线
|
||||
export const updateGroupOptions = reactive({
|
||||
updateGroupOptions(newOptions: any) {
|
||||
|
@ -50,7 +50,7 @@ export const columns: BasicColumn[] = [
|
|||
if (!groupOptions.value) {
|
||||
return '加载中...'; // 如果未加载,显示加载中
|
||||
}
|
||||
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||
const group = groupOptions.value.find((item) => item.value === text.groupId);
|
||||
if (group) {
|
||||
return group.label;
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ export const searchFormSchema: FormSchema[] = [
|
|||
},
|
||||
ifShow: ({ values }) => {
|
||||
return hasPermission('student:majorId:select');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
<!--字段回显插槽-->
|
||||
<template #bodyCell="{ column, record, index, text }">
|
||||
<span v-if="column.dataIndex === 'checked'">
|
||||
<a-tag v-if="record.checked === 0" color="green">是</a-tag>
|
||||
<a-tag v-else-if="record.checked !== 0" color="red">否</a-tag>
|
||||
<a-tag v-if="record.checked === 1" color="green">是</a-tag>
|
||||
<a-tag v-else-if="record.checked !== 1" color="red">否</a-tag>
|
||||
</span>
|
||||
<span v-if="column.dataIndex === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">正常</a-tag>
|
||||
|
|
|
@ -172,18 +172,18 @@ function validateIdCard(value: string) {
|
|||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userName',
|
||||
},
|
||||
{
|
||||
title: '用户身份码 ',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userId',
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userName',
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
align: 'center',
|
||||
|
@ -196,6 +196,12 @@ export const columns: BasicColumn[] = [
|
|||
sorter: true,
|
||||
dataIndex: 'sex',
|
||||
},
|
||||
{
|
||||
title: '用户专业ID ',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
dataIndex: 'userMajorId',
|
||||
},
|
||||
{
|
||||
title: '学科',
|
||||
align: 'center',
|
||||
|
|
|
@ -64,25 +64,30 @@
|
|||
<span>{{ record.majorIdDescription }}</span>
|
||||
</span>
|
||||
<span v-if="column.dataIndex === 'dormitoryName'">
|
||||
<!-- 选择逻辑存在问题使placeholder没办法显示 -->
|
||||
<a-select
|
||||
placeholder="请选择"
|
||||
placeholder="请选择宿舍"
|
||||
size="small"
|
||||
style="width: 120px"
|
||||
v-model:value="record.dormitoryName"
|
||||
:disabled="record.dormitoryName != null"
|
||||
:disabled="record.dormitoryStatus === 0 || record.dormitoryName != null"
|
||||
@focus="handleFocus(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>
|
||||
|
||||
<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>
|
||||
</a-select>
|
||||
</span>
|
||||
|
@ -406,25 +411,35 @@
|
|||
<select
|
||||
className="custom-select"
|
||||
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)}
|
||||
>
|
||||
<option value="" disabled hidden>
|
||||
请选择宿舍
|
||||
</option>
|
||||
|
||||
{/* 添加兜底选项回显 */}
|
||||
{!dormOptions.value.some((item) => item.value === record.dormitoryName) && record.dormitoryName && (
|
||||
<option value={record.dormitoryName}>{record.dormitoryName}</option>
|
||||
)}
|
||||
|
||||
{dormOptions.value.map((item) => (
|
||||
<option key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
{/* 禁用状态显示提示 */}
|
||||
{record.dormitoryStatus === 0 ? (
|
||||
<option value="" disabled>
|
||||
该用户未住宿
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : (
|
||||
<>
|
||||
<option value="" disabled hidden>
|
||||
请选择宿舍
|
||||
</option>
|
||||
|
||||
{/* 兜底选项(仅当启用状态且当前值不在选项中时显示) */}
|
||||
{!dormOptions.value.some((item) => item.value === record.dormitoryName) && record.dormitoryName && (
|
||||
<option value={record.dormitoryName}>{record.dormitoryName}</option>
|
||||
)}
|
||||
|
||||
{/* 正常宿舍选项 */}
|
||||
{dormOptions.value.map((item) => (
|
||||
<option key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</select>
|
||||
<span className="custom-arrow"></span>
|
||||
</div>
|
||||
</Descriptions.Item>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
>
|
||||
<template #title="{ slotTitle, ruleFlag }">
|
||||
{{ 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>
|
||||
</BasicTree>
|
||||
<!--右下角按钮-->
|
||||
|
@ -53,7 +53,7 @@
|
|||
import { PopConfirmButton } from '/@/components/Button';
|
||||
import RoleDataRuleDrawer from './RoleDataRuleDrawer.vue';
|
||||
import { queryTreeListForRole, queryRolePermission, saveRolePermission } from '../role.api';
|
||||
import { useI18n } from "/@/hooks/web/useI18n";
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
const emit = defineEmits(['register']);
|
||||
//树的信息
|
||||
const treeData = ref<TreeItem[]>([]);
|
||||
|
@ -92,9 +92,9 @@
|
|||
setDrawerProps({ loading: false });
|
||||
});
|
||||
/**
|
||||
* 2024-02-28
|
||||
* liaozhiyang
|
||||
* 翻译菜单名称
|
||||
* 2024-02-28
|
||||
* liaozhiyang
|
||||
* 翻译菜单名称
|
||||
*/
|
||||
function translateTitle(data) {
|
||||
if (data?.length) {
|
||||
|
@ -158,15 +158,15 @@
|
|||
lastpermissionIds: unref(defaultCheckedKeys).join(','),
|
||||
};
|
||||
//update-begin-author:taoyan date:2023-2-11 for: issues/352 VUE角色授权重复保存
|
||||
if(loading.value===false){
|
||||
await doSave(params)
|
||||
}else{
|
||||
if (loading.value === false) {
|
||||
await doSave(params);
|
||||
} else {
|
||||
console.log('请等待上次执行完毕!');
|
||||
}
|
||||
if(exit){
|
||||
if (exit) {
|
||||
// 如果关闭
|
||||
closeDrawer();
|
||||
}else{
|
||||
} else {
|
||||
// 没有关闭需要重新获取选中数据
|
||||
const permResult = await queryRolePermission({ roleId: unref(roleId) });
|
||||
defaultCheckedKeys.value = permResult;
|
||||
|
@ -177,9 +177,9 @@
|
|||
async function doSave(params) {
|
||||
loading.value = true;
|
||||
await saveRolePermission(params);
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 500)
|
||||
}, 500);
|
||||
}
|
||||
//update-end-author:taoyan date:2023-2-11 for: issues/352 VUE角色授权重复保存
|
||||
|
||||
|
@ -224,7 +224,7 @@
|
|||
margin-right: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
:deep(.jeecg-tree-header){
|
||||
:deep(.jeecg-tree-header) {
|
||||
border-bottom: none;
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20230202 for:抽屉弹窗标题图标下拉样式------------
|
||||
|
|
Loading…
Reference in New Issue