|
@@ -308,10 +308,22 @@ const radarOption = {
|
|
|
};
|
|
|
export default {
|
|
|
name: 'Chartsr',
|
|
|
-
|
|
|
+ props: {
|
|
|
+ //数据的字段名
|
|
|
+ fieldname: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
+ echartname: {
|
|
|
+ type: String,
|
|
|
+ default: () => ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- inHourDataOption: null
|
|
|
+ inHourDataOption: null,
|
|
|
+ listdata: [],
|
|
|
+ page: 0, //当前table页面
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
@@ -329,10 +341,98 @@ export default {
|
|
|
this.pageQuery = query
|
|
|
//获取页面配置
|
|
|
const { pagecode, qid, auth_id } = this.$route.meta
|
|
|
- //获取页面权限类型组件 pagetype 1模块 2页面 3按钮 4表格 5树形 6弹窗
|
|
|
+ //获取页面权限类型组件 pagetype 1模块 2页面 3按钮 4表格 5树形 6弹窗
|
|
|
const pageAuths = this.authArrs
|
|
|
if (!pageAuths.length) return
|
|
|
- }
|
|
|
+ },
|
|
|
+ //处理数据1
|
|
|
+ processingdata (data) {
|
|
|
+ let arr = []
|
|
|
+ fieldname.forEach(res => {
|
|
|
+ arr.push(data[res])
|
|
|
+ });
|
|
|
+ let series = [
|
|
|
+ {
|
|
|
+ name: this.echartname,
|
|
|
+ data: arr,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '20',
|
|
|
+ showBackground: true,
|
|
|
+ backgroundStyle: {
|
|
|
+ color: 'rgba(180, 180, 180, 0.2)'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: {
|
|
|
+ type: "linear",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "#595FAE", // 0% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.2,
|
|
|
+ color: "#595FAE", // 0% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "#595FAE", // 100% 处的颜色
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ return series
|
|
|
+ },
|
|
|
+ //处理数据2
|
|
|
+ processingdata1 (data) {
|
|
|
+ let arr = []
|
|
|
+ fieldname.forEach(res => {
|
|
|
+ data.forEach(element => {
|
|
|
+ arr.push(element[res])
|
|
|
+ });
|
|
|
+ });
|
|
|
+ let series = [
|
|
|
+ {
|
|
|
+ name: this.echartname,
|
|
|
+ data: arr,
|
|
|
+ type: 'bar',
|
|
|
+ barWidth: '20',
|
|
|
+ showBackground: true,
|
|
|
+ backgroundStyle: {
|
|
|
+ color: 'rgba(180, 180, 180, 0.2)'
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: {
|
|
|
+ type: "linear",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "#595FAE", // 0% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.2,
|
|
|
+ color: "#595FAE", // 0% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "#595FAE", // 100% 处的颜色
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ return series
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|