扁平化方法

2022-03-17  本文已影响0人  糖醋里脊120625
publicData(index,rowData){
      rowData.deliverDateTimes = rowData.planDate + ' ' + this.$format(rowData.supplyTime,'hh:mm:ss');
      this.infoObj = rowData;
      this.getcanteenInfo(rowData.canteenId);
      this.infoLoading = true;
      this.dialogVisible = true;
      this.value = config.baseYGimg + '/canteen-supplier/#/order/sendGpage?id='+rowData.id+'&areaName='+this.invoiceTitle+'&type=1';
      

      supplierDeliveryApi.getDetail(rowData.id).then(data => {
        let zj = 0;
        if(data.deliveryVehicleInfos.length > 0){
          let catinfo = data.deliveryVehicleInfos[0];
          catinfo.startDates = this.$format(catinfo.startTime,'yyyy-MM-dd');
          catinfo.endDates = this.$format(catinfo.endTime,'yyyy-MM-dd');
          this.catInfo = catinfo;
        }else{
          this.catInfo = {};
        }
        let listData = data.list;
        listData.forEach((ele,ind)=>{
          this.$set(ele, "voucherimglist", ele.voucherList.map(item => {return {url: item, type: item.substr(item.lastIndexOf(".") + 1)}}));
          if(ele.productionDate){
            ele.scDate = this.$format(ele.productionDate,'yyyy-MM-dd');
            if(ele.scDate.indexOf('1900') >= 0){
              ele.scDate = '';
            }
          }
        })
        this.infoData = listData;
        var arrayTwo = Object.values(listData.reduce((res, item) => {
          res[item.salesItemName] ? res[item.salesItemName].push(item) : res[item.salesItemName] = [item];
          return res;
        }, {}));
        this.newInfoData = arrayTwo;
      })
      .finally(() => {
        this.infoLoading = false;
      })
      return
    },
上一篇 下一篇

猜你喜欢

热点阅读