分组优化
This commit is contained in:
parent
02df9af20b
commit
84a94783ba
|
@ -8,9 +8,9 @@ const { hasPermission } = usePermission();
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '组名',
|
title: '组名',
|
||||||
align:"center",
|
align: 'center',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
width: 150
|
width: 150,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '分组',
|
// title: '分组',
|
||||||
|
@ -36,10 +36,10 @@ export const columns: BasicColumn[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '评卷地点',
|
title: '评卷地点',
|
||||||
align: "center",
|
align: 'center',
|
||||||
dataIndex: 'markingLocation',
|
dataIndex: 'markingLocation',
|
||||||
width: 200
|
width: 200,
|
||||||
}
|
},
|
||||||
// {
|
// {
|
||||||
// title: '专业id',
|
// title: '专业id',
|
||||||
// align:"center",
|
// align:"center",
|
||||||
|
@ -74,7 +74,7 @@ export const searchFormSchema: FormSchema[] = [
|
||||||
label: '评卷地点',
|
label: '评卷地点',
|
||||||
field: 'markingLocation',
|
field: 'markingLocation',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
//表单数据
|
//表单数据
|
||||||
export const formSchema: FormSchema[] = [
|
export const formSchema: FormSchema[] = [
|
||||||
|
@ -83,9 +83,7 @@ export const formSchema: FormSchema[] = [
|
||||||
field: 'name',
|
field: 'name',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
return [
|
return [{ required: true, message: '请输入分组名!' }];
|
||||||
{ required: true, message: '请输入分组名!'},
|
|
||||||
];
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -101,13 +99,15 @@ export const formSchema: FormSchema[] = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
dynamicRules: ({ model, schema }) => {
|
dynamicRules: ({ model, schema }) => {
|
||||||
return [
|
if (!hasPermission('majorId:edit')) {
|
||||||
{ required: true, message: '请选择学科!'},
|
// 没有权限,不添加校验规则
|
||||||
];
|
return [];
|
||||||
|
}
|
||||||
|
return [{ required: true, message: '请选择学科!' }];
|
||||||
},
|
},
|
||||||
show: ({ values }) => {
|
show: ({ values }) => {
|
||||||
return hasPermission('majorId:edit');
|
return hasPermission('majorId:edit');
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '评卷地点',
|
label: '评卷地点',
|
||||||
|
@ -119,14 +119,14 @@ export const formSchema: FormSchema[] = [
|
||||||
label: '',
|
label: '',
|
||||||
field: 'id',
|
field: 'id',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
show: false
|
show: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// 高级查询数据
|
// 高级查询数据
|
||||||
export const superQuerySchema = {
|
export const superQuerySchema = {
|
||||||
name: {title: '组名',order: 0,view: 'text', type: 'string',},
|
name: { title: '组名', order: 0, view: 'text', type: 'string' },
|
||||||
majorId: {title: '专业id',order: 1,view: 'number', type: 'number',},
|
majorId: { title: '专业id', order: 1, view: 'number', type: 'number' },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
<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>
|
||||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</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>
|
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||||
<a-button type="primary" @click="batchHandleDelete" v-if="hasPermission('group:batchDelete')">批量删除
|
<a-button type="primary" @click="batchHandleDelete" v-if="hasPermission('group:batchDelete')">批量删除 </a-button>
|
||||||
</a-button>
|
|
||||||
<!-- 高级查询 -->
|
<!-- 高级查询 -->
|
||||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -20,11 +19,10 @@
|
||||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||||
</template>
|
</template>
|
||||||
<!--字段回显插槽-->
|
<!--字段回显插槽-->
|
||||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
<template #bodyCell="{ column, record, index, text }"> </template>
|
||||||
</template>
|
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<CeesGroupModal @register="registerModal" @success="handleSuccess"></CeesGroupModal>
|
<CeesGroupModal @register="registerModal" @success="handleSuccess" />
|
||||||
<!-- 分组对话框 -->
|
<!-- 分组对话框 -->
|
||||||
<!--<CeesGroupTransferModal v-model:visible="groupDialogVisible" :groupDialogTitle="groupDialogTitle"
|
<!--<CeesGroupTransferModal v-model:visible="groupDialogVisible" :groupDialogTitle="groupDialogTitle"
|
||||||
:groupTitle="groupTitle" :dataSource="transferData" show-search @search="handleSearch" :targetKeys="targetKeys"
|
:groupTitle="groupTitle" :dataSource="transferData" show-search @search="handleSearch" :targetKeys="targetKeys"
|
||||||
|
@ -36,9 +34,9 @@
|
||||||
import { ref, reactive, computed, unref, onMounted } from 'vue';
|
import { ref, reactive, computed, unref, onMounted } from 'vue';
|
||||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { useModal } from '/@/components/Modal';
|
||||||
import CeesGroupTransferModal from './components/CeesGroupTransferModal.vue'
|
import CeesGroupTransferModal from './components/CeesGroupTransferModal.vue';
|
||||||
import { useListPage } from '/@/hooks/system/useListPage'
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
import CeesGroupModal from './components/CeesGroupModal.vue'
|
import CeesGroupModal from './components/CeesGroupModal.vue';
|
||||||
import { columns, searchFormSchema, superQuerySchema } from './CeesGroup.data';
|
import { columns, searchFormSchema, superQuerySchema } from './CeesGroup.data';
|
||||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getRowUser, addGroupMembers, removeGroupMembers } from './CeesGroup.api';
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getRowUser, addGroupMembers, removeGroupMembers } from './CeesGroup.api';
|
||||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
@ -64,37 +62,33 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
schemas: searchFormSchema,
|
schemas: searchFormSchema,
|
||||||
autoSubmitOnEnter: true,
|
autoSubmitOnEnter: true,
|
||||||
showAdvancedButton: true,
|
showAdvancedButton: true,
|
||||||
fieldMapToNumber: [
|
fieldMapToNumber: [],
|
||||||
],
|
fieldMapToTime: [],
|
||||||
fieldMapToTime: [
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 120,
|
width: 120,
|
||||||
fixed: 'right'
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
return Object.assign(params, queryParam);
|
return Object.assign(params, queryParam);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
exportConfig: {
|
exportConfig: {
|
||||||
name: "分组表",
|
name: '分组表',
|
||||||
url: getExportUrl,
|
url: getExportUrl,
|
||||||
params: queryParam,
|
params: queryParam,
|
||||||
},
|
},
|
||||||
importConfig: {
|
importConfig: {
|
||||||
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 superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高级查询事件
|
* 高级查询事件
|
||||||
*/
|
*/
|
||||||
|
@ -190,8 +184,6 @@ function getDropDownAction(record) {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="min-height: 400px">
|
<div style="min-height: 400px">
|
||||||
<BasicForm @register="registerForm"></BasicForm>
|
<BasicForm @register="registerForm" />
|
||||||
<div style="width: 100%; text-align: center" v-if="!formDisabled">
|
<div style="width: 100%; text-align: center" v-if="!formDisabled">
|
||||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,9 +16,9 @@
|
||||||
import { saveOrUpdate } from '../CeesGroup.api';
|
import { saveOrUpdate } from '../CeesGroup.api';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "CeesGroupForm",
|
name: 'CeesGroupForm',
|
||||||
components: {
|
components: {
|
||||||
BasicForm
|
BasicForm,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
formData: propTypes.object.def({}),
|
formData: propTypes.object.def({}),
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
labelWidth: 150,
|
labelWidth: 150,
|
||||||
schemas: getBpmFormSchema(props.formData),
|
schemas: getBpmFormSchema(props.formData),
|
||||||
showActionButtonGroup: false,
|
showActionButtonGroup: false,
|
||||||
baseColProps: {span: 24}
|
baseColProps: { span: 24 },
|
||||||
});
|
});
|
||||||
|
|
||||||
const formDisabled = computed(() => {
|
const formDisabled = computed(() => {
|
||||||
|
@ -44,18 +44,18 @@
|
||||||
async function initFormData() {
|
async function initFormData() {
|
||||||
let params = { id: props.formData.dataId };
|
let params = { id: props.formData.dataId };
|
||||||
const data = await defHttp.get({ url: queryByIdUrl, params });
|
const data = await defHttp.get({ url: queryByIdUrl, params });
|
||||||
formData = {...data}
|
formData = { ...data };
|
||||||
//设置表单的值
|
//设置表单的值
|
||||||
await setFieldsValue(formData);
|
await setFieldsValue(formData);
|
||||||
//默认是禁用
|
//默认是禁用
|
||||||
await setProps({disabled: formDisabled.value})
|
await setProps({ disabled: formDisabled.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitForm() {
|
async function submitForm() {
|
||||||
let data = getFieldsValue();
|
let data = getFieldsValue();
|
||||||
let params = Object.assign({}, formData, data);
|
let params = Object.assign({}, formData, data);
|
||||||
console.log('表单数据', params)
|
console.log('表单数据', params);
|
||||||
await saveOrUpdate(params, true)
|
await saveOrUpdate(params, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
initFormData();
|
initFormData();
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
registerForm,
|
registerForm,
|
||||||
formDisabled,
|
formDisabled,
|
||||||
submitForm,
|
submitForm,
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -18,7 +18,7 @@
|
||||||
//labelWidth: 150,
|
//labelWidth: 150,
|
||||||
schemas: formSchema,
|
schemas: formSchema,
|
||||||
showActionButtonGroup: false,
|
showActionButtonGroup: false,
|
||||||
baseColProps: {span: 24}
|
baseColProps: { span: 24 },
|
||||||
});
|
});
|
||||||
//表单赋值
|
//表单赋值
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 隐藏底部时禁用整个表单
|
// 隐藏底部时禁用整个表单
|
||||||
setProps({ disabled: !data?.showFooter })
|
setProps({ disabled: !data?.showFooter });
|
||||||
});
|
});
|
||||||
//设置标题
|
//设置标题
|
||||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||||
|
@ -57,10 +57,10 @@
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
/** 时间和数字输入框样式 */
|
/** 时间和数字输入框样式 */
|
||||||
:deep(.ant-input-number) {
|
:deep(.ant-input-number) {
|
||||||
width: 100%
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-calendar-picker) {
|
:deep(.ant-calendar-picker) {
|
||||||
width: 100%
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue