Commit 9b2ca6b5 by 张杰

修复bug

1 parent b8d29e5d
...@@ -32,29 +32,37 @@ export default { ...@@ -32,29 +32,37 @@ export default {
}; };
}, },
watch: { watch: {
value: { // value: {
handler: function (n, o) { // handler: function (n, o) {
if (n) { // if (n) {
this.init(); // this.init();
} // }
}, // },
immediate: true, // immediate: true,
}, // },
}, },
mounted() { mounted() {
//this.city = this.value; //this.city = this.value;
this.init();
}, },
methods: { methods: {
onChange(e) { onChange(e) {
console.log(e); console.log(e);
let list = this.cityList; let list = this.cityList;
let nameList = []
let m = list.find((k) => k.code == e[0]); let m = list.find((k) => k.code == e[0]);
console.log(m)
nameList.push(m.name)
let n = m.children.find((k) => k.code == e[1]); let n = m.children.find((k) => k.code == e[1]);
let b = (n.children || []).find((k) => k.code == e[2]); let b = (n && n.children || []).find((k) => k.code == e[2]);
if (n) { if (n) {
this.$emit("input", n.name); this.$emit("input", n.name);
nameList.push(n.name)
}
if(b){
nameList.push(b.name)
} }
this.$emit("change", { code: e, name: [m.name, n.name, b.name] }); this.$emit("change", { code: e, name: nameList });
}, },
// 初始化 // 初始化
......
...@@ -20,5 +20,5 @@ export const CONSTANT = { ...@@ -20,5 +20,5 @@ export const CONSTANT = {
API_URL: '/ots/', API_URL: '/ots/',
MAP_KEY, MAP_KEY,
MAP_PLUGINS, MAP_PLUGINS,
AMAP_URL: `https://webapi.amap.com/maps?v=1.4.2&key=${MAP_KEY}&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.DistrictSearch,AMap.Autocomplete,AMap.MarkerClusterer,AMap.MouseTool,AMap.Text,AMap.Scale` AMAP_URL: `https://webapi.amap.com/maps?v=1.4.2&key=${MAP_KEY}&plugin=${MAP_PLUGINS.toString()}`
} }
\ No newline at end of file \ No newline at end of file
...@@ -51,9 +51,12 @@ ...@@ -51,9 +51,12 @@
<div class="shape_tip" v-show="form.shapeType==3">*注:地图任意位置,单击新增双击结束绘制。</div> <div class="shape_tip" v-show="form.shapeType==3">*注:地图任意位置,单击新增双击结束绘制。</div>
</el-form-item> </el-form-item>
<el-form-item label="围栏半径" prop="radius" v-if="form.shapeType == 1"> <el-form-item label="围栏半径" prop="radius" v-if="form.shapeType == 1">
<el-input placeholder="请输入围栏半径" v-model.trim="form.radius" @input="changeRadius"> <div class="radius_box">
<el-input placeholder="请输入围栏半径" v-model.trim="form.radius">
<template slot="append">米</template> <template slot="append">米</template>
</el-input> </el-input>
<el-button type="primary" class="btn" :disabled="!form.radius" @click="changeRadius">更新围栏</el-button>
</div>
</el-form-item> </el-form-item>
<el-form-item label="省市区" class="is-required" v-if="form.shapeType==4" prop="areaCode"> <el-form-item label="省市区" class="is-required" v-if="form.shapeType==4" prop="areaCode">
<city-select v-model="form.areaCode" :checkStrictly="true" @change="changeArea"></city-select> <city-select v-model="form.areaCode" :checkStrictly="true" @change="changeArea"></city-select>
...@@ -338,7 +341,7 @@ export default { ...@@ -338,7 +341,7 @@ export default {
updateUserData(data) { updateUserData(data) {
this.userArr = data; this.userArr = data;
this.tableData = data; this.tableData = data;
//console.log(data) console.log(data);
}, },
updateMapData(data) { updateMapData(data) {
console.log(data); console.log(data);
...@@ -387,27 +390,45 @@ export default { ...@@ -387,27 +390,45 @@ export default {
// 编辑围栏 // 编辑围栏
if (_this.fenceId) { if (_this.fenceId) {
UPDATE_ELECFENCE_INFO(oParams).then((res) => { UPDATE_ELECFENCE_INFO(oParams)
if (res.code == 200) { .then((res) => {
_this.$message({ _this.submitting = false;
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
showToast({
message: "编辑成功", message: "编辑成功",
type: "success", type: "success",
}); });
_this.cancel(); _this.cancel();
} })
.catch(() => {
_this.submitting = false;
}); });
return false; return false;
} }
// 新增围栏 // 新增围栏
SAVE_ELECFENCE_INFO(oParams).then((res) => { SAVE_ELECFENCE_INFO(oParams)
if (res.code == 200) { .then((res) => {
_this.$message({ _this.submitting = false;
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
showToast({
message: "新增成功", message: "新增成功",
type: "success", type: "success",
}); });
_this.cancel(); _this.cancel();
} })
.catch(() => {
_this.submitting = false;
}); });
}); });
}, },
...@@ -456,7 +477,7 @@ export default { ...@@ -456,7 +477,7 @@ export default {
// 行政区域围栏 // 行政区域围栏
if (form.shapeType == 4) { if (form.shapeType == 4) {
oParams.areaCode = form.areaCode[form.areaCode.length - 1]; oParams.areaCode = form.areaCode[form.areaCode.length - 1];
oParams.areaText = form.areaText[form.areaText.length - 1]; oParams.areaText = form.areaText.toString();
} }
// 监控周期 1:永久有效,2:指定区间 // 监控周期 1:永久有效,2:指定区间
...@@ -476,9 +497,9 @@ export default { ...@@ -476,9 +497,9 @@ export default {
}); });
oParams.snList = list; oParams.snList = list;
} else { } else {
this.userArr.map(k => { this.userArr.map((k) => {
delete k._X_ROW_KEY; delete k._X_ROW_KEY;
}) });
oParams.snList = this.userArr; oParams.snList = this.userArr;
} }
...@@ -577,7 +598,7 @@ export default { ...@@ -577,7 +598,7 @@ export default {
} }
if (obj.lnglat) { if (obj.lnglat) {
let lnglat = obj.lnglat.split(","); let lnglat = obj.lnglat.split(",");
console.log(lnglat) console.log(lnglat);
obj.lng = lnglat[0]; obj.lng = lnglat[0];
obj.lat = lnglat[1]; obj.lat = lnglat[1];
} }
...@@ -663,8 +684,13 @@ export default { ...@@ -663,8 +684,13 @@ export default {
}, },
//监听围栏半径改变 //监听围栏半径改变
changeRadius(e) { changeRadius() {
if (!e) { let e = this.form.radius;
let reg = /^\d+$/;
if (!reg.test(e) || e < 1000) {
showToast({
message: "请输入整数且不小于1000",
});
return false; return false;
} }
this.$refs.fenceMap.updateFence({ this.$refs.fenceMap.updateFence({
...@@ -750,6 +776,12 @@ form { ...@@ -750,6 +776,12 @@ form {
color: #fff; color: #fff;
} }
} }
.radius_box{
display:flex;
.btn{
margin-left:4px;
}
}
</style> </style>
<style > <style >
.scrollbar::-webkit-scrollbar { .scrollbar::-webkit-scrollbar {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<div class="radio_cell"> <div class="radio_cell">
<el-radio :label="1" v-model="form.shapeType">圆形</el-radio> <el-radio :label="1" v-model="form.shapeType">圆形</el-radio>
<el-form-item label="" prop="radius"> <el-form-item label="" prop="radius">
<el-input v-model.trim="form.radius" style="width: 80px;" maxlength="200"></el-input>米 <el-input v-model.trim="form.radius" style="width: 80px;" maxlength="200" @change="changeRadius"></el-input>米
</el-form-item> </el-form-item>
</div> </div>
<div class="radio_cell"> <div class="radio_cell">
...@@ -149,11 +149,8 @@ export default { ...@@ -149,11 +149,8 @@ export default {
}; };
let checkMsgtel = (rule, vaule, cb) => { let checkMsgtel = (rule, vaule, cb) => {
let reg = /^1\d{10}((\,1\d{10})|(\,1\d{10}))?$/ let reg = /^1\d{10}((\,1\d{10})|(\,1\d{10}))?$/;
if ( if (this.form.telNumbers && !reg.test(this.form.telNumbers)) {
this.form.telNumbers &&
!reg.test(this.form.telNumbers)
) {
cb(new Error("请输入正确的格式")); cb(new Error("请输入正确的格式"));
} else { } else {
cb(); cb();
...@@ -458,6 +455,23 @@ export default { ...@@ -458,6 +455,23 @@ export default {
oParams.snList = arr; oParams.snList = arr;
return oParams; return oParams;
}, },
// 监听圆形半径更改
changeRadius(e) {
let reg = /^\d+$/;
if (!reg.test(e) || e < 1000) {
showToast({
message: "请输入整数且不小于1000",
});
return false;
}
this.$refs.fenceMap.updateFence({
fenceType: "circle",
lng: this.form.lng,
lat: this.form.lat,
radius: this.form.radius,
});
},
}, },
}; };
</script> </script>
......
...@@ -187,22 +187,15 @@ export default { ...@@ -187,22 +187,15 @@ export default {
}, },
bindContextMenu() { bindContextMenu() {
const self = this; const self = this;
window.mapMenu = new ContextMenu(this.mapObj); //暴露mapMenu onclick要用 window.mapMenu = new ContextMenu(self.mapObj); //暴露mapMenu onclick要用
console.log(mapMenu);
function ContextMenu(map) { function ContextMenu(map) {
var me = this; var me = this;
var content = [];
this.contextMenuPositon = null; this.contextMenuPositon = null;
content.push('<div class="context_menu" >');
content.push(
'<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>'
);
content.push("</div>");
this.contextMenu = new AMap.ContextMenu({ this.contextMenu = new AMap.ContextMenu({
isCustom: true, isCustom: true,
content: content.join(""), content: `<div class="context_menu" >
<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>
</div>`,
}); });
map.on("rightclick", (e) => { map.on("rightclick", (e) => {
if (self.mapObj.getAllOverlays("circle").length) { if (self.mapObj.getAllOverlays("circle").length) {
...@@ -211,9 +204,7 @@ export default { ...@@ -211,9 +204,7 @@ export default {
} }
}); });
} }
ContextMenu.prototype.moveCenter = function addPOI() {
ContextMenu.prototype.moveCenter = function () {
console.log("6666666666");
self.moveCenter(); self.moveCenter();
this.contextMenu.close(); this.contextMenu.close();
}; };
...@@ -431,11 +422,13 @@ export default { ...@@ -431,11 +422,13 @@ export default {
self.geolocation.getCurrentPosition(); self.geolocation.getCurrentPosition();
AMap.event.addListener(self.geolocation, "complete", function (e) { AMap.event.addListener(self.geolocation, "complete", function (e) {
console.log('complete',e)
//返回定位信息 //返回定位信息
var lnglatXY = mapService.getLngLat(e.position.lng, e.position.lat); var lnglatXY = mapService.getLngLat(e.position.lng, e.position.lat);
resolve(lnglatXY); resolve(lnglatXY);
}); });
AMap.event.addListener(self.geolocation, "error", function (e) { AMap.event.addListener(self.geolocation, "error", function (e) {
console.log('error',e)
//返回定位出错信息 //返回定位出错信息
resolve(mapObj.getCenter()); resolve(mapObj.getCenter());
}); });
......
...@@ -238,6 +238,8 @@ export default { ...@@ -238,6 +238,8 @@ export default {
name: obj.name, name: obj.name,
vin: obj.vin, vin: obj.vin,
userTel: obj.userTel, userTel: obj.userTel,
address: obj.address,
time: obj.time,
}); });
}); });
} else { } else {
...@@ -246,6 +248,8 @@ export default { ...@@ -246,6 +248,8 @@ export default {
name: obj.name, name: obj.name,
vin: obj.vin, vin: obj.vin,
userTel: obj.userTel, userTel: obj.userTel,
address: obj.address,
time: obj.time,
}); });
} }
}); });
......
...@@ -246,8 +246,8 @@ export default { ...@@ -246,8 +246,8 @@ export default {
treeKey: "", treeKey: "",
treeDataList: {}, // 缓存车辆 treeDataList: {}, // 缓存车辆
pageSizeList: {}, pageSizeList: {},
pageSize:10, pageSize: 10,
loadingMore:false loadingMore: false,
}; };
}, },
computed: { computed: {
...@@ -512,9 +512,9 @@ export default { ...@@ -512,9 +512,9 @@ export default {
} }
}, },
loadNode(node, resolve) { loadNode(node, resolve) {
console.log(node) console.log(node);
let _this = this; let _this = this;
let id = node.data.id let id = node.data.id;
const nodeData = node.data; const nodeData = node.data;
const origin = nodeData.origin; const origin = nodeData.origin;
if (nodeData.children) { if (nodeData.children) {
...@@ -535,9 +535,9 @@ export default { ...@@ -535,9 +535,9 @@ export default {
if (data.length) { if (data.length) {
data.map((item) => { data.map((item) => {
item.leaf = true; item.leaf = true;
item.showMore = false item.showMore = false;
}); });
data[data.length-1].showMore = true data[data.length - 1].showMore = true;
_this.treeDataList[id] = data; _this.treeDataList[id] = data;
_this.pageSizeList[id] = oParams.pageNumber; _this.pageSizeList[id] = oParams.pageNumber;
return resolve(data); return resolve(data);
...@@ -618,10 +618,11 @@ export default { ...@@ -618,10 +618,11 @@ export default {
returnTrees: true, returnTrees: true,
}).then((res) => { }).then((res) => {
const items = res.data; const items = res.data;
this.autoOpenLastInfoWindow = true;
this.expandTreeItems(items); this.expandTreeItems(items);
}); });
this.treeHidden = true; this.treeHidden = false;
this.listDialogHidden = true;
} }
} else { } else {
this.checkLoadedTimeoutId = check(); this.checkLoadedTimeoutId = check();
...@@ -1137,8 +1138,8 @@ export default { ...@@ -1137,8 +1138,8 @@ export default {
// 展示更多 // 展示更多
showMore(node, data) { showMore(node, data) {
let o = this.treeDataList["u" + data.parentId]; let o = this.treeDataList["u" + data.parentId];
console.log(node) console.log(node);
console.log(o) console.log(o);
// 不存在 // 不存在
if (!o || o.length <= 0) { if (!o || o.length <= 0) {
return false; return false;
...@@ -1156,7 +1157,7 @@ export default { ...@@ -1156,7 +1157,7 @@ export default {
// 加载下一页 // 加载下一页
loadNext(node, data) { loadNext(node, data) {
console.log(node); console.log(node);
console.log(data) console.log(data);
let _this = this; let _this = this;
let id = "u" + node.data.parentId; let id = "u" + node.data.parentId;
let pageNumber = this.pageSizeList[id]; let pageNumber = this.pageSizeList[id];
...@@ -1166,34 +1167,36 @@ export default { ...@@ -1166,34 +1167,36 @@ export default {
oParams.term = this.searchText; oParams.term = this.searchText;
oParams.pageSize = this.pageSize; oParams.pageSize = this.pageSize;
oParams.pageNumber = pageNumber + 1; oParams.pageNumber = pageNumber + 1;
data.showMore = false data.showMore = false;
_this.loadingMore = true _this.loadingMore = true;
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then((res) => { MONITOR_SERVICE.getVehicleTreeUserList(oParams)
_this.loadingMore = false .then((res) => {
_this.loadingMore = false;
let list = res.data || []; let list = res.data || [];
if (list.length) { if (list.length) {
list.map((item) => { list.map((item) => {
item.leaf = true; item.leaf = true;
item.showMore = false item.showMore = false;
}); });
list[list.length-1].showMore = true list[list.length - 1].showMore = true;
_this.pageSizeList[id] = oParams.pageNumber _this.pageSizeList[id] = oParams.pageNumber;
let treeDataList = _this.treeDataList[id]; let treeDataList = _this.treeDataList[id];
if (treeDataList) { if (treeDataList) {
treeDataList = treeDataList.concat(list); treeDataList = treeDataList.concat(list);
_this.treeDataList[id] = treeDataList _this.treeDataList[id] = treeDataList;
} else { } else {
_this.treeDataList[id] = list; _this.treeDataList[id] = list;
} }
list.map(k => { list.map((k) => {
_this.$refs.tree.append(k,id) _this.$refs.tree.append(k, id);
_this.showMore(node,k) _this.showMore(node, k);
}) });
} }
}).catch(() => { })
_this.loadingMore = false .catch(() => {
_this.loadingMore = false;
}); });
}, },
...@@ -1295,7 +1298,7 @@ export default { ...@@ -1295,7 +1298,7 @@ export default {
.monitor_dialog_header .i_refresh { .monitor_dialog_header .i_refresh {
cursor: pointer; cursor: pointer;
} }
.load_more_link{ .load_more_link {
color:#409EFF; color: #409eff;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!