buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/lwc/lexArriveGsDetails/lexArriveGsDetails.js
@@ -4,6 +4,10 @@
import { NavigationMixin } from 'lightning/navigation';
import init from '@salesforce/apex/LexArriveGsDetailsController.init';
import proSale from '@salesforce/apex/LexArriveGsDetailsController.proSale';
import helpText from '@salesforce/label/c.LexArrivegsDetailsPageHelpText';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexArriveGsDetails extends NavigationMixin(LightningElement) {
@@ -16,16 +20,20 @@
    @track arrivetoorder = false;
    @track coc;
    @track consumableorderdetailsRecords = [];
    stylesLoaded = false;
    //是否一直显示提示
    @track isNoteStay = true;
    @track colms = [
        {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,initialWidth:200},
        {label:'规格' , fieldName:'packing_list', hideDefaultActions: true},
        {label:'CFDA状态' , fieldName:'statusCFDA', hideDefaultActions: true},
        {label:'注册证编码号' , fieldName:'approbation_No', hideDefaultActions: true},
        {label:'注册证效期' , fieldName:'expiration_DateStr', hideDefaultActions: true},
        {label:'使用期限' , fieldName:'Sterilization_limitStr', hideDefaultActions: true},
        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:200},
        {label:'采购单价' , fieldName:'intraTradeList', hideDefaultActions: true}
        {label:'消耗品名称' , fieldName:'prodName', hideDefaultActions: true,wrapText:true},
        {label:'规格' , fieldName:'packing_list', hideDefaultActions: true,wrapText:true,initialWidth:50,cellAttributes: { alignment: "right" }},
        {label:'CFDA状态' , fieldName:'statusCFDA', hideDefaultActions: true,wrapText:true,initialWidth:100},
        {label:'注册证编码号' , fieldName:'approbation_No', hideDefaultActions: true,wrapText:true,initialWidth:125},
        {label:'注册证效期' , fieldName:'expiration_DateStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
        {label:'使用期限' , fieldName:'Sterilization_limitStr', hideDefaultActions: true,wrapText:true,initialWidth:115},
        {label:'BarCode' , fieldName:'barCode', hideDefaultActions: true,initialWidth:250},
        {label:'采购单价' ,type:'number',fieldName:'intraTradeList', hideDefaultActions: true,wrapText:true,initialWidth:120,typeAttributes:{minimumFractionDigits: 2},cellAttributes: { alignment: "right" }}
    ];
    label = {helpText};
    // 获取参数
    @wire(CurrentPageReference)
@@ -36,11 +44,25 @@
        console.log('CurrentPageReference:'+this.eSetId);
    }
    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(){
        init({eSetIdStr : this.eSetId})
        .then(result=>{
            this.showPage = true;
            this.isNoteStay = result.isNoteStay;
            if(result.result == 'Success'){
                this.coc = result.coc;
                if(this.coc.Arrive_Order__c != null && this.coc.Arrive_Order__c != ''){
@@ -61,6 +83,7 @@
                        // this.consumableorderdetailsRecords[i]['prodName'] = this.consumableorderdetailsRecords[i].prodName;
                        this.consumableorderdetailsRecords[i]['barCode'] = this.consumableorderdetailsRecords[i].esd.Bar_Code__c;
                        this.consumableorderdetailsRecords[i]['intraTradeList'] = this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c;
                        console.log("Intra_Trade_List_RMB__c:"+this.consumableorderdetailsRecords[i].esd.Intra_Trade_List_RMB__c);
                    }
                    if(this.consumableorderdetailsRecords[i].Prod != null){
                        this.consumableorderdetailsRecords[i]['statusCFDA'] = this.consumableorderdetailsRecords[i].Prod.SFDA_Status__c;
@@ -113,11 +136,33 @@
    }
    showMyToast(title,message,variant){
        const evt = new ShowToastEvent({
           title : title,
           message: message,
           variant: variant
        });
        this.dispatchEvent(evt);
        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);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
        // }else{
        //     mode = 'dismissable';
        // }
        // const evt = new ShowToastEvent({
        //     title: title,
        //     message: message,
        //     variant: variant,
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
    }
}