diff --git a/src/views/sponeScreen/projectHM/ProjectDisplay.vue b/src/views/sponeScreen/projectHM/ProjectDisplay.vue index 50a4684..b2ba46a 100644 --- a/src/views/sponeScreen/projectHM/ProjectDisplay.vue +++ b/src/views/sponeScreen/projectHM/ProjectDisplay.vue @@ -65,78 +65,106 @@ const getIcon = name => { return obj[name]; }; -let projectList = [ - { - layerLabel: '海绵建筑与社区', - layerName: 'HMJZYSQ', - data: [], - }, - { - layerLabel: '海绵型道路广场', - layerName: 'HMXDLGC', - data: [], - }, - { - layerLabel: '海绵型公园绿地', - layerName: 'HMXGYLD', - data: [], - }, - { - layerLabel: '海绵型水系', - layerName: 'HMXSX', - data: [], - }, - { - layerLabel: '管网排查与修复', - layerName: 'GWPCYXF', - data: [], - }, - { - layerLabel: '管网及泵站', - layerName: 'GWJBZ', - data: [], - }, - { - layerLabel: 'GIS平台建设与监测设施', - layerName: 'GIS', - data: [], - }, -]; +let layerList = ['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GWJBZ', 'GIS']; async function projectInfoNewM(p) { console.log('ppppp---', p); let { data, code } = await projectInfoNew(p); if (code == 200) { listDataXm.value = data; + console.log(typeof p); + if (!p || !p.projectTypeId) { + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GWJBZ', 'GIS'], true); //全部 + } else if (p.projectTypeId == '1701128641279070210') { + newfiberMap.setLayersVisible(['HMJZYSQ'], true); + newfiberMap.setLayersVisible(['HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GWJBZ', 'GIS'], false); //社区 + } else if (p.projectTypeId == '1701128777853997058') { + newfiberMap.setLayersVisible(['HMXDLGC'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GWJBZ', 'GIS'], false); //道路 + } else if (p.projectTypeId == '1701128863459741697') { + newfiberMap.setLayersVisible(['HMXGYLD'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXSX', 'GWPCYXF', 'GWJBZ', 'GIS'], false); //绿地 + } else if (p.projectTypeId == '1701128943340261378') { + newfiberMap.setLayersVisible(['HMXSX'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'GWPCYXF', 'GWJBZ', 'GIS'], false); //水系 + } else if (p.projectTypeId == '1701129031496142849') { + newfiberMap.setLayersVisible(['GWPCYXF'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWJBZ', 'GIS'], false); //管网排查 + } else if (p.projectTypeId == '1701129103495565313') { + newfiberMap.setLayersVisible(['GWJBZ'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GIS'], false); //管网泵站 + } else if (p.projectTypeId == '1701129308194377729') { + newfiberMap.setLayersVisible(['GIS'], true); + newfiberMap.setLayersVisible(['HMJZYSQ', 'HMXDLGC', 'HMXGYLD', 'HMXSX', 'GWPCYXF', 'GWJBZ'], false); //GIS + } } } //海绵工程gis渲染 const addProjectLayers = async () => { let { data, code } = await projectInfoNew(); - //海绵工程数据分类 - projectList.forEach(projectItem => { - data.forEach(item => { - if (item.projectTypeCode == projectItem.layerName) projectItem.data.push(item); + if (code == 200) { + let projectList = [ + { + layerLabel: '海绵建筑与社区', + layerName: 'HMJZYSQ', + data: [], + }, + { + layerLabel: '海绵型道路广场', + layerName: 'HMXDLGC', + data: [], + }, + { + layerLabel: '海绵型公园绿地', + layerName: 'HMXGYLD', + data: [], + }, + { + layerLabel: '海绵型水系', + layerName: 'HMXSX', + data: [], + }, + { + layerLabel: '管网排查与修复', + layerName: 'GWPCYXF', + data: [], + }, + { + layerLabel: '管网及泵站', + layerName: 'GWJBZ', + data: [], + }, + { + layerLabel: 'GIS平台建设与监测设施', + layerName: 'GIS', + data: [], + }, + ]; + //海绵工程数据分类 + projectList.forEach(projectItem => { + data.forEach(item => { + if (item.projectTypeCode == projectItem.layerName) projectItem.data.push(item); + }); }); - }); - //海绵工程上图 - projectList.forEach(projectItem => { - let mapDataFeatures = []; - let mapDataGeojson = {}; - projectItem.data.forEach((item, index) => { - if (!!!item.projectLocation) return; - let projectWKT = `POINT(${item.projectLocation.split(',').join(' ')})`; + //海绵工程上图 + projectList.forEach(projectItem => { + let mapDataFeatures = []; + let mapDataGeojson = {}; + projectItem.data.forEach((item, index) => { + if (!!!item.projectLocation) return; + let projectWKT = `POINT(${item.projectLocation.split(',').join(' ')})`; - let feature = { type: 'Feature', geometry: Terraformer.WKT.parse(projectWKT), properties: item }; - mapDataFeatures.push(feature); + let feature = { type: 'Feature', geometry: Terraformer.WKT.parse(projectWKT), properties: item }; + mapDataFeatures.push(feature); + }); + + mapDataGeojson = { + type: 'FeatureCollection', + features: mapDataFeatures, + }; + if (!mapDataGeojson.features.length) return; + newfiberVectorLayer.addGeojsonPoint(newfiberMap, mapDataGeojson, getIcon(projectItem.layerLabel), projectItem.layerName); }); - - mapDataGeojson = { - type: 'FeatureCollection', - features: mapDataFeatures, - }; - if (!mapDataGeojson.features.length) return; - newfiberVectorLayer.addGeojsonPoint(newfiberMap, mapDataGeojson, getIcon(projectItem.layerLabel), projectItem.layerName); - }); + } }; const AllData = reactive({ queryParams: {},