|
@@ -8,10 +8,13 @@ Page({
|
|
|
date: app.globalData.month,
|
|
|
employee_id:0,
|
|
|
isDb:false,
|
|
|
+ showtu:false,
|
|
|
+ chartData:[]
|
|
|
},
|
|
|
onLoad(e) {
|
|
|
that = this;
|
|
|
dd.setNavigationBar({ title: "奖扣统计" });
|
|
|
+ chart1,chart2='';
|
|
|
if (e.id && e.month) {
|
|
|
that.setData({
|
|
|
date: e.month,
|
|
@@ -19,24 +22,18 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
that.getUserData();
|
|
|
- that.getIncidentLsit();
|
|
|
},
|
|
|
onInitChart(F2, config) {
|
|
|
chart1 = new F2.Chart(config);
|
|
|
chart1.source(that.data.chartData, {
|
|
|
time: {
|
|
|
- type: 'timeCat',
|
|
|
- tickCount: 4,
|
|
|
+ // type: 'timeCat',
|
|
|
+ tickCount: 5,
|
|
|
range: [0, 1]
|
|
|
}
|
|
|
});
|
|
|
chart1.legend(false);
|
|
|
chart1.axis('time', {
|
|
|
- // line: {
|
|
|
- // lineWidth: 2,
|
|
|
- // stroke: '#F56C6C',
|
|
|
- // top: true, // 展示在最上层
|
|
|
- // },
|
|
|
label: function label(text, index, total) {
|
|
|
const textCfg = {};
|
|
|
if (index === 0) {
|
|
@@ -55,18 +52,13 @@ Page({
|
|
|
chart2 = new F2.Chart(config);
|
|
|
chart2.source(that.data.chartData, {
|
|
|
time: {
|
|
|
- type: 'timeCat',
|
|
|
- tickCount: 4,
|
|
|
+ // type: 'timeCat',
|
|
|
+ tickCount: 5,
|
|
|
range: [0, 1]
|
|
|
}
|
|
|
});
|
|
|
chart2.legend(false);
|
|
|
chart2.axis('time', {
|
|
|
- // line: {
|
|
|
- // lineWidth: 2,
|
|
|
- // // stroke: '#F56C6C',
|
|
|
- // top: true, // 展示在最上层
|
|
|
- // },
|
|
|
label: function label(text, index, total) {
|
|
|
const textCfg = {};
|
|
|
if (index === 0) {
|
|
@@ -79,64 +71,35 @@ Page({
|
|
|
});
|
|
|
chart2.line().position('time*value').color('type', [ '#F56C6C', '#67C23A']);
|
|
|
chart2.render();
|
|
|
+ that.getIncidentLsit();
|
|
|
return chart2;
|
|
|
},
|
|
|
- //获取个人统计
|
|
|
- getUserData() {
|
|
|
- app.$get("api/integral/statistics", { employee_id: that.data.employee_id, month: that.data.date }).then((res) => {
|
|
|
- var data = res.data.data;
|
|
|
- var task = data.task;
|
|
|
- dd.setNavigationBar({ title: data.name });
|
|
|
- var ratio = task.reward.point === 0 || task.deduction.point === 0 ? '-' : `${task.ratio.ratio}:1`
|
|
|
- var target_ratio = task.ratio.target_ratio <= 0 ? '0:0' : `${task.ratio.target_ratio}:1`
|
|
|
- if(data.task.reward.point>=data.task.reward.target_point&&data.task.deduction.point>=data.task.deduction.target_point&&data.task.exec.count>=data.task.exec.target_count){
|
|
|
- if(task.ratio.ratio>=task.ratio.target_ratio){
|
|
|
- this.setData({
|
|
|
- isDb: true
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- data.ratio = {
|
|
|
- ratio: ratio,
|
|
|
- target_ratio: target_ratio
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- userData: data
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
getIncidentLsit() {
|
|
|
app.$get("api/integral/statistics/prize", { employee_id: that.data.employee_id, month: that.data.date }).then((res) => {
|
|
|
- const { img_url, name, chart } = res.data.data;
|
|
|
+ const {chart } = res.data.data;
|
|
|
const { reward, deduct } = chart;
|
|
|
var rewardArr = reward.map((item) => {
|
|
|
- return { time: item.date, value: item.point, type: '奖扣' };
|
|
|
+ return { time: item.date, value: item.point, type: '奖分' };
|
|
|
})
|
|
|
var deductArr = deduct.map((item) => {
|
|
|
return { time: item.date, value: item.point, type: '扣分' };
|
|
|
})
|
|
|
var rewardArrCount = reward.map((item) => {
|
|
|
- return { time: item.date, value: item.count, type: '奖扣' };
|
|
|
+ return { time: item.date, value: item.count, type: '奖分人次' };
|
|
|
})
|
|
|
var deductArrCount = deduct.map((item) => {
|
|
|
- return { time: item.date, value: item.count, type: '扣分' };
|
|
|
+ return { time: item.date, value: item.count, type: '扣分人次' };
|
|
|
})
|
|
|
var charData = rewardArr.concat(deductArr);
|
|
|
var charData2 = rewardArrCount.concat(deductArrCount);
|
|
|
- // console.log(charData)
|
|
|
- // console.log(charData2)
|
|
|
- setTimeout(() => {
|
|
|
- chart1.changeData(charData);
|
|
|
- chart2.changeData(charData2);
|
|
|
- }, 1000);
|
|
|
- that.setData({
|
|
|
- img_url: img_url,
|
|
|
- name: name
|
|
|
- });
|
|
|
+ chart1.changeData(charData);
|
|
|
+ chart2.changeData(charData2);
|
|
|
})
|
|
|
},
|
|
|
//时间选择
|
|
|
openDate() {
|
|
|
+ that.setData({showDate: true});
|
|
|
dd.datePicker({
|
|
|
format: 'yyyy-MM',
|
|
|
currentDate: that.data.date,
|
|
@@ -147,6 +110,35 @@ Page({
|
|
|
that.getUserData();
|
|
|
that.getIncidentLsit();
|
|
|
},
|
|
|
+ complete:(res)=>{
|
|
|
+ that.setData({
|
|
|
+ showDate: false
|
|
|
+ })
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
+ //获取个人统计
|
|
|
+ getUserData() {
|
|
|
+ app.$get("api/integral/statistics", { employee_id: that.data.employee_id, month: that.data.date }).then((res) => {
|
|
|
+ var data = res.data.data;
|
|
|
+ var task = data.task;
|
|
|
+ dd.setNavigationBar({ title: data.name });
|
|
|
+ var ratio = task.reward.point === 0 || task.deduction.point === 0 ? '-' : `${task.ratio.ratio}:1`
|
|
|
+ var target_ratio = task.ratio.target_ratio <= 0 ? '0:0' : `${task.ratio.target_ratio}:1`
|
|
|
+ if(data.task.reward.point>=data.task.reward.target_point&&data.task.deduction.point>=data.task.deduction.target_point&&data.task.exec.count>=data.task.exec.target_count){
|
|
|
+ if(task.ratio.ratio>=task.ratio.target_ratio){
|
|
|
+ this.setData({
|
|
|
+ isDb: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.ratio = {
|
|
|
+ ratio: ratio,
|
|
|
+ target_ratio: target_ratio
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ userData: data
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
});
|