|
|
|
@ -1,10 +1,14 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div :style="styleObj">
|
|
|
|
|
<v-chart :options="options" autoresize />
|
|
|
|
|
<v-chart ref="myVChart" :options="options" autoresize />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
originWidgetLinkageLogic,
|
|
|
|
|
targetWidgetLinkageLogic,
|
|
|
|
|
} from "@/views/bigscreenDesigner/designer/linkageLogic";
|
|
|
|
|
import echarts from "echarts";
|
|
|
|
|
export default {
|
|
|
|
|
name: "WidgetGradientColorBarchart", //渐变色,参考https://www.makeapie.com/editor.html?c=x0oZWoncE
|
|
|
|
@ -12,6 +16,10 @@ export default {
|
|
|
|
|
props: {
|
|
|
|
|
value: Object,
|
|
|
|
|
ispreview: Boolean,
|
|
|
|
|
widgetIndex: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 0,
|
|
|
|
|
}, // 当前组件,在工作区变量widgetInWorkbench中的索引
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
@ -130,6 +138,7 @@ export default {
|
|
|
|
|
optionsStyle: {}, // 样式
|
|
|
|
|
optionsData: {}, // 数据
|
|
|
|
|
optionsSetup: {},
|
|
|
|
|
flagInter: null,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
@ -143,6 +152,9 @@ export default {
|
|
|
|
|
background: this.optionsSetup.background,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
allComponentLinkage() {
|
|
|
|
|
return this.$store.state.designer.allComponentLinkage;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
value: {
|
|
|
|
@ -162,6 +174,8 @@ export default {
|
|
|
|
|
this.optionsCollapse = this.value.setup;
|
|
|
|
|
this.optionsSetup = this.value.setup;
|
|
|
|
|
this.editorOptions();
|
|
|
|
|
targetWidgetLinkageLogic(this); // 联动-目标组件逻辑
|
|
|
|
|
originWidgetLinkageLogic(this); // 联动-源组件逻辑
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 修改图标options属性
|
|
|
|
@ -379,16 +393,29 @@ export default {
|
|
|
|
|
itemStyle["normal"] = normal;
|
|
|
|
|
},
|
|
|
|
|
// 数据解析
|
|
|
|
|
setOptionsData() {
|
|
|
|
|
setOptionsData(e, paramsConfig) {
|
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
|
const optionsData = this.optionsData; // 数据类型 静态 or 动态
|
|
|
|
|
// 联动接收者逻辑开始
|
|
|
|
|
optionsData.dynamicData = optionsData.dynamicData || {}; // 兼容 dynamicData undefined
|
|
|
|
|
const myDynamicData = optionsData.dynamicData;
|
|
|
|
|
clearInterval(this.flagInter); // 不管咋,先干掉上一次的定时任务,避免多跑
|
|
|
|
|
if (
|
|
|
|
|
e &&
|
|
|
|
|
optionsData.dataType !== "staticData" &&
|
|
|
|
|
Object.keys(myDynamicData.contextData).length
|
|
|
|
|
) {
|
|
|
|
|
const keyArr = Object.keys(myDynamicData.contextData);
|
|
|
|
|
paramsConfig.forEach((conf) => {
|
|
|
|
|
if (keyArr.includes(conf.targetKey)) {
|
|
|
|
|
myDynamicData.contextData[conf.targetKey] = e[conf.originKey];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 联动接收者逻辑结束
|
|
|
|
|
optionsData.dataType == "staticData"
|
|
|
|
|
? this.staticDataFn(optionsData.staticData)
|
|
|
|
|
: this.dynamicDataFn(
|
|
|
|
|
optionsData.dynamicData,
|
|
|
|
|
optionsData.refreshTime,
|
|
|
|
|
optionsSetup
|
|
|
|
|
);
|
|
|
|
|
: this.dynamicDataFn(optionsData.refreshTime);
|
|
|
|
|
},
|
|
|
|
|
// 静态数据
|
|
|
|
|
staticDataFn(val) {
|
|
|
|
@ -417,7 +444,10 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 动态数据
|
|
|
|
|
dynamicDataFn(val, refreshTime, optionsSetup) {
|
|
|
|
|
dynamicDataFn(refreshTime) {
|
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
|
const optionsData = this.optionsData;
|
|
|
|
|
const val = optionsData.dynamicData;
|
|
|
|
|
if (!val) return;
|
|
|
|
|
if (this.ispreview) {
|
|
|
|
|
this.getEchartData(val, optionsSetup);
|
|
|
|
|