|
@@ -11,19 +11,27 @@ import apiUrl from '../../../util/apiUrl'
|
|
var app = getApp();
|
|
var app = getApp();
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
- reportDate: '2020年11月',
|
|
|
|
- servantName: '王阿姨',
|
|
|
|
- serviceDay: '28',
|
|
|
|
- percentTop: '88%',
|
|
|
|
- expendTotal: '1888',
|
|
|
|
- taskNum: '60',
|
|
|
|
|
|
+ reportDate: '',
|
|
|
|
+ servantName: '',
|
|
|
|
+ serviceDay: '',
|
|
|
|
+ percentTop: '',
|
|
|
|
+ expendTotal: '',
|
|
|
|
+ taskNum: '',
|
|
reportInfo:'',
|
|
reportInfo:'',
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
let reportInfo=app.globalData.reportInfo;
|
|
let reportInfo=app.globalData.reportInfo;
|
|
|
|
+ let serviceTime=JSON.parse(reportInfo.serviceTime);
|
|
|
|
+ let year=(serviceTime.year==null?'':serviceTime.year);
|
|
|
|
+ let month=(serviceTime.month==null?'':serviceTime.month);
|
|
console.log(reportInfo);
|
|
console.log(reportInfo);
|
|
this.setData({
|
|
this.setData({
|
|
reportInfo:reportInfo,
|
|
reportInfo:reportInfo,
|
|
|
|
+ reportDate:year+'年'+month+'月',
|
|
|
|
+ servantName:serviceTime.nickName,
|
|
|
|
+ serviceDay:serviceTime.serviceDay,
|
|
|
|
+ percentTop:serviceTime.serviceQuality,
|
|
|
|
+ expendTotal:reportInfo.expenses
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onInitChart(F2, config) {
|
|
onInitChart(F2, config) {
|
|
@@ -69,17 +77,14 @@ Page({
|
|
onInitChart1(F2, config) {
|
|
onInitChart1(F2, config) {
|
|
// 本月任务分布饼状图
|
|
// 本月任务分布饼状图
|
|
const chart = new F2.Chart(config);
|
|
const chart = new F2.Chart(config);
|
|
- let taskNum = this.data.taskNum;
|
|
|
|
-
|
|
|
|
- // chart.plugins.register([ PieLabel ]);
|
|
|
|
- const data = [
|
|
|
|
- { name: '打扫房间', proportion: 0.4, a: '1' },
|
|
|
|
- { name: '打扫厨房', proportion: 0.2, a: '1' },
|
|
|
|
- { name: '带孩子', proportion: 0.18, a: '1' },
|
|
|
|
- { name: '照顾老人', proportion: 0.15, a: '1' },
|
|
|
|
- { name: '清洁厨房', proportion: 0.05, a: '1' },
|
|
|
|
- { name: '其他', proportion: 0.02, a: '1' },
|
|
|
|
- ];
|
|
|
|
|
|
+ let taskNum = JSON.parse(this.data.reportInfo.pieChart).taskSum;
|
|
|
|
+ let dataList=JSON.parse(this.data.reportInfo.pieChart).randList;
|
|
|
|
+ dataList.forEach(item => {
|
|
|
|
+ item.percentage=(item.percentage)*1;
|
|
|
|
+ });
|
|
|
|
+ const data =dataList;
|
|
|
|
+ // const data = JSON.parse(this.data.reportInfo.pieChart).randList;
|
|
|
|
+ // const data=[{"taskName":"洗护类","percentage":100.00}]
|
|
|
|
|
|
chart.source(data);
|
|
chart.source(data);
|
|
chart.legend(false);
|
|
chart.legend(false);
|
|
@@ -90,8 +95,8 @@ Page({
|
|
chart.axis(false);
|
|
chart.axis(false);
|
|
chart
|
|
chart
|
|
.interval()
|
|
.interval()
|
|
- .position('a*proportion')
|
|
|
|
- .color('name', [
|
|
|
|
|
|
+ .position('taskName*percentage')
|
|
|
|
+ .color('taskName', [
|
|
'#EB6F49',
|
|
'#EB6F49',
|
|
'#00D98B',
|
|
'#00D98B',
|
|
'#FDB628',
|
|
'#FDB628',
|
|
@@ -117,14 +122,14 @@ Page({
|
|
activeShape: true,
|
|
activeShape: true,
|
|
label1: function label1(data) {
|
|
label1: function label1(data) {
|
|
return {
|
|
return {
|
|
- text: data.name,
|
|
|
|
|
|
+ text: data.taskName,
|
|
fill: '#7ED4F6',
|
|
fill: '#7ED4F6',
|
|
fontWeight: 'bold'
|
|
fontWeight: 'bold'
|
|
};
|
|
};
|
|
},
|
|
},
|
|
label2: function label2(data) {
|
|
label2: function label2(data) {
|
|
return {
|
|
return {
|
|
- text: data.proportion,
|
|
|
|
|
|
+ text: data.percentage+'%',
|
|
fill: '#7ED4F6'
|
|
fill: '#7ED4F6'
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -141,17 +146,7 @@ Page({
|
|
onInitChart2(F2, config) {
|
|
onInitChart2(F2, config) {
|
|
// 本月任务完成情况
|
|
// 本月任务完成情况
|
|
const chart = new F2.Chart(config);
|
|
const chart = new F2.Chart(config);
|
|
- let taskNum = this.data.taskNum;
|
|
|
|
-
|
|
|
|
- // chart.plugins.register([ PieLabel ]);
|
|
|
|
- const data = [
|
|
|
|
- { name: '打扫房间', proportion: 0.4, a: '1' },
|
|
|
|
- { name: '打扫厨房', proportion: 0.2, a: '1' },
|
|
|
|
- { name: '带孩子', proportion: 0.18, a: '1' },
|
|
|
|
- { name: '照顾老人', proportion: 0.15, a: '1' },
|
|
|
|
- { name: '清洁厨房', proportion: 0.05, a: '1' },
|
|
|
|
- { name: '其他', proportion: 0.02, a: '1' },
|
|
|
|
- ];
|
|
|
|
|
|
+ const data = JSON.parse(this.data.reportInfo.finishInfo);
|
|
|
|
|
|
chart.source(data);
|
|
chart.source(data);
|
|
chart.legend(false);
|
|
chart.legend(false);
|
|
@@ -177,14 +172,14 @@ Page({
|
|
activeShape: true,
|
|
activeShape: true,
|
|
label1: function label1(data) {
|
|
label1: function label1(data) {
|
|
return {
|
|
return {
|
|
- text: data.name,
|
|
|
|
|
|
+ text: data.taskName,
|
|
fill: '#7ED4F6',
|
|
fill: '#7ED4F6',
|
|
fontWeight: 'bold'
|
|
fontWeight: 'bold'
|
|
};
|
|
};
|
|
},
|
|
},
|
|
label2: function label2(data) {
|
|
label2: function label2(data) {
|
|
return {
|
|
return {
|
|
- text: data.proportion,
|
|
|
|
|
|
+ text: data.percentage,
|
|
fill: '#7ED4F6'
|
|
fill: '#7ED4F6'
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -202,91 +197,19 @@ Page({
|
|
|
|
|
|
//任务完成趋势图
|
|
//任务完成趋势图
|
|
const chart = new F2.Chart(config);
|
|
const chart = new F2.Chart(config);
|
|
- const data = [{
|
|
|
|
- time: '2016-08-08 00:00:00',
|
|
|
|
- value: 10,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-08 00:10:00',
|
|
|
|
- value: 22,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-08 00:30:00',
|
|
|
|
- value: 16,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 00:35:00',
|
|
|
|
- value: 26,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 01:00:00',
|
|
|
|
- value: 12,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 01:20:00',
|
|
|
|
- value: 26,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 01:40:00',
|
|
|
|
- value: 18,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 02:00:00',
|
|
|
|
- value: 26,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 02:20:00',
|
|
|
|
- value: 12,
|
|
|
|
- type: '预期收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-08 00:00:00',
|
|
|
|
- value: 4,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-08 00:10:00',
|
|
|
|
- value: 3,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-08 00:30:00',
|
|
|
|
- value: 6,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 00:35:00',
|
|
|
|
- value: -12,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 01:00:00',
|
|
|
|
- value: 1,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-09 01:20:00',
|
|
|
|
- value: 9,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 01:40:00',
|
|
|
|
- value: 13,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 02:00:00',
|
|
|
|
- value: -3,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}, {
|
|
|
|
- time: '2016-08-10 02:20:00',
|
|
|
|
- value: 11,
|
|
|
|
- type: '实际收益率'
|
|
|
|
-}];
|
|
|
|
|
|
+ const data = JSON.parse(this.data.reportInfo.taskTrend);
|
|
chart.source(data, {
|
|
chart.source(data, {
|
|
- time: {
|
|
|
|
|
|
+ workDay: {
|
|
type: 'timeCat',
|
|
type: 'timeCat',
|
|
- tickCount: 3,
|
|
|
|
- mask: 'hh:mm',
|
|
|
|
|
|
+ tickCount: 5,
|
|
|
|
+ // mask: 'hh:mm',
|
|
range: [ 0, 1 ]
|
|
range: [ 0, 1 ]
|
|
},
|
|
},
|
|
- value: {
|
|
|
|
|
|
+ taskNum: {
|
|
tickCount: 3,
|
|
tickCount: 3,
|
|
- formatter: function formatter(ivalue) {
|
|
|
|
- return ivalue + '%';
|
|
|
|
- }
|
|
|
|
|
|
+ // formatter: function formatter(ivalue) {
|
|
|
|
+ // return ivalue + '%';
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
// chart.tooltip({
|
|
// chart.tooltip({
|
|
@@ -298,7 +221,7 @@ Page({
|
|
// items[0].value = '¥ ' + items[0].value;
|
|
// items[0].value = '¥ ' + items[0].value;
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
- chart.axis('time', {
|
|
|
|
|
|
+ chart.axis('workDay', {
|
|
line: null,
|
|
line: null,
|
|
label: function label(text, index, total) {
|
|
label: function label(text, index, total) {
|
|
const textCfg = {};
|
|
const textCfg = {};
|
|
@@ -325,8 +248,8 @@ chart.legend({
|
|
offsetY: -5
|
|
offsetY: -5
|
|
});
|
|
});
|
|
chart.line()
|
|
chart.line()
|
|
- .position('time*value')
|
|
|
|
- .color('type');
|
|
|
|
|
|
+ .position('workDay*taskNum')
|
|
|
|
+ .color('name');
|
|
|
|
|
|
|
|
|
|
chart.render();
|
|
chart.render();
|
|
@@ -336,62 +259,26 @@ chart.render();
|
|
onInitChart4(F2, config) {
|
|
onInitChart4(F2, config) {
|
|
// 任务类完成详细情况
|
|
// 任务类完成详细情况
|
|
const chart = new F2.Chart(config);
|
|
const chart = new F2.Chart(config);
|
|
- let taskNum = this.data.taskNum;
|
|
|
|
-
|
|
|
|
- // chart.plugins.register([ PieLabel ]);
|
|
|
|
- const data = [
|
|
|
|
- { name: '打扫房间', proportion: 0.4, a: '1' },
|
|
|
|
- { name: '打扫厨房', proportion: 0.2, a: '1' },
|
|
|
|
- { name: '带孩子', proportion: 0.18, a: '1' },
|
|
|
|
- { name: '照顾老人', proportion: 0.15, a: '1' },
|
|
|
|
- { name: '清洁厨房', proportion: 0.05, a: '1' },
|
|
|
|
- { name: '其他', proportion: 0.02, a: '1' },
|
|
|
|
- ];
|
|
|
|
-
|
|
|
|
- chart.source(data);
|
|
|
|
-
|
|
|
|
- chart.legend({
|
|
|
|
- position: 'left'
|
|
|
|
- });
|
|
|
|
- chart.coord('polar', {
|
|
|
|
- transposed: true,
|
|
|
|
- innerRadius: 0.5,
|
|
|
|
|
|
+ // const data = [{"number":"20","typeName":"任务太多"},{"number":"0","typeName":"我不会"},{"number":"10","typeName":"任务不详细"}];
|
|
|
|
+ const data=JSON.parse(this.data.reportInfo.classfInish).lefts;
|
|
|
|
+ chart.source(data, {
|
|
|
|
+ sales: {
|
|
|
|
+ tickCount: 5
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- chart.axis(false);
|
|
|
|
- chart
|
|
|
|
- .interval()
|
|
|
|
- .position('a*proportion')
|
|
|
|
- .color('name', [
|
|
|
|
- '#EB6F49',
|
|
|
|
- '#00D98B',
|
|
|
|
- '#FDB628',
|
|
|
|
- '#0091F1',
|
|
|
|
- '#00E4EC',
|
|
|
|
- '#8256E8',
|
|
|
|
- ])
|
|
|
|
- .adjust('stack')
|
|
|
|
- .style({
|
|
|
|
- lineWidth: 1,
|
|
|
|
- stroke: '#4413A0',
|
|
|
|
- lineJoin: 'round',
|
|
|
|
- lineCap: 'round'
|
|
|
|
- });
|
|
|
|
- chart.guide()
|
|
|
|
- .text({
|
|
|
|
- position: ['50%', '50%'],
|
|
|
|
- style: {
|
|
|
|
- fill: '#7ED4F6',
|
|
|
|
- fontSize: '12',
|
|
|
|
- backgroundColor: '#fff',
|
|
|
|
- },
|
|
|
|
- content: `完成
|
|
|
|
-占比`,
|
|
|
|
-
|
|
|
|
- limitInPlot: true,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ // chart.tooltip({
|
|
|
|
+ // showItemMarker: false,
|
|
|
|
+ // onShow: function onShow(ev) {
|
|
|
|
+ // const items = ev.items;
|
|
|
|
+ // items[0].name = null;
|
|
|
|
+ // items[0].name = items[0].title;
|
|
|
|
+ // items[0].value = '¥ ' + items[0].value;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ chart.interval()
|
|
|
|
+ .position('taskClass*finishRate')
|
|
|
|
+ .color('l(90) 0:#FBEC9F 1:#F3D34D'); // 定义柱状图渐变色
|
|
chart.render();
|
|
chart.render();
|
|
-
|
|
|
|
// 注意:需要把chart return 出来
|
|
// 注意:需要把chart return 出来
|
|
return chart;
|
|
return chart;
|
|
},
|
|
},
|