KKbes
2023-08-07 492f744d9d84289e27b2ddac9a9b4a2137fd11d6
force-app/main/default/lwc/lexCancleCampaign/lexCancleCampaign.js
@@ -5,7 +5,7 @@
const event1 = new ShowToastEvent({
                  message:
                   "已经取消!!",
                   "已经取消!",
                   variant : "error" 
});   
const event4 = new ShowToastEvent({
@@ -51,7 +51,6 @@
        }).then(result => {
            if (result != null) {
                this.Campaign = result;
                console.log(this.Campaign);
                this.cancle().then(result=>{
                   this.IsLoading=false;
                   this.dispatchEvent(new CloseActionScreenEvent());
@@ -70,6 +69,7 @@
    async cancle(){
       var checkUpdate=0;
       if(this.Campaign.Status =='取消'){
         this.dispatchEvent(event1);
         return;
@@ -113,8 +113,8 @@
                  message : result,
                  variant : 'error'
               })
               checkUpdate +=1;
               this.dispatchEvent(event7);
            }
         });
      }else if(this.Campaign.Status =='公开中'){
@@ -124,33 +124,44 @@
                  message : result,
                  variant : 'error'
               })
               checkUpdate +=1;
               this.dispatchEvent(event8);
            }
         });
      if(checkUpdate!=0){
         return;
      }
         await  submitApprovalRequest({recordId : this.recordId}).then(result1=>{
            console.log(result1);
            if(result1!=null){
            //更新状态
             newAndUpddateCampaign({campaignId : this.Campaign.Id , Status : '公开中'}).then(result2=>{
            newAndUpddateCampaign({campaignId : this.Campaign.Id , Status : '公开中'}).then(result2=>{
                if(result2!='success'){
                   const eventErroe3 = new ShowToastEvent({
                        message:
                          result2,
                          variant : 'error'
                    });
                    checkUpdate +=1;
                    this.dispatchEvent(eventErroe3);   
                }
            });
            if(checkUpdate!=0){
               return;
            }
            const eventFail = new ShowToastEvent({
                       message:
                        result1,
                      variant : 'error'
                 });   
            checkUpdate +=1;
              this.dispatchEvent(eventFail);
              return;
            }
         });
         if(checkUpdate!=0){
            return;
         }
         window.location.reload();
      }