This commit is contained in:
Xubx 2025-03-06 14:58:16 +08:00
commit be44e6195a
6 changed files with 493 additions and 390 deletions

View File

@ -2,6 +2,11 @@ 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';
// 学科过滤方法
const filterMajor = (value, row) => {
console.log(value, row); // 打印过滤值和行数据
return row === value;
};
import { ref, onMounted,reactive } from 'vue'; import { ref, onMounted,reactive } from 'vue';
const groupOptions=ref() const groupOptions=ref()
@ -38,6 +43,15 @@ export const columns: BasicColumn[] = [
title: '学科', title: '学科',
align: 'center', align: 'center',
dataIndex: 'majorId', 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), // 过滤方法
}, },
{ {
title: '所属分组', title: '所属分组',
@ -61,14 +75,12 @@ export const columns: BasicColumn[] = [
// align: 'center', // align: 'center',
// dataIndex: 'userMajorId', // dataIndex: 'userMajorId',
//}, //},
//{ //{
// title: '使用次数', // title: '使用次数',
// align: 'center', // align: 'center',
// dataIndex: 'numberuse', // dataIndex: 'numberuse',
//}, //},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
@ -81,45 +93,29 @@ export const searchFormSchema: FormSchema[] = [
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
//{
// label: '用户id',
// field: 'userId',
// component: 'Input',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户id!' }];
// },
//},
{ {
label: '用户id', label: '姓名',
field: 'userId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户id!' }];
},
},
{
label: '用户名',
field: 'userName', field: 'userName',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户名!' }]; return [{ required: true, message: '请输入姓名!' }];
},
},
{
label: '学科',
field: 'majorId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入学科!' }];
},
},
{
label: '用户专业id',
field: 'userMajorId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户专业id!' }];
}, },
}, },
{ {
label: '工号', label: '工号',
field: 'teacherId', field: 'teacherId',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入工号!' }]; // return [{ required: true, message: '请输入工号!' }];
}, //},
}, },
{ {
label: '手机号', label: '手机号',
@ -129,8 +125,33 @@ 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: '请选择学科!' }];
// },
//},
//{
// label: '用户专业id',
// field: 'userMajorId',
// component: 'Input',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户专业id!' }];
// },
//},
{ {
label: '所属分组', label: '所属组',
field: 'groupId', field: 'groupId',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
@ -140,14 +161,14 @@ export const formSchema: FormSchema[] = [
return [{ required: true, message: '请选择分组!' }]; return [{ required: true, message: '请选择分组!' }];
}, },
}, },
{ //{
label: '使用次数', // label: '使用次数',
field: 'numberuse', // field: 'numberuse',
component: 'InputNumber', // component: 'InputNumber',
dynamicRules: ({ model, schema }) => { // dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入使用次数!' }]; // return [{ required: true, message: '请输入使用次数!' }];
}, // },
}, //},
{ {
label: '是否第一次阅卷', label: '是否第一次阅卷',
field: 'status', field: 'status',
@ -158,17 +179,17 @@ export const formSchema: FormSchema[] = [
{ label: '否', value: 1 }, { label: '否', value: 1 },
], ],
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择是否第一次阅卷!' }]; // return [{ required: true, message: '请选择是否第一次阅卷!' }];
}, //},
}, },
// TODO 主键隐藏字段目前写死为ID // TODO 主键隐藏字段目前写死为ID
{ //{
label: '', // label: '',
field: 'id', // field: 'id',
component: 'Input', // component: 'Input',
show: false, // show: false,
}, //},
]; ];
// 高级查询数据 // 高级查询数据

View File

@ -33,6 +33,9 @@
<a-tag v-if="record.status === 0" color="green"></a-tag> <a-tag v-if="record.status === 0" color="green"></a-tag>
<a-tag v-else-if="record.status !== 0" color="red"></a-tag> <a-tag v-else-if="record.status !== 0" color="red"></a-tag>
</span> </span>
<span v-if="column.dataIndex === 'majorId'">
<span>{{ record.majorIdDescription }}</span>
</span>
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->
@ -88,6 +91,53 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
success: handleSuccess, success: handleSuccess,
}, },
}); });
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CeesLocalTeacherModal from './components/CeesLocalTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './CeesLocalTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesLocalTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '本校教师表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '本校教师表',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;

View File

@ -70,7 +70,7 @@ export const columns: BasicColumn[] = [
onFilter: (value, record) => filterMajor(value, record.majorId), // 过滤方法 onFilter: (value, record) => filterMajor(value, record.majorId), // 过滤方法
}, },
{ {
title: '所属分组', title: '所属分组',
align: 'center', align: 'center',
customRender: ({ text }) => { customRender: ({ text }) => {
if (!groupOptions.value) { if (!groupOptions.value) {
@ -89,16 +89,16 @@ export const columns: BasicColumn[] = [
dataIndex: 'checked', dataIndex: 'checked',
}, },
{ //{
title: '使用次数', // title: '使用次数',
align: 'center', // align: 'center',
dataIndex: 'numberuse', // dataIndex: 'numberuse',
}, //},
{ //{
title: '状态', // title: '状态',
align: 'center', // align: 'center',
dataIndex: 'status', // dataIndex: 'status',
}, //},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
@ -111,54 +111,31 @@ export const searchFormSchema: FormSchema[] = [
]; ];
//表单数据 //表单数据
export const formSchema: FormSchema[] = [ export const formSchema: FormSchema[] = [
//{
// label: '用户id',
// field: 'userId',
// component: 'Input',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户id!' }];
// },
//},
{ {
label: '用户id', label: '学生名',
field: 'userId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户id!' }];
},
},
{
label: '用户名',
field: 'userName', field: 'userName',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户名!' }]; return [{ required: true, message: '请输入学生名!' }];
}, },
}, },
{ {
label: '学科', 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: '用户专业id',
field: 'userMajorId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户专业id!' }];
},
},
{
label: '学生id',
field: 'studentId', field: 'studentId',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入学生id!' }]; return [{ required: true, message: '请输入学号!' }];
}, },
}, },
{ {
label: '手机号', label: '手机号',
field: 'phone', field: 'phone',
@ -167,6 +144,39 @@ 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: '请选择学科!' }];
// },
//},
//{
// label: '用户专业id',
// field: 'userMajorId',
// component: 'Input',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户专业id!' }];
// },
//},
{
label: '所属组',
field: 'groupId',
component: 'InputNumber',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入组id!' }];
//},
},
{ {
label: '是否第一次阅卷', label: '是否第一次阅卷',
field: 'checked', field: 'checked',
@ -177,9 +187,9 @@ export const formSchema: FormSchema[] = [
{ label: '否', value: 1 }, { label: '否', value: 1 },
], ],
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择是否第一次阅卷!' }]; // return [{ required: true, message: '请选择是否第一次阅卷!' }];
}, //},
}, },
{ {
label: '所属分组', label: '所属分组',
@ -192,35 +202,35 @@ export const formSchema: FormSchema[] = [
return [{ required: true, message: '请选择分组!' }]; return [{ required: true, message: '请选择分组!' }];
}, },
}, },
{ //{
label: '使用次数', // label: '使用次数',
field: 'numberuse', // field: 'numberuse',
component: 'InputNumber', // component: 'InputNumber',
dynamicRules: ({ model, schema }) => { // dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入使用次数!' }]; // return [{ required: true, message: '请输入使用次数!' }];
}, // },
}, //},
{ //{
label: '状态', // label: '状态',
field: 'status', // field: 'status',
component: 'RadioGroup', // component: 'RadioGroup',
componentProps: { // componentProps: {
options: [ // options: [
{ label: '正常', value: 0 }, // { label: '正常', value: 0 },
{ label: '禁用', value: 1 }, // { label: '禁用', value: 1 },
], // ],
}, // },
dynamicRules: ({ model, schema }) => { // dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择状态!' }]; // return [{ required: true, message: '请选择状态!' }];
}, // },
}, //},
// TODO 主键隐藏字段目前写死为ID //// TODO 主键隐藏字段目前写死为ID
{ //{
label: '', // label: '',
field: 'id', // field: 'id',
component: 'Input', // component: 'Input',
show: false, // show: false,
}, //},
]; ];
// 高级查询数据 // 高级查询数据

View File

@ -37,6 +37,9 @@
<a-tag v-if="record.status === 0" color="green">正常</a-tag> <a-tag v-if="record.status === 0" color="green">正常</a-tag>
<a-tag v-else-if="record.status !== 0" color="red">禁用</a-tag> <a-tag v-else-if="record.status !== 0" color="red">禁用</a-tag>
</span> </span>
<span v-if="column.dataIndex === 'majorId'">
<span>{{ record.majorIdDescription }}</span>
</span>
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->

View File

@ -2,6 +2,12 @@ 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';
// 学科过滤方法
const filterMajor = (value, row) => {
console.log(value, row); // 打印过滤值和行数据
return row === value;
};
import { ref, onMounted,reactive } from 'vue'; import { ref, onMounted,reactive } from 'vue';
const groupOptions=ref() const groupOptions=ref()
@ -39,6 +45,15 @@ export const columns: BasicColumn[] = [
title: '学科', title: '学科',
align: 'center', align: 'center',
dataIndex: 'majorId', 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), // 过滤方法
}, },
{ {
title: '手机号', title: '手机号',
@ -72,82 +87,80 @@ export const columns: BasicColumn[] = [
align: 'center', align: 'center',
dataIndex: 'dormitory', dataIndex: 'dormitory',
}, },
//{
{ // title: '用户专业id',
title: '用户专业id', // align: 'center',
align: 'center', // dataIndex: 'userMajorId',
dataIndex: 'userMajorId', //},
}, //{
{ // title: '银行卡号',
title: '银行卡号', // align: 'center',
align: 'center', // dataIndex: 'pyCard',
dataIndex: 'pyCard', //},
}, //{
{ // title: '饭卡',
title: '饭卡', // align: 'center',
align: 'center', // dataIndex: 'mealCard',
dataIndex: 'mealCard', //},
}, //{
// title: '工作名称',
{ // align: 'center',
title: '工作名称', // dataIndex: 'workName',
align: 'center', //},
dataIndex: 'workName', //{
}, // title: '固定电话',
{ // align: 'center',
title: '固定电话', // dataIndex: 'workPhone',
align: 'center', //},
dataIndex: 'workPhone', //{
}, // title: '身份证',
{ // align: 'center',
title: '身份证', // dataIndex: 'identityId',
align: 'center', //},
dataIndex: 'identityId', //{
}, // title: '车牌号',
{ // align: 'center',
title: '车牌号', // dataIndex: 'carNumber',
align: 'center', //},
dataIndex: 'carNumber', //{
}, // title: '车辆是否入校',
{ // align: 'center',
title: '车辆是否入校', // dataIndex: 'carStatus',
align: 'center', //},
dataIndex: 'carStatus', //{
}, // title: '是否住宿',
{ // align: 'center',
title: '是否住宿', // dataIndex: 'dormitoryStatus',
align: 'center', //},
dataIndex: 'dormitoryStatus', //{
}, // title: '开户所在地',
{ // align: 'center',
title: '开户所在地', // dataIndex: 'bankAddress',
align: 'center', //},
dataIndex: 'bankAddress', //{
}, // title: '开户行',
{ // align: 'center',
title: '开户行', // dataIndex: 'bankName',
align: 'center', //},
dataIndex: 'bankName', //{
}, // title: '使用次数',
{ // align: 'center',
title: '使用次数', // dataIndex: 'numberuse',
align: 'center', //},
dataIndex: 'numberuse', //{
}, // title: '状态',
{ // align: 'center',
title: '状态', // dataIndex: 'status',
align: 'center', //},
dataIndex: 'status',
},
]; ];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ //{
label: '学科', // label: '学科',
field: 'majorId', // field: 'majorId',
component: 'JRangeNumber', // component: 'JRangeNumber',
//colProps: {span: 6}, // //colProps: {span: 6},
}, //},
{ {
label: '姓名', label: '姓名',
field: 'userName', field: 'userName',
@ -165,22 +178,6 @@ export const formSchema: FormSchema[] = [
return [{ required: true, message: '请输入用户ID!' }]; return [{ required: true, message: '请输入用户ID!' }];
}, },
}, },
{
label: '学科',
field: 'majorId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入专业id!' }];
},
},
{
label: '用户专业id',
field: 'userMajorId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户专业id!' }];
},
},
{ {
label: '姓名', label: '姓名',
field: 'userName', field: 'userName',
@ -189,62 +186,6 @@ export const formSchema: FormSchema[] = [
return [{ required: true, message: '请输入姓名!' }]; return [{ required: true, message: '请输入姓名!' }];
}, },
}, },
{
label: '手机号',
field: 'phone',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入手机号!' }];
},
},
{
label: '职称',
field: 'jobTitle',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入职称!' }];
},
},
{
label: '银行卡号',
field: 'pyCard',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入银行卡号!' }];
},
},
{
label: '饭卡',
field: 'mealCard',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入饭卡!' }];
},
},
{
label: '职务',
field: 'office',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入办公位!' }];
},
},
{
label: '工作名称',
field: 'workName',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入工作名称!' }];
},
},
{
label: '固定电话',
field: 'workPhone',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入固定电话!' }];
},
},
{ {
label: '身份证', label: '身份证',
field: 'identityId', field: 'identityId',
@ -254,12 +195,9 @@ export const formSchema: FormSchema[] = [
}, },
}, },
{ {
label: '车牌号', label: '年龄',
field: 'carNumber', field: 'age',
component: 'Input', component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入车牌号!' }];
},
}, },
{ {
label: '性别', label: '性别',
@ -273,31 +211,109 @@ export const formSchema: FormSchema[] = [
}, },
}, },
{ {
label: '年龄', label: '学科',
field: 'age', field: 'majorId',
component: 'InputNumber', component: 'Select',
},
{
label: '车辆是否入校',
field: 'carStatus',
component: 'RadioGroup',
componentProps: { componentProps: {
options: [ options: [
{ label: '是', value: 0 }, { label: '语文', value: 1 },
{ label: '否', value: 1 }, { label: '地理', value: 4 },
{ label: '历史', value: 7 },
{ label: '政治', value: 8 },
], ],
}, },
dynamicRules: ({ model, schema }) => { dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入车辆是否入校!' }]; return [{ required: true, message: '请选择学科!' }];
}, },
}, },
//{
// label: '用户专业id',
// field: 'userMajorId',
// component: 'Input',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入用户专业id!' }];
// },
//},
{ {
label: '住宿信息', label: '手机号',
field: 'dormitory', field: 'phone',
component: 'Input', component: 'Input',
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入宿舍信息!' }]; // return [{ required: true, message: '请输入手机号!' }];
}, //},
},
{
label: '职称',
field: 'jobTitle',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入职称!' }];
//},
},
{
label: '职务',
field: 'office',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入办公位!' }];
//},
},
{
label: '单位名称',
field: 'workName',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入单位名称!' }];
//},
},
{
label: '单位电话',
field: 'workPhone',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入单位电话!' }];
//},
},
{
label: '银行卡号',
field: 'pyCard',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入银行卡号!' }];
//},
},
{
label: '开户地区',
field: 'bankAddress',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入开户地区(北京,哈尔滨)' }];
//},
},
{
label: '开户行',
field: 'bankName',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入开户行!' }];
//},
},
{
label: '车牌号',
field: 'carNumber',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入车牌号!' }];
//},
},
{
label: '饭卡',
field: 'mealCard',
component: 'Input',
//dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入饭卡!' }];
//},
}, },
{ {
label: '是否住宿', label: '是否住宿',
@ -309,25 +325,9 @@ export const formSchema: FormSchema[] = [
{ label: '否', value: 1 }, { label: '否', value: 1 },
], ],
}, },
dynamicRules: ({ model, schema }) => { //dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入是否住宿!' }]; // return [{ required: true, message: '请输入是否住宿!' }];
}, //},
},
{
label: '开户所在地',
field: 'bankAddress',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入开户所在地!' }];
},
},
{
label: '开户行',
field: 'bankName',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入开户行!' }];
},
}, },
{ {
label: '所属分组', label: '所属分组',
@ -341,40 +341,72 @@ export const formSchema: FormSchema[] = [
}, },
}, },
{ {
label: '使用次数', label: '车辆是否入校',
field: 'numberuse', field: 'carStatus',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入使用次数!' }];
},
},
{
label: '状态:',
field: 'status',
component: 'RadioGroup', component: 'RadioGroup',
componentProps: { componentProps: {
options: [ options: [
{ label: '已报到', value: 0 }, { label: '是', value: 0 },
{ label: '未报到', value: 1 }, { label: '否', value: 1 },
], ],
}, },
dynamicRules: ({ model, schema }) => { }
return [{ required: true, message: '请选择状态' }]; //dynamicRules: ({ model, schema }) => {
}, // return [{ required: true, message: '请输入车辆是否入校!' }];
}, //},
// TODO 主键隐藏字段目前写死为ID
{ //{
label: '', // label: '住宿信息',
field: 'id', // field: 'dormitory',
component: 'Input', // component: 'Input',
show: false, // dynamicRules: ({ model, schema }) => {
}, // return [{ required: true, message: '请输入宿舍信息!' }];
// },
//},
//{
// label: '所属分组',
// field: 'groupId',
// component: 'InputNumber',
// dynamicRules: ({ model, schema }) => {
// return [{ required: true, message: '请输入组id!' }];
// },
//},
//{
// 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 = { export const superQuerySchema = {
userId: { title: '用户ID', order: 0, view: 'text', type: 'string' }, userId: { title: '用户ID', order: 0, view: 'text', type: 'string' },
majorId: { title: '学科', order: 1, view: 'number', type: 'number' }, majorId: { title: '学科', order: 1, view: 'text', type: 'number' },
userMajorId: { title: '用户专业id', order: 2, view: 'text', type: 'string' }, userMajorId: { title: '用户专业id', order: 2, view: 'text', type: 'string' },
userName: { title: '姓名', order: 3, view: 'text', type: 'string' }, userName: { title: '姓名', order: 3, view: 'text', type: 'string' },
phone: { title: '手机号', order: 4, view: 'text', type: 'string' }, phone: { title: '手机号', order: 4, view: 'text', type: 'string' },

View File

@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expanded-row-keys="expandedRowKeys" <BasicTable @register="registerTable" :rowSelection="rowSelection" ref="tableRef" :expandedRowKeys="expandedKeys"
:expandable="expandable" @expanded-rows-change="handleExpand"> rowKey="id" :expandedRowRender="renderExpandedRow" @expand="handleExpand">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -24,34 +24,6 @@
<!-- 高级查询 --> <!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" /> <super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template> </template>
<template #expand="{ record }">
<a-descriptions bordered :column="2">
<a-descriptions-item label="身份证号">
{{ record.identityId }}
</a-descriptions-item>
<a-descriptions-item label="银行卡号">
{{ record.pyCard }}
</a-descriptions-item>
<a-descriptions-item label="工作单位">
{{ record.workName }}
</a-descriptions-item>
<a-descriptions-item label="开户所在地">
{{ record.bankAddress }}
</a-descriptions-item>
<a-descriptions-item label="单位电话">
{{ record.workPhone }}
</a-descriptions-item>
<a-descriptions-item label="开户行">
{{ record.bankName }}
</a-descriptions-item>
<a-descriptions-item label="车牌号">
{{ record.carNumber }}
</a-descriptions-item>
<a-descriptions-item label="饭卡号">
{{ record.mealCard }}
</a-descriptions-item>
</a-descriptions>
</template>
<!--操作栏--> <!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
@ -59,12 +31,12 @@
<!--字段回显插槽--> <!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }"> <template #bodyCell="{ column, record, index, text }">
<span v-if="column.dataIndex === 'sex'"> <span v-if="column.dataIndex === 'sex'">
<a-tag v-if="record.dormitoryType === 0" color="green"></a-tag> <a-tag v-if="record.sex === 0" color="green"></a-tag>
<a-tag v-else-if="record.dormitoryType !== 0" color="red"></a-tag> <a-tag v-else-if="record.sex !== 0" color="red"></a-tag>
</span> </span>
<span v-if="column.dataIndex === 'status'"> <span v-if="column.dataIndex === 'status'">
<a-tag v-if="record.dormitoryStatus === 0" color="green">已报到</a-tag> <a-tag v-if="record.status === 0" color="green">已报到</a-tag>
<a-tag v-else-if="record.dormitoryStatus !== 0" color="red">未报到</a-tag> <a-tag v-else-if="record.status !== 0" color="red">未报到</a-tag>
</span> </span>
<span v-if="column.dataIndex === 'carStatus'"> <span v-if="column.dataIndex === 'carStatus'">
<a-tag v-if="record.carStatus === 0" color="green"></a-tag> <a-tag v-if="record.carStatus === 0" color="green"></a-tag>
@ -74,6 +46,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>
<!-- 表单区域 --> <!-- 表单区域 -->
@ -81,14 +56,14 @@
</div> </div>
</template> </template>
<script lang="ts" name="cees-ceesWaiTeacher" setup> <script lang="tsx" name="cees-ceesWaiTeacher" setup>
import { ref, reactive, computed, unref,onMounted } from 'vue'; import { ref, reactive, computed, unref, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue'; import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema,updateGroupOptions } from './CeesWaiTeacher.data'; import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesWaiTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,getGroup } from './CeesWaiTeacher.api'; import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup } from './CeesWaiTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils'; import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({}); const queryParam = reactive<any>({});
@ -129,21 +104,33 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
success: handleSuccess, success: handleSuccess,
}, },
}); });
//
const expandedRowKeys = ref<string[]>(["0"]); // rowKey key
const expandable = { const expandedKeys = ref<string[]>(['1']); //
expandedRowKeys, //
expandedRowRender: (record) => ( const renderExpandedRow = (record: Record<string, any>) => {
1111 return (
), <a-descriptions column = { 2} >
}; <a-descriptions - item label = "身份证号" > { record.record.identityId } </a-descriptions-item>
// < a - descriptions - item label = "银行卡号" > { record.record.pyCard } </a-descriptions-item>
const handleExpand = (expanded, record) => { < a - descriptions - item label = "工作单位" > { record.record.workName } </a-descriptions-item>
console.log(expanded, record, 'expand'); < a - descriptions - item label = "开户所在地" > { record.record.bankAddress } </a-descriptions-item>
< a - descriptions - item label = "单位电话" > { record.record.workPhone } </a-descriptions-item>
< a - descriptions - item label = "开户行" > { record.record.bankName } </a-descriptions-item>
< a - descriptions - item label = "车牌号" > { record.record.carNumber } </a-descriptions-item>
< a - descriptions - item label = "饭卡号" > { record.record.mealCard } </a-descriptions-item>
</a-descriptions>
);
};
// / expandedKeys
const handleExpand = (expanded: boolean, record: Record<string, any>) => {
console.log('展开/收起', expanded, record);
if (expanded) { if (expanded) {
expandedRowKeys.value = [record.id]; // if (!expandedKeys.value.includes(record.id)) {
expandedKeys.value.push(record.id);
}
} else { } else {
expandedRowKeys.value = []; // expandedKeys.value = expandedKeys.value.filter((key) => key !== record.id);
} }
}; };
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;