8 changed files with 231 additions and 8 deletions
@ -0,0 +1,17 @@ |
|||||||
|
import type { ReportSystemFile, ReportSystemFileParams, ReportSystemFileResult } from '/@/api/platform/report/entity/reportSystemFile'; |
||||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||||
|
|
||||||
|
enum Api { |
||||||
|
list = '/report_proxy/report/rest/list', |
||||||
|
get = '/report_proxy/report/rest', |
||||||
|
del = '/report_proxy/report/client/remove', |
||||||
|
} |
||||||
|
|
||||||
|
/** 查询报表列表 */ |
||||||
|
export const listReportSystemFile = (params?: Partial<ReportSystemFileParams>) => defHttp.get<ReportSystemFileResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||||
|
|
||||||
|
/** 查询报表详细 */ |
||||||
|
export const getReportSystemFile = (id: string) => defHttp.get<ReportSystemFile>({ url: `${Api.get}/${id}` }); |
||||||
|
|
||||||
|
/** 删除报表 */ |
||||||
|
export const delReportSystemFile = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,16 @@ |
|||||||
|
import type { R } from '/#/axios'; |
||||||
|
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||||
|
|
||||||
|
/** 报表系统文件查询参数 */ |
||||||
|
export type ReportSystemFileParams = Page & ReportSystemFile; |
||||||
|
|
||||||
|
/** 报表系统文件 */ |
||||||
|
export interface ReportSystemFile extends CommonEntity { |
||||||
|
id: string; |
||||||
|
name: string; |
||||||
|
content: Blob[]; |
||||||
|
[key: string]: any; |
||||||
|
} |
||||||
|
|
||||||
|
/** 报表系统文件响应对象 */ |
||||||
|
export type ReportSystemFileResult = R<ReportSystemFile[]>; |
@ -0,0 +1,45 @@ |
|||||||
|
import { BasicColumn } from '/@/components/Table'; |
||||||
|
import { FormSchema } from '/@/components/Table'; |
||||||
|
|
||||||
|
/** 表格列配置 */ |
||||||
|
export const columns: BasicColumn[] = [ |
||||||
|
{ |
||||||
|
title: '文件名', |
||||||
|
dataIndex: 'name', |
||||||
|
width: 100 |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '更新时间', |
||||||
|
dataIndex: 'updateTime', |
||||||
|
width: 100 |
||||||
|
}, |
||||||
|
{ |
||||||
|
title: '创建时间', |
||||||
|
dataIndex: 'createTime', |
||||||
|
width: 100 |
||||||
|
}, |
||||||
|
]; |
||||||
|
|
||||||
|
/** 搜索表单配置 */ |
||||||
|
export const searchFormSchema: FormSchema[] = [ |
||||||
|
{ |
||||||
|
field: 'name', |
||||||
|
label: '文件名', |
||||||
|
component: 'Input', |
||||||
|
componentProps: { |
||||||
|
placeholder: '请输入文件名', |
||||||
|
}, |
||||||
|
colProps: { span: 8 }, |
||||||
|
}, |
||||||
|
{ |
||||||
|
field: 'dateRange', |
||||||
|
label: '创建时间', |
||||||
|
component: 'RangePicker', |
||||||
|
componentProps: { |
||||||
|
style: { width:'100%' }, |
||||||
|
valueFormat: 'YYYY-MM-DD', |
||||||
|
placeholder: ['开始日期','结束日期'] |
||||||
|
}, |
||||||
|
colProps: { span: 8 } |
||||||
|
} |
||||||
|
]; |
@ -0,0 +1,139 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<BasicTable |
||||||
|
@register="registerTable" |
||||||
|
@selection-change="handleSelectionChange" |
||||||
|
> |
||||||
|
<template #toolbar> |
||||||
|
<a-button |
||||||
|
type="primary" |
||||||
|
@click="handleAdd()" |
||||||
|
>新增报表</a-button> |
||||||
|
<a-button |
||||||
|
type="primary" |
||||||
|
:disabled="state.multiple" |
||||||
|
@click="handleDel()" |
||||||
|
>删除报表</a-button> |
||||||
|
</template> |
||||||
|
<template #bodyCell="{ column, record }"> |
||||||
|
<template v-if="column.key === 'action'"> |
||||||
|
<TableAction |
||||||
|
:actions="[ |
||||||
|
{ |
||||||
|
label: '预览', |
||||||
|
icon: 'fa6-solid:file-pdf', |
||||||
|
onClick: handlePreview.bind(null, record) |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '设计', |
||||||
|
icon: 'fa6-solid:pen-ruler', |
||||||
|
onClick: handleDesign.bind(null, record) |
||||||
|
}, |
||||||
|
{ |
||||||
|
label: '删除', |
||||||
|
icon: 'ant-design:delete-outlined', |
||||||
|
color: 'error', |
||||||
|
onClick: handleDel.bind(null, record) |
||||||
|
}]" |
||||||
|
/> |
||||||
|
</template> |
||||||
|
</template> |
||||||
|
</BasicTable> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script lang="ts" setup> |
||||||
|
/** |
||||||
|
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import { reactive, toRaw } from 'vue'; |
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||||
|
import { listReportSystemFile, delReportSystemFile } from '/@/api/platform/report/controller/reportSystemFile'; |
||||||
|
import { useModal } from '/@/components/Modal'; |
||||||
|
import { columns, searchFormSchema } from './design.data'; |
||||||
|
import { useMessage } from '/@/hooks/web/useMessage'; |
||||||
|
import { useRouter } from 'vue-router'; |
||||||
|
|
||||||
|
interface TableState { |
||||||
|
single: boolean; |
||||||
|
multiple: boolean; |
||||||
|
} |
||||||
|
|
||||||
|
const state = reactive<TableState>({ |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true |
||||||
|
}); |
||||||
|
const { push, replace } = useRouter(); |
||||||
|
const { createConfirm, createMessage } = useMessage(); |
||||||
|
const [registerModal, { openModal }] = useModal(); |
||||||
|
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||||
|
title: '报表列表', |
||||||
|
api: listReportSystemFile, |
||||||
|
rowKey: 'id', |
||||||
|
columns, |
||||||
|
formConfig: { |
||||||
|
compact: true, |
||||||
|
labelWidth: 100, |
||||||
|
schemas: searchFormSchema, |
||||||
|
autoSubmitOnEnter: true, |
||||||
|
showAdvancedButton: true, |
||||||
|
autoAdvancedLine: 3, |
||||||
|
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||||
|
}, |
||||||
|
rowSelection: { type: 'checkbox' }, |
||||||
|
useSearchForm: true, |
||||||
|
showTableSetting: true, |
||||||
|
bordered: true, |
||||||
|
clickToRowSelect: false, |
||||||
|
showIndexColumn: false, |
||||||
|
actionColumn: { |
||||||
|
width: 220, |
||||||
|
title: '操作', |
||||||
|
dataIndex: 'action', |
||||||
|
fixed: false |
||||||
|
}, |
||||||
|
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||||
|
}); |
||||||
|
|
||||||
|
function handleSelectionChange(selection?: Recordable) { |
||||||
|
const rowSelection = toRaw(selection?.keys) || []; |
||||||
|
state.single = rowSelection.length != 1; |
||||||
|
state.multiple = !rowSelection.length; |
||||||
|
} |
||||||
|
|
||||||
|
function handleAdd() { |
||||||
|
push({ name: '报表设计器', query: { enableMetaMerge: 'y', title: '设计报表', frameSrc: 'https://www.baidu.com' } }); |
||||||
|
} |
||||||
|
|
||||||
|
function handleDesign(record: Recordable) { |
||||||
|
push({ name: '报表设计' }); |
||||||
|
} |
||||||
|
|
||||||
|
function handlePreview(record: Recordable) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
async function handleDel(record?: Recordable) { |
||||||
|
const ids = record?.id || getSelectRowKeys(); |
||||||
|
createConfirm({ |
||||||
|
iconType: 'warning', |
||||||
|
title: '警告', |
||||||
|
content: `是否确认删除报表编号为${ids}报表吗?`, |
||||||
|
onOk: async () => { |
||||||
|
await delReportSystemFile(ids); |
||||||
|
createMessage.success('删除成功!'); |
||||||
|
handleRefreshTable(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
function handleRefreshTable() { |
||||||
|
clearSelectedRowKeys(); |
||||||
|
reload(); |
||||||
|
} |
||||||
|
</script> |
Loading…
Reference in new issue