添加外校老师报到权限和宿舍显示人员
This commit is contained in:
parent
eea74b629e
commit
cbdc977fd6
|
@ -10,26 +10,37 @@ export const columns: BasicColumn[] = [
|
|||
title: '宿舍信息',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitory',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '宿舍类型(男/女)',
|
||||
title: '宿舍类型',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitoryType',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '宿舍人数',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitoryNum',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitoryStatus',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '所属学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '宿舍人员信息',
|
||||
align: 'center',
|
||||
dataIndex: 'dormitorydata',
|
||||
width: 300,
|
||||
},
|
||||
];
|
||||
//查询数据
|
||||
|
@ -51,7 +62,7 @@ export const searchFormSchema: FormSchema[] = [
|
|||
},
|
||||
ifShow: ({ values }) => {
|
||||
return hasPermission('dormitory:majorId:select');
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
//表单数据
|
||||
|
|
|
@ -410,8 +410,8 @@ export const formSchema: FormSchema[] = [
|
|||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '是', value: 0 },
|
||||
{ label: '否', value: 1 },
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
},
|
||||
//dynamicRules: ({ model, schema }) => {
|
||||
|
@ -436,8 +436,8 @@ export const formSchema: FormSchema[] = [
|
|||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '是', value: 0 },
|
||||
{ label: '否', value: 1 },
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
},
|
||||
//dynamicRules: ({ model, schema }) => {
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
</template>
|
||||
<!--操作栏-->
|
||||
<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)" />
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
|
@ -303,34 +304,23 @@
|
|||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
const actions = [];
|
||||
|
||||
if (record.status !== 0) {
|
||||
actions.push({
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
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) {
|
||||
const actions = [];
|
||||
|
@ -341,8 +331,8 @@
|
|||
Modal.confirm({
|
||||
title: isConfirmAction ? '请核对信息!!!' : '',
|
||||
content: <ConfirmContent record={record} />,
|
||||
okText: isConfirmAction ? '确认报到' : '取消报到', // 根据操作类型设置确认按钮文本
|
||||
cancelText: isConfirmAction ? '取消' : '关闭', // 根据操作类型设置取消按钮文本
|
||||
okText: isConfirmAction ? '确认报到' : '取消报到',
|
||||
cancelText: isConfirmAction ? '取消' : '关闭',
|
||||
width: 800,
|
||||
onOk: () => {
|
||||
if (isConfirmAction) {
|
||||
|
@ -354,17 +344,28 @@
|
|||
});
|
||||
};
|
||||
|
||||
// 取消报到按钮(始终显示,无权限时禁用)
|
||||
if (record.status === 0) {
|
||||
const hasCancelPermission = hasPermission('waiTeacher:cancelRegister');
|
||||
actions.push({
|
||||
label: '取消确认',
|
||||
label: '取消报到',
|
||||
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({
|
||||
label: '确认报到',
|
||||
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.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.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>
|
||||
);
|
||||
|
@ -427,25 +456,21 @@
|
|||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
},
|
||||
ifShow: () => {
|
||||
return hasPermission('waiTeacher:delete');
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
//function getDropDownAction(record) {
|
||||
// return [
|
||||
// {
|
||||
// label: '删除',
|
||||
// popConfirm: {
|
||||
// title: '是否确认删除',
|
||||
// confirm: handleDelete.bind(null, record),
|
||||
// placement: 'topLeft',
|
||||
// },
|
||||
// ifShow: () => {
|
||||
// return hasPermission('waiTeacher:delete');
|
||||
// },
|
||||
// },
|
||||
// ];
|
||||
//}
|
||||
|
||||
// 定义 handleFocus 函数
|
||||
async function handleFocus(record) {
|
||||
|
@ -502,4 +527,60 @@
|
|||
.qr {
|
||||
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>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
//展开折叠的key
|
||||
const expandedKeys = ref<any>([]);
|
||||
//父子节点选中状态是否关联
|
||||
const checkStrictly = ref<boolean>(false);
|
||||
const checkStrictly = ref<boolean>(true);
|
||||
const [registerDrawer1, { openDrawer: openDataRuleDrawer }] = useDrawer();
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
await reset();
|
||||
|
|
Loading…
Reference in New Issue