提交 7c1dcb3e authored 作者: lidongxu's avatar lidongxu

Merge branch 'jimu' into release

...@@ -16,9 +16,11 @@ VITE_APP_REDIRECT_URL = 'http://localhost:8085' ...@@ -16,9 +16,11 @@ 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_PREVIEW_URL = '/report/jmreport/view'
# 积木报表分享预览地址
VITE_APP_REPORT_SHARE_PREVIEW_URL = '/report'
# 积木报表编辑地址 # 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = 'https://sfa-qa.wxl66.cn/report/jmreport/index' 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'
...@@ -16,6 +16,8 @@ VITE_APP_REDIRECT_URL = 'https://sfa.wxl66.cn/link/' ...@@ -16,6 +16,8 @@ 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_PREVIEW_URL = '/report/jmreport/view'
# 积木报表分享预览地址
VITE_APP_REPORT_SHARE_PREVIEW_URL = '/report'
# 积木报表编辑地址 # 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index' VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index'
......
...@@ -15,6 +15,8 @@ VITE_APP_REDIRECT_URL = 'https://sfa-qa.wxl66.cn/' ...@@ -15,6 +15,8 @@ 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_PREVIEW_URL = '/report/jmreport/view'
# 积木报表分享预览地址
VITE_APP_REPORT_SHARE_PREVIEW_URL = '/report'
# 积木报表编辑地址 # 积木报表编辑地址
VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index' VITE_APP_REPORT_EDIT_URL = '/report/jmreport/index'
......
...@@ -54,3 +54,22 @@ export function importReportAPI(data) { ...@@ -54,3 +54,22 @@ export function importReportAPI(data) {
} }
}) })
} }
// 查询分享报表连接
export function selShareReportAPI(params) {
return request({
url: `/report/jmreport/share/queryJurisdiction`,
params
})
}
// 创建/编辑分享链接参数
export function addOrEditShareReportAPI(data) {
return request({
url: `/report/jmreport/share/addAndEdit`,
method: 'POST',
data
})
}
...@@ -60,7 +60,9 @@ ...@@ -60,7 +60,9 @@
<template #default="{ row }"> <template #default="{ row }">
<div> <div>
<svg-icon icon-class="bg-document"></svg-icon> <svg-icon icon-class="bg-document"></svg-icon>
<span style="margin-left: 10px">{{ row.name }}</span> <el-link :href="getReportPreviewUrl(row)"
target="_blank"
style="margin-left: 10px">{{ row.name }}</el-link>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -69,12 +71,12 @@ ...@@ -69,12 +71,12 @@
align="left" align="left"
width="200"> width="200">
<template #default="scope"> <template #default="scope">
<xl-tool-tip content="预览报表" <xl-tool-tip content="分享报表"
placement="top"> placement="top">
<el-button link <el-button link
type="primary" type="primary"
icon="View" icon="Share"
@click="handlePreview(scope.row)"></el-button> @click="handleShare(scope.row)"></el-button>
</xl-tool-tip> </xl-tool-tip>
<xl-tool-tip content="修改" <xl-tool-tip content="修改"
placement="top"> placement="top">
...@@ -108,6 +110,50 @@ ...@@ -108,6 +110,50 @@
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
@pagination="getReportList" /> @pagination="getReportList" />
</el-col> </el-col>
<!-- 新增/编辑分享弹窗 -->
<el-dialog title="创建分享链接"
v-model="dialogVisible">
<div v-if="shareReportUrl">
<el-form-item label="分享链接">
<el-input v-model="shareReportUrl"
style="width: 80%; margin-right: 20px;"
placeholder="分享链接" />
<el-button type="primary"
v-copyText="shareReportUrl"
v-copyText:callback="copyTextSuccess">复制链接剪切板</el-button>
</el-form-item>
</div>
<div v-else>
<el-form label-width="180px"
v-model="shareForm">
<el-form-item label="过期时间">
<el-radio-group v-model="shareForm.termOfValidity">
<el-radio value="1">永久有效</el-radio>
<el-radio value="2">7天</el-radio>
<el-radio value="3">1天</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="是否开启密码">
<el-radio-group v-model="shareForm.isPasswordEnabled">
<el-radio label="否">否</el-radio>
<el-radio label="是">是</el-radio>
</el-radio-group>
</el-form-item> -->
<!-- <el-form-item label="是否检验分享token">
<el-switch v-model="shareForm.isCheckToken" />
</el-form-item> -->
</el-form>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary"
@click="handleConfirm">确认</el-button>
</span>
</template>
</el-dialog>
</el-row> </el-row>
</div> </div>
</div> </div>
...@@ -115,12 +161,14 @@ ...@@ -115,12 +161,14 @@
<script setup> <script setup>
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { getReportFolderStructureAPI, getDesignReportListAPI, deleteReportAPI, copyReportAPI, addReportAPI, importReportAPI } from '@/api' import { getReportFolderStructureAPI, getDesignReportListAPI, deleteReportAPI, copyReportAPI, addReportAPI, importReportAPI, selShareReportAPI, addOrEditShareReportAPI } from '@/api'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
const reportBaseDomain = import.meta.env.VITE_APP_REPORT_URL // 基础域名
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览 const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览
const reportShareViewURL = import.meta.env.VITE_APP_REPORT_SHARE_PREVIEW_URL // 分享预览
const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑 const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑
/************ 文件夹分组 ********************/ /************ 文件夹分组 ********************/
...@@ -187,13 +235,16 @@ const getReportList = async () => { ...@@ -187,13 +235,16 @@ const getReportList = async () => {
total.value = res.result.total total.value = res.result.total
} }
getReportList() getReportList()
// 报表预览地址
const getReportPreviewUrl = (row) => {
return `${reportBaseDomain}${reportShareViewURL}${row.shareViewUrl}`
}
/********* 报表功能按钮 ***********/ /********* 报表功能按钮 ***********/
// 新建报表 // 新建报表
const handleAdd = async () => { const handleAdd = async () => {
const res = await addReportAPI() const res = await addReportAPI()
window.open(`${reportEditURL}/${res.result.id}?menuType=${queryParams.reportType}&token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`) window.open(`${reportBaseDomain}${reportEditURL}/${res.result.id}?menuType=${queryParams.reportType}&token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
} }
// 导入报表 // 导入报表
const handleImport = () => { const handleImport = () => {
...@@ -206,19 +257,68 @@ const handleImport = () => { ...@@ -206,19 +257,68 @@ const handleImport = () => {
formData.append('type', queryParams.reportType) formData.append('type', queryParams.reportType)
const res = await importReportAPI(formData) const res = await importReportAPI(formData)
proxy.$modal.msgSuccess(res.result) proxy.$modal.msgSuccess(res.result)
getReportList() getReportList()
}).catch(err => { }).catch(err => {
proxy.$modal.msgError(err) proxy.$modal.msgError(err)
}) })
} }
// 预览报表
const handlePreview = (row) => { // 分享报表
window.open(`${reportViewURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`) const shareReportUrl = ref('') // 分享报表地址链接
const dialogVisible = ref(false)
const nowShareRow = ref(null) // 当前分享报表数据对象
const shareForm = reactive({
termOfValidity: '1', // 1:永久有效 2:7天 3:1天
// isPasswordEnabled: '否',
verifyShareToken: true
})
const handleShare = async (row) => {
const res = await selShareReportAPI({
reportId: row.id
})
shareReportUrl.value = res.result?.previewUrl ? reportBaseDomain + reportShareViewURL + res.result?.previewUrl : ''
nowShareRow.value = row
dialogVisible.value = true
}
// 确认分享
const handleConfirm = async () => {
if (shareReportUrl.value) {
dialogVisible.value = false
return
}
const res = await addOrEditShareReportAPI({
id: nowShareRow.value.id,
lastUpdateTime: new Date().getTime(),
previewLock: "",
previewLockStatus: "0",
previewUrl: "",
reportId: nowShareRow.value.id,
shareToken: Math.random().toString(36).substring(2),
status: "0",
termOfValidity: shareForm.termOfValidity,
verifyShareToken: shareForm.verifyShareToken ? '1' : '0'
})
shareReportUrl.value = reportBaseDomain + reportShareViewURL + res.result?.previewUrl
// 将分享链接复制到剪贴板
const input = document.createElement('input')
input.setAttribute('value', shareReportUrl.value)
document.body.appendChild(input)
input.select()
document.execCommand('copy')
document.body.removeChild(input)
proxy.$modal.msgSuccess('链接已复制到剪切板')
dialogVisible.value = false
}
// 点击分享地址复制
function copyTextSuccess() {
proxy.$modal.msgSuccess('链接已复制到剪切板')
} }
// 修改报表 // 修改报表
const handleEdit = (row) => { const handleEdit = (row) => {
window.open(`${reportEditURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`) window.open(`${reportBaseDomain}${reportEditURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`)
} }
// 删除报表 // 删除报表
const handleDelete = (row) => { const handleDelete = (row) => {
......
...@@ -37,18 +37,26 @@ ...@@ -37,18 +37,26 @@
prop="name" prop="name"
align="left" align="left"
sortable> sortable>
<template #default="scope"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<svg-icon icon-class="bg-document"></svg-icon> <svg-icon icon-class="bg-document"></svg-icon>
<span style="margin-left: 10px">{{ scope.row.name }}</span> <el-link :href="reportBaseDomain + reportShareViewURL + row.previewUrl"
target="_blank"
style="margin-left: 10px">{{ row.name }}</el-link>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="报表类目"
key="categoryName"
prop="categoryName"
align="left"
width="120"
sortable />
<el-table-column label="创建人" <el-table-column label="创建人"
key="createBy" key="createBy"
prop="createBy" prop="createBy"
align="left" align="left"
width="180" width="120"
sortable /> sortable />
<el-table-column label="创建时间" <el-table-column label="创建时间"
prop="createTime" prop="createTime"
...@@ -59,16 +67,31 @@ ...@@ -59,16 +67,31 @@
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否被分享"
key="hasShare"
prop="hasShare"
align="center"
width="120"
sortable>
<!-- 使用 tag 标记颜色 -->
<template #default="{ row }">
<el-tag :type="row.hasShare === 1 ? 'success' : 'danger'">{{ row.hasShare === 1 ? '是' : '否' }}</el-tag>
</template>
</el-table-column>
<!-- 操作预览 --> <!-- 操作预览 -->
<el-table-column label="操作" <el-table-column label="操作"
key="operation" key="operation"
align="center" align="center"
width="180"> width="120">
<template #default="scope"> <template #default="scope">
<el-button link <el-tooltip content="复制报表地址">
type="primary" <el-button text
icon="Reading" type="primary"
@click="previewReport(scope.row)">预览</el-button> icon="Share"
v-copyText="reportBaseDomain + reportShareViewURL + scope.row.previewUrl"
v-copyText:callback="copyTextSuccess" />
</el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -88,8 +111,12 @@ ...@@ -88,8 +111,12 @@
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL const reportBaseDomain = import.meta.env.VITE_APP_REPORT_URL // 基础域名
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览
const reportShareViewURL = import.meta.env.VITE_APP_REPORT_SHARE_PREVIEW_URL // 分享预览
const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑
/*************** 报表列表部分 ****************/ /*************** 报表列表部分 ****************/
// 报表搜索 // 报表搜索
const showSearch = ref(true) const showSearch = ref(true)
...@@ -124,12 +151,10 @@ ...@@ -124,12 +151,10 @@
getReportList() getReportList()
// 点击某行报表 // 点击某行报表
function previewReport(row) { function copyTextSuccess() {
window.open(`${reportViewURL}/${row.id}?token=${getToken()}&tenantId=${userStore.$state.userInfo.deptId}`) proxy.$modal.msgSuccess('链接已复制到剪切板')
} }
</script> </script>
<style scoped <style scoped
lang="scss"> lang="scss"></style>
\ No newline at end of file
</style>
\ No newline at end of file
...@@ -53,10 +53,12 @@ ...@@ -53,10 +53,12 @@
prop="name" prop="name"
align="left" align="left"
sortable> sortable>
<template #default="scope"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<svg-icon icon-class="bg-document"></svg-icon> <svg-icon icon-class="bg-document"></svg-icon>
<span style="margin-left: 10px">{{ scope.row.name }}</span> <el-link :href="getReportPreviewUrl(row)"
target="_blank"
style="margin-left: 10px">{{ row.name }}</el-link>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -212,6 +214,10 @@ ...@@ -212,6 +214,10 @@
import { selReportListAPI, selReportCategoryAPI, deptTreeSelectList, listUser, batchAuthReportAPI, selReportAuthUserListAPI } from "@/api" import { selReportListAPI, selReportCategoryAPI, deptTreeSelectList, listUser, batchAuthReportAPI, selReportAuthUserListAPI } from "@/api"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const reportBaseDomain = import.meta.env.VITE_APP_REPORT_URL // 基础域名
const reportViewURL = import.meta.env.VITE_APP_REPORT_PREVIEW_URL // 预览
const reportShareViewURL = import.meta.env.VITE_APP_REPORT_SHARE_PREVIEW_URL // 分享预览
const reportEditURL = import.meta.env.VITE_APP_REPORT_EDIT_URL // 新增/编辑
/*************** 报表列表部分 ****************/ /*************** 报表列表部分 ****************/
// 报表搜索 // 报表搜索
...@@ -253,6 +259,10 @@ ...@@ -253,6 +259,10 @@
}) })
} }
getReportList() getReportList()
// 报表预览地址
const getReportPreviewUrl = (row) => {
return `${reportBaseDomain}${reportShareViewURL}${row.previewUrl}`
}
/**************** 分配用户 ****************/ /**************** 分配用户 ****************/
const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论