Commit 0f232a82 by 张杰

修复监控列表树

1 parent 63710f4c
...@@ -381,6 +381,7 @@ export default { ...@@ -381,6 +381,7 @@ export default {
}, },
checkFlow(data, node) { checkFlow(data, node) {
let _this = this;
let action = MONITOR_SERVICE.getVehicleTreeUserIds; let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id }; let params = { oId: data.id };
if (data.origin.type === "u") { if (data.origin.type === "u") {
...@@ -388,10 +389,15 @@ export default { ...@@ -388,10 +389,15 @@ export default {
params = { uId: data.id }; params = { uId: data.id };
} }
console.log('勾选树:',data) console.log("勾选树:", data);
params.termType = this.searchType; params.termType = this.searchType;
params.term = this.searchText; params.term = this.searchText;
if (data.origin.type == "u") {
params.pageSize = _this.pageSize;
params.pageNumber = _this.pageSizeList[data.id] || 1;
}
this.treeLoading = true; this.treeLoading = true;
action(params).then((res) => { action(params).then((res) => {
this.treeLoading = false; this.treeLoading = false;
...@@ -438,7 +444,7 @@ export default { ...@@ -438,7 +444,7 @@ export default {
if (data.children !== undefined) { if (data.children !== undefined) {
data.children.forEach((item, i) => { data.children.forEach((item, i) => {
//this.$refs.tree.setChecked(item, false, true); //this.$refs.tree.setChecked(item, false, true);
this.checkedKeys.push(item.id) this.checkedKeys.push(item.id);
}); });
} }
} }
...@@ -746,12 +752,12 @@ export default { ...@@ -746,12 +752,12 @@ export default {
let _this = this; let _this = this;
arr.forEach((item) => { arr.forEach((item) => {
if (isDevice) { if (isDevice) {
console.log(item.id) console.log(item.id);
let keys = _this.$refs.tree.getCheckedKeys() let keys = _this.$refs.tree.getCheckedKeys();
console.log('keys',keys) console.log("keys", keys);
//_this.$refs.tree.setCheckedKeys(keys); //_this.$refs.tree.setCheckedKeys(keys);
_this.checkedKeys.push(item.id); _this.checkedKeys.push(item.id);
console.log('勾选key:',_this.checkedKeys) console.log("勾选key:", _this.checkedKeys);
this.addMonitor({ this.addMonitor({
sn: item.label, sn: item.label,
name: item.label1, name: item.label1,
...@@ -762,9 +768,9 @@ export default { ...@@ -762,9 +768,9 @@ export default {
sourceType: item.source, sourceType: item.source,
}); });
} else { } else {
console.log('展开节点',item) console.log("展开节点", item);
this.expandedKeys.push(item.id); this.expandedKeys.push(item.id);
console.log(this.expandedKeys) console.log(this.expandedKeys);
} }
if (item.children && item.children.length) { if (item.children && item.children.length) {
this.expandTreeItems( this.expandTreeItems(
...@@ -1010,8 +1016,11 @@ export default { ...@@ -1010,8 +1016,11 @@ export default {
this.monitorList.itemArr.indexOf(item.sn) > -1 && this.monitorList.itemArr.indexOf(item.sn) > -1 &&
item.eLocateType item.eLocateType
); );
if(this.monitorList.itemArr && this.monitorList.itemArr.length > 0){ if (
this.autoOpenLastInfoWindow = true this.monitorList.itemArr &&
this.monitorList.itemArr.length > 0
) {
this.autoOpenLastInfoWindow = true;
EventBus.$emit( EventBus.$emit(
"uiMap.monitor.draw", "uiMap.monitor.draw",
drawData, drawData,
...@@ -1214,7 +1223,7 @@ export default { ...@@ -1214,7 +1223,7 @@ export default {
this.getTreeData(); this.getTreeData();
}, },
mounted(){ mounted() {
let _this = this; let _this = this;
AMapLoader.load({ AMapLoader.load({
key: CONSTANT.MAP_KEY, key: CONSTANT.MAP_KEY,
......
const MAPGEO = { const MAPGEO = {
geocoder: null, geocoder: null,
getGeocoder: function(){ getGeocoder: function () {
return new Promise((resolve)=>{ return new Promise((resolve) => {
AMap.service('AMap.Geocoder',function(){//回调函数 AMap.service('AMap.Geocoder', function () {//回调函数
var geocoder = new AMap.Geocoder({ var geocoder = new AMap.Geocoder({
batch: true batch: true
}); });
...@@ -11,59 +11,62 @@ const MAPGEO = { ...@@ -11,59 +11,62 @@ const MAPGEO = {
}); });
}) })
}, },
transferAddressByGroup(obj, cb){ transferAddressByGroup(obj, cb) {
if(!this.geocoder){ if (!this.geocoder) {
this.getGeocoder().then(()=>{ this.getGeocoder().then(() => {
this.transfer(obj, cb) this.transfer(obj, cb)
}) })
}else{ } else {
this.transfer(obj, cb) this.transfer(obj, cb)
} }
}, },
transfer(obj, cb){ transfer(obj, cb) {
const data = obj.data; const data = obj.data;
obj.len = data.length; obj.len = data.length;
obj.times = obj.len>20?Math.ceil(obj.len/20):1; obj.times = obj.len > 20 ? Math.ceil(obj.len / 20) : 1;
obj.totalNum = 0; obj.totalNum = 0;
obj.realNum = 0; //为了剔除脏数据,脏数据导致解析不回调 obj.realNum = 0; //为了剔除脏数据,脏数据导致解析不回调
for(let i=0; i<obj.times; i++){ for (let i = 0; i < obj.times; i++) {
let lnglatArr = []; let lnglatArr = [];
let initIdx = i*20; let initIdx = i * 20;
let maxIdx = i===obj.times-1?obj.len:(i+1)*20; let maxIdx = i === obj.times - 1 ? obj.len : (i + 1) * 20;
for(let idx=initIdx; idx<maxIdx; idx++){ for (let idx = initIdx; idx < maxIdx; idx++) {
// 防止出现gps点:.00000的错误 // 防止出现gps点:.00000的错误
if(Number(data[idx].elng) > 0 && Number(data[idx].elat) > 0){ if (Number(data[idx].elng) > 0 && Number(data[idx].elat) > 0) {
lnglatArr.push([data[idx].elng, data[idx].elat]) lnglatArr.push([data[idx].elng, data[idx].elat])
obj.realNum++; obj.realNum++;
} }
} }
(function(initIdx){ (function (initIdx) {
geocoderGetAdr(lnglatArr, initIdx) geocoderGetAdr(lnglatArr, initIdx)
})(initIdx) })(initIdx)
} }
function geocoderGetAdr(arr, initIdx){ function geocoderGetAdr(arr, initIdx) {
const timeoutId = window.setTimeout(()=>{ if (!arr || arr.length <= 0) {
return false;
}
const timeoutId = window.setTimeout(() => {
MAPGEO.geocoder.getAddress(arr, function(status, result) { MAPGEO.geocoder.getAddress(arr, function (status, result) {
if (status === 'complete' && result.info === 'OK') {//获取地址成功 if (status === 'complete' && result.info === 'OK') {//获取地址成功
result.regeocodes.forEach((item, idx)=>{ result.regeocodes.forEach((item, idx) => {
data[initIdx+idx].transferAddress = item.formattedAddress; data[initIdx + idx].transferAddress = item.formattedAddress;
obj.totalNum++; obj.totalNum++;
}); });
if(obj.totalNum === obj.realNum){ if (obj.totalNum === obj.realNum) {
cb && cb(data) cb && cb(data)
//ifPlay && obj.init(data) //ifPlay && obj.init(data)
//EventBus.$emit('uiMap.replay.transferAdrDone'); //EventBus.$emit('uiMap.replay.transferAdrDone');
} }
}else{ } else {
geocoderGetAdr(arr, initIdx) geocoderGetAdr(arr, initIdx)
} }
}); });
}); });
if(!obj.timeoutIds){ if (!obj.timeoutIds) {
obj.timeoutIds = [] obj.timeoutIds = []
} }
obj.timeoutIds.push(timeoutId) obj.timeoutIds.push(timeoutId)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!