Compare commits
No commits in common. "d3d5587c58e7c0e537b767aabcfc01517399e76e" and "f1ee6723d0661e23f78318fa7feac70d3c7d27d1" have entirely different histories.
d3d5587c58
...
f1ee6723d0
|
@ -1,64 +0,0 @@
|
||||||
import {defHttp} from '/@/utils/http/axios';
|
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
|
||||||
|
|
||||||
enum Api {
|
|
||||||
list = '/cees/ceesAdminInfo/list',
|
|
||||||
save='/cees/ceesAdminInfo/add',
|
|
||||||
edit='/cees/ceesAdminInfo/edit',
|
|
||||||
deleteOne = '/cees/ceesAdminInfo/delete',
|
|
||||||
deleteBatch = '/cees/ceesAdminInfo/deleteBatch',
|
|
||||||
importExcel = '/cees/ceesAdminInfo/importExcel',
|
|
||||||
exportXls = '/cees/ceesAdminInfo/exportXls',
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 导出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});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除单个
|
|
||||||
*/
|
|
||||||
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});
|
|
||||||
}
|
|
|
@ -1,171 +0,0 @@
|
||||||
import {BasicColumn} from '/@/components/Table';
|
|
||||||
import {FormSchema} from '/@/components/Table';
|
|
||||||
import { rules} from '/@/utils/helper/validator';
|
|
||||||
import { render } from '/@/utils/common/renderUtils';
|
|
||||||
//列表数据
|
|
||||||
export const columns: BasicColumn[] = [
|
|
||||||
{
|
|
||||||
title: '用户名',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'userName'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '工号',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'workNumber'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '往年组别',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'beforeGroupLevel'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '组别',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'groupLevel'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '往年职务',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'beforeDuty'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '职务',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'duty'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '部门',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'department'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '岗位',
|
|
||||||
align:"center",
|
|
||||||
dataIndex: 'job'
|
|
||||||
},
|
|
||||||
|
|
||||||
// {
|
|
||||||
// title: '用户id',
|
|
||||||
// align:"center",
|
|
||||||
// dataIndex: 'userId'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '用户专业id',
|
|
||||||
// align:"center",
|
|
||||||
// dataIndex: 'userMajorId'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '专业id,0表示未选择',
|
|
||||||
// align:"center",
|
|
||||||
// dataIndex: 'majorId'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '组别',
|
|
||||||
// align:"center",
|
|
||||||
// dataIndex: 'groupId'
|
|
||||||
// },
|
|
||||||
];
|
|
||||||
//查询数据
|
|
||||||
export const searchFormSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '用户名',
|
|
||||||
field: 'userName',
|
|
||||||
component: 'Input',
|
|
||||||
//colProps: {span: 6},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
//表单数据
|
|
||||||
export const formSchema: FormSchema[] = [
|
|
||||||
{
|
|
||||||
label: '用户名',
|
|
||||||
field: 'userName',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入用户名!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '工号',
|
|
||||||
field: 'workNumber',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入工号!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '往年组别',
|
|
||||||
field: 'beforeGroupLevel',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '组别',
|
|
||||||
field: 'groupLevel',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入组别!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '往年职务',
|
|
||||||
field: 'beforeDuty',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '职务',
|
|
||||||
field: 'duty',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入职务!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '部门',
|
|
||||||
field: 'department',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入部门!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '岗位',
|
|
||||||
field: 'job',
|
|
||||||
component: 'Input',
|
|
||||||
dynamicRules: ({ model, schema }) => {
|
|
||||||
return [{ required: true, message: '请输入岗位!' }];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// 高级查询数据
|
|
||||||
export const superQuerySchema = {
|
|
||||||
workNumber: {title: '工号',order: 0,view: 'text', type: 'string',},
|
|
||||||
userName: {title: '姓名',order: 1,view: 'text', type: 'string',},
|
|
||||||
userId: {title: '用户id',order: 2,view: 'text', type: 'string',},
|
|
||||||
userMajorId: {title: '用户专业id',order: 3,view: 'text', type: 'string',},
|
|
||||||
majorId: {title: '专业id,0表示未选择',order: 4,view: 'number', type: 'number',},
|
|
||||||
groupId: {title: '组别',order: 5,view: 'text', type: 'string',},
|
|
||||||
beforeGroupLevel: {title: '组级别',order: 6,view: 'text', type: 'string',},
|
|
||||||
groupLevel: {title: '组级别',order: 7,view: 'text', type: 'string',},
|
|
||||||
beforeDuty: {title: '之前的职务',order: 8,view: 'text', type: 'string',},
|
|
||||||
duty: {title: '职务',order: 9,view: 'text', type: 'string',},
|
|
||||||
department: {title: '部门',order: 10,view: 'text', type: 'string',},
|
|
||||||
job: {title: '岗位',order: 11,view: 'text', type: 'string',},
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程表单调用这个方法获取formSchema
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
export function getBpmFormSchema(_formData): FormSchema[]{
|
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
|
||||||
return formSchema;
|
|
||||||
}
|
|
|
@ -1,186 +0,0 @@
|
||||||
<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 #action="{ record }">
|
|
||||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
|
||||||
</template>
|
|
||||||
<!--字段回显插槽-->
|
|
||||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
|
||||||
</template>
|
|
||||||
</BasicTable>
|
|
||||||
<!-- 表单区域 -->
|
|
||||||
<CeesAdminInfoModal @register="registerModal" @success="handleSuccess"></CeesAdminInfoModal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" name="cees-ceesAdminInfo" setup>
|
|
||||||
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 CeesAdminInfoModal from './components/CeesAdminInfoModal.vue'
|
|
||||||
import {columns, searchFormSchema, superQuerySchema} from './CeesAdminInfo.data';
|
|
||||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './CeesAdminInfo.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: 'cees_admin_info',
|
|
||||||
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:"cees_admin_info",
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
|
||||||
|
|
||||||
// 高级查询配置
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 高级查询事件
|
|
||||||
*/
|
|
||||||
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>
|
|
|
@ -1,70 +0,0 @@
|
||||||
<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 '../CeesAdminInfo.data';
|
|
||||||
import {saveOrUpdate} from '../CeesAdminInfo.api';
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "CeesAdminInfoForm",
|
|
||||||
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/ceesAdminInfo/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>
|
|
|
@ -1,66 +0,0 @@
|
||||||
<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 '../CeesAdminInfo.data';
|
|
||||||
import {saveOrUpdate} from '../CeesAdminInfo.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>
|
|
|
@ -16,15 +16,15 @@
|
||||||
</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>
|
||||||
<!-- 高级查询 -->
|
<!-- 高级查询 -->
|
||||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||||
<!-- 新增生成账号按钮 -->
|
<!-- 新增生成账号按钮 -->
|
||||||
<a-button type="primary" @click="showAutoGenerateForm = true" preIcon="ant-design:plus-outlined"> 生成账号
|
<a-button type="primary" @click="showAutoGenerateForm = true" preIcon="ant-design:plus-outlined"> 生成账号 </a-button>
|
||||||
</a-button>
|
|
||||||
</template>
|
</template>
|
||||||
<!--操作栏-->
|
<!--操作栏-->
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
|
@ -49,21 +49,25 @@
|
||||||
<CeesUserModal @register="registerModal" @success="handleSuccess" />
|
<CeesUserModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
|
||||||
<!-- 生成账号表单 -->
|
<!-- 生成账号表单 -->
|
||||||
<a-modal v-model:visible="showAutoGenerateForm" title="生成账号" @ok="handleAutoGenerate"
|
<a-modal
|
||||||
@cancel="showAutoGenerateForm = false" :width="600" :bodyStyle="{ padding: '24px' }">
|
v-model:visible="showAutoGenerateForm"
|
||||||
|
title="生成账号"
|
||||||
|
@ok="handleAutoGenerate"
|
||||||
|
@cancel="showAutoGenerateForm = false"
|
||||||
|
:width="600"
|
||||||
|
:bodyStyle="{ padding: '24px' }"
|
||||||
|
>
|
||||||
<a-form :model="autoGenerateForm" layout="vertical">
|
<a-form :model="autoGenerateForm" layout="vertical">
|
||||||
<a-form-item label="账号类型" class="form-item-custom">
|
<a-form-item label="账号类型" class="form-item-custom">
|
||||||
<a-select v-model="autoGenerateForm.group" placeholder="请选择账号类型" @change="handleGroupChange"
|
<a-select v-model="autoGenerateForm.group" placeholder="请选择账号类型" @change="handleGroupChange" class="select-custom">
|
||||||
class="select-custom">
|
|
||||||
<a-select-option v-for="item in autoGeneratType" :key="item.id" :value="item.value">
|
<a-select-option v-for="item in autoGeneratType" :key="item.id" :value="item.value">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item v-if="isDisplay" label="专业" class="form-item-custom">
|
<a-form-item label="专业" class="form-item-custom">
|
||||||
<a-select v-model="autoGenerateForm.majorId" placeholder="请选择专业" @change="handleMajorChange"
|
<a-select v-model="autoGenerateForm.majorId" placeholder="请选择专业" @change="handleMajorChange" class="select-custom">
|
||||||
class="select-custom">
|
|
||||||
<a-select-option v-for="item in majors" :key="item.id" :value="item.value">
|
<a-select-option v-for="item in majors" :key="item.id" :value="item.value">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
|
@ -71,8 +75,13 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="账号数量" class="form-item-custom">
|
<a-form-item label="账号数量" class="form-item-custom">
|
||||||
<a-input-number v-model="autoGenerateForm.num" :min="1" placeholder="请输入账号数量" @change="handleNumChange"
|
<a-input-number
|
||||||
class="input-number-custom" />
|
v-model="autoGenerateForm.num"
|
||||||
|
:min="1"
|
||||||
|
placeholder="请输入账号数量"
|
||||||
|
@change="handleNumChange"
|
||||||
|
class="input-number-custom"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
@ -80,239 +89,229 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="org.jeecg.modules-ceesUser" setup>
|
<script lang="ts" name="org.jeecg.modules-ceesUser" setup>
|
||||||
import { ref, onMounted, reactive } from 'vue';
|
import { ref, onMounted, reactive } 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 CeesUserModal from './components/CeesUserModal.vue';
|
import CeesUserModal from './components/CeesUserModal.vue';
|
||||||
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesUser.data';
|
import { columns, searchFormSchema, superQuerySchema, updateGroupOptions } from './CeesUser.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate, getGroup, generateAccount } from './CeesUser.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate, getGroup, generateAccount } from './CeesUser.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';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
// 表单相关状态
|
// 表单相关状态
|
||||||
const showAutoGenerateForm = ref(false); // 控制表单显示
|
const showAutoGenerateForm = ref(false); // 控制表单显示
|
||||||
const isDisplay = ref(false);
|
|
||||||
|
|
||||||
const handleGroupChange = (value) => {
|
const handleGroupChange = (value) => {
|
||||||
autoGenerateForm.group = value;
|
autoGenerateForm.group = value;
|
||||||
if (value != 1) {
|
};
|
||||||
isDisplay.value = true;
|
const handleMajorChange = (value) => {
|
||||||
} else {
|
autoGenerateForm.majorId = value;
|
||||||
isDisplay.value = false;
|
};
|
||||||
autoGenerateForm.majorId = undefined;
|
const handleNumChange = (value) => {
|
||||||
}
|
autoGenerateForm.num = value;
|
||||||
};
|
};
|
||||||
const handleMajorChange = (value) => {
|
|
||||||
autoGenerateForm.majorId = value;
|
|
||||||
};
|
|
||||||
const handleNumChange = (value) => {
|
|
||||||
autoGenerateForm.num = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const autoGenerateForm = reactive({
|
const autoGenerateForm = reactive({
|
||||||
group: undefined, // 账号类型
|
group: undefined, // 账号类型
|
||||||
majorId: undefined, // 专业
|
majorId: undefined, // 专业
|
||||||
num: undefined, // 账号数量
|
num: undefined, // 账号数量
|
||||||
});
|
|
||||||
|
|
||||||
// 账号类型选项
|
|
||||||
const autoGeneratType = ref([
|
|
||||||
{ id: 1, name: '行政人员', value: 1 },
|
|
||||||
{ id: 2, name: '研究生', value: 2 },
|
|
||||||
{ id: 2, name: '本校老师', value: 3 },
|
|
||||||
{ id: 3, name: "外校老师", value: 4 }
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 专业选项
|
|
||||||
const majors = ref([
|
|
||||||
{ id: 1, name: '语文', value: 1 },
|
|
||||||
{ id: 2, name: '地理', value: 4 },
|
|
||||||
{ id: 3, name: '历史', value: 7 },
|
|
||||||
{ id: 4, name: '政治', value: 8 },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 生成账号逻辑
|
|
||||||
const handleAutoGenerate = () => {
|
|
||||||
console.log(autoGenerateForm)
|
|
||||||
if (autoGenerateForm.group == undefined) {
|
|
||||||
message.warning('请选择身份', 1.5);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (autoGenerateForm.majorId == undefined && isDisplay.value == true) {
|
|
||||||
message.warning('请选择专业', 1.5);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (autoGenerateForm.num == undefined) {
|
|
||||||
message.warning('请输入账号数量', 1.5);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 账号数量小于500并且大于0
|
|
||||||
if (autoGenerateForm.num <= 0) {
|
|
||||||
message.warning('账号数量必须大于0', 1.5);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (autoGenerateForm.num > 500) {
|
|
||||||
message.warning('账号数量不能大于500', 1.5);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 调用生成账号的 API 或逻辑
|
|
||||||
try {
|
|
||||||
generateAccount(autoGenerateForm).then((res) => {
|
|
||||||
console.log(res)
|
|
||||||
if (res.code == 200) {
|
|
||||||
message.success(res.message, 1.5);
|
|
||||||
//清空表单
|
|
||||||
autoGenerateForm.group = undefined;
|
|
||||||
autoGenerateForm.majorId = undefined;
|
|
||||||
autoGenerateForm.num = undefined;
|
|
||||||
} else {
|
|
||||||
message.error(res.message, 1.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
// 处理失败逻辑
|
|
||||||
message.error('账号生成失败,请重试');
|
|
||||||
} finally {
|
|
||||||
showAutoGenerateForm.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 其他代码保持不变
|
|
||||||
const queryParam = reactive<any>({});
|
|
||||||
const checkedKeys = ref<Array<string | number>>([]);
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const [registerModal, { openModal }] = useModal();
|
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
||||||
tableProps: {
|
|
||||||
title: 'CEES用户表',
|
|
||||||
api: list,
|
|
||||||
columns,
|
|
||||||
canResize: false,
|
|
||||||
formConfig: {
|
|
||||||
schemas: searchFormSchema,
|
|
||||||
autoSubmitOnEnter: true,
|
|
||||||
showAdvancedButton: true,
|
|
||||||
fieldMapToNumber: [],
|
|
||||||
fieldMapToTime: [],
|
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 120,
|
|
||||||
fixed: 'right',
|
|
||||||
},
|
|
||||||
beforeFetch: (params) => {
|
|
||||||
return Object.assign(params, queryParam);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exportConfig: {
|
|
||||||
name: 'CEES用户表',
|
|
||||||
url: getExportUrl,
|
|
||||||
params: queryParam,
|
|
||||||
},
|
|
||||||
importConfig: {
|
|
||||||
url: getImportUrl,
|
|
||||||
success: handleSuccess,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
|
||||||
onMounted(async () => {
|
|
||||||
try {
|
|
||||||
const res = await getGroup();
|
|
||||||
groupOptions.value = res.map((group) => ({
|
|
||||||
label: group.name,
|
|
||||||
value: group.id,
|
|
||||||
}));
|
|
||||||
updateGroupOptions.updateGroupOptions(groupOptions.value);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取分组数据失败:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
||||||
const superQueryConfig = reactive(superQuerySchema);
|
|
||||||
|
|
||||||
function handleSuperQuery(params) {
|
|
||||||
Object.keys(params).map((k) => {
|
|
||||||
queryParam[k] = params[k];
|
|
||||||
});
|
});
|
||||||
reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleAdd() {
|
// 账号类型选项
|
||||||
openModal(true, {
|
const autoGeneratType = ref([
|
||||||
isUpdate: false,
|
{ id: 1, name: '研究生', value: 2 },
|
||||||
showFooter: true,
|
{ id: 2, name: '本校老师', value: 3 },
|
||||||
});
|
{ id: 3, name: '外校老师', value: 4 },
|
||||||
}
|
]);
|
||||||
|
|
||||||
function handleEdit(record: Recordable) {
|
// 专业选项
|
||||||
openModal(true, {
|
const majors = ref([
|
||||||
record,
|
{ id: 1, name: '语文', value: 1 },
|
||||||
isUpdate: true,
|
{ id: 2, name: '地理', value: 4 },
|
||||||
showFooter: true,
|
{ id: 3, name: '历史', value: 7 },
|
||||||
});
|
{ id: 4, name: '政治', value: 8 },
|
||||||
}
|
]);
|
||||||
|
|
||||||
function handleDetail(record: Recordable) {
|
// 生成账号逻辑
|
||||||
openModal(true, {
|
const handleAutoGenerate = () => {
|
||||||
record,
|
console.log(autoGenerateForm);
|
||||||
isUpdate: true,
|
if (autoGenerateForm.group == undefined) {
|
||||||
showFooter: false,
|
message.warning('请选择身份', 1.5);
|
||||||
});
|
return;
|
||||||
}
|
}
|
||||||
|
if (autoGenerateForm.majorId == undefined) {
|
||||||
|
message.warning('请选择专业', 1.5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (autoGenerateForm.num == undefined) {
|
||||||
|
message.warning('请输入账号数量', 1.5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 账号数量小于500并且大于0
|
||||||
|
if (autoGenerateForm.num <= 0) {
|
||||||
|
message.warning('账号数量必须大于0', 1.5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (autoGenerateForm.num > 500) {
|
||||||
|
message.warning('账号数量不能大于500', 1.5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 调用生成账号的 API 或逻辑
|
||||||
|
try {
|
||||||
|
generateAccount(autoGenerateForm).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
message.success('生成账号成功', 1.5);
|
||||||
|
//清空表单
|
||||||
|
autoGenerateForm.group = undefined;
|
||||||
|
autoGenerateForm.majorId = undefined;
|
||||||
|
autoGenerateForm.num = undefined;
|
||||||
|
} else {
|
||||||
|
message.error('生成账号失败', 1.5);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// 处理失败逻辑
|
||||||
|
message.error('账号生成失败,请重试');
|
||||||
|
} finally {
|
||||||
|
showAutoGenerateForm.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
async function handleDelete(record) {
|
// 其他代码保持不变
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
const queryParam = reactive<any>({});
|
||||||
}
|
const checkedKeys = ref<Array<string | number>>([]);
|
||||||
|
const userStore = useUserStore();
|
||||||
async function batchHandleDelete() {
|
const [registerModal, { openModal }] = useModal();
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
}
|
tableProps: {
|
||||||
|
title: 'CEES用户表',
|
||||||
function handleSuccess() {
|
api: list,
|
||||||
(selectedRowKeys.value = []) && reload();
|
columns,
|
||||||
}
|
canResize: false,
|
||||||
|
formConfig: {
|
||||||
function getTableAction(record) {
|
schemas: searchFormSchema,
|
||||||
return [
|
autoSubmitOnEnter: true,
|
||||||
{
|
showAdvancedButton: true,
|
||||||
label: '编辑',
|
fieldMapToNumber: [],
|
||||||
onClick: handleEdit.bind(null, record),
|
fieldMapToTime: [],
|
||||||
},
|
},
|
||||||
];
|
actionColumn: {
|
||||||
}
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
function getDropDownAction(record) {
|
},
|
||||||
return [
|
beforeFetch: (params) => {
|
||||||
{
|
return Object.assign(params, queryParam);
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
exportConfig: {
|
||||||
}
|
name: 'CEES用户表',
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const groupOptions = ref<{ label: string; value: number }[]>([]);
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const res = await getGroup();
|
||||||
|
groupOptions.value = res.map((group) => ({
|
||||||
|
label: group.name,
|
||||||
|
value: group.id,
|
||||||
|
}));
|
||||||
|
updateGroupOptions.updateGroupOptions(groupOptions.value);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分组数据失败:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.form-item-custom {
|
.form-item-custom {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-custom {
|
.select-custom {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-number-custom {
|
.input-number-custom {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue