Compare commits
2 Commits
6a46bdb45a
...
be44e6195a
Author | SHA1 | Date |
---|---|---|
|
be44e6195a | |
|
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});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,16 @@ const filterMajor = (value, row) => {
|
||||||
console.log(value, row); // 打印过滤值和行数据
|
console.log(value, row); // 打印过滤值和行数据
|
||||||
return row === value;
|
return row === value;
|
||||||
};
|
};
|
||||||
|
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[] = [
|
||||||
{
|
{
|
||||||
|
@ -46,7 +56,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: '是否第一次阅卷',
|
||||||
|
@ -136,10 +153,13 @@ export const formSchema: FormSchema[] = [
|
||||||
{
|
{
|
||||||
label: '所属组',
|
label: '所属组',
|
||||||
field: 'groupId',
|
field: 'groupId',
|
||||||
component: 'InputNumber',
|
component: 'Select',
|
||||||
//dynamicRules: ({ model, schema }) => {
|
componentProps: {
|
||||||
// return [{ required: true, message: '请输入所属分组!' }];
|
options: groupOptions, // 动态设置分组选项
|
||||||
//},
|
},
|
||||||
|
dynamicRules: ({ model, schema }) => {
|
||||||
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
//{
|
//{
|
||||||
// label: '使用次数',
|
// label: '使用次数',
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -45,22 +44,22 @@
|
||||||
</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>({});
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
const checkedKeys = ref<Array<string | number>>([]);
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
//注册model
|
//注册model
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
//注册table数据
|
//注册table数据
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
tableProps: {
|
tableProps: {
|
||||||
title: '本校教师表',
|
title: '本校教师表',
|
||||||
api: list,
|
api: list,
|
||||||
|
@ -91,84 +90,150 @@
|
||||||
url: getImportUrl,
|
url: getImportUrl,
|
||||||
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;
|
||||||
|
|
||||||
// 高级查询配置
|
// 在组件加载时获取分组数据
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
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);
|
||||||
|
|
||||||
|
/**
|
||||||
* 高级查询事件
|
* 高级查询事件
|
||||||
*/
|
*/
|
||||||
function handleSuperQuery(params) {
|
function handleSuperQuery(params) {
|
||||||
Object.keys(params).map((k) => {
|
Object.keys(params).map((k) => {
|
||||||
queryParam[k] = params[k];
|
queryParam[k] = params[k];
|
||||||
});
|
});
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增事件
|
* 新增事件
|
||||||
*/
|
*/
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 编辑事件
|
* 编辑事件
|
||||||
*/
|
*/
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
function handleDetail(record: Recordable) {
|
function handleDetail(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除事件
|
* 删除事件
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
async function handleDelete(record) {
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除事件
|
* 批量删除事件
|
||||||
*/
|
*/
|
||||||
async function batchHandleDelete() {
|
async function batchHandleDelete() {
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
(selectedRowKeys.value = []) && reload();
|
(selectedRowKeys.value = []) && reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 操作栏
|
* 操作栏
|
||||||
*/
|
*/
|
||||||
function getTableAction(record) {
|
function getTableAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record),
|
onClick: handleEdit.bind(null, record),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 下拉操作栏
|
* 下拉操作栏
|
||||||
*/
|
*/
|
||||||
function getDropDownAction(record) {
|
function getDropDownAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '详情',
|
label: '详情',
|
||||||
|
@ -183,7 +248,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -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: '是否第一次阅卷',
|
||||||
|
@ -173,7 +191,17 @@ export const formSchema: FormSchema[] = [
|
||||||
// return [{ required: true, message: '请选择是否第一次阅卷!' }];
|
// return [{ required: true, message: '请选择是否第一次阅卷!' }];
|
||||||
//},
|
//},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '所属分组',
|
||||||
|
field: 'groupId',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
|
dynamicRules: ({ model, schema }) => {
|
||||||
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
|
},
|
||||||
|
},
|
||||||
//{
|
//{
|
||||||
// label: '使用次数',
|
// label: '使用次数',
|
||||||
// field: 'numberuse',
|
// field: 'numberuse',
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -49,22 +48,23 @@
|
||||||
</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数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
tableProps: {
|
tableProps: {
|
||||||
title: '研究生表',
|
title: '研究生表',
|
||||||
api: list,
|
api: list,
|
||||||
|
@ -95,84 +95,99 @@
|
||||||
url: getImportUrl,
|
url: getImportUrl,
|
||||||
success: handleSuccess,
|
success: handleSuccess,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
// 高级查询配置
|
// 在组件加载时获取分组数据
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
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) {
|
function handleSuperQuery(params) {
|
||||||
Object.keys(params).map((k) => {
|
Object.keys(params).map((k) => {
|
||||||
queryParam[k] = params[k];
|
queryParam[k] = params[k];
|
||||||
});
|
});
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增事件
|
* 新增事件
|
||||||
*/
|
*/
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 编辑事件
|
* 编辑事件
|
||||||
*/
|
*/
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
function handleDetail(record: Recordable) {
|
function handleDetail(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除事件
|
* 删除事件
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
async function handleDelete(record) {
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除事件
|
* 批量删除事件
|
||||||
*/
|
*/
|
||||||
async function batchHandleDelete() {
|
async function batchHandleDelete() {
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
(selectedRowKeys.value = []) && reload();
|
(selectedRowKeys.value = []) && reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 操作栏
|
* 操作栏
|
||||||
*/
|
*/
|
||||||
function getTableAction(record) {
|
function getTableAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record),
|
onClick: handleEdit.bind(null, record),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 下拉操作栏
|
* 下拉操作栏
|
||||||
*/
|
*/
|
||||||
function getDropDownAction(record) {
|
function getDropDownAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '详情',
|
label: '详情',
|
||||||
|
@ -187,7 +202,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</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});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,17 @@ const filterMajor = (value, row) => {
|
||||||
console.log(value, row); // 打印过滤值和行数据
|
console.log(value, row); // 打印过滤值和行数据
|
||||||
return row === value;
|
return row === value;
|
||||||
};
|
};
|
||||||
|
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[] = [
|
||||||
{
|
{
|
||||||
|
@ -62,7 +73,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: '住宿信息',
|
||||||
|
@ -311,6 +329,17 @@ export const formSchema: FormSchema[] = [
|
||||||
// return [{ required: true, message: '请输入是否住宿!' }];
|
// return [{ required: true, message: '请输入是否住宿!' }];
|
||||||
//},
|
//},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '所属分组',
|
||||||
|
field: 'groupId',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
options: groupOptions, // 动态设置分组选项
|
||||||
|
},
|
||||||
|
dynamicRules: ({ model, schema }) => {
|
||||||
|
return [{ required: true, message: '请选择分组!' }];
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '车辆是否入校',
|
label: '车辆是否入校',
|
||||||
field: 'carStatus',
|
field: 'carStatus',
|
||||||
|
@ -321,10 +350,11 @@ 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: '住宿信息',
|
||||||
// field: 'dormitory',
|
// field: 'dormitory',
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!--引用表格-->
|
<!--引用表格-->
|
||||||
<BasicTable
|
<BasicTable @register="registerTable" :rowSelection="rowSelection" ref="tableRef" :expandedRowKeys="expandedKeys"
|
||||||
@register="registerTable"
|
rowKey="id" :expandedRowRender="renderExpandedRow" @expand="handleExpand">
|
||||||
:rowSelection="rowSelection"
|
|
||||||
ref="tableRef"
|
|
||||||
:expandedRowKeys="expandedKeys"
|
|
||||||
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,8 +17,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>
|
||||||
|
@ -65,22 +57,22 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" name="cees-ceesWaiTeacher" setup>
|
<script lang="tsx" 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>({});
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
const checkedKeys = ref<Array<string | number>>([]);
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
//注册model
|
//注册model
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
//注册table数据
|
//注册table数据
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
tableProps: {
|
tableProps: {
|
||||||
title: '外校老师管理',
|
title: '外校老师管理',
|
||||||
api: list,
|
api: list,
|
||||||
|
@ -111,27 +103,27 @@
|
||||||
url: getImportUrl,
|
url: getImportUrl,
|
||||||
success: handleSuccess,
|
success: handleSuccess,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 指定默认展开的行(根据 rowKey 属性传入行的 key 值)
|
// 指定默认展开的行(根据 rowKey 属性传入行的 key 值)
|
||||||
const expandedKeys = ref<string[]>(['1']); // 默认展开第一行
|
const expandedKeys = ref<string[]>(['1']); // 默认展开第一行
|
||||||
// 定义展开行内容的渲染函数
|
// 定义展开行内容的渲染函数
|
||||||
const renderExpandedRow = (record: Record<string, any>) => {
|
const renderExpandedRow = (record: Record<string, any>) => {
|
||||||
return (
|
return (
|
||||||
<a-descriptions column={2}>
|
<a-descriptions column = { 2} >
|
||||||
<a-descriptions-item label="身份证号">{record.record.identityId}</a-descriptions-item>
|
<a-descriptions - item label = "身份证号" > { record.record.identityId } </a-descriptions-item>
|
||||||
<a-descriptions-item label="银行卡号">{record.record.pyCard}</a-descriptions-item>
|
< a - descriptions - item label = "银行卡号" > { record.record.pyCard } </a-descriptions-item>
|
||||||
<a-descriptions-item label="工作单位">{record.record.workName}</a-descriptions-item>
|
< a - descriptions - item label = "工作单位" > { record.record.workName } </a-descriptions-item>
|
||||||
<a-descriptions-item label="开户所在地">{record.record.bankAddress}</a-descriptions-item>
|
< 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.workPhone } </a-descriptions-item>
|
||||||
<a-descriptions-item label="开户行">{record.record.bankName}</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.carNumber } </a-descriptions-item>
|
||||||
<a-descriptions-item label="饭卡号">{record.record.mealCard}</a-descriptions-item>
|
< a - descriptions - item label = "饭卡号" > { record.record.mealCard } </a-descriptions-item>
|
||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
// 监听展开/收起事件,更新 expandedKeys
|
// 监听展开/收起事件,更新 expandedKeys
|
||||||
const handleExpand = (expanded: boolean, record: Record<string, any>) => {
|
const handleExpand = (expanded: boolean, record: Record<string, any>) => {
|
||||||
console.log('展开/收起', expanded, record);
|
console.log('展开/收起', expanded, record);
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
if (!expandedKeys.value.includes(record.id)) {
|
if (!expandedKeys.value.includes(record.id)) {
|
||||||
|
@ -140,83 +132,102 @@
|
||||||
} else {
|
} else {
|
||||||
expandedKeys.value = expandedKeys.value.filter((key) => key !== record.id);
|
expandedKeys.value = expandedKeys.value.filter((key) => key !== record.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
|
||||||
// 高级查询配置
|
// 在组件加载时获取分组数据
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
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);
|
||||||
|
|
||||||
|
/**
|
||||||
* 高级查询事件
|
* 高级查询事件
|
||||||
*/
|
*/
|
||||||
function handleSuperQuery(params) {
|
function handleSuperQuery(params) {
|
||||||
Object.keys(params).map((k) => {
|
Object.keys(params).map((k) => {
|
||||||
queryParam[k] = params[k];
|
queryParam[k] = params[k];
|
||||||
});
|
});
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新增事件
|
* 新增事件
|
||||||
*/
|
*/
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 编辑事件
|
* 编辑事件
|
||||||
*/
|
*/
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
*/
|
*/
|
||||||
function handleDetail(record: Recordable) {
|
function handleDetail(record: Recordable) {
|
||||||
openModal(true, {
|
openModal(true, {
|
||||||
record,
|
record,
|
||||||
isUpdate: true,
|
isUpdate: true,
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除事件
|
* 删除事件
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
async function handleDelete(record) {
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除事件
|
* 批量删除事件
|
||||||
*/
|
*/
|
||||||
async function batchHandleDelete() {
|
async function batchHandleDelete() {
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
*/
|
*/
|
||||||
function handleSuccess() {
|
function handleSuccess() {
|
||||||
(selectedRowKeys.value = []) && reload();
|
(selectedRowKeys.value = []) && reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 操作栏
|
* 操作栏
|
||||||
*/
|
*/
|
||||||
function getTableAction(record) {
|
function getTableAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record),
|
onClick: handleEdit.bind(null, record),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 下拉操作栏
|
* 下拉操作栏
|
||||||
*/
|
*/
|
||||||
function getDropDownAction(record) {
|
function getDropDownAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: '详情',
|
label: '详情',
|
||||||
|
@ -231,7 +242,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Reference in New Issue