diff --git a/report-ui/src/mixins/queryform.js b/report-ui/src/mixins/queryform.js index 3eb437ef..8a27114f 100644 --- a/report-ui/src/mixins/queryform.js +++ b/report-ui/src/mixins/queryform.js @@ -124,7 +124,7 @@ export default { } else if (chartType == "widget-gauge") { return this.gaugeFn(params.chartProperties, data); } else if (chartType == "widget-text") { - return this.text(params.chartProperties, data) + return this.widgettext(params.chartProperties, data) } else { } @@ -195,24 +195,23 @@ export default { } // console.log(ananysicData, '结果数据') return ananysicData[0]; - } - }, - text(chartProperties, data) { - debugger - const ananysicData = []; - for (let i = 0; i < data.length; i++) { - const obj = {}; - for (const key in chartProperties) { - const value = chartProperties[key]; - if (value === "name") { - //obj["name"] = data[i][key]; - } else { - obj["value"] = data[i][key]; + }, + widgettext(chartProperties, data) { + const ananysicData = []; + for (let i = 0; i < data.length; i++) { + const obj = {}; + for (const key in chartProperties) { + const value = chartProperties[key]; + if (value === "name") { + //obj["name"] = data[i][key]; + } else { + obj["value"] = data[i][key]; + } } + ananysicData.push(obj); } - ananysicData.push(obj); - } - return ananysicData; + return ananysicData; + }, }, watch: { 'selectInput.keyname'(newVal, oldVal) { diff --git a/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue b/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue index ba9c8afc..7951981a 100644 --- a/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue +++ b/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue @@ -18,7 +18,8 @@ export default { }, data() { return { - options: {} + options: {}, + optionsData: {} }; }, computed: { @@ -47,14 +48,49 @@ export default { value: { handler(val) { this.options = val; + this.optionsData = val.data + this.setOptionsData() }, deep: true } }, mounted() { this.options = this.value; + this.optionsData = this.value.data + this.setOptionsData() }, - methods: {} + methods: { + // 数据解析 + setOptionsData() { + const optionsData = this.optionsData; // 数据类型 静态 or 动态 + optionsData.dataType == "staticData" + ? this.staticDataFn(optionsData.staticData) + : this.dynamicDataFn( + optionsData.dynamicData, + optionsData.refreshTime + ); + }, + staticDataFn(val) { + }, + dynamicDataFn(val, refreshTime) { + if (!val) return; + if (this.ispreview) { + this.getEchartData(val); + this.flagInter = setInterval(() => { + this.getEchartData(val); + }, refreshTime); + } else { + this.getEchartData(val); + } + }, + getEchartData(val) { + const data = this.queryEchartsData(val); + data.then(res => { + this.styleColor.text = res[0].value + this.$forceUpdate(); + }); + }, + } }; diff --git a/report-ui/src/views/report/bigscreen/designer/widget/widgetText2.vue b/report-ui/src/views/report/bigscreen/designer/widget/widgetText2.vue deleted file mode 100644 index d89b4eb2..00000000 --- a/report-ui/src/views/report/bigscreen/designer/widget/widgetText2.vue +++ /dev/null @@ -1,167 +0,0 @@ - - - - - -