Commit 0ab57171 authored by lixy's avatar lixy

片区-车辆添加车型关联

parent 33fec714
...@@ -25,10 +25,11 @@ function loadFromServer(type) { ...@@ -25,10 +25,11 @@ function loadFromServer(type) {
headerAuthorization = getToken(); // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改 headerAuthorization = getToken(); // 让每个请求携带token--['Authorization']为自定义key 请根据实际情况自行修改
} }
// url : baseURL+"",//路径 // url : baseURL+"",//路径
let rs; let rs = [];
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: process.env.BASE_API + '/vehicle/constant/type/' + type, // url: process.env.BASE_API + '/vehicle/constant/type/' + type,
url: process.env.BASE_API + '/vehicle/area/findAll',
async: false, async: false,
headers: { headers: {
Authorization: headerAuthorization Authorization: headerAuthorization
...@@ -38,15 +39,19 @@ function loadFromServer(type) { ...@@ -38,15 +39,19 @@ function loadFromServer(type) {
success: function (result) { success: function (result) {
// 返回数据根据结果进行相应的处理 // 返回数据根据结果进行相应的处理
if (result.code === rsCode.RS_CODE_SUC) { if (result.code === rsCode.RS_CODE_SUC) {
rs = result.data; result.data.map(function(item){
rs.push(item);
})
} else { } else {
console.log('请求常量信息出错。'); console.log('请求常量信息出错。');
} }
return rs;
}, },
error: function () { error: function () {
console.log('请求常量信息出错。'); console.log('请求常量信息出错。');
} }
}); });
console.log(rs);
return rs; return rs;
} }
...@@ -108,6 +113,23 @@ export function getConstantListByType(type) { ...@@ -108,6 +113,23 @@ export function getConstantListByType(type) {
return constantMap; return constantMap;
} }
export function getConstantListByTypeNew(type) {
if (!type) {
console.error('empty constant type');
return null;
}
let constantMap = store.getters.vehicleConstants(type);
if (constantMap == null || typeof (constantMap) == "undefined") {
let constants = loadFromServer(type);
if (!constants || constants.length === 0) {
return null;
}
constantMap = constants;
}
return constantMap;
}
/** 保险公司 */ /** 保险公司 */
export function getInsuranceCompany(code) { export function getInsuranceCompany(code) {
if (code == null || typeof (code) == "undefined" || code === VEHICLE_CONSTANT_INSURANCE_COMPANY_UNKOWN) { if (code == null || typeof (code) == "undefined" || code === VEHICLE_CONSTANT_INSURANCE_COMPANY_UNKOWN) {
...@@ -129,5 +151,5 @@ export function getZone(code) { ...@@ -129,5 +151,5 @@ export function getZone(code) {
} }
export function getAllZone() { export function getAllZone() {
return getConstantListByType(ZONE); return getConstantListByTypeNew(ZONE);
} }
...@@ -53,3 +53,12 @@ export function getBookedInfo(vehicleId, yearMonth) { ...@@ -53,3 +53,12 @@ export function getBookedInfo(vehicleId, yearMonth) {
method: 'get' method: 'get'
}); });
} }
/*
* 根据id获取片区下省份
* */
export function getSysRegionByIds(ids) {
return fetch({
url: '/vehicle/sysRegion/getSysRegionByIds/' + ids,
method: 'get'
});
}
...@@ -60,6 +60,16 @@ export function deleteVehicleType(id) { ...@@ -60,6 +60,16 @@ export function deleteVehicleType(id) {
method: 'delete' method: 'delete'
}); });
} }
/**
* 获取全部车型
* */
export function getAllVehicleList() {
return fetch({
url: '/vehicle/vehicleModel/findAll',
method: 'get'
});
}
/** /**
* 车型标签是否多选 * 车型标签是否多选
*/ */
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</el-form-item> </el-form-item>
<el-form-item label="所属片区" prop="zoneId"> <el-form-item label="所属片区" prop="zoneId">
<el-select class="filter-item" v-model="form.zoneId" placeholder="请选择"> <el-select class="filter-item" v-model="form.zoneId" placeholder="请选择">
<el-option v-for="(val, key, index) in getAllZone()" :key="val.code" :label="val.val" :value="val.code"> </el-option> <el-option v-for="val in getAllZoneList" :key="val.id" :label="val.name" :value="val.id"> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属分公司" prop="companyId"> <el-form-item label="所属分公司" prop="companyId">
...@@ -255,7 +255,11 @@ export default { ...@@ -255,7 +255,11 @@ export default {
computed: { computed: {
...mapGetters([ ...mapGetters([
'elements' 'elements'
]) ]),
getAllZoneList(){
this.allZoneArr = getAllZone();
return getAllZone();
},
}, },
methods: { methods: {
getAllZone, getAllZone,
......
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
this.showLoadingBody = true; this.showLoadingBody = true;
return isJPG && isLt2M; return isJPG && isLt2M;
}, },
handleAvatarSuccess(res, file) {debugger handleAvatarSuccess(res, file) {
this.form.cover = res.data; this.form.cover = res.data;
this.showLoadingBody = false; this.showLoadingBody = false;
}, },
......
...@@ -113,19 +113,19 @@ ...@@ -113,19 +113,19 @@
</el-form-item> </el-form-item>
<el-form-item label="所属地区" prop="zoneId"> <el-form-item label="所属地区" prop="zoneId">
<el-select class="filter-item" v-model="form.zoneId" placeholder="请选择"> <el-select class="filter-item" v-model="form.zoneId" placeholder="请选择" @change="getProvinceRegions">
<el-option v-for="(val, key, index) in getAllZone()" :key="val.code" :label="val.val" :value="val.code"> </el-option> <el-option v-for="val in getAllZoneList" :key="val.id" :label="val.name" :value="val.id"> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="省份" prop="addrProvince"> <el-form-item label="省份" prop="addrProvince">
<el-select v-model.number="form.addrProvince" placeholder="请选择省份(直辖市)" > <el-select v-model.number="form.addrProvince" placeholder="请选择省份(直辖市)" @change="changeProvince">
<el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="城市" prop="addrCity"> <el-form-item label="城市" prop="addrCity">
<el-select v-model.number="form.addrCity" placeholder="请选择城市"> <el-select v-model.number="form.addrCity" placeholder="请选择城市" @change="changeCity">
<el-option v-for="item in cityRegions" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in cityRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -179,6 +179,10 @@ ...@@ -179,6 +179,10 @@
putObj putObj
} from 'api/base_info/branch_company'; } from 'api/base_info/branch_company';
import {
getSysRegionByIds
} from 'api/vehicle/vehicleInfo/';
import { import {
getSonRegionByCodes, getSonRegionByCodes,
getRegionByCodes, getRegionByCodes,
...@@ -211,6 +215,8 @@ ...@@ -211,6 +215,8 @@
leaderContactInfo: undefined, leaderContactInfo: undefined,
updateTime: undefined updateTime: undefined
}, },
allZoneArr:[],//全部片区
provinceRegions: [],//片区下省份数据
rules: { rules: {
latitude: [ latitude: [
{ {
...@@ -366,9 +372,13 @@ ...@@ -366,9 +372,13 @@
'elements', 'elements',
'companyStatusAndCode' 'companyStatusAndCode'
]), ]),
provinceRegions() { getAllZoneList(){
return getSonRegionByCodes(1); this.allZoneArr = getAllZone();
return getAllZone();
}, },
// provinceRegions() {
// return getSonRegionByCodes(1);
// },
cityRegions() { cityRegions() {
if (!this.$utils.isInteger(this.form.addrProvince)) { if (!this.$utils.isInteger(this.form.addrProvince)) {
return null; return null;
...@@ -395,7 +405,42 @@ ...@@ -395,7 +405,42 @@
} }
}, },
methods: { methods: {
getAllZone, /**
* 根据片区获取省份数据
* */
getProvinceRegions() {
let that = this;
this.form.addrCity = undefined;
this.form.addrProvince = undefined;
this.form.addrTown = undefined;
if (!this.$utils.isInteger(this.form.zoneId)) {
return null;
}
this.allZoneArr.map(function(item){
if(item.id == that.form.zoneId){
getSysRegionByIds(item.provinceIds).then(response => {
let listRs = undefined;
if (!that.$utils.isEmpty(response.data)) {
listRs = response.data;
}
that.provinceRegions = listRs;
});
}
});
},
/**
* 改变省份,清空城市
* */
changeProvince(){
this.form.addrCity = undefined;
this.form.addrTown = undefined;
},
/**
* 改变城市,清空城镇
* */
changeCity(){
this.form.addrTown = undefined;
},
getValue(e){ getValue(e){
this.listQuery.addrCity = undefined; this.listQuery.addrCity = undefined;
}, },
...@@ -527,7 +572,7 @@ ...@@ -527,7 +572,7 @@
}); });
}, },
choiceImg(){ choiceImg(){
this.$refs.filElem.dispatchEvent(new MouseEvent('click')) this.$refs.filElem.dispatchEvent(new MouseEvent('click'))
}, },
getFile(event){ getFile(event){
let formData = new FormData(); let formData = new FormData();
......
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
let allList = this.list; let allList = this.list;
this.nomore = false; this.nomore = false;
this.nodata = false; this.nodata = false;
this.send = !0;debugger this.send = !0;
stockSearchPage(this.listQuery) stockSearchPage(this.listQuery)
.then(res => { .then(res => {
if (res.code == 1) { if (res.code == 1) {
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
this.nodata = true; this.nodata = true;
} }
} }
this.send = !1;debugger this.send = !1;
}); });
}, },
} }
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<el-input v-model.number="form.price" placeholder="请输入股权单价"></el-input> <el-input v-model.number="form.price" placeholder="请输入股权单价"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="省份" prop="addrProvince"> <el-form-item label="省份" prop="addrProvince">
<el-select v-model.number="form.addrProvince" placeholder="请选择省份(直辖市)"> <el-select v-model.number="form.addrProvince" placeholder="请选择省份(直辖市)" @change="changeProvince">
<el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<el-form-item label="公司图片" prop="drivingLicensePath" :style="{display:'block'}"> <el-form-item label="公司图片" prop="drivingLicensePath" :style="{display:'block'}">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
:action="BASE_API + '/vehicle/branchCompany/stock/upload/companyPic'" :action="BASE_API+ '/vehicle/branchCompany/stock/upload/companyPic'"
:show-file-list="false" :show-file-list="false"
:headers="getHeaderWithToken" :headers="getHeaderWithToken"
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
...@@ -275,6 +275,12 @@ ...@@ -275,6 +275,12 @@
} }
}, },
methods: { methods: {
/**
* 改变省份,清空城市
* */
changeProvince(){
this.form.addrCity = undefined;
},
getCompanyPicUrl(companyPic) { getCompanyPicUrl(companyPic) {
return process.env.BASE_API + return process.env.BASE_API +
'/vehicle/branchCompany/stock/download/companyPic?realFileRelPath=' + encodeURI(companyPic); '/vehicle/branchCompany/stock/download/companyPic?realFileRelPath=' + encodeURI(companyPic);
...@@ -424,7 +430,7 @@ ...@@ -424,7 +430,7 @@
this.getList(); this.getList();
}, },
choiceImg(){ choiceImg(){
this.$refs.filElem.dispatchEvent(new MouseEvent('click')) this.$refs.filElem.dispatchEvent(new MouseEvent('click'))
}, },
getFile(event){ getFile(event){
let formData = new FormData(); let formData = new FormData();
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
}, },
mounted() { mounted() {
let row = this.upkeepRow; let row = this.upkeepRow;
this.cleanUpkeepForm();debugger this.cleanUpkeepForm();
this.upkeepForm.branchCompanyId = row.subordinateBranch; this.upkeepForm.branchCompanyId = row.subordinateBranch;
let that = this; let that = this;
let selectArry = []; let selectArry = [];
......
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
select = ii; select = ii;
} }
}); });
this.lists.map(function(iitem){debugger this.lists.map(function(iitem){
if(iitem.id == item.id){ if(iitem.id == item.id){
iitem.name = select.name; iitem.name = select.name;
iitem.address = select.address; iitem.address = select.address;
...@@ -140,7 +140,6 @@ ...@@ -140,7 +140,6 @@
iitem.latitude = select.latitude; iitem.latitude = select.latitude;
} }
}); });
debugger
}, },
/** /**
* 深拷贝 * 深拷贝
...@@ -208,7 +207,6 @@ ...@@ -208,7 +207,6 @@
} }
}); });
}); });
debugger
// this.lists.map(function) // this.lists.map(function)
this.$emit('departureEvent', this.lists); this.$emit('departureEvent', this.lists);
console.log( this.lists) console.log( this.lists)
......
...@@ -512,7 +512,7 @@ ...@@ -512,7 +512,7 @@
tagDTOS.push({tagId: item.id}); tagDTOS.push({tagId: item.id});
} }
}); });
let siteDTOS = [];debugger let siteDTOS = [];
//出发地 //出发地
this.departureList.map(function(item){ this.departureList.map(function(item){
let p = { let p = {
...@@ -710,7 +710,7 @@ ...@@ -710,7 +710,7 @@
/** /**
* 编辑一条途径地 * 编辑一条途径地
**/ **/
editPathway(item){debugger editPathway(item){
this.onePathObj = item; this.onePathObj = item;
this.onePathObj.showTitle = "途径地编辑";//弹框名称 this.onePathObj.showTitle = "途径地编辑";//弹框名称
this.onePathObj.headTitle = "途径地名称"; this.onePathObj.headTitle = "途径地名称";
...@@ -857,7 +857,7 @@ ...@@ -857,7 +857,7 @@
/** /**
* 封面图上传 * 封面图上传
* **/ * **/
handleAvatarSuccess(res, file){debugger handleAvatarSuccess(res, file){
this.form.cover = res.data; this.form.cover = res.data;
}, },
/** /**
......
...@@ -66,9 +66,9 @@ ...@@ -66,9 +66,9 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="所属地区" prop="zoneId"> <el-form-item label="所属地区" prop="zoneId">
<el-select class="filter-item" v-model="listQuery.zoneId" placeholder="请选择"> <el-select class="filter-item" v-model="listQuery.zoneId" placeholder="请选择" @change="getProvinceRegions">
<el-option :key="undefined" label="无" :value="undefined"></el-option> <el-option :key="undefined" label="无" :value="undefined"></el-option>
<el-option v-for="(val, key, index) in getAllZone()" :key="val.code" :label="val.val" :value="val.code"> </el-option> <el-option v-for="val in getAllZoneList" :key="val.id" :label="val.name" :value="val.id"> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!--<el-form-item label="片区" prop="addrCity">--> <!--<el-form-item label="片区" prop="addrCity">-->
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="省份"> <el-form-item label="省份">
<el-select class="filter-item" v-model="listQuery.addrProvince" placeholder="请选择省份(直辖市)" @change='getValue'> <el-select class="filter-item" v-model="listQuery.addrProvince" placeholder="请选择省份(直辖市)" @change='getValue'>
<el-option :key="undefined" label="无" :value="undefined"></el-option> <el-option :key="undefined" label="无" :value="undefined"></el-option>
<el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in provinceRegions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
...@@ -499,6 +499,18 @@ ...@@ -499,6 +499,18 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="车型">
<el-select v-model="form.modelId" filterable placeholder="请选择">
<el-option
v-for="item in allVehicleList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<!--<el-col :span="12">--> <!--<el-col :span="12">-->
<!--<el-form-item label="收车时间" prop="receiveTime">--> <!--<el-form-item label="收车时间" prop="receiveTime">-->
<!--<el-date-picker--> <!--<el-date-picker-->
...@@ -726,9 +738,14 @@ ...@@ -726,9 +738,14 @@
book, book,
getBookedInfoIn2Month, getBookedInfoIn2Month,
getBookedInfo, getBookedInfo,
putObj putObj,
getSysRegionByIds
} from 'api/vehicle/vehicleInfo/'; } from 'api/vehicle/vehicleInfo/';
import {
getAllVehicleList
} from 'api/vehicleType';
import { import {
getConstantByTypeAndCode, getConstantByTypeAndCode,
getConstantListByType, getConstantListByType,
...@@ -792,10 +809,12 @@ ...@@ -792,10 +809,12 @@
import { import {
getAllZone getAllZone
} from 'api/base_info/constant/'; } from 'api/base_info/constant/';
import ElFormItem from "../../../../node_modules/element-ui/packages/form/src/form-item.vue";
export default { export default {
name: 'vehicleInfo', name: 'vehicleInfo',
components: { components: {
ElFormItem,
ElCol, ElCol,
ElRow, ElRow,
Element1, Element1,
...@@ -811,8 +830,10 @@ ...@@ -811,8 +830,10 @@
dialogForm4LicenceVisible: false, dialogForm4LicenceVisible: false,
licenceSrcUrl: undefined, licenceSrcUrl: undefined,
showLoadingBody: false, showLoadingBody: false,
allVehicleList: [],//全部车型
form: { form: {
state2:'', state2:'',
modelId:undefined,//车型id
status: undefined, status: undefined,
code: undefined, code: undefined,
numberPlate: undefined, numberPlate: undefined,
...@@ -1091,11 +1112,14 @@ ...@@ -1091,11 +1112,14 @@
arrivalBranchCompanyName: '' arrivalBranchCompanyName: ''
}, },
upkeepDialogVisible: false, upkeepDialogVisible: false,
allUpkeepItems: null allUpkeepItems: null,
allZoneArr:[],//全部片区
provinceRegions: [],//片区下省份数据
} }
}, },
created() { created() {
this.getList(); this.getList();
this.getAllVehicleType();//获取全部车型
getAll() getAll()
.then(response => { .then(response => {
this.allCompaniesArr = response.data; this.allCompaniesArr = response.data;
...@@ -1116,9 +1140,6 @@ ...@@ -1116,9 +1140,6 @@
'belong2Type', 'belong2Type',
'vehicleStatus' 'vehicleStatus'
]), ]),
provinceRegions() {
return getSonRegionByCodes(1);
},
cityRegions() { cityRegions() {
if (!this.$utils.isInteger(this.form.addrProvince)) { if (!this.$utils.isInteger(this.form.addrProvince)) {
return null; return null;
...@@ -1137,6 +1158,10 @@ ...@@ -1137,6 +1158,10 @@
} }
return getSonRegionByCodes(this.listQuery.addrProvince); return getSonRegionByCodes(this.listQuery.addrProvince);
}, },
getAllZoneList(){
this.allZoneArr = getAllZone();
return getAllZone();
},
townRegions4Query() { townRegions4Query() {
if (!this.$utils.isInteger(this.listQuery.addrCity)) { if (!this.$utils.isInteger(this.listQuery.addrCity)) {
return null; return null;
...@@ -1244,10 +1269,43 @@ ...@@ -1244,10 +1269,43 @@
} }
}, },
methods: { methods: {
getAllZone, /**
* 根据片区获取省份数据
* */
getProvinceRegions() {
let that = this;
this.listQuery.addrCity = undefined;
this.listQuery.addrProvince = undefined;
if (!this.$utils.isInteger(this.listQuery.zoneId)) {
return null;
}
this.allZoneArr.map(function(item){
if(item.id == that.listQuery.zoneId){
getSysRegionByIds(item.provinceIds).then(response => {
let listRs = undefined;
if (!that.$utils.isEmpty(response.data)) {
listRs = response.data;
}
that.provinceRegions = listRs;
});
}
});
},
getValue(e){ getValue(e){
this.listQuery.addrCity = undefined; this.listQuery.addrCity = undefined;
}, },
/**
* 获取全部车型
* */
getAllVehicleType() {
getAllVehicleList().then(response => {
let listRs = undefined;
if (!this.$utils.isEmpty(response.data)) {
listRs = response.data;
}
this.allVehicleList = listRs;
});
},
/** /**
* 刷新 * 刷新
* */ * */
...@@ -1667,7 +1725,7 @@ ...@@ -1667,7 +1725,7 @@
getAllVehicleStatus: function () { getAllVehicleStatus: function () {
return this.vehicleStatus; return this.vehicleStatus;
}, },
getBrand: function (code) {debugger getBrand: function (code) {
if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) { if (!this.$utils.isInteger(code) || code == VEHICLE_CONSTANT_BRAND_CODE_UNKOWN) {
return '未知'; return '未知';
} }
...@@ -1751,9 +1809,8 @@ ...@@ -1751,9 +1809,8 @@
this.$utils.objectEach(response.data, (item, key) => { this.$utils.objectEach(response.data, (item, key) => {
this.form[key] = item; this.form[key] = item;
}); });
selectArry.map(function (iitem) { selectArry.map(function (iitem) {
if( that.form["parkBranchCompanyId"] == iitem.id){ if( that.form["subordinateBranch"] == iitem.id){
that.form.state2 = iitem.name; that.form.state2 = iitem.name;
that.form.subordinateBranch = iitem.id; that.form.subordinateBranch = iitem.id;
} }
...@@ -1932,6 +1989,7 @@ ...@@ -1932,6 +1989,7 @@
status: undefined, status: undefined,
code: undefined, code: undefined,
state2:undefined, state2:undefined,
modelId:undefined,//车型id
numberPlate: undefined, numberPlate: undefined,
brand: undefined, brand: undefined,
subordinateBranch: undefined, subordinateBranch: undefined,
......
...@@ -524,7 +524,7 @@ ...@@ -524,7 +524,7 @@
i.children.map(function (ic) { i.children.map(function (ic) {
if(ic.id == that.childName){ if(ic.id == that.childName){
i.selectChild = ic.name; i.selectChild = ic.name;
let a = [];debugger let a = [];
i.childNameLists[0] = that.childName; i.childNameLists[0] = that.childName;
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment