|
|
|
@ -44,7 +44,7 @@ export default {
|
|
|
|
|
{ type: 'seq', width: 60, title: '序号' },
|
|
|
|
|
{ field: 'label', title: '跨',},
|
|
|
|
|
{ field: 'quantity', title: '数量',},
|
|
|
|
|
{ field: 'weight', title: '重量',},
|
|
|
|
|
{ field: 'weight', title: '重量',formatter:this.weightFormat},
|
|
|
|
|
]
|
|
|
|
|
const path=this.$route.path
|
|
|
|
|
switch (path){
|
|
|
|
@ -83,106 +83,120 @@ export default {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
init(type){
|
|
|
|
|
getData().then(res=>{
|
|
|
|
|
const _data=JSON.parse(res.data)
|
|
|
|
|
|
|
|
|
|
let begin=XEUtils.toDateString(XEUtils.now(),'yyyy/MM/dd')
|
|
|
|
|
let end=XEUtils.toDateString(XEUtils.getWhatDay(XEUtils.now(), 1),'yyyy/MM/dd')
|
|
|
|
|
const endOfMonth=XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0,'last'),'yyyy/MM/dd')
|
|
|
|
|
switch (type){
|
|
|
|
|
methods: {
|
|
|
|
|
init(type) {
|
|
|
|
|
getData().then(res => {
|
|
|
|
|
const _data = JSON.parse(res.data)
|
|
|
|
|
|
|
|
|
|
let begin = XEUtils.toDateString(XEUtils.now(), 'yyyy/MM/dd')
|
|
|
|
|
let end = XEUtils.toDateString(XEUtils.getWhatDay(XEUtils.now(), 1), 'yyyy/MM/dd')
|
|
|
|
|
const endOfMonth = XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0, 'last'), 'yyyy/MM/dd')
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'riwc':
|
|
|
|
|
console.log(111)
|
|
|
|
|
this.gridOptions.data= this.完成率计算(_data,begin,end,endOfMonth).point
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).point
|
|
|
|
|
break
|
|
|
|
|
case 'zhouwc':
|
|
|
|
|
begin=XEUtils.toDateString(XEUtils.getWhatWeek (XEUtils.now(), 0,1,0),'yyyy/MM/dd')
|
|
|
|
|
end=XEUtils.toDateString(XEUtils.getWhatWeek (XEUtils.now(), 1,1,0),'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data= this.完成率计算(_data,begin,end,endOfMonth).point
|
|
|
|
|
begin = XEUtils.toDateString(XEUtils.getWhatWeek(XEUtils.now(), 0, 1, 0), 'yyyy/MM/dd')
|
|
|
|
|
end = XEUtils.toDateString(XEUtils.getWhatWeek(XEUtils.now(), 1, 1, 0), 'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).point
|
|
|
|
|
break
|
|
|
|
|
case 'yuewc':
|
|
|
|
|
begin=XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0,'first'),'yyyy/MM/dd')
|
|
|
|
|
end=XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0,'last'),'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data=this.完成率计算(_data,begin,end,endOfMonth).point
|
|
|
|
|
begin = XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0, 'first'), 'yyyy/MM/dd')
|
|
|
|
|
end = XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0, 'last'), 'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).point
|
|
|
|
|
break
|
|
|
|
|
case 'ricl':
|
|
|
|
|
this.gridOptions.data=this.完成率计算(_data,begin,end,endOfMonth).wc
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).wc
|
|
|
|
|
break
|
|
|
|
|
case 'zhoucl':
|
|
|
|
|
begin=XEUtils.toDateString(XEUtils.getWhatWeek (XEUtils.now(), 0,1,0),'yyyy/MM/dd')
|
|
|
|
|
end=XEUtils.toDateString(XEUtils.getWhatWeek (XEUtils.now(), 1,1,0),'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data= this.完成率计算(_data,begin,end,endOfMonth).wc
|
|
|
|
|
begin = XEUtils.toDateString(XEUtils.getWhatWeek(XEUtils.now(), 0, 1, 0), 'yyyy/MM/dd')
|
|
|
|
|
end = XEUtils.toDateString(XEUtils.getWhatWeek(XEUtils.now(), 1, 1, 0), 'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).wc
|
|
|
|
|
break
|
|
|
|
|
case 'yuecl':
|
|
|
|
|
begin=XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0,'first'),'yyyy/MM/dd')
|
|
|
|
|
end=XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0,'last'),'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data= this.完成率计算(_data,begin,end,endOfMonth).wc
|
|
|
|
|
begin = XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0, 'first'), 'yyyy/MM/dd')
|
|
|
|
|
end = XEUtils.toDateString(XEUtils.getWhatMonth(XEUtils.now(), 0, 'last'), 'yyyy/MM/dd')
|
|
|
|
|
this.gridOptions.data = this.完成率计算(_data, begin, end, endOfMonth).wc
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
完成率计算(data,date,nextDate,endOfMonth){
|
|
|
|
|
完成率计算(data, date, nextDate, endOfMonth) {
|
|
|
|
|
|
|
|
|
|
const wc=[],point=[]
|
|
|
|
|
const wc = [], point = []
|
|
|
|
|
|
|
|
|
|
const 一跨完成数据=data.filter(item=> item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '二区'&&['7','8'].includes(item.kw))
|
|
|
|
|
const 一跨计划数量=data.filter(item=> item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '二区'&&['7','8'].includes(item.kw)).length
|
|
|
|
|
const 一跨完成数据 = data.filter(item => item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '二区' && ['7', '8','9'].includes(item.kw))
|
|
|
|
|
const 一跨计划数量 = data.filter(item => item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '二区' && ['7', '8','9'].includes(item.kw)).length
|
|
|
|
|
|
|
|
|
|
let 一跨完成率='0'
|
|
|
|
|
if (一跨计划数量){
|
|
|
|
|
一跨完成率=(一跨完成数据.length/一跨计划数量*100).toFixed(2)
|
|
|
|
|
let 一跨完成率 = '0'
|
|
|
|
|
if (一跨计划数量) {
|
|
|
|
|
一跨完成率 = (一跨完成数据.length / 一跨计划数量 * 100).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
point.push({kua:'1跨',c:一跨完成率,n:一跨完成率>100?'0':(100-一跨完成率).toFixed(2)})
|
|
|
|
|
point.push({kua: '1跨', c: 一跨完成率, n: 一跨完成率 > 100 ? '0' : (100 - 一跨完成率).toFixed(2)})
|
|
|
|
|
|
|
|
|
|
wc.push({ label: '1跨', quantity: 一跨完成数据.length, weight: 一跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue?.bcshzl||0)/1000;
|
|
|
|
|
}, 0) },)
|
|
|
|
|
wc.push({
|
|
|
|
|
label: '1跨', quantity: 一跨完成数据.length, weight: 一跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue?.bcshzl || 0) / 1000;
|
|
|
|
|
}, 0)
|
|
|
|
|
},)
|
|
|
|
|
|
|
|
|
|
const 二跨完成数据=data.filter(item=> item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '三区')
|
|
|
|
|
const 二跨计划数量=data.filter(item=> item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '三区').length
|
|
|
|
|
const 二跨完成数据 = data.filter(item => item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '三区')
|
|
|
|
|
const 二跨计划数量 = data.filter(item => item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '三区').length
|
|
|
|
|
|
|
|
|
|
let 二跨完成率='0.00'
|
|
|
|
|
if (二跨计划数量){
|
|
|
|
|
二跨完成率=(二跨完成数据.length/二跨计划数量*100).toFixed(2)
|
|
|
|
|
let 二跨完成率 = '0.00'
|
|
|
|
|
if (二跨计划数量) {
|
|
|
|
|
二跨完成率 = (二跨完成数据.length / 二跨计划数量 * 100).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
point.push({kua:'2跨',c:二跨完成率,n:二跨完成率>100?'0':(100-二跨完成率).toFixed(2)})
|
|
|
|
|
point.push({kua: '2跨', c: 二跨完成率, n: 二跨完成率 > 100 ? '0' : (100 - 二跨完成率).toFixed(2)})
|
|
|
|
|
|
|
|
|
|
wc.push({ label: '2跨', quantity: 二跨完成数据.length, weight: 二跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl||0)/1000;
|
|
|
|
|
}, 0) },)
|
|
|
|
|
wc.push({
|
|
|
|
|
label: '2跨', quantity: 二跨完成数据.length, weight: 二跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl || 0) / 1000;
|
|
|
|
|
}, 0)
|
|
|
|
|
},)
|
|
|
|
|
|
|
|
|
|
const 三跨完成数据=data.filter(item=> item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '二区'&&['6','13','14'].includes(item.kw))
|
|
|
|
|
const 三跨计划数量=data.filter(item=> item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '二区'&&['6','13','14'].includes(item.kw)).length
|
|
|
|
|
const 三跨完成数据 = data.filter(item => item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '二区' && ['6', '13', '14'].includes(item.kw))
|
|
|
|
|
const 三跨计划数量 = data.filter(item => item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '二区' && ['6', '13', '14'].includes(item.kw)).length
|
|
|
|
|
|
|
|
|
|
let 三跨完成率='0.00'
|
|
|
|
|
if (三跨计划数量){
|
|
|
|
|
三跨完成率=(三跨完成数据.length/三跨计划数量*100).toFixed(2)
|
|
|
|
|
let 三跨完成率 = '0.00'
|
|
|
|
|
if (三跨计划数量) {
|
|
|
|
|
三跨完成率 = (三跨完成数据.length / 三跨计划数量 * 100).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
point.push({kua:'3跨',c:三跨完成率,n:三跨完成率>100?'0':(100-三跨完成率).toFixed(2)})
|
|
|
|
|
point.push({kua: '3跨', c: 三跨完成率, n: 三跨完成率 > 100 ? '0' : (100 - 三跨完成率).toFixed(2)})
|
|
|
|
|
|
|
|
|
|
wc.push({ label: '3跨', quantity: 三跨完成数据.length, weight: 三跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl||0)/1000;
|
|
|
|
|
}, 0) },)
|
|
|
|
|
wc.push({
|
|
|
|
|
label: '3跨', quantity: 三跨完成数据.length, weight: 三跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl || 0) / 1000;
|
|
|
|
|
}, 0)
|
|
|
|
|
},)
|
|
|
|
|
|
|
|
|
|
const 四跨完成数据=data.filter(item=> item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '四区')
|
|
|
|
|
const 四跨计划数量=data.filter(item=> item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '四区').length
|
|
|
|
|
const 四跨完成数据 = data.filter(item => item.qgfkrq >= date && item.qgfkrq < nextDate && item.zyq1 === '四区')
|
|
|
|
|
const 四跨计划数量 = data.filter(item => item.qgjhrq >= date && item.qgjhrq < endOfMonth && item.zyq1 === '四区').length
|
|
|
|
|
|
|
|
|
|
let 四跨完成率='0.00'
|
|
|
|
|
if (四跨计划数量){
|
|
|
|
|
四跨完成率=(四跨完成数据.length/四跨计划数量*100).toFixed(2)
|
|
|
|
|
const _四跨完成数据 = data.filter(item => item.qgfkrq>='2025/05/26 00:00:00' && item.zyq1 === '四区')
|
|
|
|
|
console.log(_四跨完成数据,date)
|
|
|
|
|
|
|
|
|
|
let 四跨完成率 = '0.00'
|
|
|
|
|
if (四跨计划数量) {
|
|
|
|
|
四跨完成率 = (四跨完成数据.length / 四跨计划数量 * 100).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
point.push({kua:'4,5,6跨',c:四跨完成率,n:四跨完成率>100?'0':(100-四跨完成率).toFixed(2)})
|
|
|
|
|
point.push({kua: '4,5,6跨', c: 四跨完成率, n: 四跨完成率 > 100 ? '0' : (100 - 四跨完成率).toFixed(2)})
|
|
|
|
|
|
|
|
|
|
wc.push({ label: '4、5、6跨', quantity: 四跨完成数据.length, weight: 四跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl||0)/1000;
|
|
|
|
|
}, 0) },)
|
|
|
|
|
wc.push({
|
|
|
|
|
label: '4、5、6跨', quantity: 四跨完成数据.length, weight: 四跨完成数据.reduce((accumulator, currentValue) => {
|
|
|
|
|
return accumulator + (currentValue.bcshzl || 0) / 1000;
|
|
|
|
|
}, 0)
|
|
|
|
|
},)
|
|
|
|
|
|
|
|
|
|
return {point,wc}
|
|
|
|
|
return {point, wc}
|
|
|
|
|
},
|
|
|
|
|
weightFormat({cellValue}) {
|
|
|
|
|
return XEUtils.toNumber(cellValue).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|