|
@@ -55,9 +55,6 @@
|
|
|
<el-table-column label="出库数量" width="160">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.quantity }}</span>
|
|
|
- <!-- <el-form-item :prop="'details.' + scope.$index + '.quantity'" :rules="formRules.quantity" :inline-message="true">
|
|
|
- <el-input-number size="small" v-model="scope.row.quantity" :controls="false" :min="1" :max="999999999" :precision="0" />
|
|
|
- </el-form-item> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="80" fixed="right">
|
|
@@ -88,12 +85,57 @@ export default {
|
|
|
warehouseList: [],
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ created() {},
|
|
|
+ mounted() {
|
|
|
warehouseList({ pageNum: 1, pageSize: 9999 }).then((res) => {
|
|
|
this.warehouseList = res.data.data.list.filter((item) => [2, 3].includes(item.status))
|
|
|
+ if (this.form.details && this.form.details.length > 0) {
|
|
|
+ let businessIdList = []
|
|
|
+ businessIdList = this.form.details.map((item) => item.businessId)
|
|
|
+ if (this.warehouseList && this.warehouseList.length > 0) {
|
|
|
+ inventoryDetails({ businessIdList: businessIdList, subsidiaryId: this.form.subsidiaryId, warehouseId: this.warehouseList[0].id }).then(
|
|
|
+ (resInventory) => {
|
|
|
+ if (resInventory.data.data && resInventory.data.data.length > 0) {
|
|
|
+ let businessIdTwoList = []
|
|
|
+ for (let i = 0; i < this.form.details.length; i++) {
|
|
|
+ let data = resInventory.data.data.filter((item) => item.businessId === this.form.details[i].businessId)
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ if (data[0].quantity) {
|
|
|
+ this.form.details[i].warehouseId = data[0].warehouseId
|
|
|
+ this.form.details[i].residueNum = Number(data[0].quantity)
|
|
|
+ } else {
|
|
|
+ businessIdTwoList.push(this.form.details[i].businessId)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ businessIdTwoList.push(this.form.details[i].businessId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (businessIdTwoList && businessIdTwoList.length > 0) {
|
|
|
+ inventoryDetails({ businessIdList: businessIdList, subsidiaryId: this.form.subsidiaryId, warehouseId: this.warehouseList[1].id }).then(
|
|
|
+ (inventoryTwo) => {
|
|
|
+ if (inventoryTwo.data.data && inventoryTwo.data.data.length > 0) {
|
|
|
+ for (let j = 0; j < this.form.details.length; j++) {
|
|
|
+ let dataTwo = inventoryTwo.data.data.filter((item) => item.businessId === this.form.details[j].businessId)
|
|
|
+ if (dataTwo && dataTwo.length > 0) {
|
|
|
+ if (dataTwo[0].quantity) {
|
|
|
+ this.form.details[j].warehouseId = dataTwo[0].warehouseId
|
|
|
+ this.form.details[j].residueNum = Number(dataTwo[0].quantity)
|
|
|
+ } else {
|
|
|
+ this.form.details[j].residueNum = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- mounted() {},
|
|
|
computed: mapGetters(['dictData']),
|
|
|
methods: {
|
|
|
validateForm() {
|
|
@@ -112,9 +154,13 @@ export default {
|
|
|
},
|
|
|
changeWarehouse(val, item) {
|
|
|
if (val && this.form.subsidiaryId) {
|
|
|
- inventoryDetails({ businessId: item.businessId, subsidiaryId: this.form.subsidiaryId, warehouseId: val }).then((res) => {
|
|
|
- if (res.data.data && res.data.data.quantity) {
|
|
|
- item.residueNum = Number(res.data.data.quantity)
|
|
|
+ inventoryDetails({ businessIdList: [item.businessId], subsidiaryId: this.form.subsidiaryId, warehouseId: val }).then((res) => {
|
|
|
+ if (res.data.data && res.data.data.length > 0) {
|
|
|
+ if (res.data.data[0].quantity) {
|
|
|
+ item.residueNum = Number(res.data.data[0].quantity)
|
|
|
+ } else {
|
|
|
+ item.residueNum = 0
|
|
|
+ }
|
|
|
} else {
|
|
|
item.residueNum = 0
|
|
|
}
|