diff --git a/src/views/resources/index.js b/src/views/resources/index.js
index 51ed9e7..bc5c4e9 100644
--- a/src/views/resources/index.js
+++ b/src/views/resources/index.js
@@ -15,21 +15,15 @@ import Right12 from './comps/right/top/2/index.vue';
import Right22 from './comps/right/middle/2/index.vue';
import Right32 from './comps/right/bottom/2/index.vue';
import Bottom1 from './comps/buttom/1/index.vue';
-
-import { getConfigKey } from "@/api/system/config";
-import { getInfo } from "@/api/login";
-import { treeselect, treeselectByDeptId } from "@/api/system/dept";
-
-import GisUtils from '@/utils/gis.js';
+import GisMap from '@/components/gis-map/index.vue';
+import MainGis from './main-gis/index.vue';
import { comps } from './data.js'
-import {
- fromLonLat
-} from 'ol/proj'
-let gis = null;
export default {
components: {
+ GisMap,
+ MainGis,
Header,
Tabs,
Left11,
@@ -48,6 +42,7 @@ export default {
},
data () {
return {
+ comps,
tabData: [
{
id: '1',
@@ -58,18 +53,7 @@ export default {
name: '预警分析'
}
],
- yellowIcon: require('./icon/yellow.png'),
tab: '1',
- comps,
- map: "", // 地图
- mapGeoServerUrl: "", // geoserver地址
- mapBorder: "", // 地图边界
- deptLayer: "", // 坐标点图层
- countyBorderLayerName: "", // 区县边界图层名称
- townBorderLayerName: "", // 乡镇边界图层名称
- villageBorderLayerName: "", // 村边界图层名称
- groupBorderLayerName: "", // 组边界图层名称
- addrOptions: [],
};
},
computed: {
@@ -80,156 +64,10 @@ export default {
created () {
},
mounted () {
- // 获取geoserver的地址
- this.getGeoServerUrl();
- getInfo().then(res => {
- // this.getData();
- treeselectByDeptId({ deptId: res.user.deptId }).then((resp) => {
- this.addrOptions = resp.data;
- // 初始化地图
- this.initMap();
- });
- });
},
methods: {
tabChange (info) {
this.tab = info.id;
- },
- // 初始化地图
- initMap () {
- let dept = this.addrOptions[0];
- let mapCenterLocation;
- if (dept.lng && dept.lat) {
- mapCenterLocation = [dept.lng, dept.lat];
- } else {
- mapCenterLocation = [116.391461, 39.902359];
- }
- gis = new GisUtils('map')
- gis.addTianDiTuLayer()
- gis.addAnnotationLayer()
- if (dept.deptLevel === '5') {
- // 登录身份为市级领导
- this.userRole = 'cityLeader';
- this.cityId = dept.id;
- this.currentDeptLevel = '5';
- // 添加区县边界
- this.addCountyBorder(dept.children.map(item => item.id));
- } else if (dept.deptLevel === '4') {
- // 登录身份为县级领导
- this.userRole = 'countyLeader';
- this.countyId = dept.id;
- this.currentDeptLevel = '4';
- // 添加乡镇边界
- this.addTownBorder(dept.children.map(item => item.id));
- gis.getView().setZoom(11);
- // this.villageIds = this.findLeafNodeIds(dept);
- } else if (dept.deptLevel === '3') {
- // 登录身份为镇级领导
- this.userRole = 'townLeader';
- this.townId = dept.id;
- this.currentDeptLevel = '3';
- // 添加村边界
- this.addVillageBorder(dept.children.map(item => item.id));
- this.map.getView().setZoom(13);
- // this.villageIds = this.findLeafNodeIds(dept);
- }
- // 添加坐标点图层
- if (dept.children) {
- this.addDeptLayer(dept.children, 'yellow.png');
- }
- gis.getView().setCenter(fromLonLat(mapCenterLocation))
-
- // 地图点击事件
- gis.getMapContainer().on("click", (evt) => {
- let feature = this.map.forEachFeatureAtPixel(
- evt.pixel,
- (feature) => feature
- );
- if (feature) {
- // 镇级:加载村级坐标点
- if (feature.get('level') === 'deptPoint') {
- let parentIds = [];
- this.findParentNodeIds(this.addrOptions, feature.get('deptId'), parentIds);
- this.addrText = parentIds;
- this.selectAddress(parentIds);
- }
- }
- });
- },
-
- selectAddress (value, isLocated = true) { // isLocated 控制地图是否跳转
- this.queryParams.deptId = value[value.length - 1];
- this.getData(DEPT_CHANGED);
- let node = this.$refs["cascader"].panel.getNodeByValue(value);
- this.drawMap(node, isLocated);
- },
-
- // 查找指定deptId的所有父节点id
- findParentNodeIds (tree, deptId, result) {
- for (let node of tree) {
- if (node.id === deptId) {
- result.unshift(node.id);
- return true;
- }
- if (node.children && node.children.length > 0) {
- let isFind = this.findParentNodeIds(node.children, deptId, result);
- if (isFind) {
- result.unshift(node.id);
- return true;
- }
- }
- }
- return false;
- },
-
-
-
- // 添加坐标点图层
- addDeptLayer (nextDeptSet) {
- let features = [];
- nextDeptSet.forEach(item => {
- let fs = gis.getFeature(item, this.yellowIcon)
- features.push(fs);
- });
- console.log(features, 88);
- gis.getVectorLayerByFs(features)
- gis.mapSetFit(features)
-
- },
- // 添加区县边界
- addCountyBorder (deptIds) {
- gis.addImageLayer(this.mapGeoServerUrl, this.countyBorderLayerName, deptIds)
- },
- // 添加乡镇边界
- addTownBorder (deptIds) {
- gis.addImageLayer(this.mapGeoServerUrl, this.townBorderLayerName, deptIds)
- },
- // 添加村边界
- addVillageBorder (deptIds) {
- gis.addImageLayer(this.mapGeoServerUrl, this.villageBorderLayerName, deptIds)
- },
- // 获取geoserver的地址
- getGeoServerUrl () {
- // 获取geoserver的地址
- getConfigKey("system.geoServer.url").then(response => {
- this.mapGeoServerUrl = response.msg;
- });
- // 获取区县边界图层名称
- getConfigKey("geoserver.layer.countyBorder").then(response => {
- this.countyBorderLayerName = response.msg;
- });
- // 获取乡镇边界的图层名称
- getConfigKey("geoserver.layer.townBorder").then(response => {
- this.townBorderLayerName = response.msg;
- });
- // 获取村边界的图层名称
- getConfigKey("geoserver.layer.villageBorder").then(response => {
- this.villageBorderLayerName = response.msg;
- });
- // 获取组边界的图层名称
- getConfigKey("geoserver.layer.groupBorder").then(response => {
- this.groupBorderLayerName = response.msg;
- });
}
}
};
diff --git a/src/views/resources/main-gis/icon/blue.png b/src/views/resources/main-gis/icon/blue.png
new file mode 100644
index 0000000..1771c93
Binary files /dev/null and b/src/views/resources/main-gis/icon/blue.png differ
diff --git a/src/views/resources/main-gis/icon/cyan.png b/src/views/resources/main-gis/icon/cyan.png
new file mode 100644
index 0000000..6c085d8
Binary files /dev/null and b/src/views/resources/main-gis/icon/cyan.png differ
diff --git a/src/views/resources/main-gis/icon/gc_icon.png b/src/views/resources/main-gis/icon/gc_icon.png
new file mode 100644
index 0000000..9c5fc74
Binary files /dev/null and b/src/views/resources/main-gis/icon/gc_icon.png differ
diff --git a/src/views/resources/main-gis/icon/green.png b/src/views/resources/main-gis/icon/green.png
new file mode 100644
index 0000000..4198a27
Binary files /dev/null and b/src/views/resources/main-gis/icon/green.png differ
diff --git a/src/views/resources/main-gis/icon/ld_icon.png b/src/views/resources/main-gis/icon/ld_icon.png
new file mode 100644
index 0000000..355b5f2
Binary files /dev/null and b/src/views/resources/main-gis/icon/ld_icon.png differ
diff --git a/src/views/resources/main-gis/icon/ljd_icon.png b/src/views/resources/main-gis/icon/ljd_icon.png
new file mode 100644
index 0000000..01be038
Binary files /dev/null and b/src/views/resources/main-gis/icon/ljd_icon.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_1.png b/src/views/resources/main-gis/icon/map_icon_1.png
new file mode 100644
index 0000000..2e32425
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_1.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_2.png b/src/views/resources/main-gis/icon/map_icon_2.png
new file mode 100644
index 0000000..15446ee
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_2.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_3.png b/src/views/resources/main-gis/icon/map_icon_3.png
new file mode 100644
index 0000000..2f64349
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_3.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_4.png b/src/views/resources/main-gis/icon/map_icon_4.png
new file mode 100644
index 0000000..4c1da52
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_4.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_5.png b/src/views/resources/main-gis/icon/map_icon_5.png
new file mode 100644
index 0000000..f7a877d
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_5.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_6.png b/src/views/resources/main-gis/icon/map_icon_6.png
new file mode 100644
index 0000000..961e13e
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_6.png differ
diff --git a/src/views/resources/main-gis/icon/map_icon_7.png b/src/views/resources/main-gis/icon/map_icon_7.png
new file mode 100644
index 0000000..1617fdd
Binary files /dev/null and b/src/views/resources/main-gis/icon/map_icon_7.png differ
diff --git a/src/views/resources/main-gis/icon/pink.png b/src/views/resources/main-gis/icon/pink.png
new file mode 100644
index 0000000..34e09da
Binary files /dev/null and b/src/views/resources/main-gis/icon/pink.png differ
diff --git a/src/views/resources/main-gis/icon/red.png b/src/views/resources/main-gis/icon/red.png
new file mode 100644
index 0000000..dd24cb3
Binary files /dev/null and b/src/views/resources/main-gis/icon/red.png differ
diff --git a/src/views/resources/main-gis/icon/sxt_icon.png b/src/views/resources/main-gis/icon/sxt_icon.png
new file mode 100644
index 0000000..ff4b093
Binary files /dev/null and b/src/views/resources/main-gis/icon/sxt_icon.png differ
diff --git a/src/views/resources/main-gis/icon/wsz_icon.png b/src/views/resources/main-gis/icon/wsz_icon.png
new file mode 100644
index 0000000..1b48993
Binary files /dev/null and b/src/views/resources/main-gis/icon/wsz_icon.png differ
diff --git a/src/views/resources/main-gis/icon/yellow copy.png b/src/views/resources/main-gis/icon/yellow copy.png
new file mode 100644
index 0000000..f5f29b0
Binary files /dev/null and b/src/views/resources/main-gis/icon/yellow copy.png differ
diff --git a/src/views/resources/main-gis/icon/yellow.png b/src/views/resources/main-gis/icon/yellow.png
new file mode 100644
index 0000000..f5f29b0
Binary files /dev/null and b/src/views/resources/main-gis/icon/yellow.png differ
diff --git a/src/views/resources/main-gis/icon/zc_icon copy.png b/src/views/resources/main-gis/icon/zc_icon copy.png
new file mode 100644
index 0000000..ebc48c9
Binary files /dev/null and b/src/views/resources/main-gis/icon/zc_icon copy.png differ
diff --git a/src/views/resources/main-gis/icon/zc_icon.png b/src/views/resources/main-gis/icon/zc_icon.png
new file mode 100644
index 0000000..ebc48c9
Binary files /dev/null and b/src/views/resources/main-gis/icon/zc_icon.png differ
diff --git a/src/views/resources/main-gis/index.html b/src/views/resources/main-gis/index.html
new file mode 100644
index 0000000..bb6561a
--- /dev/null
+++ b/src/views/resources/main-gis/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/src/views/resources/main-gis/index.js b/src/views/resources/main-gis/index.js
new file mode 100644
index 0000000..b519967
--- /dev/null
+++ b/src/views/resources/main-gis/index.js
@@ -0,0 +1,183 @@
+
+import GisUtils from '@/utils/gis.js';
+import {
+ fromLonLat
+} from 'ol/proj'
+import { getUserGeo, getUserGeoList } from "@/api/dataScreen/stockCooperative/index.js";
+import { treeselect, getDept, listDeptExcludeChild } from "@/api/system/dept";
+import { getInfo } from "@/api/login";
+import { getConfigKey } from "@/api/system/config";
+import { getPermanentListByDeptId, listPermanent } from "@/api/asset/permanent.js";
+import { getResourceListByDeptId, listResource } from "@/api/asset/resource.js";
+import { attachmentList } from "@/api/common/uploadAttachment.js";
+let gis = null;
+export default {
+ components: {
+ },
+ data () {
+ return {
+ };
+ },
+ computed: {
+ },
+ created () {
+ },
+ mounted () {
+ this.initMap();
+ },
+ methods: {
+ // 加载地图
+ initMap () {
+ gis = new GisUtils('map2')
+ gis.addTianDiTuLayer()
+ gis.addAnnotationLayer()
+ const initZoom = 11;
+ //初始加载当前用户级别的geojson数据
+ getUserGeo().then((res) => {
+ if (res.code == 200) {
+ // 存在geojson数据,加载边界图层,定位到当前位置
+ if (res.data.geoJson != null && res.data.geoJson != "") {
+ // 解析geojson数据,添加轮廓图层
+ require(["@/assets/maps/" + res.data.geoJson], (data) => {
+
+ this.map.addLayer(boundaryLayer);
+
+ //定位查询位置
+ const maxXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxX;
+ const maxYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxY;
+ const minXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minX;
+ const minYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minY;
+ //获取边界区域的中心位置
+ const center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]);
+ this.map.getView().animate({
+ // 只设置需要的属性即可
+ center: center, // 中心点
+ zoom: initZoom, // 缩放级别
+ rotation: undefined, // 缩放完成view视图旋转弧度
+ duration: 1000, // 缩放持续时间,默认不需要设置
+ });
+ });
+ } else { // 不存在geojson数据,直接定位到当前位置
+ gis.getMapContainer().getView().animate({
+ // 只设置需要的属性即可
+ center: fromLonLat([res.data.lng, res.data.lat]), // 中心点
+ zoom: initZoom, // 缩放级别
+ rotation: undefined, // 缩放完成view视图旋转弧度
+ duration: 1000, // 缩放持续时间,默认不需要设置
+ });
+ }
+ //村级组级只定位坐标点 deptLevel: 1 组级、2 村级、3 乡镇级、4 区县级
+ if (res.data.deptLevel === '3' || res.data.deptLevel === '4') {
+ let locationIcon;
+ if (res.data.deptLevel === '3') {
+ locationIcon = "red.png";
+ } else if (res.data.deptLevel === '4') {
+ locationIcon = "yellow.png";
+ }
+ //获取用户级别的下级区域
+ setTimeout(() => {
+ getUserGeoList(res.data.deptId).then((res) => {
+ if (res.code == 200) {
+ this.addDeptLayer(res.data, require(`./icon/${locationIcon}`))
+ }
+ });
+ }, 500);
+ } else {
+ let lowestOrder = [];
+ lowestOrder.push(res.data);
+ this.addDeptLayer(lowestOrder, require('./icon/green.png'));
+ }
+ }
+ });
+
+ gis.getMapContainer().on("click", (evt) => {
+ let feature = gis.getMapContainer().forEachFeatureAtPixel(
+ evt.pixel,
+ (feature) => feature
+ );
+ if (feature) {
+ // 镇级:加载村级坐标点
+ if (feature.get('deptLevel') === '3') {
+ gis.getMapContainer().getView().animate({
+ center: fromLonLat([feature.get('lng'), feature.get('lat')]), // 中心点
+ zoom: 12, // 缩放级别
+ rotation: undefined, // 缩放完成view视图旋转弧度
+ duration: 1000, // 缩放持续时间,默认不需要设置
+ });
+ //根据镇级deptID获取下级部门集合,并创建坐标点
+ getUserGeoList(feature.get('deptId')).then((res) => {
+ if (res.code == 200) {
+ let content = res.data;
+ if (this.villagePointLayer) {
+ gis.getMapContainer().removeLayer(this.villagePointLayer);
+ this.villagePointLayer = "";
+ }
+ this.villagePointLayer = this.addDeptLayer(content, require('./icon/green.png'));
+ }
+ });
+ }
+ }
+ });
+
+ // 缩小地图,重新加载页面
+ gis.getMapContainer().on("moveend", (evt) => {
+ const zoom = gis.getMapContainer().getView().getZoom();
+ if (this.villagePointLayer && zoom < 10.5) {
+ gis.getMapContainer().removeLayer(this.villagePointLayer);
+ this.villagePointLayer = "";
+ }
+ });
+ },
+ // 创建矢量数据源
+ addDeptLayer (nextDeptSet, locationIcon) {
+ let features = [];
+ nextDeptSet.forEach(item => {
+ let fs = gis.getFeature(item, locationIcon)
+ features.push(fs);
+ });
+ gis.getVectorLayerByFs(features)
+ gis.mapSetFit(features)
+ },
+ // 获取资源列表
+ getResourceList (deptId) {
+ getResourceListByDeptId(deptId).then(response => {
+ if (response.data && response.data.length > 0) {
+ this.addResourceLayer(response.data);
+ }
+ });
+ },
+ // 添加资源图层
+ addResourceLayer (resourceList) {
+ let features = [];
+ resourceList.forEach(item => {
+ if (item.theGeom != null && item.theGeom !== '') {
+ let fs = gis.getFeature3(item)
+ features.push(fs);
+ }
+
+ });
+
+
+ gis.getVectorLayerByFs(features)
+ gis.mapSetFit(features)
+ },
+ getAllList () {
+ //三务公开
+ // this.getList(null);
+ // //零工公开
+ // this.getTempWorkerOpenList();
+ // //重大事项公开
+ // this.getMajorEventOpenList();
+ // //补贴资金管理
+ // this.getSubsidyFundsList();
+ // //固定资产
+ // this.getPermanentListList();
+ // //资源资产
+ // this.getResourceListList();
+ // //合同信息
+ // this.getContractionByPermanentList();
+ // //资金情况
+ // this.getFundAndBankAmountByDeptIdArray();
+ },
+ }
+};
diff --git a/src/views/resources/main-gis/index.scss b/src/views/resources/main-gis/index.scss
new file mode 100644
index 0000000..765baf7
--- /dev/null
+++ b/src/views/resources/main-gis/index.scss
@@ -0,0 +1,42 @@
+.map {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+//选择地址
+.select_address {
+ height: 30px;
+ width: 300px;
+ position: absolute;
+ left: 480px;
+ top: 112px;
+ z-index: 302;
+
+ //
+ //
+ ::v-deep {
+ .el-input--suffix {
+ // background: url('../../../../assets/images/dataScreen/bigDataMonitoring2/stockCooperative/addText_bg.png') center center no-repeat !important;
+ background-size: 100% 100% !important;
+ height: 35px;
+ width: 280px;
+
+ .el-input__inner {
+ background: none !important;
+ border: 0 none !important;
+ color: #a7dbff;
+ font-size: 1.66vh;
+ text-align: center;
+ padding: 0;
+ padding-top: .9vh;
+ }
+
+ .el-input__icon {
+ display: none !important;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/views/resources/main-gis/index.vue b/src/views/resources/main-gis/index.vue
new file mode 100644
index 0000000..5ac9224
--- /dev/null
+++ b/src/views/resources/main-gis/index.vue
@@ -0,0 +1,4 @@
+
+
+