buli
2023-05-23 19f3491cd91e0c863eb13f0c6c69aca5634ed1d9
force-app/main/default/lwc/lexCancelRemoveBox/lexCancelRemoveBox.js
@@ -4,10 +4,9 @@
import searchDeatail from "@salesforce/apex/LexCancelRemoveBoxController.searchConsumableorderdetails" 
import saveConfirm from '@salesforce/apex/LexCancelRemoveBoxController.cancelRemoveBoxConfirm';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
const columns = [
    {
      label: '消耗品名称',
@@ -21,21 +20,22 @@
      label: '规格',
      fieldName: 'ProductPacking_list_manual__c',
      hideDefaultActions: true,
      // initialWidth: 250,
      cellAttributes: { alignment: "right" },
      initialWidth: 50,
  
    },
    {
      label: 'CFDA状态',
      fieldName: 'CFDA_Status__c',
      hideDefaultActions: true,
      // initialWidth: 250,
      initialWidth: 200,
  
    },
    {
      label: '注册证编码号',
      fieldName: 'Report_Product_Approbation__c',
      hideDefaultActions: true,
      // initialWidth: 250,
      initialWidth: 200,
    },
    {
      label: '注册证效期',
@@ -92,6 +92,20 @@
    @track saveFLGbln = false
    @track dataSize = 0;
    renderedCallback() {
      if (!this.stylesLoaded) {
          Promise.all([loadStyle(this, WrappedHeaderTable)])
              .then(() => {
                  console.log("Custom styles loaded");
                  this.stylesLoaded = true;
              })
              .catch((error) => {
                  console.error("Error loading custom styles");
              });
      }
  }
    connectedCallback() {
@@ -108,13 +122,7 @@
          // this.data = JSON.parse(result.entity.codPageRecords);
          // this.showTable = true;
        } else {
          console.log('result.msg = ' + result.msg);
          const evt = new ShowToastEvent({
            title: '录入失败',
            message: result.msg,
            variant: 'error'
          });
          this.dispatchEvent(evt);
          this.showMyToast('初始化失败',result.msg,'error');
        }
      }).catch((error) => {
        console.log('error = ' + JSON.stringify(error));
@@ -154,13 +162,7 @@
        // this.showTables = true;
        this.showSpinner = false;
      } else{
        console.log('result.msg = ' + result.msg);
        const evt = new ShowToastEvent({
          title: '获取失败',
          message: result.msg,
          variant: 'error'
        });
        this.dispatchEvent(evt);
        this.showMyToast('获取失败',result.msg,'error');
        this.showSpinner = false;
      }
    }).catch((error) => {
@@ -201,24 +203,13 @@
         this.saveFLGbln = result.entity.saveFLGbln;
        //  this.showSpinner = false;
         if(this.saveFLGbln){
          const evt = new ShowToastEvent({
            title: '成功',
            message: result.msg,
            variant: 'Success'
          });
          this.dispatchEvent(evt);
          this.showMyToast(result.msg,'','success');
          this.showSpinner = false;
         }
      } else {
        console.log('result.msg = ' + result.msg);
        const evt = new ShowToastEvent({
          title: '失败',
          message: result.msg,
          variant: 'error'
        });
        this.dispatchEvent(evt);
        this.showMyToast('取消拆盒失败',result.msg,'error');
        this.showSpinner = false;
      }
    })
@@ -227,6 +218,22 @@
      });
  }
  showMyToast(title, message, variant) {
    console.log('show custom message');
    var iconName = '';
    var content = '';
    if(variant == 'success'){
       iconName = 'utility:check';
    }else{
       iconName = 'utility:error';
    }
    if(message != ''){
       content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
    }else{
       content = '<h2><strong>'+title+'<strong/></h2>';
    }
    this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
   }