diff --git a/src/pages.json b/src/pages.json index 4e380bd..a89554a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -34,7 +34,7 @@ },{ "path": "pages/outLocation/index", "style": { - "navigationStyle": "custom", + "navigationBarTitleText": "领用出库", "navigationBarBackgroundColor": "#409eff", "navigationBarTextStyle": "white" } diff --git a/src/pages/inLocation/addForm.vue b/src/pages/inLocation/addForm.vue index f7122d0..97ac60f 100644 --- a/src/pages/inLocation/addForm.vue +++ b/src/pages/inLocation/addForm.vue @@ -2,10 +2,10 @@ - + - + @@ -87,7 +87,7 @@ - + 扫描 @@ -99,7 +99,7 @@ - + 扫描 @@ -113,7 +113,7 @@ - + @@ -154,7 +154,8 @@ qty: '' }, isShow: false, - isInAccount: 'FALSE' + locationList: [], //备件的库位列表 + locationItem: '', //备件账内库 } }, methods: { @@ -206,7 +207,7 @@ async getInLocationDetail() { await inLocationApi.getInLocationDetail(this.form.id).then(res => { this.orderList = res.data - }) + }).catch((err) => {}) }, // 打开弹窗 open() { @@ -219,7 +220,7 @@ qty: '' } this.isPopupShow = true - this.isShow= false + this.isShow = false }, // 添加备件 addSpare() { @@ -236,7 +237,7 @@ this.$modal.showToast('请选择库位') return; } - if (this.isInAccount == 'FALSE') { + if (!this.locationItem || this.locationItem.isInAccount === 'FALSE') { this.$modal.showToast('该库位属于帐外库,请选择帐内库') return; } @@ -259,8 +260,8 @@ this.$modal.showToast('该备件已添加') return; } - let arr1 = orderList.filter(item => item.itemNumber == this.form1.itemNumber) - if (!arr1|| (arr1&&arr1.length == 0)) { + let arr1 = this.orderList.filter(item => item.itemNumber == this.form1.itemNumber) + if (!arr1 || (arr1 && arr1.length == 0)) { this.$modal.showToast('订单信息没有该备件') return; } @@ -275,14 +276,26 @@ }, getLocation() { locationApi.getLocation(this.form1.locationNumber).then(res => { - if(!res.data){ + if (!res.data) { this.$modal.showToast('找不到该库位') return; } - this.form1.areaNumber = res.data.areaNumber; - this.isInAccount = res.data.isInAccount || '' + this.locationItem = res.data + this.form1.areaNumber = this.locationItem.areaNumber this.itemNumber = res.data.itemNumber || '' - }) + // 判断该库位在之前添加的列表里有没有被绑定过 + if (this.form.itemNumbers && this.form.itemNumbers.length > 0) { + let arr = this.form.itemNumbers.filter(item => item.locationNumber == this.form1 + .locationNumber) + if (arr && arr.length > 0) { + this.itemNumber = 1 + } else { + this.itemNumber = res.data.itemNumber || '' + } + } else { + this.itemNumber = res.data.itemNumber || '' + } + }).catch((err) => {}) }, blur() { if (this.form1.locationNumber) { @@ -295,25 +308,37 @@ number: this.form1.itemNumber, id: this.form.id }).then(res => { - if(!res.data){ + if (!res.data) { this.$modal.showToast('找不到该备件') this.itemNumber = '' this.form1.areaNumber = '' - this.form1.locationNumber = ''; - this.isInAccount = '' + this.form1.locationNumber = ''; this.form1.itemName = '' return; } this.itemNumber = '' - this.form1.areaNumber = res.data.areaNumber || '' - this.form1.locationNumber = res.data.locationNumber; - this.isInAccount = res.data.isInAccount|| '' this.form1.itemName = res.data.itemName this.form1.deliveryQty = res.data.deliveryQty this.form1.applyQty = res.data.applyQty - if (!this.form1.locationNumber) { + // 判断是否有帐内库 + this.locationItem = res.data.list.filter(item => item.isInAccount === 'TRUE')[0] + if (this.locationItem) { + this.form1.areaNumber = this.locationItem.areaNumber + this.form1.locationNumber = this.locationItem.locationNumber + this.isShow = false + } else { + this.form1.areaNumber = '' + this.form1.locationNumber = '' this.isShow = true } + + }).catch((err) => { + this.itemNumber = '' + this.form1.areaNumber = '' + this.form1.itemName = '' + this.form1.applyQty = '' + this.form1.deliveryQty = '' + this.locationList = []; }) }, blur1() { @@ -329,9 +354,9 @@ if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option .data)).id) { let form = JSON.parse(decodeURIComponent(option.data)) - this.form.supplierName =form.supplierName - this.form.number =form.number - this.form.id =form.id + this.form.supplierName = form.supplierName + this.form.number = form.number + this.form.id = form.id } await this.getInLocationDetail() } diff --git a/src/pages/outLocation/addForm.vue b/src/pages/outLocation/addForm.vue index 26d05d6..615a37f 100644 --- a/src/pages/outLocation/addForm.vue +++ b/src/pages/outLocation/addForm.vue @@ -89,14 +89,14 @@ - + 扫描 - + @@ -111,7 +111,7 @@ - + @@ -212,7 +212,7 @@ this.form.approveName = res.data.approveName this.form.applyDeptName = res.data.applyDeptName this.form.subList = res.data.subList - }) + }).catch(() => {}) }, // 打开弹窗 open() { @@ -284,11 +284,19 @@ this.form1.areaNumber = res.data.areaNumber; this.form1.itemName = res.data.itemName; this.form1.itemNumber = res.data.itemNumber; - this.form1.receiveQty = res.data.receiveQty; - this.form1.applyQty = res.data.applyQty; - this.form1.stockQty = res.data.qty; + this.form1.receiveQty = res.data.receiveQty||0; + this.form1.applyQty = res.data.applyQty||0; + this.form1.stockQty = res.data.qty||0; this.isInAccount = res.data.isInAccount || '' // this.itemNumber = res.data.itemNumber || '' + }).catch(() => { + this.form1.areaNumber = ''; + this.form1.itemName = ''; + this.form1.itemNumber = ''; + this.form1.receiveQty = ''; + this.form1.applyQty = ''; + this.form1.stockQty = ''; + this.isInAccount = ''; }) }, blur() { diff --git a/src/pages/outLocation/index.vue b/src/pages/outLocation/index.vue index 4c4bf9f..fb6692a 100644 --- a/src/pages/outLocation/index.vue +++ b/src/pages/outLocation/index.vue @@ -1,9 +1,9 @@