19626
2023-10-23 1727a4f4d02e429475608e60f142a63bc24127bc
force-app/main/default/lwc/lexSISubmit/lexSISubmit.js
@@ -7,6 +7,9 @@
import init from '@salesforce/apex/ISOpportunityDemand.initISOpportunityController';
import submit from '@salesforce/apex/ISOpportunityDemand.submit';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import LightningConfirm from 'lightning/confirm';
export default class LexSiSubmit extends LightningElement {
    @api recordId;
@@ -28,14 +31,25 @@
     }
     connectedCallback(){
        Promise.all([
          loadStyle(this, lwcCSS)
        ]);
        this.IsLoading = false;
        // this.submit();
        init({recordId:this.recordId})
        .then(result=>{
            console.log("lexsubmit------>>>",result)
            if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
              return;
            }
            // if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
            //   return;
            // }
            // this.handleConfirmClick();
            LightningConfirm.open({
              message: "一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?",
              variant: 'headerless',
              label: '提示信息',
              // setting theme would have no effect
          }).then(res=>{
            if(!res) return;
            if (result.checkTf !=true ) {
              this.showToast('请营业担当提交审批','error')
              return;
@@ -62,6 +76,7 @@
            .finally(()=>{
              window.location.reload();
            })
          })
        })
        .catch(e=>{console.log(e)})
        .finally(()=>{
@@ -71,12 +86,22 @@
     showToast(msg,type) {
      const event = new ShowToastEvent({
          title: '',
          message: msg,
          variant: type
      });
      this.dispatchEvent(event);
      if(type == "success"){
        const event = new ShowToastEvent({
            // title: '',
            message: msg,
            variant: type
        });
        this.dispatchEvent(event);
      }else{
        const event = new ShowToastEvent({
            // title: '',
            message: msg,
            variant: type,
            mode:'sticky'
        });
        this.dispatchEvent(event);
      }
      this.dispatchEvent(new CloseActionScreenEvent());
    }