CEES-manage/src/views/cees/localTeacher/CeesLocalTeacher.data.ts

202 lines
5.0 KiB
TypeScript
Raw Normal View History

2025-03-03 19:41:01 +08:00
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
2025-03-03 18:23:57 +08:00
import { render } from '/@/utils/common/renderUtils';
2025-03-11 20:30:57 +08:00
import { ref, onMounted, reactive } from 'vue';
import { usePermission } from '/@/hooks/web/usePermission';
const { hasPermission } = usePermission();
2025-03-06 14:39:23 +08:00
2025-03-11 20:30:57 +08:00
const groupOptions = ref();
2025-03-06 14:39:23 +08:00
// 创建一个简单的事件总线
export const updateGroupOptions = reactive({
updateGroupOptions(newOptions: any) {
groupOptions.value = newOptions;
},
});
2025-03-03 18:23:57 +08:00
//列表数据
export const columns: BasicColumn[] = [
2025-03-03 19:41:01 +08:00
{
2025-03-04 14:32:56 +08:00
title: '姓名',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
2025-03-03 19:41:01 +08:00
dataIndex: 'userName',
},
{
2025-05-25 19:32:43 +08:00
title: '用户身份码 ',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
2025-03-04 14:32:56 +08:00
dataIndex: 'userId',
2025-03-03 19:41:01 +08:00
},
{
2025-03-04 14:32:56 +08:00
title: '工号',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
2025-03-03 19:41:01 +08:00
dataIndex: 'teacherId',
},
{
2025-03-03 18:23:57 +08:00
title: '手机号',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
2025-03-03 19:41:01 +08:00
dataIndex: 'phone',
},
{
2025-03-04 14:32:56 +08:00
title: '学科',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
dataIndex: 'majorId',
2025-03-03 19:41:01 +08:00
},
{
2025-03-04 14:32:56 +08:00
title: '所属分组',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-06 14:39:23 +08:00
//dataIndex: 'groupId',
customRender: ({ text }) => {
2025-03-11 20:30:57 +08:00
const group = groupOptions.value.find((item) => item.value === text.groupId);
2025-03-06 14:39:23 +08:00
if (group) {
return group.label;
}
return '未知分组';
},
2025-03-03 19:41:01 +08:00
},
{
2025-03-04 14:32:56 +08:00
title: '是否第一次阅卷',
2025-03-03 19:41:01 +08:00
align: 'center',
2025-03-11 20:30:57 +08:00
sorter: true,
2025-03-03 19:41:01 +08:00
dataIndex: 'status',
},
2025-03-04 14:32:56 +08:00
//{
// title: '用户专业id',
// align: 'center',
// dataIndex: 'userMajorId',
//},
2025-03-11 20:30:57 +08:00
2025-03-04 14:32:56 +08:00
//{
// title: '使用次数',
// align: 'center',
// dataIndex: 'numberuse',
//},
2025-03-03 18:23:57 +08:00
];
//查询数据
export const searchFormSchema: FormSchema[] = [
2025-03-03 19:41:01 +08:00
{
label: '用户名',
field: 'userName',
component: 'Input',
//colProps: {span: 6},
},
2025-03-11 18:35:23 +08:00
{
label: '学科',
field: 'majorId',
component: 'Select',
componentProps: {
options: [
{ label: '语文', value: 1 },
{ label: '地理', value: 4 },
{ label: '历史', value: 7 },
{ label: '政治', value: 8 },
],
},
ifShow: ({ values }) => {
return hasPermission('localTeacher:majorId:select');
},
2025-03-11 20:30:57 +08:00
},
2025-03-03 18:23:57 +08:00
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '用户id',
field: 'userId',
component: 'Input',
2025-03-06 17:14:16 +08:00
show: false,
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户id!' }];
//},
2025-03-03 18:23:57 +08:00
},
{
2025-03-06 17:14:16 +08:00
label: '姓名',
2025-03-03 18:23:57 +08:00
field: 'userName',
component: 'Input',
2025-03-03 19:41:01 +08:00
dynamicRules: ({ model, schema }) => {
2025-03-06 17:14:16 +08:00
return [{ required: true, message: '请输入姓名!' }];
2025-03-03 19:41:01 +08:00
},
2025-03-03 18:23:57 +08:00
},
{
2025-03-04 14:32:56 +08:00
label: '工号',
2025-03-03 18:23:57 +08:00
field: 'teacherId',
component: 'Input',
2025-03-06 17:14:16 +08:00
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入工号!' }];
//},
2025-03-03 18:23:57 +08:00
},
{
label: '手机号',
field: 'phone',
component: 'Input',
2025-03-03 19:41:01 +08:00
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入手机号!' }];
},
2025-03-03 18:23:57 +08:00
},
{
label: '所属分组',
2025-03-03 18:23:57 +08:00
field: 'groupId',
2025-03-06 14:39:23 +08:00
component: 'Select',
componentProps: {
options: groupOptions, // 动态设置分组选项
},
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请选择分组!' }];
//},
2025-03-03 18:23:57 +08:00
},
2025-03-06 17:14:16 +08:00
//{
// label: '使用次数',
// field: 'numberuse',
// component: 'InputNumber',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入使用次数!' }];
// },
//},
2025-03-03 18:23:57 +08:00
{
2025-03-04 14:32:56 +08:00
label: '是否第一次阅卷',
2025-03-03 18:23:57 +08:00
field: 'status',
2025-03-03 19:41:01 +08:00
component: 'RadioGroup',
componentProps: {
options: [
2025-03-04 14:32:56 +08:00
{ label: '是', value: 0 },
{ label: '否', value: 1 },
2025-03-03 19:41:01 +08:00
],
},
2025-03-06 17:14:16 +08:00
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请选择是否第一次阅卷!' }];
//},
2025-03-03 19:41:01 +08:00
},
// TODO 主键隐藏字段目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
2025-03-03 18:23:57 +08:00
];
// 高级查询数据
export const superQuerySchema = {
2025-03-03 19:41:01 +08:00
userId: { title: '用户id', order: 0, view: 'text', type: 'string' },
userName: { title: '用户名', order: 1, view: 'text', type: 'string' },
2025-03-04 14:32:56 +08:00
majorId: { title: '学科', order: 2, view: 'number', type: 'number' },
2025-03-03 19:41:01 +08:00
userMajorId: { title: '用户专业id', order: 3, view: 'text', type: 'string' },
teacherId: { title: '用户专业id', order: 4, view: 'text', type: 'string' },
phone: { title: '手机号', order: 5, view: 'text', type: 'string' },
2025-03-04 14:32:56 +08:00
groupId: { title: '所属分组', order: 6, view: 'number', type: 'number' },
2025-03-03 19:41:01 +08:00
numberuse: { title: '使用次数', order: 7, view: 'number', type: 'number' },
status: { title: '状态0正常 1禁用', order: 8, view: 'number', type: 'number' },
2025-03-03 18:23:57 +08:00
};
/**
2025-03-03 19:41:01 +08:00
* formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
2025-03-03 18:23:57 +08:00
// 默认和原始表单保持一致 如果流程中配置了权限数据这里需要单独处理formSchema
return formSchema;
2025-03-03 19:41:01 +08:00
}