binxie
2023-06-26 dd004276162a2bf9d042ff0aaa569dc30a95d827
force-app/main/default/lwc/customShipmentNumberComp/customShipmentNumberComp.js
@@ -11,8 +11,8 @@
    }
    shipmentNumberBlur(event) {
        debugger
        console.log('shipmentNumberBlur')
        debugger;
        console.log('shipmentNumberBlur');
        this.shipmentNumber = event.target.value;
        if (this.isConinvoice) {
            if (this.hasDecimals(this.shipmentNumber)) {
@@ -20,7 +20,11 @@
                this.shipmentNumber = 0;
            }else{
                if(this.esdInvoiceProNotCount < this.shipmentNumber){
                    this.showMyToast('错误', '发票数量不能超过还没发票数量!', 'Error');
                    this.showMyToast(
                        '错误',
                        '发票数量不能超过还没发票数量!',
                        'Error'
                    );
                    this.shipmentNumber = 0;
                }
            }
@@ -28,18 +32,23 @@
            //向下取整
            if (this.hasDecimals(this.shipmentNumber)) {
                this.showMyToast('错误', '请输入整数', 'Error');
                this.shipmentNumber = Math.floor(this.shipmentNumber)
                this.shipmentNumber = Math.floor(this.shipmentNumber);
            }
        }
        event.target.value = this.shipmentNumber;
        this.dispatchEvent(new CustomEvent('shipmentnumber', {
        this.dispatchEvent(
            new CustomEvent('shipmentnumber', {
            composed: true,
            bubbles: true,
            cancelable: true,
            detail: {
                data: { shipmentnumber: this.shipmentNumber, recordId: this.recordId }
                    data: {
                        shipmentnumber: this.shipmentNumber,
                        recordId: this.recordId
            }
        }));
                }
            })
        );
    }
    hasDecimals(num) {
@@ -61,10 +70,17 @@
            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);
    }
}