Browse Source

车辆管理进行接口对接

xiaowang-featrue
是小王呀\24601 10 months ago
parent
commit
aaba40c3fc
  1. 2
      src/views/modules/base/orgUnitManger/index.vue
  2. 29
      src/views/modules/base/vehicleManger/add.vue
  3. 186
      src/views/modules/base/vehicleManger/index.vue
  4. 414
      src/views/modules/base/vehicleManger/info.vue

2
src/views/modules/base/orgUnitManger/index.vue

@ -502,7 +502,7 @@
//
async getTableData() {
// const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/project-list";
const url = "/voluntary/pointsAward/admin/list";
const url = "/customerAgencyUnit/page";
let params = {
pageNo: this.pageNo,
shelveOnTimeFrom: this.formData.shelveOnTimeFrom,

29
src/views/modules/base/vehicleManger/add.vue

@ -7,8 +7,8 @@
<el-row>
<el-col :span="12">
<el-form-item label="所属组织" prop="ownerName" label-width="100px">
<el-cascader class="u-item-width-normal" ref="myCascader" clearable size="small"
v-model.trim="formData.agencyId" :options="orgOptions" :props="orgOptionProps"
<el-cascader v-model="formData.agencyId" class="u-item-width-normal" ref="cascader_Ref" clearable size="small"
:options="orgOptions" :props="orgOptionProps"
@change="handleChangeAgency"></el-cascader>
</el-form-item>
</el-col>
@ -125,9 +125,10 @@
value: 'agencyId',
label: 'agencyName',
children: 'subAgencyList',
emitPath: false,
emitPath: true,
multiple: false,
checkStrictly: true
},//
showdisabled:false,
searchOptions:[],
@ -178,6 +179,28 @@
},
methods: {
initForm(type,row){
if(type=="edit"){
this.formData=row
}
},
// handleClick() {
// // id
// if (this.formData.agencyId) {
// this.formData.orgIdPath += this.formData.agencyId + '-'; // '-'
// }
// console.log(' ID:', this.formData.orgIdPath);
// },
handleChangeAgency(valuePath) {
console.log("选择的值:", valuePath, this.$refs.cascader_Ref.getCheckedNodes()[0].pathLabels.join(" / ")); //
this.formData.orgIdPath =valuePath.toString(); // '-'
this.formData.agencyId=valuePath[valuePath.length-1]
this.formData.orgNamePath=this.$refs.cascader_Ref.getCheckedNodes()[0].pathLabels.toString()
console.log("选择的值:", this.formData.orgIdPath, this.formData.orgNamePath, this.formData.agencyId); //
},
//
getOrgTreeList() {
this.$http

186
src/views/modules/base/vehicleManger/index.vue

@ -6,38 +6,37 @@
<el-form :inline="true" class="communityHeight" ref="ref_searchform" :label-width="'100px'">
<el-form-item label="所属组织" prop="ownerName">
<el-cascader class="u-item-width-normal" ref="myCascader" clearable size="small"
v-model.trim="formData.redeemOrgId" :options="orgOptions" :props="orgOptionProps"
v-model.trim="formData.agencyId" :options="orgOptions" :props="orgOptionProps"
@change="handleChangeAgency"></el-cascader>
</el-form-item>
<el-form-item label="车辆类型" prop="ownerPhone">
<el-select class="u-item-width-normal" v-model="formData.classKey" placeholder="请选择" clearable>
<el-option v-for="item in optionsStatus" :key="item.value" :label="item.lable" :value="item.value">
</el-option>
</el-select>
<el-form-item label="车辆类型" prop="carType">
<el-input v-model.trim="formData.carType" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="车牌号码" prop="ownerPhone">
<el-input v-model.trim="ownerPhone" class="u-item-width-normal" size="small" clearable
placeholder="请输入联系电话">
<el-input v-model.trim="formData.carNumber" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="车牌品牌" prop="ownerPhone">
<el-input v-model.trim="ownerPhone" class="u-item-width-normal" size="small" clearable
placeholder="请输入联系电话">
<el-input v-model.trim="formData.carBrand" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="车主姓名" prop="ownerPhone">
<el-input v-model.trim="ownerPhone" class="u-item-width-normal" size="small" clearable
placeholder="请输入联系电话">
<el-input v-model.trim="formData.carOwnerName" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="车主电话" prop="ownerPhone">
<el-input v-model.trim="ownerPhone" class="u-item-width-normal" size="small" clearable
placeholder="请输入联系电话">
<el-input v-model.trim="formData.carOwnerMobile" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="车主证件号" prop="ownerPhone">
<el-input v-model.trim="ownerPhone" class="u-item-width-normal" size="small" clearable
placeholder="请输入联系电话">
<el-input v-model.trim="formData.carOwnerNum" class="u-item-width-normal" size="small" clearable
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="录入时间" prop="ownerPhone">
@ -83,32 +82,31 @@
</div>
<div class="m-table-item">
<el-table :data="tableData" border :show-overflow-tooltip="true" style="width: 100%">
<el-table-column width="55">
<el-table :data="tableData" border :show-overflow-tooltip="true" style="width: 100%" @select-All="selectAll" @selection-change="selectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column width="70" type="index" label="序号" header-align="center" align="center">
</el-table-column>
<el-table-column fixed="left" width="70" type="index" label="序号" header-align="center" align="center">
<el-table-column prop="orgNamePath" label="所属组织" header-align="left" align="left" min-width="180">
</el-table-column>
<el-table-column prop="orgNamePath" fixed="left" label="所属组织" header-align="left" align="left"
min-width="180"> </el-table-column>
<el-table-column prop="neighborHoodName" label="车牌号码" header-align="left" align="left" min-width="160">
<el-table-column prop="carNumber" label="车牌号码" header-align="left" align="left" min-width="160">
</el-table-column>
<el-table-column prop="buildingType" label="车辆类型" header-align="left" align="left" width="90">
<el-table-column prop="carType" label="车辆类型" header-align="left" align="left" width="90">
</el-table-column>
<el-table-column prop="buildingLeaderName" label="车辆颜色" header-align="left" align="left" min-width="90">
<el-table-column prop="carColor" label="车辆颜色" header-align="left" align="left" min-width="90">
</el-table-column>
<el-table-column prop="buildingLeaderMobile" label="核载人数" header-align="left" align="left" min-width="110">
<el-table-column prop="carriersNum" label="核载人数" header-align="left" align="left" min-width="110">
</el-table-column>
<el-table-column prop="totalUnitNum" header-align="left" align="left" label="车辆品牌">
<el-table-column prop="carBrand" header-align="left" align="left" label="车辆品牌">
</el-table-column>
<el-table-column prop="totalFloorNum" header-align="left" align="left" label="购置日期">
<el-table-column prop="acquistionDate" header-align="left" align="left" label="购置日期">
</el-table-column>
<el-table-column prop="realTotalHouseNum" header-align="left" align="left" width="90" label="车主姓名">
<el-table-column prop="carOwnerName" header-align="left" align="left" width="90" label="车主姓名">
</el-table-column>
<el-table-column prop="realTotalHouseNum" header-align="left" align="left" width="90" label="车主电话">
<el-table-column prop="carOwnerMobile" header-align="left" align="left" width="90" label="车主电话">
</el-table-column>
<el-table-column prop="realTotalHouseNum" header-align="left" align="left" width="90" label="车主证件号">
<el-table-column prop="carOwnerNum" header-align="left" align="left" width="90" label="车主证件号">
</el-table-column>
<el-table-column prop="realTotalHouseNum" header-align="left" align="left" width="90" label="录入时间">
<el-table-column prop="cteatedtime" header-align="left" align="left" width="90" label="录入时间">
</el-table-column>
<el-table-column label="操作" fixed="right" width="220" header-align="center" align="center" class="operate">
<template slot-scope="scope">
@ -148,7 +146,9 @@
import CDialog from "@c/CDialog";
import add from "./add.vue";
// import info from "./info.vue";
import info from "./info.vue"
import info from "./info.vue";
// import axios form "axios"
import axios from 'axios';
// import buildTable from "./buildTable";
// import roomTable from "./roomTable";
import { requestPost, requestGet } from "@/js/dai/request";
@ -160,6 +160,7 @@
export default {
data() {
return {
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
//
optionsStatus:[
{
@ -201,56 +202,7 @@
showAdd:false,
formTitle:"",
tableData: [
{
buildingName: '区划A',
neighborHoodName: '小区1',
buildingType: '住宅',
buildingLeaderName: '张三',
buildingLeaderMobile: '13812345678',
totalUnitNum: '单位A',
totalFloorNum: '5层',
realTotalHouseNum: '123456',
},
{
buildingName: '区划B',
neighborHoodName: '小区2',
buildingType: '商用',
buildingLeaderName: '李四',
buildingLeaderMobile: '13898765432',
totalUnitNum: '单位B',
totalFloorNum: '8层',
realTotalHouseNum: '654321',
},
{
buildingName: '区划C',
neighborHoodName: '小区3',
buildingType: '住宅',
buildingLeaderName: '王五',
buildingLeaderMobile: '13812349876',
totalUnitNum: '单位C',
totalFloorNum: '3层',
realTotalHouseNum: '123789',
},
{
buildingName: '区划D',
neighborHoodName: '小区4',
buildingType: '工业',
buildingLeaderName: '赵六',
buildingLeaderMobile: '13867891234',
totalUnitNum: '单位D',
totalFloorNum: '12层',
realTotalHouseNum: '789123',
},
{
buildingName: '区划E',
neighborHoodName: '小区5',
buildingType: '住宅',
buildingLeaderName: '钱七',
buildingLeaderMobile: '13854321098',
totalUnitNum: '单位E',
totalFloorNum: '6层',
realTotalHouseNum: '987654',
}
],//
orgOptions:[],//
orgOptionProps: {
@ -261,6 +213,7 @@
multiple: false,
checkStrictly: true
},//
selection: [],//
};
},
@ -268,10 +221,12 @@
add,info
},
async mounted() {
this.handleSearch()
this.getOrgTreeList()
await this.loadOrgData();
},
computed: {
rowHeight() {
return this.$store.state.inIframe
? this.clientHeight - 140 + this.iframeHeight + "px"
@ -300,6 +255,13 @@
},
methods: {
selectAll(selection) {
this.selection = selection;
},
selectionChange(selection) {
console.log(selection,"sdflkjlksfd ");
this.selection = selection;
},
//
handleSizeChange(val) {
this.pageSize = val;
@ -312,7 +274,7 @@
},
//
deleteBatch() {
deleteBatch(row) {
if (this.selection.length > 0) {
this.$confirm("删除之后无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
@ -327,22 +289,23 @@
}
});
} else {
this.$message.warning("请先选择要删除的居民");
this.$message.warning("请先选择要删除的车辆");
}
},
//
async deleteresiBatch() {
if (this.selection.length === 0)
return this.$message.error("请选择之后进行操作");
let userIds = this.selection.map((item) => item.resiId);
let ids = this.selection.map((item) => item.id);
this.$http
.post("/actual/base/residentBaseInfo/batchdel", userIds)
.then(({ data: res }) => {
if (res.code !== 0) {
.post("/epmetuser/carInfo/delete", ids)
.then(res => {
console.log(res,"sdflkjkjsfld");
if (res.data.code !== 0) {
return this.$message.error(res.msg);
} else {
this.$message.success("删除成功");
this.handleSearchFrom();
this.getTableData();
}
})
.catch((err) => {
@ -368,7 +331,7 @@
const formData = new FormData(); //FormDataappend('key', value)
formData.append('file', file.file); //
formData.append('code', ''); //
let url = '/governance/icEvent/importEvent'
let url = window.SITE_CONFIG["apiURL"]+'/governance/icEvent/importEvent'
if (this.importType == 2) {
url = '/governance/icEvent/importAwo'
}
@ -432,11 +395,11 @@
},
//
async handleExport() {
const url = "/governance/icEvent/export";
const url = "/epmetuser/carInfo/export";
const { pageSize, pageNo, formData } = this;
axios({
url: window.SITE_CONFIG["apiURL"] + url,
method: "post",
method: "get",
data: {
pageSize,
pageNo,
@ -473,14 +436,16 @@
})
.then(() => {
console.log(row.id,"online");
let url="/voluntary/pointsAward/admin/delete"
let params={
id:row.id
}
requestPost(url,params).then((res)=>{
console.log(res,"res");
this.getTableData()
let url="/epmetuser/carInfo/delete"
let ids= [row.id]
requestPost(url,ids).then((res)=>{
if (res.data.code==0) {
this.$message.success("删除成功")
this.getTableData()
}else{
this.$message.error("删除失败")
}
})
})
.catch(err => {
@ -497,11 +462,12 @@
const url = "/epmetuser/carInfo/page";
let params = {
pageNo: this.pageNo,
shelveOnTimeFrom: this.formData.shelveOnTimeFrom,
redeemOrgId: this.formData.redeemOrgId,
pageTo: this.pageSize,
classKey: this.formData.classKey,
shelveOnTimeTo: this.formData.shelveOnTimeTo
// shelveOnTimeFrom: this.formData.shelveOnTimeFrom,
// redeemOrgId: this.formData.redeemOrgId,
...this.formData,
pageSize: this.pageSize,
// classKey: this.formData.classKey,
// shelveOnTimeTo: this.formData.shelveOnTimeTo
}
const { data, code, msg } = await requestGet(url, params)
@ -558,12 +524,12 @@
return this.$message.error("网络错误");
});
},
handleDetail(){
handleDetail(row){
this.formTitle = '查看'
this.showinfo = true
// this.$nextTick(() => {
// this.$refs.ref_form.initForm("info", "");
// });
this.$nextTick(() => {
this.$refs.ref_form.initForm("info", row);
});
},
showAddClose(){
console.log("23132132d");
@ -576,7 +542,7 @@
this.$refs.ref_form.initForm("add", "");
});
},
handleEdit() {
handleEdit(row) {
this.formTitle ='编辑'
this.showAdd = true
this.$nextTick(() => {

414
src/views/modules/base/vehicleManger/info.vue

@ -5,58 +5,65 @@
<el-form ref="ref_form" :inline="true" :model="formData" :rules="dataRule" class="form">
<el-row>
<el-col :span="12">
<el-form-item label="所有组织" label-width="100px" prop="orgNamePath">
{{formData.orgNamePath}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车牌号码" label-width="100px" prop="name">
{{formData.carNumber}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车主姓名" label-width="100px" prop="name">
{{formData.carOwnerName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车主电话" label-width="100px" prop="name">
{{ formData.carOwnerMobile}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车主身份证" label-width="100px" prop="name">
{{ formData.carOwnerNum}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车辆品牌" label-width="100px" prop="name">
{{ formData.carBrand}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="linkPhone" label-width="100px">
<el-form-item label="车辆类型" prop="linkPhone" label-width="100px">
{{ formData.carBrand}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车辆颜色" prop="linkPhone" label-width="100px">
{{ formData.carColor}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="核载人数" prop="linkPhone" label-width="100px">
{{ formData.carriersNum}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="购置日期" prop="linkPhone" label-width="100px">
<!-- <span style="margin: 0 10px"></span><el-date-picker
v-model="formData.shelveOnTimeTo" type="datetime" placeholder="结束时间"
format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker> -->
{{ formData.acquistionDate}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" label-width="100px" prop="name">
{{ formData.remake}}
</el-form-item>
</el-col>
</el-row></el-form>
@ -89,7 +96,6 @@
export default {
data() {
return {
showdisabled:false,
searchOptions:[],
fileList:[],
@ -103,14 +109,8 @@
tableDate:{},
formData:
{
attrs:[],
positionId:"",//
address: "",//
longitude: this.$store.state.user.longitude, //
latitude: this.$store.state.user.latitude,//
},
uploadUrl: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadqrcodeV2',
customerId: localStorage.getItem('customerId'),
}
@ -118,379 +118,15 @@
components: { Tinymce, UploadImage },
mounted() {
this.getSiteTableData()
this.formData.agencyId=this.$store.state.user.agencyId
this.formData.agencyName=this.$store.state.user.agencyName
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
this.formData.latitude = latitude;
this.formData.longitude = longitude;
this.activityType()
},
methods: {
//
async getSiteTableData() {
// const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/project-list";
const url = "/voluntary/position/list";
let params = {
name: "",
type: "",
pageNo: "",
pageSize: ""
}
const { data, code, msg } = await requestGet(url, params);
if (code === 0) {
console.log("列表请求成功!!!!!!!!!!!!!!");
// this.total = data.total || 0;
this.SiteData = data.list
} else {
}
},
//
async initForm(type, unitId) {
console.log(type, unitId,"i就理解哦i");
if(type=="info"){
this.showdisabled=true
this.getTableDetail(unitId)
}
if (type == "edit") {
this.getTableDetail(unitId)
}
},
//
getTableDetail(id) {
console.log(id,"dskljfksdljf");
let url = `/voluntary/positionVenues/edit/${id}`;
requestGet(url).then((res) => {
console.log(res);
if (res.code == 0) {
this.formData = res.data
this.searchValue= res.data.address
this.fileList=[{fileUrl:res.data.attrs[0].url}]
} else {
this.$message.error(res.msg)
}
})
},
async activityType() {
this.$nextTick(() => {
if (!map) {
this.initMap(this.formData.latitude, this.formData.longitude);
console.log("map", map,this.formData.latitude, this.formData.longitude)
} else {
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
console.log("mapmapmap", map)
}
})
},
handleOnlineRegistration(value) {
//
if (value) {
this.online = true;
this.formData.online = 1;
} else {
this.online = false;
this.formData.cutOffTime = ''
this.formData.online = 0;
}
},
onChangeFileList(e) {
console.log(e, 'sssssb');
this.fileList = e.length > 0 ? e.map(item => ({
fileType: '0',
type:'image',
fileType: '0',
name:item.response.data.fileName,
fileUrl: item.response.data.url,
format: item.response.data.fileName.split('.').pop(),
url: item.response.data.url
})) : []; // efileList
if (e.length > 0) {
console.log(this.fileList,"this.fileList");
this.formData.attrs=this.fileList;
console.log(this.formData.attrs,"this.fileList");
} else {
this.formData.coverPic = '';
}
},
removedImg() {
this.formData.coverPic = ''
},
onChangeFileList1(e) {
console.log(e, 'sssssb');
this.fileList1 = e.length > 0 ? e.map(item => ({
fileType: '0',
fileUrl: item.response.data.url
})) : []; // efileList
if (e.length > 0) {
this.formData.brandImg = e[0].response.data.url;
} else {
this.formData.brandImg = '';
}
},
onChangeImgs(e, rowIndex = 0) {
console.log('onChangeFileList', e)
if (e.length > 0) {
this.activityImgs = []
e.forEach(item => {
let ob = {
fileType: '0',
fileUrl: item.response.data.url
}
this.activityImgs.push(ob)
})
}
},
// onChangeImgs(e) {
// this.activityImgs = [];
// if (e.length > 0) {
// e.forEach(item => {
// let ob = {
// fileType: '0',
// fileUrl: item.response.data.url
// };
// this.activityImgs.push(ob);
// });
// console.log('this.activityImgs',this.activityImgs)
// }
// },
handleChange(value) {},
handleTimeChange(time) {
if (time) {
const startTimeArray = util.dateFormatter(time[0], 'time').split('-')
console.log(startTimeArray);
const endTimeArray = util.dateFormatter(time[1], 'time').split('-')
console.log(endTimeArray);
this.formData.startTime = startTimeArray[0] + '-' + startTimeArray[1] + '-' + startTimeArray[2]
this.formData.endTime = endTimeArray[0] + '-' + endTimeArray[1] + '-' + endTimeArray[2]
// this.startTimeShow = startTimeArray[0] + '' + startTimeArray[1] + '' + startTimeArray[2] + ''
// this.endTimeShow = endTimeArray[0] + '' + endTimeArray[1] + '' + endTimeArray[2] + ''
} else {
this.formData.startTime = ''
this.formData.endTime = ''
}
},
async getDemandOptions() {
this.$http
.post("/actual/base/serviceitem/listAllCategory")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
} else {
console.log(res.data);
this.demandOptions = this.getFlagData(
this.getTreeData(res.data),
"usableFlag"
);
}
})
.catch(() => {
return this.$message.error("网络错误");
});
},
getFlagData(data, flag) {
if (!Array.isArray(data)) return [];
let arr1 = data.filter((item) => item[flag]);
let arr2 = arr1.map((item) => {
if (item.childCateList)
return { ...item, childCateList: this.getFlagData(item.childCateList, flag) };
else return item;
});
return arr2;
},
getTreeData(data) {
if (!Array.isArray(data)) return [];
let arr = data.map((item) => {
let _item = {};
if (item.childCateList) {
if (item.childCateList.length === 0)
_item = { ...item, childCateList: undefined };
else _item = { ...item, childCateList: this.getTreeData(item.childCateList) };
} else {
_item = { ...item };
}
return _item;
});
return arr;
},
async loadGrid() {
const url = "/gov/org/customergrid/gridoption"
let params = {
agencyId: this.agencyId
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.gridList = data
} else {
this.$message.error(msg)
}
},
async handleComfirm() {
console.log(this.formData," this.formData");
if (!this.formData.address) {
this.$message.error('请输入具体位置');
return;
}
if (!this.formData.attrs ) {
this.$message.error('请上传图片');
return;
}
if (!this.formData.linkPhone) {
this.$message.error('请填写联系电话');
return;
}
if (!this.formData.positionId) {
this.$message.error('请选择挂靠阵地');
return;
}
this.addActivity()
},
//
async addActivity() {
let url = '/voluntary/positionVenues/saveOrUpdate'
const { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
// this.resetData()
this.$emit('showAddClose')
} else {
this.$message.error(msg)
}
},
handleCancle() {
console.log("sdlkfjklsdf ");
this.$emit('showAddClose')
},
// init
initMap(latitude, longitude) {
console.log(latitude, longitude,"564564568");
map = new daiMap(
document.getElementById("app_activity"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
//
/* map.on("dragend", (e) => {
this.handleMoveCenter(e);
});*/
map.on("click", (e) => {
this.handleMoveCenter(e);
});
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
async handleMoveCenter(e) {
//
// const { lat, lng } = map.getCenter();
const { lat, lng } = e.latLng;
this.formData.latitude = lat;
this.formData.longitude = lng;
map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address;
this.searchValue=data.address
console.log(this.formData.address," this.formData.address ");
this.searchValue = data.address
this.searchOptions = []
// console.log('data,this.searchValue ', this.searchValue)
}
},
async remoteMethod(query) {
console.log(query, "sfsvsdv");
if (query !== '') {
const { msg, data } = await map.searchNearby(query);
this.resultList = []
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList
console.log(this.resultList, "this.resultList");
this.searchOptions = this.resultList.map(item => {
return { value: `${item.id}`, label: `${item.address + item.title}` };
});
console.log(this.searchOptions, "this.searchOptions");
}
} else {
this.searchOptions = [
{
value: '0',
label: '未检索到结果'
}
]
}
} else {
this.searchOptions = [];
}
},
handleClickKey(index) {
let selPosition = this.resultList[index]
let lonlat = selPosition.lonlat.split(" ")
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.formData.latitude = lonlat[1];
this.formData.longitude = lonlat[0];
this.formData.address=selPosition.address + selPosition.nam
this.searchValue = selPosition.address + selPosition.name
console.log(this.formData.address," this.formData.address ");
},
initForm(type,row){
this.formData=row
console.log(this.formData,"sdjkkds");
},

Loading…
Cancel
Save