😎优化报表分组配置相关代码

This commit is contained in:
zuohuaijun 2025-07-07 19:30:08 +08:00
parent 57db9373ae
commit 57b5f03669
2 changed files with 15 additions and 16 deletions

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro", "name": "admin.net.pro",
"type": "module", "type": "module",
"version": "2.4.33", "version": "2.4.33",
"lastBuildTime": "2025.07.05", "lastBuildTime": "2025.07.07",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架", "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun", "author": "zuohuaijun",
"license": "MIT", "license": "MIT",
@ -54,7 +54,7 @@
"md-editor-v3": "^5.7.1", "md-editor-v3": "^5.7.1",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"monaco-editor": "^0.52.2", "monaco-editor": "^0.52.2",
"mqtt": "^5.13.1", "mqtt": "^5.13.2",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"ol": "^10.6.1", "ol": "^10.6.1",
"pinia": "^3.0.3", "pinia": "^3.0.3",
@ -84,7 +84,7 @@
"vue-router": "^4.5.1", "vue-router": "^4.5.1",
"vue-signature-pad": "^3.0.2", "vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2", "vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.6.47", "vxe-pc-ui": "^4.6.48",
"vxe-table": "^4.13.52", "vxe-table": "^4.13.52",
"xe-utils": "^3.7.5", "xe-utils": "^3.7.5",
"xlsx-js-style": "^1.2.0" "xlsx-js-style": "^1.2.0"

View File

@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</template> </template>
<div style="margin-bottom: 45px" v-loading="state.loading"> <div style="margin-bottom: 45px" v-loading="state.isLoading">
<el-scrollbar> <el-scrollbar>
<el-tree <el-tree
v-if="state.treeData" v-if="state.treeData"
@ -79,9 +79,9 @@ const editReportGroup = ref<InstanceType<typeof EditReportGroup>>();
const filterText = ref(''); const filterText = ref('');
const state = reactive({ const state = reactive({
isLoading: false, // isLoading: false, //
title: '', title: '',
treeData: [], treeData: [] as any,
}); });
// //
@ -128,21 +128,21 @@ const filterNode = (value: string, data: any) => {
// //
const handleCommand = async (command: string | number | object) => { const handleCommand = async (command: string | number | object) => {
if ('expandAll' == command) { if ('expandAll' == command) {
// //
for (let i = 0; i < treeRef.value!.store._getAllNodes().length; i++) { for (let i = 0; i < treeRef.value!.store._getAllNodes().length; i++) {
treeRef.value!.store._getAllNodes()[i].expanded = true; treeRef.value!.store._getAllNodes()[i].expanded = true;
} }
} else if ('collapseAll' == command) { } else if ('collapseAll' == command) {
// //
for (let i = 0; i < treeRef.value!.store._getAllNodes().length; i++) { for (let i = 0; i < treeRef.value!.store._getAllNodes().length; i++) {
treeRef.value!.store._getAllNodes()[i].expanded = false; treeRef.value!.store._getAllNodes()[i].expanded = false;
} }
} else if ('create' == command) { } else if ('create' == command) {
// //
state.title = t('新增分组'); state.title = t('新增分组');
editReportGroup.value?.openDialog({}); editReportGroup.value?.openDialog({});
} else if ('edit' == command) { } else if ('edit' == command) {
// //
const currData = treeRef.value!.getCurrentNode(); const currData = treeRef.value!.getCurrentNode();
if (!currData) { if (!currData) {
ElMessage.error(t('请选择分组后编辑')); ElMessage.error(t('请选择分组后编辑'));
@ -155,27 +155,26 @@ const handleCommand = async (command: string | number | object) => {
state.title = t('编辑分组'); state.title = t('编辑分组');
editReportGroup.value?.openDialog(currData); editReportGroup.value?.openDialog(currData);
} else if ('delete' == command) { } else if ('delete' == command) {
// //
const currData = treeRef.value!.getCurrentNode(); const currData = treeRef.value!.getCurrentNode();
if (currData.id == 0) { if (currData?.id == 0) {
ElMessage.error(t('请选择有效的分组节点')); ElMessage.error(t('请选择有效的分组节点'));
return; return;
} }
ElMessageBox.confirm(t('确认删除?', { label: currData.label }), t('提示'), { ElMessageBox.confirm(t('确认删除?', { label: currData?.label }), t('提示'), {
confirmButtonText: t('确定'), confirmButtonText: t('确定'),
cancelButtonText: t('取消'), cancelButtonText: t('取消'),
type: 'warning', type: 'warning',
}).then(() => { }).then(() => {
getAPI(SysReportGroupApi) getAPI(SysReportGroupApi)
.apiSysReportGroupDeletePost({ id: recordId }) .apiSysReportGroupDeletePost({ id: currData?.id })
.then((res) => { .then((res) => {
ElMessage.success(t('删除成功')); ElMessage.success(t('删除成功'));
fetchTreeData(); fetchTreeData();
}); });
}); });
} else if ('refresh' == command) { } else if ('refresh' == command) {
// fetchTreeData(); //
fetchTreeData();
} }
}; };
</script> </script>