Merge pull request #2327 from dataease/pr@dev@fix-panel-unpublished

refactor: 仪表板未发布状态显示优化
This commit is contained in:
王嘉豪 2022-05-27 10:54:14 +08:00 committed by GitHub
commit f7f73a9d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 8 deletions

View File

@ -136,6 +136,10 @@ export default {
type: String, type: String,
required: false, required: false,
default: 'NotProvided' default: 'NotProvided'
},
panelInfo: {
type: Object,
required: true
} }
}, },
data() { data() {
@ -176,15 +180,14 @@ export default {
}, },
showUnpublishedArea() { showUnpublishedArea() {
// return this.panelInfo.status === 'unpublished' // return this.panelInfo.status === 'unpublished'
if (this.mainActiveName === 'PanelMain' && this.activeTab === 'PanelList') { if (this.panelInfo && this.panelInfo.showType === 'view') {
return false
} else if ((this.mainActiveName === 'PanelMain' && this.activeTab === 'PanelList') || this.showPosition.includes('multiplexing')) {
return this.panelInfo.status === 'unpublished' && !hasDataPermission('manage', this.panelInfo.privileges) return this.panelInfo.status === 'unpublished' && !hasDataPermission('manage', this.panelInfo.privileges)
} else { } else {
return this.panelInfo.status === 'unpublished' return this.panelInfo.status === 'unpublished'
} }
}, },
panelInfo() {
return this.$store.state.panel.panelInfo
},
showExportImgButton() { showExportImgButton() {
return this.showChartInfo.type && !this.showChartInfo.type.includes('table') return this.showChartInfo.type && !this.showChartInfo.type.includes('table')
}, },

View File

@ -5,6 +5,7 @@
:component-data="componentData" :component-data="componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:back-screen-shot="backScreenShot" :back-screen-shot="backScreenShot"
:panel-info="panelInfo"
@mainHeightChange="mainHeightChange" @mainHeightChange="mainHeightChange"
/> />
</div> </div>
@ -36,6 +37,9 @@ export default {
return { height: '100vh!important' } return { height: '100vh!important' }
} }
}, },
panelInfo() {
return this.$store.state.panel.panelInfo
},
...mapState([ ...mapState([
'canvasStyleData', 'canvasStyleData',
'componentData' 'componentData'

View File

@ -5,6 +5,7 @@
v-if="fullscreen" v-if="fullscreen"
:component-data="componentData" :component-data="componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:panel-info="panelInfo"
:in-screen="!fullscreen" :in-screen="!fullscreen"
/> />
</fullscreen> </fullscreen>
@ -20,6 +21,9 @@ import { mapState } from 'vuex'
export default { export default {
components: { Preview }, components: { Preview },
computed: { computed: {
panelInfo() {
return this.$store.state.panel.panelInfo
},
...mapState([ ...mapState([
'canvasStyleData', 'canvasStyleData',
'componentData' 'componentData'

View File

@ -4,6 +4,7 @@
v-if="show" v-if="show"
:component-data="componentData" :component-data="componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:panel-info="panelInfo"
/> />
</div> </div>
</template> </template>
@ -33,7 +34,8 @@ export default {
}, },
data() { data() {
return { return {
show: false show: false,
panelInfo: {}
} }
}, },
computed: { computed: {
@ -51,12 +53,13 @@ export default {
loadResource(this.resourceId).then(res => { loadResource(this.resourceId).then(res => {
this.show = false this.show = false
let loadingCount = 0 let loadingCount = 0
this.$store.dispatch('panel/setPanelInfo', { this.panelInfo = {
id: res.data.id, id: res.data.id,
name: res.data.name, name: res.data.name,
privileges: res.data.privileges, privileges: res.data.privileges,
status: res.data.status status: res.data.status
}) }
this.$store.dispatch('panel/setPanelInfo', panelInfo)
panelInit(JSON.parse(res.data.panelData), JSON.parse(res.data.panelStyle)) panelInit(JSON.parse(res.data.panelData), JSON.parse(res.data.panelStyle))
// title // title

View File

@ -11,6 +11,7 @@
v-if="selectedPanel" v-if="selectedPanel"
:component-data="componentData" :component-data="componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:panel-info="panelInfo"
:show-position="showPosition" :show-position="showPosition"
/> />
<el-col v-else style="height: 100%;"> <el-col v-else style="height: 100%;">
@ -54,7 +55,8 @@ export default {
msgPanelIds: null, msgPanelIds: null,
componentData: [], componentData: [],
canvasStyleData: {}, canvasStyleData: {},
selectedPanel: null selectedPanel: null,
panelInfo: {}
} }
}, },
watch: { watch: {
@ -73,6 +75,13 @@ export default {
_this.panelLoading = true _this.panelLoading = true
findOne(params.showId).then(response => { findOne(params.showId).then(response => {
_this.panelLoading = false _this.panelLoading = false
this.panelInfo = {
id: response.data.id,
name: response.data.name,
privileges: response.data.privileges,
sourcePanelName: response.data.sourcePanelName,
status: response.data.status
}
panelDataPrepare(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle), function(rsp) { panelDataPrepare(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle), function(rsp) {
_this.componentData = rsp.componentData _this.componentData = rsp.componentData
_this.canvasStyleData = rsp.componentStyle _this.canvasStyleData = rsp.componentStyle
@ -94,6 +103,9 @@ export default {
'viewId': params.showId, 'viewId': params.showId,
'id': componentId 'id': componentId
} }
this.panelInfo = {
'showType': 'view'
}
_this.$nextTick(() => { _this.$nextTick(() => {
_this.componentData.push(userView) _this.componentData.push(userView)
_this.selectedPanel = params _this.selectedPanel = params

View File

@ -97,6 +97,7 @@
:active-tab="activeTab" :active-tab="activeTab"
:in-screen="!fullscreen" :in-screen="!fullscreen"
:show-type="'width'" :show-type="'width'"
:panel-info="panelInfo"
:screen-shot="dataLoading" :screen-shot="dataLoading"
/> />
</fullscreen> </fullscreen>