75 lines
2.4 KiB
JavaScript
75 lines
2.4 KiB
JavaScript
import request from '@/utils/request'
|
|
|
|
|
|
const selectYearAndMonth=(data)=> {
|
|
return new Promise(reslove=>{
|
|
request({
|
|
url: `/bgscreen/costOut/selectYearAndMonth`,
|
|
method: 'post',
|
|
data:data
|
|
}).then(d=>{
|
|
const getValue=(tmps,type)=>{
|
|
let objs=tmps.filter(d=>d.costType==type);
|
|
return objs.length>0?objs[0]:{};
|
|
}
|
|
let tmps=(d.data||[]).map(it=>{
|
|
it.money=it.money?it.money/10000.0:0;
|
|
return it;
|
|
});
|
|
let y=data.year;
|
|
let m=data.month;
|
|
let curM=tmps.filter(it=>it.costType==9 && it.year==y && it.month==m);
|
|
curM=curM.length>0?curM[0]:{};
|
|
let totalObjs=tmps.filter(it=>it.costType==9);
|
|
let total=0;
|
|
totalObjs.forEach(it=>{
|
|
total+=(it.money?it.money:0)
|
|
});
|
|
totalObjs=tmps.filter(it=>it.costType==9 && it.year==y);
|
|
let totalY=0;
|
|
totalObjs.forEach(it=>{
|
|
totalY+=(it.money?it.money:0)
|
|
});
|
|
let obj={
|
|
totalInv:getValue(tmps,1).money||0,//总投资
|
|
curYear:getValue(tmps,2).money||0,//年总投资
|
|
contract1:getValue(tmps,3).money||0,//合同金额
|
|
contract2:getValue(tmps,4).money||0,//合同支付金额
|
|
contract3:getValue(tmps,5).money||0,//合同挂账金额
|
|
safety1:getValue(tmps,6).money||0,//安措金额
|
|
safety2:getValue(tmps,7).money||0,//安措支付金额
|
|
safety3:getValue(tmps,8).money||0,//安措挂账金额
|
|
curMonth:curM.money||0,//当月投资
|
|
totalMonth:total,//开累投资
|
|
totalYear:totalY,//本年完成
|
|
}
|
|
reslove(obj);
|
|
})
|
|
})
|
|
}
|
|
const sumByDeptId=data=>{
|
|
return new Promise(reslove=>{
|
|
request({
|
|
url: `/bgscreen/costOut/sumByDeptId`,
|
|
method: 'post',
|
|
data:data
|
|
}).then(d=>{
|
|
let tmps=d.data||[];
|
|
const getValue=(tmps,type)=>{
|
|
let objs=tmps.filter(d=>d.costType==type);
|
|
return objs.length>0?objs[0]:{};
|
|
}
|
|
let obj={
|
|
totalMonth:(getValue(tmps,10).money||0)/10000.0,
|
|
curYear:(getValue(tmps,2).money||0)/10000.0,
|
|
curMonth:(getValue(tmps,9).money||0)/10000.0,
|
|
};
|
|
reslove(obj);
|
|
});
|
|
});
|
|
}
|
|
export default{
|
|
selectYearAndMonth,
|
|
sumByDeptId
|
|
}
|