var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, userInfo: { "loginGuid": '', "loginAccount": '', }, itemNo: "", num: "", fnm:"", billNo: "", barcode:"", ItemBlDetail:[], modeInfo: [], active: 0, show: false, actions: [], ItemDetail: [], splitNum: "", zdy: "", ItemTblDetail: [], ItemBarKw: [], currentIndex: -1, } }, mounted() { var that = this; this.userInfo = { loginGuid: this.GetLoginInfor().loginGuid, loginAccount: this.GetLoginInfor().loginAccount, }; }, methods: { handleRowClick(item, index) { if (this.isLoading) { return; } // 重置所有行的选中状态 this.currentIndex = -1; // 设置当前选中行 this.currentIndex = index; this.selItem = { itemid: item.itemId, index: index }; console.log('当前选中项:', this.selItem); // 调试用 this.GetBarKwByItem(); }, GetBarKwByItem() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Womdaa/GetBarKwByItem', { itemId: that.selItem.itemid, userName: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; if (json.status == 0) { that.ItemBarKw = json.data.tbBillList; } else { that.$toast.fail(json.message); that.$playSound('error'); that.ItemBarKw = []; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); console.log(error); that.ItemBarKw = []; }); }, getInfo() { this.show = true; var that = this; that.isLoading = true; that.AxiosHttp("post", 'MesItemQt/GetPendingQtList', { //name: that.userInfo.loginAccount, }, false) .then(function (res) { var json = res; if (json.status == 0) { if (json.data.tbBillList.length <= 0) { that.$toast.fail("没有可用的数据"); that.$playSound('error'); } else { that.actions = json.data.tbBillList.map(item => { return { name: item } }); } } else { that.$toast.fail(json.message); that.$playSound('error'); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); console.log(error); }); }, onClick(index, title) { this.$toast(`${index} ${title}`); //this.$notify({ type: 'success', message: '某某物料扫码成功某某物料扫码成功某某物料扫码成功某某物料扫码成功' }); }, 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", 'MesItemQt/GetPendingQtDetailList', { billNo: that.billNo, userName: that.userInfo.loginAccount }, false) .then(function (res) { var json = res; if (json.status == 0) { that.ItemDetail = json.data.tbBillList; that.zdy = json.data.tbBillList.allList[0].createNmae; //that.ItemBlDetail = json.data.tbBillList; that.$refs.barcode.focus(); that.barcode = ""; } else { that.$toast.fail(json.message); that.$playSound('error'); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); console.log(error); }); }, getBarcode() { if (this.isLoading) { return; } //this.barcode = value; var that = this; that.isLoading = true; if (!that.userInfo.loginAccount) { this.$toast.fail("请重新检查登录状态"); that.$playSound('error'); that.isLoading = false; return; } if (!that.barcode) { this.$toast.fail("条码不能为空"); that.$playSound('error'); that.isLoading = false; return; } if (!that.billNo) { this.$toast.fail("申请单号不能为空"); that.$playSound('error'); that.isLoading = false; return; } that.AxiosHttp("post", 'MesItemQt/OutScanBarcode', { userName: that.userInfo.loginAccount, barcode: that.barcode, billNo: that.billNo }, false) .then(function (res) { var json = res; if (json.status == 0) { that.num = json.data.tbBillList.barcodeNum; that.GetMesItemBlDetailByBillNo(); that.$refs.barcode.focus(); that.barcode = null; that.$playSound('success'); that.$notify({ type: 'success', message: json.message }); } else if (json.status == 2) { that.$refs.splitNum.focus(); that.splitNum = json.data.tbBillList.splitNum; that.num = json.data.tbBillList.barcodeNum; } else { that.$playSound('error'); that.$toast.fail(json.message); that.$refs.barcode.focus(); that.barcode = null; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); console.log(error); }); }, tmcf() { if (this.isLoading) { return; } var that = this; that.isLoading = true; if (!that.userInfo.loginAccount) { this.$toast.fail("请重新检查登录状态"); that.$playSound('error'); that.isLoading = false; return; } if (!that.barcode) { this.$toast.fail("条码不能为空"); that.$playSound('error'); that.isLoading = false; return; } if (!that.billNo) { this.$toast.fail("申请单号不能为空"); that.$playSound('error'); that.isLoading = false; return; } if (!that.fnm) { this.$toast.fail("发料数量不能为空"); that.$playSound('error'); that.isLoading = false; return; } if (that.fnm <= 0) { this.$toast.fail("发料数量不能小于等于零"); that.$playSound('error'); that.isLoading = false; return; } that.AxiosHttp("post", 'MesItemQt/OutScanBarcode', { userName: that.userInfo.loginAccount, barcode: that.barcode, fum: that.fnm, }, false) .then(function (res) { var json = res; if (json.status == 0) { that.itemNo = json.data.form.itemNo; that.num = json.data.form.num; that.fum = json.data.form.fum; that.barcode = json.data.form.barcode; that.ItemBlDetail = json.data.item that.$notify({ type: 'success', message: json.data.message }); that.$playSound('success'); } else { that.$toast.fail(json.message); that.$playSound('error'); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); console.log(error); }); }, getChaiFen() { //this.isPrinterPopupVisible = true; // 显示弹窗 if (this.isLoading) { return; } var that = this; if (!that.userInfo.loginAccount) { this.$toast.fail("请重新检查登录状态"); that.$playSound('error'); that.isLoading = false; return; } if (!that.barcode) { this.$toast.fail("条码不能为空"); that.$playSound('error'); that.isLoading = false; return; } if (!that.billNo) { this.$toast.fail("申请单号不能为空"); that.$playSound('error'); that.isLoading = false; return; } //that.ip = ""; //that.prot = ""; //that.getPrintInfo(); //if (that.ip.length <= 0 || that.prot.length <= 0) { // alert(that.ip); // alert(that.prot); // return; //} that.isLoading = true; that.AxiosHttp("post", 'MesItemQt/ScanCodeCF', { userName: that.userInfo.loginAccount, barcode: that.barcode, billNo: that.billNo, Num: that.splitNum, }, false) .then(function (res) { var json = res; if (json.status == 0) { // that.modeInfo = json.data.tbBillList; that.splitNum = null; that.num = null; that.barcode = null; that.$notify({ type: 'success', message: json.message }); that.$playSound('success'); that.GetMesItemBlDetailByBillNo(); //that.sendMessage(json.data.tbBillList); that.sendPrintMessage(json.data.tbBillList); that.$refs.barcode.focus(); } else { that.$playSound('error'); that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$playSound('error'); }); }, } })