优化职级模块

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

View File

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