|
|
|
@ -46,7 +46,7 @@ |
|
|
|
|
<el-option v-for="item in proportion" :key="item.id" :label="item.label" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入金额(元)" |
|
|
|
|
placeholder="请输入数值" |
|
|
|
|
class="wd20 mglr10" |
|
|
|
|
style="min-width: 200px" |
|
|
|
|
:disabled="!searchStr.proportionSymbol" |
|
|
|
@ -55,7 +55,7 @@ |
|
|
|
|
></el-input> |
|
|
|
|
<p>%</p> |
|
|
|
|
<p class="fz-16 mgr10 font-blue mgl20 nowrap">已清收总额</p> |
|
|
|
|
<el-select v-model="searchStr.allAoumntSymbol" placeholder="请选择" clearable @change="search"> |
|
|
|
|
<el-select @change="allAoumntSymbolChange" v-model="searchStr.allAoumntSymbol" placeholder="请选择" clearable> |
|
|
|
|
<el-option v-for="item in proportion" :key="item.id" :label="item.label" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-input :disabled="!searchStr.allAoumntSymbol" class="wd20 mglr10" placeholder="请输入金额(元)" style="min-width: 200px" v-model="searchStr.allAoumnt" clearable></el-input> |
|
|
|
@ -89,7 +89,7 @@ |
|
|
|
|
v-model="searchStr.queryCondition" |
|
|
|
|
placeholder="工号/清收负责人" |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
><i slot="suffix" class="el-input__icon el-icon-search" @click="annualStatisticsList"></i></el-input> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<!-- |
|
|
|
@ -107,8 +107,8 @@ |
|
|
|
|
:key="1" |
|
|
|
|
> |
|
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column prop="companyRanks" label="公司排名" align="center" width="120px"></el-table-column> |
|
|
|
|
<el-table-column prop="TeamRanks" label="小组排名" align="center" width="120px"></el-table-column> |
|
|
|
|
<el-table-column prop="companyRanks" label="公司排名" align="center" width="70px"></el-table-column> |
|
|
|
|
<el-table-column prop="TeamRanks" label="小组排名" align="center" width="70px"></el-table-column> |
|
|
|
|
<el-table-column prop="groupName" label="清收组" align="center" width="150px"></el-table-column> |
|
|
|
|
<el-table-column prop="personLiable" label="清收负责人" align="center" width="150px"></el-table-column> |
|
|
|
|
<el-table-column prop="jobNumber" label="工号" align="center"></el-table-column> |
|
|
|
@ -137,6 +137,7 @@ |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="backTime static multi-box" v-for="(item, index) in scope.row.collectionTime" :key="index"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-if="item.collectionTime" |
|
|
|
|
style="width:180px" |
|
|
|
|
v-model="item.collectionTime" |
|
|
|
|
type="date" |
|
|
|
@ -144,6 +145,7 @@ |
|
|
|
|
:disabled="!scope.row.edit" |
|
|
|
|
> |
|
|
|
|
</el-date-picker> |
|
|
|
|
<div v-else>-</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -161,14 +163,19 @@ |
|
|
|
|
<el-input :disabled="!scope.row.edit" placeholder="输入年度金额指标" v-model="scope.row.proportion"></el-input> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="!scope.row.edit"> |
|
|
|
|
{{scope.row.percent}}% |
|
|
|
|
{{scope.row.percent==="未填写年度指标"?"未填写年度指标":scope.row.percent+"%"}} |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="remark" label="备注" align="center" width="200px"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<div class="backTime static multi-box" v-for="(item, index) in scope.row.description" :key="index"> |
|
|
|
|
<el-tooltip v-if="item.description&&item.description!='-'&&scope.row.description!=' '" class="item" effect="dark" :content="item.description" placement="top"> |
|
|
|
|
<el-input :disabled="!scope.row.edit" v-model="item.description"></el-input> |
|
|
|
|
</el-tooltip> |
|
|
|
|
<div v-else> |
|
|
|
|
- |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
@ -206,7 +213,7 @@ |
|
|
|
|
<div class="tree"> |
|
|
|
|
<div class="left-border fz-16 mgt20"><p class="c-black mgl10">参与本年度清收排名的人员</p></div> |
|
|
|
|
<div class="mgl80 mgt20 mgr80" style="border: 1px solid #e6e6e6; border-radius: 15px; overflow: auto; padding: 15px"> |
|
|
|
|
<el-checkbox @change="allCheck" v-model="checked" class="mgl20" style="margin-left:23px">全选</el-checkbox> |
|
|
|
|
<!-- <el-checkbox @change="allCheck" v-model="checked" class="mgl20" style="margin-left:23px">全选</el-checkbox> --> |
|
|
|
|
<el-tree |
|
|
|
|
:data="tree" |
|
|
|
|
show-checkbox |
|
|
|
@ -230,11 +237,14 @@ |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { json } from 'mathjs'; |
|
|
|
|
import {collectionGroupList ,generateAnnualStatistics,annualList,annualStatisticsList,editAnnualStatistics,personnelSelection ,annualStatisticsDeleted,annualStatisticsListExport,liquidateList } from '../../../utils/api' |
|
|
|
|
import core from '../../../utils/core' |
|
|
|
|
export default { |
|
|
|
|
name: '', |
|
|
|
|
props: {}, |
|
|
|
|
components:{ |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
showRank: false, // 弹框 |
|
|
|
@ -291,17 +301,21 @@ export default { |
|
|
|
|
changeStaffYear:'', |
|
|
|
|
changeStaffDisabled:false, |
|
|
|
|
checked:false, |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
showRank(val){ |
|
|
|
|
if(val){ |
|
|
|
|
this.getTree() |
|
|
|
|
}else{ |
|
|
|
|
this.tree = [] |
|
|
|
|
this.treeIds = [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
liquidate(val){ |
|
|
|
|
if(val==2){ |
|
|
|
|
console.log('判断为2') |
|
|
|
|
// console.log('判断为2') |
|
|
|
|
this.liquidateList() |
|
|
|
|
this.annualStatisticsList() |
|
|
|
|
}else{ |
|
|
|
@ -327,15 +341,15 @@ export default { |
|
|
|
|
},set(){} |
|
|
|
|
}, |
|
|
|
|
percent(){ |
|
|
|
|
console.log(this.statisticsData,'statisticsData') |
|
|
|
|
console.log(this.statisticsData.totalAmount,this.statisticsData.proportion,'计算百分比的值') |
|
|
|
|
// console.log(this.statisticsData,'statisticsData') |
|
|
|
|
// console.log(this.statisticsData.totalAmount,this.statisticsData.proportion,'计算百分比的值') |
|
|
|
|
return (+this.statisticsData.totalAmount/+this.statisticsData.proportion).toFixed(2) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.searchStr = this.$store.state.loan.liquidateSearch |
|
|
|
|
this.annualList() |
|
|
|
|
console.log(this.liquidate,this.searchStr,'li') |
|
|
|
|
// console.log(this.liquidate,this.searchStr,'li') |
|
|
|
|
if(this.liquidate=='2'){ |
|
|
|
|
this.annualStatisticsList() |
|
|
|
|
} |
|
|
|
@ -347,7 +361,7 @@ export default { |
|
|
|
|
liquidateList(){// 清收组 |
|
|
|
|
liquidateList().then(res=>{ |
|
|
|
|
this.liquidateSelectArr = res.data.groupList |
|
|
|
|
console.log(this.liquidateSelectArr,'arr') |
|
|
|
|
// console.log(this.liquidateSelectArr,'arr') |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleScroll:core.debounce(function(){ |
|
|
|
@ -395,7 +409,6 @@ export default { |
|
|
|
|
if(!this.searchStr.year) { |
|
|
|
|
this.searchStr = this.$store.state.loan.liquidateSearch |
|
|
|
|
} |
|
|
|
|
this.moreText = "点击加载更多数据" |
|
|
|
|
let param = { |
|
|
|
|
year:this.searchStr.year, |
|
|
|
|
groupId:this.searchStr.groupId, |
|
|
|
@ -405,10 +418,113 @@ export default { |
|
|
|
|
} |
|
|
|
|
this.statisticsLoading = true |
|
|
|
|
annualStatisticsList(param).then(res=>{ |
|
|
|
|
// console.clear() |
|
|
|
|
// console.log('开始处理数据') |
|
|
|
|
this.statisticsLoading = false |
|
|
|
|
let arr = new Map() |
|
|
|
|
let arr = new Map() // 最后处理得到的map对象 |
|
|
|
|
let data = res.data.list |
|
|
|
|
data.forEach(e=>{ |
|
|
|
|
let groupArr= new Map()// 得到的组排序对象,仅取出多组和多组排名即可。 |
|
|
|
|
let overArr = []// 最终处理出来的组排序的数组 |
|
|
|
|
|
|
|
|
|
function compare(key){ |
|
|
|
|
return function(value1,value2){ |
|
|
|
|
let val1=value1[key]; |
|
|
|
|
let val2=value2[key]; |
|
|
|
|
return val2-val1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// console.log(res.data.groupList.collect,'res.data.groupList.collect') |
|
|
|
|
// 按组分人进行处理,取得人的组排序值,以及对应的多组的值,取得这两个数据即可 |
|
|
|
|
let collect = JSON.parse(JSON.stringify(res.data.groupList.collect)) |
|
|
|
|
if(res.data.groupList.collect){ |
|
|
|
|
|
|
|
|
|
// console.log('开始处理组的数据') |
|
|
|
|
for (let key in res.data.groupList.collect) {// 循环分组 |
|
|
|
|
// 每次取出一个组进行处理,并且在该次处理中,把人员组和名次取出来 |
|
|
|
|
let group = res.data.groupList.collect[key] |
|
|
|
|
// console.log(group,'每个组的数据',key,'key') |
|
|
|
|
let aloneMap = new Map() // 每个组独立的map对象处理 |
|
|
|
|
let aloneArr = []// 取出所有的已处理数据 |
|
|
|
|
group.forEach(e=>{// 进行相同数据处理叠加,需要注意组和排名的处理 |
|
|
|
|
// 进行各项数据叠加,然后根据叠加的totalAmount字段进行排序,且,组之间需要进行一次额外排序 |
|
|
|
|
if(aloneMap.has(e.jobNumber)){// 如果处理过,进行叠加处理 |
|
|
|
|
let obj = aloneMap.get(e.jobNumber) |
|
|
|
|
obj.enterprise.push({enterprise:e.enterprise,id:e.id}) |
|
|
|
|
obj.totalAmount += ((+e.cash||0)+(+e.assets)) |
|
|
|
|
obj.cash.push({cash:e.cash,id:e.id}) |
|
|
|
|
obj.assets.push({assets:e.assets,id:e.id}) |
|
|
|
|
obj.collectionTime.push({collectionTime:e.collectionTime,id:e.id}) |
|
|
|
|
obj.description.push({description:e.description,id:e.id}) |
|
|
|
|
aloneMap.set(e.jobNumber,obj) |
|
|
|
|
// console.log(e.groupName,'多次处理的组数据') |
|
|
|
|
}else{ |
|
|
|
|
e.groupName = [e.groupName]// 区别于公司人员处理,把组提取出来 |
|
|
|
|
// console.log(e.groupName,'e.groupName') |
|
|
|
|
e.enterprise = [{enterprise:e.enterprise||'-',id:e.id}] |
|
|
|
|
e.totalAmount = (+e.cash||0)+(+e.assets) |
|
|
|
|
e.cash = [{cash:e.cash||'-',id:e.id}] |
|
|
|
|
e.assets = [{assets:e.assets||'-',id:e.id}] |
|
|
|
|
e.collectionTime = [{collectionTime:e.collectionTime,id:e.id}] |
|
|
|
|
e.description = [{description:e.description||'-',id:e.id}] |
|
|
|
|
// console.log(e.totalAmount,`首次加入的${e.personLiable}`) |
|
|
|
|
aloneMap.set(e.jobNumber,e)// 根据工号进行标识储存 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// console.log(aloneMap,'首次处理的alone') |
|
|
|
|
// 处理完的map进行解构,并排序,以此取得每个组的排序对象数组 |
|
|
|
|
for(let [key,value] of aloneMap){ |
|
|
|
|
aloneArr.push(value) |
|
|
|
|
} |
|
|
|
|
// console.log('取得aloneArr的map对象',aloneArr) |
|
|
|
|
|
|
|
|
|
aloneArr.sort(compare('totalAmount'))// 进行金额排序 |
|
|
|
|
aloneArr.forEach((e,i)=>{// 由此取得每个人在组内的排序 |
|
|
|
|
e.TeamRanks = [i+1] |
|
|
|
|
}) |
|
|
|
|
groupArr.set(key,aloneArr)// 再把该数组存入组id标识的map对象中 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let dispose = [] |
|
|
|
|
// 处理完map对象后,需要再根据人进行合并,先取出所有的组对应数组 |
|
|
|
|
for(let [key,value] of groupArr){ |
|
|
|
|
// 存在map中的是一个个组为标识的数组,先把数组解构出来,然后再需要进行一个一个对象的工号对比,若相同,则进行合并 |
|
|
|
|
dispose.push(...value) |
|
|
|
|
} |
|
|
|
|
// console.log(dispose,'取出所有的dispose值') |
|
|
|
|
|
|
|
|
|
if(dispose.length>0){ |
|
|
|
|
// 建立一个新的map进行合并操作,以工号为标识 |
|
|
|
|
let disposeMap = new Map() |
|
|
|
|
dispose.forEach(e=>{// 循环,合并相同的数据,仅需取得对应的排序和复数组 |
|
|
|
|
if(disposeMap.has(e.jobNumber)){// 如果处理过,进行叠加处理 |
|
|
|
|
let obj = disposeMap.get(e.jobNumber) |
|
|
|
|
// console.log(e.groupName,e.TeamRanks,'e的组和排名') |
|
|
|
|
// console.log(obj.groupName,obj.TeamRanks,'obj的组和排名') |
|
|
|
|
// console.log(obj.groupName.includes(e.groupName),'obj是否包含e的判断') |
|
|
|
|
if(!obj.groupName.includes(e.groupName)){// 进行初步判重 |
|
|
|
|
obj.groupName.push(...e.groupName)// 把多组处理出来,无需判重 |
|
|
|
|
obj.TeamRanks.push(...e.TeamRanks)// 再把组排名取出来 |
|
|
|
|
} |
|
|
|
|
// console.log(obj,'处理完的obj') |
|
|
|
|
// 无需处理其他类型数据 |
|
|
|
|
disposeMap.set(e.jobNumber,obj)// 进行覆盖 |
|
|
|
|
}else{ |
|
|
|
|
// e.groupName = [...e.groupName]// 区别于公司人员处理,把组提取出来 |
|
|
|
|
// e.TeamRanks = |
|
|
|
|
disposeMap.set(e.jobNumber,e)// 根据工号进行标识储存 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 最后取得一个已处理完毕的数组 |
|
|
|
|
// console.log(disposeMap,'处理完毕的map对象') |
|
|
|
|
for(let [key,value] of disposeMap){ |
|
|
|
|
overArr.push(value)// 取得对应数组,只需要赋值到公司排名那里即可 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// console.log('取得overArr',overArr) |
|
|
|
|
// 然后再把组和排名拿到公司排名那里进行拼接 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.forEach(e=>{// 数据处理为一条--需要额外取得多组和分组排名,按组排序将无法正常展示 |
|
|
|
|
if(arr.has(e.jobNumber)){ |
|
|
|
|
let obj = arr.get(e.jobNumber) |
|
|
|
|
obj.enterprise.push({enterprise:e.enterprise,id:e.id}) |
|
|
|
@ -421,12 +537,12 @@ export default { |
|
|
|
|
// console.log(e.totalAmount,`再次处理加入的${e.personLiable}`) |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
e.enterprise = [{enterprise:e.enterprise,id:e.id}] |
|
|
|
|
e.enterprise = [{enterprise:e.enterprise||'-',id:e.id}] |
|
|
|
|
e.totalAmount = (+e.cash||0)+(+e.assets) |
|
|
|
|
e.cash = [{cash:e.cash,id:e.id}] |
|
|
|
|
e.assets = [{assets:e.assets,id:e.id}] |
|
|
|
|
e.cash = [{cash:e.cash||'-',id:e.id}] |
|
|
|
|
e.assets = [{assets:e.assets||'-',id:e.id}] |
|
|
|
|
e.collectionTime = [{collectionTime:e.collectionTime,id:e.id}] |
|
|
|
|
e.description = [{description:e.description,id:e.id}] |
|
|
|
|
e.description = [{description:e.description||'-',id:e.id}] |
|
|
|
|
// console.log(e.totalAmount,`首次加入的${e.personLiable}`) |
|
|
|
|
arr.set(e.jobNumber,e) |
|
|
|
|
} |
|
|
|
@ -434,21 +550,32 @@ export default { |
|
|
|
|
// 取得初次处理的数据 |
|
|
|
|
this.originalData = [] |
|
|
|
|
for(let [key,value] of arr){ |
|
|
|
|
// 处理百分比展示文字 |
|
|
|
|
if(value.totalAmount&&value.proportion){ |
|
|
|
|
value.percent = ((value.totalAmount/value.proportion)*100).toFixed(2) |
|
|
|
|
}else{ |
|
|
|
|
value.percent = '未填写年度指标' |
|
|
|
|
} |
|
|
|
|
// 把组和排名进行赋值,取得组排名和多组的值 |
|
|
|
|
overArr.forEach(e=>{ |
|
|
|
|
if(e.jobNumber==value.jobNumber){ |
|
|
|
|
value.groupName = e.groupName.join(",") // 多组处理的拼接 |
|
|
|
|
value.TeamRanks = e.TeamRanks.join(",") // 多组排名的拼接 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.originalData.push(value) |
|
|
|
|
} |
|
|
|
|
console.log(this.originalData,'初始处理的数据') |
|
|
|
|
|
|
|
|
|
this.radioChange('依据小组排名') |
|
|
|
|
// console.log(this.originalData,'初始处理的数据') |
|
|
|
|
// 初始数据执行两次排名,分别取得组排名和公司排名 |
|
|
|
|
// this.radioChange('依据小组排名') |
|
|
|
|
this.radioChange('依据公司排名') |
|
|
|
|
// 根据单选按钮,进行实际排序展示 |
|
|
|
|
if(this.radio==='依据小组排名'){ |
|
|
|
|
this.radioChange('依据小组排名') |
|
|
|
|
// console.log('依据小组排名',collect,'chunazhi') |
|
|
|
|
this.radioChange('依据小组排名',collect) |
|
|
|
|
} |
|
|
|
|
console.log(this.searchStr.proportionSymbol,'this.searchStr.allAoumntSymbol') |
|
|
|
|
// console.log(this.searchStr.proportionSymbol,'this.searchStr.allAoumntSymbol') |
|
|
|
|
|
|
|
|
|
switch (this.searchStr.proportionSymbol) { |
|
|
|
|
case '': |
|
|
|
|
break; |
|
|
|
@ -495,7 +622,7 @@ export default { |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// 查完成比例 |
|
|
|
|
// 查完成比例查询 |
|
|
|
|
switch (this.searchStr.allAoumntSymbol) { |
|
|
|
|
case '': |
|
|
|
|
break; |
|
|
|
@ -527,13 +654,13 @@ export default { |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 长度大于10,开启滚动记录数组,切割当前数组 |
|
|
|
|
if (this.statisticsData.length>10) { |
|
|
|
|
this.recordArr = JSON.parse(JSON.stringify(this.statisticsData)) |
|
|
|
|
this.recordArr.splice(0,10) |
|
|
|
|
this.statisticsData.splice(10,this.statisticsData.length-1)// 首次切割 |
|
|
|
|
} |
|
|
|
|
/* 分页改为无限滚动,暂时保留 */ |
|
|
|
|
// // 长度大于10,开启滚动记录数组,切割当前数组 |
|
|
|
|
// if (this.statisticsData.length>10) { |
|
|
|
|
// this.recordArr = JSON.parse(JSON.stringify(this.statisticsData)) |
|
|
|
|
// this.recordArr.splice(0,10) |
|
|
|
|
// this.statisticsData.splice(10,this.statisticsData.length-1)// 首次切割 |
|
|
|
|
// } |
|
|
|
|
}).catch(err=>{ |
|
|
|
|
this.statisticsLoading = false |
|
|
|
|
}) |
|
|
|
@ -548,17 +675,60 @@ export default { |
|
|
|
|
e.disabled = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.tree = data |
|
|
|
|
let allTree = [{ |
|
|
|
|
id:'全选group', |
|
|
|
|
name:'全选', |
|
|
|
|
personnel:[...data] |
|
|
|
|
}] |
|
|
|
|
this.tree = allTree |
|
|
|
|
// console.log("取得树数据") |
|
|
|
|
}).catch(err=>{ |
|
|
|
|
this.treeLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 勾选 |
|
|
|
|
checkBox(data, checked, indeterminate){ |
|
|
|
|
// console.log(checked,'dianjiindeterminate') |
|
|
|
|
|
|
|
|
|
this.treeIds = this.$refs.tree.getCheckedKeys() |
|
|
|
|
// console.log(this.treeIds,'ids') |
|
|
|
|
// if(checked){ |
|
|
|
|
// const fn = function(arr,ids,id){ |
|
|
|
|
// arr.forEach(el=>{ |
|
|
|
|
// if(el.id.includes(',')){ |
|
|
|
|
// if(el.id.split(',').pop()==id&&!ids.includes(el.id)){ |
|
|
|
|
// ids.push(el.id) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// if(el.personnel&&el.personnel.length>0){ |
|
|
|
|
// fn(el.personnel,ids,id) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// this.treeIds.forEach(e=>{ |
|
|
|
|
// if(e.includes(",")){ |
|
|
|
|
// let id = e.split(",").pop()// 取出勾选的那个值 |
|
|
|
|
// fn(this.tree,this.treeIds,id) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// }else{ |
|
|
|
|
// let tid = this.treeIds |
|
|
|
|
// this.treeIds.forEach(e=>{ |
|
|
|
|
// if(e.includes(',')){ |
|
|
|
|
// let id = e.split(",").pop() |
|
|
|
|
// this.treeIds.forEach(el=>{ |
|
|
|
|
// if(el.includes(id)){ |
|
|
|
|
// tid.splice(tid.indexOf(el),1) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// console.log(this.treeIds,'ids') |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
async createList(val) {// 唤起清收组弹窗 |
|
|
|
|
console.log(val,'val') |
|
|
|
|
// console.log(val,'val') |
|
|
|
|
this.showRank = true; |
|
|
|
|
if(val==='new'){// 新增人员 |
|
|
|
|
this.treeIds = [] |
|
|
|
@ -574,14 +744,21 @@ export default { |
|
|
|
|
if (this.treeStatus === 'new') { |
|
|
|
|
// 新建生成统计表 |
|
|
|
|
if(!this.chooisYear)return this.$message.error('请先选择年份!') |
|
|
|
|
let arr = [] |
|
|
|
|
this.treeIds.forEach((e,index)=>{ |
|
|
|
|
if(typeof(e)=='number'){ |
|
|
|
|
arr.push(e) |
|
|
|
|
// let arr = [] |
|
|
|
|
// this.treeIds.forEach((e,index)=>{ |
|
|
|
|
// if(e.includes(',')){ |
|
|
|
|
// arr.push(e.split(",").pop()) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
if(this.treeIds.length===0) return this.$message.warning('请先选择人员后再生成列表!') |
|
|
|
|
console.log(this.treeIds,'treeIds') |
|
|
|
|
this.treeIds.forEach((e)=>{ |
|
|
|
|
if(e=="全选group"){ |
|
|
|
|
this.treeIds.splice(this.treeIds.indexOf(e),1) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if(arr.length===0) return this.$message.warning('请先选择人员后再生成列表!') |
|
|
|
|
generateAnnualStatistics({personLiableIds:arr,year:this.chooisYear,flag:1}).then(res=>{ |
|
|
|
|
generateAnnualStatistics({personLiableIds:this.treeIds,year:this.chooisYear,flag:1}).then(res=>{ |
|
|
|
|
this.showRank = false |
|
|
|
|
this.$message.success('操作成功!') |
|
|
|
|
this.annualList() |
|
|
|
@ -589,18 +766,26 @@ export default { |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}else{// 编辑 |
|
|
|
|
let arr = [] |
|
|
|
|
// let arr = []] |
|
|
|
|
this.treeIds.forEach((e)=>{ |
|
|
|
|
if(e=="全选group"){ |
|
|
|
|
this.treeIds.splice(this.treeIds.indexOf(e),1) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(this.ids,'ids的值',this.treeIds) |
|
|
|
|
this.ids.forEach(e=>{// 避免重复生成 |
|
|
|
|
if(this.treeIds.includes(+e)){ |
|
|
|
|
this.treeIds.splice(this.treeIds.indexOf(+e),1) |
|
|
|
|
if(this.treeIds.includes(e+"")){ |
|
|
|
|
this.treeIds.splice(this.treeIds.indexOf(e+""),1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.treeIds.forEach((e,index)=>{ |
|
|
|
|
if(typeof(e)=='number'){ |
|
|
|
|
arr.push(e) |
|
|
|
|
this.treeIds.forEach((e)=>{ |
|
|
|
|
if(e=="全选group"){ |
|
|
|
|
this.treeIds.splice(this.treeIds.indexOf(e,1)) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
generateAnnualStatistics({personLiableIds:arr,year:this.chooisYear}).then(res=>{ |
|
|
|
|
generateAnnualStatistics({personLiableIds:this.treeIds,year:this.chooisYear}).then(res=>{ |
|
|
|
|
this.showRank = false |
|
|
|
|
this.$message.success('操作成功!') |
|
|
|
|
this.annualList() |
|
|
|
@ -613,7 +798,7 @@ export default { |
|
|
|
|
currentChange(val) { |
|
|
|
|
// 列表变更 |
|
|
|
|
}, |
|
|
|
|
radioChange(val) {// 排名 |
|
|
|
|
radioChange(val,groups) {// 排名 |
|
|
|
|
function compare(key){ |
|
|
|
|
return function(value1,value2){ |
|
|
|
|
let val1=value1[key]; |
|
|
|
@ -622,46 +807,111 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(val==='依据小组排名'){ |
|
|
|
|
let groupMap = new Map() |
|
|
|
|
this.originalData.forEach(e=>{ |
|
|
|
|
if(groupMap.has(e.groupName)){ |
|
|
|
|
let obj = groupMap.get(e.groupName) |
|
|
|
|
obj.totalAmount += e.totalAmount |
|
|
|
|
groupMap.set(e.groupName,obj) |
|
|
|
|
}else{ |
|
|
|
|
let obj = {groupName:e.groupName,totalAmount:e.totalAmount} |
|
|
|
|
groupMap.set(e.groupName,obj) |
|
|
|
|
let groupMap = new Map()// 进行组的总金额排名对象 |
|
|
|
|
let sortGroups = []// 排序组的顺序 |
|
|
|
|
// console.log('开始执行依据小组排名',groups,'groups') |
|
|
|
|
if(!groups){// 执行列表接口逻辑,从列表走 |
|
|
|
|
this.annualStatisticsList() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let group = [] |
|
|
|
|
for(let [key,value] of groupMap){ |
|
|
|
|
group.push(value) |
|
|
|
|
if(groups){// 传来的后端处理的组排名 |
|
|
|
|
for (let key in groups) { |
|
|
|
|
let group = JSON.parse(JSON.stringify(groups[key]))// 取得每个数组的数据 |
|
|
|
|
if(group.length===0) return |
|
|
|
|
// 只需要把数组进行排序,再把组内进行排序进行展示即可,无需进行人员合并 |
|
|
|
|
// 进行组的金额叠加 |
|
|
|
|
let sum = group.reduce((pre,item)=>{ |
|
|
|
|
return pre + (item.cash||0) + (item.assets||0) |
|
|
|
|
},0) |
|
|
|
|
console.log(sum,'叠加的组数据') |
|
|
|
|
let obj = { |
|
|
|
|
sum:sum, |
|
|
|
|
id:group[0].groupId |
|
|
|
|
} |
|
|
|
|
console.log(group,'组group的数据') |
|
|
|
|
groupMap.set(group[0].groupId,obj)// 存累加的组的数据,和组的id做为标识 |
|
|
|
|
console.log(groupMap,'排序的组') |
|
|
|
|
} |
|
|
|
|
group.sort(compare('totalAmount')) |
|
|
|
|
let newGroup = [] |
|
|
|
|
group.forEach(e=>{ |
|
|
|
|
let arr = [] |
|
|
|
|
this.originalData.forEach(el=>{ |
|
|
|
|
if(e.groupName===el.groupName){ |
|
|
|
|
arr.push(el) |
|
|
|
|
let sortGroup = []// 组排名的数组 |
|
|
|
|
for (let [key,value] of groupMap) { |
|
|
|
|
sortGroup.push(value) |
|
|
|
|
} |
|
|
|
|
console.log(sortGroup,'取得排序过的数组数据') |
|
|
|
|
|
|
|
|
|
sortGroup.sort(compare('sum'))// 把组进行排名 |
|
|
|
|
// 以上的组排名根据多次检测,已无问题 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 然后根据排名的组,进行一次排序分离,push进数组中 |
|
|
|
|
sortGroup.forEach(e=>{ |
|
|
|
|
sortGroups.push(groups[e.id])// 组排序人员塞进新数组 |
|
|
|
|
}) |
|
|
|
|
newGroup.push(arr) |
|
|
|
|
|
|
|
|
|
console.log(sortGroups,'处理好的排序组') |
|
|
|
|
let lastData = []// 最后处理出来的数组 |
|
|
|
|
|
|
|
|
|
// 再把组内进行人员合并,且进行排序 |
|
|
|
|
sortGroups.forEach(e=>{ |
|
|
|
|
let manMap = new Map() |
|
|
|
|
e.forEach(e=>{ |
|
|
|
|
if(manMap.has(e.jobNumber)){// 合并相同的人员数据 |
|
|
|
|
let obj = manMap.get(e.jobNumber) |
|
|
|
|
obj.enterprise.push({enterprise:e.enterprise,id:e.id}) |
|
|
|
|
obj.totalAmount += ((+e.cash||0)+(+e.assets)) |
|
|
|
|
obj.cash.push({cash:e.cash,id:e.id}) |
|
|
|
|
obj.assets.push({assets:e.assets,id:e.id}) |
|
|
|
|
obj.collectionTime.push({collectionTime:e.collectionTime,id:e.id}) |
|
|
|
|
obj.description.push({description:e.description,id:e.id}) |
|
|
|
|
manMap.set(e.jobNumber,obj) |
|
|
|
|
}else{// 处理首次的人员 |
|
|
|
|
e.enterprise = [{enterprise:e.enterprise||'-',id:e.id}] |
|
|
|
|
e.totalAmount = (+e.cash||0)+(+e.assets) |
|
|
|
|
e.cash = [{cash:e.cash||'-',id:e.id}] |
|
|
|
|
e.assets = [{assets:e.assets||'-',id:e.id}] |
|
|
|
|
e.collectionTime = [{collectionTime:e.collectionTime,id:e.id}] |
|
|
|
|
e.description = [{description:e.description||'-',id:e.id}] |
|
|
|
|
// console.log(e.totalAmount,`首次加入的${e.personLiable}`) |
|
|
|
|
manMap.set(e.jobNumber,e) |
|
|
|
|
} |
|
|
|
|
// 处理完毕,取出处理好的组的数组,解构,取得初步处理完的数据 |
|
|
|
|
}) |
|
|
|
|
newGroup.forEach(e=>{ |
|
|
|
|
e.sort(compare('totalAmount')) |
|
|
|
|
let handelArr = [] |
|
|
|
|
for(let [key,val] of manMap){ |
|
|
|
|
handelArr.push(val) |
|
|
|
|
} |
|
|
|
|
handelArr.sort(compare('totalAmount')) |
|
|
|
|
|
|
|
|
|
console.log(handelArr,'handlarr') |
|
|
|
|
// 排序完,进行一次赋值操作,把公司排名和组排名搞上去 |
|
|
|
|
handelArr.forEach((e,i)=>{ |
|
|
|
|
e.TeamRanks = i+1 |
|
|
|
|
this.originalData.some(el=>{ |
|
|
|
|
if(e.jobNumber===el.jobNumber){ |
|
|
|
|
e.companyRanks = el.companyRanks |
|
|
|
|
// e.groupName = |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
let groupDown = [] |
|
|
|
|
newGroup.forEach((e)=>{ |
|
|
|
|
e.forEach((e,index)=>{ |
|
|
|
|
e.TeamRanks = index+1 |
|
|
|
|
e.editStr = '编辑' |
|
|
|
|
e.edit = false |
|
|
|
|
groupDown.push(e) |
|
|
|
|
if(e.totalAmount&&e.proportion){ |
|
|
|
|
e.percent = ((e.totalAmount/e.proportion)*100).toFixed(2) |
|
|
|
|
}else{ |
|
|
|
|
e.percent = '未填写年度指标' |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// 最后处理完成的值 |
|
|
|
|
lastData.push(...handelArr) |
|
|
|
|
// for(let [key,val] of manMap){ |
|
|
|
|
// lastData.push(val) |
|
|
|
|
// } |
|
|
|
|
}) |
|
|
|
|
this.statisticsData = JSON.parse(JSON.stringify(groupDown)) |
|
|
|
|
|
|
|
|
|
// console.log(lastData,'处理完的最后的组排名,分人')/ |
|
|
|
|
this.statisticsData = JSON.parse(JSON.stringify(lastData)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}else if(val==='依据公司排名'){ |
|
|
|
|
// this.annualStatisticsList() |
|
|
|
|
// 取得原始的数组,且进行公司排名 |
|
|
|
|
this.originalData.sort(compare('totalAmount')) |
|
|
|
|
this.originalData.forEach((e,i)=>{ |
|
|
|
@ -689,7 +939,9 @@ export default { |
|
|
|
|
statisticsSelection() { |
|
|
|
|
// console.log('发',this.searchStr.year) |
|
|
|
|
// console.log(this.searchStr.year+`年度清收工作完成进度表`) |
|
|
|
|
core.exportFile(annualStatisticsListExport(this.searchStr.year),this.searchStr.year+"年度清收工作完成进度表") |
|
|
|
|
let num |
|
|
|
|
this.radio == "依据公司排名"?num=1:num=0 |
|
|
|
|
core.exportFile(annualStatisticsListExport(this.searchStr.year)+`&flag=${num}`,this.searchStr.year+"年度清收工作完成进度表") |
|
|
|
|
}, |
|
|
|
|
edit(row, val) { |
|
|
|
|
// 编辑 |
|
|
|
@ -700,7 +952,7 @@ export default { |
|
|
|
|
this.$store.commit('liquidate','2') |
|
|
|
|
// 判断进入查看 |
|
|
|
|
this.$store.commit('liquidWatch',val) |
|
|
|
|
console.log(val,this.liquidWatch,'liquidWatch') |
|
|
|
|
// console.log(val,this.liquidWatch,'liquidWatch') |
|
|
|
|
// this.annualStatisticsList() |
|
|
|
|
}, |
|
|
|
|
yearEdit(row, val){// 编辑功能 |
|
|
|
@ -731,12 +983,23 @@ export default { |
|
|
|
|
}, |
|
|
|
|
personnelSelection(val){// 人员选择 |
|
|
|
|
return personnelSelection({year:val}).then(res=>{ |
|
|
|
|
console.log(res.data.list,'list') |
|
|
|
|
this.treeIds = res.data.list.map(e=>{ |
|
|
|
|
return e.split(",").pop() |
|
|
|
|
this.treeIds = res.data.list |
|
|
|
|
// const disabled = function(arr,ids){ |
|
|
|
|
// arr.forEach(e=>{ |
|
|
|
|
// if(ids.includes(e.id)){ |
|
|
|
|
// e.disabled = true |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// disabled(this.tree,this.treeIds) |
|
|
|
|
console.log(this.treeIds,'ids的值') |
|
|
|
|
this.tree[0].personnel.forEach(e=>{ |
|
|
|
|
if(this.treeIds.includes(+e.id)){ |
|
|
|
|
e.disabled = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
console.log(this.treeIds,'treeids') |
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
// console.log('treeIds',this.treeIds) |
|
|
|
|
this.ids = res.data.list |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
@ -748,29 +1011,34 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
allCheck(val){ |
|
|
|
|
console.log(this.tree,'tree') |
|
|
|
|
if(this.tree.length==0) return |
|
|
|
|
let that = this |
|
|
|
|
function recursion(arr){ |
|
|
|
|
if(arr&&arr.length>0){ |
|
|
|
|
arr.forEach(e=>{ |
|
|
|
|
that.treeIds.push(e.id) |
|
|
|
|
if(e.personnel&&e.personnel.length>0){ |
|
|
|
|
recursion(e.personnel) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// allCheck(val){ |
|
|
|
|
// console.log(this.tree,'tree') |
|
|
|
|
// if(this.tree.length==0) return |
|
|
|
|
// let that = this |
|
|
|
|
// function recursion(arr){ |
|
|
|
|
// if(arr&&arr.length>0){ |
|
|
|
|
// arr.forEach(e=>{ |
|
|
|
|
// that.treeIds.push(e.id) |
|
|
|
|
// if(e.personnel&&e.personnel.length>0){ |
|
|
|
|
// recursion(e.personnel) |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// if(val){ |
|
|
|
|
// recursion(this.tree) |
|
|
|
|
// // this.ids = this.treeIds |
|
|
|
|
// }else{ |
|
|
|
|
// this.treeIds = [] |
|
|
|
|
// } |
|
|
|
|
// this.$refs.tree.setCheckedKeys([this.treeIds]); |
|
|
|
|
// // console.log(this.treeIds,'ids') |
|
|
|
|
// // this.$forceUpdate(); |
|
|
|
|
// }, |
|
|
|
|
allAoumntSymbolChange(val){ |
|
|
|
|
if(!val){ |
|
|
|
|
this.searchStr.allAoumnt = '' |
|
|
|
|
} |
|
|
|
|
if(val){ |
|
|
|
|
recursion(this.tree) |
|
|
|
|
// this.ids = this.treeIds |
|
|
|
|
}else{ |
|
|
|
|
this.treeIds = [] |
|
|
|
|
} |
|
|
|
|
this.$refs.tree.setCheckedKeys([this.treeIds]); |
|
|
|
|
// console.log(this.treeIds,'ids') |
|
|
|
|
// this.$forceUpdate(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -845,4 +1113,5 @@ export default { |
|
|
|
|
color:#606266; |
|
|
|
|
background: transparent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|