forked from github/dataease
Merge pull request #7034 from dataease/pr@dev@refactor_template-auth
refactor: 模版中心增加权限校验
This commit is contained in:
commit
d81f3a7b9b
@ -1,4 +1,4 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4 2.66666C4 1.93028 4.59695 1.33333 5.33333 1.33333H21.1477C21.3265 1.33333 21.4979 1.40515 21.6232 1.53267L27.8088 7.82587C27.9313 7.95055 28 8.11838 28 8.2932V29.3333C28 30.0697 27.403 30.6667 26.6667 30.6667H5.33333C4.59695 30.6667 4 30.0697 4 29.3333V2.66666Z" fill="#FF8800"/>
|
||||
<path d="M9.33398 11.3333C9.33398 10.9651 9.63246 10.6667 10.0007 10.6667H22.0007C22.3688 10.6667 22.6673 10.9651 22.6673 11.3333V12.6667C22.6673 13.0349 22.3688 13.3333 22.0007 13.3333H10.0007C9.63246 13.3333 9.33398 13.0349 9.33398 12.6667V11.3333Z" fill="white"/>
|
||||
<path d="M14.6673 16.6667C14.6673 16.2985 14.9658 16 15.334 16H22.0007C22.3688 16 22.6673 16.2985 22.6673 16.6667V23.3333C22.6673 23.7015 22.3688 24 22.0007 24H15.334C14.9658 24 14.6673 23.7015 14.6673 23.3333V16.6667Z" fill="white"/>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@ -18,6 +18,7 @@
|
||||
:base-url="baseUrl"
|
||||
:width="templateCurWidth"
|
||||
:cur-position="curPosition"
|
||||
:create-auth="createAuth"
|
||||
@templateApply="templateApply"
|
||||
@templatePreview="templatePreview"
|
||||
/>
|
||||
@ -67,6 +68,15 @@ const props = defineProps({
|
||||
fullTemplateShowList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
createAuth: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
PANEL: false,
|
||||
SCREEN: false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
@ -101,12 +101,13 @@
|
||||
class="main-area"
|
||||
:class="state.asideActive ? 'main-area-active' : ''"
|
||||
>
|
||||
<el-row>
|
||||
<span v-if="state.curTemplate" class="template-title">{{ state.curTemplate.title }}</span>
|
||||
<el-row v-if="state.curTemplate">
|
||||
<span class="template-title">{{ state.curTemplate.title }}</span>
|
||||
<div style="flex: 1; text-align: right">
|
||||
<el-button
|
||||
style="float: right"
|
||||
type="primary"
|
||||
:disabled="!createAuth[state.curTemplate?.templateType]"
|
||||
@click="templateApply(state.curTemplate)"
|
||||
>{{ t('visualization.apply_this_template') }}</el-button
|
||||
>
|
||||
@ -138,6 +139,15 @@ const props = defineProps({
|
||||
templateShowList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
createAuth: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
PANEL: false,
|
||||
SCREEN: false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,11 @@
|
||||
<el-row class="bottom-area"> </el-row>
|
||||
<el-row
|
||||
class="bottom-area-show"
|
||||
:class="{ 'create-area': ['branchCreate', 'create'].includes(props.curPosition) }"
|
||||
:class="{
|
||||
'create-area':
|
||||
['branchCreate', 'create'].includes(props.curPosition) ||
|
||||
!createAuth[template.templateType]
|
||||
}"
|
||||
>
|
||||
<el-row class="demonstration">
|
||||
{{ template.title }}
|
||||
@ -44,6 +48,15 @@ const props = defineProps({
|
||||
},
|
||||
width: {
|
||||
type: Number
|
||||
},
|
||||
createAuth: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
PANEL: false,
|
||||
SCREEN: false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -139,4 +152,8 @@ const templateInnerPreview = e => {
|
||||
.create-area {
|
||||
bottom: -38px !important;
|
||||
}
|
||||
|
||||
.fix-bottom {
|
||||
bottom: -38px !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -8,6 +8,7 @@
|
||||
<market-preview-v2
|
||||
v-show="previewModel === 'marketPreview'"
|
||||
:preview-id="state.templatePreviewId"
|
||||
:create-auth="createAuth"
|
||||
@closePreview="closePreview"
|
||||
@templateApply="templateApply"
|
||||
></market-preview-v2>
|
||||
@ -111,6 +112,7 @@
|
||||
:base-url="state.baseUrl"
|
||||
:template-cur-width="state.templateCurWidth"
|
||||
:cur-position="state.curPosition"
|
||||
:create-auth="createAuth"
|
||||
@templateApply="templateApply"
|
||||
@templatePreview="templatePreview"
|
||||
></category-template-v2>
|
||||
@ -130,6 +132,7 @@
|
||||
:base-url="state.baseUrl"
|
||||
:template-cur-width="state.templateCurWidth"
|
||||
:cur-position="state.curPosition"
|
||||
:create-auth="createAuth"
|
||||
@templateApply="templateApply"
|
||||
@templatePreview="templatePreview"
|
||||
></category-template-v2>
|
||||
@ -163,9 +166,12 @@ import MarketPreviewV2 from '@/views/template-market/component/MarketPreviewV2.v
|
||||
import { imgUrlTrans } from '@/utils/imgUtils'
|
||||
import { deepCopy } from '@/utils/utils'
|
||||
import CategoryTemplateV2 from '@/views/template-market/component/CategoryTemplateV2.vue'
|
||||
import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||
const { t } = useI18n()
|
||||
const { wsCache } = useCache()
|
||||
|
||||
const interactiveStore = interactiveStoreWithOut()
|
||||
|
||||
// full 正常展示 marketPreview 模板中心预览 createPreview 创建界面预览
|
||||
const previewModel = ref('full')
|
||||
const emits = defineEmits(['close'])
|
||||
@ -264,6 +270,14 @@ const state = reactive({
|
||||
}
|
||||
})
|
||||
|
||||
const createAuth = computed(() => {
|
||||
const authMap = interactiveStore.getData
|
||||
return {
|
||||
PANEL: authMap['0'].menuAuth && authMap['0'].anyManage,
|
||||
SCREEN: authMap['1'].menuAuth && authMap['1'].anyManage
|
||||
}
|
||||
})
|
||||
|
||||
const categoriesComputed = computed(() => {
|
||||
let result
|
||||
if (state.templateSourceType === 'all') {
|
||||
|
@ -3,8 +3,10 @@
|
||||
<div class="photo">
|
||||
<div class="img" :style="classBackground"></div>
|
||||
</div>
|
||||
<div class="apply">
|
||||
<span :title="template.title" class="name ellipsis"> {{ template.title }} </span>
|
||||
<div class="apply" :class="{ 'fix-height': !createAuth[template.templateType] }">
|
||||
<span :title="template.title" class="name ellipsis">
|
||||
{{ template.title }}
|
||||
</span>
|
||||
<el-button class="flex-center" secondary @click="templateInnerPreview">{{
|
||||
t('dataset.preview')
|
||||
}}</el-button>
|
||||
@ -30,6 +32,15 @@ const props = defineProps({
|
||||
return {}
|
||||
}
|
||||
},
|
||||
createAuth: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
PANEL: false,
|
||||
SCREEN: false
|
||||
}
|
||||
}
|
||||
},
|
||||
baseUrl: {
|
||||
type: String
|
||||
}
|
||||
@ -69,7 +80,7 @@ const templateInnerPreview = e => {
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 181px;
|
||||
min-width: 181px;
|
||||
height: 141px;
|
||||
margin-left: 16px;
|
||||
position: relative;
|
||||
@ -136,4 +147,8 @@ const templateInnerPreview = e => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fix-height {
|
||||
height: 39px !important;
|
||||
}
|
||||
</style>
|
||||
|
@ -58,6 +58,21 @@ const showTemplate = computed(() => {
|
||||
return state.networkStatus && state.hasResult
|
||||
})
|
||||
|
||||
const createAuth = computed(() => {
|
||||
return {
|
||||
PANEL: havePanelAuth.value,
|
||||
SCREEN: haveScreenAuth.value
|
||||
}
|
||||
})
|
||||
|
||||
const havePanelAuth = computed(() => {
|
||||
return quickCreationList.value[0]['menuAuth'] && quickCreationList.value[0]['anyManage']
|
||||
})
|
||||
|
||||
const haveScreenAuth = computed(() => {
|
||||
return quickCreationList.value[1]['menuAuth'] && quickCreationList.value[1]['anyManage']
|
||||
})
|
||||
|
||||
const activeTabChange = value => {
|
||||
activeTabBtn.value = value
|
||||
}
|
||||
@ -289,8 +304,23 @@ initMarketTemplate()
|
||||
{{ t(`auth.${ele.name}`) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item item-quick" @click="toTemplateMarketAdd">
|
||||
<el-icon class="main-color-quick">
|
||||
<div
|
||||
class="item item-quick"
|
||||
:class="{
|
||||
'quick-create-disabled': !(havePanelAuth || haveScreenAuth)
|
||||
}"
|
||||
@click="toTemplateMarketAdd"
|
||||
>
|
||||
<el-tooltip
|
||||
v-if="!(havePanelAuth || haveScreenAuth)"
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
content="缺少创建权限"
|
||||
placement="top"
|
||||
>
|
||||
<div class="empty-tooltip-container-template" />
|
||||
</el-tooltip>
|
||||
<el-icon class="main-color-quick template-create">
|
||||
<Icon name="icon_template_colorful" />
|
||||
</el-icon>
|
||||
<span class="name">使用模板新建</span>
|
||||
@ -329,6 +359,7 @@ initMarketTemplate()
|
||||
:key="index"
|
||||
:template="template"
|
||||
:base-url="state.baseUrl"
|
||||
:create-auth="createAuth"
|
||||
@templateApply="templateApply"
|
||||
@templatePreview="templatePreview"
|
||||
>
|
||||
@ -536,6 +567,15 @@ initMarketTemplate()
|
||||
height: 52px;
|
||||
margin-left: -16px;
|
||||
}
|
||||
.empty-tooltip-container-template {
|
||||
width: 300px;
|
||||
position: absolute;
|
||||
height: 52px;
|
||||
margin-left: -16px;
|
||||
}
|
||||
.template-create {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -620,6 +660,7 @@ initMarketTemplate()
|
||||
.template-list {
|
||||
display: flex;
|
||||
margin-left: -16px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user