Browse Source

商配任务编辑页面回显

dev-warehouse
kilo 2 years ago
parent
commit
30c69636eb
  1. 372
      src/views/distribution/turndelivery/deliveryDiscuss.vue

372
src/views/distribution/turndelivery/deliveryDiscuss.vue

@ -26,11 +26,11 @@
<el-form ref="form" :model="form" label-width="100px" style="margin: 3px">
<el-row>
<el-col :span="6">
<el-form-item label="车辆信息:" prop="goodsShelfId">
<el-form-item label="车辆信息:" prop="vehicleIds">
<el-select
v-model="vehicleIds"
filterable
multiple
v-model="vehicleIds"
placeholder="请选择车辆"
@change="changeVehicle"
>
@ -63,8 +63,9 @@
v-model="deliveryDriver"
multiple
filterable
placeholder="请选择司机"
@change="changeDriver"
placeholder="请选择司机"
>
<el-option
v-for="item in driverData"
@ -290,6 +291,7 @@
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
:disabled="isDisable"
>
</el-option>
<!-- {{this.forkliftData}}-->
@ -304,6 +306,7 @@
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
:disabled="isDisable"
>
</el-option>
</el-select>
@ -319,6 +322,7 @@
v-for="item in loadAndUnloadData"
:label="item.dictKey"
:value="item.dictKey"
:disabled="isDisable"
>
<span>{{ item.dictValue }}</span>
</el-checkbox>
@ -345,6 +349,7 @@
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
:disabled="isDisable"
>
</el-option>
</el-select>
@ -352,7 +357,7 @@
</el-col>
<el-col :span="6">
<el-form-item label="备货时间:" prop="goodsShelfId">
<el-date-picker v-model="form.stockupDate" type="date" placeholder="请选择备货时间">
<el-date-picker v-model="form.stockupDate" type="date" placeholder="请选择备货时间" :disabled="isDisable">
</el-date-picker>
</el-form-item>
</el-col>
@ -865,6 +870,24 @@
//
tripartiteSourceData:[],
deliveryListId:'',
isDisable:false,
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
value1: [],
};
@ -967,19 +990,26 @@
},
//
getMasterDriverData() {
getDriverList(1, 10, '').then(res => {
this.driverData = res.data.data.records;
});
return new Promise((rv,rev)=>{
getDriverList(1, 10, '').then(res => {
this.driverData = res.data.data.records;
console.log("===============>",res.data.data);
rv(res.data.data.records)
});
})
},
selectionChange(list) {
this.selectionList = list;
},
//
getvehicleData() {
getVehicleList(1, 10, '').then(res => {
this.vehicleData = res.data.data.records;
console.log(res.data.data);
});
return new Promise((rv,rev)=>{
getVehicleList(1, 10, '').then(res => {
this.vehicleData = res.data.data.records;
console.log("^^^^^^^^^^^^^^^^",res.data.data);
rv(res.data.data.records)
});
})
},
fetchData() {
this.error = this.post = null;
@ -1095,110 +1125,185 @@
// this.form.orderInfo = this.orderData;
// }
const params = this.form;
let stockup = {};
let tripartite = {};
let allocationInfo = [];
//
if (params.loader) {
this.loaderData.forEach(a => {
if (params.loader === a.dictKey) {
stockup.loaderName = a.dictValue;
stockup.loaderId = a.dictKey;
}
if (this.deliveryListId){
let tripartite = {};
let allocationInfo = [];
//
let serve = Object.values(this.serveType);
serve = serve.sort((a, b) => {
return a - b;
});
}
this.forkliftData.forEach(b => {
if (params.forklift === b.dictKey) {
stockup.forkliftName = b.dictValue;
stockup.forkliftId = b.dictKey;
}
});
this.goodsAreaData.forEach(c => {
if (params.goodsAreaId === c.dictKey) {
stockup.goodsAreaId = c.dictKey;
stockup.goodsAreaName = c.dictValue;
}
});
if (params.stockupDate) {
stockup.stockupDate = params.stockupDate;
}
if (params.remarks) {
stockup.remarks = params.remarks;
}
//
let serve = Object.values(this.serveType);
serve = serve.sort((a, b) => {
return a - b;
});
console.log('5555555555', serve);
this.form.serveType = serve.join(',');
stockup.loadAndUnload = this.loadAndUnload.join(',');
//
if (params.tripartiteSource) {
//
if (params.driverName) {
tripartite.driverName = params.driverName;
this.form.serveType = serve.join(',');
// stockup.loadAndUnload = this.loadAndUnload.join(',');
//
if (params.tripartiteSource) {
//
if (params.driverName) {
tripartite.driverName = params.driverName;
}
if (params.deiverPhone) {
tripartite.deiverPhone = params.deiverPhone;
}
if (params.vehicleNum) {
tripartite.vehicleNum = params.vehicleNum;
}
if (params.deliveryFee) {
tripartite.deliveryFee = params.deliveryFee;
}
if (params.tripartiteSource) {
this.tripartiteSourceData.forEach(item => {
if (params.tripartiteSource === item.dictValue) {
tripartite.distributionCompanyId = item.dictKey;
tripartite.distributionCompany = item.dictValue;
}
});
}
} else {
//
console.log("this.driverList----------->",this.driverList);
console.log("this.vehticleList----------->",this.vehticleList);
if (this.driverList.length !== this.vehticleList.length) {
this.$message({
message: '司机车辆数量有误!!!',
type: 'warning'
});
return;
} else {
let info = [];
for (let i = 0; i < this.driverInfo.length; i++) {
let obj = {};
obj.driverName = this.driverInfo[i].name;
obj.driverPhone = this.driverInfo[i].phone;
obj.driverId = this.driverInfo[i].id;
obj.vehicleNub = this.vehticleInfo[i].vehicleNub;
obj.vehicleId = this.vehticleInfo[i].id;
info.push(obj);
this.driverInfo[i].name;
}
allocationInfo = info;
}
}
if (params.deiverPhone) {
tripartite.deiverPhone = params.deiverPhone;
let data = {};
data.masterDriverName = this.form.masterDriverName;
data.masterVehicleNub = this.form.masterVehicleNub;
data.allocationInfo = allocationInfo;
data.tripartite = tripartite;
data.stockArticle = this.orderData;
let reservation = {};
reservation.deliveryType = this.form.deliveryType;
reservation.deliveryWay = this.form.deliveryWay;
reservation.serveType = this.form.serveType;
reservation.otherFee = this.form.otherFee;
data.reservation = reservation;
// data.reservationIds = this.ids;
console.log('data>>>>>>>>>>>', data);
}else {
let stockup = {};
let tripartite = {};
let allocationInfo = [];
//
if (params.loader) {
this.loaderData.forEach(a => {
if (params.loader === a.dictKey) {
stockup.loaderName = a.dictValue;
stockup.loaderId = a.dictKey;
}
});
}
if (params.vehicleNum) {
tripartite.vehicleNum = params.vehicleNum;
this.forkliftData.forEach(b => {
if (params.forklift === b.dictKey) {
stockup.forkliftName = b.dictValue;
stockup.forkliftId = b.dictKey;
}
});
this.goodsAreaData.forEach(c => {
if (params.goodsAreaId === c.dictKey) {
stockup.goodsAreaId = c.dictKey;
stockup.goodsAreaName = c.dictValue;
}
});
if (params.stockupDate) {
stockup.stockupDate = params.stockupDate;
}
if (params.deliveryFee) {
tripartite.deliveryFee = params.deliveryFee;
if (params.remarks) {
stockup.remarks = params.remarks;
}
//
let serve = Object.values(this.serveType);
serve = serve.sort((a, b) => {
return a - b;
});
this.form.serveType = serve.join(',');
stockup.loadAndUnload = this.loadAndUnload.join(',');
//
if (params.tripartiteSource) {
this.tripartiteSourceData.forEach(item => {
if (params.tripartiteSource === item.dictValue) {
tripartite.distributionCompanyId = item.dictKey;
tripartite.distributionCompany = item.dictValue;
}
});
}
} else {
//
if (this.driverList.length !== this.vehticleList.length) {
this.$message({
message: '司机车辆数量有误!!!',
type: 'warning',
});
return;
//
if (params.driverName) {
tripartite.driverName = params.driverName;
}
if (params.deiverPhone) {
tripartite.deiverPhone = params.deiverPhone;
}
if (params.vehicleNum) {
tripartite.vehicleNum = params.vehicleNum;
}
if (params.deliveryFee) {
tripartite.deliveryFee = params.deliveryFee;
}
if (params.tripartiteSource) {
this.tripartiteSourceData.forEach(item => {
if (params.tripartiteSource === item.dictValue) {
tripartite.distributionCompanyId = item.dictKey;
tripartite.distributionCompany = item.dictValue;
}
});
}
} else {
let info = [];
for (let i = 0; i < this.driverInfo.length; i++) {
let obj = {};
obj.driverName = this.driverInfo[i].name;
obj.driverPhone = this.driverInfo[i].phone;
obj.driverId = this.driverInfo[i].id;
obj.vehicleNub = this.vehticleInfo[i].vehicleNub;
obj.vehicleId = this.vehticleInfo[i].id;
info.push(obj);
this.driverInfo[i].name;
//
if (this.driverList.length !== this.vehticleList.length) {
this.$message({
message: '司机车辆数量有误!!!',
type: 'warning'
});
return;
} else {
let info = [];
for (let i = 0; i < this.driverInfo.length; i++) {
let obj = {};
obj.driverName = this.driverInfo[i].name;
obj.driverPhone = this.driverInfo[i].phone;
obj.driverId = this.driverInfo[i].id;
obj.vehicleNub = this.vehticleInfo[i].vehicleNub;
obj.vehicleId = this.vehticleInfo[i].id;
info.push(obj);
this.driverInfo[i].name;
}
allocationInfo = info;
}
allocationInfo = info;
}
}
let data = {};
data.stockup = stockup;
data.masterDriverName = this.form.masterDriverName;
data.masterVehicleNub = this.form.masterVehicleNub;
data.allocationInfo = allocationInfo;
data.tripartite = tripartite;
data.stockArticle = this.orderData;
let reservation = {};
reservation.deliveryType = this.form.deliveryType;
reservation.deliveryWay = this.form.deliveryWay;
reservation.serveType = this.form.serveType;
reservation.otherFee = this.form.otherFee;
data.reservation = reservation;
// data.reservationIds = this.ids;
console.log('data>>>>>>>>>>>', data);
deliveryBusinessTask(data).then(res => {
this.$router.push({
path: '/distribution/deliverylist/distributionDeliveryListdis',
let data = {};
data.stockup = stockup;
data.masterDriverName = this.form.masterDriverName;
data.masterVehicleNub = this.form.masterVehicleNub;
data.allocationInfo = allocationInfo;
data.tripartite = tripartite;
data.stockArticle = this.orderData;
let reservation = {};
reservation.deliveryType = this.form.deliveryType;
reservation.deliveryWay = this.form.deliveryWay;
reservation.serveType = this.form.serveType;
reservation.otherFee = this.form.otherFee;
data.reservation = reservation;
// data.reservationIds = this.ids;
console.log('data>>>>>>>>>>>', data);
deliveryBusinessTask(data).then((res) => {
this.$router.push({
path: '/distribution/deliverylist/distributionDeliveryListdis'
});
});
});
}
},
changeVehicle(params) {
console.log(params);
@ -1317,12 +1422,14 @@
this.bbb = false;
this.form = {};
this.loadAndUnload = [];
this.onLoad(this.page);
},
ddd() {
this.aaa = false;
this.bbb = true;
this.form = {};
this.loadAndUnload = [];
this.onLoad(this.page);
},
handleAddOrder() {
this.query.typeService=1;
@ -1367,15 +1474,16 @@
this.selectionList = [];
// this.$refs.table.clearSelection();
},
onLoad(page, params = {}) {
async onLoad(page, params = {}) {
console.log("》》》》》》》》》》》》》》》",this.deliveryListId);
if (this.deliveryListId){
getDeliveryList(this.deliveryListId).then(res=>{
getDeliveryList(this.deliveryListId).then( async res=>{
let data = res.data.data;
Object.assign(this.form,data.reservationInfo)
Object.assign(this.form,data.stockupInfo)
this.form.deliveryType = '2';
this.form.deliveryWay = data.reservationInfo.deliveryWay;
this.serveType = data.reservationInfo.serveType.split(",");
if (data.stockupInfo){
this.loadAndUnload = data.stockupInfo.teamResponsibility.split(",");
@ -1383,36 +1491,56 @@
this.form.loader = data.stockupInfo.loaderName;
this.form.forklift = data.stockupInfo.forkliftName;
this.form.remarks = data.stockupInfo.remarks;
this.orderData = data.stockArticleList;
if (data.kind === "1"){
//
let self = data.deliverySelfVO;
let vehicle = this.vehicleData;
console.log("___________________vahicle",vahicle);
let vehicle =await this.getvehicleData();
console.log("___________________-->",vehicle);
let driver =await this.getMasterDriverData();
let a = [];
let b = [];
let vehicleInfo = [];
vehicle.forEach(item => {
self.forEach(s => {
if (item.id === s.vehicleId) {
a.push(s.vehicleId);
vehicleInfo.push(item);
}
if (s.isMaster === 2) {
this.form.masterVehicleNub = s.vehicleNub;
vehicle.forEach(item=>{
console.log("___________________",item);
self.forEach(s=>{
})
}
});
})
this.vehicleIds = a;
console.log(" this.vehicleIds", this.vehicleIds);
this.vehticleInfo = vehicleInfo;
let driverInfo = [];
driver.forEach(item => {
self.forEach(s => {
if (item.id === s.driverId) {
b.push(s.driverId);
driverInfo.push(item);
}
if (s.isMaster === 2) {
this.form.masterDriverName = s.driverName;
}
});
});
this.deliveryDriver = b;
this.driverInfo = driverInfo;
}else {
this.aaa = false;
this.bbb = true;
//
}
this.vehicleData.forEach(item=>{
})
console.log(">>>>>>>>this.form",this.form);
console.log(res.data.data);
this.orderData = data.stockArticleList;
})
}
this.isDisable=true;
this.loading = false;
// Object.assign(this.form, data.reservationInfo);

Loading…
Cancel
Save