feat: 报表配置增加发布到菜单功能

This commit is contained in:
写意 2025-07-02 15:36:52 +08:00
parent f9e30dfbe7
commit ebb821a359
2 changed files with 60 additions and 17 deletions

View File

@ -55,6 +55,7 @@
</el-tooltip> </el-tooltip>
<el-button icon="ele-CopyDocument" size="small" text type="primary" @click="copy(row)"> {{ $t('复制') }} </el-button> <el-button icon="ele-CopyDocument" size="small" text type="primary" @click="copy(row)"> {{ $t('复制') }} </el-button>
<el-button icon="ele-ScaleToOriginal" size="small" text type="primary" @click="preview(row)"> {{ $t('预览') }} </el-button> <el-button icon="ele-ScaleToOriginal" size="small" text type="primary" @click="preview(row)"> {{ $t('预览') }} </el-button>
<el-button size="small" text type="primary" @click="publicToMenu(row)"> {{ $t('发布到菜单') }} </el-button>
</template> </template>
</vxe-grid> </vxe-grid>
</el-card> </el-card>
@ -62,6 +63,7 @@
</splitpanes> </splitpanes>
<EditReportConfig ref="editRef" :title="state.title" @handleQuery="handleQuery" /> <EditReportConfig ref="editRef" :title="state.title" @handleQuery="handleQuery" />
<EditMenu ref="editMenuRef" :title="state.title" :menuData="state.menuData" @handleQuery="handleEditMenuQuery" />
</div> </div>
</template> </template>
@ -79,11 +81,12 @@ import { auth } from '/@/utils/authFunction';
import ReportGroupPanel from './component/reportGroupPanel/index.vue'; import ReportGroupPanel from './component/reportGroupPanel/index.vue';
import EditReportConfig from '/@/views/system/reportConfig/component/editReportConfig.vue'; import EditReportConfig from '/@/views/system/reportConfig/component/editReportConfig.vue';
import EditMenu from '/@/views/system/menu/component/editMenu.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue'; import ModifyRecord from '/@/components/table/modifyRecord.vue';
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { SysReportConfigApi, SysReportDataSourceApi } from '/@/api-services/api'; import { SysMenuApi, SysReportConfigApi, SysReportDataSourceApi } from '/@/api-services/api';
import { PageReportConfigInput, ReportConfigDsTypeEnum, ReportConfigOutput, ReportDataSourceOutput, SysReportGroup } from '/@/api-services/models'; import { MenuTypeEnum, PageReportConfigInput, ReportConfigDsTypeEnum, ReportConfigOutput, ReportDataSourceOutput, StatusEnum, SysMenu, SysReportGroup } from '/@/api-services/models';
const { t } = useI18n(); const { t } = useI18n();
@ -91,6 +94,7 @@ const router = useRouter();
const xGrid = ref<VxeGridInstance>(); const xGrid = ref<VxeGridInstance>();
const editRef = ref<InstanceType<typeof EditReportConfig>>(); const editRef = ref<InstanceType<typeof EditReportConfig>>();
const editMenuRef = ref<InstanceType<typeof EditMenu>>();
const state = reactive({ const state = reactive({
queryParams: { queryParams: {
name: undefined, name: undefined,
@ -104,6 +108,8 @@ const state = reactive({
selectedGroupId: 0, selectedGroupId: 0,
/** 数据源列表数据 */ /** 数据源列表数据 */
dataSourceList: [] as ReportDataSourceOutput[], dataSourceList: [] as ReportDataSourceOutput[],
/** 菜单树数据 */
menuData: [] as Array<SysMenu>,
}); });
// //
@ -114,14 +120,14 @@ const options = useVxeTable<ReportConfigOutput>(
id: 'sysReportConfig', id: 'sysReportConfig',
name: '报表数据源', name: '报表数据源',
columns: [ columns: [
{ field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' }, { field: 'seq', type: 'seq', title: t('序号'), width: 60, fixed: 'left' },
{ field: 'name', title: '名称', minWidth: 200, showOverflow: 'tooltip' }, { field: 'name', title: t('名称'), minWidth: 200, showOverflow: 'tooltip' },
{ field: 'dsType', title: '数据源类型', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_dsType' } }, { field: 'dsType', title: t('数据源类型'), minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_dsType' } },
{ field: 'dataSource', title: '数据源', showOverflow: 'tooltip', slots: { default: 'row_dataSource' } }, { field: 'dataSource', title: t('数据源'), showOverflow: 'tooltip', slots: { default: 'row_dataSource' } },
{ field: 'groupName', title: '分组名称', showOverflow: 'tooltip' }, { field: 'groupName', title: t('分组名称'), showOverflow: 'tooltip' },
{ field: 'record', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } }, { field: 'record', title: t('修改记录'), width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
{ field: 'buttons', title: '操作', fixed: 'right', width: 200, showOverflow: true, slots: { default: 'row_buttons' } }, { field: 'buttons', title: t('操作'), fixed: 'right', width: 300, showOverflow: true, slots: { default: 'row_buttons' } },
], ],
}, },
// vxeGrid()vxe-table // vxeGrid()vxe-table
@ -212,7 +218,7 @@ const gridEvents: VxeGridListeners<ReportConfigOutput> = {
}, },
// //
async cellDblclick({ row }) { async cellDblclick({ row }) {
if (auth('sysReportConfig/update') && row.status !== 1) await handleEdit(row); if (auth('sysReportConfig/update')) await handleEdit(row);
}, },
}; };
@ -238,6 +244,43 @@ const copy = (row: any) => {
const preview = (row: any) => { const preview = (row: any) => {
router.push(`/report/view/${row.id}/${encodeURIComponent(row.name)}`); router.push(`/report/view/${row.id}/${encodeURIComponent(row.name)}`);
}; };
/** 发布到菜单 */
const publicToMenu = async (row: ReportConfigOutput) => {
if (state.menuData.length == 0) {
await loadMenuList();
}
state.title = t('发布到菜单');
editMenuRef.value?.openDialog({
id: 0,
type: MenuTypeEnum.NUMBER_2,
name: '',
title: row.name,
icon: 'ele-Tickets',
path: `/report/view/${row.id}/${row.name}`,
orderNo: 100,
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
status: StatusEnum.NUMBER_1,
} as SysMenu);
};
/** 处理发布菜单后查询 */
const handleEditMenuQuery = () => {
loadMenuList();
};
/** 获取菜单列表 */
const loadMenuList = () => {
return getAPI(SysMenuApi)
.apiSysMenuListGet()
.then((res) => {
state.menuData = res.data.result!;
return res;
});
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -93,14 +93,14 @@ const options = useVxeTable<SysReportDataSource>(
id: 'sysReportDataSource', id: 'sysReportDataSource',
name: '报表数据源', name: '报表数据源',
columns: [ columns: [
{ field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' }, { field: 'seq', type: 'seq', title: t('序号'), width: 60, fixed: 'left' },
{ field: 'name', title: '名称', minWidth: 200, showOverflow: 'tooltip' }, { field: 'name', title: t('名称'), minWidth: 200, showOverflow: 'tooltip' },
{ field: 'dbType', title: '数据库类型', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_dbType' } }, { field: 'dbType', title: t('数据库类型'), minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_dbType' } },
{ field: 'connectionString', title: '连接字符串', minWidth: 400, showOverflow: 'tooltip' }, { field: 'connectionString', title: t('连接字符串'), minWidth: 400, showOverflow: 'tooltip' },
{ field: 'memo', title: '备注', showOverflow: 'tooltip' }, { field: 'memo', title: t('备注'), showOverflow: 'tooltip' },
{ field: 'record', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } }, { field: 'record', title: t('修改记录'), width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
{ field: 'buttons', title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } }, { field: 'buttons', title: t('操作'), fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
], ],
}, },
// vxeGrid()vxe-table // vxeGrid()vxe-table