import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { rules } from '/@/utils/helper/validator'; import { ref,reactive } from 'vue'; import { render } from '/@/utils/common/renderUtils'; import {defHttp} from '/@/utils/http/axios'; import { getOption } from 'showdown'; const groupOptions=ref() // 创建一个简单的事件总线 export const updateGroupOptions = reactive({ updateGroupOptions(newOptions: any) { groupOptions.value = newOptions; }, }); //列表数据 export const columns: BasicColumn[] = [ { title: '学生名', align: 'center', dataIndex: 'userName', }, { title: '用户ID', align: 'center', dataIndex: 'userId', }, { title: '学号', align: 'center', dataIndex: 'studentId', }, { title: '手机号', align: 'center', dataIndex: 'phone', }, { title: '学科', align: 'center', dataIndex: 'majorId', }, { title: '所属分组', align: 'center', customRender: ({ text }) => { if (!groupOptions.value) { return '加载中...'; // 如果未加载,显示加载中 } const group = groupOptions.value.find(item => item.value === text.groupId); if (group) { return group.label; } return '未知分组'; }, }, { title: '是否第一次阅卷', align: 'center', dataIndex: 'checked', }, //{ // title: '使用次数', // align: 'center', // dataIndex: 'numberuse', //}, //{ // title: '状态', // align: 'center', // dataIndex: 'status', //}, ]; //查询数据 export const searchFormSchema: FormSchema[] = [ { label: '用户名', field: 'userName', component: 'Input', //colProps: {span: 6}, }, { label: '学科', field: 'majorId', component: 'Select', componentProps: { options: [ { label: '语文', value: 1 }, { label: '地理', value: 4 }, { label: '历史', value: 7 }, { label: '政治', value: 8 }, ], }, } ]; //表单数据 export const formSchema: FormSchema[] = [ //{ // label: '用户id', // field: 'userId', // component: 'Input', // dynamicRules: ({ model, schema }) => { // return [{ required: true, message: '请输入用户id!' }]; // }, //}, { label: '学生名', field: 'userName', component: 'Input', dynamicRules: ({ model, schema }) => { 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: '请选择学科!' }]; }, }, { label: '学号', field: 'studentId', component: 'Input', dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请输入学号!' }]; }, }, { label: '手机号', field: 'phone', component: 'Input', dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请输入手机号!' }]; }, }, { label: '是否第一次阅卷', field: 'checked', component: 'RadioGroup', componentProps: { options: [ { label: '是', value: 0 }, { label: '否', value: 1 }, ], }, //dynamicRules: ({ model, schema }) => { // return [{ required: true, message: '请选择是否第一次阅卷!' }]; //}, }, { label: '所属分组', field: 'groupId', component: 'Select', componentProps: { options: groupOptions, // 动态设置分组选项 }, dynamicRules: ({ model, schema }) => { return [{ required: true, message: '请选择分组!' }]; }, }, //{ // label: '使用次数', // field: 'numberuse', // component: 'InputNumber', // dynamicRules: ({ model, schema }) => { // return [{ required: true, message: '请输入使用次数!' }]; // }, //}, //{ // label: '状态', // field: 'status', // component: 'RadioGroup', // componentProps: { // options: [ // { label: '正常', value: 0 }, // { label: '禁用', value: 1 }, // ], // }, // dynamicRules: ({ model, schema }) => { // return [{ required: true, message: '请选择状态!' }]; // }, //}, // TODO 主键隐藏字段,目前写死为ID { label: '', field: 'id', component: 'Input', show: false, }, ]; // 高级查询数据 export const superQuerySchema = { userId: { title: '用户id', order: 0, view: 'text', type: 'string' }, userName: { title: '用户名', order: 1, view: 'text', type: 'string' }, majorId: { title: '专业id,0表示未选择', order: 2, view: 'number', type: 'number' }, userMajorId: { title: '用户专业id', order: 3, view: 'text', type: 'string' }, studentId: { title: '学生id', order: 4, view: 'text', type: 'string' }, phone: { title: '手机号', order: 5, view: 'text', type: 'string' }, checked: { title: '是否第一次阅卷', order: 6, view: 'text', type: 'string' }, groupId: { title: '组id', order: 7, view: 'number', type: 'number' }, numberuse: { title: '使用次数', order: 8, view: 'number', type: 'number' }, status: { title: '状态:0正常 1禁用', order: 9, view: 'number', type: 'number' }, }; /** * 流程表单调用这个方法获取formSchema * @param param */ export function getBpmFormSchema(_formData): FormSchema[] { // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema return formSchema; }