优化职级模块

This commit is contained in:
zjl 2024-12-11 15:06:40 +08:00
parent 21bee63340
commit c273262589
2 changed files with 44 additions and 10 deletions

View File

@ -69,11 +69,16 @@
default: 0, default: 0,
}, },
}); });
/**
* 定义模态
*/
const [modalRegister, { openModal, setSubLoading }] = useModal({ const [modalRegister, { openModal, setSubLoading }] = useModal({
title: props.levelId ? '编辑职级' : '添加职级', title: props.levelId ? '编辑职级' : '添加职级',
subBtuText: '确定', subBtuText: '确定',
width: 600, width: 600,
}); });
/** /**
* 执行提交 * 执行提交
*/ */
@ -88,6 +93,7 @@
emit('success'); emit('success');
}) })
.catch((error) => { .catch((error) => {
console.log(error);
setSubLoading(false); setSubLoading(false);
}); });
}; };
@ -120,7 +126,10 @@
setFormData(); setFormData();
} }
}); });
//
/**
* 定义
*/
defineExpose({ defineExpose({
openModal, openModal,
}); });

View File

@ -27,7 +27,6 @@
</template> </template>
新建 新建
</n-button> </n-button>
<n-button <n-button
type="error" type="error"
@click="handleDelete" @click="handleDelete"
@ -92,10 +91,8 @@
ToTopOutlined, ToTopOutlined,
FormOutlined, FormOutlined,
} from '@vicons/antd'; } from '@vicons/antd';
import CreateModal from './CreateModal.vue';
import editDialog from './edit.vue'; import editDialog from './edit.vue';
import userUpload from './userUpload.vue'; import userUpload from './userUpload.vue';
import { basicModal, useModal } from '@/components/Modal';
import { schemas } from './querySchemas'; import { schemas } from './querySchemas';
import { renderIcon } from '@/utils'; import { renderIcon } from '@/utils';
@ -108,15 +105,21 @@
const rowKeys = ref([]); const rowKeys = ref([]);
const importVisible = ref(false); const importVisible = ref(false);
const exportLoading = ref(false); const exportLoading = ref(false);
const showModal = ref(false); const showModal = ref(false);
/**
* 定义查询参数
*/
const formParams = reactive({ const formParams = reactive({
name: '', name: '',
status: '', status: '',
}); });
/**
* 定义操作栏
*/
const actionColumn = reactive({ const actionColumn = reactive({
width: 400, width: 200,
title: '操作', title: '操作',
align: 'center', align: 'center',
key: 'action', key: 'action',
@ -144,24 +147,36 @@
}, },
}); });
function addTable() { /**
showModal.value = true; * 加载数据列表
} * @param res 参数
*/
const loadDataTable = async (res) => { const loadDataTable = async (res) => {
rowKeys.value = []; rowKeys.value = [];
const result = await getLevelList({ ...formParams, ...res }); const result = await getLevelList({ ...formParams, ...res });
return result; return result;
}; };
/**
* 数据行选中事件
* @param keys 参数
*/
function onCheckedRow(keys) { function onCheckedRow(keys) {
rowKeys.value = keys; rowKeys.value = keys;
} }
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') { function reloadTable(noRefresh = '') {
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
} }
/**
* 执行提交表单
* @param values 参数
*/
function handleSubmit(values: Recordable) { function handleSubmit(values: Recordable) {
for (const key in formParams) { for (const key in formParams) {
formParams[key] = ''; formParams[key] = '';
@ -172,6 +187,10 @@
reloadTable(); reloadTable();
} }
/**
* 执行重置
* @param values 参数
*/
function handleReset(values: Recordable) { function handleReset(values: Recordable) {
for (const key in formParams) { for (const key in formParams) {
formParams[key] = ''; formParams[key] = '';
@ -182,6 +201,9 @@
reloadTable(); reloadTable();
} }
/**
* 执行注册
*/
const [register, {}] = useForm({ const [register, {}] = useForm({
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
labelWidth: 80, labelWidth: 80,
@ -197,6 +219,7 @@
await nextTick(); await nextTick();
createModalRef.value.openModal(); createModalRef.value.openModal();
}; };
/** /**
* 执行编辑 * 执行编辑
*/ */
@ -206,6 +229,7 @@
await nextTick(); await nextTick();
createModalRef.value.openModal(); createModalRef.value.openModal();
} }
/** /**
* 执行删除 * 执行删除
* @param id 参数 * @param id 参数
@ -223,6 +247,7 @@
}, },
}); });
} }
/** /**
* 执行导出 * 执行导出
*/ */