|
|
|
|
@ -1,6 +1,12 @@ |
|
|
|
|
<template> |
|
|
|
|
<el-dialog title="新增" append-to-body :modelValue="openShow" width="30%" @close="closeDialog"> |
|
|
|
|
<el-form :model="form" ref="form" :rules="rules" label-width="auto" @submit.prevent> |
|
|
|
|
<el-form-item label="配送模式" prop="boxType"> |
|
|
|
|
<el-radio-group v-model="form.bindType" @change="typeChange"> |
|
|
|
|
<el-radio value="bind">送料</el-radio> |
|
|
|
|
<el-radio value="unbind">叫料</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="箱条码"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.boxBarcode" |
|
|
|
|
@ -8,17 +14,44 @@ |
|
|
|
|
placeholder="请扫描箱条码" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="起点站点" prop="stationCode"> |
|
|
|
|
<el-form-item label="起点站点" prop="stationCode" v-if="form.bindType == 'bind'" required> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.stationCode" |
|
|
|
|
@keyup.enter.native="changeCode" |
|
|
|
|
placeholder="请扫描箱条码" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="起点站点" v-if="form.bindType == 'unbind'" required> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.regionIndex" |
|
|
|
|
placeholder="请选择站点区域" |
|
|
|
|
@change="val => regionDataStartChange(val)" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item, index) in regionDataStart" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.stationRegion" |
|
|
|
|
:value="item.stationRegion" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.regionCode" |
|
|
|
|
placeholder="请选择站点码" |
|
|
|
|
@change="val => regionDataEndChange(val)" |
|
|
|
|
style="margin-top: 5px" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item, index) in regionStartCode" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item" |
|
|
|
|
:value="item" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="终点站点" prop="endLocationId"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.endLocationId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
placeholder="请选择作业中心" |
|
|
|
|
filterable |
|
|
|
|
@change="endLocationChange" |
|
|
|
|
> |
|
|
|
|
@ -29,6 +62,14 @@ |
|
|
|
|
:value="item.id" |
|
|
|
|
/> |
|
|
|
|
</el-select> |
|
|
|
|
<el-select |
|
|
|
|
v-model="form.regionName" |
|
|
|
|
placeholder="请选择终点区域" |
|
|
|
|
filterable |
|
|
|
|
style="margin-top: 5px" |
|
|
|
|
> |
|
|
|
|
<el-option v-for="item in regionData" :key="item" :label="item" :value="item" /> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
@ -44,7 +85,8 @@ |
|
|
|
|
import { |
|
|
|
|
returnWarehouseList, |
|
|
|
|
returnWarehouse, |
|
|
|
|
boxBinding |
|
|
|
|
boxBinding, |
|
|
|
|
getStationRegionList, |
|
|
|
|
} from '@/api/logisticsManagement/logisticsDistribution'; |
|
|
|
|
export default { |
|
|
|
|
props: { |
|
|
|
|
@ -61,23 +103,59 @@ export default { |
|
|
|
|
return { |
|
|
|
|
submitLoading: false, |
|
|
|
|
openShow: false, |
|
|
|
|
form: {}, |
|
|
|
|
form: { |
|
|
|
|
bindType: 'bind', |
|
|
|
|
endLocationId: '', //终点作业中心 |
|
|
|
|
endLocationRange: '', //终点区域 |
|
|
|
|
regionIndex: '', //起点区域 |
|
|
|
|
regionCode: '', //起点区域码 |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
boxBarcode: [{ required: true, message: '请扫描箱条码', trigger: 'blur' }], |
|
|
|
|
stationCode: [{ required: true, message: '请扫描站点码', trigger: 'blur' }], |
|
|
|
|
endLocationId: [{ required: true, message: '请选择作业中心', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
workCenterOptions: [], |
|
|
|
|
regionData: [], //终点区域数据 |
|
|
|
|
regionDataStart: [], //起点站点区域列表 |
|
|
|
|
regionStartCode: [], //起点区域码 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.openShow = this.showDialog; |
|
|
|
|
this.returnWarehouseList(); |
|
|
|
|
if (this.form.bindType == 'unbind') { |
|
|
|
|
this.getStationRegionList(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
typeChange() { |
|
|
|
|
if (this.form.bindType == 'unbind') { |
|
|
|
|
this.getStationRegionList(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
regionDataStartChange(val) { |
|
|
|
|
const selected = this.regionDataStart.find( |
|
|
|
|
item => item.stationRegion === this.form.regionIndex |
|
|
|
|
); |
|
|
|
|
this.regionStartCode = selected.stationCodeList; |
|
|
|
|
// 默认选择第一个站点码 |
|
|
|
|
if (this.regionStartCode && this.regionStartCode.length > 0) { |
|
|
|
|
this.form.regionCode = this.regionStartCode[0]; |
|
|
|
|
this.$message.success(`已自动选择站点码:${this.regionStartCode[0]}`); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取起点站点区域 |
|
|
|
|
getStationRegionList() { |
|
|
|
|
getStationRegionList().then(res => { |
|
|
|
|
this.regionDataStart = res.data.data; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取终点站名字 |
|
|
|
|
endLocationChange() { |
|
|
|
|
const selected = this.workCenterOptions.find(item => item.id === this.form.endLocationId); |
|
|
|
|
console.log(989898989898, selected); |
|
|
|
|
this.regionData = selected ? selected.stationRegionList : []; |
|
|
|
|
this.form.endName = selected ? selected.wcName : ''; |
|
|
|
|
}, |
|
|
|
|
// 获取退回列表 |
|
|
|
|
@ -97,12 +175,23 @@ export default { |
|
|
|
|
this.$refs.form.validate(async valid => { |
|
|
|
|
if (valid) { |
|
|
|
|
this.submitLoading = true; |
|
|
|
|
// 根据模式区分提交参数 |
|
|
|
|
let params = { |
|
|
|
|
boxBarcode: this.form.boxBarcode, |
|
|
|
|
startStationCode: this.form.stationCode, |
|
|
|
|
endWcId: this.form.endLocationId, |
|
|
|
|
boxBarcode: this.form.boxBarcode,//箱条码 |
|
|
|
|
// endWcId: this.form.endLocationId, |
|
|
|
|
endWcId: this.form.endLocationId, // 配送模式 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 送料模式:使用 stationCode |
|
|
|
|
if (this.form.bindType === 'bind') { |
|
|
|
|
params.startStationCode = this.form.stationCode; |
|
|
|
|
} |
|
|
|
|
// 叫料模式:使用 regionCode 和 regionIndex |
|
|
|
|
else if (this.form.bindType === 'unbind') { |
|
|
|
|
params.startStationCode = this.form.regionCode; |
|
|
|
|
} |
|
|
|
|
console.log(9898989898989, params) |
|
|
|
|
|
|
|
|
|
boxBinding(params) |
|
|
|
|
.then(res => { |
|
|
|
|
this.$message.success('操作成功'); |
|
|
|
|
|