【修改】ureport2 集成
This commit is contained in:
parent
7df7719be3
commit
0b9cf35b17
@ -1,39 +1,39 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface UreportFileVO {
|
||||
id: number
|
||||
fileName: string
|
||||
status: number
|
||||
fileContent: string
|
||||
remark: string
|
||||
}
|
||||
|
||||
// 查询Ureport2报表分页
|
||||
export const getUreportFilePage = async (params) => {
|
||||
return await request.get({ url: `/report/ureport-file/page`, params })
|
||||
}
|
||||
|
||||
// 查询Ureport2报表详情
|
||||
export const getUreportFile = async (id: number) => {
|
||||
return await request.get({ url: `/report/ureport-file/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增Ureport2报表
|
||||
export const createUreportFile = async (data: UreportFileVO) => {
|
||||
return await request.post({ url: `/report/ureport-file/create`, data })
|
||||
}
|
||||
|
||||
// 修改Ureport2报表
|
||||
export const updateUreportFile = async (data: UreportFileVO) => {
|
||||
return await request.put({ url: `/report/ureport-file/update`, data })
|
||||
}
|
||||
|
||||
// 删除Ureport2报表
|
||||
export const deleteUreportFile = async (id: number) => {
|
||||
return await request.delete({ url: `/report/ureport-file/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出Ureport2报表 Excel
|
||||
export const exportUreportFile = async (params) => {
|
||||
return await request.download({ url: `/report/ureport-file/export-excel`, params })
|
||||
}
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface UReportDataVO {
|
||||
id: number
|
||||
name: string
|
||||
status: number
|
||||
content: string
|
||||
remark: string
|
||||
}
|
||||
|
||||
// 查询Ureport2报表分页
|
||||
export const getUReportDataPage = async (params) => {
|
||||
return await request.get({ url: `/report/ureport-data/page`, params })
|
||||
}
|
||||
|
||||
// 查询Ureport2报表详情
|
||||
export const getUReportData = async (id: number) => {
|
||||
return await request.get({ url: `/report/ureport-data/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增Ureport2报表
|
||||
export const createUReportData = async (data: UReportDataVO) => {
|
||||
return await request.post({ url: `/report/ureport-data/create`, data })
|
||||
}
|
||||
|
||||
// 修改Ureport2报表
|
||||
export const updateUReportData = async (data: UReportDataVO) => {
|
||||
return await request.put({ url: `/report/ureport-data/update`, data })
|
||||
}
|
||||
|
||||
// 删除Ureport2报表
|
||||
export const deleteUReportData = async (id: number) => {
|
||||
return await request.delete({ url: `/report/ureport-data/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出Ureport2报表 Excel
|
||||
export const exportUReportData = async (params) => {
|
||||
return await request.download({ url: `/report/ureport-data/export-excel`, params })
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="formData.fileName" placeholder="请输入文件名称" />
|
||||
<el-form-item label="文件名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入文件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
@ -20,8 +20,8 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件内容" prop="fileContent">
|
||||
<Editor v-model="formData.fileContent" height="150px" />
|
||||
<el-form-item label="文件内容" prop="content">
|
||||
<Editor v-model="formData.content" height="150px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
@ -35,7 +35,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
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 message = useMessage() // 消息弹窗
|
||||
@ -46,13 +46,13 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
fileName: undefined,
|
||||
name: undefined,
|
||||
status: undefined,
|
||||
fileContent: undefined,
|
||||
content: undefined,
|
||||
remark: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '文件名称不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '状态不能为空', trigger: 'change' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
@ -67,7 +67,7 @@ const open = async (type: string, id?: number) => {
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await UreportFileApi.getUreportFile(id)
|
||||
formData.value = await UReportDataApi.getUReportData(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@ -83,12 +83,12 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as UreportFileApi.UreportFileVO
|
||||
const data = formData.value as unknown as UReportDataApi.UReportDataVO
|
||||
if (formType.value === 'create') {
|
||||
await UreportFileApi.createUreportFile(data)
|
||||
await UReportDataApi.createUReportData(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await UreportFileApi.updateUreportFile(data)
|
||||
await UReportDataApi.updateUReportData(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
@ -103,9 +103,9 @@ const submitForm = async () => {
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
fileName: undefined,
|
||||
name: undefined,
|
||||
status: undefined,
|
||||
fileContent: undefined,
|
||||
content: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
@ -6,7 +6,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { getAccessToken } from '@/utils/auth'
|
||||
|
||||
defineOptions({ name: 'Ureport' })
|
||||
defineOptions({ name: 'UReportData' })
|
||||
|
||||
const BASE_URL = import.meta.env.VITE_BASE_URL
|
||||
const src = ref(BASE_URL + '/ureport/designer?token=' + getAccessToken())
|
||||
|
@ -8,9 +8,9 @@
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-form-item label="文件名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.fileName"
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入文件名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
@ -59,7 +59,7 @@
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['report:ureport-file:create']"
|
||||
v-hasPermi="['report:ureport-data:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
@ -68,7 +68,7 @@
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['report:ureport-file:export']"
|
||||
v-hasPermi="['report:ureport-data:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
@ -80,12 +80,13 @@
|
||||
<ContentWrap>
|
||||
<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="文件名称" align="center" prop="fileName" />
|
||||
<el-table-column label="文件名称" align="center" prop="name" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="文件内容" align="center" prop="content" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
@ -100,7 +101,7 @@
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['report:ureport-file:update']"
|
||||
v-hasPermi="['report:ureport-data:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
@ -108,7 +109,7 @@
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['report:ureport-file:delete']"
|
||||
v-hasPermi="['report:ureport-data:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
@ -125,17 +126,17 @@
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<UreportFileForm ref="formRef" @success="getList" />
|
||||
<UReportDataForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as UreportFileApi from '@/api/report/ureport'
|
||||
import UreportFileForm from './UreportFileForm.vue'
|
||||
import * as UReportDataApi from '@/api/report/ureport'
|
||||
import UReportDataForm from './UReportDataForm.vue'
|
||||
|
||||
defineOptions({ name: 'UreportFile' })
|
||||
defineOptions({ name: 'UReportData' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
@ -146,7 +147,7 @@ const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
fileName: null,
|
||||
name: null,
|
||||
status: null,
|
||||
remark: null,
|
||||
createTime: [],
|
||||
@ -158,7 +159,7 @@ const exportLoading = ref(false) // 导出的加载中
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await UreportFileApi.getUreportFilePage(queryParams)
|
||||
const data = await UReportDataApi.getUReportDataPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
@ -190,7 +191,7 @@ const handleDelete = async (id: number) => {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await UreportFileApi.deleteUreportFile(id)
|
||||
await UReportDataApi.deleteUReportData(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
@ -204,7 +205,7 @@ const handleExport = async () => {
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await UreportFileApi.exportUreportFile(queryParams)
|
||||
const data = await UReportDataApi.exportUReportData(queryParams)
|
||||
download.excel(data, 'Ureport2报表.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
@ -216,4 +217,4 @@ const handleExport = async () => {
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user