Commit 0ab57171 authored by lixy's avatar lixy

片区-车辆添加车型关联

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