提交 f7efedb1 authored 作者: lidongxu's avatar lidongxu

fix(report): 合并代码:把报表设计功能完成并合并准备上线

...@@ -15,6 +15,10 @@ VITE_APP_PROMOTION = '/dev-promotion-api' # 促销 ...@@ -15,6 +15,10 @@ VITE_APP_PROMOTION = '/dev-promotion-api' # 促销
VITE_APP_REDIRECT_URL = 'http://localhost:8085' VITE_APP_REDIRECT_URL = 'http://localhost:8085'
# 积木报表服务地址 # 积木报表服务地址
VITE_APP_REPORT_URL = 'https://sfa-qa.wxl66.cn' VITE_APP_REPORT_URL = 'https://sfa-qa.wxl66.cn'
# 积木报表预览地址
VITE_APP_REPORT_PREVIEW_URL = 'https://sfa-qa.wxl66.cn/report/jmreport/view'
# 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = 'https://sfa-qa.wxl66.cn/report/jmreport/index'
# 模板表格 # 模板表格
VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx' VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx'
\ No newline at end of file
...@@ -14,6 +14,10 @@ VITE_APP_PROMOTION = '/promotion-api' # 促销 ...@@ -14,6 +14,10 @@ VITE_APP_PROMOTION = '/promotion-api' # 促销
VITE_APP_REDIRECT_URL = 'https://sfa.wxl66.cn/link/' VITE_APP_REDIRECT_URL = 'https://sfa.wxl66.cn/link/'
# 积木报表服务地址 # 积木报表服务地址
VITE_APP_REPORT_URL = 'https://sfa.wxl66.cn' VITE_APP_REPORT_URL = 'https://sfa.wxl66.cn'
# 积木报表预览地址
VITE_APP_REPORT_PREVIEW_URL = '/report/jmreport/view'
# 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index
# 模板表格 # 模板表格
VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx' VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx'
\ No newline at end of file
...@@ -13,6 +13,10 @@ VITE_APP_PROMOTION = '/promotion-api' # 促销 ...@@ -13,6 +13,10 @@ VITE_APP_PROMOTION = '/promotion-api' # 促销
VITE_APP_REDIRECT_URL = 'https://sfa-qa.wxl66.cn/' VITE_APP_REDIRECT_URL = 'https://sfa-qa.wxl66.cn/'
# 积木报表服务地址 # 积木报表服务地址
VITE_APP_REPORT_URL = 'https://sfa-qa.wxl66.cn' VITE_APP_REPORT_URL = 'https://sfa-qa.wxl66.cn'
# 积木报表预览地址
VITE_APP_REPORT_PREVIEW_URL = '/report/jmreport/view'
# 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index
# 模板表格 # 模板表格
VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx' VITE_APP_PLAN_TEMPLATE_EXCEL = 'https://link-promotion.oss-cn-shanghai.aliyuncs.com/file/%E6%96%B0%E5%A2%9E%E6%88%96%E4%BF%AE%E6%94%B9%E8%AE%A1%E5%88%92-%E6%A8%A1%E6%9D%BF4.0.xlsx'
\ No newline at end of file
...@@ -12,7 +12,10 @@ export * from './bi/report' ...@@ -12,7 +12,10 @@ export * from './bi/report'
export * from './bi/sale' export * from './bi/sale'
export * from './bi/store' export * from './bi/store'
export * from './bi/supply' export * from './bi/supply'
export * from './jimu/index' export * from './jimu/design'
export * from './jimu/ext'
export * from './jimu/list'
export * from './jimu/manager'
export * from './other/logistics' export * from './other/logistics'
export * from './other/version' export * from './other/version'
export * from './monitor/cache' export * from './monitor/cache'
...@@ -32,7 +35,6 @@ export * from './system/menu' ...@@ -32,7 +35,6 @@ export * from './system/menu'
export * from './system/notice' export * from './system/notice'
export * from './system/operlog' export * from './system/operlog'
export * from './system/post' export * from './system/post'
export * from './system/report'
export * from './system/role' export * from './system/role'
export * from './system/user' export * from './system/user'
export * from './tool/gen' export * from './tool/gen'
import request from '@/utils/request'
// 获取文件夹结构
export function getReportFolderStructureAPI(params) {
return request({
url: `/report/jmreport/category/list`,
params
})
}
// 获取报表设计中的报表列表
export function getDesignReportListAPI(params) {
return request({
url: `/report/jmreport/query/report/folder`,
params
})
}
// 删除报表
export function deleteReportAPI(params) {
return request({
url: `/report/jmreport/delete`,
method: 'DELETE',
params,
data: params
})
}
// 复制报表
export function copyReportAPI(params) {
return request({
url: `/report/jmreport/reportCopy`,
params
})
}
// 新建报表(需要先调用接口创建一个 id,传给新建页面)
export function addReportAPI() {
return request({
url: `/report/jmreport/save`,
method: 'POST',
data: {}
})
}
// 导入报表(报表来自积木设计页面右键导出报表配置 json 文件的导入)
export function importReportAPI(data) {
return request({
url: `/report/jmreport/importReportConfig`,
method: 'POST',
data,
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
import request from '@/utils/request' import request from '@/utils/request'
import { getToken } from '@/utils/auth'
// 提交其他报表超链接 // 提交其他报表超链接
export function submitOtherReportAPI(data) { export function submitOtherReportAPI(data) {
...@@ -17,16 +16,4 @@ export function enterOtherReportAPI(data) { ...@@ -17,16 +16,4 @@ export function enterOtherReportAPI(data) {
method: 'POST', method: 'POST',
data data
}) })
} }
\ No newline at end of file
// 获取积木报表文件夹列表(分组)
export function getReportFolderListAPI() {
return request({
url: `/report/jmreport/category/list`,
headers: {
Token: getToken()
},
method: 'GET'
})
}
import request from '@/utils/request'
// 查看报表-属于自己和被分配的报表列表(暂时不包含其他平台的报表)
export function getReportListByUserAPI(params) {
return request({
url: `/report/jimuReport/query/list`,
params
})
}
// 查看报表-搜索时:报表分类下拉列表接口
export const selReportCategoryAPI = () => {
return request({
url: `/report/jimuReportCategory/query/list`
})
}
\ No newline at end of file
import request from '@/utils/request' import request from '@/utils/request'
// 管理员查询所有报表接口 // 管理员查询所有报表接口
export const selReportListAPI = (params) => { export const selReportListAPI = (params) => {
return request({ return request({
...@@ -7,22 +8,6 @@ export const selReportListAPI = (params) => { ...@@ -7,22 +8,6 @@ export const selReportListAPI = (params) => {
}) })
} }
// 授权单个报表给单个/多个用户
export const batchAuthReportAPI = (data) => {
return request({
url: `/report/jimuReportAuth/core/authUsers`,
method: "PUT",
data
})
}
// 报表分类下拉列表接口
export const selReportCategoryAPI = () => {
return request({
url: `/report/jimuReportCategory/query/list`
})
}
// 查询-报表已分配用户列表 // 查询-报表已分配用户列表
export const selReportAuthUserListAPI = (params) => { export const selReportAuthUserListAPI = (params) => {
return request({ return request({
...@@ -30,3 +15,12 @@ export const selReportAuthUserListAPI = (params) => { ...@@ -30,3 +15,12 @@ export const selReportAuthUserListAPI = (params) => {
params params
}) })
} }
// 授权单个报表,给单个/多个用户
export const batchAuthReportAPI = (data) => {
return request({
url: `/report/jimuReportAuth/core/authUsers`,
method: "PUT",
data
})
}
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1753438508298" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6380" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M875.093333 301.653333L597.333333 21.333333a77.226667 77.226667 0 0 0-14.933333-11.52l-4.266667-2.133333h-2.986666A72.533333 72.533333 0 0 0 546.133333 0H200.106667A72.106667 72.106667 0 0 0 128 72.106667v879.786666A72.106667 72.106667 0 0 0 200.106667 1024h623.786666A72.106667 72.106667 0 0 0 896 951.893333V352.426667a72.106667 72.106667 0 0 0-20.906667-50.773334z m-290.986666 10.24V110.506667l199.68 201.813333z" fill="#1eae1d" p-id="6381"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1753427197844" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4404" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M890.764387 269.477161H523.47871a9.166452 9.166452 0 0 1-6.523871-2.708645l-94.63742-94.538322a45.914839 45.914839 0 0 0-32.652387-13.510194H133.235613a46.261677 46.261677 0 0 0-46.195613 46.146065v609.14787a46.179097 46.179097 0 0 0 46.195613 46.146065h757.528774a46.261677 46.261677 0 0 0 46.195613-46.146065V315.623226a46.179097 46.179097 0 0 0-46.195613-46.146065z" fill="#ffce45" p-id="4405"></path></svg>
\ No newline at end of file
...@@ -196,3 +196,8 @@ aside { ...@@ -196,3 +196,8 @@ aside {
} }
} }
// 分割线调整宽度线条
.splitpanes--vertical > .splitpanes__splitter {
width: 2px; /* 调整粗细 */
background: #ddd; /* 可选:修改颜色 */
}
\ No newline at end of file
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
v-slot="{ node, data }" v-slot="{ node, data }"
:style="{ margin: rowGap + 'px !important' }"> :style="{ margin: rowGap + 'px !important' }">
<svg-icon v-if="customOptions.showIcon" <svg-icon v-if="customOptions.showIcon"
icon-class="tab" icon-class="floader"
style="fill: #409eff; stroke: red; margin-right: 10px;" /> class="floader-icon" />
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
<span v-if="customOptions.showTool" <span v-if="customOptions.showTool"
class="edit_del"> class="edit_del">
...@@ -114,8 +114,8 @@ const props = defineProps({ ...@@ -114,8 +114,8 @@ const props = defineProps({
default: () => ({ default: () => ({
// 右侧工具是否显示 // 右侧工具是否显示
showTool: false, showTool: false,
// 左侧图表是否显示 // // 左侧图表是否显示
showIcon: false, // showIcon: false,
// 行与行间隙 // 行与行间隙
rowGap: 0, rowGap: 0,
// 底部分页是否显示 // 底部分页是否显示
...@@ -292,7 +292,18 @@ const handleClick = () => { ...@@ -292,7 +292,18 @@ const handleClick = () => {
} }
} }
::v-deep(.el-tree-node){
margin-top: 5px;
}
::v-deep(.el-tree-node__content){
.el-icon, .svg-icon{
font-size: 16px;
}
.floader-icon{
margin-right: 10px;
}
}
::v-deep(.custom-tree-node) { ::v-deep(.custom-tree-node) {
width: 100%; width: 100%;
...@@ -302,7 +313,7 @@ const handleClick = () => { ...@@ -302,7 +313,7 @@ const handleClick = () => {
/* 间距放大 */ /* 间距放大 */
::v-deep(.row_gap .el-tree-node .el-tree-node__content) { ::v-deep(.row_gap .el-tree-node .el-tree-node__content) {
padding: 10px 0; padding: 20px 0;
height: auto; height: auto;
} }
......
...@@ -12,6 +12,8 @@ import 'element-plus/dist/index.css' ...@@ -12,6 +12,8 @@ import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css' // 暗黑模式变量 import 'element-plus/theme-chalk/dark/css-vars.css' // 暗黑模式变量
import locale from 'element-plus/es/locale/lang/zh-cn' import locale from 'element-plus/es/locale/lang/zh-cn'
import '@/assets/styles/index.scss' import '@/assets/styles/index.scss'
import { Splitpanes, Pane } from "splitpanes" // 分割拖拽调整宽度
import "splitpanes/dist/splitpanes.css"
/****************** 插件 ******************/ /****************** 插件 ******************/
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
...@@ -24,6 +26,7 @@ import { download } from '@/utils/request' ...@@ -24,6 +26,7 @@ import { download } from '@/utils/request'
import { useDict } from '@/utils/dict' import { useDict } from '@/utils/dict'
import { checkPermi } from '@/utils/permission' import { checkPermi } from '@/utils/permission'
import eventBus from '@/utils/eventBus' import eventBus from '@/utils/eventBus'
import { chooseFile } from '@/utils/upload'
/****************** 移动端 ******************/ /****************** 移动端 ******************/
import registerMobile from "@/mobile/main.js" import registerMobile from "@/mobile/main.js"
...@@ -80,6 +83,7 @@ app.config.globalProperties.selectDictLabels = selectDictLabels ...@@ -80,6 +83,7 @@ app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.isMobile = isMobile app.config.globalProperties.isMobile = isMobile
app.config.globalProperties.checkPermi = checkPermi app.config.globalProperties.checkPermi = checkPermi
app.config.globalProperties.eventBus = eventBus app.config.globalProperties.eventBus = eventBus
app.config.globalProperties.chooseFile = chooseFile
// 全局组件 // 全局组件
app.component('svg-icon', SvgIcon) app.component('svg-icon', SvgIcon)
...@@ -100,6 +104,8 @@ app.component('XlToolTip', XLToolTip) ...@@ -100,6 +104,8 @@ app.component('XlToolTip', XLToolTip)
app.component('XlSelect', XlSelect) app.component('XlSelect', XlSelect)
app.component('OpenDialog', OpenDialog) app.component('OpenDialog', OpenDialog)
app.component('VersionNotice', VersionNotice) app.component('VersionNotice', VersionNotice)
app.component('Splitpanes', Splitpanes)
app.component('Pane', Pane)
// 全局插件 // 全局插件
app.use(plugins) app.use(plugins)
......
...@@ -13,6 +13,7 @@ export * from './route' ...@@ -13,6 +13,7 @@ export * from './route'
export * from './ruoyi' export * from './ruoyi'
export * from './scroll-to' export * from './scroll-to'
export * from './theme' export * from './theme'
export * from './upload'
export * from './url' export * from './url'
export * from './validate' export * from './validate'
......
...@@ -35,7 +35,7 @@ service.interceptors.request.use(config => { ...@@ -35,7 +35,7 @@ service.interceptors.request.use(config => {
// 促销后台不能带 Bearer 前缀 // 促销后台不能带 Bearer 前缀
config.headers['Authorization'] = getToken() config.headers['Authorization'] = getToken()
} else { } else {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 config.headers['Authorization'] = 'Bearer ' + getToken()
} }
} }
// get请求映射params参数 // get请求映射params参数
......
// 通过 JS 方式实现选择文件,而非组件
export const chooseFile = ({ accept, id = 'fileInput' }) => {
return new Promise((resolve, reject) => {
const fileInput = document.createElement('input')
fileInput.type = 'file'
fileInput.id = id
fileInput.accept = accept
fileInput.addEventListener('change', function () {
if (fileInput.files.length > 0) {
const file = fileInput.files[0]
resolve(file)
} else {
reject('请选择文件')
}
})
fileInput.addEventListener('change', () => {
document.body.removeChild(fileInput)
})
// 关闭窗口没选择文件
window.addEventListener('cancel', () => {
document.body.removeChild(fileInput)
})
document.body.appendChild(fileInput)
fileInput.click()
})
}
\ No newline at end of file
...@@ -41,22 +41,17 @@ const { proxy } = getCurrentInstance() ...@@ -41,22 +41,17 @@ const { proxy } = getCurrentInstance()
// 覆盖上传直播间分类表格 // 覆盖上传直播间分类表格
const uploadExcel = () => { const uploadExcel = () => {
const fileInput = document.createElement('input'); proxy.chooseFile({
fileInput.type = 'file'; accept: '.xls, .xlsx'
fileInput.id = 'fileInput'; }).then(async file => {
fileInput.accept = '.xls, .xlsx'; // 限制只能选择 .xls 和 .xlsx 文件 // 在这里可以添加文件上传的逻辑
fileInput.addEventListener('change', async function () { const formData = new FormData();
const file = fileInput.files[0]; formData.append('file', file);
if (file) { const res = await uploadLiveCate(formData)
// 在这里可以添加文件上传的逻辑 proxy.$modal.msgSuccess(res.data)
const formData = new FormData(); }).catch(err => {
formData.append('file', file); proxy.$modal.msgError(err)
const res = await uploadLiveCate(formData) })
proxy.$modal.msgSuccess(res.data)
}
});
document.body.appendChild(fileInput);
fileInput.click()
} }
/************ 直播间分类列表 *******************/ /************ 直播间分类列表 *******************/
......
<template>
<div class="app-container">
<div class="container">
<el-row :gutter="20"
class="client-fix-height container">
<category-tree v-model="queryParams.reportType"
:options="floderList"
:defaultProps="{ label: 'title', children: 'children' }"
node-key="id"
placeholder="搜索文件夹名称"
:defaultExpandList="defaultExpandList"
:colSpan="4"
:customOptions="{
showIcon: true
}"
@search="handleNodeClick">
</category-tree>
<el-col :span="20"
:xs="24"
class="right_col">
<el-form :model="queryParams"
ref="queryRef"
:inline="true"
label-width="68px">
<el-form-item label="报表名字"
prop="name">
<el-input v-model="queryParams.name"
placeholder="请输入用户工号"
clearable
style="width: 240px"
@input="getReportList" />
</el-form-item>
</el-form>
<el-row :gutter="10"
class="mb8">
<el-col :span="1.5">
<el-button type="primary"
plain
icon="Plus"
@click="handleAdd">新建报表</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info"
plain
icon="Upload"
@click="handleImport">导入报表</el-button>
</el-col>
</el-row>
<el-table v-loading="loading"
:data="reportList">
<el-table-column type="selection"
width="50" />
<el-table-column label="报表名称"
key="name"
prop="name"
align="left">
<template #default="{ row }">
<div>
<svg-icon icon-class="bg-document"></svg-icon>
<span style="margin-left: 10px">{{ row.name }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作"
class-name="small-padding fixed-width"
align="left"
width="200">
<template #default="scope">
<xl-tool-tip content="预览报表"
placement="top">
<el-button link
type="primary"
icon="View"
@click="handlePreview(scope.row)"></el-button>
</xl-tool-tip>
<xl-tool-tip content="修改"
placement="top">
<el-button link
type="primary"
icon="Edit"
@click="handleEdit(scope.row)"></el-button>
</xl-tool-tip>
<xl-tool-tip content="删除"
placement="top"
v-if="scope.row.userId !== 1">
<el-button link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"></el-button>
</xl-tool-tip>
<xl-tool-tip content="复制报表"
placement="top"
v-if="scope.row.userId !== 1">
<el-button link
type="primary"
icon="CopyDocument"
@click="handleCopy(scope.row)"></el-button>
</xl-tool-tip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getReportList" />
</el-col>
</el-row>
</div>
</div>
</template>
<script setup>
import { getToken } from '@/utils/auth'
import { getReportFolderStructureAPI, getDesignReportListAPI, deleteReportAPI, copyReportAPI, addReportAPI, importReportAPI } from '@/api'
import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览
const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑
/************ 文件夹分组 ********************/
const floderList = ref([{ // 文件夹结构
id: '0',
izLeaf: 0,
pid: '-1',
sortNo: 0,
title: '文件夹',
value: '0',
children: []
}])
const defaultExpandList = ref([])
const getReportFolderStructure = async (obj) => {
// 递归判断每个 res.result 数组里的对象去请求,有数据放到 children 里,没有则停止递归
const res = await getReportFolderStructureAPI({
parentId: obj.id
})
obj.children = [...res.result]
floderList.value = [...floderList.value]
// 确保返回数据有效
res.result.forEach(o => {
if (o.izLeaf === 0) {
// 还有底层数据继续请求
getReportFolderStructure(o)
}
})
// 只需要在初始化时设置一次展开
if (defaultExpandList.value.length === 0) {
defaultExpandList.value = [floderList.value[0].id]
// 选中最外层文件夹
queryParams.reportType = floderList.value[0].id
}
}
getReportFolderStructure(floderList.value[0])
// 某行点击
const handleNodeClick = (row) => {
queryParams.reportType = row ? row.id : '0' // 文件夹 id 固定是 0(当不选择左侧文件夹默认查询所有)
getReportList()
}
/**************** 报表列表 ***************/
// 报表搜索
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
reportType: '', // 文件夹 ID
name: '', // 搜索名字字段
token: getToken()
})
const loading = ref(false)
const reportList = ref([])
const total = ref(0)
const getReportList = async () => {
loading.value = true
const res = await getDesignReportListAPI(queryParams)
loading.value = false
reportList.value = res.result.records
total.value = res.result.total
}
getReportList()
/********* 报表功能按钮 ***********/
// 新建报表
const handleAdd = async () => {
const res = await addReportAPI()
window.open(`${reportEditURL}/${res.result.id}?menuType=${queryParams.reportType}&token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
}
// 导入报表
const handleImport = () => {
proxy.chooseFile({
accept: '.json'
}).then(async file => {
// 在这里可以添加文件上传的逻辑
const formData = new FormData()
formData.append('file', file)
formData.append('type', queryParams.reportType)
const res = await importReportAPI(formData)
proxy.$modal.msgSuccess(res.result)
getReportList()
}).catch(err => {
proxy.$modal.msgError(err)
})
}
// 预览报表
const handlePreview = (row) => {
window.open(`${reportViewURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
}
// 修改报表
const handleEdit = (row) => {
window.open(`${reportEditURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
}
// 删除报表
const handleDelete = (row) => {
proxy.$modal.confirm('确定删除该报表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 调用删除接口
deleteReportAPI({
id: row.id,
token: getToken()
}).then(res => {
proxy.$modal.msgSuccess('删除成功')
getReportList()
}).catch(err => {
proxy.$modal.msgError(err.message)
})
})
}
// 复制报表
const handleCopy = (row) => {
// 确认提示框
proxy.$modal.confirm('确定复制该报表吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
copyReportAPI({
id: row.id,
token: getToken()
}).then(res => {
proxy.$modal.msgSuccess('复制成功')
getReportList()
}).catch(err => {
proxy.$modal.msgError(err.message)
})
})
}
</script>
<style scoped></style>
\ No newline at end of file
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</template> </template>
<script setup> <script setup>
import { enterOtherReportAPI, getReportFolderListAPI } from '@/api' import { enterOtherReportAPI, getReportFolderStructureAPI } from '@/api'
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
// 表单数据 // 表单数据
...@@ -98,7 +98,7 @@ const handleSubmit = async () => { ...@@ -98,7 +98,7 @@ const handleSubmit = async () => {
// 获取积木报表文件夹分组一级 // 获取积木报表文件夹分组一级
const deptList = ref([]) const deptList = ref([])
const getDeptList = async () => { const getDeptList = async () => {
const res = await getReportFolderListAPI() const res = await getReportFolderStructureAPI()
deptList.value = res.result deptList.value = res.result
} }
getDeptList() getDeptList()
......
<template>
<i-frame :src="openUrl"
id="jimuReportFrame"></i-frame>
</template>
<script setup>
// 报表设计器
import { getToken } from '@/utils/auth'
import iFrame from '@/components/iFrame/index'
// 获取 pinia 里保存的用户部门 id
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const openUrl = ref(`${import.meta.env.VITE_APP_REPORT_URL}/report/jmreport/list?token=` + getToken() + `&tenantId=${userStore.$state.userInfo.deptId}`)
</script>
<style lang="scss"
scoped>
#jimuReportFrame {
width: 100%;
// 为了隐藏积木报表顶部的广告栏
min-height: calc(100vh - 40px) !important;
margin-top: -45px;
}
</style>
\ No newline at end of file
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
@input="getReportList" /> @input="getReportList" />
</el-form-item> </el-form-item>
<el-form-item label="报表类目" <el-form-item label="报表类目"
prop="categoryName"> prop="categoryId">
<el-select v-model="queryParams.categoryName" <el-select v-model="queryParams.categoryId"
placeholder="选择报表类目" placeholder="选择报表类目"
clearable clearable
filterable filterable
...@@ -24,13 +24,9 @@ ...@@ -24,13 +24,9 @@
style="width: 240px"> style="width: 240px">
<el-option v-for="item in categoryList" <el-option v-for="item in categoryList"
:label="item.name" :label="item.name"
:value="item.name" /> :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<el-button icon="Refresh"
@click="resetQuery">重置</el-button>
</el-form-item>
</el-form> </el-form>
<!-- 表格数据 --> <!-- 表格数据 -->
...@@ -43,9 +39,7 @@ ...@@ -43,9 +39,7 @@
sortable> sortable>
<template #default="scope"> <template #default="scope">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-icon> <svg-icon icon-class="bg-document"></svg-icon>
<List color="green" />
</el-icon>
<span style="margin-left: 10px">{{ scope.row.name }}</span> <span style="margin-left: 10px">{{ scope.row.name }}</span>
</div> </div>
</template> </template>
...@@ -90,21 +84,18 @@ ...@@ -90,21 +84,18 @@
<script setup <script setup
name="Role"> name="Role">
import { getUserReportListAPI, selReportCategoryAPI } from "@/api" import { getReportListByUserAPI, selReportCategoryAPI } from "@/api"
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const reportBaseURL = import.meta.env.VITE_APP_REPORT_URL const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL
const { proxy } = getCurrentInstance()
/*************** 报表列表部分 ****************/ /*************** 报表列表部分 ****************/
// 报表搜索 // 报表搜索
const showSearch = ref(true) const showSearch = ref(true)
const queryParams = reactive({ const queryParams = reactive({
name: undefined, // 报表名称 name: undefined, // 报表名称
categoryName: undefined, // 报表类目 categoryId: undefined, // 报表类目
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}) })
...@@ -116,11 +107,6 @@ ...@@ -116,11 +107,6 @@
}) })
} }
getCategoryList() getCategoryList()
// 重置
function resetQuery() {
proxy.resetForm("queryRef")
getReportList()
}
// 获取报表列表 // 获取报表列表
const loading = ref(true) const loading = ref(true)
...@@ -129,17 +115,17 @@ ...@@ -129,17 +115,17 @@
// 查询报表列表 // 查询报表列表
function getReportList() { function getReportList() {
loading.value = true loading.value = true
getUserReportListAPI(queryParams).then(response => { getReportListByUserAPI(queryParams).then(response => {
reportList.value = response.data.rows reportList.value = response.data.rows
total.value = response.data.total
loading.value = false loading.value = false
total.value = response.data.total
}) })
} }
getReportList() getReportList()
// 点击某行报表 // 点击某行报表
function previewReport(row) { function previewReport(row) {
window.open(`${reportBaseURL}/report/jmreport/view/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`) window.open(`${reportViewURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
} }
</script> </script>
......
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
:value="item.id" /> :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item>
<el-button icon="Refresh"
@click="resetQuery">重置</el-button>
</el-form-item>
</el-form> </el-form>
<el-row :gutter="10" <el-row :gutter="10"
...@@ -42,8 +38,8 @@ ...@@ -42,8 +38,8 @@
:disabled="reportMultipleBtnDis" :disabled="reportMultipleBtnDis"
@click="handleAssign">分配用户</el-button> @click="handleAssign">分配用户</el-button>
</el-col> --> </el-col> -->
<right-toolbar v-model:showSearch="showSearch" <!-- <right-toolbar v-model:showSearch="showSearch"
@queryTable="getReportList"></right-toolbar> @queryTable="getReportList"></right-toolbar> -->
</el-row> </el-row>
<!-- 表格数据 --> <!-- 表格数据 -->
...@@ -59,9 +55,7 @@ ...@@ -59,9 +55,7 @@
sortable> sortable>
<template #default="scope"> <template #default="scope">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-icon> <svg-icon icon-class="bg-document"></svg-icon>
<List color="green" />
</el-icon>
<span style="margin-left: 10px">{{ scope.row.name }}</span> <span style="margin-left: 10px">{{ scope.row.name }}</span>
</div> </div>
</template> </template>
...@@ -96,7 +90,7 @@ ...@@ -96,7 +90,7 @@
placement="top"> placement="top">
<el-button link <el-button link
type="primary" type="primary"
icon="Reading" icon="User"
@click="handleAssign(scope.row)"></el-button> @click="handleAssign(scope.row)"></el-button>
</xl-tool-tip> </xl-tool-tip>
</template> </template>
...@@ -236,11 +230,6 @@ ...@@ -236,11 +230,6 @@
}) })
} }
getCategoryList() getCategoryList()
// 重置
function resetQuery() {
proxy.resetForm("queryRef")
getReportList()
}
// 批量分配报表 // 批量分配报表
const reportMultipleBtnDis = ref(true) // 是否多选报表 const reportMultipleBtnDis = ref(true) // 是否多选报表
......
...@@ -441,8 +441,6 @@ ...@@ -441,8 +441,6 @@
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import useAppStore from '@/store/modules/app' import useAppStore from '@/store/modules/app'
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelectList, getProCityAPI, openPromotionSystemAPI } from "@/api"; import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelectList, getProCityAPI, openPromotionSystemAPI } from "@/api";
// import { Splitpanes, Pane } from "splitpanes"
// import "splitpanes/dist/splitpanes.css"
const router = useRouter(); const router = useRouter();
const appStore = useAppStore() const appStore = useAppStore()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论