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

Loading…
Cancel
Save