|
|
@@ -394,18 +394,14 @@
|
|
|
let url = "{{url('customer/project/getPriceModel')}}";
|
|
|
let params = {id:this.ownerTemp.id};
|
|
|
window.tempTip.postBasicRequest(url,params,res=>{
|
|
|
- this._getOwners();
|
|
|
- this._getUnits();
|
|
|
- this._getCars();
|
|
|
- this._getCities();
|
|
|
- this._getLogistics();
|
|
|
- this._getProvinces();
|
|
|
- setTimeout(()=> {
|
|
|
- $(".selectpicker").selectpicker('refresh');
|
|
|
- },500);
|
|
|
if (res.owner_storage_price_models.length>0)this.selectedModel.storage = res.owner_storage_price_models;
|
|
|
- if (res.owner_price_operations.length>0)this.selectedModel.operation = res.owner_price_operations;
|
|
|
+ if (res.owner_price_operations.length>0){
|
|
|
+ this._loadOperation();
|
|
|
+ this.selectedModel.operation = res.owner_price_operations;
|
|
|
+ }
|
|
|
if (res.owner_price_expresses.length>0){
|
|
|
+ this._loadExpress();
|
|
|
+ if (!this.pool.logistics)this._getLogistics();
|
|
|
res.owner_price_expresses.forEach((express,i)=>{
|
|
|
express.logistics.forEach((logistic,j)=>{
|
|
|
express.logistics[j] = logistic.id;
|
|
|
@@ -416,6 +412,11 @@
|
|
|
this.selectedModel.express = res.owner_price_expresses;
|
|
|
}
|
|
|
if (res.owner_price_logistics.length>0){
|
|
|
+ if (res.owner_price_expresses.length===0)this._loadLogistic();
|
|
|
+ else {
|
|
|
+ this._getUnits();
|
|
|
+ this._getCities();
|
|
|
+ }
|
|
|
res.owner_price_logistics.forEach((logistic,i)=>{
|
|
|
logistic.logistics.forEach((l,j)=>{
|
|
|
logistic.logistics[j] = l.id;
|
|
|
@@ -436,7 +437,7 @@
|
|
|
});
|
|
|
},
|
|
|
//加载仓储所需基础信息
|
|
|
- _loadStorage(){
|
|
|
+ async _loadStorage(){
|
|
|
if (!this.pool.units)this._getUnits();
|
|
|
if (!this.isLoad && this.ownerTemp.id)this._loadPriceModel();//计费模型未被加载且项目ID存在时
|
|
|
if (!this.isLoad && !this.ownerTemp.id) this.isLoad = true;
|
|
|
@@ -448,24 +449,14 @@
|
|
|
//加载快递
|
|
|
_loadExpress(){
|
|
|
if (!this.pool.provinces)this._getProvinces();
|
|
|
- if (!this.pool.logistics){
|
|
|
- this._getLogistics();
|
|
|
- setTimeout(()=>{
|
|
|
- $(".selectpicker").selectpicker('refresh');
|
|
|
- },500);
|
|
|
- }
|
|
|
+ if (!this.pool.logistics)this._getLogistics();
|
|
|
},
|
|
|
//加载物流
|
|
|
_loadLogistic(){
|
|
|
if (!this.pool.units) this._getUnits();
|
|
|
if (!this.pool.provinces)this._getProvinces();
|
|
|
if (!this.pool.cities)this._getCities();
|
|
|
- if (!this.pool.logistics){
|
|
|
- this._getLogistics();
|
|
|
- setTimeout(()=>{
|
|
|
- $(".selectpicker").selectpicker('refresh');
|
|
|
- },500);
|
|
|
- }
|
|
|
+ if (!this.pool.logistics)this._getLogistics();
|
|
|
},
|
|
|
//加载直发车
|
|
|
_loadDirectLogistic(){
|
|
|
@@ -476,83 +467,48 @@
|
|
|
if (!this.pool.owners)this._getOwners();
|
|
|
if (!this.pool.logistics)this._getLogistics();
|
|
|
},
|
|
|
+ _setModelData(key,val){
|
|
|
+ let mapping = [];
|
|
|
+ val.forEach(item=>{
|
|
|
+ mapping[item.id] = item.name;
|
|
|
+ });
|
|
|
+ this.$set(this.pool,key,val);
|
|
|
+ this.$set(this.poolMapping,key,mapping);
|
|
|
+ },
|
|
|
//获取项目
|
|
|
_getOwners(){
|
|
|
let url = "{{url('maintenance/owner/get')}}";
|
|
|
- window.tempTip.postBasicRequest(url,{},res=>{
|
|
|
- this.pool.owners = res;
|
|
|
- let mapping = [];
|
|
|
- res.forEach(owner=>{
|
|
|
- mapping[owner.id] = owner.name;
|
|
|
- });
|
|
|
- this.poolMapping.owners = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ window.tempTip.postBasicRequest(url,{},res=>{this._setModelData("owners",res);});
|
|
|
},
|
|
|
//获取单位
|
|
|
_getUnits(){
|
|
|
let url = "{{url('maintenance/unit/getUnits')}}";
|
|
|
- window.tempTip.postBasicRequest(url,{},res=>{
|
|
|
- this.pool.units = res;
|
|
|
- let mapping = [];
|
|
|
- res.forEach(unit=>{
|
|
|
- mapping[unit.id] = unit.name;
|
|
|
- });
|
|
|
- this.poolMapping.units = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ window.tempTip.postBasicRequest(url,{},res=>{this._setModelData("units",res);});
|
|
|
},
|
|
|
//获取省份
|
|
|
_getProvinces(){
|
|
|
let url = "{{url('maintenance/province/get')}}";
|
|
|
- window.tempTip.postBasicRequest(url,{},res=>{
|
|
|
- this.pool.provinces = res;
|
|
|
- let mapping = [];
|
|
|
- res.forEach(province=>{
|
|
|
- mapping[province.id] = province.name;
|
|
|
- });
|
|
|
- this.poolMapping.provinces = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ window.tempTip.postBasicRequest(url,{},res=>{this._setModelData("provinces",res);});
|
|
|
},
|
|
|
//获取城市
|
|
|
_getCities(){
|
|
|
let url = "{{url('maintenance/city/get')}}";
|
|
|
- window.tempTip.postBasicRequest(url,{},res=>{
|
|
|
- this.pool.cities = res;
|
|
|
- let mapping = [];
|
|
|
- res.forEach(city=>{
|
|
|
- mapping[city.id] = city.name;
|
|
|
- });
|
|
|
- this.poolMapping.cities = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ window.tempTip.postBasicRequest(url,{},res=>{this._setModelData("cities",res);});
|
|
|
},
|
|
|
//获取承运商
|
|
|
_getLogistics(){
|
|
|
let url = "{{url('maintenance/logistic/get')}}";
|
|
|
window.tempTip.postBasicRequest(url,{type:''},res=>{
|
|
|
- this.pool.logistics = res;
|
|
|
- let mapping = [];
|
|
|
- res.forEach(logistic=>{
|
|
|
- mapping[logistic.id] = logistic.name;
|
|
|
- });
|
|
|
- this.poolMapping.logistics = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
+ this._setModelData("logistics",res);
|
|
|
+ setTimeout(()=>{
|
|
|
+ $(".selectpicker").selectpicker('refresh');
|
|
|
+ },0);
|
|
|
});
|
|
|
},
|
|
|
//获取车型
|
|
|
_getCars(){
|
|
|
let url = "{{url('maintenance/carType/get')}}";
|
|
|
- window.axios.post(url).then(res=>{
|
|
|
- this.pool.cars = res.data;
|
|
|
- let mapping = [];
|
|
|
- res.data.forEach(car=>{
|
|
|
- mapping[car.id] = car.name;
|
|
|
- });
|
|
|
- this.poolMapping.cars = mapping;
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ window.axios.post(url).then(res=>{this._setModelData("cars",res);});
|
|
|
},
|
|
|
//保存模型
|
|
|
saveModel(){
|