{{ item.left }}, {{ item.top }}
-
+
@@ -242,7 +242,6 @@
ref="dataConfig"
:instance="instance"
:dict="dict"
- :urlPrefix="urlPrefix"
:options="currLayout"
@change="onChange('barChart')">
@@ -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)
}
}