给echart提供个性化的地方

This commit is contained in:
aixianling
2024-03-25 15:51:15 +08:00
parent e2c0e919d3
commit 4c220621b5
3 changed files with 87 additions and 123 deletions

View File

@@ -190,9 +190,9 @@
:total="images.length"
:colConfigs="colConfigs"
@getList="() => {}">
<el-table-column slot="img" prop="素材地址" label="素材" align="center">
<el-table-column :slot="'img'" prop="素材地址" label="素材" align="center">
</el-table-column>
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<el-table-column :slot="'options'" width="140px" fixed="right" label="操作" align="center">
<template slot-scope="{ row, $index }">
<div class="table-options">
<el-button type="text" @click="removeImg($index)">删除</el-button>
@@ -313,6 +313,7 @@ export default {
comps: v => {
const obj = {}
v.components.map(e => e.list.map(c => c.list.map(com => {
com.echartOps = com.echartOps || v.$echartTpls[com.type]
obj[com.type] = com
})))
return obj
@@ -351,11 +352,9 @@ export default {
})
oInput.remove()
},
removeImg(index) {
this.images.splice(index, 1)
},
onImageConfirm() {
if (!this.form.images.length) {
return this.$message.error('请上传图片')
@@ -383,7 +382,6 @@ export default {
this.componentList.splice(this.activeIndex, 1)
this.componentList.unshift(item)
},
getInfo(id) {
id && this.instance.post(`/app/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
if (res?.data) {
@@ -394,7 +392,6 @@ export default {
}
})
},
back(params) {
if (!!params) {
const {id} = this.$route.query
@@ -424,6 +421,9 @@ export default {
},
//从资产中新建时使用
clone(e) {
if (/Chart/.test(e.type)) {
e.echartOps = this.$echartTpls[e.config]
}
this.componentList.push(this.deepClone(e))
},
onChange() {
@@ -432,13 +432,8 @@ export default {
deepClone(obj) {
if (obj instanceof Object) {
let newObj = {}
if (Array.isArray(obj)) {
let arr = []
obj.forEach(item => {
arr.push(this.deepClone(item))
})
return arr
return this.$copy(obj)
} else if (typeof obj == 'function') {
newObj = obj.bind(newObj)
} else {
@@ -460,13 +455,11 @@ export default {
}
}
}
return newObj
} else {
return obj
}
},
onContextmenu(e, index) {
this.menuX = e.clientX + 10
this.menuY = e.clientY + 10
@@ -485,7 +478,6 @@ export default {
this.componentList.splice(this.activeIndex, 1)
this.activeIndex = -1
},
onActivated(index) {
this.activeIndex = index
},
@@ -499,7 +491,6 @@ export default {
item.width = w
item.height = h
},
initCanvas() {
let widthScale = (this.middleWidth - this.widthPaddingTools) / this.bigscreenWidth
let heightScale = (this.middleHeight - this.widthPaddingTools) / this.bigscreenHeight