zhangqian
2023-07-10 b37242ad5f2a81065eba0b176b38de4dd93ac8d6
force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
@@ -2,6 +2,7 @@
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { updateRecord } from 'lightning/uiRecordApi';
import init from '@salesforce/apex/AllReceivedFseController.init';
import getRaeSet from '@salesforce/apex/AllReceivedFseController.getRaeSet';
@@ -39,23 +40,11 @@
               recordId: this.recordId
            }).then(res=>{
               if(res == 'SUCCESS'){
                  const evt = new ShowToastEvent({
                           title : '现场已全部收货',
                           message: '',
                           variant: 'success'
                       });
                       this.dispatchEvent(new CloseActionScreenEvent());
                      this.dispatchEvent(evt);
                      this.showToast('现场已全部收货','success');
                      return;
               }else{
                  const errToast = new ShowToastEvent({
                           title : res,
                           message: '',
                           variant: 'error'
                       });
                       this.dispatchEvent(new CloseActionScreenEvent());
                      this.dispatchEvent(errToast);
                      console.log(res);
                      this.showToast(res,'warning');
                      return;
               }
               
            })
@@ -67,4 +56,20 @@
         console.log('init==='+err);
      })
   }
   showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        if(type == 'success'){
            this.updateRecordView(this.recordId);
        }
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
}