优化代码

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

@ -110,10 +110,12 @@ function themeChange(val) {
settingsStore.theme = val;
handleThemeStyle(val);
}
function handleTheme(val) {
settingsStore.sideTheme = val;
sideTheme.value = val;
}
function saveSetting() {
proxy.$modal.loading("正在保存到本地,请稍候...");
let layoutSetting = {
@ -128,11 +130,13 @@ function saveSetting() {
localStorage.setItem("layout-setting", JSON.stringify(layoutSetting));
setTimeout(proxy.$modal.closeLoading(), 1000)
}
function resetSetting() {
proxy.$modal.loading("正在清除设置缓存并刷新,请稍候...");
localStorage.removeItem("layout-setting")
setTimeout("window.location.reload()", 1000)
}
function openSetting() {
showSettings.value = true;
}

View File

@ -20,6 +20,7 @@ const scrollWrapper = computed(() => proxy.$refs.scrollContainer.$refs.wrapRef);
onMounted(() => {
scrollWrapper.value.addEventListener('scroll', emitScroll, true)
})
onBeforeUnmount(() => {
scrollWrapper.value.removeEventListener('scroll', emitScroll)
})
@ -29,6 +30,7 @@ function handleScroll(e) {
const $scrollWrapper = scrollWrapper.value;
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
}
const emits = defineEmits()
const emitScroll = () => {
emits('scroll')

View File

@ -67,6 +67,7 @@ watch(route, () => {
addTags()
moveToCurrentTag()
})
watch(visible, (value) => {
if (value) {
document.body.addEventListener('click', closeMenu)
@ -74,6 +75,7 @@ watch(visible, (value) => {
document.body.removeEventListener('click', closeMenu)
}
})
onMounted(() => {
initTags()
addTags()
@ -82,6 +84,7 @@ onMounted(() => {
function isActive(r) {
return r.path === route.path
}
function activeStyle(tag) {
if (!isActive(tag)) return {};
return {
@ -89,9 +92,11 @@ function activeStyle(tag) {
"border-color": theme.value
};
}
function isAffix(tag) {
return tag.meta && tag.meta.affix
}
function isFirstView() {
try {
return selectedTag.value.fullPath === '/index' || selectedTag.value.fullPath === visitedViews.value[1].fullPath
@ -99,6 +104,7 @@ function isFirstView() {
return false
}
}
function isLastView() {
try {
return selectedTag.value.fullPath === visitedViews.value[visitedViews.value.length - 1].fullPath
@ -106,6 +112,7 @@ function isLastView() {
return false
}
}
function filterAffixTags(routes, basePath = '') {
let tags = []
routes.forEach(route => {
@ -127,6 +134,7 @@ function filterAffixTags(routes, basePath = '') {
})
return tags
}
function initTags() {
const res = filterAffixTags(routes.value);
affixTags.value = res;
@ -137,6 +145,7 @@ function initTags() {
}
}
}
function addTags() {
const { name } = route
if (name) {
@ -147,6 +156,7 @@ function addTags() {
}
return false
}
function moveToCurrentTag() {
nextTick(() => {
for (const r of visitedViews.value) {
@ -160,12 +170,14 @@ function moveToCurrentTag() {
}
})
}
function refreshSelectedTag(view) {
proxy.$tab.refreshPage(view);
if (route.meta.link) {
useTagsViewStore().delIframeView(route);
}
}
function closeSelectedTag(view) {
proxy.$tab.closePage(view).then(({ visitedViews }) => {
if (isActive(view)) {
@ -173,6 +185,7 @@ function closeSelectedTag(view) {
}
})
}
function closeRightTags() {
proxy.$tab.closeRightPage(selectedTag.value).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === route.fullPath)) {
@ -180,6 +193,7 @@ function closeRightTags() {
}
})
}
function closeLeftTags() {
proxy.$tab.closeLeftPage(selectedTag.value).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === route.fullPath)) {
@ -187,12 +201,14 @@ function closeLeftTags() {
}
})
}
function closeOthersTags() {
router.push(selectedTag.value).catch(() => { });
proxy.$tab.closeOtherPage(selectedTag.value).then(() => {
moveToCurrentTag()
})
}
function closeAllTags(view) {
proxy.$tab.closeAllPage().then(({ visitedViews }) => {
if (affixTags.value.some(tag => tag.path === route.path)) {
@ -201,6 +217,7 @@ function closeAllTags(view) {
toLastView(visitedViews, view)
})
}
function toLastView(visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
@ -216,6 +233,7 @@ function toLastView(visitedViews, view) {
}
}
}
function openMenu(tag, e) {
const menuMinWidth = 105
const offsetLeft = proxy.$el.getBoundingClientRect().left // container margin left
@ -233,9 +251,11 @@ function openMenu(tag, e) {
visible.value = true
selectedTag.value = tag
}
function closeMenu() {
visible.value = false
}
function handleScroll() {
closeMenu()
}

View File

@ -331,15 +331,18 @@ function getList() {
loading.value = false;
});
}
/** 任务组名字典翻译 */
function jobGroupFormat(row, column) {
return proxy.selectDictLabel(sys_job_group.value, row.jobGroup);
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -354,22 +357,26 @@ function reset() {
};
proxy.resetForm("jobRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.jobId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
//
function handleCommand(command, row) {
switch (command) {
@ -386,6 +393,7 @@ function handleCommand(command, row) {
break;
}
}
//
function handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
@ -397,6 +405,7 @@ function handleStatusChange(row) {
row.status = row.status === "0" ? "1" : "0";
});
}
/* 立即执行一次 */
function handleRun(row) {
proxy.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function () {
@ -405,6 +414,7 @@ function handleRun(row) {
proxy.$modal.msgSuccess("执行成功");})
.catch(() => {});
}
/** 任务详细信息 */
function handleView(row) {
getJob(row.jobId).then(response => {
@ -412,26 +422,31 @@ function handleView(row) {
openView.value = true;
});
}
/** cron表达式按钮操作 */
function handleShowCron() {
expression.value = form.value.cronExpression;
openCron.value = true;
}
/** 确定后回传值 */
function crontabFill(value) {
form.value.cronExpression = value;
}
/** 任务日志列表查询 */
function handleJobLog(row) {
const jobId = row.jobId || 0;
router.push('/monitor/job-log/index/' + jobId)
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加任务";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -442,6 +457,7 @@ function handleUpdate(row) {
title.value = "修改任务";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["jobRef"].validate(valid => {
@ -462,6 +478,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const jobIds = row.jobId || ids.value;
@ -472,6 +489,7 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("monitor/job/export", {

View File

@ -209,32 +209,38 @@ function getList() {
loading.value = false;
});
}
//
function handleClose() {
const obj = { path: "/monitor/job" };
proxy.$tab.closeOpenPage(obj);
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.jobLogId);
multiple.value = !selection.length;
}
/** 详细按钮操作 */
function handleView(row) {
open.value = true;
form.value = row;
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除调度日志编号为"' + ids.value + '"的数据项?').then(function () {
@ -244,6 +250,7 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 清空按钮操作 */
function handleClean() {
proxy.$modal.confirm("是否确认清空所有调度日志数据项?").then(function () {
@ -253,6 +260,7 @@ function handleClean() {
proxy.$modal.msgSuccess("清空成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("monitor/jobLog/export", {

View File

@ -161,11 +161,13 @@ function getList() {
loading.value = false;
});
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
@ -173,6 +175,7 @@ function resetQuery() {
queryParams.value.pageNum = 1;
proxy.$refs["logininforRef"].sort(defaultSort.value.prop, defaultSort.value.order);
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.infoId);
@ -180,12 +183,14 @@ function handleSelectionChange(selection) {
single.value = selection.length != 1;
selectName.value = selection.map(item => item.userName);
}
/** 排序触发事件 */
function handleSortChange(column, prop, order) {
queryParams.value.orderByColumn = column.prop;
queryParams.value.isAsc = column.order;
getList();
}
/** 删除按钮操作 */
function handleDelete(row) {
const infoIds = row.infoId || ids.value;
@ -196,6 +201,7 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 清空按钮操作 */
function handleClean() {
proxy.$modal.confirm("是否确认清空所有登录日志数据项?").then(function () {
@ -205,6 +211,7 @@ function handleClean() {
proxy.$modal.msgSuccess("清空成功");
}).catch(() => {});
}
/** 解锁按钮操作 */
function handleUnlock() {
const username = selectName.value;
@ -214,6 +221,7 @@ function handleUnlock() {
proxy.$modal.msgSuccess("用户" + username + "解锁成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("monitor/logininfor/export", {

View File

@ -82,16 +82,19 @@ function getList() {
loading.value = false;
});
}
/** 搜索按钮操作 */
function handleQuery() {
pageNum.value = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 强退按钮操作 */
function handleForceLogout(row) {
proxy.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function () {

View File

@ -239,15 +239,18 @@ function getList() {
loading.value = false;
});
}
/** 操作日志类型字典翻译 */
function typeFormat(row, column) {
return proxy.selectDictLabel(sys_oper_type.value, row.businessType);
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
@ -255,22 +258,26 @@ function resetQuery() {
queryParams.value.pageNum = 1;
proxy.$refs["operlogRef"].sort(defaultSort.value.prop, defaultSort.value.order);
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.operId);
multiple.value = !selection.length;
}
/** 排序触发事件 */
function handleSortChange(column, prop, order) {
queryParams.value.orderByColumn = column.prop;
queryParams.value.isAsc = column.order;
getList();
}
/** 详细按钮操作 */
function handleView(row) {
open.value = true;
form.value = row;
}
/** 删除按钮操作 */
function handleDelete(row) {
const operIds = row.operId || ids.value;
@ -281,6 +288,7 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 清空按钮操作 */
function handleClean() {
proxy.$modal.confirm("是否确认清空所有操作日志数据项?").then(function () {
@ -290,6 +298,7 @@ function handleClean() {
proxy.$modal.msgSuccess("清空成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("monitor/operlog/export",{

View File

@ -208,11 +208,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -225,29 +227,34 @@ function reset() {
};
proxy.resetForm("configRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.configId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加参数";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -258,6 +265,7 @@ function handleUpdate(row) {
title.value = "修改参数";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["configRef"].validate(valid => {
@ -278,6 +286,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const configIds = row.configId || ids.value;
@ -288,12 +297,14 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/config/export", {
...queryParams.value
}, `config_${new Date().getTime()}.xlsx`);
}
/** 刷新缓存按钮操作 */
function handleRefreshCache() {
refreshCache().then(() => {

View File

@ -180,11 +180,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -199,15 +201,18 @@ function reset() {
};
proxy.resetForm("deptRef");
}
/** 搜索按钮操作 */
function handleQuery() {
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 新增按钮操作 */
function handleAdd(row) {
reset();
@ -220,6 +225,7 @@ function handleAdd(row) {
open.value = true;
title.value = "添加部门";
}
/** 展开/折叠操作 */
function toggleExpandAll() {
refreshTable.value = false;
@ -228,6 +234,7 @@ function toggleExpandAll() {
refreshTable.value = true;
});
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -240,6 +247,7 @@ function handleUpdate(row) {
title.value = "修改部门";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["deptRef"].validate(valid => {
@ -260,6 +268,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {

View File

@ -238,6 +238,7 @@ function getTypeList() {
typeOptions.value = response.data;
});
}
/** 查询字典数据列表 */
function getList() {
loading.value = true;
@ -247,11 +248,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -266,22 +269,26 @@ function reset() {
};
proxy.resetForm("dataRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 返回按钮操作 */
function handleClose() {
const obj = { path: "/system/dict" };
proxy.$tab.closeOpenPage(obj);
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
queryParams.value.dictType = defaultDictType.value;
handleQuery();
}
/** 新增按钮操作 */
function handleAdd() {
reset();
@ -289,12 +296,14 @@ function handleAdd() {
title.value = "添加字典数据";
form.value.dictType = queryParams.value.dictType;
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.dictCode);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -305,6 +314,7 @@ function handleUpdate(row) {
title.value = "修改字典数据";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["dataRef"].validate(valid => {
@ -327,6 +337,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const dictCodes = row.dictCode || ids.value;
@ -338,6 +349,7 @@ function handleDelete(row) {
useDictStore().removeDict(queryParams.value.dictType);
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/dict/data/export", {

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(() => {

View File

@ -316,6 +316,7 @@ function getList() {
loading.value = false;
});
}
/** 查询菜单下拉树结构 */
function getTreeselect() {
menuOptions.value = [];
@ -325,11 +326,13 @@ function getTreeselect() {
menuOptions.value.push(menu);
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -346,23 +349,28 @@ function reset() {
};
proxy.resetForm("menuRef");
}
/** 展示下拉图标 */
function showSelectIcon() {
iconSelectRef.value.reset();
}
/** 选择图标 */
function selected(name) {
form.value.icon = name;
}
/** 搜索按钮操作 */
function handleQuery() {
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 新增按钮操作 */
function handleAdd(row) {
reset();
@ -375,6 +383,7 @@ function handleAdd(row) {
open.value = true;
title.value = "添加菜单";
}
/** 展开/折叠操作 */
function toggleExpandAll() {
refreshTable.value = false;
@ -383,6 +392,7 @@ function toggleExpandAll() {
refreshTable.value = true;
});
}
/** 修改按钮操作 */
async function handleUpdate(row) {
reset();
@ -393,6 +403,7 @@ async function handleUpdate(row) {
title.value = "修改菜单";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["menuRef"].validate(valid => {
@ -413,6 +424,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {

View File

@ -200,11 +200,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -216,28 +218,33 @@ function reset() {
};
proxy.resetForm("noticeRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.noticeId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加公告";
}
/**修改按钮操作 */
function handleUpdate(row) {
reset();
@ -248,6 +255,7 @@ function handleUpdate(row) {
title.value = "修改公告";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["noticeRef"].validate(valid => {
@ -268,6 +276,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const noticeIds = row.noticeId || ids.value

View File

@ -187,11 +187,13 @@ function getList() {
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
@ -204,28 +206,33 @@ function reset() {
};
proxy.resetForm("postRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.postId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加岗位";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -236,6 +243,7 @@ function handleUpdate(row) {
title.value = "修改岗位";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["postRef"].validate(valid => {
@ -256,6 +264,7 @@ function submitForm() {
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const postIds = row.postId || ids.value;
@ -266,6 +275,7 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/post/export", {

View File

@ -123,30 +123,36 @@ function getList() {
loading.value = false;
});
}
//
/** 返回按钮 */
function handleClose() {
const obj = { path: "/system/role" };
proxy.$tab.closeOpenPage(obj);
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
/** 多选框选中数据 */
function handleSelectionChange(selection) {
userIds.value = selection.map(item => item.userId);
multiple.value = !selection.length;
}
/** 打开授权用户表弹窗 */
function openSelectUser() {
proxy.$refs["selectRef"].show();
}
/** 取消授权按钮操作 */
function cancelAuthUser(row) {
proxy.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () {
@ -156,6 +162,7 @@ function cancelAuthUser(row) {
proxy.$modal.msgSuccess("取消授权成功");
}).catch(() => {});
}
/** 批量取消授权按钮操作 */
function cancelAuthUserAll(row) {
const roleId = queryParams.roleId;

View File

@ -305,17 +305,20 @@ function getList() {
loading.value = false;
});
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
/** 删除按钮操作 */
function handleDelete(row) {
const roleIds = row.roleId || ids.value;
@ -326,18 +329,21 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/role/export", {
...queryParams.value,
}, `role_${new Date().getTime()}.xlsx`);
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.roleId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 角色状态修改 */
function handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
@ -349,6 +355,7 @@ function handleStatusChange(row) {
row.status = row.status === "0" ? "1" : "0";
});
}
/** 更多操作 */
function handleCommand(command, row) {
switch (command) {
@ -362,16 +369,19 @@ function handleCommand(command, row) {
break;
}
}
/** 分配用户 */
function handleAuthUser(row) {
router.push("/system/role-auth/user/" + row.roleId);
}
/** 查询菜单树结构 */
function getMenuTreeselect() {
menuTreeselect().then(response => {
menuOptions.value = response.data;
});
}
/** 所有部门节点数据 */
function getDeptAllCheckedKeys() {
//
@ -381,6 +391,7 @@ function getDeptAllCheckedKeys() {
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys;
}
/** 重置新增的表单以及其他数据 */
function reset() {
if (menuRef.value != undefined) {
@ -404,6 +415,7 @@ function reset() {
};
proxy.resetForm("roleRef");
}
/** 添加角色 */
function handleAdd() {
reset();
@ -411,6 +423,7 @@ function handleAdd() {
open.value = true;
title.value = "添加角色";
}
/** 修改角色 */
function handleUpdate(row) {
reset();
@ -433,6 +446,7 @@ function handleUpdate(row) {
title.value = "修改角色";
});
}
/** 根据角色ID查询菜单树结构 */
function getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => {
@ -440,6 +454,7 @@ function getRoleMenuTreeselect(roleId) {
return response;
});
}
/** 根据角色ID查询部门树结构 */
function getDeptTree(roleId) {
return deptTreeSelect(roleId).then(response => {
@ -447,6 +462,7 @@ function getDeptTree(roleId) {
return response;
});
}
/** 树权限(展开/折叠)*/
function handleCheckedTreeExpand(value, type) {
if (type == "menu") {
@ -461,6 +477,7 @@ function handleCheckedTreeExpand(value, type) {
}
}
}
/** 树权限(全选/全不选) */
function handleCheckedTreeNodeAll(value, type) {
if (type == "menu") {
@ -469,6 +486,7 @@ function handleCheckedTreeNodeAll(value, type) {
deptRef.value.setCheckedNodes(value ? deptOptions.value : []);
}
}
/** 树权限(父子联动) */
function handleCheckedTreeConnect(value, type) {
if (type == "menu") {
@ -477,6 +495,7 @@ function handleCheckedTreeConnect(value, type) {
form.value.deptCheckStrictly = value ? true : false;
}
}
/** 所有菜单节点数据 */
function getMenuAllCheckedKeys() {
//
@ -486,6 +505,7 @@ function getMenuAllCheckedKeys() {
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys;
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["roleRef"].validate(valid => {
@ -508,17 +528,20 @@ function submitForm() {
}
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 选择角色权限范围触发 */
function dataScopeSelectChange(value) {
if (value !== "2") {
deptRef.value.setCheckedKeys([]);
}
}
/** 分配数据权限操作 */
function handleDataScope(row) {
reset();
@ -538,6 +561,7 @@ function handleDataScope(row) {
title.value = "分配数据权限";
});
}
/** 提交按钮(数据权限) */
function submitDataScope() {
if (form.value.roleId != undefined) {
@ -549,6 +573,7 @@ function submitDataScope() {
});
}
}
/** 取消按钮(数据权限)*/
function cancelDataScope() {
openDataScope.value = false;

View File

@ -7,7 +7,7 @@
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
style="width: 200px"
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
@ -16,7 +16,7 @@
v-model="queryParams.phonenumber"
placeholder="请输入手机号码"
clearable
style="width: 200px"
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
@ -91,14 +91,17 @@ function show() {
getList();
visible.value = true;
}
/**选择行 */
function clickRow(row) {
proxy.$refs["refTable"].toggleRowSelection(row);
}
//
function handleSelectionChange(selection) {
userIds.value = selection.map(item => item.userId);
}
//
function getList() {
unallocatedUserList(queryParams).then(res => {
@ -106,16 +109,19 @@ function getList() {
total.value = res.total;
});
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
const emit = defineEmits(["ok"]);
/** 选择授权用户操作 */
function handleSelectUser() {
@ -127,10 +133,8 @@ function handleSelectUser() {
}
authUserSelectAll({ roleId: roleId, userIds: uIds }).then(res => {
proxy.$modal.msgSuccess(res.msg);
if (res.code === 200) {
visible.value = false;
emit("ok");
}
});
}

View File

@ -67,19 +67,23 @@ const form = ref({
function clickRow(row) {
proxy.$refs["roleRef"].toggleRowSelection(row);
};
/** 多选框选中数据 */
function handleSelectionChange(selection) {
roleIds.value = selection.map(item => item.roleId);
};
/** 保存选中的数据编号 */
function getRowKey(row) {
return row.roleId;
};
/** 关闭按钮 */
function close() {
const obj = { path: "/system/user" };
proxy.$tab.closeOpenPage(obj);
};
/** 提交按钮 */
function submitForm() {
const userId = form.value.userId;

View File

@ -404,16 +404,19 @@ const filterNode = (value, data) => {
if (!value) return true;
return data.label.indexOf(value) !== -1;
};
/** 根据名称筛选部门树 */
watch(deptName, val => {
proxy.$refs["deptTreeRef"].filter(val);
});
/** 查询部门下拉树结构 */
function getDeptTree() {
deptTreeSelect().then(response => {
deptOptions.value = response.data;
});
};
/** 查询用户列表 */
function getList() {
loading.value = true;
@ -423,16 +426,19 @@ function getList() {
total.value = res.total;
});
};
/** 节点单击事件 */
function handleNodeClick(data) {
queryParams.value.deptId = data.id;
handleQuery();
};
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
@ -441,6 +447,7 @@ function resetQuery() {
proxy.$refs.deptTreeRef.setCurrentKey(null);
handleQuery();
};
/** 删除按钮操作 */
function handleDelete(row) {
const userIds = row.userId || ids.value;
@ -451,12 +458,14 @@ function handleDelete(row) {
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
};
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/user/export", {
...queryParams.value,
},`user_${new Date().getTime()}.xlsx`);
};
/** 用户状态修改 */
function handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
@ -468,6 +477,7 @@ function handleStatusChange(row) {
row.status = row.status === "0" ? "1" : "0";
});
};
/** 更多操作 */
function handleCommand(command, row) {
switch (command) {
@ -481,11 +491,13 @@ function handleCommand(command, row) {
break;
}
};
/** 跳转角色分配 */
function handleAuthRole(row) {
const userId = row.userId;
router.push("/system/user-auth/role/" + userId);
};
/** 重置密码按钮操作 */
function handleResetPwd(row) {
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
@ -505,26 +517,31 @@ function handleResetPwd(row) {
});
}).catch(() => {});
};
/** 选择条数 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.userId);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 导入按钮操作 */
function handleImport() {
upload.title = "用户导入";
upload.open = true;
};
/** 下载模板操作 */
function importTemplate() {
proxy.download("system/user/importTemplate", {
}, `user_template_${new Date().getTime()}.xlsx`);
};
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
upload.open = false;
@ -533,10 +550,12 @@ const handleFileSuccess = (response, file, fileList) => {
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
getList();
};
/** 提交上传文件 */
function submitFileForm() {
proxy.$refs["uploadRef"].submit();
};
/** 重置操作表单 */
function reset() {
form.value = {
@ -555,11 +574,13 @@ function reset() {
};
proxy.resetForm("userRef");
};
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
};
/** 新增按钮操作 */
function handleAdd() {
reset();
@ -571,6 +592,7 @@ function handleAdd() {
form.value.password = initPassword.value;
});
};
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
@ -586,6 +608,7 @@ function handleUpdate(row) {
form.password = "";
});
};
/** 提交按钮 */
function submitForm() {
proxy.$refs["userRef"].validate(valid => {

View File

@ -34,6 +34,7 @@ const equalToPassword = (rule, value, callback) => {
callback();
}
};
const rules = ref({
oldPassword: [{ required: true, message: "旧密码不能为空", trigger: "blur" }],
newPassword: [{ required: true, message: "新密码不能为空", trigger: "blur" }, { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }],
@ -50,6 +51,7 @@ function submit() {
}
});
};
/** 关闭按钮 */
function close() {
proxy.$tab.closePage();

View File

@ -87,25 +87,31 @@ const options = reactive({
function editCropper() {
open.value = true;
}
/** 打开弹出层结束时的回调 */
function modalOpened() {
visible.value = true;
}
/** 覆盖默认上传行为 */
function requestUpload() {}
/** 向左旋转 */
function rotateLeft() {
proxy.$refs.cropper.rotateLeft();
}
/** 向右旋转 */
function rotateRight() {
proxy.$refs.cropper.rotateRight();
}
/** 图片缩放 */
function changeScale(num) {
num = num || 1;
proxy.$refs.cropper.changeScale(num);
}
/** 上传预处理 */
function beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
@ -119,6 +125,7 @@ function beforeUpload(file) {
};
}
}
/** 上传图片 */
function uploadImg() {
proxy.$refs.cropper.getCropBlob(data => {
@ -133,10 +140,12 @@ function uploadImg() {
});
});
}
/** 实时预览 */
function realTime(data) {
options.previews = data;
}
/** 关闭窗口 */
function closeDialog() {
options.img = userStore.avatar;

View File

@ -168,6 +168,7 @@ function submitForm() {
}
});
}
function getFormPromise(form) {
return new Promise(resolve => {
form.validate(res => {
@ -175,6 +176,7 @@ function getFormPromise(form) {
});
});
}
function close() {
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } };
proxy.$tab.closeOpenPage(obj);

View File

@ -258,15 +258,18 @@ const rules = ref({
businessName: [{ required: true, message: "请输入生成业务名", trigger: "blur" }],
functionName: [{ required: true, message: "请输入生成功能名", trigger: "blur" }]
});
function subSelectChange(value) {
props.info.subTableFkName = "";
}
function tplSelectChange(value) {
if (value !== "sub") {
props.info.subTableName = "";
props.info.subTableFkName = "";
}
}
function setSubTableColumns(value) {
for (var item in props.tables) {
const name = props.tables[item].tableName;
@ -276,6 +279,7 @@ function setSubTableColumns(value) {
}
}
}
/** 查询菜单下拉树结构 */
function getMenuTreeselect() {
listMenu().then(response => {

View File

@ -7,6 +7,7 @@
v-model="queryParams.tableName"
placeholder="请输入表名称"
clearable
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
@ -15,6 +16,7 @@
v-model="queryParams.tableComment"
placeholder="请输入表描述"
clearable
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
@ -71,14 +73,17 @@ function show() {
getList();
visible.value = true;
}
/** 单击选择行 */
function clickRow(row) {
proxy.$refs.table.toggleRowSelection(row);
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
tables.value = selection.map(item => item.tableName);
}
/** 查询表数据 */
function getList() {
listDbTable(queryParams).then(res => {
@ -86,16 +91,19 @@ function getList() {
total.value = res.total;
});
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 导入按钮操作 */
function handleImportTable() {
const tableNames = tables.value.join(",");

View File

@ -217,11 +217,13 @@ function getList() {
loading.value = false;
});
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 生成代码操作 */
function handleGenTable(row) {
const tbNames = row.tableName || tableNames.value;
@ -237,6 +239,7 @@ function handleGenTable(row) {
proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip");
}
}
/** 同步数据库操作 */
function handleSynchDb(row) {
const tableName = row.tableName;
@ -246,20 +249,24 @@ function handleSynchDb(row) {
proxy.$modal.msgSuccess("同步成功");
}).catch(() => {});
}
/** 打开导入表弹窗 */
function openImportTable() {
proxy.$refs["importRef"].show();
}
/** 打开创建表弹窗 */
function openCreateTable() {
proxy.$refs["createRef"].show();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
/** 预览按钮 */
function handlePreview(row) {
previewTable(row.tableId).then(response => {
@ -268,10 +275,12 @@ function handlePreview(row) {
preview.value.activeName = "domain.java";
});
}
/** 复制代码成功 */
function copyTextSuccess() {
proxy.$modal.msgSuccess("复制成功");
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.tableId);
@ -279,11 +288,13 @@ function handleSelectionChange(selection) {
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 修改按钮操作 */
function handleEditTable(row) {
const tableId = row.tableId || ids.value[0];
router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } });
}
/** 删除按钮操作 */
function handleDelete(row) {
const tableIds = row.tableId || ids.value;