buli
2023-04-21 43fdbff49764d55c7b3a19a1d6e7d8aeb62072ef
force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -42,6 +42,7 @@
   @track category4Option = [];
   @track category5Option = [];
   @track consumableorderdetailsRecordsview = [];
   @track consumableorderdetailsRecordForDT = [];
   @track attachmentRecoeds = [];
   @track contactDealer = [];
   @track proLimitAndDate = [];
@@ -117,6 +118,38 @@
      {label:'允许报价期间(结束日)',fieldName:'Contract_Decide_End_Date__c',initialWidth:200,hideDefaultActions: true}
   ];
   //消耗品数据col
   get cols(){
      var cols = [];
      cols.push({label:'消耗品名称',fieldName:'prodName',wrapText:true,hideDefaultActions: true});
      cols.push({label:'规格',fieldName:'packing_list',hideDefaultActions: true});
      cols.push({label:'CFDA状态',fieldName:'prodSFDAStatus',hideDefaultActions: true});
      cols.push({label:'注册证编码号',fieldName:'approbation_No',hideDefaultActions: true});
      cols.push({label:'注册证效期',fieldName:'expiration_Date',hideDefaultActions: true});
      cols.push({label:'第3分类',fieldName:'prodCategory3',hideDefaultActions: true});
      cols.push({label:'第4分类',fieldName:'prodCategory4',hideDefaultActions: true});
      cols.push({label:'第5分类',fieldName:'prodCategory5',hideDefaultActions: true});
      if(this.cansee){
         cols.push({label:'标准单价',fieldName:'prodIntraTradeList',hideDefaultActions: true});
      }
      if(this.editAble){
         cols.push(
            {label:'采购数量',
            type: "customTableInput",typeAttributes: {
               recordId: { fieldName: "recordId" },
               inputValue: { fieldName: "consumableCount" },
            },
            hideDefaultActions: true});
      }else{
         cols.push({label:'采购数量',fieldName:'consumableCount',hideDefaultActions: true});
      }
      cols.push({label:'在库数下限',fieldName:'lowerlimit',hideDefaultActions: true});
      cols.push({label:'在库数上限',fieldName:'upperlimit',hideDefaultActions: true});
      cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true});
      cols.push({label:'有效期库存(个)',fieldName:'allnumber_piece',hideDefaultActions: true});
      return cols;l
   }
   @wire(CurrentPageReference)
   getStateParameters(currentPageReference) {
      console.log('CurrentPageReference');
@@ -147,11 +180,11 @@
               this.contractName = result.contractName;
               this.contractLabel = '经销商有效合同';
               this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
               // this.consumableorderdetailsRecordForDT = result.consumableorderdetailsRecordsview;
               this.getTableData();
               this.attachmentRecoeds = result.attachmentRecoeds;
               this.errorMsgs = result.errorMsgList;
               this.warningMsgs = result.warningMsgList;
               // this.hasError = result.hasError;
               // this.hasWarning = result.hasWarning;
               this.userWorkLocation = result.userWorkLocation;
               this.accountName = result.accountName;
               this.accountid = result.accountid;
@@ -202,20 +235,30 @@
               }
               this.showSpinner = false;
               this.showPage = true;
               // this.warningMsgs.push('warning1');
               // this.warningMsgs.push('warning2');
               // this.warningMsgs.push('warning3');
               // this.warningMsgs.push('warning4');
               // this.errorMsgs.push('error1');
               // this.errorMsgs.push('error2');
               // this.errorMsgs.push('error3');
               // this.errorMsgs.push('error4');
            }else{
               this.showSpinner = false;
               console.log("Error:"+result.errorMsg);
               this.showMyToast('初始化页面失败',result.errorMsg,'error');
            }
         })
   }
   getTableData(){
      for(var i in this.consumableorderdetailsRecordForDT){
         if(!this.consumableorderdetailsRecordForDT[i].oldCheck){
            this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].Prod.Name__c;
         }else{
            this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_Product__r.Name__c;
         }
         this.consumableorderdetailsRecordForDT[i]["prodSFDAStatus"] = this.consumableorderdetailsRecordForDT[i].Prod.SFDA_Status__c;
         this.consumableorderdetailsRecordForDT[i]["prodCategory3"] = this.consumableorderdetailsRecordForDT[i].Prod.Category3__c;
         this.consumableorderdetailsRecordForDT[i]["prodCategory4"] = this.consumableorderdetailsRecordForDT[i].Prod.Category4__c;
         this.consumableorderdetailsRecordForDT[i]["prodCategory5"] = this.consumableorderdetailsRecordForDT[i].Prod.Category5__c;
         this.consumableorderdetailsRecordForDT[i]["prodIntraTradeList"] = this.consumableorderdetailsRecordForDT[i].Prod.Intra_Trade_List_RMB__c;
         this.consumableorderdetailsRecordForDT[i]["consumableCount"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_count__c;
      }
      console.log("ProdName1:"+this.consumableorderdetailsRecordForDT[0].prodName);
      console.log("ProdName2:"+this.consumableorderdetailsRecordsview[0].prodName);
   }
   
   get hasWarning(){
@@ -304,6 +347,7 @@
            .then(result=>{
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                  this.getTableData();
                  this.showSpinner = false;
                  this.errorMsgs = result.errorMsgList;
                  this.warningMsgs = result.warningMsgList;
@@ -351,6 +395,7 @@
      }).then(result=>{
            if(result.result == 'Success'){
               this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
               this.getTableData();
               this.showSpinner = false;
               this.showMyToast('搜索成功',result.errorMsg,'success');
            }else{
@@ -786,6 +831,7 @@
            }).then(result=>{
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                  this.getTableData();
                  this.showMyToast('搜索成功',result.errorMsg,'success');
               }else{
                  console.log("Error:"+result.errorMsg);
@@ -901,6 +947,7 @@
            }).then(result=>{
               if(result.result == 'Success'){
                  this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                  this.getTableData();
                  this.showMyToast('搜索成功',result.errorMsg,'success');
               }else{
                  console.log("Error:"+result.errorMsg);