添加外校老师报到权限和宿舍显示人员

This commit is contained in:
Qi 2025-05-26 21:06:00 +08:00
parent eea74b629e
commit cbdc977fd6
4 changed files with 152 additions and 60 deletions

View File

@ -10,26 +10,37 @@ export const columns: BasicColumn[] = [
title: '宿舍信息', title: '宿舍信息',
align: 'center', align: 'center',
dataIndex: 'dormitory', dataIndex: 'dormitory',
width: 100,
}, },
{ {
title: '宿舍类型(男/女)', title: '宿舍类型',
align: 'center', align: 'center',
dataIndex: 'dormitoryType', dataIndex: 'dormitoryType',
width: 100,
}, },
{ {
title: '宿舍人数', title: '宿舍人数',
align: 'center', align: 'center',
dataIndex: 'dormitoryNum', dataIndex: 'dormitoryNum',
width: 100,
}, },
{ {
title: '状态', title: '状态',
align: 'center', align: 'center',
dataIndex: 'dormitoryStatus', dataIndex: 'dormitoryStatus',
width: 100,
}, },
{ {
title: '所属学科', title: '所属学科',
align: 'center', align: 'center',
dataIndex: 'majorId', dataIndex: 'majorId',
width: 100,
},
{
title: '宿舍人员信息',
align: 'center',
dataIndex: 'dormitorydata',
width: 300,
}, },
]; ];
//查询数据 //查询数据
@ -51,7 +62,7 @@ export const searchFormSchema: FormSchema[] = [
}, },
ifShow: ({ values }) => { ifShow: ({ values }) => {
return hasPermission('dormitory:majorId:select'); return hasPermission('dormitory:majorId:select');
} },
}, },
]; ];
//表单数据 //表单数据

View File

@ -410,8 +410,8 @@ export const formSchema: FormSchema[] = [
component: 'RadioGroup', component: 'RadioGroup',
componentProps: { componentProps: {
options: [ options: [
{ label: '是', value: 0 }, { label: '是', value: 1 },
{ label: '否', value: 1 }, { label: '否', value: 0 },
], ],
}, },
//dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
@ -436,8 +436,8 @@ export const formSchema: FormSchema[] = [
component: 'RadioGroup', component: 'RadioGroup',
componentProps: { componentProps: {
options: [ options: [
{ label: '是', value: 0 }, { label: '是', value: 1 },
{ label: '否', value: 1 }, { label: '否', value: 0 },
], ],
}, },
//dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {

View File

@ -38,7 +38,8 @@
</template> </template>
<!--操作栏--> <!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <!--<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />-->
<TableAction :actions="getTableAction(record)" />
<TableAction :actions="ConfirmRegistration(record)" /> <TableAction :actions="ConfirmRegistration(record)" />
</template> </template>
<!--字段回显插槽--> <!--字段回显插槽-->
@ -303,34 +304,23 @@
* 操作栏 * 操作栏
*/ */
function getTableAction(record) { function getTableAction(record) {
const actions = []; return [
{
if (record.status !== 0) {
actions.push({
label: '编辑', label: '编辑',
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
}); ifShow: () => record.status !== 0, // 0
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
ifShow: () => hasPermission('waiTeacher:delete'), //
},
];
} }
return actions;
}
//function ConfirmRegistration(record) {
// const actions = [{}];
// //
// if (record.status === 0) {
// actions.push({
// label: '',
// color: 'error', //
// onClick: () => updateStatus(record.id, 'un'), //
// });
// } else {
// actions.push({
// label: '',
// color: 'primary', //
// onClick: () => updateStatus(record.id), //
// });
// }
// return actions;
//}
function ConfirmRegistration(record) { function ConfirmRegistration(record) {
const actions = []; const actions = [];
@ -341,8 +331,8 @@
Modal.confirm({ Modal.confirm({
title: isConfirmAction ? '请核对信息!!!' : '', title: isConfirmAction ? '请核对信息!!!' : '',
content: <ConfirmContent record={record} />, content: <ConfirmContent record={record} />,
okText: isConfirmAction ? '确认报到' : '取消报到', // okText: isConfirmAction ? '确认报到' : '取消报到',
cancelText: isConfirmAction ? '取消' : '关闭', // cancelText: isConfirmAction ? '取消' : '关闭',
width: 800, width: 800,
onOk: () => { onOk: () => {
if (isConfirmAction) { if (isConfirmAction) {
@ -354,17 +344,28 @@
}); });
}; };
//
if (record.status === 0) { if (record.status === 0) {
const hasCancelPermission = hasPermission('waiTeacher:cancelRegister');
actions.push({ actions.push({
label: '取消确认', label: '取消报到',
color: 'error', color: 'error',
onClick: () => handleConfirm('cancel'), onClick: hasCancelPermission ? () => handleConfirm('cancel') : undefined,
disabled: !hasCancelPermission,
tooltip: !hasCancelPermission ? '无取消报到权限' : undefined,
ifShow: () => true, //
}); });
} else { }
//
else {
const hasConfirmPermission = hasPermission('waiTeacher:confirmRegister');
actions.push({ actions.push({
label: '确认报到', label: '确认报到',
color: 'primary', color: 'primary',
onClick: () => handleConfirm('confirm'), onClick: hasConfirmPermission ? () => handleConfirm('confirm') : undefined,
disabled: !hasConfirmPermission,
tooltip: !hasConfirmPermission ? '无确认报到权限' : undefined,
ifShow: () => true, //
}); });
} }
@ -397,10 +398,38 @@
<Descriptions.Item label="开户行">{record.bankName}</Descriptions.Item> <Descriptions.Item label="开户行">{record.bankName}</Descriptions.Item>
<Descriptions.Item label="车牌号">{record.carNumber}</Descriptions.Item> <Descriptions.Item label="车牌号">{record.carNumber}</Descriptions.Item>
{/*<Descriptions.Item label="饭卡">{record.mealCard}</Descriptions.Item>*/} <Descriptions.Item label="饭卡">{record.mealCard}</Descriptions.Item>
<Descriptions.Item label="所属分组">{record.groupId}</Descriptions.Item> <Descriptions.Item label="所属分组">{record.groupId}</Descriptions.Item>
<Descriptions.Item label="住宿信息">{record.dormitoryName}</Descriptions.Item> <Descriptions.Item label="住宿信息">
<div className="custom-select-wrapper">
<select
className="custom-select"
value={record.dormitoryName}
disabled={!!record.dormitoryName}
onFocus={() => handleFocus(record)}
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}
</option>
))}
</select>
<span className="custom-arrow"></span>
</div>
</Descriptions.Item>
<Descriptions.Item label="学科">{record.majorIdDescription}</Descriptions.Item> <Descriptions.Item label="学科">{record.majorIdDescription}</Descriptions.Item>
</Descriptions> </Descriptions>
); );
@ -427,25 +456,21 @@
/** /**
* 下拉操作栏 * 下拉操作栏
*/ */
function getDropDownAction(record) { //function getDropDownAction(record) {
return [ // return [
{ // {
label: '详情', // label: '',
onClick: handleDetail.bind(null, record), // popConfirm: {
}, // title: '',
{ // confirm: handleDelete.bind(null, record),
label: '删除', // placement: 'topLeft',
popConfirm: { // },
title: '是否确认删除', // ifShow: () => {
confirm: handleDelete.bind(null, record), // return hasPermission('waiTeacher:delete');
placement: 'topLeft', // },
}, // },
ifShow: () => { // ];
return hasPermission('waiTeacher:delete'); //}
},
},
];
}
// handleFocus // handleFocus
async function handleFocus(record) { async function handleFocus(record) {
@ -502,4 +527,60 @@
.qr { .qr {
display: flex; display: flex;
} }
/** 自定义选择框容器 */
.custom-select-wrapper {
position: relative;
display: inline-block;
width: 150px;
}
/* 原生select元素美化 */
.custom-select {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
padding: 6px 12px;
font-size: 14px;
line-height: 1.5;
color: rgba(0, 0, 0, 0.85);
background-color: #fff;
background-image: none;
border: 1px solid #d9d9d9;
border-radius: 4px;
transition: all 0.3s;
cursor: pointer;
}
/* 下拉箭头 */
.custom-arrow {
position: absolute;
top: 50%;
right: 12px;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #999;
pointer-events: none;
}
/* 交互状态 */
.custom-select:focus {
border-color: #40a9ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
outline: none;
}
.custom-select:disabled {
color: rgba(0, 0, 0, 0.25);
background-color: #f5f5f5;
cursor: not-allowed;
}
/* 选项样式 */
.custom-select option {
padding: 8px 12px;
}
</style> </style>

View File

@ -72,7 +72,7 @@
//key //key
const expandedKeys = ref<any>([]); const expandedKeys = ref<any>([]);
// //
const checkStrictly = ref<boolean>(false); const checkStrictly = ref<boolean>(true);
const [registerDrawer1, { openDrawer: openDataRuleDrawer }] = useDrawer(); const [registerDrawer1, { openDrawer: openDataRuleDrawer }] = useDrawer();
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
await reset(); await reset();