CEES-manage/src/views/cees/group/CeesGroup.data.ts

140 lines
3.4 KiB
TypeScript
Raw Normal View History

2025-06-09 22:54:03 +08:00
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
2025-03-06 14:39:23 +08:00
import { render } from '/@/utils/common/renderUtils';
2025-04-28 19:20:17 +08:00
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
2025-03-06 14:39:23 +08:00
export const columns: BasicColumn[] = [
2025-06-09 22:54:03 +08:00
{
2025-03-06 14:39:23 +08:00
title: '组名',
2025-06-09 22:54:03 +08:00
align: 'center',
2025-03-23 17:36:25 +08:00
dataIndex: 'name',
2025-06-09 22:54:03 +08:00
width: 150,
},
2025-03-06 14:39:23 +08:00
// {
2025-03-23 17:36:25 +08:00
// title: '分组',
2025-03-06 14:39:23 +08:00
// align: 'center',
// width: 150,
// slots: { customRender: 'action2' }, // 使用插槽自定义操作列
//},
{
title: '组员信息',
align: 'center',
dataIndex: 'rowUser',
//customRender: ({ record }) => {
// // 使用Promise处理异步操作
// return getRowUser({ id: record.id }).then((data) => {
// console.log(data);
// // 假设getRowUser返回的数据是一个字符串数组
// return data.map((item) => item).join(',');
// }).catch((error) => {
// console.error(error);
// return '加载失败';
// });
//},
},
{
title: '评卷地点',
2025-06-09 22:54:03 +08:00
align: 'center',
dataIndex: 'markingLocation',
2025-06-09 22:54:03 +08:00
width: 200,
},
2025-03-06 14:39:23 +08:00
// {
// title: '专业id',
// align:"center",
// dataIndex: 'majorId'
// },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
2025-04-28 19:20:17 +08:00
{
label: '组名',
field: 'name',
component: 'Input',
//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');
},
},
{
label: '评卷地点',
field: 'markingLocation',
component: 'Input',
2025-06-09 22:54:03 +08:00
},
2025-03-06 14:39:23 +08:00
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '组名',
field: 'name',
component: 'Input',
2025-06-09 22:54:03 +08:00
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入分组名!' }];
},
2025-03-06 14:39:23 +08:00
},
{
2025-03-23 17:36:25 +08:00
label: '学科',
2025-03-06 14:39:23 +08:00
field: 'majorId',
2025-03-23 17:36:25 +08:00
component: 'Select',
componentProps: {
options: [
{ label: '语文', value: 1 },
{ label: '地理', value: 4 },
{ label: '历史', value: 7 },
{ label: '政治', value: 8 },
],
},
2025-06-09 22:54:03 +08:00
dynamicRules: ({ model, schema }) => {
if (!hasPermission('majorId:edit')) {
// 没有权限,不添加校验规则
return [];
}
return [{ required: true, message: '请选择学科!' }];
2025-03-23 17:36:25 +08:00
},
2025-04-28 19:20:17 +08:00
show: ({ values }) => {
return hasPermission('majorId:edit');
2025-06-09 22:54:03 +08:00
},
},
{
label: '评卷地点',
field: 'markingLocation',
component: 'Input',
2025-03-06 14:39:23 +08:00
},
2025-06-09 22:54:03 +08:00
// TODO 主键隐藏字段目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
2025-03-06 14:39:23 +08:00
];
// 高级查询数据
export const superQuerySchema = {
2025-06-09 22:54:03 +08:00
name: { title: '组名', order: 0, view: 'text', type: 'string' },
majorId: { title: '专业id', order: 1, view: 'number', type: 'number' },
2025-03-06 14:39:23 +08:00
};
/**
2025-06-09 22:54:03 +08:00
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
2025-03-06 14:39:23 +08:00
// 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema
return formSchema;
2025-06-09 22:54:03 +08:00
}