bugfix--#I7K1RB 仪表盘更新

qianming 1 year ago
parent 3a90ebab2d
commit 8ed0802e17

@ -233,6 +233,14 @@ export const widgetGauge = {
placeholder: '', placeholder: '',
value: 0, value: 0,
}, },
{
type: 'vue-color',
label: '颜色',
name: 'labelColor',
required: false,
placeholder: '',
value: '#fff',
},
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字号', label: '字号',
@ -242,12 +250,31 @@ export const widgetGauge = {
value: 10, value: 10,
}, },
{ {
type: 'vue-color', type: 'el-select',
label: '颜色', label: '字体粗细',
name: 'labelColor', name: 'labelFontWeight',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'bold', name: '粗体' },
{ code: 'bolder', name: '特粗体' },
{ code: 'lighter', name: '细体' }
],
value: 'normal'
},
{
type: 'el-select',
label: '字体风格',
name: 'labelFontStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
],
value: 'normal'
}, },
] ]
}, },
@ -257,7 +284,7 @@ export const widgetGauge = {
{ {
type: 'vue-color', type: 'vue-color',
label: '颜色', label: '颜色',
name: 'labelColor', name: 'detailColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff', value: '#fff',
@ -265,7 +292,7 @@ export const widgetGauge = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字号', label: '字号',
name: 'labelFontSize', name: 'detailFontSize',
require: false, require: false,
placeholder: '', placeholder: '',
value: 14, value: 14,
@ -273,7 +300,7 @@ export const widgetGauge = {
{ {
type: 'el-select', type: 'el-select',
label: '字体粗细', label: '字体粗细',
name: 'labelFontWeight', name: 'detailFontWeight',
required: false, required: false,
placeholder: '', placeholder: '',
selectOptions: [ selectOptions: [
@ -284,6 +311,19 @@ export const widgetGauge = {
], ],
value: 'normal' value: 'normal'
}, },
{
type: 'el-select',
label: '字体风格',
name: 'detailFontStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
],
value: 'normal'
},
] ]
}, },
], ],

@ -1,11 +1,12 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart :options="options" autoresize/>
</div> </div>
</template> </template>
<script> <script>
import echarts from "echarts"; import echarts from "echarts";
export default { export default {
name: "WidgetGauge", name: "WidgetGauge",
components: {}, components: {},
@ -244,9 +245,27 @@ export default {
width: optionsSetup.splitWidth, width: optionsSetup.splitWidth,
}, },
}; };
const axisLabel = {
show: optionsSetup.labelShow,
color: optionsSetup.labelColor,
distance: optionsSetup.labelDistance,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
fontStyle: optionsSetup.labelFontStyle,
};
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.detailColor,
fontSize: optionsSetup.detailFontSize,
fontWeight: optionsSetup.detailFontWeight,
fontStyle: optionsSetup.detailFontStyle,
};
series[0].axisLine = axisLine; series[0].axisLine = axisLine;
series[0].axisTick = axisTick; series[0].axisTick = axisTick;
series[0].splitLine = splitLine; series[0].splitLine = splitLine;
series[0].axisLabel = axisLabel;
series[0].detail = detail;
} }
}, },
setOptionsData() { setOptionsData() {
@ -256,7 +275,6 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime); : this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
}, },
staticDataFn(val) { staticDataFn(val) {
const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
const num = val[0]["num"]; const num = val[0]["num"];
const data = [ const data = [
@ -264,15 +282,7 @@ export default {
value: num, value: num,
}, },
]; ];
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.labelColor,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
};
series[0].data = data; series[0].data = data;
series[0].detail = detail;
}, },
dynamicDataFn(val, refreshTime) { dynamicDataFn(val, refreshTime) {
if (!val) return; if (!val) return;
@ -292,22 +302,13 @@ export default {
}); });
}, },
renderingFn(val) { renderingFn(val) {
const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
const data = [ const data = [
{ {
value: val[0].value, value: val[0].value,
}, },
]; ];
const detail = {
valueAnimation: true,
formatter: "{value} %",
color: optionsSetup.labelColor,
fontSize: optionsSetup.labelFontSize,
fontWeight: optionsSetup.labelFontWeight,
};
series[0].data = data; series[0].data = data;
series[0].detail = detail;
}, },
}, },
}; };

Loading…
Cancel
Save