设计页面驻留调整

This commit is contained in:
aixianling
2022-11-09 11:54:15 +08:00
parent c48d86ee42
commit 8252fca39f
3 changed files with 92 additions and 134 deletions

View File

@@ -8,7 +8,7 @@
</div>
<div class="layout-header__right">
<span type="text" @click="isShowImg = true">素材</span>
<span type="text" @click="back">退出</span>
<span type="text" @click="back()">退出</span>
<span type="text" @click="save">保存</span>
</div>
</div>
@@ -60,7 +60,7 @@
width: bigscreenWidth + 'px',
height: bigscreenHeight + 'px'
}">
<ai-dv-wrapper style="height: 100%" :title="params.name" :theme="dashboard.theme">
<ai-dv-wrapper style="height: 100%" :title="$route.query.name" :theme="dashboard.theme">
<div style="width: 100%; height: 100%">
<AiDvBackground
:theme="dashboard.theme"
@@ -91,7 +91,7 @@
<div class="coordinate-top"></div>
<div class="coordinate-label">{{ item.left }}, {{ item.top }}</div>
</div>
<ai-dv-render :data="item" :theme="dashboard.theme" :index="index" :instance="instance" />
<ai-dv-render :data="item" :theme="dashboard.theme" :index="index" :instance="instance"/>
</vue-draggable-resizable>
</div>
</ai-dv-wrapper>
@@ -242,7 +242,6 @@
ref="dataConfig"
:instance="instance"
:dict="dict"
:urlPrefix="urlPrefix"
:options="currLayout"
@change="onChange('barChart')">
</data-config>
@@ -355,13 +354,11 @@ import 'vue-draggable-resizable/dist/VueDraggableResizable.css'
import DataConfig from './form/DataConfig.vue'
export default {
name: "designDashboard",
props: {
instance: Function,
dict: Object,
params: Object,
urlPrefix: String
},
data() {
return {
colConfigs: [
@@ -440,9 +437,7 @@ export default {
},
mounted() {
if (this.params && this.params.id) {
this.getInfo(this.params.id)
}
this.getInfo(this.$route.query.did)
this.$nextTick(() => {
this.middleWidth = document.querySelector('.layout-wrapper').offsetWidth - 670
this.middleHeight = document.querySelector('.layout-wrapper').offsetHeight
@@ -451,15 +446,6 @@ export default {
},
methods: {
bindEvent() {
this.middleWidth = document.querySelector('.layout-wrapper').offsetWidth - 670
this.middleHeight = document.querySelector('.layout-wrapper').offsetHeight
this.$nextTick(() => {
this.initCanvas()
})
},
copy(link) {
let oInput = document.createElement('input')
oInput.value = link
@@ -506,7 +492,7 @@ export default {
},
getInfo(id) {
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
id && this.instance.post(`/app/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
if (res.code === 0) {
const data = JSON.parse(res.data.config)
this.componentList = data.config
@@ -516,29 +502,32 @@ export default {
})
},
back() {
this.$emit('close')
back(params) {
if (!!params) {
const {id} = this.$route.query
this.$router.push({hash: "#add", params, query: {id}})
} else {
this.$router.back()
}
},
save() {
this.instance.post(`${this.urlPrefix}/appdiylargescreen/addOrUpdateLargeScreen`, {
const {did: id} = this.$route.query, {dashboard} = this
this.instance.post(`/app/appdiylargescreen/addOrUpdateLargeScreen`, {
id,
config: JSON.stringify({
config: this.componentList,
dashboard: this.dashboard,
dashboard,
images: this.images
}),
status: 1,
title: this.dashboard.title,
id: this.params.id || ''
title: dashboard.title,
}).then(res => {
if (res.code == 0) {
if (res?.code == 0) {
this.$message.success('保存成功')
this.$emit('change', res.data)
this.back()
this.back(res.data)
}
})
},
clone(e) {
this.componentList.push(this.deepClone(e))
},
@@ -617,8 +606,8 @@ export default {
},
initCanvas() {
var widthScale = (this.middleWidth - this.widthPaddingTools) / this.bigscreenWidth
var heightScale = (this.middleHeight - this.widthPaddingTools) / this.bigscreenHeight
let widthScale = (this.middleWidth - this.widthPaddingTools) / this.bigscreenWidth
let heightScale = (this.middleHeight - this.widthPaddingTools) / this.bigscreenHeight
this.heightScale = Math.min(widthScale, heightScale)
}
}