buli
2023-06-05 0f44cb1a0b7b36860e9ce81c1eac9e395d87f0b4
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
@@ -3,6 +3,10 @@
import { NavigationMixin } from 'lightning/navigation';
import initPage from '@salesforce/apex/LexConsumableOrderManageController.init1';
import searchConsumableorderdetails from '@salesforce/apex/LexConsumableOrderManageController.searchConsumableorderdetails';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexConsumableOrderManage extends NavigationMixin(LightningElement) {
    @track category1;
@@ -20,11 +24,15 @@
    @track cols = [];
    @track showSpinner = false;
    @track showPage = false;
    stylesLoaded = false;
    //是否一直显示提示
    @track isNoteStay = true;
    connectedCallback(){
        this.showSpinner = true;
        initPage()
            .then(result=>{
                this.isNoteStay = result.isNoteStay;
                if(result.result == 'Success'){
                    this.provinceOpts = result.provinceOpts;
                    this.title = result.title;
@@ -62,6 +70,19 @@
                this.showSpinner = false;
                console.log("Error:"+error);
            })
    }
    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");
                });
        }
    }
    category1Change(event){
@@ -167,12 +188,34 @@
            })
    }
    showMyToast(title,message,variant){
        const evt = new ShowToastEvent({
           title : title,
           message: message,
           variant: variant
        });
        this.dispatchEvent(evt);
    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);
        // 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);
     }
}