247 lines
6.6 KiB
Vue
247 lines
6.6 KiB
Vue
|
<template>
|
||
|
<view class="box-t">
|
||
|
<view class="box-t-color">
|
||
|
<view class="box-card" v-for="(item,index) in uchartsData.weight_statistics_apiarys" :key="index">
|
||
|
|
||
|
<view class="charts-box">
|
||
|
<view class="xin-box-title">
|
||
|
<view style="flex: 1;display: flex;align-items: center;">
|
||
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/出勤.png"></image>
|
||
|
<text style="margin-left: 10rpx;">{{item.name}}</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
<qiun-data-charts
|
||
|
type="column"
|
||
|
:opts="opts"
|
||
|
:chartData="chartData[index]"
|
||
|
:errorShow="false"
|
||
|
:errorReload="false"
|
||
|
:animation="false"
|
||
|
:tooltipShow="false"
|
||
|
:tapLegend="false"
|
||
|
/>
|
||
|
</view>
|
||
|
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import request from '../../utils/request';
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
uchartsData:{},
|
||
|
chartData: [],
|
||
|
//这里的 opts 是图表类型 type="column" 的全部配置参数,您可以将此配置复制到 config-ucharts.js 文件中下标为 ['column'] 的节点中来覆盖全局默认参数。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式,达到页面简洁的需求。
|
||
|
opts: {
|
||
|
timing: "linear",
|
||
|
duration: 1000,
|
||
|
rotate: false,
|
||
|
rotateLock: false,
|
||
|
color: ["#89c28c","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
|
||
|
padding: [0,0,0,0],
|
||
|
fontSize: 13,
|
||
|
fontColor: "#666666",
|
||
|
dataLabel: false,
|
||
|
dataPointShape: false,
|
||
|
dataPointShapeType: "solid",
|
||
|
touchMoveLimit: 60,
|
||
|
enableScroll: false,
|
||
|
enableMarkLine: false,
|
||
|
legend: {
|
||
|
show: false,
|
||
|
position: "bottom",
|
||
|
float: "center",
|
||
|
padding: 5,
|
||
|
margin: 5,
|
||
|
backgroundColor: "rgba(0,0,0,0)",
|
||
|
borderColor: "rgba(0,0,0,0)",
|
||
|
borderWidth: 0,
|
||
|
fontSize: 13,
|
||
|
fontColor: "#666666",
|
||
|
lineHeight: 11,
|
||
|
hiddenColor: "#CECECE",
|
||
|
itemGap: 10
|
||
|
},
|
||
|
xAxis: {
|
||
|
disableGrid: true,
|
||
|
disabled: false,
|
||
|
axisLine: false,
|
||
|
axisLineColor: "#CCCCCC",
|
||
|
calibration: false,
|
||
|
fontColor: "#666666",
|
||
|
fontSize: 13,
|
||
|
lineHeight: 20,
|
||
|
marginTop: 10,
|
||
|
rotateLabel: false,
|
||
|
rotateAngle: 45,
|
||
|
itemCount: 5,
|
||
|
boundaryGap: "center",
|
||
|
splitNumber: 5,
|
||
|
gridColor: "#CCCCCC",
|
||
|
gridType: "dash",
|
||
|
dashLength: 4,
|
||
|
gridEval: 1,
|
||
|
scrollShow: false,
|
||
|
scrollAlign: "left",
|
||
|
scrollColor: "#A6A6A6",
|
||
|
scrollBackgroundColor: "#EFEBEF",
|
||
|
title: "",
|
||
|
titleFontSize: 13,
|
||
|
titleOffsetY: 0,
|
||
|
titleOffsetX: 0,
|
||
|
titleFontColor: "#666666",
|
||
|
format: ""
|
||
|
},
|
||
|
yAxis: {
|
||
|
data: [
|
||
|
{
|
||
|
min: 0,
|
||
|
disabled: false,
|
||
|
axisLine: false,
|
||
|
position: "left",
|
||
|
calibration: false,
|
||
|
title: "",
|
||
|
textAlign: "left",
|
||
|
titleFontSize: 13,
|
||
|
max: null,
|
||
|
format: "",
|
||
|
titleOffsetY: 0,
|
||
|
titleOffsetX: 0,
|
||
|
type: "value"
|
||
|
}
|
||
|
],
|
||
|
disabled: false,
|
||
|
disableGrid: false,
|
||
|
splitNumber: 5,
|
||
|
gridType: "dash",
|
||
|
dashLength: 4,
|
||
|
gridColor: "#CCCCCC",
|
||
|
padding: 10,
|
||
|
showTitle: true
|
||
|
},
|
||
|
extra: {
|
||
|
column: {
|
||
|
type: "group",
|
||
|
width: 20,
|
||
|
activeBgColor: "#000000",
|
||
|
activeBgOpacity: 0.08,
|
||
|
seriesGap: 2,
|
||
|
categoryGap: 3,
|
||
|
barBorderCircle: false,
|
||
|
barBorderRadius: [
|
||
|
50,
|
||
|
50,
|
||
|
50,
|
||
|
50
|
||
|
],
|
||
|
linearType: "none",
|
||
|
linearOpacity: 1,
|
||
|
colorStop: 0,
|
||
|
meterBorder: 1,
|
||
|
meterFillColor: "#FFFFFF",
|
||
|
labelPosition: "outside"
|
||
|
},
|
||
|
tooltip: {
|
||
|
showBox: false,
|
||
|
showArrow: false,
|
||
|
showCategory: false,
|
||
|
borderWidth: 0,
|
||
|
borderRadius: 0,
|
||
|
borderColor: "#000000",
|
||
|
borderOpacity: 0.7,
|
||
|
bgColor: "#000000",
|
||
|
bgOpacity: 0.7,
|
||
|
gridType: "solid",
|
||
|
dashLength: 4,
|
||
|
gridColor: "#CCCCCC",
|
||
|
boxPadding: 3,
|
||
|
fontSize: 13,
|
||
|
lineHeight: 20,
|
||
|
fontColor: "#FFFFFF",
|
||
|
legendShow: true,
|
||
|
legendShape: "auto",
|
||
|
splitLine: true,
|
||
|
horizentalLine: false,
|
||
|
xAxisLabel: false,
|
||
|
yAxisLabel: false,
|
||
|
labelBgColor: "#FFFFFF",
|
||
|
labelBgOpacity: 0.7,
|
||
|
labelFontColor: "#666666"
|
||
|
},
|
||
|
markLine: {
|
||
|
type: "solid",
|
||
|
dashLength: 4,
|
||
|
data: []
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
},
|
||
|
onReady() {
|
||
|
this.getServerData();
|
||
|
},
|
||
|
methods: {
|
||
|
async echartsFn(){
|
||
|
const eres = await request.get('/api/index/statistics') // echarts数据
|
||
|
this.uchartsData = {...eres.data.data}
|
||
|
console.log(this.uchartsData,'99999999999')
|
||
|
},
|
||
|
async getServerData() {
|
||
|
await this.echartsFn()
|
||
|
console.log(this.uchartsData.weight_statistics_apiarys , '8888888')
|
||
|
//模拟从服务器获取数据时的延时
|
||
|
setTimeout(() => {
|
||
|
let res = Object.values(this.uchartsData.work_count_statistics_apiarys).map(item => {
|
||
|
return {
|
||
|
categories: [...item.xData],
|
||
|
series: [
|
||
|
{
|
||
|
name: "目标值",
|
||
|
data: item.yData
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
});
|
||
|
this.chartData = JSON.parse(JSON.stringify(res));
|
||
|
console.log(this.chartData,'123456789')
|
||
|
}, 500);
|
||
|
},
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
|
||
|
.charts-box {
|
||
|
width: 100%;
|
||
|
}
|
||
|
/* 卡片 */
|
||
|
.box-t{
|
||
|
/* height: 100%; */
|
||
|
width: 100%;
|
||
|
position: absolute;
|
||
|
top: 0px;
|
||
|
bottom: 0px;
|
||
|
background-color: #f7f7f7;
|
||
|
}
|
||
|
.box-t-color{
|
||
|
background-color: #f7f7f7;
|
||
|
}
|
||
|
.box-card{
|
||
|
border-radius: 40rpx;
|
||
|
background-color: #fff;
|
||
|
margin: 20rpx;
|
||
|
padding: 10rpx;
|
||
|
/* height: 420rpx; */
|
||
|
}
|
||
|
.xin-box-title{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
padding: 20rpx;
|
||
|
color: #23693F;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
</style>
|