Commit 9b2ca6b5 by 张杰

修复bug

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