// 清收完成统计
<template>
    <div>
        <!-- 清收工作完成统计 -->
        <div v-if="liquidate === '1'">
            <div class="mgt20 left-border fz-16"><p class="c-black mgl10">清收工作完成情况统计</p></div>
            <div class="mgt20 pdb20">
                <div class="mgtb20">
                    <div class="flex-center">
                        <el-button  type="primary" v-if="$router.currentRoute.meta.btn.includes('生成年度统计表')"  round @click="createList('new')">生成年度统计表</el-button>
                    </div>
                </div>
                <div class="shadow radius10 pdt20">
                    <el-table v-loading='loading' :data="data"  stripe header-align="center" class="mat20">
                        <el-table-column type="index" width="200" label="序号" align="center"></el-table-column>
                        <el-table-column label="年度" align="center">
                            <template slot-scope="scope">
                                {{scope.row}}
                            </template>
                        </el-table-column>
                        <el-table-column label="操作" width="300" align="center">
                            <template slot-scope="scope">
                                <el-button type="text" v-if="$router.currentRoute.meta.btn.includes('人员选择')" @click="createList(scope.row)">人员选择</el-button>
                                <el-button type="text" v-if="$router.currentRoute.meta.btn.includes('统计查看')" @click="[(liquidate = '2'), edit(scope.row, 'watch')]">查看</el-button>
                                <el-button type="text" v-if="$router.currentRoute.meta.btn.includes('统计编辑')"  @click="edit(scope.row)">编辑</el-button>
                                <el-button type="text" v-if="$router.currentRoute.meta.btn.includes('统计删除')"  @click="del(scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </div>
        </div>
        <!-- 查看详细数据 -->
        <div v-if="liquidate === '2'">
            <div class="mgt20 left-border fz-16"><p class="c-black mgl10">条件筛选</p></div>
            <div class="mgt20 pdb20">
                <div class="flex-between mgtb20">
                    <div class="flex-center">
                        <p class="fz-16 mgr10 font-blue mgl20 nowrap">清收组</p>
                        <el-select v-model="searchStr.groupId" placeholder="请选择" clearable @change="search">
                            <el-option v-for="item in liquidateSelectArr" :key="item.id" :label="item.groupName" :value="item.id"></el-option>
                        </el-select>

                        <p class="fz-16 mgr10 font-blue mgl20 nowrap">完成比例</p>
                        <el-select v-model="searchStr.proportionSymbol" placeholder="请选择" clearable @change="search">
                            <el-option v-for="item in proportion" :key="item.id" :label="item.label" :value="item.id"></el-option>
                        </el-select>
                        <el-input
                            placeholder="请输入整数"
                            class="wd20 mglr10"
                            style="min-width: 200px"
                            :disabled="!searchStr.proportionSymbol"
                            v-model="searchStr.proportion"
                            clearable
                        ></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-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>
                    </div>
                    <div class="flex-center">
                        <el-button v-preventReClick type="primary" size="small" round @click="clearOption">清空选项</el-button>
                        <el-button v-preventReClick type="primary" size="small" round @click="annualStatisticsList">搜索</el-button>
                    </div>
                </div>
                <div class="shadow radius10 pdt20">
                    <div class="flex-between mab20 mgl10">
                        <div class="flex-center">
                            <p class="hr_tag"></p>
                            <span class="hr_text">{{liquidateSearch.year}}年度清收工作完成情况统计表</span>
                        </div>
                    </div>

                    <div class="flex-between">
                        <div class="flex-center">
                            <el-button class="mgl20"  v-if="$router.currentRoute.meta.btn.includes('统计导出')"  v-preventReClick type="primary" size="small" round @click="statisticsSelection">导出列表</el-button>
                            <el-radio-group v-model="radio" class="mgl30" @change="radioChange">
                                <el-radio-button class="ht40" label="依据公司排名"></el-radio-button>
                                <el-radio-button class="ht40" label="依据小组排名"></el-radio-button>
                            </el-radio-group>
                        </div>
                        <div class="df">
                            <el-input
                                style="min-width: 250px"
                                class="ht40 mgl10 mgr10"
                                @keyup.enter.native="annualStatisticsList('search')"
                                v-model="searchStr.queryCondition"
                                placeholder="工号/清收负责人/清收企业"
                                clearable
                            ></el-input>
                        </div>
                    </div> 
                    <!-- 
                        前端查询
                         :data="data.filter(data => !search || data.businessCode.toLowerCase().includes(search.toLowerCase()))"
                     -->
                    <div class="dataList" ref="table" @scroll="handleScroll">
                        <el-table
                            :data="statisticsData"
                            stripe
                            header-align="center"
                            v-loading="statisticsLoading"
                            class="mat20 "
                            :row-key="getRowKeys"
                            :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="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>
                            <el-table-column prop="enterprise" label="清收企业" align="center" width="150px">
                                <template slot-scope="scope">
                                    <div class="multi-box" v-for="(item, index) in scope.row.enterprise" :key="index">
                                        {{ item.enterprise }}
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="cash" label="清收现金（万元）" align="center" width="150px">
                                <template slot-scope="scope">
                                    <div class="multi-box" v-for="(item, index) in scope.row.cash" :key="index">
                                        {{ item.cash }}
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="asset" label="清收资产（万元）" align="center" width="150px">
                                <template slot-scope="scope">
                                    <div class="multi-box" v-for="(item, index) in scope.row.assets" :key="index">
                                        {{ item.asset }}
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="collectionTime" label="回款时间" align="center" width="200px">
                                <template slot-scope="scope">
                                    <div class="backTime" v-for="(item, index) in scope.row.collectionTime" :key="index">
                                        <el-date-picker
                                            style="width:180px"
                                            v-model="item.collectionTime"
                                            type="date"
                                            value-format="yyyy-MM-dd"
                                            :disabled="!scope.row.edit"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="totalAmount" label="已清收总额（元）" align="center" width="150px">
                                <template slot-scope="scope" >
                                    <div class="multi-box" >
                                        {{ scope.row.totalAmount }}
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="ratio" label="完成比例" align="center" width="150px">
                                <template slot-scope="scope">
                                    <div class="ratio" v-show="scope.row.edit">
                                        <div class="top">{{scope.row.totalAmount}}</div>
                                        <el-input :disabled="!scope.row.edit" v-model="scope.row.proportion"></el-input>
                                    </div>
                                    <div v-if="!scope.row.edit">
                                        {{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" v-for="(item, index) in scope.row.description" :key="index">
                                        <el-input :disabled="!scope.row.edit" v-model="item.description"></el-input>
                                    </div>
                                </template>
                            </el-table-column>
                            <!-- 判断是否为查看或者编辑 -->
                            <el-table-column v-if="!liquidWatch" label="操作" width="300" align="center">
                                <template slot-scope="scope">
                                    <el-button type="text" @click="yearEdit(scope.row)">{{scope.row.editStr}}</el-button>
                                    <!-- <el-button type="text" @click="history(scope.row)">查看</el-button> -->
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <el-button class="more-btn" v-show="moreBtn" type="primary" @click="clickMore" round>{{moreText}}</el-button>
                </div>
            </div>
        </div>

        <!-- 弹框--生成年度统计表 -->
        <el-dialog title="请选择" v-loading="treeLoading" width="40%" :visible.sync="showRank" center>
            <div class="ranking">
                <div class="top">
                    <div class="left-border fz-16"><p class="c-black mgl10">年份</p></div>
                    <el-date-picker
                        :disabled="changeStaffDisabled"
                        class="mgt10 mgl80"
                        v-model="chooisYear"
                        value-format="yyyy"
                        :picker-options="pickerOptions"
                        type="year"
                        placeholder="选择年"
                    >
                    </el-date-picker>
                </div>
                <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-tree
                            :data="tree"
                            show-checkbox
                            default-expand-all
                            node-key="id"
                            ref="tree"
                            @check-change="checkBox"
                            :default-checked-keys="treeIds"
                            highlight-current
                            :props="defaultProps"
                        >
                        </el-tree>
                    </div>
                </div>
                <div class="flex-center fj-center mgt20">
                    <el-button type="primary" v-preventReClick round class="mgr20" @click="treeSure">确定</el-button>
                    <el-button round class="mgl20" @click="[chooisYear='',showRank=false]">取消</el-button>
                </div>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {collectionGroupList ,generateAnnualStatistics,annualList,annualStatisticsList,editAnnualStatistics,personnelSelection ,annualStatisticsDeleted,annualStatisticsListExport,liquidateList } from '../../../utils/api'
import core from '../../../utils/core'
export default {
    name: '',
    props: {},
    data() {
        return {
            showRank: false, // 弹框
            treeLoading:false,// 树弹框加载
            loading:false,// 列表加载
            statisticsLoading:false,// 统计列表加载
            defaultProps: {
                children: 'personnel',
                label: "name"
            },
            data: [],
            tree: [],
            treeIds:[],
            treeStatus:'',
            chooisYear: '',
            pageNo: 0,
            totals: 0,
            liquidateSelectArr: [{ label: '不限', id: '' }],
            proportion: [
                // 选择完成比例符号
                { label: '不限', id: '' },
                { label: '>', id: '>' },
                { label: '<', id: '<' },
                { label: '>=', id: '>=' },
                { label: '<=', id: '<=' },
                { label: '=', id: '=' }
            ],
            searchStr: {
                // 筛选条件
                year:'',
                groupId: '', // 清收组
                proportion: '', // 比例
                percent: '', // 比例整数百分比
                proportionSymbol: '', // 选择比例符号
            },
            radio: '依据公司排名',

            liquidateSelect: '0', // 选择筛选框
            originalData:[],// 记录原本data
            statisticsData: [// 统计表的数据
            ], 
            keyword: '', // 搜索绑定变量占位
            pickerOptions: {
                disabledDate(time) {
                    // 限制时间
                    let date = new Date();
                    let year = date.getFullYear();
                    return time.getFullYear() > year;
                }
            },
            moreBtn:false,
            moreText:'向下滚动查看更多',
            recordArr:[],// 记录用数组,加载更多
            changeStaffYear:'',
            changeStaffDisabled:false,
        };
    },
    watch: {
        showRank(val){
            if(val){
                this.getTree()
            }
        },
    },
    computed: {
        liquidate:{
            get(){
                return this.$store.state.loan.liquidate
            },set(){}
        },
        liquidWatch:{
            get(){
                return this.$store.state.loan.liquidWatch
            },set(){}
        },
        liquidateSearch:{
            get(){
                this.searchStr = this.$store.state.loan.liquidateSearch
                return this.$store.state.loan.liquidateSearch
            },set(){}
        },
        percent(){
            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,'li')
        if(this.liquidate=='2'){
            console.log('判断为2')
            this.liquidateList()
            this.annualStatisticsList()
        }
    },
    mounted() {
       
    },
    methods: {
        liquidateList(){// 清收组
            liquidateList().then(res=>{
                this.liquidateSelectArr = res.data.groupList
                console.log(this.liquidateSelectArr,'arr')
            })
        },
        handleScroll:core.debounce(function(){
            let box = this.$refs.table
            if(box.scrollTop+box.clientHeight+180>box.scrollHeight){
                this.moreBtn = true
            }else{
                this.moreBtn = false
            }
            if(box.scrollTop+box.clientHeight+50>=box.scrollHeight){
                
            }
        },10),
        async clickMore(){// 进行加载更多操作
            this.statisticsLoading = true
            await setTimeout(() => {
                this.statisticsLoading = false
            }, 500+Math.floor(Math.random(500)));
            this.statisticsData.push(...this.recordArr.slice(0,10))
            this.recordArr.splice(0,10)
            let box = this.$refs.table
            let st = box.scrollTop
            if(this.recordArr.length===0){
                this.moreText = "没有更多数据了！"
            }else{
                this.moreText = "点击加载更多数据"
                box.scrollTop = st
            }
        },
        annualList(){
            this.loading = true
            annualList().then(res=>{
                this.loading = false
                this.data = res.data.list
            }).catch(()=>{
                this.loading = false
            })
        },
        annualStatisticsList(){
            if(this.searchStr.proportionSymbol&&!this.searchStr.proportion) return this.$message('请输入完成比例整数！')
            if(this.searchStr.allAoumntSymbol&&!this.searchStr.allAoumnt) return this.$message('请输入已清收总额！')
            if(!this.searchStr.year) {
                this.searchStr = this.$store.state.loan.liquidateSearch
            }
            this.moreText = "点击加载更多数据"
            let param = {
                year:this.searchStr.year,
                groupId:this.searchStr.groupId,
                // proportionSymbol:this.searchStr.proportionSymbol,
                // proportion:this.searchStr.proportion,
                queryCondition:this.searchStr.queryCondition,
            }
            this.statisticsLoading = true
            annualStatisticsList(param).then(res=>{
                this.statisticsLoading = false
                let arr = new Map()
                let data = res.data.list
                data.forEach(e=>{
                    if(arr.has(e.jobNumber)){
                        let obj = arr.get(e.jobNumber)
                        obj.enterprise.push({enterprise:e.enterprise,id:e.id})
                        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})
                        obj.totalAmount += e.totalAmount
                        arr.set(e.jobNumber,obj)
                    }else{
                        e.enterprise = [{enterprise:e.enterprise,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.totalAmount += e.totalAmount
                        arr.set(e.jobNumber,e)
                    }
                })
                // 取得初次处理的数据
                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 = '未填写任务额度'
                    }
                    this.originalData.push(value)
                }
                console.log(this.originalData,'初始处理的数据')

                this.radioChange('依据小组排名')
                this.radioChange('依据公司排名')
                if(this.radio==='依据小组排名'){
                    this.radioChange('依据小组排名')
                }
                console.log(this.searchStr.proportionSymbol,'this.searchStr.allAoumntSymbol')
                switch (this.searchStr.proportionSymbol) {
                    case '':
                        break;
                    case ">":
                        if(this.searchStr.proportion){
                            this.statisticsData = this.statisticsData.filter(e=>{
                                if(e.percent!=='未填写任务额度')
                                return +e.percent > this.searchStr.proportion
                            })
                        }
                        break;
                    case "<":
                        if(this.searchStr.proportion){
                            this.statisticsData = this.statisticsData.filter(e=>{
                                if(e.percent!=='未填写任务额度')
                                return +e.percent < this.searchStr.proportion
                            })
                        }
                        break;
                    case ">=":
                        if(this.searchStr.proportion){
                            this.statisticsData = this.statisticsData.filter(e=>{
                                if(e.percent!=='未填写任务额度')
                                return +e.percent >= this.searchStr.proportion
                            })
                        }
                        break;
                    case "<=":
                        if(this.searchStr.proportion){
                            this.statisticsData = this.statisticsData.filter(e=>{
                                if(e.percent!=='未填写任务额度')
                                return +e.percent <= this.searchStr.proportion
                            })
                        }
                        break;
                    case "=":
                        if(this.searchStr.proportion){
                            this.statisticsData = this.statisticsData.filter(e=>{
                                if(e.percent!=='未填写任务额度')
                                return +e.percent == this.searchStr.proportion
                            })
                        }
                        break;
                    default:
                        break;
                }
                // 查完成比例
                switch (this.searchStr.allAoumntSymbol) {
                    case '':
                        break;
                    case ">":
                        this.statisticsData = this.statisticsData.filter(e=>{
                            return e.totalAmount > this.searchStr.allAoumnt||0
                        })
                        break;
                    case "<":
                        this.statisticsData = this.statisticsData.filter(e=>{
                            return e.totalAmount < this.searchStr.allAoumnt||0
                        })
                        break;
                    case ">=":
                        this.statisticsData = this.statisticsData.filter(e=>{
                            return e.totalAmount >= this.searchStr.allAoumnt||0
                        })
                        break;
                    case "<=":
                        this.statisticsData = this.statisticsData.filter(e=>{
                            return e.totalAmount <= this.searchStr.allAoumnt||0
                        })
                        break;
                    case "=":
                        this.statisticsData = this.statisticsData.filter(e=>{
                            return e.totalAmount == this.searchStr.allAoumnt||0
                        })
                        break;
                    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)// 首次切割
                }
            }).catch(err=>{
                this.statisticsLoading = false
            })
        },
        getTree(){// 取得统计树数据
            this.treeLoading = true
            collectionGroupList().then(res=>{
                this.treeLoading = false
                let data = res.data.list
                data.forEach((e,index)=>{
                    if(e.id.includes('group')&&e.personnel.length===0){
                        e.disabled = true
                    }
                })
                this.tree = data 
            }).catch(err=>{
                this.treeLoading = false
            })
        },
        // 勾选
        checkBox(data, checked, indeterminate){
            this.treeIds = this.$refs.tree.getCheckedKeys()
        },
        async createList(val) {// 唤起清收组弹窗
            console.log(val,'val')
            this.showRank = true;
            if(val==='new'){// 新增人员
                this.treeIds = []
                this.changeStaffDisabled = false
            }else{
                await this.personnelSelection(val)
                this.changeStaffDisabled = true
                this.chooisYear = val
            }
            this.treeStatus = val
        },
        treeSure(){// 确定
            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)
                    }
                })
                if(arr.length===0) return this.$message.warning('请先选择人员后再生成列表！')
                generateAnnualStatistics({personLiableIds:arr,year:this.chooisYear,flag:1}).then(res=>{
                    this.showRank = false
                    this.$message.success('操作成功！')
                    this.annualList()
                }).catch(err=>{

                })
            }else{// 编辑
                let arr = []
                this.ids.forEach(e=>{// 避免重复生成
                    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)
                    }
                })
                generateAnnualStatistics({personLiableIds:arr,year:this.chooisYear}).then(res=>{
                    this.showRank = false
                    this.$message.success('操作成功！')
                    this.annualList()
                }).catch(err=>{

                })
                
            }
        },
        currentChange(val) {
            // 列表变更
        },
        radioChange(val) {// 排名
            function compare(key){
                return function(value1,value2){
                    let val1=value1[key];
                    let val2=value2[key];
                    return val2-val1;
                }
            }
            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 group = []
                for(let [key,value] of groupMap){
                    group.push(value)
                }
                group.sort(compare('totalAmount'))
                let newGroup = []
                group.forEach(e=>{
                    let arr = []
                    this.originalData.forEach(el=>{
                        if(e.groupName===el.groupName){
                            arr.push(el)
                        }
                    })
                    newGroup.push(arr)
                })
                newGroup.forEach(e=>{
                    e.sort(compare('totalAmount'))
                })
                let groupDown = []
                newGroup.forEach((e)=>{
                    e.forEach((e,index)=>{
                        e.TeamRanks = index+1
                        e.editStr = '编辑'
                        e.edit = false
                        groupDown.push(e)
                    })
                })
                this.statisticsData = JSON.parse(JSON.stringify(groupDown))
            }else if(val==='依据公司排名'){
                // 取得原始的数组,且进行公司排名
                this.originalData.sort(compare('totalAmount'))
                this.originalData.forEach((e,i)=>{
                    e.companyRanks = i+1
                    e.editStr = '编辑'
                    e.edit = false
                })
                this.statisticsData = JSON.parse(JSON.stringify(this.originalData))
            }

            
        },
        clearOption() {
            // 清空筛选条件
            this.$store.commit('liquidateSearch',{year:this.liquidateSearch.year})
            this.annualStatisticsList()
        },
        search() {
            // 暂时占位
        },
        getRowKeys(row) {
            // 列表的Key
            return row.Id;
        },
        statisticsSelection() {
            // console.log('发',this.searchStr.year)
            // console.log(this.searchStr.year+`年度清收工作完成进度表`)
            core.exportFile(annualStatisticsListExport(this.searchStr.year),this.searchStr.year+"年度清收工作完成进度表")
        },
        edit(row, val) {
            // 编辑
            this.liquidate ='2';
            this.$store.commit('liquidateSearch',{
                year:row
            })
            this.$store.commit('liquidate','2')
            // 判断进入查看
            this.$store.commit('liquidWatch',val)
            console.log(val,this.liquidWatch,'liquidWatch')
            this.annualStatisticsList()
        },
        yearEdit(row, val){// 编辑功能
            if(row.edit != false){
                row.edit = false
                row.editStr = '编辑'
                // 调接口，存数据，重新请求列表
                let param = []
                row.enterprise.forEach((e,index)=>{
                    let obj = {
                        collectionTime:row.collectionTime[index].collectionTime,
                        id:e.id,
                        description:row.description[index].description,
                        proportion:row.proportion
                    }
                    param.push(obj)
                })
                editAnnualStatistics({collectionStatistics:param}).then(res=>{
                    this.$message.success('编辑成功！')
                    setTimeout(() => {
                        this.annualStatisticsList()
                    }, 1000);
                })
            }else{
                row.editStr = '保存'
                row.edit = true
            }
        },
        personnelSelection(val){// 人员选择
            return personnelSelection({year:val}).then(res=>{
                this.treeIds = res.data.list
                this.ids = res.data.list
            })
        },
        del(row){
            this.$confirm('确定要删除该年度统计数据吗？').then(()=>{
                annualStatisticsDeleted(row).then(res=>{
                    this.annualList()
                    
                })
            })
        }
    }
};
</script>
<style lang='scss' scoped>
/deep/ .el-radio-button__inner {
    padding-top: 9px;
    padding-bottom: 9px;
}
.multi-box {
    border: 1px solid #e6e6e6;
    min-height: 50px;
    text-align: center;
    line-height: 50px;
    &:nth-child(2n) {
        background: #e6e6e6;
    }
}
.backTime{
    min-height: 50px;
    line-height: 50px;
    /deep/ .el-input__inner{
        text-align: center;
    }

}
.ratio{
    .top{
        border-bottom: 1px solid;
        height: 52px;
        line-height: 52px;
        margin-bottom: 15px;
    }
}
.dataList{
    height: 550px;
    overflow: auto;
    position: relative;
}
/deep/ .el-table::before{
    background-color: transparent;
}
.more-btn{
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translate(-50%,0);
}
/deep/ .el-input.is-disabled .el-input__inner{
    text-align: center;
}
</style>
