学科选择框优化
This commit is contained in:
parent
87201c3af9
commit
1416ffced7
|
@ -3,11 +3,6 @@ import { FormSchema } from '/@/components/Table';
|
|||
import { rules } from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { ref, onMounted,reactive } from 'vue';
|
||||
// 学科过滤方法
|
||||
const filterMajor = (value, row) => {
|
||||
console.log(value, row); // 打印过滤值和行数据
|
||||
return row === value;
|
||||
};
|
||||
|
||||
const groupOptions=ref()
|
||||
// 创建一个简单的事件总线
|
||||
|
@ -42,16 +37,7 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId',
|
||||
filters: [
|
||||
{ text: '语文', value: 1 },
|
||||
{ text: '地理', value: 4 },
|
||||
{ text: '历史', value: 7 },
|
||||
{ text: '政治', value: 8 },
|
||||
],
|
||||
filterMultiple: false, // 是否支持多选过滤
|
||||
//value: 用户选择的过滤值(如 1)。
|
||||
onFilter: (value, record) => filterMajor(value, record.majorId), // 过滤方法
|
||||
dataIndex: 'majorId'
|
||||
},
|
||||
{
|
||||
title: '所属分组',
|
||||
|
@ -92,6 +78,19 @@ export const searchFormSchema: FormSchema[] = [
|
|||
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[] = [
|
||||
|
|
|
@ -6,13 +6,6 @@ import { render } from '/@/utils/common/renderUtils';
|
|||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { getOption } from 'showdown';
|
||||
|
||||
// 学科映射
|
||||
const majorMap = {
|
||||
1: '语文',
|
||||
4: '地理',
|
||||
7: '历史',
|
||||
8: '政治',
|
||||
};
|
||||
const groupOptions=ref()
|
||||
// 创建一个简单的事件总线
|
||||
export const updateGroupOptions = reactive({
|
||||
|
@ -20,15 +13,6 @@ export const updateGroupOptions = reactive({
|
|||
groupOptions.value = newOptions;
|
||||
},
|
||||
});
|
||||
// 根据 majorId 获取学科名称
|
||||
const isMajor = (majorId) => {
|
||||
return majorMap[majorId] || '未知学科';
|
||||
};
|
||||
|
||||
// 学科过滤方法
|
||||
const filterMajor = (value, row) => {
|
||||
return row === value;
|
||||
};
|
||||
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
|
@ -56,18 +40,6 @@ export const columns: BasicColumn[] = [
|
|||
title: '学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId',
|
||||
customRender: ({ text }) => {
|
||||
return isMajor(text); // 根据 majorId 显示学科名称
|
||||
},
|
||||
filters: [
|
||||
{ text: '语文', value: 1 },
|
||||
{ text: '地理', value: 4 },
|
||||
{ text: '历史', value: 7 },
|
||||
{ text: '政治', value: 8 },
|
||||
],
|
||||
filterMultiple: false, // 是否支持多选过滤
|
||||
//value: 用户选择的过滤值(如 1)。
|
||||
onFilter: (value, record) => filterMajor(value, record.majorId), // 过滤方法
|
||||
},
|
||||
{
|
||||
title: '所属分组',
|
||||
|
@ -108,6 +80,19 @@ export const searchFormSchema: FormSchema[] = [
|
|||
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[] = [
|
||||
|
|
|
@ -4,12 +4,6 @@ import { rules } from '/@/utils/helper/validator';
|
|||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { ref, onMounted, reactive } from 'vue';
|
||||
|
||||
// 学科过滤方法
|
||||
const filterMajor = (value, row) => {
|
||||
console.log(value, row); // 打印过滤值和行数据
|
||||
return row === value;
|
||||
};
|
||||
|
||||
const groupOptions = ref();
|
||||
|
||||
// 创建一个简单的事件总线
|
||||
|
@ -44,16 +38,7 @@ export const columns: BasicColumn[] = [
|
|||
{
|
||||
title: '学科',
|
||||
align: 'center',
|
||||
dataIndex: 'majorId',
|
||||
filters: [
|
||||
{ text: '语文', value: 1 },
|
||||
{ text: '地理', value: 4 },
|
||||
{ text: '历史', value: 7 },
|
||||
{ text: '政治', value: 8 },
|
||||
],
|
||||
filterMultiple: false, // 是否支持多选过滤
|
||||
//value: 用户选择的过滤值(如 1)。
|
||||
onFilter: (value, record) => filterMajor(value, record.majorId), // 过滤方法
|
||||
dataIndex: 'majorId'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
|
@ -102,6 +87,19 @@ export const searchFormSchema: FormSchema[] = [
|
|||
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[] = [
|
||||
|
|
|
@ -110,7 +110,6 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
fieldMapToNumber: [['majorId', ['majorId_begin', 'majorId_end']]],
|
||||
fieldMapToTime: [],
|
||||
},
|
||||
actionColumn: {
|
||||
|
|
Loading…
Reference in New Issue