|
|
|
|
@ -19,26 +19,23 @@ |
|
|
|
|
</template> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<!-- prop 格式:数组名[索引].字段名 --> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].location`" :rules="formRules.location"> |
|
|
|
|
<el-select |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].location`" :rules="formRules.location" style="margin-top: 14px"> |
|
|
|
|
<jhSelect |
|
|
|
|
v-model="scope.row.goodsId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%; margin-top: 15px" |
|
|
|
|
remote |
|
|
|
|
:remote-method="remoteMethodGoods" |
|
|
|
|
:loading="loading" |
|
|
|
|
reserve-keyword |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
@change="val => changeGoods(val, scope.$index)" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in goodsData" |
|
|
|
|
:key="item.goodsId" |
|
|
|
|
:value="item.goodsId" |
|
|
|
|
:label="item.goodsCodeAndGoodsName" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
placeholder="请搜索选择" |
|
|
|
|
api-url="/api/blade-wms/combox/config/goodsOut" |
|
|
|
|
echo-api="/api/blade-wms/combox/config/goodsOut" |
|
|
|
|
echoParamsKey="ids" |
|
|
|
|
echo-method="get" |
|
|
|
|
api-method="get" |
|
|
|
|
list-key="records" |
|
|
|
|
total-key="total" |
|
|
|
|
label-key="goodsCodeAndGoodsName" |
|
|
|
|
value-key="goodsId" |
|
|
|
|
search-key="filterValue" |
|
|
|
|
:debounce-time="500" |
|
|
|
|
@change="(value, item) => changeGoods(value, item, scope.$index)" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -55,14 +52,11 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<!-- 新库房号(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="新库房号"> |
|
|
|
|
<template #header> |
|
|
|
|
<span><i style="color: red">*</i>新库房号</span> |
|
|
|
|
</template> |
|
|
|
|
<template #header> |
|
|
|
|
<span><i style="color: red">*</i>新库房号</span> |
|
|
|
|
</template> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].newShId`" |
|
|
|
|
:rules="formRules.newShId" |
|
|
|
|
> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].newShId`" :rules="formRules.newShId"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="scope.row.newShId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
@ -87,25 +81,26 @@ |
|
|
|
|
</el-table-column> |
|
|
|
|
<!-- 新库位号(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="新库位号"> |
|
|
|
|
<!-- remote |
|
|
|
|
<!-- remote |
|
|
|
|
:remote-method="remoteMethodLocation" --> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].newSlId`" |
|
|
|
|
:rules="formRules.newSlId" |
|
|
|
|
> |
|
|
|
|
<el-select |
|
|
|
|
v-model="scope.row.newSlId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%; margin-top: 15px" |
|
|
|
|
|
|
|
|
|
:loading="loading" |
|
|
|
|
reserve-keyword |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
> |
|
|
|
|
<el-option v-for="item in locationData" :key="item.id" :value="item.id" :label="item.location"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].newSlId`" :rules="formRules.newSlId"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="scope.row.newSlId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%; margin-top: 15px" |
|
|
|
|
:loading="loading" |
|
|
|
|
reserve-keyword |
|
|
|
|
clearable |
|
|
|
|
filterable |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in locationData" |
|
|
|
|
:key="item.id" |
|
|
|
|
:value="item.id" |
|
|
|
|
:label="item.location" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<!-- <el-input style="margin-top: 15px" v-model="scope.row.newSlId" disabled></el-input> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
@ -113,10 +108,7 @@ |
|
|
|
|
<!-- 旧库房号(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="旧库房号"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].shName`" |
|
|
|
|
:rules="formRules.shName" |
|
|
|
|
> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].shName`" :rules="formRules.shName"> |
|
|
|
|
<el-input style="margin-top: 15px" v-model="scope.row.shName" disabled></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
@ -124,10 +116,7 @@ |
|
|
|
|
<!-- 旧库位号(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="旧库位号"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].location`" |
|
|
|
|
:rules="formRules.location" |
|
|
|
|
> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].location`" :rules="formRules.location"> |
|
|
|
|
<el-input style="margin-top: 15px" v-model="scope.row.location" disabled></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
@ -139,17 +128,18 @@ |
|
|
|
|
:prop="`tableData[${scope.$index}].specifications`" |
|
|
|
|
:rules="formRules.specifications" |
|
|
|
|
> |
|
|
|
|
<el-input style="margin-top: 15px" v-model="scope.row.specifications" disabled></el-input> |
|
|
|
|
<el-input |
|
|
|
|
style="margin-top: 15px" |
|
|
|
|
v-model="scope.row.specifications" |
|
|
|
|
disabled |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<!-- 批次号(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="批次号"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].piNo`" |
|
|
|
|
:rules="formRules.piNo" |
|
|
|
|
> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].piNo`" :rules="formRules.piNo"> |
|
|
|
|
<el-input style="margin-top: 15px" v-model="scope.row.piNo" disabled></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
@ -157,10 +147,7 @@ |
|
|
|
|
<!-- 库存数量(绑定数组字段) --> |
|
|
|
|
<el-table-column align="center" label="库存数量"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item |
|
|
|
|
:prop="`tableData[${scope.$index}].quantity`" |
|
|
|
|
:rules="formRules.quantity" |
|
|
|
|
> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].quantity`" :rules="formRules.quantity"> |
|
|
|
|
<el-input style="margin-top: 15px" v-model="scope.row.quantity" disabled></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
@ -177,218 +164,213 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {getGoodsOutList,addTransfer} from '@/api/storeManagement/binTransfer.js' |
|
|
|
|
import {getWareList,getLocationList} from "@/api/storeManagement/warehouseMaintenance.js" |
|
|
|
|
import { getGoodsOutList, addTransfer } from '@/api/storeManagement/binTransfer.js'; |
|
|
|
|
import { getWareList, getLocationList } from '@/api/storeManagement/warehouseMaintenance.js'; |
|
|
|
|
import { add } from '@/api/system/menu'; |
|
|
|
|
export default { |
|
|
|
|
props: { |
|
|
|
|
title: { |
|
|
|
|
type: String, |
|
|
|
|
default: '新增', |
|
|
|
|
}, |
|
|
|
|
showDialog: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false, |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
title: { |
|
|
|
|
type: String, |
|
|
|
|
default: '新增', |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
openShow: false, |
|
|
|
|
warehouseData: [], |
|
|
|
|
locationData:[], |
|
|
|
|
formError:'', |
|
|
|
|
form: { |
|
|
|
|
tableData: [], |
|
|
|
|
}, |
|
|
|
|
goodsData:[], |
|
|
|
|
formRules: { |
|
|
|
|
// 表格数据数组的整体校验(可选:如最少1行数据) |
|
|
|
|
tableData: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: '请至少添加一行数据', |
|
|
|
|
trigger: 'submit', |
|
|
|
|
type: 'array' // 明确类型为数组 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
if (value.length === 0) { |
|
|
|
|
callback(new Error('请至少添加一行数据')); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
trigger: 'submit' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
// 数组中每一项的 wcId 字段校验 |
|
|
|
|
goodsCode: [ |
|
|
|
|
{ required: true, message: '请选择物料编码', trigger: ['change', 'submit'] } |
|
|
|
|
], |
|
|
|
|
newShId:[ |
|
|
|
|
{ required: true, message: '请选择新库房号', trigger: ['change', 'submit'] } |
|
|
|
|
], |
|
|
|
|
newSlId:[ |
|
|
|
|
{ required: true, message: '请选择新库位号', trigger: ['change', 'submit'] } |
|
|
|
|
] |
|
|
|
|
showDialog: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
openShow: false, |
|
|
|
|
warehouseData: [], |
|
|
|
|
locationData: [], |
|
|
|
|
formError: '', |
|
|
|
|
form: { |
|
|
|
|
tableData: [], |
|
|
|
|
}, |
|
|
|
|
goodsData: [], |
|
|
|
|
formRules: { |
|
|
|
|
// 表格数据数组的整体校验(可选:如最少1行数据) |
|
|
|
|
tableData: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: '请至少添加一行数据', |
|
|
|
|
trigger: 'submit', |
|
|
|
|
type: 'array', // 明确类型为数组 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
if (value.length === 0) { |
|
|
|
|
callback(new Error('请至少添加一行数据')); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
loading:false, |
|
|
|
|
}; |
|
|
|
|
trigger: 'submit', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
// 数组中每一项的 wcId 字段校验 |
|
|
|
|
goodsCode: [{ required: true, message: '请选择物料编码', trigger: ['change', 'submit'] }], |
|
|
|
|
newShId: [{ required: true, message: '请选择新库房号', trigger: ['change', 'submit'] }], |
|
|
|
|
newSlId: [{ required: true, message: '请选择新库位号', trigger: ['change', 'submit'] }], |
|
|
|
|
}, |
|
|
|
|
loading: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.openShow = this.showDialog; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
remoteMethodGoods(query) { |
|
|
|
|
console.log('query==========', query); |
|
|
|
|
if (query) { |
|
|
|
|
console.log('1111111111111'); |
|
|
|
|
this.loading = true; |
|
|
|
|
getGoodsOutList({ |
|
|
|
|
goodsCode: query, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.goodsData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
console.log('222222222222222'); |
|
|
|
|
this.loading = true; |
|
|
|
|
getGoodsOutList({ |
|
|
|
|
current: 1, |
|
|
|
|
size: 9999, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.goodsData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
console.log('goods==============', this.goodsData); |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.openShow = this.showDialog; |
|
|
|
|
remoteMethodWare(query) { |
|
|
|
|
if (query) { |
|
|
|
|
this.loading = true; |
|
|
|
|
getWareList({ |
|
|
|
|
warehouseCode: query, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.warehouseData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.loading = true; |
|
|
|
|
getWareList().then(res => { |
|
|
|
|
this.warehouseData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
remoteMethodGoods(query){ |
|
|
|
|
console.log('query==========',query) |
|
|
|
|
if (query) { |
|
|
|
|
console.log('1111111111111') |
|
|
|
|
this.loading = true |
|
|
|
|
getGoodsOutList({ |
|
|
|
|
goodsCode:query |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.goodsData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
console.log('222222222222222') |
|
|
|
|
this.loading = true |
|
|
|
|
getGoodsOutList({ |
|
|
|
|
current:1, |
|
|
|
|
size:9999 |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.goodsData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
console.log('goods==============',this.goodsData) |
|
|
|
|
}, |
|
|
|
|
remoteMethodWare(query){ |
|
|
|
|
if(query){ |
|
|
|
|
this.loading = true |
|
|
|
|
getWareList({ |
|
|
|
|
warehouseCode:query |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.warehouseData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.loading = true |
|
|
|
|
getWareList().then(res =>{ |
|
|
|
|
this.warehouseData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
changeGoods(val,index){ |
|
|
|
|
let tmp = this.goodsData.find(item => item.goodsId == val) |
|
|
|
|
this.form.tableData[index].rlsId = tmp.id |
|
|
|
|
this.form.tableData[index].goodsName = tmp.goodsName |
|
|
|
|
this.form.tableData[index].location = tmp.location |
|
|
|
|
this.form.tableData[index].shName = tmp.shName |
|
|
|
|
this.form.tableData[index].specifications = tmp.specifications |
|
|
|
|
this.form.tableData[index].piNo = tmp.piNo |
|
|
|
|
this.form.tableData[index].quantity = tmp.quantity |
|
|
|
|
this.form.tableData[index].oldSlId = tmp.slId |
|
|
|
|
this.form.tableData[index].oldShId = tmp.shId |
|
|
|
|
}, |
|
|
|
|
changeWare(val,index){ |
|
|
|
|
this.form.tableData[index].newSlId = '' |
|
|
|
|
this.remoteMethodLocation(val) |
|
|
|
|
}, |
|
|
|
|
remoteMethodLocation(val){ |
|
|
|
|
if(val){ |
|
|
|
|
this.loading = true |
|
|
|
|
getLocationList({ |
|
|
|
|
shId:val |
|
|
|
|
}).then(res =>{ |
|
|
|
|
this.locationData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.loading = true |
|
|
|
|
getLocationList().then(res =>{ |
|
|
|
|
this.locationData = res.data.data.records; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
selectChange(list, row) { |
|
|
|
|
row._select = !row._select; |
|
|
|
|
}, |
|
|
|
|
// 新增一行(直接push到表单模型的 tableData 中) |
|
|
|
|
addTable() { |
|
|
|
|
this.form.tableData.push({ |
|
|
|
|
_select: false, // 选择状态 |
|
|
|
|
location: '', // 库位号 |
|
|
|
|
goodsCode: '', // 物料编码 |
|
|
|
|
goodsName: '', // 物料名称 |
|
|
|
|
specifications: '', // 物料规格 |
|
|
|
|
materialModel: '', // 型号/牌号 |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 删除选中行 |
|
|
|
|
delTable() { |
|
|
|
|
this.$confirm('确定删除选中数据?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
this.form.tableData = this.form.tableData.filter(row => !row._select); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
closeDialog(val) { |
|
|
|
|
this.openShow = false; |
|
|
|
|
this.$emit('closeDialog',val); |
|
|
|
|
// 重置表单 |
|
|
|
|
this.form.tableData = []; |
|
|
|
|
this.formError = ''; |
|
|
|
|
this.$refs.tableForm?.resetFields(); |
|
|
|
|
}, |
|
|
|
|
submitForm(){ |
|
|
|
|
this.formError = ''; |
|
|
|
|
console.log('table----------------',this.form.tableData) |
|
|
|
|
if(this.form.tableData.length === 0){ |
|
|
|
|
this.formError = '请至少填写一条数据'; |
|
|
|
|
return |
|
|
|
|
changeGoods(val, item, index) { |
|
|
|
|
let tmp = item; |
|
|
|
|
this.form.tableData[index].rlsId = tmp.id; |
|
|
|
|
this.form.tableData[index].goodsName = tmp.goodsName; |
|
|
|
|
this.form.tableData[index].location = tmp.location; |
|
|
|
|
this.form.tableData[index].shName = tmp.shName; |
|
|
|
|
this.form.tableData[index].specifications = tmp.specifications; |
|
|
|
|
this.form.tableData[index].piNo = tmp.piNo; |
|
|
|
|
this.form.tableData[index].quantity = tmp.quantity; |
|
|
|
|
this.form.tableData[index].oldSlId = tmp.slId; |
|
|
|
|
this.form.tableData[index].oldShId = tmp.shId; |
|
|
|
|
}, |
|
|
|
|
changeWare(val, index) { |
|
|
|
|
this.form.tableData[index].newSlId = ''; |
|
|
|
|
this.remoteMethodLocation(val); |
|
|
|
|
}, |
|
|
|
|
remoteMethodLocation(val) { |
|
|
|
|
if (val) { |
|
|
|
|
this.loading = true; |
|
|
|
|
getLocationList({ |
|
|
|
|
shId: val, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.locationData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.loading = true; |
|
|
|
|
getLocationList().then(res => { |
|
|
|
|
this.locationData = res.data.data.records; |
|
|
|
|
this.loading = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
selectChange(list, row) { |
|
|
|
|
row._select = !row._select; |
|
|
|
|
}, |
|
|
|
|
// 新增一行(直接push到表单模型的 tableData 中) |
|
|
|
|
addTable() { |
|
|
|
|
this.form.tableData.push({ |
|
|
|
|
_select: false, // 选择状态 |
|
|
|
|
location: '', // 库位号 |
|
|
|
|
goodsCode: '', // 物料编码 |
|
|
|
|
goodsName: '', // 物料名称 |
|
|
|
|
specifications: '', // 物料规格 |
|
|
|
|
materialModel: '', // 型号/牌号 |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 删除选中行 |
|
|
|
|
delTable() { |
|
|
|
|
this.$confirm('确定删除选中数据?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}).then(() => { |
|
|
|
|
this.form.tableData = this.form.tableData.filter(row => !row._select); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
closeDialog(val) { |
|
|
|
|
this.openShow = false; |
|
|
|
|
this.$emit('closeDialog', val); |
|
|
|
|
// 重置表单 |
|
|
|
|
this.form.tableData = []; |
|
|
|
|
this.formError = ''; |
|
|
|
|
this.$refs.tableForm?.resetFields(); |
|
|
|
|
}, |
|
|
|
|
submitForm() { |
|
|
|
|
this.formError = ''; |
|
|
|
|
console.log('table----------------', this.form.tableData); |
|
|
|
|
if (this.form.tableData.length === 0) { |
|
|
|
|
this.formError = '请至少填写一条数据'; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 调用单个 Form 的校验方法 |
|
|
|
|
this.$refs.tableForm.validate((isValid, invalidFields) => { |
|
|
|
|
if (!isValid) { |
|
|
|
|
// 校验失败:显示提示并滚动到第一个错误字段 |
|
|
|
|
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
// 找到第一个错误字段并滚动到视图 |
|
|
|
|
const firstError = document.querySelector('.el-form-item.is-error'); |
|
|
|
|
if (firstError) { |
|
|
|
|
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
|
|
|
|
} |
|
|
|
|
// 调用单个 Form 的校验方法 |
|
|
|
|
this.$refs.tableForm.validate((isValid, invalidFields) => { |
|
|
|
|
if (!isValid) { |
|
|
|
|
// 校验失败:显示提示并滚动到第一个错误字段 |
|
|
|
|
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
// 找到第一个错误字段并滚动到视图 |
|
|
|
|
const firstError = document.querySelector('.el-form-item.is-error'); |
|
|
|
|
if (firstError) { |
|
|
|
|
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 校验通过:准备提交数据(过滤无用字段) |
|
|
|
|
const submitData = this.form.tableData.map(row => { |
|
|
|
|
const { _select, |
|
|
|
|
// goodsCode,goodsName, |
|
|
|
|
// location,materialModel,piNo,quantity, |
|
|
|
|
// shName,specifications, |
|
|
|
|
...validData } = row; // 剔除选择状态字段 |
|
|
|
|
return validData; |
|
|
|
|
}); |
|
|
|
|
// 校验通过:准备提交数据(过滤无用字段) |
|
|
|
|
const submitData = this.form.tableData.map(row => { |
|
|
|
|
const { |
|
|
|
|
_select, |
|
|
|
|
// goodsCode,goodsName, |
|
|
|
|
// location,materialModel,piNo,quantity, |
|
|
|
|
// shName,specifications, |
|
|
|
|
...validData |
|
|
|
|
} = row; // 剔除选择状态字段 |
|
|
|
|
return validData; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
console.log('submitData---------------',submitData) |
|
|
|
|
addTransfer(submitData).then(res =>{ |
|
|
|
|
if(res.data.code === 200){ |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.closeDialog(true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log('submitData---------------', submitData); |
|
|
|
|
addTransfer(submitData).then(res => { |
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
this.$message.success('新增成功'); |
|
|
|
|
this.closeDialog(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|