分组优化

This commit is contained in:
Qi 2025-06-09 22:54:03 +08:00
parent 02df9af20b
commit 84a94783ba
4 changed files with 296 additions and 304 deletions

View File

@ -8,9 +8,9 @@ const { hasPermission } = usePermission();
export const columns: BasicColumn[] = [
{
title: '组名',
align:"center",
align: 'center',
dataIndex: 'name',
width: 150
width: 150,
},
// {
// title: '分组',
@ -36,10 +36,10 @@ export const columns: BasicColumn[] = [
},
{
title: '评卷地点',
align: "center",
align: 'center',
dataIndex: 'markingLocation',
width: 200
}
width: 200,
},
// {
// title: '专业id',
// align:"center",
@ -74,7 +74,7 @@ export const searchFormSchema: FormSchema[] = [
label: '评卷地点',
field: 'markingLocation',
component: 'Input',
}
},
];
//表单数据
export const formSchema: FormSchema[] = [
@ -83,9 +83,7 @@ export const formSchema: FormSchema[] = [
field: 'name',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [
{ required: true, message: '请输入分组名!'},
];
return [{ required: true, message: '请输入分组名!' }];
},
},
{
@ -101,13 +99,15 @@ export const formSchema: FormSchema[] = [
],
},
dynamicRules: ({ model, schema }) => {
return [
{ required: true, message: '请选择学科!'},
];
if (!hasPermission('majorId:edit')) {
// 没有权限,不添加校验规则
return [];
}
return [{ required: true, message: '请选择学科!' }];
},
show: ({ values }) => {
return hasPermission('majorId:edit');
}
},
},
{
label: '评卷地点',
@ -119,14 +119,14 @@ export const formSchema: FormSchema[] = [
label: '',
field: 'id',
component: 'Input',
show: false
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
name: {title: '组名',order: 0,view: 'text', type: 'string',},
majorId: {title: '专业id',order: 1,view: 'number', type: 'number',},
name: { title: '组名', order: 0, view: 'text', type: 'string' },
majorId: { title: '专业id', order: 1, view: 'number', type: 'number' },
};
/**

View File

@ -7,8 +7,7 @@
<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-button type="primary" @click="batchHandleDelete" v-if="hasPermission('group:batchDelete')">批量删除
</a-button>
<a-button type="primary" @click="batchHandleDelete" v-if="hasPermission('group:batchDelete')">批量删除 </a-button>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
@ -20,11 +19,10 @@
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<!--字段回显插槽-->
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
<template #bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<!-- 表单区域 -->
<CeesGroupModal @register="registerModal" @success="handleSuccess"></CeesGroupModal>
<CeesGroupModal @register="registerModal" @success="handleSuccess" />
<!-- 分组对话框 -->
<!--<CeesGroupTransferModal v-model:visible="groupDialogVisible" :groupDialogTitle="groupDialogTitle"
:groupTitle="groupTitle" :dataSource="transferData" show-search @search="handleSearch" :targetKeys="targetKeys"
@ -36,9 +34,9 @@
import { ref, reactive, computed, unref, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import CeesGroupTransferModal from './components/CeesGroupTransferModal.vue'
import { useListPage } from '/@/hooks/system/useListPage'
import CeesGroupModal from './components/CeesGroupModal.vue'
import CeesGroupTransferModal from './components/CeesGroupTransferModal.vue';
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, addGroupMembers, removeGroupMembers } from './CeesGroup.api';
import { downloadFile } from '/@/utils/common/renderUtils';
@ -64,37 +62,33 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [
],
fieldMapToTime: [
],
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right'
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "分组表",
name: '分组表',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
success: handleSuccess,
},
})
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
@ -190,8 +184,6 @@ function getDropDownAction(record) {
},
];
}
</script>
<style scoped></style>

View File

@ -1,6 +1,6 @@
<template>
<div style="min-height: 400px">
<BasicForm @register="registerForm"></BasicForm>
<BasicForm @register="registerForm" />
<div style="width: 100%; text-align: center" v-if="!formDisabled">
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary"> </a-button>
</div>
@ -16,9 +16,9 @@
import { saveOrUpdate } from '../CeesGroup.api';
export default defineComponent({
name: "CeesGroupForm",
name: 'CeesGroupForm',
components: {
BasicForm
BasicForm,
},
props: {
formData: propTypes.object.def({}),
@ -29,7 +29,7 @@
labelWidth: 150,
schemas: getBpmFormSchema(props.formData),
showActionButtonGroup: false,
baseColProps: {span: 24}
baseColProps: { span: 24 },
});
const formDisabled = computed(() => {
@ -44,18 +44,18 @@
async function initFormData() {
let params = { id: props.formData.dataId };
const data = await defHttp.get({ url: queryByIdUrl, params });
formData = {...data}
formData = { ...data };
//
await setFieldsValue(formData);
//
await setProps({disabled: formDisabled.value})
await setProps({ disabled: formDisabled.value });
}
async function submitForm() {
let data = getFieldsValue();
let params = Object.assign({}, formData, data);
console.log('表单数据', params)
await saveOrUpdate(params, true)
console.log('表单数据', params);
await saveOrUpdate(params, true);
}
initFormData();
@ -64,7 +64,7 @@
registerForm,
formDisabled,
submitForm,
}
}
};
},
});
</script>

View File

@ -18,7 +18,7 @@
//labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: 24}
baseColProps: { span: 24 },
});
//
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
@ -33,7 +33,7 @@
});
}
//
setProps({ disabled: !data?.showFooter })
setProps({ disabled: !data?.showFooter });
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
@ -57,10 +57,10 @@
<style lang="less" scoped>
/** 时间和数字输入框样式 */
:deep(.ant-input-number) {
width: 100%
width: 100%;
}
:deep(.ant-calendar-picker) {
width: 100%
width: 100%;
}
</style>