let relist=[];
      let abcArray=['A','B','C','D','E','F','G','H','I','J','K','L','M','N'];
      let mergesArray=[];
      //测试数据
        relist.push({
          nickname: 'nickname1', 
          phone: 'phone1', 
          orderNo: 'orderNo1',
          dtbName: 'dtbName1',
          giftName: 'giftName1', 
          createTime: 'createTime1',
          id:2
        });
        relist.push({
          nickname: 'nickname1', 
          phone: 'phone1', 
          orderNo: 'orderNo1',
          dtbName: 'dtbName2',
          giftName: 'giftName1', 
          createTime: 'createTime1',
          id:0
        });
        relist.push({
          nickname: 'nickname1', 
          phone: 'phone1', 
          orderNo: 'orderNo1',
          dtbName: 'dtbName3',
          giftName: 'giftName1', 
          createTime: 'createTime1',
          id:0
        });
        relist.push({
          nickname: 'nickname1', 
          phone: 'phone1', 
          orderNo: 'orderNo1',
          dtbName: 'dtbName3',
          giftName: 'giftName1', 
          createTime: 'createTime1',
          id:1
        });
        relist.push({
          nickname: 'nickname1', 
          phone: 'phone1', 
          orderNo: 'orderNo1',
          dtbName: 'dtbName3',
          giftName: 'giftName1', 
          createTime: 'createTime1',
          id:0
        });
         for(let i=0;i<relist.length;i++){
        if(relist[i].id!=0){
          let ids=[];
          ids.push(i);
          for(let j=1;j<relist[i].id+1;j++){
            ids.push(i+j);
          }
          if(ids.length>1){
            let mergesStr0 =[]
            let mergesStr1 =[]
            let mergesStr2 =[]
            let mergesStr3 =[]
            let mergesStr5 =[]
            ids.map(item=>{
              item=item+2
              mergesStr0.push(abcArray[0]+item)
              mergesStr1.push(abcArray[1]+item)
              mergesStr2.push(abcArray[2]+item)
              mergesStr3.push(abcArray[3]+item)
              mergesStr5.push(abcArray[5]+item)
            })
            mergesArray.push(mergesStr0.join(':'))
            mergesArray.push(mergesStr1.join(':'))
            mergesArray.push(mergesStr2.join(':'))
            mergesArray.push(mergesStr3.join(':'))
            mergesArray.push(mergesStr5.join(':'))
          }
          
        }
      }
      console.log(mergesArray,'mergesArray')
      import('../../vendor/Export2Excel.js').then(excel => {
          // const multiHeader = [['标题', '','']] // 标题
          const header = ['用户', '手机号','订单编号', '活动', '赠品','下单时间'] // 表头
          const filterVal = ['nickname', 'phone','orderNo', 'dtbName', 'giftName', ' createTime'] // 数据属性
          const list = relist //请求来的数据
          console.log(list,'导出')
          const merges = mergesArray //需要合并的单元格
          const data = list.map(item => filterVal.map(j => item[j])) // 转换二维数组
          const filename = '订单列表'
          excel.export_json_to_excel({
            // multiHeader, // 标题--非必要
            header, // 表头
            data,  // 具体数据--二维数组
            merges, // 合并--非必要
            filename // 下载文件名
          })
        })
GitHub 加速计划 / vu / vue
207.54 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:2 个月前 )
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 4 个月前
e428d891 Updated Browser Compatibility reference. The previous currently returns HTTP 404. 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐