yanzili 3 years ago
commit 56e6335b32

@ -1,36 +1,53 @@
# AJ-Report
## Online experience
####   Computer online experience: [https://report.anji-plus.com/](https://report.anji-plus.com/ "链接")  accountguest passwordguest
#### &emsp; Online documents: [https://report.anji-plus.com/#/doc](https://report.anji-plus.com/#/doc "doc")<br>
#### &emsp; issues: [https://gitee.com/anji-plus/report/issues](https://gitee.com/anji-plus/report/issues "issue")
#### Description
大屏设计
## Function overview
#### &emsp; Component introduction
&emsp;&emsp; AJ-Reportis a visual drag edit, intuitive, cool, with a sense of science and technology chart tool full open source project.
#### Software Architecture
Software architecture description
The built-in basic functions include data source, data set, report management, and some screenshots of the project are shown below.。<br>
#### Installation
1. xxxx
2. xxxx
3. xxxx
## Packaging directory
#### Instructions
```
├── bin
│ ├── logs
│ ├── cache
│ ├── startup.cmd
│ ├── shutdown.cmd
│ ├── startup.sh
│ └── shutdown.sh
├── config
├── lib
├── target
```
1. xxxx
2. xxxx
3. xxxx
## System directory
```
├── doc
│ ├── docs
│ ├── package.json
│ └── README.md
├── pom.xml
├── report-core
│ ├── pom.xml
│ └── README.md
├── report-ui
├── LICENSE
├── README.md
```
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
## Short term plan
#### &emsp; Enrich more chart components
## technical support
If you have any questions, please submit to [Issue](https://gitee.com/anji-plus/report/issues)
#### Open source is not easy, please, star ☺
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

@ -1,37 +1,51 @@
# AJ-Report
## 在线体验
#### &emsp; 电脑在线体验: [https://report.anji-plus.com/](https://report.anji-plus.com/ "链接") &emsp;体验账号guest 密码guest
#### &emsp; 在线文档: [https://report.anji-plus.com/#/doc](https://report.anji-plus.com/#/doc "doc")<br>
#### &emsp; 在线提问: [https://gitee.com/anji-plus/report/issues](https://gitee.com/anji-plus/report/issues "issue")
## 功能概述
#### &emsp; 组件介绍
&emsp;&emsp; 大屏设计AJ-Report是一个可视化拖拽编辑的直观酷炫具有科技感的图表工具全开源项目。
内置的基础功能包括数据源,数据集,报表管理,项目部分截图如下。<br>
## 打包目录
```
├── bin 启动命令脚本
│ ├── logs 启动日志目录
│ ├── cache 本地缓存目录
│ ├── startup.cmd
│ ├── shutdown.cmd
│ ├── startup.sh
│ └── shutdown.sh
├── config 配置文件目录
├── lib 自定义扩展包
├── target report-core核心包
```
## 系统目录
```
├── doc 文档源码
│ ├── docs
│ ├── package.json
│ └── README.md
├── pom.xml 父pomjar版本管理
├── report-core java源码
│ ├── pom.xml gaea父pomjar版本管理
│ └── README.md
├── report-ui 前端vue源码
├── LICENSE
├── README.md
```
## 近期计划
#### &emsp; 丰富更多图表组件
## 技术支持
如有问题,请提交 [Issue](https://gitee.com/anji-plus/report/issues)
#### 开源不易劳烦各位star ☺
#### 介绍
大屏设计
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

@ -1,71 +1,70 @@
<!--
* @Author: lide1202@hotmail.com
* @Date: 2021-4-8 11:04:24
* @Last Modified by: lide1202@hotmail.com
* @Last Modified time: 2021-4-8 11:04:24
!-->
<template>
<el-popover placement="right"
trigger="click">
<Chrome v-model="colors"
@input="updateValue" />
<el-input slot="reference"
v-model="colors.hex"
<el-input
clearable
v-model="colorValue"
placeholder="请输入颜色"
size="mini"
placeholder="颜色选择器">
<template #append><i class="iconfont iconcolorSelector" /></template>
@change="changeColor"
>
<template slot="append">
<el-color-picker
v-model="colorValue"
:predefine="predefineColors"
size="mini"
@change="changeColor"
/>
</template>
</el-input>
</el-popover>
</template>
<script>
import { Chrome } from 'vue-color' // https://gitee.com/mirrors/vue-color // Photoshop Chrome
export default {
name: 'ColorPicker',
components: {
Chrome,
},
name: "ColorPicker",
model: {
prop: 'value',
event: 'input',
prop: "value",
event: "input"
},
props: {
value: {
type: [String],
default: '',
},
default: ""
}
},
data () {
data() {
return {
colors: {
hex: '',
hsl: { h: 150, s: 0.5, l: 0.2, a: 1 },
hsv: { h: 150, s: 0.66, v: 0.3, a: 1 },
rgba: { r: 25, g: 77, b: 51, a: 1 },
},
}
predefineColors: [
"#ff4500",
"#ff8c00",
"#ffd700",
"#90ee90",
"#00ced1",
"#1e90ff",
"#c71585"
],
colorValue: ""
};
},
watch: {
value (val) {
this.colors.hex = val
value(val) {
this.colorValue = val || "";
}
},
mounted () {
this.colors.hex = this.value
mounted() {
this.colorValue = this.value;
},
methods: {
updateValue (value) {
// this.colors = value
this.$emit('input', value.hex)
this.$emit('change', value.hex)
},
},
}
changeColor(val) {
this.colorValue = val || "";
this.$emit("input", this.colorValue);
this.$emit("change", this.colorValue);
}
}
};
</script>
<style scoped lang="scss">
/deep/.el-input-group__append {
width: 20px;
padding: 0 5px;
<style lang="scss" scoped>
/deep/.el-color-picker--mini,
/deep/.el-color-picker--mini .el-color-picker__trigger {
width: 23px;
height: 23px;
}
</style>

@ -167,8 +167,8 @@ export default {
/deep/.el-table::before {
height: 0;
}
/deep/.el-form-item--mini .el-color-picker--mini,
/deep/.el-form-item--mini .el-color-picker--mini .el-color-picker__trigger {
/deep/.el-color-picker--mini,
/deep/.el-color-picker--mini .el-color-picker__trigger {
width: 23px;
height: 23px;
}

@ -52,7 +52,6 @@
placeholder="请输入内容"
@change="changed($event, item.name)"
/>
<ColorPicker
v-if="item.type == 'vue-color'"
v-model="formData[item.name]"

@ -1,104 +1,120 @@
<template>
<div :style="styleObj">
<v-chart :options="options"
autoresize />
<v-chart :options="options" autoresize />
</div>
</template>
<script>
import echarts from 'echarts';
import echarts from "echarts";
export default {
name: 'WidgetGradientColorBarchart', //https://www.makeapie.com/editor.html?c=x0oZWoncE
name: "WidgetGradientColorBarchart", //https://www.makeapie.com/editor.html?c=x0oZWoncE
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data () {
data() {
return {
options: {
// backgroundColor: '#00265f',
"title": {
"text": "政策补贴额度",
title: {
text: "政策补贴额度",
x: "center",
y: "4%",
textStyle: {
color: '#fff',
fontSize: '22'
color: "#fff",
fontSize: "22"
},
subtextStyle: {
color: '#90979c',
fontSize: '16',
},
color: "#90979c",
fontSize: "16"
}
},
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'shadow'
type: "shadow"
}
},
grid: {
top: '15%',
right: '3%',
left: '5%',
bottom: '12%'
top: "15%",
right: "3%",
left: "5%",
bottom: "12%"
},
legend: {
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
xAxis: {
type: 'category',
data: ['制造业', '建筑业', '农林牧渔', '房地产', '金融业', '居民服务及其他'],
type: "category",
data: [
"制造业",
"建筑业",
"农林牧渔",
"房地产",
"金融业",
"居民服务及其他"
],
axisLine: {
lineStyle: {
color: 'rgba(255,255,255,0.12)'
color: "rgba(255,255,255,0.12)"
}
},
axisLabel: {
margin: 10,
color: '#e2e9ff',
color: "#e2e9ff",
textStyle: {
fontSize: 14
},
},
}
}
},
yAxis: {
name: '单位:万元',
name: "单位:万元",
axisLabel: {
formatter: '{value}',
color: '#e2e9ff',
formatter: "{value}",
color: "#e2e9ff"
},
axisLine: {
show: false,
lineStyle: {
color: 'rgba(255,255,255,0)'
color: "rgba(255,255,255,0)"
}
},
splitLine: {
lineStyle: {
color: 'rgba(255,255,255,0.12)'
color: "rgba(255,255,255,0.12)"
}
}
},
series: [{
type: 'bar',
series: [
{
type: "bar",
data: [5000, 2600, 1300, 1300, 1250, 1500],
barWidth: '20px',
barWidth: "20px",
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: 'rgba(0,244,255,1)' // 0%
}, {
color: "rgba(0,244,255,1)" // 0%
},
{
offset: 1,
color: 'rgba(0,77,167,1)' // 100%
}], false),
color: "rgba(0,77,167,1)" // 100%
}
],
false
),
barBorderRadius: [30, 30, 30, 30],
shadowColor: 'rgba(0,160,221,1)',
shadowBlur: 4,
shadowColor: "rgba(0,160,221,1)",
shadowBlur: 4
}
},
label: {
@ -107,116 +123,115 @@ export default {
lineHeight: 30,
width: 80,
height: 30,
backgroundColor: 'rgba(0,160,221,0.1)',
backgroundColor: "rgba(0,160,221,0.1)",
borderRadius: 200,
position: ['-8', '-60'],
position: ["-8", "-60"],
distance: 1,
formatter: [
' {d|●}',
' {a|{c}} \n',
' {b|}'
].join(','),
formatter: [" {d|●}", " {a|{c}} \n", " {b|}"].join(
","
),
rich: {
d: {
color: '#3CDDCF',
color: "#3CDDCF"
},
a: {
color: '#fff',
align: 'center',
color: "#fff",
align: "center"
},
b: {
width: 1,
height: 30,
borderWidth: 1,
borderColor: '#234e6c',
align: 'left'
},
borderColor: "#234e6c",
align: "left"
}
}
}
}
}]
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj () {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler (val) {
console.log(val)
this.optionsStyle = val.position
this.optionsData = val.data
this.optionsCollapse = val.setup
this.optionsSetup = val.setup
this.editorOptions()
},
deep: true,
},
handler(val) {
console.log(val);
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.setup;
this.optionsSetup = val.setup;
this.editorOptions();
},
deep: true
}
},
mounted () {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.setup
this.optionsSetup = this.value.setup
this.editorOptions()
mounted() {
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.setup;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
// options
editorOptions () {
this.setOptionsTitle()
this.setOptionsX()
this.setOptionsY()
editorOptions() {
this.setOptionsTitle();
this.setOptionsX();
this.setOptionsY();
// this.setOptionsTop()
// this.setOptionsTooltip()
this.setOptionsMargin()
this.setOptionsMargin();
// this.setOptionsLegend()
this.setOptionsColor()
this.setOptionsData()
this.setOptionsColor();
this.setOptionsData();
},
//
setOptionsTitle () {
const optionsCollapse = this.optionsSetup
const title = {}
title.text = optionsCollapse.titleText
title.show = optionsCollapse.isNoTitle
title.left = optionsCollapse.textAlign
setOptionsTitle() {
const optionsCollapse = this.optionsSetup;
const title = {};
title.text = optionsCollapse.titleText;
title.show = optionsCollapse.isNoTitle;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight,
}
title.subtext = optionsCollapse.subText
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize,
}
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title
this.options.title = title;
},
// X
setOptionsX () {
const optionsCollapse = this.optionsSetup
setOptionsX() {
const optionsCollapse = this.optionsSetup;
const xAxis = {
type: 'category',
type: "category",
show: optionsCollapse.hideX, //
name: optionsCollapse.xName, //
nameTextStyle: {
color: optionsCollapse.xNameColor,
fontSize: optionsCollapse.xNameFontSize,
fontSize: optionsCollapse.xNameFontSize
},
nameRotate: optionsCollapse.textAngle, //
inverse: optionsCollapse.reversalX, //
@ -226,194 +241,213 @@ export default {
rotate: optionsCollapse.textAngle, //
textStyle: {
color: optionsCollapse.Xcolor, // x
fontSize: optionsCollapse.fontSizeX,
},
fontSize: optionsCollapse.fontSizeX
}
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorX,
},
color: optionsCollapse.lineColorX
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineX,
lineStyle: {
color: optionsCollapse.splitLineColorX
},
},
}
this.options.xAxis = xAxis
}
};
this.options.xAxis = xAxis;
},
// Y
setOptionsY () {
const optionsCollapse = this.optionsSetup
setOptionsY() {
const optionsCollapse = this.optionsSetup;
const yAxis = {
type: 'value',
type: "value",
show: optionsCollapse.isShowY, //
name: optionsCollapse.textNameY, //
nameTextStyle: {
color: optionsCollapse.NameColorY,
fontSize: optionsCollapse.NameFontSizeY,
fontSize: optionsCollapse.NameFontSizeY
},
inverse: optionsCollapse.reversalY, //
axisLabel: {
show: true,
textStyle: {
color: optionsCollapse.colorY, // x
fontSize: optionsCollapse.fontSizeY,
},
fontSize: optionsCollapse.fontSizeY
}
},
splitLine: {
show: false,
show: false
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorY,
},
color: optionsCollapse.lineColorY
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineY,
lineStyle: {
color: optionsCollapse.splitLineColorY
},
},
}
}
};
this.options.yAxis = yAxis
this.options.yAxis = yAxis;
},
// or
setOptionsTop () {
const optionsCollapse = this.optionsSetup
const series = this.options.series
setOptionsTop() {
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == 'bar') {
if (series[key].type == "bar") {
series[key].label = {
show: optionsCollapse.isShow,
position: 'top',
position: "top",
distance: 10,
fontSize: optionsCollapse.fontSize,
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.fontWeight,
fontWeight: optionsCollapse.fontWeight
};
series[key].barWidth = optionsCollapse.maxWidth;
series[key].barMinHeight = optionsCollapse.minHeight;
}
series[key].barWidth = optionsCollapse.maxWidth
series[key].barMinHeight = optionsCollapse.minHeight
}
}
this.options.series = series
this.options.series = series;
},
// tooltip
setOptionsTooltip () {
const optionsCollapse = this.optionsSetup
setOptionsTooltip() {
const optionsCollapse = this.optionsSetup;
const tooltip = {
trigger: 'item',
trigger: "item",
show: true,
textStyle: {
color: optionsCollapse.lineColor,
fontSize: optionsCollapse.fontSize,
},
fontSize: optionsCollapse.fontSize
}
this.options.tooltip = tooltip
};
this.options.tooltip = tooltip;
},
//
setOptionsMargin () {
const optionsCollapse = this.optionsSetup
setOptionsMargin() {
const optionsCollapse = this.optionsSetup;
const grid = {
left: optionsCollapse.marginLeft,
right: optionsCollapse.marginRight,
bottom: optionsCollapse.marginBottom,
top: optionsCollapse.marginTop,
containLabel: true,
}
this.options.grid = grid
containLabel: true
};
this.options.grid = grid;
},
// legend
setOptionsLegend () {
const optionsCollapse = this.optionsSetup
const legend = this.options.legend
legend.show = optionsCollapse.isShowLegend
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
legend.orient = optionsCollapse.layoutFront
setOptionsLegend() {
const optionsCollapse = this.optionsSetup;
const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront;
legend.textStyle = {
color: optionsCollapse.lengedColor,
fontSize: optionsCollapse.fontSize,
}
legend.itemWidth = optionsCollapse.lengedWidth
fontSize: optionsCollapse.fontSize
};
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor () {
const optionsCollapse = this.optionsSetup
const barStart = {}
barStart['offset'] = 0
barStart['color'] = optionsCollapse.barStart
const barEnd = {}
barStart['offset'] = 1
barStart['color'] = optionsCollapse.barEnd
setOptionsColor() {
const optionsCollapse = this.optionsSetup;
const barStart = {};
barStart["offset"] = 0;
barStart["color"] = optionsCollapse.barStart;
const barEnd = {};
barStart["offset"] = 1;
barStart["color"] = optionsCollapse.barEnd;
// this.options.series[0].itemStyle.normal.color = new echarts.graphic.LinearGradient(0, 0, 0, 1,[ barStart, barEnd], false)
},
//
setOptionsData () {
const optionsSetup = this.optionsSetup
console.log(optionsSetup)
const optionsData = this.optionsData // or
console.log(optionsData)
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData, optionsSetup) : this.dynamicDataFn(optionsData.dynamicData, optionsSetup)
setOptionsData() {
const optionsSetup = this.optionsSetup;
const optionsData = this.optionsData; // or
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData, optionsSetup)
: this.dynamicDataFn(
optionsData.dynamicData,
optionsData.refreshTime,
optionsSetup
);
},
//
staticDataFn (val, optionsSetup) {
const staticData = JSON.parse(val)
staticDataFn(val, optionsSetup) {
const staticData = JSON.parse(val);
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = []
this.options.yAxis.data = staticData.categories
this.options.xAxis.type = 'value'
this.options.yAxis.type = 'category'
this.options.xAxis.data = [];
this.options.yAxis.data = staticData.categories;
this.options.xAxis.type = "value";
this.options.yAxis.type = "category";
} else {
this.options.xAxis.data = staticData.categories
this.options.yAxis.data = []
this.options.xAxis.type = 'category'
this.options.yAxis.type = 'value'
this.options.xAxis.data = staticData.categories;
this.options.yAxis.data = [];
this.options.xAxis.type = "category";
this.options.yAxis.type = "value";
}
// series
const series = this.options.series
const series = this.options.series;
for (const i in series) {
if (series[i].type == 'bar') {
series[i].data = staticData.series[0].data
if (series[i].type == "bar") {
series[i].data = staticData.series[0].data;
}
}
},
//
dynamicDataFn (val, optionsSetup) {
console.log(val)
if (!val) return
dynamicDataFn(val, refreshTime, optionsSetup) {
if (!val) return;
if (this.ispreview) {
this.getEchartData(val, optionsSetup);
this.flagInter = setInterval(() => {
this.getEchartData(val, optionsSetup);
}, refreshTime);
} else {
this.getEchartData(val, optionsSetup);
}
},
getEchartData(val, optionsSetup) {
const data = this.queryEchartsData(val);
data.then(res => {
this.renderingFn(optionsSetup, res);
});
},
renderingFn(optionsSetup, val) {
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = []
this.options.yAxis.data = val.xAxis
this.options.xAxis.type = 'value'
this.options.yAxis.type = 'category'
this.options.xAxis.data = [];
this.options.yAxis.data = val.xAxis;
this.options.xAxis.type = "value";
this.options.yAxis.type = "category";
} else {
this.options.xAxis.data = val.xAxis
this.options.yAxis.data = []
this.options.xAxis.type = 'category'
this.options.yAxis.type = 'value'
this.options.xAxis.data = val.xAxis;
this.options.yAxis.data = [];
this.options.xAxis.type = "category";
this.options.yAxis.type = "value";
}
// series
const series = this.options.series
const series = this.options.series;
for (const i in series) {
if (series[i].type == 'bar') {
series[i].data = val.series[i].data
if (series[i].type == "bar") {
series[i].data = val.series[i].data;
}
}
},
},
}
}
}
};
</script>
<style scoped lang="scss">

@ -1,179 +1,178 @@
<template>
<div :style="styleObj">
<v-chart :options="options"
autoresize />
<v-chart :options="options" autoresize />
</div>
</template>
<script>
export default {
name: 'WidgetBarlinechart',
name: "WidgetBarlinechart",
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data () {
data() {
return {
options: {
color: [],
grid: {},
title: {
text: '',
text: "",
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c}%',
trigger: "item",
formatter: "{a} <br/>{b} : {c}%"
},
legend: {
textStyle: {
color: '#fff',
color: "#fff"
},
data: ['货运量', '货运总量'],
data: ["货运量", "货运总量"]
},
xAxis: [
{
type: 'category',
type: "category",
data: [],
axisLabel: {
show: true,
textStyle: {
color: '#fff',
},
},
},
color: "#fff"
}
}
}
],
yAxis: [
{
type: 'value',
name: '',
type: "value",
name: "",
min: 0,
max: 250,
interval: 50,
axisLabel: {
show: true,
textStyle: {
color: '#fff',
},
},
color: "#fff"
}
}
},
{
type: 'value',
name: '',
type: "value",
name: "",
min: 0,
max: 25,
interval: 5,
axisLabel: {
show: true,
textStyle: {
color: '#fff',
},
},
},
color: "#fff"
}
}
}
],
series: [
{
name: '',
type: 'bar',
name: "",
type: "bar",
data: [],
itemStyle: {
barBorderRadius: null,
},
barBorderRadius: null
}
},
{
name: '',
type: 'line',
name: "",
type: "line",
yAxisIndex: 1,
data: [],
itemStyle: {},
},
],
itemStyle: {}
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj () {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler (val) {
this.optionsStyle = val.position
this.optionsData = val.data
this.optionsCollapse = val.collapse
this.optionsSetup = val.setup
this.editorOptions()
},
deep: true,
},
handler(val) {
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
this.editorOptions();
},
deep: true
}
},
created () {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.collapse
this.optionsSetup = this.value.setup
this.editorOptions()
created() {
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
// options
editorOptions () {
this.setOptionsTitle()
this.setOptionsX()
this.setOptionsY()
this.setOptionsTop()
this.setOptionsBar()
this.setOptionsTooltip()
this.setOptionsData()
this.setOptionsMargin()
this.setOptionsLegend()
this.setOptionsColor()
editorOptions() {
this.setOptionsTitle();
this.setOptionsX();
this.setOptionsY();
this.setOptionsTop();
this.setOptionsBar();
this.setOptionsTooltip();
this.setOptionsData();
this.setOptionsMargin();
this.setOptionsLegend();
this.setOptionsColor();
},
//
setOptionsTitle () {
const optionsCollapse = this.optionsSetup
const title = {}
title.text = optionsCollapse.titleText
title.show = optionsCollapse.isNoTitle
title.left = optionsCollapse.textAlign
setOptionsTitle() {
const optionsCollapse = this.optionsSetup;
const title = {};
title.text = optionsCollapse.titleText;
title.show = optionsCollapse.isNoTitle;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight,
}
title.subtext = optionsCollapse.subText
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize,
}
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title
this.options.title = title;
},
// X
setOptionsX () {
const optionsCollapse = this.optionsSetup
setOptionsX() {
const optionsCollapse = this.optionsSetup;
const xAxis = {
type: 'category',
type: "category",
show: optionsCollapse.hideX, //
name: optionsCollapse.xName, //
nameTextStyle: {
color: optionsCollapse.xNameColor,
fontSize: optionsCollapse.xNameFontSize,
fontSize: optionsCollapse.xNameFontSize
},
nameRotate: optionsCollapse.textAngle, //
inverse: optionsCollapse.reversalX, //
@ -183,238 +182,257 @@ export default {
rotate: optionsCollapse.textAngle, //
textStyle: {
color: optionsCollapse.Xcolor, // x
fontSize: optionsCollapse.fontSizeX,
},
fontSize: optionsCollapse.fontSizeX
}
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorX,
},
color: optionsCollapse.lineColorX
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineX,
lineStyle: {
color: optionsCollapse.splitLineColorX
},
},
}
this.options.xAxis = xAxis
}
};
this.options.xAxis = xAxis;
},
// Y
setOptionsY () {
const optionsCollapse = this.optionsSetup
setOptionsY() {
const optionsCollapse = this.optionsSetup;
const yAxis = [
{
type: 'value',
type: "value",
show: optionsCollapse.isShowY, //
name: optionsCollapse.textNameY, //
nameTextStyle: {
color: optionsCollapse.NameColorY,
fontSize: optionsCollapse.NameFontSizeY,
fontSize: optionsCollapse.NameFontSizeY
},
inverse: optionsCollapse.reversalY, //
axisLabel: {
show: true,
textStyle: {
color: optionsCollapse.colorY, // x
fontSize: optionsCollapse.fontSizeY,
},
fontSize: optionsCollapse.fontSizeY
}
},
splitLine: {
show: false,
show: false
},
axisLine: {
show: true,
lineStyle: {
color: '#fff',
},
color: "#fff"
}
},
splitLine: {
show: optionsCollapse.isShowSplitLineY,
lineStyle: {
color: optionsCollapse.splitLineColorY
},
},
}
}
},
{
type: 'value',
type: "value",
show: optionsCollapse.isShowY, //
name: optionsCollapse.textNameY, //
nameTextStyle: {
color: optionsCollapse.NameColorY,
fontSize: optionsCollapse.NameFontSizeY,
fontSize: optionsCollapse.NameFontSizeY
},
inverse: optionsCollapse.reversalY, //
axisLabel: {
show: true,
textStyle: {
color: optionsCollapse.colorY, // x
fontSize: optionsCollapse.fontSizeY,
},
fontSize: optionsCollapse.fontSizeY
}
},
splitLine: {
show: false,
show: false
},
axisLine: {
show: true,
lineStyle: {
color: optionsCollapse.lineColorY,
},
color: optionsCollapse.lineColorY
}
},
splitLine: {
show: true,
lineStyle: {
color: optionsCollapse.splitLineColorY
},
},
},
]
}
}
}
];
this.options.yAxis = yAxis
this.options.yAxis = yAxis;
},
// 线
setOptionsTop () {
const optionsCollapse = this.optionsSetup
const series = this.options.series
setOptionsTop() {
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == 'line') {
series[key].showSymbol = optionsCollapse.markPoint
series[key].symbolSize = optionsCollapse.pointSize
series[key].smooth = optionsCollapse.smoothCurve
if (series[key].type == "line") {
series[key].showSymbol = optionsCollapse.markPoint;
series[key].symbolSize = optionsCollapse.pointSize;
series[key].smooth = optionsCollapse.smoothCurve;
if (optionsCollapse.area) {
series[key].areaStyle = {
opacity: optionsCollapse.areaThickness / 100,
}
opacity: optionsCollapse.areaThickness / 100
};
} else {
series[key].areaStyle = {
opacity: 0,
}
opacity: 0
};
}
series[key].lineStyle = {
width: optionsCollapse.lineWidth,
}
series[key].itemStyle.borderRadius = optionsCollapse.radius
width: optionsCollapse.lineWidth
};
series[key].itemStyle.borderRadius = optionsCollapse.radius;
series[key].label = {
show: optionsCollapse.isShow,
position: 'top',
position: "top",
distance: 10,
fontSize: optionsCollapse.fontSize,
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.fontWeight,
}
fontWeight: optionsCollapse.fontWeight
};
}
}
this.options.series = series
this.options.series = series;
},
setOptionsBar () {
const optionsCollapse = this.optionsSetup
const series = this.options.series
setOptionsBar() {
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == 'bar') {
if (series[key].type == "bar") {
series[key].label = {
show: optionsCollapse.isShow,
position: 'top',
position: "top",
distance: 10,
fontSize: optionsCollapse.fontSize,
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.fontWeight,
}
series[key].barWidth = optionsCollapse.maxWidth
series[key].barMinHeight = optionsCollapse.minHeight
series[key].itemStyle.barBorderRadius = optionsCollapse.radius
fontWeight: optionsCollapse.fontWeight
};
series[key].barWidth = optionsCollapse.maxWidth;
series[key].barMinHeight = optionsCollapse.minHeight;
series[key].itemStyle.barBorderRadius = optionsCollapse.radius;
}
}
this.options.series = series
this.options.series = series;
},
// tooltip
setOptionsTooltip () {
const optionsCollapse = this.optionsSetup
setOptionsTooltip() {
const optionsCollapse = this.optionsSetup;
const tooltip = {
trigger: 'item',
trigger: "item",
show: true,
textStyle: {
color: optionsCollapse.lineColor,
fontSize: optionsCollapse.fontSize,
},
fontSize: optionsCollapse.fontSize
}
this.options.tooltip = tooltip
};
this.options.tooltip = tooltip;
},
//
setOptionsMargin () {
const optionsCollapse = this.optionsSetup
setOptionsMargin() {
const optionsCollapse = this.optionsSetup;
const grid = {
left: optionsCollapse.marginLeft,
right: optionsCollapse.marginRight,
bottom: optionsCollapse.marginBottom,
top: optionsCollapse.marginTop,
containLabel: true,
}
this.options.grid = grid
containLabel: true
};
this.options.grid = grid;
},
// legend
setOptionsLegend () {
const optionsCollapse = this.optionsSetup
const legend = this.options.legend
legend.show = optionsCollapse.isShowLegend
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
legend.orient = optionsCollapse.layoutFront
setOptionsLegend() {
const optionsCollapse = this.optionsSetup;
const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront;
legend.textStyle = {
color: optionsCollapse.lengedColor,
fontSize: optionsCollapse.fontSize,
}
legend.itemWidth = optionsCollapse.lengedWidth
fontSize: optionsCollapse.fontSize
};
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor () {
const optionsCollapse = this.optionsSetup
const customColor = optionsCollapse.customColor
if (!customColor) return
const arrColor = []
setOptionsColor() {
const optionsCollapse = this.optionsSetup;
const customColor = optionsCollapse.customColor;
if (!customColor) return;
const arrColor = [];
for (let i = 0; i < customColor.length; i++) {
arrColor.push(customColor[i].color)
arrColor.push(customColor[i].color);
}
this.options.color = arrColor
this.options = Object.assign({}, this.options)
this.options.color = arrColor;
this.options = Object.assign({}, this.options);
},
//
setOptionsData () {
const optionsData = this.optionsData // or
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
},
staticDataFn (val) {
const staticData = JSON.parse(val)
setOptionsData() {
const optionsData = this.optionsData; // or
console.log(optionsData);
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
// x
this.options.xAxis.data = staticData.xAxis
this.options.xAxis.data = staticData.xAxis;
// series
const series = this.options.series
const series = this.options.series;
for (const i in series) {
for (const j in staticData.series) {
if (series[i].type == staticData.series[j].type) {
series[i].data = staticData.series[j].data
series[i].data = staticData.series[j].data;
}
}
}
},
dynamicDataFn (val) {
if (!val) return
// x
this.options.xAxis.data = val.xAxis
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.renderingFn(res);
});
},
renderingFn(val) {
this.options.xAxis.data = val.xAxis;
// series
const series = this.options.series
const series = this.options.series;
for (const i in series) {
for (const j in val.series) {
if (series[i].type == val.series[j].type) {
series[i].data = val.series[j].data
series[i].data = val.series[j].data;
}
}
}
},
},
}
}
}
};
</script>
<style scoped lang="scss">

@ -6,218 +6,239 @@
<script>
export default {
name: 'WidgetFunnel',
name: "WidgetFunnel",
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data() {
return {
options: {
color: [],
title: {
text: '',
text: "",
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c}%',
trigger: "item",
formatter: "{a} <br/>{b} : {c}%"
},
legend: {
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
series: [
{
name: '',
type: 'funnel',
left: '10%',
name: "",
type: "funnel",
left: "10%",
top: 60,
// x2: 80,
bottom: 60,
width: '80%',
width: "80%",
// height: {totalHeight} - y - y2,
min: 0,
max: 100,
minSize: '0%',
maxSize: '100%',
sort: 'descending',
minSize: "0%",
maxSize: "100%",
sort: "descending",
gap: 2,
label: {
show: true,
position: 'inside',
position: "inside"
},
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid',
},
type: "solid"
}
},
itemStyle: {
borderColor: '#fff',
borderWidth: 1,
borderColor: "#fff",
borderWidth: 1
},
emphasis: {
label: {
fontSize: 20,
},
},
data: [],
fontSize: 20
}
},
],
data: []
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position
this.optionsData = val.data
this.optionsCollapse = val.collapse
this.optionsSetup = val.setup
this.editorOptions()
},
deep: true,
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
this.editorOptions();
},
deep: true
}
},
created() {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.collapse
this.optionsSetup = this.value.setup
this.editorOptions()
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
// options
editorOptions() {
this.setOptionsText()
this.setOptionsTitle()
this.setOptionsTooltip()
this.setOptionsLegend()
this.setOptionsColor()
this.setOptionsData()
this.setOptionsText();
this.setOptionsTitle();
this.setOptionsTooltip();
this.setOptionsLegend();
this.setOptionsColor();
this.setOptionsData();
},
//
setOptionsText() {
const optionsCollapse = this.optionsSetup
const series = this.options.series
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == 'funnel') {
series[key].label.show = optionsCollapse.isShow
series[key].label.fontSize = optionsCollapse.fontSize
series[key].label.color = optionsCollapse.color
series[key].label.fontWeight = optionsCollapse.fontWeight
if (series[key].type == "funnel") {
series[key].label.show = optionsCollapse.isShow;
series[key].label.fontSize = optionsCollapse.fontSize;
series[key].label.color = optionsCollapse.color;
series[key].label.fontWeight = optionsCollapse.fontWeight;
series[key].sort = optionsCollapse.reversal ? 'ascending' : 'descending'
series[key].sort = optionsCollapse.reversal
? "ascending"
: "descending";
}
}
},
//
setOptionsTitle() {
const optionsCollapse = this.optionsSetup
const title = {}
title.show = optionsCollapse.isNoTitle
title.text = optionsCollapse.titleText
title.left = optionsCollapse.textAlign
const optionsCollapse = this.optionsSetup;
const title = {};
title.show = optionsCollapse.isNoTitle;
title.text = optionsCollapse.titleText;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight,
}
title.subtext = optionsCollapse.subText
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize,
}
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title
this.options.title = title;
},
// tooltip
setOptionsTooltip() {
const optionsCollapse = this.optionsSetup
const optionsCollapse = this.optionsSetup;
const tooltip = {
trigger: 'item',
trigger: "item",
show: true,
textStyle: {
color: optionsCollapse.lineColor,
fontSize: optionsCollapse.fontSize,
},
fontSize: optionsCollapse.fontSize
}
this.options.tooltip = tooltip
};
this.options.tooltip = tooltip;
},
// legend
setOptionsLegend() {
const optionsCollapse = this.optionsSetup
const legend = this.options.legend
legend.show = optionsCollapse.isShowLegend
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
legend.orient = optionsCollapse.layoutFront
const optionsCollapse = this.optionsSetup;
const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront;
legend.textStyle = {
color: optionsCollapse.lengedColor,
fontSize: optionsCollapse.fontSize,
}
legend.itemWidth = optionsCollapse.lengedWidth
fontSize: optionsCollapse.fontSize
};
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor() {
const optionsCollapse = this.optionsSetup
const customColor = optionsCollapse.customColor
if (!customColor) return
const arrColor = []
const optionsCollapse = this.optionsSetup;
const customColor = optionsCollapse.customColor;
if (!customColor) return;
const arrColor = [];
for (let i = 0; i < customColor.length; i++) {
arrColor.push(customColor[i].color)
arrColor.push(customColor[i].color);
}
this.options.color = arrColor
this.options = Object.assign({}, this.options)
this.options.color = arrColor;
this.options = Object.assign({}, this.options);
},
setOptionsData() {
const optionsData = this.optionsData // or
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
const optionsData = this.optionsData; // or
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val)
const staticData = JSON.parse(val);
for (const key in this.options.series) {
if (this.options.series[key].type == 'funnel') {
this.options.series[key].data = staticData
if (this.options.series[key].type == "funnel") {
this.options.series[key].data = staticData;
}
}
},
dynamicDataFn(val) {
if (!val) return
for (const key in this.options.series) {
if (this.options.series[key].type == 'funnel') {
this.options.series[key].data = 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.renderingFn(res);
});
},
}
renderingFn(val) {
for (const key in this.options.series) {
if (this.options.series[key].type == "funnel") {
this.options.series[key].data = val;
}
}
}
}
};
</script>
<style scoped lang="scss">

@ -6,128 +6,148 @@
<script>
export default {
name: 'WidgetGauge',
name: "WidgetGauge",
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data() {
return {
options: {
series: [
{
name: 'Pressure',
type: 'gauge',
name: "Pressure",
type: "gauge",
detail: {
formatter: '{value}',
formatter: "{value}",
textStyle: {
fontSize: 12,
},
fontSize: 12
}
},
axisLine: {
show: true,
lineStyle: {
width: 10,
},
width: 10
}
},
axisLabel: {
show: true,
fontSize: 12,
fontSize: 12
},
axisTick: {
show: true,
show: true
},
data: [
{
value: 50,
name: '',
},
],
},
],
name: ""
}
]
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position //
this.optionsData = val.data //
this.optionsCollapse = val.collapse //
this.optionsSetup = val.setup //
this.setOptions()
this.setOptionsData()
},
deep: true,
},
this.optionsStyle = val.position; //
this.optionsData = val.data; //
this.optionsCollapse = val.collapse; //
this.optionsSetup = val.setup; //
this.setOptions();
this.setOptionsData();
},
deep: true
}
},
created() {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.collapse
this.optionsSetup = this.value.setup
this.setOptions()
this.setOptionsData()
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.setOptions();
this.setOptionsData();
},
methods: {
setOptions() {
const optionsSetup = this.optionsSetup
const series = this.options.series
const optionsSetup = this.optionsSetup;
const series = this.options.series;
for (const key in series) {
if (series[key].type == 'gauge') {
series[key].axisLine.lineStyle.width = optionsSetup.tickMarkWeight
series[key].axisLabel.show = optionsSetup.showScaleValue
series[key].axisLabel.fontSize = optionsSetup.scaleFontSize
series[key].axisTick.show = optionsSetup.showTickMarks
series[key].detail.textStyle.fontSize = optionsSetup.targetFontSize
if (series[key].type == "gauge") {
series[key].axisLine.lineStyle.width = optionsSetup.tickMarkWeight;
series[key].axisLabel.show = optionsSetup.showScaleValue;
series[key].axisLabel.fontSize = optionsSetup.scaleFontSize;
series[key].axisTick.show = optionsSetup.showTickMarks;
series[key].detail.textStyle.fontSize = optionsSetup.targetFontSize;
}
}
},
setOptionsData() {
const optionsData = this.optionsData // or
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
const optionsData = this.optionsData; // or
console.log(optionsData);
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const unit = JSON.parse(val).unit
const series = this.options.series
const unit = JSON.parse(val).unit;
const series = this.options.series;
for (const key in series) {
series[key].detail.formatter = `{value}${unit}`
series[key].detail.formatter = `{value}${unit}`;
series[key].data[0] = {
value: JSON.parse(val).value,
name: JSON.parse(val).name,
name: JSON.parse(val).name
};
}
},
dynamicDataFn(val, refreshTime) {
console.log(val);
if (!val) return;
if (this.ispreview) {
this.getEchartData(val);
this.flagInter = setInterval(() => {
this.getEchartData(val);
}, refreshTime);
} else {
this.getEchartData(val);
}
},
dynamicDataFn(val) {
if (!val) return
const series = this.options.series
getEchartData(val) {
const data = this.queryEchartsData(val);
data.then(res => {
this.renderingFn(res);
});
},
renderingFn(val) {
const series = this.options.series;
for (const key in series) {
series[key].detail.formatter = `{value}${val.unit}`
series[key].detail.formatter = `{value}${val.unit}`;
series[key].data[0] = {
value: val.value,
name: val.name || '',
name: val.name || ""
};
}
}
},
},
}
}
};
</script>
<style scoped lang="scss">

@ -6,123 +6,123 @@
<script>
export default {
name: 'WidgetHollowPiechart',
name: "WidgetHollowPiechart",
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data() {
return {
options: {
color: [],
tooltip: {
trigger: 'item',
trigger: "item"
},
legend: {
top: '5%',
left: 'center',
top: "5%",
left: "center",
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
series: [
{
type: 'pie',
radius: ['40%', '70%'],
type: "pie",
radius: ["40%", "70%"],
avoidLabelOverlap: true,
label: {
show: false,
position: 'center',
position: "center"
},
emphasis: {
label: {
show: true,
fontSize: '40',
fontWeight: 'bold',
},
fontSize: "40",
fontWeight: "bold"
}
},
labelLine: {
show: true,
},
data: [],
show: true
},
],
data: []
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position
this.optionsData = val.data
this.optionsCollapse = val.collapse
this.optionsSetup = val.setup
this.editorOptions()
},
deep: true,
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
this.editorOptions();
},
deep: true
}
},
created() {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.collapse
this.optionsSetup = this.value.setup
this.editorOptions()
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
// options
editorOptions() {
this.setOptionsTitle()
this.setOptionsValue()
this.setOptionsTooltip()
this.setOptionsLegend()
this.setOptionsColor()
this.setOptionsData()
this.setOptionsTitle();
this.setOptionsValue();
this.setOptionsTooltip();
this.setOptionsLegend();
this.setOptionsColor();
this.setOptionsData();
},
//
setOptionsTitle() {
const optionsCollapse = this.optionsSetup
const title = {}
title.show = optionsCollapse.isNoTitle
title.text = optionsCollapse.titleText
title.left = optionsCollapse.textAlign
const optionsCollapse = this.optionsSetup;
const title = {};
title.show = optionsCollapse.isNoTitle;
title.text = optionsCollapse.titleText;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight,
}
title.subtext = optionsCollapse.subText
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize,
}
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title
this.options.title = title;
},
//
setOptionsValue() {
const optionsCollapse = this.optionsSetup
const series = this.options.series
const numberValue = optionsCollapse.numberValue ? '{c}' : ''
const percentage = optionsCollapse.percentage ? '({d})%' : ''
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
const numberValue = optionsCollapse.numberValue ? "{c}" : "";
const percentage = optionsCollapse.percentage ? "({d})%" : "";
const label = {
show: optionsCollapse.isShow,
formatter: `{a|{b}${numberValue} ${percentage}}`,
@ -131,83 +131,102 @@ export default {
padding: [-30, 15, -20, 15],
color: optionsCollapse.subTextColor,
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.fontWeight,
},
fontWeight: optionsCollapse.fontWeight
}
},
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.optionsCollapse,
}
fontWeight: optionsCollapse.optionsCollapse
};
for (const key in series) {
if (series[key].type == 'pie') {
series[key].label = label
series[key].labelLine.show = optionsCollapse.isShow
if (series[key].type == "pie") {
series[key].label = label;
series[key].labelLine.show = optionsCollapse.isShow;
}
}
},
// tooltip
setOptionsTooltip() {
const optionsCollapse = this.optionsSetup
const optionsCollapse = this.optionsSetup;
const tooltip = {
trigger: 'item',
trigger: "item",
show: true,
textStyle: {
color: optionsCollapse.lineColor,
fontSize: optionsCollapse.fontSize,
},
fontSize: optionsCollapse.fontSize
}
this.options.tooltip = tooltip
};
this.options.tooltip = tooltip;
},
// legend
setOptionsLegend() {
const optionsCollapse = this.optionsSetup
const legend = this.options.legend
legend.show = optionsCollapse.isShowLegend
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
legend.orient = optionsCollapse.layoutFront
const optionsCollapse = this.optionsSetup;
const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront;
legend.textStyle = {
color: optionsCollapse.lengedColor,
fontSize: optionsCollapse.fontSize,
}
legend.itemWidth = optionsCollapse.lengedWidth
fontSize: optionsCollapse.fontSize
};
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor() {
const optionsCollapse = this.optionsSetup
const customColor = optionsCollapse.customColor
if (!customColor) return
const arrColor = []
const optionsCollapse = this.optionsSetup;
const customColor = optionsCollapse.customColor;
if (!customColor) return;
const arrColor = [];
for (let i = 0; i < customColor.length; i++) {
arrColor.push(customColor[i].color)
arrColor.push(customColor[i].color);
}
this.options.color = arrColor
this.options = Object.assign({}, this.options)
this.options.color = arrColor;
this.options = Object.assign({}, this.options);
},
setOptionsData() {
const optionsData = this.optionsData // or
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
const optionsData = this.optionsData; // or
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val)
const staticData = JSON.parse(val);
for (const key in this.options.series) {
if (this.options.series[key].type == 'pie') {
this.options.series[key].data = staticData
if (this.options.series[key].type == "pie") {
this.options.series[key].data = staticData;
}
}
},
dynamicDataFn(val) {
if (!val) return
for (const key in this.options.series) {
if (this.options.series[key].type == 'pie') {
this.options.series[key].data = val
}
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.renderingFn(res);
});
},
}
renderingFn(val) {
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = val;
}
}
}
}
};
</script>
<style scoped lang="scss">

@ -298,7 +298,7 @@ export default {
const optionsData = this.optionsData; // or
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData);
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
@ -312,8 +312,24 @@ export default {
}
}
},
dynamicDataFn(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.renderingFn(res);
});
},
renderingFn(val) {
// x
this.options.xAxis.data = val.xAxis;
// series

@ -6,118 +6,118 @@
<script>
export default {
name: 'WidgetPiechart',
name: "WidgetPiechart",
components: {},
props: {
value: Object,
ispreview: Boolean,
ispreview: Boolean
},
data() {
return {
options: {
title: {
text: '某站点用户访问来源',
left: 'center',
text: "",
left: "center",
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
legend: {
orient: 'vertical',
left: 'left',
orient: "vertical",
left: "left",
textStyle: {
color: '#fff',
},
color: "#fff"
}
},
series: [
{
type: 'pie',
radius: '50%',
type: "pie",
radius: "50%",
data: [],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
},
],
shadowColor: "rgba(0, 0, 0, 0.5)"
}
}
}
]
},
optionsStyle: {}, //
optionsData: {}, //
optionsCollapse: {}, //
optionsSetup: {},
}
optionsSetup: {}
};
},
computed: {
styleObj() {
return {
position: this.ispreview ? 'absolute' : 'static',
width: this.optionsStyle.width + 'px',
height: this.optionsStyle.height + 'px',
left: this.optionsStyle.left + 'px',
top: this.optionsStyle.top + 'px',
background: this.optionsSetup.background,
position: this.ispreview ? "absolute" : "static",
width: this.optionsStyle.width + "px",
height: this.optionsStyle.height + "px",
left: this.optionsStyle.left + "px",
top: this.optionsStyle.top + "px",
background: this.optionsSetup.background
};
}
},
},
watch: {
value: {
handler(val) {
this.optionsStyle = val.position
this.optionsData = val.data
this.optionsCollapse = val.collapse
this.optionsSetup = val.setup
this.editorOptions()
},
deep: true,
this.optionsStyle = val.position;
this.optionsData = val.data;
this.optionsCollapse = val.collapse;
this.optionsSetup = val.setup;
this.editorOptions();
},
deep: true
}
},
created() {
this.optionsStyle = this.value.position
this.optionsData = this.value.data
this.optionsCollapse = this.value.collapse
this.optionsSetup = this.value.setup
this.editorOptions()
this.optionsStyle = this.value.position;
this.optionsData = this.value.data;
this.optionsCollapse = this.value.collapse;
this.optionsSetup = this.value.setup;
this.editorOptions();
},
methods: {
// options
editorOptions() {
this.setOptionsTitle()
this.setOptionsValue()
this.setOptionsTooltip()
this.setOptionsLegend()
this.setOptionsColor()
this.setOptionsData()
this.setOptionsTitle();
this.setOptionsValue();
this.setOptionsTooltip();
this.setOptionsLegend();
this.setOptionsColor();
this.setOptionsData();
},
//
setOptionsTitle() {
const optionsCollapse = this.optionsSetup
const title = {}
title.show = optionsCollapse.isNoTitle
title.text = optionsCollapse.titleText
title.left = optionsCollapse.textAlign
const optionsCollapse = this.optionsSetup;
const title = {};
title.show = optionsCollapse.isNoTitle;
title.text = optionsCollapse.titleText;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight,
}
title.subtext = optionsCollapse.subText
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize,
}
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title
this.options.title = title;
},
//
setOptionsValue() {
const optionsCollapse = this.optionsSetup
const series = this.options.series
const numberValue = optionsCollapse.numberValue ? '{c}' : ''
const percentage = optionsCollapse.percentage ? '({d})%' : ''
const optionsCollapse = this.optionsSetup;
const series = this.options.series;
const numberValue = optionsCollapse.numberValue ? "{c}" : "";
const percentage = optionsCollapse.percentage ? "({d})%" : "";
const label = {
show: optionsCollapse.isShow,
formatter: `{a|{b}${numberValue} ${percentage}}`,
@ -126,83 +126,102 @@ export default {
padding: [-30, 15, -20, 15],
color: optionsCollapse.subTextColor,
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.fontWeight,
},
fontWeight: optionsCollapse.fontWeight
}
},
fontSize: optionsCollapse.fontSize,
fontWeight: optionsCollapse.optionsCollapse,
}
fontWeight: optionsCollapse.optionsCollapse
};
for (const key in series) {
if (series[key].type == 'pie') {
series[key].label = label
series[key].labelLine = { show: optionsCollapse.isShow }
if (series[key].type == "pie") {
series[key].label = label;
series[key].labelLine = { show: optionsCollapse.isShow };
}
}
},
// tooltip
setOptionsTooltip() {
const optionsCollapse = this.optionsSetup
const optionsCollapse = this.optionsSetup;
const tooltip = {
trigger: 'item',
trigger: "item",
show: true,
textStyle: {
color: optionsCollapse.lineColor,
fontSize: optionsCollapse.fontSize,
},
fontSize: optionsCollapse.fontSize
}
this.options.tooltip = tooltip
};
this.options.tooltip = tooltip;
},
// legend
setOptionsLegend() {
const optionsCollapse = this.optionsSetup
const legend = this.options.legend
legend.show = optionsCollapse.isShowLegend
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
legend.orient = optionsCollapse.layoutFront
const optionsCollapse = this.optionsSetup;
const legend = this.options.legend;
legend.show = optionsCollapse.isShowLegend;
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
legend.bottom =
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
legend.orient = optionsCollapse.layoutFront;
legend.textStyle = {
color: optionsCollapse.lengedColor,
fontSize: optionsCollapse.fontSize,
}
legend.itemWidth = optionsCollapse.lengedWidth
fontSize: optionsCollapse.fontSize
};
legend.itemWidth = optionsCollapse.lengedWidth;
},
//
setOptionsColor() {
const optionsCollapse = this.optionsSetup
const customColor = optionsCollapse.customColor
if (!customColor) return
const arrColor = []
const optionsCollapse = this.optionsSetup;
const customColor = optionsCollapse.customColor;
if (!customColor) return;
const arrColor = [];
for (let i = 0; i < customColor.length; i++) {
arrColor.push(customColor[i].color)
arrColor.push(customColor[i].color);
}
this.options.color = arrColor
this.options = Object.assign({}, this.options)
this.options.color = arrColor;
this.options = Object.assign({}, this.options);
},
setOptionsData() {
const optionsData = this.optionsData // or
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
const optionsData = this.optionsData; // or
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val)
const staticData = JSON.parse(val);
for (const key in this.options.series) {
if (this.options.series[key].type == 'pie') {
this.options.series[key].data = staticData
if (this.options.series[key].type == "pie") {
this.options.series[key].data = staticData;
}
}
},
dynamicDataFn(val) {
if (!val) return
for (const key in this.options.series) {
if (this.options.series[key].type == 'pie') {
this.options.series[key].data = 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.renderingFn(res);
});
},
}
renderingFn(val) {
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = val;
}
}
}
}
};
</script>
<style scoped lang="scss">

Loading…
Cancel
Save