【修改】ureport2 集成

This commit is contained in:
liuhongfeng 2023-12-03 17:00:00 +08:00
parent 7df7719be3
commit 0b9cf35b17
4 changed files with 71 additions and 70 deletions

View File

@ -1,39 +1,39 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface UreportFileVO { export interface UReportDataVO {
id: number id: number
fileName: string name: string
status: number status: number
fileContent: string content: string
remark: string remark: string
} }
// 查询Ureport2报表分页 // 查询Ureport2报表分页
export const getUreportFilePage = async (params) => { export const getUReportDataPage = async (params) => {
return await request.get({ url: `/report/ureport-file/page`, params }) return await request.get({ url: `/report/ureport-data/page`, params })
} }
// 查询Ureport2报表详情 // 查询Ureport2报表详情
export const getUreportFile = async (id: number) => { export const getUReportData = async (id: number) => {
return await request.get({ url: `/report/ureport-file/get?id=` + id }) return await request.get({ url: `/report/ureport-data/get?id=` + id })
} }
// 新增Ureport2报表 // 新增Ureport2报表
export const createUreportFile = async (data: UreportFileVO) => { export const createUReportData = async (data: UReportDataVO) => {
return await request.post({ url: `/report/ureport-file/create`, data }) return await request.post({ url: `/report/ureport-data/create`, data })
} }
// 修改Ureport2报表 // 修改Ureport2报表
export const updateUreportFile = async (data: UreportFileVO) => { export const updateUReportData = async (data: UReportDataVO) => {
return await request.put({ url: `/report/ureport-file/update`, data }) return await request.put({ url: `/report/ureport-data/update`, data })
} }
// 删除Ureport2报表 // 删除Ureport2报表
export const deleteUreportFile = async (id: number) => { export const deleteUReportData = async (id: number) => {
return await request.delete({ url: `/report/ureport-file/delete?id=` + id }) return await request.delete({ url: `/report/ureport-data/delete?id=` + id })
} }
// 导出Ureport2报表 Excel // 导出Ureport2报表 Excel
export const exportUreportFile = async (params) => { export const exportUReportData = async (params) => {
return await request.download({ url: `/report/ureport-file/export-excel`, params }) return await request.download({ url: `/report/ureport-data/export-excel`, params })
} }

View File

@ -7,8 +7,8 @@
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="文件名称" prop="fileName"> <el-form-item label="文件名称" prop="name">
<el-input v-model="formData.fileName" placeholder="请输入文件名称" /> <el-input v-model="formData.name" placeholder="请输入文件名称" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="formData.status" placeholder="请选择状态"> <el-select v-model="formData.status" placeholder="请选择状态">
@ -20,8 +20,8 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文件内容" prop="fileContent"> <el-form-item label="文件内容" prop="content">
<Editor v-model="formData.fileContent" height="150px" /> <Editor v-model="formData.content" height="150px" />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" /> <el-input v-model="formData.remark" placeholder="请输入备注" />
@ -35,7 +35,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as UreportFileApi from '@/api/report/ureport' import * as UReportDataApi from '@/api/report/ureport'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -46,13 +46,13 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
fileName: undefined, name: undefined,
status: undefined, status: undefined,
fileContent: undefined, content: undefined,
remark: undefined, remark: undefined,
}) })
const formRules = reactive({ const formRules = reactive({
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }], status: [{ required: true, message: '状态不能为空', trigger: 'change' }],
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
@ -67,7 +67,7 @@ const open = async (type: string, id?: number) => {
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await UreportFileApi.getUreportFile(id) formData.value = await UReportDataApi.getUReportData(id)
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -83,12 +83,12 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as unknown as UreportFileApi.UreportFileVO const data = formData.value as unknown as UReportDataApi.UReportDataVO
if (formType.value === 'create') { if (formType.value === 'create') {
await UreportFileApi.createUreportFile(data) await UReportDataApi.createUReportData(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await UreportFileApi.updateUreportFile(data) await UReportDataApi.updateUReportData(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false dialogVisible.value = false
@ -103,9 +103,9 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
fileName: undefined, name: undefined,
status: undefined, status: undefined,
fileContent: undefined, content: undefined,
remark: undefined, remark: undefined,
} }
formRef.value?.resetFields() formRef.value?.resetFields()

View File

@ -6,7 +6,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getAccessToken } from '@/utils/auth' import { getAccessToken } from '@/utils/auth'
defineOptions({ name: 'Ureport' }) defineOptions({ name: 'UReportData' })
const BASE_URL = import.meta.env.VITE_BASE_URL const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/ureport/designer?token=' + getAccessToken()) const src = ref(BASE_URL + '/ureport/designer?token=' + getAccessToken())

View File

@ -8,9 +8,9 @@
:inline="true" :inline="true"
label-width="68px" label-width="68px"
> >
<el-form-item label="文件名称" prop="fileName"> <el-form-item label="文件名称" prop="name">
<el-input <el-input
v-model="queryParams.fileName" v-model="queryParams.name"
placeholder="请输入文件名称" placeholder="请输入文件名称"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
@ -59,7 +59,7 @@
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['report:ureport-file:create']" v-hasPermi="['report:ureport-data:create']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
@ -68,7 +68,7 @@
plain plain
@click="handleExport" @click="handleExport"
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['report:ureport-file:export']" v-hasPermi="['report:ureport-data:export']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> </el-button>
@ -80,12 +80,13 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="ID" align="center" prop="id" /> <el-table-column label="ID" align="center" prop="id" />
<el-table-column label="文件名称" align="center" prop="fileName" /> <el-table-column label="文件名称" align="center" prop="name" />
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="文件内容" align="center" prop="content" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column <el-table-column
label="创建时间" label="创建时间"
@ -100,7 +101,7 @@
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
v-hasPermi="['report:ureport-file:update']" v-hasPermi="['report:ureport-data:update']"
> >
编辑 编辑
</el-button> </el-button>
@ -108,7 +109,7 @@
link link
type="danger" type="danger"
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"
v-hasPermi="['report:ureport-file:delete']" v-hasPermi="['report:ureport-data:delete']"
> >
删除 删除
</el-button> </el-button>
@ -125,17 +126,17 @@
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<UreportFileForm ref="formRef" @success="getList" /> <UReportDataForm ref="formRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as UreportFileApi from '@/api/report/ureport' import * as UReportDataApi from '@/api/report/ureport'
import UreportFileForm from './UreportFileForm.vue' import UReportDataForm from './UReportDataForm.vue'
defineOptions({ name: 'UreportFile' }) defineOptions({ name: 'UReportData' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -146,7 +147,7 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
fileName: null, name: null,
status: null, status: null,
remark: null, remark: null,
createTime: [], createTime: [],
@ -158,7 +159,7 @@ const exportLoading = ref(false) // 导出的加载中
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
const data = await UreportFileApi.getUreportFilePage(queryParams) const data = await UReportDataApi.getUReportDataPage(queryParams)
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
} finally { } finally {
@ -190,7 +191,7 @@ const handleDelete = async (id: number) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await UreportFileApi.deleteUreportFile(id) await UReportDataApi.deleteUReportData(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
@ -204,7 +205,7 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await UreportFileApi.exportUreportFile(queryParams) const data = await UReportDataApi.exportUReportData(queryParams)
download.excel(data, 'Ureport2报表.xls') download.excel(data, 'Ureport2报表.xls')
} catch { } catch {
} finally { } finally {
@ -216,4 +217,4 @@ const handleExport = async () => {
onMounted(() => { onMounted(() => {
getList() getList()
}) })
</script> </script>