binxie
2023-06-16 da42e2995c00293af89c71fe5ba6e16cbb77e1b3
force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
@@ -3,7 +3,7 @@
import save from "@salesforce/apex/LexUpAccountProLimit.upAccount";
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from "lightning/navigation";
export default class InventoryEditingLWC extends  NavigationMixin(LightningElement){
export default class LexProductLimitEdit extends NavigationMixin(LightningElement) {
    @track invRecords = [];
    @track accountid;
    @track upstring = '';
@@ -89,24 +89,22 @@
        console.log('保存');
        console.log('this.invRecords'+JSON.stringify(this.invRecords));
        for(var i in this.invRecords){
            console.log('inven'+this.invRecords[i]["inventory1"]);
            console.log('数字'+this.isNum(this.invRecords[i]["inventory1"]));
            if(this.isNum(this.invRecords[i]["inventory1"]) == false || this.isNum(this.invRecords[i]["inventory2"]==false)){
                // alert("输入格式不正确,请输入数字!");
            console.log('inven1' + this.invRecords[i]["inventory1"]);
            console.log('数字1' + this.isNum(this.invRecords[i]["inventory1"]));
            console.log('inven2' + this.invRecords[i]["inventory2"]);
            console.log('数字2' + this.isNum(this.invRecords[i]["inventory2"]));
            if (this.invRecords[i]["inventory1"] == '' || this.invRecords[i]["inventory1"] == null || this.invRecords[i]["inventory2"] == null || this.invRecords[i]["inventory2"] == '') {
                this.showMyToast('保存失败','输入格式不正确,请输入数字','error');
                this.showSpinner = false;
                return;
            }
            if(this.invRecords[i]["inventory1"] == ''||this.invRecords[i]["inventory1"] == null ||this.invRecords[i]["inventory2"] == null ||
            this.invRecords[i]["inventory2"] == ''){
                // alert('请输入' +this.invRecords[i]["productNumber"] + '库存上下限信息!');
                this.showMyToast('保存失败','请输入' +this.invRecords[i]["productNumber"] + '库存上下限信息','error');
            if( this.isNum(this.invRecords[i]["inventory1"]) == false || this.isNum(this.invRecords[i]["inventory2"]) == false){
                this.showMyToast('保存失败', '输入格式不正确,请输入数字', 'error');
                this.showSpinner = false;
                return;
            }
            if(Number(this.invRecords[i]["inventory1"])>Number(this.invRecords[i]["inventory2"])){
                // alert( this.invRecords[i]["productNumber"]  + '库存下限大于上限!');
                this.showMyToast('保存失败',this.invRecords[i]["productNumber"]  + '库存下限大于上限','error');
                this.showSpinner = false;
                return;
@@ -155,9 +153,11 @@
        }
        else if (event.target.name == 'inventory1') {
            this.invRecords[event.currentTarget.dataset.index].inventory1 = event.target.value;
            console.log('===>invrecords' + JSON.stringify(this.invRecords));
        }
        else if (event.target.name == 'inventory2') {
            this.invRecords[event.currentTarget.dataset.index].inventory2 = event.target.value;
            console.log('===>invrecords' + JSON.stringify(this.invRecords));
        }
    }