分组管理
This commit is contained in:
parent
dbc9d8b458
commit
011d500186
|
@ -0,0 +1,80 @@
|
||||||
|
import {defHttp} from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/cees/ceesGroup/list',
|
||||||
|
save='/cees/ceesGroup/add',
|
||||||
|
edit='/cees/ceesGroup/edit',
|
||||||
|
deleteOne = '/cees/ceesGroup/delete',
|
||||||
|
deleteBatch = '/cees/ceesGroup/deleteBatch',
|
||||||
|
importExcel = '/cees/ceesGroup/importExcel',
|
||||||
|
exportXls = '/cees/ceesGroup/exportXls',
|
||||||
|
getRowUser = '/cees/ceesGroup/getRowUser',
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) =>
|
||||||
|
defHttp.get({url: Api.list, params}).then((res) => {
|
||||||
|
//添加组员信息
|
||||||
|
res.records.map((item) => {
|
||||||
|
getRowUser({id: item.id}).then((data) => {
|
||||||
|
item.rowUser = data.map((item) => item).join(',');
|
||||||
|
}).catch((error) => {
|
||||||
|
item.rowUser = '加载失败';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.log(res.records);
|
||||||
|
return res.records;
|
||||||
|
});
|
||||||
|
|
||||||
|
//查询组员
|
||||||
|
export const getRowUser = (params) =>
|
||||||
|
defHttp.get({url: Api.getRowUser, params});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({url: url, params});
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
//import { getRowUser } from '/@/views/cees/group/CeesGroup.api';
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '组名',
|
||||||
|
align:"center",
|
||||||
|
dataIndex: 'name'
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '操作',
|
||||||
|
// 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: '专业id',
|
||||||
|
// align:"center",
|
||||||
|
// dataIndex: 'majorId'
|
||||||
|
// },
|
||||||
|
];
|
||||||
|
//查询数据
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
];
|
||||||
|
//表单数据
|
||||||
|
export const formSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
label: '组名',
|
||||||
|
field: 'name',
|
||||||
|
component: 'Input',
|
||||||
|
dynamicRules: ({model,schema}) => {
|
||||||
|
return [
|
||||||
|
{ required: true, message: '请输入分组名!'},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '专业id',
|
||||||
|
field: 'majorId',
|
||||||
|
component: 'InputNumber',
|
||||||
|
dynamicRules: ({model,schema}) => {
|
||||||
|
return [
|
||||||
|
{ required: true, message: '请输入专业id!'},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// TODO 主键隐藏字段,目前写死为ID
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
field: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 高级查询数据
|
||||||
|
export const superQuerySchema = {
|
||||||
|
name: {title: '组名',order: 0,view: 'text', type: 'string',},
|
||||||
|
majorId: {title: '专业id',order: 1,view: 'number', type: 'number',},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程表单调用这个方法获取formSchema
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
export function getBpmFormSchema(_formData): FormSchema[]{
|
||||||
|
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||||
|
return formSchema;
|
||||||
|
}
|
|
@ -0,0 +1,194 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<!--引用表格-->
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<!--插槽:table标题-->
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||||
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
|
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button>批量操作
|
||||||
|
<Icon icon="mdi:chevron-down"></Icon>
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
<!-- 高级查询 -->
|
||||||
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||||
|
</template>
|
||||||
|
<!--操作栏-->
|
||||||
|
<template #action2="{ record }">
|
||||||
|
<a-button type="link" @click="addOrUpdateHandle(record)">分组</a-button>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||||
|
</template>
|
||||||
|
<!--字段回显插槽-->
|
||||||
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<CeesGroupModal @register="registerModal" @success="handleSuccess"></CeesGroupModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="cees-ceesGroup" setup>
|
||||||
|
import { ref, reactive, computed, unref, onMounted } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage'
|
||||||
|
import CeesGroupModal from './components/CeesGroupModal.vue'
|
||||||
|
import { columns, searchFormSchema, superQuerySchema } from './CeesGroup.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getRowUser } from './CeesGroup.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 superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
|
||||||
|
//分组
|
||||||
|
const addOrUpdateHandle = (record) => {
|
||||||
|
console.log('分组操作:', record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级查询事件
|
||||||
|
*/
|
||||||
|
function handleSuperQuery(params) {
|
||||||
|
Object.keys(params).map((k) => {
|
||||||
|
queryParam[k] = params[k];
|
||||||
|
});
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
openModal(true, {
|
||||||
|
isUpdate: false,
|
||||||
|
showFooter: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
openModal(true, {
|
||||||
|
record,
|
||||||
|
isUpdate: true,
|
||||||
|
showFooter: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
openModal(true, {
|
||||||
|
record,
|
||||||
|
isUpdate: true,
|
||||||
|
showFooter: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess() {
|
||||||
|
(selectedRowKeys.value = []) && reload();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
}, {
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
|
@ -0,0 +1,70 @@
|
||||||
|
<template>
|
||||||
|
<div style="min-height: 400px">
|
||||||
|
<BasicForm @register="registerForm"></BasicForm>
|
||||||
|
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
||||||
|
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||||
|
import {computed, defineComponent} from 'vue';
|
||||||
|
import {defHttp} from '/@/utils/http/axios';
|
||||||
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
|
import {getBpmFormSchema} from '../CeesGroup.data';
|
||||||
|
import {saveOrUpdate} from '../CeesGroup.api';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "CeesGroupForm",
|
||||||
|
components:{
|
||||||
|
BasicForm
|
||||||
|
},
|
||||||
|
props:{
|
||||||
|
formData: propTypes.object.def({}),
|
||||||
|
formBpm: propTypes.bool.def(true),
|
||||||
|
},
|
||||||
|
setup(props){
|
||||||
|
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||||
|
labelWidth: 150,
|
||||||
|
schemas: getBpmFormSchema(props.formData),
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
baseColProps: {span: 24}
|
||||||
|
});
|
||||||
|
|
||||||
|
const formDisabled = computed(()=>{
|
||||||
|
if(props.formData.disabled === false){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
let formData = {};
|
||||||
|
const queryByIdUrl = '/cees/ceesGroup/queryById';
|
||||||
|
async function initFormData(){
|
||||||
|
let params = {id: props.formData.dataId};
|
||||||
|
const data = await defHttp.get({url: queryByIdUrl, params});
|
||||||
|
formData = {...data}
|
||||||
|
//设置表单的值
|
||||||
|
await setFieldsValue(formData);
|
||||||
|
//默认是禁用
|
||||||
|
await setProps({disabled: formDisabled.value})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitForm() {
|
||||||
|
let data = getFieldsValue();
|
||||||
|
let params = Object.assign({}, formData, data);
|
||||||
|
console.log('表单数据', params)
|
||||||
|
await saveOrUpdate(params, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
initFormData();
|
||||||
|
|
||||||
|
return {
|
||||||
|
registerForm,
|
||||||
|
formDisabled,
|
||||||
|
submitForm,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<template>
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||||
|
<BasicForm @register="registerForm"/>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import {ref, computed, unref} from 'vue';
|
||||||
|
import {BasicModal, useModalInner} from '/@/components/Modal';
|
||||||
|
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||||
|
import {formSchema} from '../CeesGroup.data';
|
||||||
|
import {saveOrUpdate} from '../CeesGroup.api';
|
||||||
|
// Emits声明
|
||||||
|
const emit = defineEmits(['register','success']);
|
||||||
|
const isUpdate = ref(true);
|
||||||
|
//表单配置
|
||||||
|
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
|
||||||
|
//labelWidth: 150,
|
||||||
|
schemas: formSchema,
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
baseColProps: {span: 24}
|
||||||
|
});
|
||||||
|
//表单赋值
|
||||||
|
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||||
|
//重置表单
|
||||||
|
await resetFields();
|
||||||
|
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
//表单赋值
|
||||||
|
await setFieldsValue({
|
||||||
|
...data.record,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 隐藏底部时禁用整个表单
|
||||||
|
setProps({ disabled: !data?.showFooter })
|
||||||
|
});
|
||||||
|
//设置标题
|
||||||
|
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||||
|
//表单提交事件
|
||||||
|
async function handleSubmit(v) {
|
||||||
|
try {
|
||||||
|
let values = await validate();
|
||||||
|
setModalProps({confirmLoading: true});
|
||||||
|
//提交表单
|
||||||
|
await saveOrUpdate(values, isUpdate.value);
|
||||||
|
//关闭弹窗
|
||||||
|
closeModal();
|
||||||
|
//刷新列表
|
||||||
|
emit('success');
|
||||||
|
} finally {
|
||||||
|
setModalProps({confirmLoading: false});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
/** 时间和数字输入框样式 */
|
||||||
|
:deep(.ant-input-number){
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-calendar-picker){
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -11,7 +11,14 @@ enum Api {
|
||||||
deleteBatch = '/CEES/ceesLocalTeacher/deleteBatch',
|
deleteBatch = '/CEES/ceesLocalTeacher/deleteBatch',
|
||||||
importExcel = '/CEES/ceesLocalTeacher/importExcel',
|
importExcel = '/CEES/ceesLocalTeacher/importExcel',
|
||||||
exportXls = '/CEES/ceesLocalTeacher/exportXls',
|
exportXls = '/CEES/ceesLocalTeacher/exportXls',
|
||||||
|
updateGroupUser = '/cees/ceesGroup/updateGroupUser',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取分组
|
||||||
|
export const getGroup = () =>
|
||||||
|
defHttp.get({url: '/cees/ceesGroup/list'}).then((res) => {
|
||||||
|
return res.records;
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* 导出api
|
* 导出api
|
||||||
* @param params
|
* @param params
|
||||||
|
@ -54,11 +61,23 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新分组中间表
|
||||||
|
export const updateGroupUser = (params) => {
|
||||||
|
return defHttp.post({url: Api.updateGroupUser, params});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
// 更新分组中间表
|
||||||
|
const groupUserParams = {
|
||||||
|
userId: params.userId,
|
||||||
|
groupId: params.groupId
|
||||||
|
}
|
||||||
|
updateGroupUser(groupUserParams);
|
||||||
return defHttp.post({url: url, params});
|
return defHttp.post({url: url, params});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,16 @@ 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';
|
||||||
|
import { ref, onMounted,reactive } from 'vue';
|
||||||
|
|
||||||
|
const groupOptions=ref()
|
||||||
|
// 创建一个简单的事件总线
|
||||||
|
export const updateGroupOptions = reactive({
|
||||||
|
updateGroupOptions(newOptions: any) {
|
||||||
|
groupOptions.value = newOptions;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
//列表数据
|
//列表数据
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
|
@ -32,7 +42,14 @@ export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '所属分组',
|
title: '所属分组',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'groupId',
|
//dataIndex: 'groupId',
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||||
|
if (group) {
|
||||||
|
return group.label;
|
||||||
|
}
|
||||||
|
return '未知分组';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '是否第一次阅卷',
|
title: '是否第一次阅卷',
|
||||||
|
@ -115,9 +132,12 @@ export const formSchema: FormSchema[] = [
|
||||||
{
|
{
|
||||||
label: '所属分组',
|
label: '所属分组',
|
||||||
field: 'groupId',
|
field: 'groupId',
|
||||||
component: 'InputNumber',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
return [{ required: true, message: '请输入所属分组!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,13 +41,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="CEES-ceesLocalTeacher" setup>
|
<script lang="ts" name="CEES-ceesLocalTeacher" setup>
|
||||||
import { ref, reactive, computed, unref } 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 CeesLocalTeacherModal from './components/CeesLocalTeacherModal.vue';
|
import CeesLocalTeacherModal from './components/CeesLocalTeacherModal.vue';
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './CeesLocalTeacher.data';
|
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesLocalTeacher.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesLocalTeacher.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup } from './CeesLocalTeacher.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>({});
|
||||||
|
@ -91,6 +91,25 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
// 在组件加载时获取分组数据
|
||||||
|
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
console.log('组件已加载');
|
||||||
|
try {
|
||||||
|
const res = await getGroup();
|
||||||
|
console.log('获取分组数据成功:', res);
|
||||||
|
groupOptions.value = res.map((group) => ({
|
||||||
|
label: group.name, // 假设分组名称字段为 name
|
||||||
|
value: group.id, // 假设分组 ID 字段为 id
|
||||||
|
}));
|
||||||
|
console.log('分组数据:', groupOptions.value);
|
||||||
|
updateGroupOptions.updateGroupOptions(groupOptions.value)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分组数据失败:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 高级查询配置
|
// 高级查询配置
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,14 @@ enum Api {
|
||||||
deleteBatch = '/cees/student/deleteBatch',
|
deleteBatch = '/cees/student/deleteBatch',
|
||||||
importExcel = '/cees/student/importExcel',
|
importExcel = '/cees/student/importExcel',
|
||||||
exportXls = '/cees/student/exportXls',
|
exportXls = '/cees/student/exportXls',
|
||||||
|
updateGroupUser = '/cees/ceesGroup/updateGroupUser',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取分组
|
||||||
|
export const getGroup = () =>
|
||||||
|
defHttp.get({url: '/cees/ceesGroup/list'}).then((res) => {
|
||||||
|
return res.records;
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* 导出api
|
* 导出api
|
||||||
* @param params
|
* @param params
|
||||||
|
@ -54,11 +61,21 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
//更新分组中间表
|
||||||
|
export const updateGroupUser = (params) => {
|
||||||
|
return defHttp.post({url: Api.updateGroupUser, params});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
// 更新分组中间表
|
||||||
|
const groupUserParams = {
|
||||||
|
userId: params.userId,
|
||||||
|
groupId: params.groupId
|
||||||
|
}
|
||||||
|
updateGroupUser(groupUserParams);
|
||||||
return defHttp.post({url: url, params});
|
return defHttp.post({url: url, params});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { BasicColumn } from '/@/components/Table';
|
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 { ref, onMounted,reactive } from 'vue';
|
||||||
import { render } from '/@/utils/common/renderUtils';
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
import {defHttp} from '/@/utils/http/axios';
|
||||||
|
import { getOption } from 'showdown';
|
||||||
|
|
||||||
// 学科映射
|
// 学科映射
|
||||||
const majorMap = {
|
const majorMap = {
|
||||||
|
@ -10,7 +13,13 @@ const majorMap = {
|
||||||
7: '历史',
|
7: '历史',
|
||||||
8: '政治',
|
8: '政治',
|
||||||
};
|
};
|
||||||
|
const groupOptions=ref()
|
||||||
|
// 创建一个简单的事件总线
|
||||||
|
export const updateGroupOptions = reactive({
|
||||||
|
updateGroupOptions(newOptions: any) {
|
||||||
|
groupOptions.value = newOptions;
|
||||||
|
},
|
||||||
|
});
|
||||||
// 根据 majorId 获取学科名称
|
// 根据 majorId 获取学科名称
|
||||||
const isMajor = (majorId) => {
|
const isMajor = (majorId) => {
|
||||||
return majorMap[majorId] || '未知学科';
|
return majorMap[majorId] || '未知学科';
|
||||||
|
@ -18,9 +27,9 @@ const isMajor = (majorId) => {
|
||||||
|
|
||||||
// 学科过滤方法
|
// 学科过滤方法
|
||||||
const filterMajor = (value, row) => {
|
const filterMajor = (value, row) => {
|
||||||
console.log(value, row); // 打印过滤值和行数据
|
|
||||||
return row === value;
|
return row === value;
|
||||||
};
|
};
|
||||||
|
|
||||||
//列表数据
|
//列表数据
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
|
@ -63,7 +72,16 @@ export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '所属分组',
|
title: '所属分组',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'groupId',
|
customRender: ({ text }) => {
|
||||||
|
if (!groupOptions.value) {
|
||||||
|
return '加载中...'; // 如果未加载,显示加载中
|
||||||
|
}
|
||||||
|
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||||
|
if (group) {
|
||||||
|
return group.label;
|
||||||
|
}
|
||||||
|
return '未知分组';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '是否第一次阅卷',
|
title: '是否第一次阅卷',
|
||||||
|
@ -164,11 +182,14 @@ export const formSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '组id',
|
label: '所属分组',
|
||||||
field: 'groupId',
|
field: 'groupId',
|
||||||
component: 'InputNumber',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
return [{ required: true, message: '请输入组id!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
<a-button
|
<a-button>批量操作
|
||||||
>批量操作
|
|
||||||
<Icon icon="mdi:chevron-down" />
|
<Icon icon="mdi:chevron-down" />
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
|
@ -46,145 +45,161 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="cees-student" setup>
|
<script lang="ts" name="cees-student" setup>
|
||||||
import { ref, reactive, computed, unref } 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 StudentModal from './components/StudentModal.vue';
|
import StudentModal from './components/StudentModal.vue';
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './Student.data';
|
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './Student.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './Student.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getGroup } from './Student.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>({});
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
const queryParam = reactive<any>({});
|
||||||
const userStore = useUserStore();
|
const checkedKeys = ref<Array<string | number>>([]);
|
||||||
//注册model
|
const userStore = useUserStore();
|
||||||
const [registerModal, { openModal }] = useModal();
|
//注册model
|
||||||
//注册table数据
|
const [registerModal, { openModal }] = useModal();
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
//注册table数据
|
||||||
tableProps: {
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
title: '研究生表',
|
tableProps: {
|
||||||
api: list,
|
title: '研究生表',
|
||||||
columns,
|
api: list,
|
||||||
canResize: false,
|
columns,
|
||||||
formConfig: {
|
canResize: false,
|
||||||
//labelWidth: 120,
|
formConfig: {
|
||||||
schemas: searchFormSchema,
|
//labelWidth: 120,
|
||||||
autoSubmitOnEnter: true,
|
schemas: searchFormSchema,
|
||||||
showAdvancedButton: true,
|
autoSubmitOnEnter: true,
|
||||||
fieldMapToNumber: [],
|
showAdvancedButton: true,
|
||||||
fieldMapToTime: [],
|
fieldMapToNumber: [],
|
||||||
},
|
fieldMapToTime: [],
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
exportConfig: {
|
actionColumn: {
|
||||||
name: '研究生表',
|
width: 120,
|
||||||
url: getExportUrl,
|
fixed: 'right',
|
||||||
params: queryParam,
|
|
||||||
},
|
},
|
||||||
importConfig: {
|
beforeFetch: (params) => {
|
||||||
url: getImportUrl,
|
return Object.assign(params, queryParam);
|
||||||
success: handleSuccess,
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: '研究生表',
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
// 在组件加载时获取分组数据
|
||||||
|
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const res = await getGroup();
|
||||||
|
groupOptions.value = res.map((group) => ({
|
||||||
|
label: group.name, // 假设分组名称字段为 name
|
||||||
|
value: group.id, // 假设分组 ID 字段为 id
|
||||||
|
}));
|
||||||
|
updateGroupOptions.updateGroupOptions(groupOptions.value);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分组数据失败:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 高级查询配置
|
||||||
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级查询事件
|
||||||
|
*/
|
||||||
|
function handleSuperQuery(params) {
|
||||||
|
Object.keys(params).map((k) => {
|
||||||
|
queryParam[k] = params[k];
|
||||||
});
|
});
|
||||||
|
reload();
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
}
|
||||||
|
/**
|
||||||
// 高级查询配置
|
* 新增事件
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
*/
|
||||||
|
function handleAdd() {
|
||||||
/**
|
openModal(true, {
|
||||||
* 高级查询事件
|
isUpdate: false,
|
||||||
*/
|
showFooter: true,
|
||||||
function handleSuperQuery(params) {
|
});
|
||||||
Object.keys(params).map((k) => {
|
}
|
||||||
queryParam[k] = params[k];
|
/**
|
||||||
});
|
* 编辑事件
|
||||||
reload();
|
*/
|
||||||
}
|
function handleEdit(record: Recordable) {
|
||||||
/**
|
openModal(true, {
|
||||||
* 新增事件
|
record,
|
||||||
*/
|
isUpdate: true,
|
||||||
function handleAdd() {
|
showFooter: true,
|
||||||
openModal(true, {
|
});
|
||||||
isUpdate: false,
|
}
|
||||||
showFooter: true,
|
/**
|
||||||
});
|
* 详情
|
||||||
}
|
*/
|
||||||
/**
|
function handleDetail(record: Recordable) {
|
||||||
* 编辑事件
|
openModal(true, {
|
||||||
*/
|
record,
|
||||||
function handleEdit(record: Recordable) {
|
isUpdate: true,
|
||||||
openModal(true, {
|
showFooter: false,
|
||||||
record,
|
});
|
||||||
isUpdate: true,
|
}
|
||||||
showFooter: true,
|
/**
|
||||||
});
|
* 删除事件
|
||||||
}
|
*/
|
||||||
/**
|
async function handleDelete(record) {
|
||||||
* 详情
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
*/
|
}
|
||||||
function handleDetail(record: Recordable) {
|
/**
|
||||||
openModal(true, {
|
* 批量删除事件
|
||||||
record,
|
*/
|
||||||
isUpdate: true,
|
async function batchHandleDelete() {
|
||||||
showFooter: false,
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
});
|
}
|
||||||
}
|
/**
|
||||||
/**
|
* 成功回调
|
||||||
* 删除事件
|
*/
|
||||||
*/
|
function handleSuccess() {
|
||||||
async function handleDelete(record) {
|
(selectedRowKeys.value = []) && reload();
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
}
|
||||||
}
|
/**
|
||||||
/**
|
* 操作栏
|
||||||
* 批量删除事件
|
*/
|
||||||
*/
|
function getTableAction(record) {
|
||||||
async function batchHandleDelete() {
|
return [
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
{
|
||||||
}
|
label: '编辑',
|
||||||
/**
|
onClick: handleEdit.bind(null, record),
|
||||||
* 成功回调
|
},
|
||||||
*/
|
];
|
||||||
function handleSuccess() {
|
}
|
||||||
(selectedRowKeys.value = []) && reload();
|
/**
|
||||||
}
|
* 下拉操作栏
|
||||||
/**
|
*/
|
||||||
* 操作栏
|
function getDropDownAction(record) {
|
||||||
*/
|
return [
|
||||||
function getTableAction(record) {
|
{
|
||||||
return [
|
label: '详情',
|
||||||
{
|
onClick: handleDetail.bind(null, record),
|
||||||
label: '编辑',
|
},
|
||||||
onClick: handleEdit.bind(null, record),
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
},
|
},
|
||||||
];
|
},
|
||||||
}
|
];
|
||||||
/**
|
}
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -11,7 +11,14 @@ enum Api {
|
||||||
deleteBatch = '/cees/ceesWaiTeacher/deleteBatch',
|
deleteBatch = '/cees/ceesWaiTeacher/deleteBatch',
|
||||||
importExcel = '/cees/ceesWaiTeacher/importExcel',
|
importExcel = '/cees/ceesWaiTeacher/importExcel',
|
||||||
exportXls = '/cees/ceesWaiTeacher/exportXls',
|
exportXls = '/cees/ceesWaiTeacher/exportXls',
|
||||||
|
updateGroupUser = '/cees/ceesGroup/updateGroupUser',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取分组
|
||||||
|
export const getGroup = () =>
|
||||||
|
defHttp.get({url: '/cees/ceesGroup/list'}).then((res) => {
|
||||||
|
return res.records;
|
||||||
|
});
|
||||||
/**
|
/**
|
||||||
* 导出api
|
* 导出api
|
||||||
* @param params
|
* @param params
|
||||||
|
@ -54,11 +61,22 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新分组中间表
|
||||||
|
export const updateGroupUser = (params) => {
|
||||||
|
return defHttp.post({url: Api.updateGroupUser, params});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
// 更新分组中间表
|
||||||
|
const groupUserParams = {
|
||||||
|
userId: params.userId,
|
||||||
|
groupId: params.groupId
|
||||||
|
}
|
||||||
|
updateGroupUser(groupUserParams);
|
||||||
return defHttp.post({url: url, params});
|
return defHttp.post({url: url, params});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,17 @@ 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';
|
||||||
|
import { ref, onMounted,reactive } from 'vue';
|
||||||
|
|
||||||
|
const groupOptions=ref()
|
||||||
|
|
||||||
|
// 创建一个简单的事件总线
|
||||||
|
export const updateGroupOptions = reactive({
|
||||||
|
updateGroupOptions(newOptions: any) {
|
||||||
|
groupOptions.value = newOptions;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
//列表数据
|
//列表数据
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
|
@ -47,7 +58,14 @@ export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '所属分组',
|
title: '所属分组',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'groupId',
|
//dataIndex: 'groupId',
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
const group = groupOptions.value.find(item => item.value === text.groupId);
|
||||||
|
if (group) {
|
||||||
|
return group.label;
|
||||||
|
}
|
||||||
|
return '未知分组';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '住宿信息',
|
title: '住宿信息',
|
||||||
|
@ -314,9 +332,12 @@ export const formSchema: FormSchema[] = [
|
||||||
{
|
{
|
||||||
label: '所属分组',
|
label: '所属分组',
|
||||||
field: 'groupId',
|
field: 'groupId',
|
||||||
component: 'InputNumber',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
return [{ required: true, message: '请输入组id!' }];
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,13 +82,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="cees-ceesWaiTeacher" setup>
|
<script lang="ts" name="cees-ceesWaiTeacher" setup>
|
||||||
import { ref, reactive, computed, unref } 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 } from './CeesWaiTeacher.data';
|
import { columns, searchFormSchema, superQuerySchema,updateGroupOptions } from './CeesWaiTeacher.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } 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>({});
|
||||||
|
@ -148,6 +148,25 @@ const handleExpand = (expanded, record) => {
|
||||||
};
|
};
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
|
// 在组件加载时获取分组数据
|
||||||
|
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
console.log('组件已加载');
|
||||||
|
try {
|
||||||
|
const res = await getGroup();
|
||||||
|
console.log('获取分组数据成功:', res);
|
||||||
|
groupOptions.value = res.map((group) => ({
|
||||||
|
label: group.name, // 假设分组名称字段为 name
|
||||||
|
value: group.id, // 假设分组 ID 字段为 id
|
||||||
|
}));
|
||||||
|
console.log('分组数据:', groupOptions.value);
|
||||||
|
updateGroupOptions.updateGroupOptions(groupOptions.value)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分组数据失败:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 高级查询配置
|
// 高级查询配置
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue