|
|
@@ -473,29 +473,29 @@ export default { |
|
|
|
const arr = res.data |
|
|
|
|
|
|
|
var resArr = [] |
|
|
|
var narr = [] |
|
|
|
const nar = [] |
|
|
|
for (var i = 0; i < arr.length; i++) { |
|
|
|
var n = resArr.indexOf(arr[i].typeName) |
|
|
|
if (n == -1) { |
|
|
|
resArr.push(arr[i].typeName) |
|
|
|
narr.push({ name: arr[i].typeName, fraction: [arr[i]] }) |
|
|
|
nar.push({ name: arr[i].typeName, fraction: [arr[i]] }) |
|
|
|
} else { |
|
|
|
narr[n].fraction.push(arr[i]) |
|
|
|
nar[n].fraction.push(arr[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 添加问题图层 |
|
|
|
addproblemLayer(narr) |
|
|
|
addproblemLayer(nar) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// 添加问题图层 |
|
|
|
const addproblemLayer = (narr) => { |
|
|
|
console.log(narr, '问题图层数据') |
|
|
|
// 如果存在问题图层,就将问题图层给删掉 |
|
|
|
if (data.problemlayer !== null) { |
|
|
|
console.log('有图层') |
|
|
|
data.map.removeLayer(data.problemlayer) |
|
|
|
if (data.problemLayerList.length) { |
|
|
|
data.problemLayerList.map((item) => { |
|
|
|
data.map.removeLayer(item.layer) |
|
|
|
}) |
|
|
|
} |
|
|
|
data.problemOverlay = new Overlay({ |
|
|
|
id: 'problem_overlay', |
|
|
@@ -506,7 +506,7 @@ export default { |
|
|
|
data.problemLayerList = [] |
|
|
|
narr.map((item) => { |
|
|
|
const Features = [] |
|
|
|
|
|
|
|
let problemLayer = null |
|
|
|
if (item.fraction.length > 0) { |
|
|
|
item.fraction.map((iitem) => { |
|
|
|
const problem = iitem |
|
|
@@ -548,18 +548,19 @@ export default { |
|
|
|
Features.push(feature) |
|
|
|
}) |
|
|
|
// 添加图层 |
|
|
|
data.problemlayer = new VectorLayer({ |
|
|
|
problemLayer = new VectorLayer({ |
|
|
|
source: new VectorSource({ |
|
|
|
features: Features |
|
|
|
}), |
|
|
|
visible: true |
|
|
|
}) |
|
|
|
|
|
|
|
const obj = { type: item.name, layer: data.problemlayer } |
|
|
|
const obj = { type: item.name, layer: problemLayer } |
|
|
|
data.problemLayerList.push(obj) |
|
|
|
data.map.addLayer(data.problemlayer) |
|
|
|
data.map.addLayer(problemLayer) |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log(data.problemLayerList, '图层列表') |
|
|
|
} |
|
|
|
/** |
|
|
|
* 初始化任务列表信息 |
|
|
@@ -618,10 +619,10 @@ export default { |
|
|
|
* |
|
|
|
*/ |
|
|
|
const handleProblemTypeValue = (value) => { |
|
|
|
// console.log(value, '选中的值') |
|
|
|
console.log(value, '选中的值') |
|
|
|
data.problemLayerList.map((item) => { |
|
|
|
const a = value.indexOf(item.type) |
|
|
|
|
|
|
|
console.log(a, item.type, '判断图层是否存在') |
|
|
|
if (a == -1) { |
|
|
|
item.layer.setVisible(false) |
|
|
|
} else { |