初始版本提交
This commit is contained in:
129
src/views/report/design/index.vue
Normal file
129
src/views/report/design/index.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<PageWrapper dense fixed-height contentFullHeight>
|
||||
<BasicTable @register="registerTable" v-if="!showFrame">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate" v-auth="'report-design:add'">
|
||||
{{ t('新增报表') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
icon: 'clarity:note-edit-line',
|
||||
auth: 'report-design:edit',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
icon: 'ant-design:delete-outlined',
|
||||
auth: 'report-design:delete',
|
||||
color: 'error',
|
||||
popConfirm: {
|
||||
title: t('是否确认删除'),
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<FramePage v-if="showFrame" :frameSrc="frameSrc" />
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table';
|
||||
import { getReportPageList, deleteReport } from '/@/api/system/report';
|
||||
import FramePage from '/@/views/sys/iframe/index.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
const { t } = useI18n();
|
||||
const columns: BasicColumn[] = [
|
||||
{
|
||||
title: t('文件名'),
|
||||
dataIndex: 'name',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('创建时间'),
|
||||
dataIndex: 'createDate',
|
||||
align: 'left',
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
title: t('修改时间'),
|
||||
dataIndex: 'modifyDate',
|
||||
align: 'left',
|
||||
width: 300,
|
||||
},
|
||||
];
|
||||
|
||||
const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'keyword',
|
||||
label: t('关键字'),
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
componentProps: {
|
||||
placeholder: t('请输入关键字'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const { notification } = useMessage();
|
||||
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: t('报表列表'),
|
||||
api: getReportPageList,
|
||||
columns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
showResetButton: false,
|
||||
},
|
||||
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
striped: false,
|
||||
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: t('操作'),
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
fixed: undefined,
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
});
|
||||
|
||||
let frameSrc = ref<string>(`${getAppEnvConfig().VITE_GLOB_API_URL}/ureport/designer`);
|
||||
const showFrame = ref<boolean>(false);
|
||||
|
||||
function handleCreate() {
|
||||
showFrame.value = true;
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
frameSrc.value = `${getAppEnvConfig().VITE_GLOB_API_URL}/ureport/designer?_u=xjr:${
|
||||
record.name
|
||||
}`;
|
||||
showFrame.value = true;
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteReport([record.id]).then((_) => {
|
||||
reload();
|
||||
notification.success({
|
||||
message: t('提示'),
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
178
src/views/report/release/components/ReportModal.vue
Normal file
178
src/views/report/release/components/ReportModal.vue
Normal file
@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" :style="{ 'margin-right': '10px' }" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, unref, onMounted } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import {
|
||||
addReportRelease,
|
||||
updateReportRelease,
|
||||
getReportReleaseInfo,
|
||||
getReportList,
|
||||
} from '/@/api/system/report';
|
||||
import { ReportCategory } from '/@/enums/reportEnum';
|
||||
const Separator = '---';
|
||||
onMounted(async () => {
|
||||
let res = await getReportList();
|
||||
let list = res.map((ele) => {
|
||||
ele.id = ele.id + Separator + ele.dataType; // value = id---type
|
||||
return ele;
|
||||
});
|
||||
reportListOptions.value = list;
|
||||
});
|
||||
|
||||
const emits = defineEmits(['success', 'register']);
|
||||
const { notification } = useMessage();
|
||||
const isUpdate = ref(true);
|
||||
const rowId = ref('');
|
||||
const systemId = ref('');
|
||||
const reportListOptions = ref<any[]>([]);
|
||||
const { t } = useI18n();
|
||||
|
||||
const accountFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'code',
|
||||
label: t('菜单编号'),
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 },
|
||||
componentProps: {
|
||||
placeholder: t('请填写菜单编号'),
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
label: t('菜单名称'),
|
||||
component: 'Input',
|
||||
required: true,
|
||||
colProps: { span: 12 },
|
||||
componentProps: {
|
||||
placeholder: t('请填写菜单名称'),
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'parentId',
|
||||
label: t('上级菜单'),
|
||||
component: 'MenuSelect',
|
||||
required: process.env.NODE_ENV === 'production',
|
||||
componentProps: {
|
||||
placeholder: t('请选择上级菜单'),
|
||||
onChange: (_, options) => {
|
||||
systemId.value = options.systemId;
|
||||
},
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'reportId',
|
||||
label: t('报表文件'),
|
||||
component: 'Select',
|
||||
required: true,
|
||||
componentProps: {
|
||||
placeholder: t('请选择报表文件'),
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
options: reportListOptions,
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'sortCode',
|
||||
label: t('排序'),
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: t('请填写排序'),
|
||||
min: 0,
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'icon',
|
||||
label: t('图标'),
|
||||
component: 'IconPicker',
|
||||
componentProps: {
|
||||
placeholder: t('请选择图标'),
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
label: t('功能描述'),
|
||||
component: 'InputTextArea',
|
||||
componentProps: {
|
||||
placeholder: t('请填写功能描述'),
|
||||
},
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
];
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 90,
|
||||
rowProps: {
|
||||
gutter: 20,
|
||||
},
|
||||
schemas: accountFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields();
|
||||
setModalProps({ confirmLoading: false, width: 700 });
|
||||
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
rowId.value = data.id;
|
||||
const record = await getReportReleaseInfo(data.id);
|
||||
if (record.dataType != undefined) {
|
||||
record.reportId = record.reportId + Separator + record.dataType;
|
||||
} else {
|
||||
record.reportId = record.reportId + Separator + ReportCategory.COMMON;
|
||||
}
|
||||
systemId.value = record.systemId;
|
||||
setFieldsValue({
|
||||
...record,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? t('新增') : t('编辑')));
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
values.systemId = systemId.value;
|
||||
setModalProps({ confirmLoading: true });
|
||||
let dataType: ReportCategory = ReportCategory.COMMON;
|
||||
if (values.reportId && values.reportId.includes(Separator)) {
|
||||
let reportIdArr = values.reportId.split(Separator);
|
||||
values.reportId = reportIdArr[0];
|
||||
dataType = reportIdArr[1];
|
||||
}
|
||||
values.dataType = dataType;
|
||||
if (!unref(isUpdate)) {
|
||||
//false 新增
|
||||
await addReportRelease(values);
|
||||
notification.success({
|
||||
message: t('提示'),
|
||||
description: t('新增成功!'),
|
||||
}); //提示消息
|
||||
} else {
|
||||
values.id = rowId.value;
|
||||
await updateReportRelease(values);
|
||||
notification.success({
|
||||
message: t('提示'),
|
||||
description: t('修改成功!'),
|
||||
}); //提示消息
|
||||
}
|
||||
|
||||
closeModal();
|
||||
emits('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
136
src/views/report/release/index.vue
Normal file
136
src/views/report/release/index.vue
Normal file
@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<PageWrapper dense fixed-height contentFullHeight>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" @click="handleCreate" v-auth="'report-release:add'">
|
||||
<template #icon><plus-outlined /></template>
|
||||
{{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
icon: 'clarity:note-edit-line',
|
||||
auth: 'report-release:edit',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
icon: 'ant-design:delete-outlined',
|
||||
auth: 'report-release:delete',
|
||||
color: 'error',
|
||||
popConfirm: {
|
||||
title: t('是否确认删除'),
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ReportModal @register="registerModal" @success="reload" />
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { BasicTable, useTable, TableAction, FormSchema, BasicColumn } from '/@/components/Table';
|
||||
import { getReportReleasePage, deleteReportRelease } from '/@/api/system/report';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import ReportModal from './components/ReportModal.vue';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
const { t } = useI18n();
|
||||
const columns: BasicColumn[] = [
|
||||
{
|
||||
title: () => t('菜单编号'),
|
||||
dataIndex: 'code',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: () => t('菜单名称'),
|
||||
dataIndex: 'title',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: () => t('父级菜单'),
|
||||
dataIndex: 'parentName',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: () => t('绑定报表'),
|
||||
dataIndex: 'reportName',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: () => t('备注'),
|
||||
dataIndex: 'remark',
|
||||
align: 'left',
|
||||
},
|
||||
];
|
||||
|
||||
const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'keyword',
|
||||
label: () => t('关键字'),
|
||||
component: 'Input',
|
||||
colProps: { span: 8 },
|
||||
componentProps: {
|
||||
placeholder: t('请输入关键字'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const { notification } = useMessage();
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: () => t('报表列表'),
|
||||
api: getReportReleasePage,
|
||||
columns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
showResetButton: false,
|
||||
},
|
||||
striped: false,
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: () => t('操作'),
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
fixed: undefined,
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
});
|
||||
|
||||
function handleCreate() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
});
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
isUpdate: true,
|
||||
id: record.id,
|
||||
});
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteReportRelease([record.id]).then((_) => {
|
||||
reload();
|
||||
notification.success({
|
||||
message: t('提示'),
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
17
src/views/report/template/index.vue
Normal file
17
src/views/report/template/index.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<FramePage :frameSrc="frameSrc" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { unref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
import FramePage from '/@/views/sys/iframe/index.vue';
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
const { path } = unref(currentRoute);
|
||||
const paths = path.split('/');
|
||||
const reportName = paths.length > 0 ? paths[paths.length - 1] : '';
|
||||
const frameSrc = `${
|
||||
getAppEnvConfig().VITE_GLOB_API_URL
|
||||
}/ureport/preview?_u=xjr:${reportName}.ureport.xml`;
|
||||
</script>
|
||||
Reference in New Issue
Block a user