所有的所属分组改成非必填项,宿舍管理添加所属学科

This commit is contained in:
Xubx 2025-05-19 14:53:26 +08:00
parent 09bc8c474b
commit 587ace2901
6 changed files with 88 additions and 16 deletions

View File

@ -2,6 +2,8 @@ import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator'; import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
@ -24,9 +26,34 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'dormitoryStatus', dataIndex: 'dormitoryStatus',
}, },
{
title: '所属学科',
align: 'center',
dataIndex: 'majorId',
},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = []; export const searchFormSchema: FormSchema[] = [
{
label: '宿舍信息',
field: 'dormitory',
component: 'Input',
},
{
label: '所属学科',
field: 'majorId',
component: 'Select',
componentProps: {
options: [
{ label: '语文', value: 1 },
{ label: '地理', value: 4 },
],
},
ifShow: ({ values }) => {
return hasPermission('dormitory:majorId:select');
}
},
];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
{ {
@ -74,6 +101,22 @@ export const formSchema: FormSchema[] = [
return [{ required: true, message: '请选择宿舍状态' }]; return [{ required: true, message: '请选择宿舍状态' }];
}, },
}, },
{
label: '所属学科',
field: 'majorId',
component: 'Select',
componentProps: {
options: [
{ label: '语文', value: 1 },
{ label: '地理', value: 4 },
{ label: '历史', value: 7 },
{ label: '政治', value: 8 },
],
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择所属学科!' }];
},
},
// TODO 主键隐藏字段目前写死为ID // TODO 主键隐藏字段目前写死为ID
{ {
label: '', label: '',

View File

@ -38,7 +38,9 @@
<a-tag v-if="record.dormitoryStatus === 0" color="green">未满</a-tag> <a-tag v-if="record.dormitoryStatus === 0" color="green">未满</a-tag>
<a-tag v-else-if="record.dormitoryStatus !== 0" color="red">已满</a-tag> <a-tag v-else-if="record.dormitoryStatus !== 0" color="red">已满</a-tag>
</span> </span>
<span v-if="column.dataIndex === 'majorId'">
<span>{{ record.majorIdDescription }}</span>
</span>
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->

View File

@ -3,10 +3,6 @@ import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator'; import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
//import { getRowUser } from '/@/views/cees/group/CeesGroup.api';
//列表数据
const { hasPermission } = usePermission(); const { hasPermission } = usePermission();
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
@ -52,6 +48,22 @@ export const searchFormSchema: FormSchema[] = [
component: 'Input', component: 'Input',
//colProps: {span: 6}, //colProps: {span: 6},
}, },
{
label: '学科',
field: 'majorId',
component: 'Select',
componentProps: {
options: [
{ label: '语文', value: 1 },
{ label: '地理', value: 4 },
{ label: '历史', value: 7 },
{ label: '政治', value: 8 },
],
},
ifShow: ({ values }) => {
return hasPermission('group:majorId:select');
},
}
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [

View File

@ -3,6 +3,8 @@ import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator'; import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
import { ref, onMounted, reactive } from 'vue'; import { ref, onMounted, reactive } from 'vue';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const groupOptions = ref(); const groupOptions = ref();
// 创建一个简单的事件总线 // 创建一个简单的事件总线
@ -94,6 +96,9 @@ export const searchFormSchema: FormSchema[] = [
{ label: '政治', value: 8 }, { label: '政治', value: 8 },
], ],
}, },
ifShow: ({ values }) => {
return hasPermission('localTeacher:majorId:select');
},
}, },
]; ];
//表单数据 //表单数据
@ -138,9 +143,9 @@ export const formSchema: FormSchema[] = [
componentProps: { componentProps: {
options: groupOptions, // 动态设置分组选项 options: groupOptions, // 动态设置分组选项
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择分组!' }]; // return [{ required: true, message: '请选择分组!' }];
}, //},
}, },
//{ //{
// label: '使用次数', // label: '使用次数',

View File

@ -5,6 +5,8 @@ import { ref,reactive } from 'vue';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
import {defHttp} from '/@/utils/http/axios'; import {defHttp} from '/@/utils/http/axios';
import { getOption } from 'showdown'; import { getOption } from 'showdown';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const groupOptions=ref() const groupOptions=ref()
// 创建一个简单的事件总线 // 创建一个简单的事件总线
@ -92,6 +94,9 @@ export const searchFormSchema: FormSchema[] = [
{ label: '政治', value: 8 }, { label: '政治', value: 8 },
], ],
}, },
ifShow: ({ values }) => {
return hasPermission('student:majorId:select');
}
} }
]; ];
//表单数据 //表单数据
@ -165,9 +170,9 @@ export const formSchema: FormSchema[] = [
componentProps: { componentProps: {
options: groupOptions, // 动态设置分组选项 options: groupOptions, // 动态设置分组选项
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择分组!' }]; // return [{ required: true, message: '请选择分组!' }];
}, //},
}, },
//{ //{
// label: '使用次数', // label: '使用次数',

View File

@ -3,6 +3,8 @@ import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator'; import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
import { ref, onMounted, reactive } from 'vue'; import { ref, onMounted, reactive } from 'vue';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
const groupOptions = ref(); const groupOptions = ref();
@ -107,7 +109,10 @@ export const searchFormSchema: FormSchema[] = [
{ label: '政治', value: 8 }, { label: '政治', value: 8 },
], ],
}, },
} ifShow: ({ values }) => {
return hasPermission('waiTeacher:majorId:select');
},
},
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
@ -277,9 +282,9 @@ export const formSchema: FormSchema[] = [
componentProps: { componentProps: {
options: groupOptions, // 动态设置分组选项 options: groupOptions, // 动态设置分组选项
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择分组!' }]; // return [{ required: true, message: '请选择分组!' }];
}, //},
}, },
{ {