binxie
2023-06-26 b5c5eb130ca0848124f9d136af4be142ad5aac07
force-app/main/default/lwc/lexConsumableOrderManage/lexConsumableOrderManage.js
@@ -4,12 +4,11 @@
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';
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexConsumableOrderManage extends NavigationMixin(
    LightningElement
) {
export default class LexConsumableOrderManage extends NavigationMixin(LightningElement) {
    @track category1;
    @track orderDate;
    @track orderStatus = '';
@@ -32,7 +31,7 @@
    connectedCallback() {
        this.showSpinner = true;
        initPage()
            .then((result) => {
            .then(result=>{
                this.isNoteStay = result.isNoteStay;
                if (result.result == 'Success') {
                    this.provinceOpts = result.provinceOpts;
@@ -49,20 +48,16 @@
                    }
                    for (var i in this.raesList) {
                        if (this.raesList[i].Order_ForHospital__c) {
                            this.raesList[i]['hosUrl'] =
                                '/s/detail/' +
                                this.raesList[i].Order_ForHospital__c;
                            this.raesList[i]['hosName'] =
                                this.raesList[i].Order_ForHospital__r.Name;
                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
                        }
                        this.raesList[i]['nameUrl'] =
                            '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                    }
                    this.showSpinner = false;
                    this.showPage = true;
                } else {
                    this.showSpinner = false;
                    console.log('Error:' + result.errorMsg);
                    console.log("Error:"+result.errorMsg);
                    const evt = new ShowToastEvent({
                        title: '初始化页面失败',
                        message: result.errorMsg,
@@ -71,21 +66,21 @@
                    this.dispatchEvent(evt);
                }
            })
            .catch((error) => {
            .catch(error=>{
                this.showSpinner = false;
                console.log('Error:' + error);
            });
                console.log("Error:"+error);
            })
    }
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log('Custom styles loaded');
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error('Error loading custom styles');
                    console.error("Error loading custom styles");
                });
        }
    }
@@ -137,33 +132,23 @@
    searchProduct(event) {
        this.showSpinner = true;
        searchConsumableorderdetails({
            categoryStr: this.category1,
            orderDate: this.orderDate,
            orderStatus: this.orderStatus,
            accountidStr: this.accountid,
            agencyProTypeStr: this.agencyProType,
            userWorkLocationStr: this.userWorkLocation
        }).then((result) => {
        searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
            .then(result=>{
            if (result.result == 'Success') {
                this.raesList = result.raesList;
                for (var i in this.raesList) {
                    if (this.raesList[i].Order_ForHospital__c) {
                        this.raesList[i]['hosUrl'] =
                            '/s/detail/' +
                            this.raesList[i].Order_ForHospital__c;
                        this.raesList[i]['hosName'] =
                            this.raesList[i].Order_ForHospital__r.Name;
                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
                    }
                    this.raesList[i]['nameUrl'] =
                        '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                }
                this.showSpinner = false;
                this.showMyToast('搜索成功', result.errorMsg, 'success');
            } else {
                this.showSpinner = false;
                this.raesList = result.raesList;
                console.log('Error:' + result.errorMsg);
                    console.log("Error:"+result.errorMsg);
                if (result.errorMsg == '没有搜索到相关订单') {
                    this.showMyToast(result.errorMsg, '', 'error');
                } else {
@@ -171,38 +156,28 @@
                }
                this.dispatchEvent(evt);
            }
        });
            })
    }
    clear(event) {
        this.category1 = '';
        this.orderDate = null;
        this.orderStatus = '';
        searchConsumableorderdetails({
            categoryStr: this.category1,
            orderDate: this.orderDate,
            orderStatus: this.orderStatus,
            accountidStr: this.accountid,
            agencyProTypeStr: this.agencyProType,
            userWorkLocationStr: this.userWorkLocation
        }).then((result) => {
        searchConsumableorderdetails({categoryStr:this.category1,orderDate:this.orderDate,orderStatus:this.orderStatus,accountidStr:this.accountid,agencyProTypeStr:this.agencyProType,userWorkLocationStr:this.userWorkLocation})
            .then(result=>{
            if (result.result == 'Success') {
                this.raesList = result.raesList;
                for (var i in this.raesList) {
                    if (this.raesList[i].Order_ForHospital__c) {
                        this.raesList[i]['hosUrl'] =
                            '/s/detail/' +
                            this.raesList[i].Order_ForHospital__c;
                        this.raesList[i]['hosName'] =
                            this.raesList[i].Order_ForHospital__r.Name;
                            this.raesList[i]['hosUrl'] = '/s/detail/'+this.raesList[i].Order_ForHospital__c;
                            this.raesList[i]['hosName'] = this.raesList[i].Order_ForHospital__r.Name;
                    }
                    this.raesList[i]['nameUrl'] =
                        '/s/lexconsumable?ESetid=' + this.raesList[i].Id;
                        this.raesList[i]['nameUrl'] = '/s/lexconsumable?ESetid='+this.raesList[i].Id;
                }
                this.showMyToast('搜索成功', result.errorMsg, 'success');
            } else {
                this.raesList = result.raesList;
                console.log('Error:' + result.errorMsg);
                    console.log("Error:"+result.errorMsg);
                if (result.errorMsg == '没有搜索到相关订单') {
                    this.showMyToast(result.errorMsg, '', 'error');
                } else {
@@ -210,7 +185,7 @@
                }
                this.dispatchEvent(evt);
            }
        });
            })
    }
    showMyToast(title, message, variant) {
@@ -223,18 +198,12 @@
            iconName = 'utility:error';
        }
        if (message != '') {
            content =
                '<h2><strong>' +
                title +
                '<strong/></h2><h5>' +
                message +
                '</h5>';
           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);
        this.template.querySelector('c-common-toast').
        showToast(variant,content,iconName,10000);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';