From a13086bdd739b123fb90e5fd001b682147b40d72 Mon Sep 17 00:00:00 2001 From: qianming Date: Mon, 19 Jul 2021 14:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=96=87=E6=9C=AC=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/report/bigscreen/designer/tools.js | 72 +++++++++++++------ .../widget/pie/widgetPiePercentageChart.vue | 4 +- .../designer/widget/widgetMarquee.vue | 37 +++++++++- .../bigscreen/designer/widget/widgetText.vue | 2 +- 4 files changed, 88 insertions(+), 27 deletions(-) diff --git a/report-ui/src/views/report/bigscreen/designer/tools.js b/report-ui/src/views/report/bigscreen/designer/tools.js index 34b499ae..8b08dccd 100644 --- a/report-ui/src/views/report/bigscreen/designer/tools.js +++ b/report-ui/src/views/report/bigscreen/designer/tools.js @@ -144,7 +144,6 @@ const widgetTools = [ value: 'center' }, ], - // 数据 data: [ { @@ -194,7 +193,7 @@ const widgetTools = [ relactiveDomValue: 'dynamicData', chartType: 'widget-text', value: '', - }, + } ], // 坐标 @@ -304,37 +303,66 @@ const widgetTools = [ ], value: 'normal' }, - { - type: 'el-select', - label: '对齐方式', - name: 'textAlign', +/* { + type: 'el-input-number', + label: '滚动速度', + name: 'marqueeQuit', required: false, placeholder: '', + value: '1', + }*/ + ], + // 数据 + data: [ + { + type: 'el-radio-group', + label: '数据类型', + name: 'dataType', + require: false, + placeholder: '', + selectValue: true, selectOptions: [ - {code: 'center', name: '居中'}, - {code: 'left', name: '左对齐'}, - {code: 'right', name: '右对齐'}, + { + code: 'staticData', + name: '静态数据', + }, + { + code: 'dynamicData', + name: '动态数据', + }, ], - value: 'center' + value: 'staticData', }, { - type: 'el-switch', - label: '开启滚动', - name: 'marqueeSet', - required: false, - placeholder: '', - value: true, + type: 'el-input-number', + label: '刷新时间(毫秒)', + name: 'refreshTime', + relactiveDom: 'dataType', + relactiveDomValue: 'dynamicData', + value: 5000 }, { - type: 'el-input-text', - label: '滚动速度', - name: 'marqueeQuit', + type: 'el-button', + label: '静态数据', + name: 'staticData', required: false, - placeholder: '', + placeholder: 'px', + relactiveDom: 'dataType', + relactiveDomValue: 'staticData', + value: '文本框', }, + { + type: 'dycustComponents', + label: '', + name: 'dynamicData', + required: false, + placeholder: 'px', + relactiveDom: 'dataType', + relactiveDomValue: 'dynamicData', + chartType: 'widget-text', + value: '', + } ], - // 数据 - data: [], // 坐标 position: [ { diff --git a/report-ui/src/views/report/bigscreen/designer/widget/pie/widgetPiePercentageChart.vue b/report-ui/src/views/report/bigscreen/designer/widget/pie/widgetPiePercentageChart.vue index d7b929c7..280d11f5 100644 --- a/report-ui/src/views/report/bigscreen/designer/widget/pie/widgetPiePercentageChart.vue +++ b/report-ui/src/views/report/bigscreen/designer/widget/pie/widgetPiePercentageChart.vue @@ -474,9 +474,7 @@ export default { getEchartData(val) { const data = this.queryEchartsData(val); data.then(res => { - this.options.title.text = '{nums|' + res[0].value + '}{percent|%}' - //this.$forceUpdate(); - console.log(res[0].value) + this.options.title.text = '{nums|' + res[0].value + '}{percent|%}'; }); } } diff --git a/report-ui/src/views/report/bigscreen/designer/widget/widgetMarquee.vue b/report-ui/src/views/report/bigscreen/designer/widget/widgetMarquee.vue index 89d18123..653f458d 100644 --- a/report-ui/src/views/report/bigscreen/designer/widget/widgetMarquee.vue +++ b/report-ui/src/views/report/bigscreen/designer/widget/widgetMarquee.vue @@ -49,14 +49,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: { + // 数据解析 + 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(); + }); + } }, - methods: {}, } 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 7951981a..d5ff935e 100644 --- a/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue +++ b/report-ui/src/views/report/bigscreen/designer/widget/widgetText.vue @@ -89,7 +89,7 @@ export default { this.styleColor.text = res[0].value this.$forceUpdate(); }); - }, + } } };