js部分:
import * as echarts from '../../../ec-canvas/echarts.js';
import $http from '../../../utils/fly.js';
var Chart=null;
const app = getApp();
Component({
/**
* 组件的属性列表
*/
data: {
// total:0, //待审批条数
// total2:0, //已审批条数
busDatatype:'1',
ec: {
onInit: function (canvas, width, height) {
chart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chart);
return chart;
},
lazyLoad: true // 延迟加载
}
},
properties: {
mes: {
type: String,
value: ''
},
},
attached() {
// this.searchBusiness(1, 0); //折线图拿到数据
// this.searchSM(1, 0, '2');
// this.searchUserInfor(1);
this.getList()
this.echartsComponnet = this.selectComponent('#mychart');
if (!Chart) {
this.init_echarts(); //初始化图表
} else {
this.setOption(Chart); //更新数据
}
},
methods:{
//折线图请求数据
// searchBusiness:function(pageNum, pageLength){
// this.$axios.post('/api/user/approverDownload', qs.stringify({ //折线
// 'type': this.busDatatype,
// 'pageNum':pageNum !== 0 ? pageNum : pageLength,
// })).then(res=>{
// // 成功后执行
// if(res.data.errCode===0){
// this.busData=res.data.data.list;
// this.busDatatotal=res.data.data.total;
// if(pageLength === null) return;
// if(pageLength === 0) {
// pageLength = Math.ceil(this.busDatatotal / 20);
// if(pageLength === 0) {
// return;
// }
// this.searchBusiness(0, pageLength);
// }else if(pageLength > 0) {
// this.initReviewChart();
// }
// }els