|
|
|
|
@ -230,6 +230,17 @@
|
|
|
|
|
},
|
|
|
|
|
// 获取当月员工人数 固定的数据获取
|
|
|
|
|
// http://sstt-dangan.ali251.langye.net/api/fill-datas-chart?business_id=20&year=2025&business_type_id=88&area_id=13
|
|
|
|
|
findLastNonZeroTotal(list) {
|
|
|
|
|
const sortedKeys = Object.keys(list).sort((a, b) => Number(a) - Number(b));
|
|
|
|
|
for (let i = sortedKeys.length - 1; i >= 0; i--) {
|
|
|
|
|
const currentArray = list[sortedKeys[i]];
|
|
|
|
|
const totalItem = currentArray.find(item => item.name === '总人数');
|
|
|
|
|
if (totalItem && totalItem.total > 0) {
|
|
|
|
|
return currentArray; // 返回符合条件的数组
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null; // 无符合条件的数组时返回null
|
|
|
|
|
},
|
|
|
|
|
async getPerson(){
|
|
|
|
|
const res = await fillChart({
|
|
|
|
|
business_id: 20,
|
|
|
|
|
@ -239,21 +250,27 @@
|
|
|
|
|
})
|
|
|
|
|
const monthNum = (new Date()).getMonth()
|
|
|
|
|
const currentMonth = monthNum===0?'01':String(new Date().getMonth()).padStart(2, '0');
|
|
|
|
|
// const currentMonth = monthNum<10?'0'+monthNum:monthNum
|
|
|
|
|
console.log("currentMonth",currentMonth)
|
|
|
|
|
const currentMonthData = this.findLastNonZeroTotal(res.list);
|
|
|
|
|
|
|
|
|
|
console.log("currentMonthData",currentMonthData)
|
|
|
|
|
if(currentMonthData){
|
|
|
|
|
currentMonthData.forEach(item => {
|
|
|
|
|
switch (item.name) {
|
|
|
|
|
case "总人数":
|
|
|
|
|
this.list.person.total = item.total; // 赋值总人数
|
|
|
|
|
break;
|
|
|
|
|
case "管理人员人数":
|
|
|
|
|
this.list.person.manage = item.total; // 赋值管理人员人数
|
|
|
|
|
break;
|
|
|
|
|
case "服务人员人数":
|
|
|
|
|
this.list.person.serve = item.total; // 赋值服务人员人数
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const currentMonthData = res.list[currentMonth] || [];
|
|
|
|
|
currentMonthData.forEach(item => {
|
|
|
|
|
switch (item.name) {
|
|
|
|
|
case "总人数":
|
|
|
|
|
this.list.person.total = item.total; // 赋值总人数
|
|
|
|
|
break;
|
|
|
|
|
case "管理人员人数":
|
|
|
|
|
this.list.person.manage = item.total; // 赋值管理人员人数
|
|
|
|
|
break;
|
|
|
|
|
case "服务人员人数":
|
|
|
|
|
this.list.person.serve = item.total; // 赋值服务人员人数
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 获取财务部 填报的数据内容
|
|
|
|
|
// http://sstt-dangan.ali251.langye.net/api/admin/base-form/show?id=15&table_name=businesses&json_data_fields[]=area_ids
|
|
|
|
|
|