饼图联动

Raod 2 years ago
parent 0bb0b5932b
commit 8092798b42

@ -338,6 +338,18 @@ export const widgetPiechart = {
}, },
], ],
}, },
{
name: '组件联动',
list: [
{
type: 'componentLinkage',
label: '',
name: 'componentLinkage',
required: false,
value: []
}
]
}
], ],
], ],
// 数据 // 数据

@ -1,10 +1,14 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart ref="myVChart" :options="options" autoresize />
</div> </div>
</template> </template>
<script> <script>
import {
originWidgetLinkageLogic,
targetWidgetLinkageLogic,
} from "@/views/bigscreenDesigner/designer/linkageLogic";
export default { export default {
name: "WidgetPiechart", name: "WidgetPiechart",
components: {}, components: {},
@ -48,6 +52,7 @@ export default {
optionsData: {}, // optionsData: {}, //
optionsCollapse: {}, // optionsCollapse: {}, //
optionsSetup: {}, optionsSetup: {},
flagInter: null,
}; };
}, },
computed: { computed: {
@ -61,6 +66,9 @@ export default {
background: this.optionsSetup.background, background: this.optionsSetup.background,
}; };
}, },
allComponentLinkage() {
return this.$store.state.designer.allComponentLinkage;
},
}, },
watch: { watch: {
value: { value: {
@ -80,6 +88,8 @@ export default {
this.optionsCollapse = this.value.collapse; this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup; this.optionsSetup = this.value.setup;
this.editorOptions(); this.editorOptions();
targetWidgetLinkageLogic(this); // -
originWidgetLinkageLogic(this); // -
}, },
methods: { methods: {
// options // options
@ -193,8 +203,25 @@ export default {
this.options.color = arrColor; this.options.color = arrColor;
this.options = Object.assign({}, this.options); this.options = Object.assign({}, this.options);
}, },
setOptionsData() { setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // or 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" optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData) ? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);

Loading…
Cancel
Save