From 02df9af20b37e70c018a5fad349c07d8f66d6078 Mon Sep 17 00:00:00 2001 From: Qi <3194726156@qq.com> Date: Mon, 9 Jun 2025 15:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=BF=E8=88=8D=E5=88=97=E8=A1=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cees/dormitory/CeesDormitoryInfo.data.ts | 26 ++++++++++++++++--- .../cees/dormitory/CeesDormitoryInfoList.vue | 11 ++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/views/cees/dormitory/CeesDormitoryInfo.data.ts b/src/views/cees/dormitory/CeesDormitoryInfo.data.ts index 637246e..fcf4e97 100644 --- a/src/views/cees/dormitory/CeesDormitoryInfo.data.ts +++ b/src/views/cees/dormitory/CeesDormitoryInfo.data.ts @@ -6,10 +6,17 @@ import { usePermission } from '/@/hooks/web/usePermission'; const { hasPermission } = usePermission(); //列表数据 export const columns: BasicColumn[] = [ + { + title: '公寓', + align: 'center', + dataIndex: 'apartment', + sorter: true, + width: 100, + }, { title: '宿舍信息', align: 'center', - dataIndex: 'dormitory', + dataIndex: 'dormitoryRoom', width: 100, }, { @@ -66,6 +73,17 @@ export const searchFormSchema: FormSchema[] = [ return hasPermission('dormitory:majorId:select'); }, }, + { + label: '宿舍类型', + field: 'dormitoryType', + component: 'Select', + componentProps: { + options: [ + { label: '女', value: 1 }, + { label: '男', value: 0 }, + ], + }, + }, ]; //表单数据 export const formSchema: FormSchema[] = [ @@ -87,7 +105,7 @@ export const formSchema: FormSchema[] = [ { label: '女', value: 1 }, ], }, - defaultValue: 1, + //defaultValue: 1, dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请选择男/女!' }]; }, @@ -96,7 +114,7 @@ export const formSchema: FormSchema[] = [ label: '宿舍人数', field: 'dormitoryNum', component: 'InputNumber', - defaultValue: 4, + //defaultValue: 4, dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请输入宿舍人数!' }]; }, @@ -123,11 +141,13 @@ export const formSchema: FormSchema[] = [ component: 'Select', componentProps: { options: [ + { label: '不分配学科', value: null }, // 👈 空值选项 { label: '语文', value: 1 }, { label: '地理', value: 4 }, { label: '历史', value: 7 }, { label: '政治', value: 8 }, ], + allowClear: true, // 👈 可选,加上后可以清除已选项(ant-design-vue 支持) }, //dynamicRules: ({ model, schema }) => { // return [{ required: true, message: '请选择所属学科!' }]; diff --git a/src/views/cees/dormitory/CeesDormitoryInfoList.vue b/src/views/cees/dormitory/CeesDormitoryInfoList.vue index 48292f9..fe82e80 100644 --- a/src/views/cees/dormitory/CeesDormitoryInfoList.vue +++ b/src/views/cees/dormitory/CeesDormitoryInfoList.vue @@ -16,7 +16,7 @@ - + {{ item.label }} @@ -123,6 +123,7 @@ }); const options = [ + { label: '不分配学科', value: '' }, { label: '语文', value: 1 }, { label: '地理', value: 4 }, { label: '历史', value: 7 }, @@ -138,10 +139,10 @@ }; const handleOk = async () => { - if (!form.majorId) { - message.warning('请选择学科'); - return; - } + //if (!form.majorId) { + // message.warning('请选择学科'); + // return; + //} console.log('选择的学科 ID:', form.majorId); // 调用后端接口设置 await setDormAndSubject({ ids: selectedRowKeys.value, majorId: form.majorId }, handleSuccess);