fix(X-Pack): [工作台]给角色分配了数据填报的权限后,如果不分配仪表板/大屏/数据源/数据集的权限时,填报人无法查看自己的填报任务

修改为默认直接展示“我的填报”
This commit is contained in:
ulleo 2024-11-19 17:17:45 +08:00
parent dfe57468f3
commit f7bdd0fb20

View File

@ -10,7 +10,7 @@ import dvDashboardSpineMobile from '@/assets/svg/dv-dashboard-spine-mobile.svg'
import icon_pc_outlined from '@/assets/svg/icon_pc_outlined.svg' import icon_pc_outlined from '@/assets/svg/icon_pc_outlined.svg'
import icon_cancel_store from '@/assets/svg/icon_cancel_store.svg' import icon_cancel_store from '@/assets/svg/icon_cancel_store.svg'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { ref, reactive, onMounted, computed } from 'vue' import { ref, reactive, onMounted, computed, watch } from 'vue'
import type { TabsPaneContext } from 'element-plus-secondary' import type { TabsPaneContext } from 'element-plus-secondary'
import GridTable from '@/components/grid-table/src/GridTable.vue' import GridTable from '@/components/grid-table/src/GridTable.vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@ -34,6 +34,7 @@ const appStore = useAppStoreWithOut()
const embeddedStore = useEmbedded() const embeddedStore = useEmbedded()
import { useShareStoreWithOut } from '@/store/modules/share' import { useShareStoreWithOut } from '@/store/modules/share'
import { cloneDeep } from 'lodash-es'
const shareStore = useShareStoreWithOut() const shareStore = useShareStoreWithOut()
const { push } = useRouter() const { push } = useRouter()
defineProps({ defineProps({
@ -89,8 +90,8 @@ const getBusiListWithPermission = () => {
busiFlagList.push(baseFlagList[parseInt(key)]) busiFlagList.push(baseFlagList[parseInt(key)])
} }
} }
tablePaneList.value[0].disabled = !busiFlagList?.length baseTablePaneList.value[0].disabled = !busiFlagList?.length
tablePaneList.value[1].disabled = baseTablePaneList.value[1].disabled =
!busiFlagList.includes('panel') && !busiFlagList.includes('screen') !busiFlagList.includes('panel') && !busiFlagList.includes('screen')
return busiFlagList return busiFlagList
} }
@ -141,17 +142,40 @@ const loadTableData = () => {
}) })
} }
const tablePaneList = ref([ const baseTablePaneList = ref([
{ title: t('work_branch.recently_used'), name: 'recent', disabled: false }, { title: t('work_branch.recently_used'), name: 'recent', disabled: false },
{ title: t('work_branch.my_collection'), name: 'store', disabled: false }, { title: t('work_branch.my_collection'), name: 'store', disabled: false },
{ title: t('visualization.share_out'), name: 'share', disabled: false } { title: t('visualization.share_out'), name: 'share', disabled: false }
]) ])
const dfTablePaneList = ref([])
const loadedDataFilling = data => { const loadedDataFilling = data => {
tablePaneList.value.push(data) dfTablePaneList.value.push(data)
} }
const busiAuthList = getBusiListWithPermission() const busiAuthList = getBusiListWithPermission()
const tablePaneList = computed(() => {
const list = cloneDeep(!!busiAuthList.length ? baseTablePaneList.value : [])
for (const valueElement of dfTablePaneList.value) {
list.push(valueElement)
}
return list
})
const firstChangeActiveName = ref(false)
watch(
() => tablePaneList.value.length,
(v1, v2) => {
if (tablePaneList.value.length > 0 && !firstChangeActiveName.value) {
firstChangeActiveName.value = true
activeName.value = tablePaneList.value[0].name
}
}
)
onMounted(() => { onMounted(() => {
!!busiAuthList.length && !!busiAuthList.length &&
handleClick({ handleClick({
@ -251,7 +275,7 @@ const getEmptyDesc = (): string => {
<div <div
class="dashboard-type" class="dashboard-type"
:class="expand && 'expand'" :class="expand && 'expand'"
v-if="busiAuthList.length" v-if="tablePaneList.length"
v-loading="loading" v-loading="loading"
> >
<el-tabs v-model="activeName" class="dashboard-type-tabs" @tab-click="handleClick"> <el-tabs v-model="activeName" class="dashboard-type-tabs" @tab-click="handleClick">
@ -276,163 +300,166 @@ const getEmptyDesc = (): string => {
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<share-grid v-if="!shareDisable" :active-name="activeName" @set-loading="setLoading" /> <template v-if="busiAuthList.length">
<el-row v-if="activeName === 'recent' || activeName === 'store'"> <share-grid v-if="!shareDisable" :active-name="activeName" @set-loading="setLoading" />
<el-col :span="12"> <el-row v-if="activeName === 'recent' || activeName === 'store'">
<el-select <el-col :span="12">
popper-class="menu-panel-select_popper" <el-select
class="select-type-list" popper-class="menu-panel-select_popper"
v-model="activeCommand" class="select-type-list"
@change="loadTableData" v-model="activeCommand"
> @change="loadTableData"
<el-option >
v-for="item in state.curTypeList" <el-option
:key="item" v-for="item in state.curTypeList"
:label="t(`auth.${item}`)" :key="item"
:value="item" :label="t(`auth.${item}`)"
/> :value="item"
</el-select> />
</el-col> </el-select>
<el-col class="search" :span="12"> </el-col>
<el-input <el-col class="search" :span="12">
v-model="panelKeyword" <el-input
clearable v-model="panelKeyword"
@change="triggerFilterPanel" clearable
:placeholder="t('work_branch.search_keyword')" @change="triggerFilterPanel"
> :placeholder="t('work_branch.search_keyword')"
<template #prefix> >
<el-icon> <template #prefix>
<Icon name="icon_search-outline_outlined" <el-icon>
><icon_searchOutline_outlined class="svg-icon" <Icon name="icon_search-outline_outlined"
/></Icon> ><icon_searchOutline_outlined class="svg-icon"
</el-icon> /></Icon>
</template>
</el-input>
</el-col>
</el-row>
<div v-if="activeName === 'recent' || activeName === 'store'" class="panel-table">
<GridTable
:show-pagination="false"
:table-data="state.tableData"
@sort-change="sortChange"
@cell-click="handleCellClick"
:empty-desc="emptyDesc"
:empty-img="imgType"
class="workbranch-grid"
>
<el-table-column key="name" width="280" prop="name" :label="t('common.name')">
<template v-slot:default="scope">
<div class="name-content" :class="{ 'jump-active': jumpActiveCheck(scope.row) }">
<el-icon v-if="scope.row.extFlag" style="margin-right: 12px; font-size: 18px">
<Icon
><component class="svg-icon" :is="iconMap[scope.row.type + 'Mobile']"></component
></Icon>
</el-icon> </el-icon>
<el-icon v-else :class="`main-color color-${scope.row.type}`">
<Icon><component class="svg-icon" :is="iconMap[scope.row.type]"></component></Icon>
</el-icon>
<el-tooltip placement="top">
<template #content>{{ scope.row.name }}</template>
<span class="ellipsis" style="max-width: 250px">{{ scope.row.name }}</span>
</el-tooltip>
<el-icon
v-if="activeName === 'recent' && ['screen', 'panel'].includes(scope.row.type)"
class="custom-icon"
@click.stop="executeStore(scope.row)"
:style="{ color: scope.row.favorite ? '#FFC60A' : '#646A73' }"
>
<icon
><component
:is="scope.row.favorite ? visualStar : icon_collection_outlined"
></component
></icon>
</el-icon>
</div>
</template>
</el-table-column>
<el-table-column
v-for="item in state.tableColumn"
:key="item.label"
:prop="item.field"
show-overflow-tooltip
:sortable="item.type === 'time'"
:label="item.label"
>
<template #default="scope">
<span :class="{ 'jump-active': jumpActiveCheck(scope.row) }">
<span v-if="item.type && item.type === 'time'">{{
formatterTime(null, null, scope.row[item.field])
}}</span>
<span v-else-if="item.field && item.field === 'type'">{{
typeMap[scope.row[item.field]]
}}</span>
<span v-else-if="desktop && item.field && item.field.endsWith('tor')">{{
userStore.getName
}}</span>
<span v-else>{{ scope.row[item.field] }}</span>
</span>
</template>
</el-table-column>
<el-table-column width="100" fixed="right" key="_operation" :label="$t('common.operate')">
<template #default="scope">
<template v-if="['dashboard', 'dataV', 'panel', 'screen'].includes(scope.row.type)">
<el-tooltip
effect="dark"
:content="t('work_branch.new_page_preview')"
placement="top"
>
<el-icon
class="hover-icon hover-icon-in-table"
@click.stop="
preview(activeName === 'recent' ? scope.row.id : scope.row.resourceId)
"
>
<Icon name="icon_pc_outlined"><icon_pc_outlined class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
<ShareHandler
v-if="!shareDisable"
:in-grid="true"
:weight="scope.row.weight"
:resource-id="activeName === 'recent' ? scope.row.id : scope.row.resourceId"
:resource-type="scope.row.type"
/>
<el-tooltip
v-if="activeName === 'store'"
effect="dark"
:content="t('work_branch.cancel_favorites')"
placement="top"
>
<el-icon
class="hover-icon hover-icon-in-table"
@click.stop="executeCancelStore(scope.row)"
>
<Icon name="icon_cancel_store"><icon_cancel_store class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
</template> </template>
</el-input>
<template v-if="['dataset'].includes(scope.row.type)"> </el-col>
<el-tooltip effect="dark" :content="t('work_branch.open_dataset')" placement="top"> </el-row>
<el-icon <div v-if="activeName === 'recent' || activeName === 'store'" class="panel-table">
class="hover-icon hover-icon-in-table" <GridTable
@click.stop=" :show-pagination="false"
openDataset(activeName === 'recent' ? scope.row.id : scope.row.resourceId) :table-data="state.tableData"
" @sort-change="sortChange"
> @cell-click="handleCellClick"
<Icon name="icon_pc_outlined"><icon_pc_outlined class="svg-icon" /></Icon> :empty-desc="emptyDesc"
:empty-img="imgType"
class="workbranch-grid"
>
<el-table-column key="name" width="280" prop="name" :label="t('common.name')">
<template v-slot:default="scope">
<div class="name-content" :class="{ 'jump-active': jumpActiveCheck(scope.row) }">
<el-icon v-if="scope.row.extFlag" style="margin-right: 12px; font-size: 18px">
<Icon
><component
class="svg-icon"
:is="iconMap[scope.row.type + 'Mobile']"
></component
></Icon>
</el-icon> </el-icon>
</el-tooltip> <el-icon v-else :class="`main-color color-${scope.row.type}`">
<Icon
><component class="svg-icon" :is="iconMap[scope.row.type]"></component
></Icon>
</el-icon>
<el-tooltip placement="top">
<template #content>{{ scope.row.name }}</template>
<span class="ellipsis" style="max-width: 250px">{{ scope.row.name }}</span>
</el-tooltip>
<el-icon
v-if="activeName === 'recent' && ['screen', 'panel'].includes(scope.row.type)"
class="custom-icon"
@click.stop="executeStore(scope.row)"
:style="{ color: scope.row.favorite ? '#FFC60A' : '#646A73' }"
>
<icon
><component
:is="scope.row.favorite ? visualStar : icon_collection_outlined"
></component
></icon>
</el-icon>
</div>
</template> </template>
</template> </el-table-column>
</el-table-column> <el-table-column
</GridTable> v-for="item in state.tableColumn"
</div> :key="item.label"
<XpackComponent :prop="item.field"
jsname="L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5l" show-overflow-tooltip
@loaded="loadedDataFilling" :sortable="item.type === 'time'"
/> :label="item.label"
>
<template #default="scope">
<span :class="{ 'jump-active': jumpActiveCheck(scope.row) }">
<span v-if="item.type && item.type === 'time'">{{
formatterTime(null, null, scope.row[item.field])
}}</span>
<span v-else-if="item.field && item.field === 'type'">{{
typeMap[scope.row[item.field]]
}}</span>
<span v-else-if="desktop && item.field && item.field.endsWith('tor')">{{
userStore.getName
}}</span>
<span v-else>{{ scope.row[item.field] }}</span>
</span>
</template>
</el-table-column>
<el-table-column width="100" fixed="right" key="_operation" :label="$t('common.operate')">
<template #default="scope">
<template v-if="['dashboard', 'dataV', 'panel', 'screen'].includes(scope.row.type)">
<el-tooltip
effect="dark"
:content="t('work_branch.new_page_preview')"
placement="top"
>
<el-icon
class="hover-icon hover-icon-in-table"
@click.stop="
preview(activeName === 'recent' ? scope.row.id : scope.row.resourceId)
"
>
<Icon name="icon_pc_outlined"><icon_pc_outlined class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
<ShareHandler
v-if="!shareDisable"
:in-grid="true"
:weight="scope.row.weight"
:resource-id="activeName === 'recent' ? scope.row.id : scope.row.resourceId"
:resource-type="scope.row.type"
/>
<el-tooltip
v-if="activeName === 'store'"
effect="dark"
:content="t('work_branch.cancel_favorites')"
placement="top"
>
<el-icon
class="hover-icon hover-icon-in-table"
@click.stop="executeCancelStore(scope.row)"
>
<Icon name="icon_cancel_store"><icon_cancel_store class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
</template>
<template v-if="['dataset'].includes(scope.row.type)">
<el-tooltip effect="dark" :content="t('work_branch.open_dataset')" placement="top">
<el-icon
class="hover-icon hover-icon-in-table"
@click.stop="
openDataset(activeName === 'recent' ? scope.row.id : scope.row.resourceId)
"
>
<Icon name="icon_pc_outlined"><icon_pc_outlined class="svg-icon" /></Icon>
</el-icon>
</el-tooltip>
</template>
</template>
</el-table-column>
</GridTable>
</div>
</template>
<XpackComponent <XpackComponent
jsname="L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5lVGFibGU=" jsname="L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5lVGFibGU="
v-if="activeName === 'data-filling'" v-if="activeName === 'data-filling'"
@ -443,6 +470,10 @@ const getEmptyDesc = (): string => {
v-else v-else
:description="t('work_branch.administrator_for_authorization')" :description="t('work_branch.administrator_for_authorization')"
/> />
<XpackComponent
jsname="L21lbnUvZGF0YS9kYXRhLWZpbGxpbmcvZmlsbC9UYWJQYW5l"
@loaded="loadedDataFilling"
/>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>