mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
perf(X-Pack): 仪表板导出权限页面控制
This commit is contained in:
parent
dae7d6c021
commit
8eb801dbc0
@ -124,7 +124,8 @@
|
||||
v-if="
|
||||
!['picture-group', 'rich-text'].includes(element.innerType) &&
|
||||
barShowCheck('download') &&
|
||||
showDownload
|
||||
showDownload &&
|
||||
(exportPermissions[0] || exportPermissions[1])
|
||||
"
|
||||
@click.prevent
|
||||
>
|
||||
@ -138,14 +139,18 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu style="width: 120px">
|
||||
<el-dropdown-item @click="exportAsExcel">Excel</el-dropdown-item>
|
||||
<el-dropdown-item v-if="exportPermissions[1]" @click="exportAsExcel"
|
||||
>Excel</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
v-if="element.innerType === 'table-pivot'"
|
||||
v-if="exportPermissions[1] && element.innerType === 'table-pivot'"
|
||||
@click="exportAsFormattedExcel"
|
||||
>
|
||||
<span>Excel(带格式)</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="exportAsImage">图片</el-dropdown-item>
|
||||
<el-dropdown-item v-if="exportPermissions[0]" @click="exportAsImage"
|
||||
>图片</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -169,7 +174,8 @@
|
||||
!['picture-group', 'rich-text'].includes(element.innerType) &&
|
||||
barShowCheck('previewDownload') &&
|
||||
authShow &&
|
||||
showDownload
|
||||
showDownload &&
|
||||
(exportPermissions[0] || exportPermissions[1])
|
||||
"
|
||||
>
|
||||
<el-icon @click="downloadClick" class="bar-base-icon">
|
||||
@ -179,14 +185,18 @@
|
||||
</el-icon>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu style="width: 118px">
|
||||
<el-dropdown-item @click="exportAsExcel">Excel</el-dropdown-item>
|
||||
<el-dropdown-item @click="exportAsExcel" v-if="exportPermissions[1]"
|
||||
>Excel</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
v-if="element.innerType === 'table-pivot'"
|
||||
v-if="exportPermissions[1] && element.innerType === 'table-pivot'"
|
||||
@click="exportAsFormattedExcel"
|
||||
>
|
||||
<span>Excel(带格式)</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="exportAsImage">图片</el-dropdown-item>
|
||||
<el-dropdown-item v-if="exportPermissions[0]" @click="exportAsImage"
|
||||
>图片</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -227,11 +237,15 @@ import { ElMessage, ElTooltip, ElButton } from 'element-plus-secondary'
|
||||
import CustomTabsSort from '@/custom-component/de-tabs/CustomTabsSort.vue'
|
||||
import { exportPivotExcel } from '@/views/chart/components/js/panel/common/common_table'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import { exportPermission } from '@/utils/utils'
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const snapshotStore = snapshotStoreWithOut()
|
||||
const copyStore = copyStoreWithOut()
|
||||
const customTabsSortRef = ref(null)
|
||||
const authShow = computed(() => !dvInfo.value.weight || dvInfo.value.weight > 3)
|
||||
const exportPermissions = computed(() =>
|
||||
exportPermission(dvInfo.value['weight'], dvInfo.value['ext'])
|
||||
)
|
||||
const emits = defineEmits([
|
||||
'userViewEnlargeOpen',
|
||||
'datasetParamsInit',
|
||||
|
@ -9,7 +9,7 @@
|
||||
>
|
||||
<div class="export-button">
|
||||
<el-select
|
||||
v-if="optType === 'enlarge' && authShow"
|
||||
v-if="optType === 'enlarge' && exportPermissions[0]"
|
||||
v-model="pixel"
|
||||
class="pixel-select"
|
||||
size="small"
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
<el-button
|
||||
class="m-button"
|
||||
v-if="optType === 'enlarge' && authShow"
|
||||
v-if="optType === 'enlarge' && exportPermissions[0]"
|
||||
link
|
||||
icon="Download"
|
||||
size="middle"
|
||||
@ -36,7 +36,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
class="m-button"
|
||||
v-if="optType === 'details' && authShow"
|
||||
v-if="optType === 'details' && exportPermissions[1]"
|
||||
link
|
||||
icon="Download"
|
||||
size="middle"
|
||||
@ -50,7 +50,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
class="m-button"
|
||||
v-if="optType === 'details' && authShow"
|
||||
v-if="optType === 'details' && exportPermissions[2]"
|
||||
link
|
||||
icon="Download"
|
||||
size="middle"
|
||||
@ -64,7 +64,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
class="m-button"
|
||||
v-if="optType === 'details' && authShow && viewInfo.type === 'table-pivot'"
|
||||
v-if="optType === 'details' && exportPermissions[2] && viewInfo.type === 'table-pivot'"
|
||||
link
|
||||
icon="Download"
|
||||
size="middle"
|
||||
@ -150,6 +150,7 @@ import { useRequestStoreWithOut } from '@/store/modules/request'
|
||||
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
||||
import { activeWatermarkCheckUser } from '@/components/watermark/watermark'
|
||||
import { getCanvasStyle } from '@/utils/style'
|
||||
import { exportPermission } from '@/utils/utils'
|
||||
const downLoading = ref(false)
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const dialogShow = ref(false)
|
||||
@ -167,7 +168,6 @@ const { dvInfo, editMode } = storeToRefs(dvMainStore)
|
||||
const exportLoading = ref(false)
|
||||
const sourceViewType = ref()
|
||||
const activeName = ref('left')
|
||||
const userInfo = ref(null)
|
||||
const DETAIL_CHART_ATTR: DeepPartial<ChartObj> = {
|
||||
render: 'antv',
|
||||
type: 'table-info',
|
||||
@ -214,6 +214,10 @@ const DETAIL_TABLE_ATTR: DeepPartial<ChartObj> = {
|
||||
|
||||
const authShow = computed(() => editMode.value === 'edit' || dvInfo.value.weight > 3)
|
||||
|
||||
const exportPermissions = computed(() =>
|
||||
exportPermission(dvInfo.value['weight'], dvInfo.value['ext'])
|
||||
)
|
||||
|
||||
const customExport = computed(() => {
|
||||
const style =
|
||||
canvasStyleData.value &&
|
||||
|
@ -188,3 +188,29 @@ export const isLink = () => {
|
||||
export const isNull = arg => {
|
||||
return typeof arg === 'undefined' || arg === null || arg === 'null'
|
||||
}
|
||||
|
||||
export const exportPermission = (weight, ext) => {
|
||||
const result = [0, 0, 0]
|
||||
if (!weight || weight === 1) {
|
||||
return result
|
||||
} else if (weight === 9) {
|
||||
return [1, 1, 1]
|
||||
}
|
||||
if (!ext) {
|
||||
return result
|
||||
}
|
||||
const extArray = formatExt(ext) || []
|
||||
for (let index = 0; index < extArray.length; index++) {
|
||||
result[index] = extArray[index]
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export const formatExt = (num: number): number[] | null => {
|
||||
if (!num) {
|
||||
return null
|
||||
}
|
||||
const reversedStr = num.toString().split('').reverse().join('')
|
||||
const reversedNumArray = reversedStr?.split('')?.map(Number) ?? []
|
||||
return reversedNumArray
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import ShareVisualHead from '@/views/share/share/ShareVisualHead.vue'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { useShareStoreWithOut } from '@/store/modules/share'
|
||||
import { exportPermission } from '@/utils/utils'
|
||||
const shareStore = useShareStoreWithOut()
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
@ -37,7 +38,9 @@ const preview = () => {
|
||||
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
||||
const isIframe = computed(() => appStore.getIsIframe)
|
||||
const shareDisable = computed(() => shareStore.getShareDisable)
|
||||
|
||||
const exportPermissions = computed(() =>
|
||||
exportPermission(dvInfo.value['weight'], dvInfo.value['ext'])
|
||||
)
|
||||
const reload = () => {
|
||||
emit('reload', dvInfo.value.id)
|
||||
}
|
||||
@ -197,7 +200,7 @@ const initOpenHandler = newWindow => {
|
||||
<el-dropdown-item style="width: 118px" @click="downloadAsAppTemplate('app')">{{
|
||||
t('visualization.apply_template')
|
||||
}}</el-dropdown-item>
|
||||
<el-dropdown-item @click="download('img')">{{
|
||||
<el-dropdown-item v-if="exportPermissions[0]" @click="download('img')">{{
|
||||
t('chart.image')
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
@ -70,7 +70,7 @@ function createNew() {
|
||||
resourceTreeRef.value?.createNewObject()
|
||||
}
|
||||
|
||||
const loadCanvasData = (dvId, weight?) => {
|
||||
const loadCanvasData = (dvId, weight?, ext?) => {
|
||||
const initMethod = props.showPosition === 'multiplexing' ? initCanvasDataPrepare : initCanvasData
|
||||
dataInitState.value = false
|
||||
initMethod(
|
||||
@ -84,6 +84,7 @@ const loadCanvasData = (dvId, weight?) => {
|
||||
curPreviewGap
|
||||
}) {
|
||||
dvInfo['weight'] = weight
|
||||
dvInfo['ext'] = ext || 0
|
||||
state.canvasDataPreview = canvasDataResult
|
||||
state.canvasStylePreview = canvasStyleResult
|
||||
state.canvasViewInfoPreview = canvasViewInfoPreview
|
||||
@ -162,11 +163,11 @@ const slideOpenChange = () => {
|
||||
}
|
||||
|
||||
const reload = id => {
|
||||
loadCanvasData(id, state.dvInfo.weight)
|
||||
loadCanvasData(id, state.dvInfo.weight, state.dvInfo.ext)
|
||||
}
|
||||
|
||||
const resourceNodeClick = data => {
|
||||
loadCanvasData(data.id, data.weight)
|
||||
loadCanvasData(data.id, data.weight, data.ext)
|
||||
}
|
||||
|
||||
const state = reactive({
|
||||
|
@ -171,6 +171,8 @@ public class DataVisualizationVO implements Serializable {
|
||||
*/
|
||||
private Integer weight;
|
||||
|
||||
private int ext;
|
||||
|
||||
/**
|
||||
* 应用信息
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user