var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, userInfo: { "loginGuid": '', "loginAccount": '', }, splitNum: "", num: "", type: "", billNo: "", selectType: "", daa001: "", barcode: "", ItemBlDetail:[], modeInfo: [], active: 0, show: false, actions: [], ItemDetail: [], } }, mounted() { var that = this; this.userInfo = { loginGuid: this.GetLoginInfor().loginGuid, loginAccount: this.GetLoginInfor().loginAccount, }; this.type = this.Request("type"); selectType = this.type == "bl" ? selectType = "生产补料" : selectType = "生产超领"; }, methods: { getInfo() { this.show = true; var that = this; that.isLoading = true; that.AxiosHttp("post", 'MesItemBl/GetSCBLBillNo', { type: selectType, }, false) .then(function (res) { var json = res; if (json.status == 0) { if (json.data.tbBillList.length <= 0) { that.$toast.fail("没有可用的数据"); } else { that.actions = json.data.tbBillList.map(item => { return { name: item } }); } } else { that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); console.log(error); }); }, onSelect(item) { // 默认情况下点击选项时不会自动收起 // 可以通过 close-on-click-action 属性开启自动收起 this.show = false; this.billNo = item.name; this.GetMesItemBlDetailByBillNo(); //this.$toast(item.name); }, GetMesItemBlDetailByBillNo() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'MesItemBl/GetMesItemWWBlDetailByBillNo', { billNo: that.billNo, type: selectType }, false) .then(function (res) { var json = res; if (json.status == 0) { that.ItemDetail = json.data.tbBillList; that.daa001 = json.data.tbBillList.daa001; that.$refs.barcode.focus(); } else { that.$toast.fail(json.message); that.$refs.billNo.focus(); that.billNo = ""; that.daa001 = ""; that.ItemBlDetail = []; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); //console.log(error); tthat.$refs.billNo.focus(); that.billNo = ""; that.daa001 = ""; that.ItemBlDetail = []; }); }, getBarcode() { // 添加防抖判断 if (this.isLoading) { return; } //this.barcode = value; var that = this; that.isLoading = true; if (!that.userInfo.loginAccount) { this.$toast.fail("请重新检查登录状态"); that.isLoading = false; return; } if (!that.barcode) { this.$toast.fail("条码不能为空"); that.isLoading = false; return; } if (!that.billNo) { this.$toast.fail("补料单号不能为空"); that.isLoading = false; return; } if (!that.daa001) { this.$toast.fail("工单号不能为空"); that.isLoading = false; return; } that.AxiosHttp("post", 'MesItemBl/ScblScanBarcode', { userName: that.userInfo.loginAccount, barcode: that.barcode, blNo: that.billNo, billNo: that.daa001, type: selectType }, false) .then(function (res) { var json = res; if (json.status == 0) { that.barcode = null; that.sms = null; that.num = null; //that.ItemBlDetail = json.data.tbBillList.item2 that.$notify({ type: 'success', message: '扫描成功' }); that.GetMesItemBlDetailByBillNo(); that.$refs.barcode.focus(); that.barcode = ""; that.num = ""; that.splitNum = ""; } else if (json.status == 2) { that.$refs.splitNum.focus(); that.splitNum = json.data.cfNum; that.num = json.data.num; } else { that.$toast.fail(json.message); that.$refs.barcode.focus(); that.barcode = ""; that.num = ""; that.splitNum = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); //console.log(error); that.$refs.barcode.focus(); that.barcode = ""; that.num = ""; that.splitNum = ""; }); }, tmcf() { //this.show = true; var that = this; that.isLoading = true; if (!that.userInfo.loginAccount) { this.$toast.fail("请重新检查登录状态"); that.isLoading = false; return; } if (!that.barcode) { this.$toast.fail("条码不能为空"); that.isLoading = false; return; } if (!that.billNo) { this.$toast.fail("补料单号不能为空"); that.isLoading = false; return; } if (!that.daa001) { this.$toast.fail("工单号不能为空"); that.isLoading = false; return; } if (!that.splitNum) { this.$toast.fail("发货数量不能为空"); that.isLoading = false; return; } that.AxiosHttp("post", 'MesItemBl/SplitBarcode', { userName: that.userInfo.loginAccount, barcode: that.barcode, blNo: that.billNo, billNo: that.daa001, num: that.splitNum, type: selectType }, false) .then(function (res) { var json = res; if (json.status == 0) { that.ItemBlDetail = json.data.pendingList; that.$notify({ type: 'success', message: '扫描成功' }); that.$refs.barcode.focus(); that.barcode = ""; that.num = ""; that.splitNum = ""; that.GetMesItemBlDetailByBillNo(); } else { that.$toast.fail(json.message); that.$refs.barcode.focus(); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); //console.log(error); that.$refs.barcode.focus(); that.barcode = ""; that.num = ""; that.splitNum = ""; }); } } })