优化代码

This commit is contained in:
RuoYi
2024-06-28 17:01:39 +08:00
parent 49d0fc0bdc
commit 6666ce5526
26 changed files with 253 additions and 8 deletions

View File

@@ -215,11 +215,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@@ -231,29 +233,34 @@ function reset() {
};
proxy.resetForm("dictRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加字典类型";
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.dictId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@@ -264,6 +271,7 @@ function handleUpdate(row) {
title.value = "修改字典类型";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["dictRef"].validate(valid => {
@@ -284,6 +292,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const dictIds = row.dictId || ids.value;
@@ -294,12 +303,14 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/dict/type/export", {
...queryParams.value
}, `dict_${new Date().getTime()}.xlsx`);
}
/** 刷新缓存按钮操作 */
function handleRefreshCache() {
refreshCache().then(() => {