组合动态列表

<div class="table_wrap" v-show="isCenter">
          <el-table ref="tableRef" v-show="centerLoad && countData.length>0" class="margin_top20" :data="countData" border>
            <el-table-column width="140" fixed>
              <template slot="header">
                <div class="slash_wrap">
                  <span class="text_right margin_bottom15">{{quarter==0?'季度':'月份'}}</span>
                  <span class="text_left margin_top15">部门</span>
                </div>
              </template>
              <template slot-scope="scope">
                <span>{{scope.row[0].dealDepartNa}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="item.monthOrQuarter==0?'合计':(quarter==0?getChinese(item.monthOrQuarter)+'季度':item.monthOrQuarter+'月') " v-for="(item,index) in countData[0]" :key="index">
              <el-table-column min-width="120" align="right" prop="targetAmou" label="任务目标(万元)" >
                <template slot-scope="scope">{{scope.row[index].targetAm}}</template>
              </el-table-column>
              <el-table-column min-width="120" align="right" prop="amoun" label="回收金额(万元)" >
                <template slot-scope="scope">{{scope.row[index].amoun}}</template>
              </el-table-column>
              <el-table-column min-width="120" align="right" prop="rat" label="完成率(%)" >
                <template slot-scope="scope">{{scope.row[index].rate}}</template>
              </el-table-column>
            </el-table-column>
          </el-table>
        </div>


//切换季度
    async quarterChange(val){
      let [data] = this.data?.filter((item)=>item.quarter == val) || []
      this.countData = await this.handleData(data?.children)
    },

/**
 * 根据指定的键函数对数组进行分组。
 */
export function groupBy(array, keyFunction) {  
  return array.reduce((result, currentValue) => {  
    const key = keyFunction(currentValue);  
    if (!result[key]) {  
      result[key] = [];  
    }  
    result[key].push(currentValue);  
    return result;  
  }, {});  
}

    //处理数据,使用Object.groupBy 百分浏览器不支持封装方法groupBy
    handleData(newData = []){
      return Object.values(groupBy(newData,(item)=>item.dealDepartmentName+`,${item.dealDepartmentId}`))
    },

//数字替换中文
    getChinese(num){
      let chinese = ['零','一','二','三','四','五','六','七','八','九','十'];
      return chinese[num]
    },

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值