xt-element-ui 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/LICENSE +21 -0
- package/README.md +240 -104
- package/docs/README.md +67 -168
- package/docs/components/base/xt-card-item.md +1 -1
- package/docs/components/base/xt-step-price.md +280 -0
- package/docs/components/base/xt-time.md +165 -0
- package/docs/components/extend/ex-chart.md +252 -144
- package/docs/components/extend/ex-date-picker.md +0 -0
- package/docs/components/extend/ex-icon.md +1 -2
- package/docs/components/extend/ex-page.md +0 -75
- package/lib/index.common.js +1172 -586
- package/lib/index.css +1 -1
- package/lib/index.umd.js +1172 -586
- package/lib/index.umd.min.js +5 -5
- package/package.json +80 -41
- package/src/components/ex-chart/ExBar.vue +35 -29
- package/src/components/ex-chart/ExLine.vue +23 -14
- package/src/components/ex-chart/ExMulti.vue +30 -52
- package/src/components/ex-chart/ExPie.vue +23 -16
- package/src/components/ex-chart/theme/dark.js +5 -4
- package/src/components/ex-chart/theme/white.js +1 -0
- package/src/components/ex-chart/utils.js +148 -7
- package/src/components/ex-date-picker/index.js +2 -0
- package/src/components/{xt-date-picker → ex-date-picker}/index.vue +1 -1
- package/src/components/index.scss +6 -0
- package/src/components/xt-card-item/index.vue +3 -1
- package/src/components/xt-step-price/index.js +2 -0
- package/src/components/xt-step-price/index.vue +270 -0
- package/src/components/xt-step-price/style/index.scss +115 -0
- package/src/components/xt-step-price-item/index.js +2 -0
- package/src/components/xt-step-price-item/index.vue +174 -0
- package/src/components/xt-time/index.js +2 -0
- package/src/components/xt-time/index.vue +313 -0
- package/src/components/xt-time/style/index.scss +23 -0
- package/src/index.js +12 -3
- package/src/components/ex-chart/theme/blue.js +0 -91
- package/src/components/ex-chart/theme/orange.js +0 -92
- package/src/components/ex-chart/theme/starry.js +0 -106
- package/src/components/xt-date-picker/index.js +0 -2
- /package/src/components/{xt-date-picker → ex-date-picker}/SearchDate.vue +0 -0
- /package/src/components/{xt-date-picker → ex-date-picker}/quarter.vue +0 -0
package/package.json
CHANGED
|
@@ -1,41 +1,80 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xt-element-ui",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "基于
|
|
5
|
-
"main": "lib/index.common.js",
|
|
6
|
-
"module": "lib/index.esm.js",
|
|
7
|
-
"unpkg": "lib/index.umd.min.js",
|
|
8
|
-
"style": "lib/index.css",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"docs:dev": "vuepress dev docs",
|
|
11
|
-
"docs:build": "vuepress build docs",
|
|
12
|
-
"dev": "vue-cli-service serve",
|
|
13
|
-
"lib": "vue-cli-service build --target lib --name index --dest lib src/index.js",
|
|
14
|
-
"prepublishOnly": "npm run lib"
|
|
15
|
-
},
|
|
16
|
-
"peerDependencies": {
|
|
17
|
-
"vue": "^2.6.10"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@vue/cli-service": "~4.5.19",
|
|
21
|
-
"sass-loader": "^10.5.2",
|
|
22
|
-
"vue": "^2.6.10",
|
|
23
|
-
"vuepress": "^1.9.10",
|
|
24
|
-
"vuepress-plugin-demo-container": "^0.2.0",
|
|
25
|
-
"vuepress-theme-reco": "^1.6.17"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"lib",
|
|
29
|
-
"src",
|
|
30
|
-
"README.md",
|
|
31
|
-
"
|
|
32
|
-
"docs/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
}
|
|
41
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "xt-element-ui",
|
|
3
|
+
"version": "1.2.7",
|
|
4
|
+
"description": "基于 Vue 2.7 + ElementUI 的企业级组件库,提供丰富的自定义组件和扩展组件",
|
|
5
|
+
"main": "lib/index.common.js",
|
|
6
|
+
"module": "lib/index.esm.js",
|
|
7
|
+
"unpkg": "lib/index.umd.min.js",
|
|
8
|
+
"style": "lib/index.css",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"docs:dev": "vuepress dev docs",
|
|
11
|
+
"docs:build": "vuepress build docs",
|
|
12
|
+
"dev": "vue-cli-service serve",
|
|
13
|
+
"lib": "vue-cli-service build --target lib --name index --dest lib src/index.js",
|
|
14
|
+
"prepublishOnly": "npm run lib"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"vue": "^2.6.10"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@vue/cli-service": "~4.5.19",
|
|
21
|
+
"sass-loader": "^10.5.2",
|
|
22
|
+
"vue": "^2.6.10",
|
|
23
|
+
"vuepress": "^1.9.10",
|
|
24
|
+
"vuepress-plugin-demo-container": "^0.2.0",
|
|
25
|
+
"vuepress-theme-reco": "^1.6.17"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib",
|
|
29
|
+
"src",
|
|
30
|
+
"README.md",
|
|
31
|
+
"CHANGELOG.md",
|
|
32
|
+
"docs/components/**/*md",
|
|
33
|
+
"docs/README.md"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"echarts": "^6.1.0",
|
|
37
|
+
"element-ui": "^2.15.14",
|
|
38
|
+
"sass": "^1.32.13",
|
|
39
|
+
"vue-server-renderer": "^2.7.14"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"vue",
|
|
43
|
+
"vue2",
|
|
44
|
+
"element-ui",
|
|
45
|
+
"element",
|
|
46
|
+
"ui",
|
|
47
|
+
"components",
|
|
48
|
+
"xt-element-ui",
|
|
49
|
+
"chart",
|
|
50
|
+
"table",
|
|
51
|
+
"echarts",
|
|
52
|
+
"component-library",
|
|
53
|
+
"vue-components",
|
|
54
|
+
"admin",
|
|
55
|
+
"dashboard"
|
|
56
|
+
],
|
|
57
|
+
"author": "XT-Element-UI Contributors",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/JobWebNie/xt-element-ui/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://jobwebnie.github.io/xt-element-ui/",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/JobWebNie/xt-element-ui.git"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=12.0.0",
|
|
69
|
+
"npm": ">=6.0.0"
|
|
70
|
+
},
|
|
71
|
+
"browserslist": [
|
|
72
|
+
"> 1%",
|
|
73
|
+
"last 2 versions",
|
|
74
|
+
"not dead",
|
|
75
|
+
"Chrome >= 60",
|
|
76
|
+
"Firefox >= 60",
|
|
77
|
+
"Safari >= 10.1",
|
|
78
|
+
"Edge >= 15"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
@@ -10,16 +10,16 @@ export default {
|
|
|
10
10
|
type: Array,
|
|
11
11
|
default: () => {
|
|
12
12
|
return [
|
|
13
|
-
{ value: 65,
|
|
14
|
-
{ value: 70,
|
|
15
|
-
{ value: 73,
|
|
16
|
-
{ value: 78,
|
|
17
|
-
{ value: 88,
|
|
18
|
-
{ value: 93,
|
|
19
|
-
{ value: 99,
|
|
20
|
-
{ value: 103,
|
|
21
|
-
{ value: 113,
|
|
22
|
-
{ value: 125,
|
|
13
|
+
{ value: 65, label: "吴十" },
|
|
14
|
+
{ value: 70, label: "唐九" },
|
|
15
|
+
{ value: 73, label: "钱一" },
|
|
16
|
+
{ value: 78, label: "孙二" },
|
|
17
|
+
{ value: 88, label: "刘八" },
|
|
18
|
+
{ value: 93, label: "王七" },
|
|
19
|
+
{ value: 99, label: "赵六" },
|
|
20
|
+
{ value: 103, label: "宋五" },
|
|
21
|
+
{ value: 113, label: "李四" },
|
|
22
|
+
{ value: 125, label: "张三" }
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
25
|
},
|
|
@@ -28,15 +28,15 @@ export default {
|
|
|
28
28
|
type: String,
|
|
29
29
|
default: "medium"
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
fieldKeys: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({ label: "label", value: "value", data: "data" })
|
|
34
|
+
},
|
|
35
35
|
markPoint: {
|
|
36
36
|
type: Boolean,
|
|
37
37
|
default: false
|
|
38
38
|
},
|
|
39
|
-
|
|
39
|
+
unit: {
|
|
40
40
|
type: String,
|
|
41
41
|
default: ""
|
|
42
42
|
},
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
type: Boolean,
|
|
49
49
|
default: false
|
|
50
50
|
},
|
|
51
|
-
longLable: {
|
|
51
|
+
longLable: {
|
|
52
52
|
type: Boolean,
|
|
53
53
|
default: false
|
|
54
54
|
},
|
|
@@ -63,6 +63,10 @@ export default {
|
|
|
63
63
|
splitNumber: {
|
|
64
64
|
type: Number,
|
|
65
65
|
default: 5
|
|
66
|
+
},
|
|
67
|
+
simpleMode: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
data() {
|
|
@@ -79,15 +83,10 @@ export default {
|
|
|
79
83
|
_self.initChart();
|
|
80
84
|
}
|
|
81
85
|
},
|
|
82
|
-
|
|
86
|
+
unit: {
|
|
83
87
|
deep: true,
|
|
84
88
|
handler(newVal, oldVal) {
|
|
85
89
|
const _self = this;
|
|
86
|
-
if (newVal == "kW.h") {
|
|
87
|
-
_self.name = "用电量";
|
|
88
|
-
} else if (newVal == "m³") {
|
|
89
|
-
_self.name = "用气量";
|
|
90
|
-
}
|
|
91
90
|
_self.initChart();
|
|
92
91
|
}
|
|
93
92
|
},
|
|
@@ -101,7 +100,10 @@ export default {
|
|
|
101
100
|
methods: {
|
|
102
101
|
initChart() {
|
|
103
102
|
const _self = this;
|
|
104
|
-
|
|
103
|
+
const keys = Object.assign(
|
|
104
|
+
{ label: "label", value: "value", data: "data" },
|
|
105
|
+
_self.fieldKeys || {}
|
|
106
|
+
);
|
|
105
107
|
const _xAxis = {
|
|
106
108
|
type: "category",
|
|
107
109
|
inverse: this.reverse,
|
|
@@ -112,7 +114,7 @@ export default {
|
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
116
|
data: _self.chartData.map((item) => {
|
|
115
|
-
return item.
|
|
117
|
+
return item[keys.label];
|
|
116
118
|
})
|
|
117
119
|
};
|
|
118
120
|
const _yAxis = {
|
|
@@ -166,8 +168,8 @@ export default {
|
|
|
166
168
|
},
|
|
167
169
|
xAxis: this.reverse ? _yAxis : _xAxis,
|
|
168
170
|
yAxis: this.reverse ? _xAxis : _yAxis,
|
|
169
|
-
series:
|
|
170
|
-
name: _self.
|
|
171
|
+
series: {
|
|
172
|
+
name: _self.unit,
|
|
171
173
|
type: "bar",
|
|
172
174
|
markPoint: {
|
|
173
175
|
data: [
|
|
@@ -177,21 +179,25 @@ export default {
|
|
|
177
179
|
},
|
|
178
180
|
avoidLabelOverlap: true,
|
|
179
181
|
data: _self.chartData.map((item, ind) => {
|
|
180
|
-
const
|
|
182
|
+
const label = item[keys.label];
|
|
183
|
+
const value = item[keys.value];
|
|
181
184
|
return {
|
|
182
185
|
value,
|
|
183
|
-
name,
|
|
186
|
+
name: label,
|
|
184
187
|
tooltip: {
|
|
185
188
|
borderWidth: 1
|
|
186
189
|
}
|
|
187
190
|
};
|
|
188
191
|
})
|
|
189
|
-
}
|
|
192
|
+
},
|
|
190
193
|
dataZoom: _self.showZoom ? [{ height: 20, bottom: 0 }] : [],
|
|
191
194
|
};
|
|
192
195
|
if (!this.markPoint) {
|
|
193
196
|
this.$delete(option.series[0], "markPoint");
|
|
194
197
|
}
|
|
198
|
+
if (this.simpleMode) {
|
|
199
|
+
EchartsUtil.applySimpleMode(option, "bar");
|
|
200
|
+
}
|
|
195
201
|
this.myChart = EchartsUtil.init(_self.$refs.barchart, this.theme, option, this.size);
|
|
196
202
|
}
|
|
197
203
|
}
|
|
@@ -6,10 +6,6 @@ import EchartsUtil from "./utils";
|
|
|
6
6
|
export default {
|
|
7
7
|
name: "XtLine",
|
|
8
8
|
props: {
|
|
9
|
-
isDark: {
|
|
10
|
-
type: Boolean, // 设置文字标线为白色系
|
|
11
|
-
default: false
|
|
12
|
-
},
|
|
13
9
|
theme: {},
|
|
14
10
|
size: {
|
|
15
11
|
type: String,
|
|
@@ -19,23 +15,31 @@ export default {
|
|
|
19
15
|
type: Array,
|
|
20
16
|
default: () => {
|
|
21
17
|
return [
|
|
22
|
-
{ value: 53,
|
|
23
|
-
{ value: 10,
|
|
24
|
-
{ value: 60,
|
|
18
|
+
{ value: 53, label: "张三" },
|
|
19
|
+
{ value: 10, label: "李四" },
|
|
20
|
+
{ value: 60, label: "宋五" }
|
|
25
21
|
];
|
|
26
22
|
}
|
|
27
23
|
},
|
|
24
|
+
fieldKeys: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({ label: "label", value: "value", data: "data" })
|
|
27
|
+
},
|
|
28
28
|
isArea: {
|
|
29
29
|
type: Boolean,
|
|
30
30
|
default: false
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
unit: {
|
|
33
33
|
type: String,
|
|
34
34
|
default: ""
|
|
35
35
|
},
|
|
36
36
|
intervalvalue: {
|
|
37
37
|
type: Number,
|
|
38
38
|
default: 0
|
|
39
|
+
},
|
|
40
|
+
simpleMode: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
45
|
data() {
|
|
@@ -51,7 +55,7 @@ export default {
|
|
|
51
55
|
_self.initChart();
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
|
-
|
|
58
|
+
unit: {
|
|
55
59
|
deep: true,
|
|
56
60
|
handler(newVal, oldVal) {
|
|
57
61
|
const _self = this;
|
|
@@ -67,9 +71,11 @@ export default {
|
|
|
67
71
|
},
|
|
68
72
|
methods: {
|
|
69
73
|
initChart() {
|
|
70
|
-
console.log(this.intervalvalue);
|
|
71
74
|
const _self = this;
|
|
72
|
-
|
|
75
|
+
const keys = Object.assign(
|
|
76
|
+
{ label: "label", value: "value", data: "data" },
|
|
77
|
+
_self.fieldKeys || {}
|
|
78
|
+
);
|
|
73
79
|
const option = {
|
|
74
80
|
animationDuration: 500,
|
|
75
81
|
grid: {
|
|
@@ -91,7 +97,7 @@ export default {
|
|
|
91
97
|
},
|
|
92
98
|
boundaryGap: false,
|
|
93
99
|
data: _self.chartData.map((item) => {
|
|
94
|
-
return item.
|
|
100
|
+
return item[keys.label];
|
|
95
101
|
})
|
|
96
102
|
}],
|
|
97
103
|
yAxis: {
|
|
@@ -109,7 +115,7 @@ export default {
|
|
|
109
115
|
type: "dashed"
|
|
110
116
|
}
|
|
111
117
|
},
|
|
112
|
-
name: _self.
|
|
118
|
+
name: _self.unit,
|
|
113
119
|
scale: true,
|
|
114
120
|
axisLabel: {
|
|
115
121
|
margin: 2,
|
|
@@ -130,11 +136,14 @@ export default {
|
|
|
130
136
|
smooth: true,
|
|
131
137
|
avoidLabelOverlap: true,
|
|
132
138
|
data: _self.chartData.map((item, ind) => {
|
|
133
|
-
return item.value;
|
|
139
|
+
return item[keys.value];
|
|
134
140
|
})
|
|
135
141
|
}]
|
|
136
142
|
};
|
|
137
143
|
|
|
144
|
+
if (this.simpleMode) {
|
|
145
|
+
EchartsUtil.applySimpleMode(option, "line");
|
|
146
|
+
}
|
|
138
147
|
this.myChart = EchartsUtil.init(_self.$refs.linechart, this.theme, option, this.size);
|
|
139
148
|
}
|
|
140
149
|
}
|
|
@@ -6,21 +6,20 @@ import EchartsUtil from "./utils";
|
|
|
6
6
|
export default {
|
|
7
7
|
name: "XtMulti",
|
|
8
8
|
props: {
|
|
9
|
-
isDark: {
|
|
10
|
-
type: Boolean, // 设置文字标线为白色系
|
|
11
|
-
default: false
|
|
12
|
-
},
|
|
13
9
|
theme: {},
|
|
14
10
|
size: {
|
|
15
11
|
type: String,
|
|
16
12
|
default: "medium"
|
|
17
13
|
},
|
|
18
|
-
|
|
14
|
+
fieldKeys: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: () => ({ label: "label", value: "value", data: "data" })
|
|
17
|
+
},
|
|
19
18
|
simpleMode: {
|
|
20
19
|
type: Boolean,
|
|
21
20
|
default: false
|
|
22
21
|
},
|
|
23
|
-
highlightKey: String
|
|
22
|
+
highlightKey: String,
|
|
24
23
|
config: {
|
|
25
24
|
type: Object,
|
|
26
25
|
default() {
|
|
@@ -29,7 +28,6 @@ export default {
|
|
|
29
28
|
rotate: 0,
|
|
30
29
|
gridbottom: 40,
|
|
31
30
|
isShowthreshold: false
|
|
32
|
-
|
|
33
31
|
};
|
|
34
32
|
}
|
|
35
33
|
},
|
|
@@ -97,16 +95,11 @@ export default {
|
|
|
97
95
|
colors: {
|
|
98
96
|
type: Array,
|
|
99
97
|
default: () => { return []; }
|
|
100
|
-
},
|
|
101
|
-
energyType: {
|
|
102
|
-
type: [String, Array],
|
|
103
|
-
default: ""
|
|
104
98
|
}
|
|
105
99
|
},
|
|
106
100
|
data() {
|
|
107
101
|
return {
|
|
108
102
|
myChart: null
|
|
109
|
-
// chartList: []
|
|
110
103
|
};
|
|
111
104
|
},
|
|
112
105
|
watch: {
|
|
@@ -119,18 +112,6 @@ export default {
|
|
|
119
112
|
_self.initChart();
|
|
120
113
|
}
|
|
121
114
|
},
|
|
122
|
-
energyType: {
|
|
123
|
-
deep: true,
|
|
124
|
-
handler(newVal, oldVal) {
|
|
125
|
-
if (newVal && oldVal && newVal.toString() == oldVal.toString()) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
this.myChart && this.myChart.dispose();
|
|
129
|
-
this.myChart = null;
|
|
130
|
-
const _self = this;
|
|
131
|
-
_self.initChart();
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
115
|
theme(newVal) {
|
|
135
116
|
this.myChart && this.myChart.dispose();
|
|
136
117
|
this.myChart = null;
|
|
@@ -143,6 +124,10 @@ export default {
|
|
|
143
124
|
methods: {
|
|
144
125
|
initChart() {
|
|
145
126
|
const _self = this;
|
|
127
|
+
const keys = Object.assign(
|
|
128
|
+
{ label: "label", value: "value", data: "data" },
|
|
129
|
+
_self.fieldKeys || {}
|
|
130
|
+
);
|
|
146
131
|
|
|
147
132
|
// 从 chartData 中收集所有 unit,并保持首次出现顺序去重
|
|
148
133
|
const uniqueUnits = [];
|
|
@@ -153,24 +138,13 @@ export default {
|
|
|
153
138
|
}
|
|
154
139
|
});
|
|
155
140
|
|
|
156
|
-
// 单个 yAxis 的生成函数
|
|
157
141
|
const groupYAxis = (unit, index) => {
|
|
158
142
|
const yAxis = {
|
|
159
143
|
type: "value",
|
|
160
144
|
name: unit,
|
|
161
|
-
axisLine: {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
axisTick: {
|
|
167
|
-
show: false
|
|
168
|
-
},
|
|
169
|
-
splitLine: {
|
|
170
|
-
lineStyle: {
|
|
171
|
-
type: "dashed"
|
|
172
|
-
}
|
|
173
|
-
},
|
|
145
|
+
axisLine: { show: false, lineStyle: {} },
|
|
146
|
+
axisTick: { show: false },
|
|
147
|
+
splitLine: { lineStyle: { type: "dashed" } },
|
|
174
148
|
axisLabel: {
|
|
175
149
|
formatter: function(value, index) {
|
|
176
150
|
if (value >= 10000 && value < 10000000) {
|
|
@@ -189,27 +163,28 @@ export default {
|
|
|
189
163
|
return yAxis;
|
|
190
164
|
};
|
|
191
165
|
|
|
192
|
-
// 根据去重后的 unit 生成 yAxis
|
|
193
166
|
const yAxisList = uniqueUnits.length
|
|
194
167
|
? uniqueUnits.map((unit, idx) => groupYAxis(unit, idx))
|
|
195
168
|
: [groupYAxis("", 0)];
|
|
196
169
|
|
|
197
|
-
// unit -> yAxisIndex 的映射,便于 series 绑定
|
|
198
170
|
const unitToYAxisIndex = {};
|
|
199
171
|
uniqueUnits.forEach((unit, idx) => {
|
|
200
172
|
unitToYAxisIndex[unit] = idx;
|
|
201
173
|
});
|
|
202
174
|
|
|
175
|
+
const firstSeriesData = _self.chartData && _self.chartData.length
|
|
176
|
+
? _self.chartData[0][keys.data] || []
|
|
177
|
+
: [];
|
|
178
|
+
|
|
203
179
|
const option = {
|
|
204
180
|
legend: {
|
|
205
181
|
right: 20,
|
|
206
182
|
top: 0,
|
|
207
183
|
show: true,
|
|
208
184
|
data: _self.chartData.map((item) => {
|
|
209
|
-
return item.label;
|
|
185
|
+
return item[keys.label];
|
|
210
186
|
}),
|
|
211
|
-
textStyle: {
|
|
212
|
-
}
|
|
187
|
+
textStyle: {}
|
|
213
188
|
},
|
|
214
189
|
tooltip: {
|
|
215
190
|
borderWidth: 1,
|
|
@@ -229,9 +204,9 @@ export default {
|
|
|
229
204
|
axisLabel: {
|
|
230
205
|
rotate: this.config.rotate
|
|
231
206
|
},
|
|
232
|
-
data:
|
|
233
|
-
return item.label;
|
|
234
|
-
})
|
|
207
|
+
data: firstSeriesData.map((item) => {
|
|
208
|
+
return item[keys.label];
|
|
209
|
+
})
|
|
235
210
|
},
|
|
236
211
|
yAxis: yAxisList,
|
|
237
212
|
dataZoom: [
|
|
@@ -242,21 +217,24 @@ export default {
|
|
|
242
217
|
end: 100
|
|
243
218
|
}
|
|
244
219
|
],
|
|
245
|
-
series: this.getSeriesData(unitToYAxisIndex)
|
|
220
|
+
series: this.getSeriesData(unitToYAxisIndex, keys)
|
|
246
221
|
};
|
|
222
|
+
if (this.simpleMode) {
|
|
223
|
+
EchartsUtil.applySimpleMode(option, "multi");
|
|
224
|
+
}
|
|
247
225
|
this.myChart = EchartsUtil.init(_self.$refs.multilinechart, this.theme, option, this.size);
|
|
248
226
|
},
|
|
249
|
-
getSeriesData(unitToYAxisIndex) {
|
|
227
|
+
getSeriesData(unitToYAxisIndex, keys) {
|
|
250
228
|
const _self = this;
|
|
251
|
-
|
|
252
229
|
const _seriesData = [];
|
|
253
|
-
_self.chartData.
|
|
230
|
+
_self.chartData.forEach((item, ind) => {
|
|
231
|
+
const seriesItems = item[keys.data] || [];
|
|
254
232
|
const _item = {
|
|
255
233
|
animation: true,
|
|
256
|
-
name: item.label,
|
|
234
|
+
name: item[keys.label],
|
|
257
235
|
type: item.type || "bar",
|
|
258
236
|
avoidLabelOverlap: true,
|
|
259
|
-
data:
|
|
237
|
+
data: seriesItems.map(it => it[keys.value]),
|
|
260
238
|
yAxisIndex: unitToYAxisIndex[item.unit || ""] != null ? unitToYAxisIndex[item.unit || ""] : 0
|
|
261
239
|
};
|
|
262
240
|
_seriesData.push(_item);
|
|
@@ -15,12 +15,16 @@ export default {
|
|
|
15
15
|
type: Array,
|
|
16
16
|
default: () => {
|
|
17
17
|
return [
|
|
18
|
-
{ value: 53,
|
|
19
|
-
{ value: 10,
|
|
20
|
-
{ value: 60,
|
|
18
|
+
{ value: 53, label: "张三" },
|
|
19
|
+
{ value: 10, label: "李四" },
|
|
20
|
+
{ value: 60, label: "宋五" }
|
|
21
21
|
];
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
fieldKeys: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({ label: "label", value: "value", data: "data" })
|
|
27
|
+
},
|
|
24
28
|
colors: {
|
|
25
29
|
type: Array,
|
|
26
30
|
default: () => { return []; }
|
|
@@ -33,12 +37,11 @@ export default {
|
|
|
33
37
|
type: Boolean,
|
|
34
38
|
default: true
|
|
35
39
|
},
|
|
36
|
-
// 新增极简模式开关
|
|
37
40
|
simpleMode: {
|
|
38
41
|
type: Boolean,
|
|
39
42
|
default: false
|
|
40
43
|
},
|
|
41
|
-
highlightKey: String
|
|
44
|
+
highlightKey: String,
|
|
42
45
|
roseType: {
|
|
43
46
|
type: String,
|
|
44
47
|
default: ""
|
|
@@ -59,7 +62,11 @@ export default {
|
|
|
59
62
|
},
|
|
60
63
|
computed: {
|
|
61
64
|
totalNum() {
|
|
62
|
-
|
|
65
|
+
const keys = Object.assign(
|
|
66
|
+
{ label: "label", value: "value", data: "data" },
|
|
67
|
+
this.fieldKeys || {}
|
|
68
|
+
);
|
|
69
|
+
return this.chartData.map(it => parseFloat(it[keys.value])).reduce((pre, aft) => { return pre + aft; }, 0);
|
|
63
70
|
}
|
|
64
71
|
},
|
|
65
72
|
watch: {
|
|
@@ -78,23 +85,19 @@ export default {
|
|
|
78
85
|
this.$nextTick(() => {
|
|
79
86
|
this.initChart();
|
|
80
87
|
});
|
|
81
|
-
/* setTimeout(() => {
|
|
82
|
-
this.initChart();
|
|
83
|
-
}, 1000); */
|
|
84
88
|
},
|
|
85
89
|
methods: {
|
|
86
90
|
initChart() {
|
|
87
91
|
const _self = this;
|
|
88
|
-
|
|
92
|
+
const keys = Object.assign(
|
|
93
|
+
{ label: "label", value: "value", data: "data" },
|
|
94
|
+
_self.fieldKeys || {}
|
|
95
|
+
);
|
|
89
96
|
const option = {
|
|
90
97
|
title: {
|
|
91
98
|
text: `${_self.totalLabel}:${_self.totalNum}`,
|
|
92
99
|
textStyle: {
|
|
93
|
-
color: "#808080",
|
|
94
|
-
fontSize: 20
|
|
95
100
|
},
|
|
96
|
-
// left: "40%",
|
|
97
|
-
// top: "45%",
|
|
98
101
|
top: "middle",
|
|
99
102
|
left: "center"
|
|
100
103
|
},
|
|
@@ -122,10 +125,11 @@ export default {
|
|
|
122
125
|
minAngle: 5,
|
|
123
126
|
avoidLabelOverlap: true,
|
|
124
127
|
data: _self.chartData.map((item, ind) => {
|
|
125
|
-
const
|
|
128
|
+
const label = item[keys.label];
|
|
129
|
+
const value = item[keys.value];
|
|
126
130
|
return {
|
|
127
131
|
value,
|
|
128
|
-
name,
|
|
132
|
+
name: label,
|
|
129
133
|
labelLine: {
|
|
130
134
|
show: this.showLabel
|
|
131
135
|
},
|
|
@@ -146,6 +150,9 @@ export default {
|
|
|
146
150
|
})
|
|
147
151
|
}]
|
|
148
152
|
};
|
|
153
|
+
if (this.simpleMode) {
|
|
154
|
+
EchartsUtil.applySimpleMode(option, "pie");
|
|
155
|
+
}
|
|
149
156
|
this.myChart = EchartsUtil.init(_self.$refs.piechart, this.theme, option, this.size);
|
|
150
157
|
}
|
|
151
158
|
}
|
|
@@ -42,7 +42,7 @@ export default {
|
|
|
42
42
|
color: "#ffffff"
|
|
43
43
|
},
|
|
44
44
|
itemStyle: {
|
|
45
|
-
borderColor:
|
|
45
|
+
borderColor: "#dcdfe6"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
gauge: {
|
|
@@ -83,11 +83,12 @@ export default {
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
tooltip: {
|
|
86
|
-
backgroundColor:
|
|
87
|
-
borderColor: variables.xtColorBorder,
|
|
86
|
+
backgroundColor: "#333333",
|
|
88
87
|
borderWidth: 1,
|
|
88
|
+
borderColor: "#dcdfe6",
|
|
89
89
|
textStyle: {
|
|
90
90
|
color: "#fff"
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
},
|
|
93
|
+
trigger: "axis"
|
|
93
94
|
};
|