var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, load: false, userInfo: { "loginGuid": '', "loginAccount": '', "loginOrgid":'', }, billNo: "", dckw: "", // 调出库位 drkw: "", // 调入库位 remark: "", // 备注 barcode: "", ItemBlDetail: [], modeInfo: [], active: 0, show: false, actions: [], ItemDetail: { items: [] // 确保有这个结构 }, scanInfo: { barcodeNum: "", splitNum: "", barcode: "", }, dbNum: "", // 调拨数量 kcNum: "", // 即时库存 printItemInfo: [], itemId:"", itemNo: "", // 物料编码 item_name: "", // 物料名称 item_model: "" // 物料规格 } }, mounted() { var that = this; this.userInfo = { loginGuid: this.GetLoginInfor().loginGuid, loginAccount: this.GetLoginInfor().loginAccount, }; }, methods: { getInfo() { this.show = true; var that = this; that.isLoading = true; that.AxiosHttp("post", 'Zzxdb/GetItemNoList', { //name: that.userInfo.loginAccount, itemNo: that.itemNo }, false) .then(function (res) { var json = res; if (json.status == 0) { if (json.data.tbBillList.length == 0) { that.$toast.fail("没有找到可以选择的物料编号"); } that.actions = json.data.tbBillList.map(item => { return { name: item.item_no, itemId : item.item_id } }); } else { that.$toast.fail(json.message); } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); 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.itemNo = item.name; this.itemId = item.itemId; console.log("物料id", this.itemId) this.itemNo = item.name.split('/')[0]; this.GetMesItemByItemNo(); //this.$toast(item.name); }, GetMesItemBlDetailByBillNo() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Zzxdb/GetKwByBillNo', { billNo: that.billNo }, false) .then(function (res) { var json = res; if (json.status == 0) { if (json.data.tbBillList.xcslItemList[0].rnum == 2) { that.drkw = 'Z2'; that.dckw = 'A14-3-33'; that.billNo = json.data.tbBillList.xcslItemList[0].billno; } else { that.drkw = 'A14-3-33'; that.dckw = 'Z2'; that.billNo = json.data.tbBillList.xcslItemList[0].billno; } } else { that.$toast.fail(json.message); that.billNo = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$refs.billNo.focus(); that.billNo = ""; that.ItemBlDetail = null; //console.log(error); }); }, GetMesItemByItemNo() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Zzxdb/GetMesItemByItemNo', { itemNo: that.itemNo, userName: that.userInfo.loginAccount, dckw: that.dckw, }, false) .then(function (res) { var json = res; if (json.status == 0) { that.itemNo = json.data.tbBillList.xcslItemList[0].item_no; that.item_model = json.data.tbBillList.xcslItemList[0].item_model; that.item_name = json.data.tbBillList.xcslItemList[0].item_name; that.kcNum = json.data.tbBillList.xcslItemList[0].kcnum; that.ItemDetail.items = json.data.tbBillList.itemDetail } else { that.$toast.fail(json.message); that.itemNo = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$refs.billNo.focus(); that.billNo = ""; that.ItemBlDetail = null; //console.log(error); }); }, saveDbsq() { var that = this; that.isLoading = true; const dbNum = Number(that.dbNum); const kcNum = Number(that.kcNum); if (dbNum <= 0) { that.$toast.fail("调拨数量不能为0"); that.isLoading = false; return; } if (dbNum > kcNum) { that.$toast.fail("调拨数量不能大于即时库存"); that.isLoading = false; return; } that.AxiosHttp("post", 'Zzxdb/saveDbsq', { id: that.itemId, dbNum: that.dbNum, userName: that.userInfo.loginAccount, remark: that.remark, drkw: that.drkw, dckw: that.dckw, }, false) .then(function (res) { var json = res; if (json.status == 0) { that.GetMesItemByItemNo(); } else { that.$toast.fail(json.message); that.itemNo = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); that.$refs.billNo.focus(); that.billNo = ""; that.ItemBlDetail = null; //console.log(error); }); }, deleteDbsqMx(mxid) { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Zzxdb/deleteDbsqMx', { id: mxid, userName: that.userInfo.loginAccount, }, false) .then(function (res) { var json = res; if (json.status == 0) { that.GetMesItemByItemNo(); } else { that.$toast.fail(json.message); that.itemNo = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); //console.log(error); }); }, submitDbBillNo() { var that = this; that.isLoading = true; that.AxiosHttp("post", 'Zzxdb/submit', { id: that.ItemDetail.items[0].pid, userName: that.userInfo.loginAccount, }, false) .then(function (res) { var json = res; if (json.status == 0) { that.GetMesItemByItemNo(); } else { that.$toast.fail(json.message); that.itemNo = ""; } that.isLoading = false; }) .catch(function (error) { that.isLoading = false; that.$toast.fail("网络错误,请重试!"); //console.log(error); }); } } })