|
|
@ -2,10 +2,10 @@ |
|
|
|
<!-- 添加维修工单 --> |
|
|
|
<view class="add-form-container"> |
|
|
|
<u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
|
<u-form-item label="批次号" prop="number" required> |
|
|
|
<u-form-item label="批次号" prop="number"> |
|
|
|
<u-input v-model="form.number" placeholder="请输入批次号" /> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="供应商" prop="supplierName" required> |
|
|
|
<u-form-item label="供应商" prop="supplierName"> |
|
|
|
<u-input v-model="form.supplierName" placeholder="请输入供应商" /> |
|
|
|
</u-form-item> |
|
|
|
</u-form> |
|
|
@ -87,7 +87,7 @@ |
|
|
|
<u-form :model="form1" ref="form1" label-width="160rpx"> |
|
|
|
<u-form-item :label="`备件编号`" prop="itemNumber" required> |
|
|
|
<view class="select"> |
|
|
|
<u-input v-model="form1.itemNumber" placeholder="请选择备件" disabled /> |
|
|
|
<u-input v-model="form1.itemNumber" placeholder="请选择备件" @blur="blur1()" /> |
|
|
|
<view class="right-button" @click="chickRightButton1"> |
|
|
|
扫描 |
|
|
|
</view> |
|
|
@ -99,7 +99,7 @@ |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="库位" prop="locationNumber" required v-if="isShow"> |
|
|
|
<u-input v-model="form1.locationNumber" placeholder="请选择库位" disabled/> |
|
|
|
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur='blur()' /> |
|
|
|
<view class="right-button" @click="chickRightButton"> |
|
|
|
扫描 |
|
|
|
</view> |
|
|
@ -113,7 +113,7 @@ |
|
|
|
<u-form-item label="入库数量" prop="qty" required> |
|
|
|
<u-input v-model="form1.qty" type="number" placeholder="请输入入库数量" /> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="描述" prop="qty" required> |
|
|
|
<u-form-item label="描述" prop="qty"> |
|
|
|
<u-input v-model="form1.describes" placeholder="请输入描述" /> |
|
|
|
</u-form-item> |
|
|
|
</u-form> |
|
|
@ -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() |
|
|
|
} |
|
|
|