移动端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

952 行
32 KiB

  1. <template>
  2. <div class="home_wrapper">
  3. <div class="map_main" id="mapWrap"></div>
  4. <div class="top_address" @click="showAddress=true">
  5. <i class="address_icon"></i>
  6. <p>{{deptName}}</p>
  7. </div>
  8. <!--选择当前区域弹窗-->
  9. <van-popup v-model="showAddress" position="bottom">
  10. <van-cascader
  11. v-model="villageValue"
  12. title="请选择"
  13. :options="addrOptions"
  14. @close="showAddress = false"
  15. @finish="onConfirmDept"
  16. active-color="#1989fa"
  17. :field-names="hcAreaInfoFieldName"
  18. />
  19. </van-popup>
  20. <!--当前区域详情弹窗-->
  21. <van-popup v-model="show" position="bottom" :overlay="false" round>
  22. <div class="pop_main">
  23. <div class="pop_title">
  24. <i class="address_icon"></i>
  25. <p>{{deptName}}</p>
  26. </div>
  27. <div class="pop_content">
  28. <div class="pop_content_left">
  29. <img src="../../../static/images/plotPremises/plotPremises_icon_01.png" alt="">
  30. <div class="pop_content_left_box">
  31. <div>
  32. <p>农房 <span>(栋)</span></p>
  33. <p class="num">{{detail.zzs}}</p>
  34. </div>
  35. <span class="border"></span>
  36. <div>
  37. <p>可租 <span>(栋)</span></p>
  38. <p class="num" @click="deptId == 100?'':(showList = true,activeName='nf')">{{detail.kzs}}</p>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="pop_content_left">
  43. <img src="../../../static/images/plotPremises/plotPremises_icon_02.png" alt="">
  44. <div class="pop_content_left_box">
  45. <div>
  46. <p>农地 <span>(亩)</span></p>
  47. <p class="num">{{detail.landArea}}</p>
  48. </div>
  49. <span class="border"></span>
  50. <div>
  51. <p>可租 <span>(亩)</span></p>
  52. <p class="num" @click="deptId == 100?'':(showList = true,activeName='nd')">{{detail.rentableArea}}</p>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </van-popup>
  59. <!--租地详情弹窗-->
  60. <van-popup v-model="showZD" closeable position="bottom" :closed="show=true" :overlay="false" round>
  61. <div class="pop_main">
  62. <div class="pop_title">
  63. <i class="address_icon"></i>
  64. <p>{{deptName}}-{{ndItem.id}}</p>
  65. </div>
  66. <div class="pop_content_zd">
  67. <img src="../../../static/images/plotPremises/plotPremises_img.png" alt="">
  68. <div class="pop_content_zd_right">
  69. <van-row type="flex" justify="space-between">
  70. <van-col>租地位置:</van-col>
  71. <van-col>{{deptName}}</van-col>
  72. </van-row>
  73. <van-row type="flex" justify="space-between">
  74. <van-col>租地编号:</van-col>
  75. <van-col class="num">{{ndItem.id}}</van-col>
  76. </van-row>
  77. <van-row type="flex" justify="space-between">
  78. <van-col>租地面积:</van-col>
  79. <van-col class="num">{{ndItem.scmjm}}亩</van-col>
  80. </van-row>
  81. <van-row type="flex" justify="space-between">
  82. <van-col>咨询代表:</van-col>
  83. <van-col>{{ deptInfo.leader }}</van-col>
  84. </van-row>
  85. <van-row type="flex" justify="space-between">
  86. <van-col>咨询电话:</van-col>
  87. <van-col class="num">{{ deptInfo.phone }}</van-col>
  88. </van-row>
  89. </div>
  90. </div>
  91. </div>
  92. </van-popup>
  93. <!--租房详情弹窗-->
  94. <van-popup v-model="showZF" closeable position="bottom" :closed="show=true" :overlay="false" round>
  95. <div class="pop_main">
  96. <div class="pop_title">
  97. <i class="address_icon"></i>
  98. <p>{{deptName}}-{{nfItem.id}}</p>
  99. </div>
  100. <div class="pop_content_zd">
  101. <img src="../../../static/images/plotPremises/plotPremises_img.png" alt="">
  102. <div class="pop_content_zd_right">
  103. <van-row type="flex" justify="space-between">
  104. <van-col>租房位置:</van-col>
  105. <van-col>{{deptName}}</van-col>
  106. </van-row>
  107. <van-row type="flex" justify="space-between">
  108. <van-col>租房编号:</van-col>
  109. <van-col class="num">{{nfItem.id}}</van-col>
  110. </van-row>
  111. <van-row type="flex" justify="space-between">
  112. <van-col>租房面积:</van-col>
  113. <van-col class="num">{{nfItem.zdmj}}㎡</van-col>
  114. </van-row>
  115. <van-row type="flex" justify="space-between">
  116. <van-col>咨询代表:</van-col>
  117. <van-col>{{ deptInfo.leader }}</van-col>
  118. </van-row>
  119. <van-row type="flex" justify="space-between">
  120. <van-col>咨询电话:</van-col>
  121. <van-col class="num">{{ deptInfo.phone }}</van-col>
  122. </van-row>
  123. </div>
  124. </div>
  125. </div>
  126. </van-popup>
  127. <!--农房农地右侧列表弹窗-->
  128. <van-popup v-model="showList" close-icon="../../../static/images/plotPremises/plotPremises_icon_03.png" closeable position="right" :closed="show=true" :overlay="false" round :style="{ width: '45%' , height: '60%' , background:'#ffffff' }">
  129. <div class="pop_main_right">
  130. <p class="pop_title" :style="{color:activeName=='nf'?'#1B65F8':'#FF7321'}">{{activeName=='nf'?'待租农房':'待租农地'}}</p>
  131. <div class="pop_content_right" v-if="activeName=='nf'">
  132. <van-row>
  133. <van-col span="12" class="num">编号</van-col>
  134. <van-col span="12" style="text-align: left;">面积(㎡)</van-col>
  135. </van-row>
  136. <!-- 待租农房列表 -->
  137. <van-row v-for="(item,index) in detail.rentableHomestead"
  138. :key="index"
  139. @click="listChange(index,'nf',item)"
  140. :class="{ active: selectChooseOrder == index }"
  141. align="center"
  142. >
  143. <van-col span="12" class="num">{{item.id}}</van-col>
  144. <van-col span="12" style="text-align: left;" class="num">{{item.zdmj}}</van-col>
  145. </van-row>
  146. </div>
  147. <div class="pop_content_right" v-else>
  148. <van-row>
  149. <van-col span="12" class="num">编号</van-col>
  150. <van-col span="12" style="text-align: left;">面积(亩)</van-col>
  151. </van-row>
  152. <!-- 待租农房列表 -->
  153. <van-row v-for="(item,index) in detail.rentableLand"
  154. :key="index"
  155. @click="listChange(index,'nd',item)"
  156. :class="{ active: selectChooseOrder == index }"
  157. align="center"
  158. >
  159. <van-col span="12" class="num">{{item.id}}</van-col>
  160. <van-col span="12" style="text-align: left;" class="num">{{item.scmjm}}</van-col>
  161. </van-row>
  162. </div>
  163. <div class="pop_btn_right">
  164. <p :style="{background:activeName=='nf'?'#1B65F8':'',color:activeName=='nf'?'#ffffff':''}" @click="tabChange('nf')">农房</p>
  165. <p :style="{background:activeName=='nd'?'#FF7321':'',color:activeName=='nd'?'#ffffff':''}" @click="tabChange('nd')">农地</p>
  166. </div>
  167. </div>
  168. </van-popup>
  169. <!-- <van-popup v-model="showAddress" position="bottom" round>-->
  170. <!-- <van-picker show-toolbar title="村镇选择" :columns="columns" />-->
  171. <!-- </van-popup>-->
  172. </div>
  173. </template>
  174. <script>
  175. import $ from "jquery";
  176. import { getConfigKey } from "@/utils/data";
  177. import { getDept , treeselect , plotPremisesStatistics } from "@/api/plotPremisesMobile";
  178. export default {
  179. data() {
  180. return {
  181. show:true,
  182. showZD:false,
  183. showZF:false,
  184. showList:false,
  185. showAddress:false,
  186. activeName:'nf',
  187. selectChooseOrder:-1,
  188. columns: [
  189. {
  190. text: '浙江',
  191. children: [
  192. {
  193. text: '杭州',
  194. children: [{ text: '西湖区' }, { text: '余杭区' }],
  195. },
  196. {
  197. text: '温州',
  198. children: [{ text: '鹿城区' }, { text: '瓯海区' }],
  199. },
  200. ],
  201. },
  202. {
  203. text: '福建',
  204. children: [
  205. {
  206. text: '福州',
  207. children: [{ text: '鼓楼区' }, { text: '台江区' }],
  208. },
  209. {
  210. text: '厦门',
  211. children: [{ text: '思明区' }, { text: '海沧区' }],
  212. },
  213. ],
  214. },
  215. ],
  216. addrOptions: [],
  217. map: "", // 地图
  218. // countyBorder: "", // 区县边界
  219. // townBorder: "", // 乡镇边界
  220. // villageBorder: "", // 村边界
  221. borderLayer: "", // 区域边界图层
  222. deptLayer: "", // 坐标点图层
  223. userRole: "", // 记录用户身份
  224. cityId: null, // 记录市的deptId
  225. countyId: null, // 记录区县的deptId
  226. townId: null, // 记录乡镇的deptId
  227. currentDeptLevel: null, // 当前所处的部门级别
  228. mapGeoServerUrl: "", // 加载geoserver地址
  229. countyBorderLayerName: "", // 区县边界图层名称
  230. townBorderLayerName: "", // 乡镇边界图层名称
  231. villageBorderLayerName: "", // 村边界图层名称
  232. landLayer: "", // 地块图层
  233. homesteadLayer: "", // 宅基地图层
  234. deptInfo: {
  235. leader: null, // 联系人
  236. phone: null // 电话
  237. },
  238. deptName:'',
  239. deptId:'',
  240. detail:{},
  241. villageValue: "",
  242. hcAreaInfoFieldName: {
  243. text: "label",
  244. value: "value",
  245. children: "children",
  246. },
  247. deptOptions:[],
  248. nfItem:{},
  249. ndItem:{},
  250. };
  251. },
  252. created() {
  253. },
  254. mounted() {
  255. // 获取geoserver的地址
  256. this.getGeoServerUrl();
  257. // 获取区县边界图层名称
  258. this.getCountyBorderLayerName();
  259. // 获取乡镇边界的图层名称
  260. this.getTownBorderLayerName();
  261. // 获取村边界的图层名称
  262. this.getVillageBorderLayerName();
  263. // 获取部门下拉树列表
  264. treeselect().then(response => {
  265. this.addrOptions = response.data;
  266. this.deptId = response.data[0].id;
  267. this.deptName = response.data[0].label;
  268. // 初始化地图
  269. this.initMap();
  270. this.getData();
  271. });
  272. },
  273. methods: {
  274. getData(){
  275. plotPremisesStatistics({deptId:this.deptId}).then(response => {
  276. this.detail = response.data;
  277. });
  278. },
  279. onConfirmDept({ selectedOptions }){
  280. this.deptId = selectedOptions[selectedOptions.length-1].id;
  281. this.deptName = selectedOptions.map((option) => option.label).join('/');
  282. this.getData();
  283. this.showAddress = false;
  284. },
  285. tabChange(name){
  286. this.activeName = name;
  287. this.selectChooseOrder = -1;
  288. },
  289. listChange(id,type,data){
  290. this.selectChooseOrder = id;
  291. this.show = false;
  292. this.showZF = false;
  293. this.showZD = false;
  294. if (type=='nf'){this.showZF = true;this.nfItem = data;}
  295. if (type=='nd'){this.showZD = true;this.ndItem = data;}
  296. },
  297. //获取geoserver的地址
  298. getGeoServerUrl() {
  299. getConfigKey("system.geoServer.url").then(response => {
  300. this.mapGeoServerUrl = response.msg;
  301. });
  302. },
  303. //获取区县边界的图层名称
  304. getCountyBorderLayerName() {
  305. getConfigKey("geoserver.layer.countyBorder").then(response => {
  306. this.countyBorderLayerName = response.msg;
  307. });
  308. },
  309. //获取乡镇边界的图层名称
  310. getTownBorderLayerName() {
  311. getConfigKey("geoserver.layer.townBorder").then(response => {
  312. this.townBorderLayerName = response.msg;
  313. });
  314. },
  315. //获取村边界的图层名称
  316. getVillageBorderLayerName() {
  317. getConfigKey("geoserver.layer.villageBorder").then(response => {
  318. this.villageBorderLayerName = response.msg;
  319. });
  320. },
  321. // 初始化地图
  322. initMap() {
  323. const dept = this.addrOptions[0];
  324. // 定义地图中心坐标
  325. let mapCenterLocation;
  326. if (dept.lng && dept.lat) {
  327. mapCenterLocation = [dept.lng, dept.lat];
  328. } else {
  329. mapCenterLocation = [116.391458, 39.902377];
  330. }
  331. document.getElementById("mapWrap").innerHTML = "";
  332. // 定义地图投影
  333. let projection = new ol.proj.Projection({
  334. code: "EPSG:3857",
  335. units: "degrees",
  336. });
  337. // 定义地图图层
  338. let aerial = new ol.layer.Tile({
  339. source: new ol.source.XYZ({
  340. url: "http://t{0-7}.tianditu.com/img_w/wmts?" +
  341. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  342. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
  343. }),
  344. isGroup: true,
  345. name: "卫星影像图",
  346. });
  347. let yingxzi = new ol.layer.Tile({
  348. source: new ol.source.XYZ({
  349. url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
  350. }),
  351. isGroup: true,
  352. name: "天地图文字标注--卫星影像图",
  353. });
  354. //加载地图
  355. this.map = new ol.Map({
  356. controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]),
  357. layers: [aerial, yingxzi],
  358. projection: projection,
  359. target: "mapWrap",
  360. view: new ol.View({
  361. center: ol.proj.fromLonLat(mapCenterLocation), // 地图中心坐标
  362. zoom: 9.5,
  363. minZoom: 1, //地图缩小限制
  364. maxZoom: 18, //地图放大限制
  365. // extent: [13481224.75161,5667110.83528,13811063.06278,5880284.11416]
  366. }),
  367. interactions: ol.interaction.defaults({
  368. doubleClickZoom: false, // 双击放大地图
  369. // mouseWheelZoom: false, // 鼠标滚轮放大地图
  370. // shiftDragZoom: false, // shift + 鼠标左键拖拽 放大地图
  371. })
  372. });
  373. if (dept.deptLevel === '5') {
  374. // 登录身份为市级领导
  375. this.userRole = 'cityLeader';
  376. this.cityId = dept.id;
  377. this.currentDeptLevel = '5';
  378. // 添加区县边界
  379. this.addCountyBorder();
  380. } else if (dept.deptLevel === '4') {
  381. // 登录身份为县级领导
  382. this.userRole = 'countyLeader';
  383. this.countyId = dept.id;
  384. this.currentDeptLevel = '4';
  385. // 添加乡镇边界
  386. this.addTownBorder(dept.id);
  387. this.map.getView().setZoom(10.5);
  388. }
  389. // else if (dept.deptLevel === '3') {
  390. // // 登录身份为镇级领导
  391. // this.userRole = 'townLeader';
  392. // this.townId = dept.id;
  393. // this.currentDeptLevel = '3';
  394. // // 添加村边界
  395. // this.addVillageBorder(dept.id);
  396. // this.map.getView().setZoom(12.5);
  397. // }
  398. if (dept.children) {
  399. this.addDeptLayer(dept.children);
  400. }
  401. this.map.on("click", (evt) => {
  402. let feature = this.map.forEachFeatureAtPixel(
  403. evt.pixel,
  404. (feature) => feature
  405. );
  406. if (feature) {
  407. // 镇级:加载村级坐标点
  408. if (feature.get('level') === 'deptPoint') {
  409. const deptId = feature.get('deptId');
  410. const deptLevel = feature.get('deptLevel');
  411. const lng = feature.get('lng');
  412. const lat = feature.get('lat');
  413. if (deptLevel === '4' || deptLevel === '3') {
  414. if (deptLevel === '4') {
  415. this.countyId = deptId;
  416. this.currentDeptLevel = '4';
  417. this.map.removeLayer(this.borderLayer);
  418. this.borderLayer = '';
  419. // 添加乡镇边界
  420. this.addTownBorder(deptId);
  421. this.map.getView().animate({
  422. center: ol.proj.fromLonLat([lng, lat]), // 中心点
  423. zoom: 10.5, // 缩放级别
  424. rotation: undefined, // 缩放完成view视图旋转弧度
  425. duration: 1000, // 缩放持续时间,默认不需要设置
  426. });
  427. } else if (deptLevel === '3') {
  428. this.townId = deptId;
  429. this.currentDeptLevel = '3';
  430. this.map.removeLayer(this.borderLayer);
  431. this.borderLayer = '';
  432. // 添加村边界
  433. const cqlFilter = "parent_id = '" + deptId + "'";
  434. this.addVillageBorder(cqlFilter);
  435. this.map.getView().animate({
  436. center: ol.proj.fromLonLat([lng, lat]), // 中心点
  437. zoom: 12.5, // 缩放级别
  438. rotation: undefined, // 缩放完成view视图旋转弧度
  439. duration: 1000, // 缩放持续时间,默认不需要设置
  440. });
  441. }
  442. const deptNode = this.findNode(this.addrOptions, deptId);
  443. if (deptNode && deptNode.children) {
  444. this.map.removeLayer(this.deptLayer);
  445. this.deptLayer = '';
  446. this.addDeptLayer(deptNode.children);
  447. }
  448. } else if (deptLevel === '2') {
  449. this.currentDeptLevel = '2';
  450. this.map.removeLayer(this.borderLayer);
  451. this.borderLayer = '';
  452. // 添加村边界
  453. const cqlFilter = "dept_id = '" + deptId + "'";
  454. this.addVillageBorder(cqlFilter);
  455. let villagePoint = {
  456. id: deptId,
  457. label: feature.get('deptName'),
  458. lng: lng,
  459. lat: lat,
  460. deptLevel: deptLevel,
  461. };
  462. let depts = [];
  463. depts.push(villagePoint);
  464. this.map.removeLayer(this.deptLayer);
  465. this.deptLayer = '';
  466. this.addDeptLayer(depts);
  467. this.addLandLayer(deptId);
  468. this.addHomesteadLayer(deptId);
  469. this.map.getView().animate({
  470. center: ol.proj.fromLonLat([lng, lat]), // 中心点
  471. zoom: 17, // 缩放级别
  472. rotation: undefined, // 缩放完成view视图旋转弧度
  473. duration: 1000, // 缩放持续时间,默认不需要设置
  474. });
  475. getDept(deptId).then(res => {
  476. this.deptInfo.leader = res.data.leader;
  477. this.deptInfo.phone = res.data.phone;
  478. });
  479. }
  480. }
  481. }
  482. });
  483. // 缩小地图,重新加载页面
  484. this.map.on("moveend", (evt) => {
  485. const zoom = this.map.getView().getZoom();
  486. if (this.userRole === 'cityLeader') {
  487. if (this.currentDeptLevel === '2' && zoom < 13) {
  488. this.currentDeptLevel = '3';
  489. this.map.removeLayer(this.borderLayer);
  490. this.borderLayer = "";
  491. const cqlFilter = "parent_id = '" + this.townId + "'";
  492. this.addVillageBorder(cqlFilter);
  493. this.map.removeLayer(this.deptLayer);
  494. this.deptLayer = "";
  495. const deptNode = this.findNode(this.addrOptions, this.townId);
  496. if (deptNode && deptNode.children) {
  497. this.addDeptLayer(deptNode.children);
  498. }
  499. this.map.removeLayer(this.landLayer);
  500. this.landLayer = "";
  501. this.map.removeLayer(this.homesteadLayer);
  502. this.homesteadLayer = "";
  503. this.deptInfo.leader = null;
  504. this.deptInfo.phone = null;
  505. } else if (this.currentDeptLevel === '3' && zoom < 11) {
  506. this.currentDeptLevel = '4';
  507. this.map.removeLayer(this.borderLayer);
  508. this.borderLayer = "";
  509. this.addTownBorder(this.countyId);
  510. this.map.removeLayer(this.deptLayer);
  511. this.deptLayer = "";
  512. const deptNode = this.findNode(this.addrOptions, this.countyId);
  513. if (deptNode && deptNode.children) {
  514. this.addDeptLayer(deptNode.children);
  515. }
  516. } else if (this.currentDeptLevel === '4' && zoom < 9.5) {
  517. this.currentDeptLevel = '5';
  518. this.map.removeLayer(this.borderLayer);
  519. this.borderLayer = "";
  520. this.addCountyBorder();
  521. this.map.removeLayer(this.deptLayer);
  522. this.deptLayer = "";
  523. const deptNode = this.findNode(this.addrOptions, this.cityId);
  524. if (deptNode && deptNode.children) {
  525. this.addDeptLayer(deptNode.children);
  526. }
  527. }
  528. } else if (this.userRole === 'countyLeader') {
  529. if (this.currentDeptLevel === '2' && zoom < 13) {
  530. this.currentDeptLevel = '3';
  531. this.map.removeLayer(this.borderLayer);
  532. this.borderLayer = "";
  533. const cqlFilter = "parent_id = '" + this.townId + "'";
  534. this.addVillageBorder(cqlFilter);
  535. this.map.removeLayer(this.deptLayer);
  536. this.deptLayer = "";
  537. const deptNode = this.findNode(this.addrOptions, this.townId);
  538. if (deptNode && deptNode.children) {
  539. this.addDeptLayer(deptNode.children);
  540. }
  541. this.map.removeLayer(this.landLayer);
  542. this.landLayer = "";
  543. this.map.removeLayer(this.homesteadLayer);
  544. this.homesteadLayer = "";
  545. this.deptInfo.leader = null;
  546. this.deptInfo.phone = null;
  547. } else if (this.currentDeptLevel === '3' && zoom < 11) {
  548. this.currentDeptLevel = '4';
  549. this.map.removeLayer(this.borderLayer);
  550. this.borderLayer = "";
  551. this.addTownBorder(this.countyId);
  552. this.map.removeLayer(this.deptLayer);
  553. this.deptLayer = "";
  554. const deptNode = this.findNode(this.addrOptions, this.countyId);
  555. if (deptNode && deptNode.children) {
  556. this.addDeptLayer(deptNode.children);
  557. }
  558. }
  559. }
  560. });
  561. },
  562. findNode(tree, deptId) {
  563. for (const node of tree) {
  564. if (node.id === deptId) return node;
  565. if (node.children) {
  566. const res = this.findNode(node.children, deptId);
  567. if (res) return res;
  568. }
  569. }
  570. return null;
  571. },
  572. // 添加区县边界
  573. addCountyBorder() {
  574. this.borderLayer = new ol.layer.Image({
  575. source: new ol.source.ImageWMS({
  576. url: this.mapGeoServerUrl + '/wms',
  577. params: {
  578. LAYERS: this.countyBorderLayerName,
  579. SRID: 3857,
  580. }
  581. }),
  582. name: 'countyBorderLayer'
  583. });
  584. this.map.getLayers().insertAt(2, this.borderLayer);
  585. },
  586. // 添加乡镇边界
  587. addTownBorder(deptId) {
  588. this.borderLayer = new ol.layer.Image({
  589. source: new ol.source.ImageWMS({
  590. url: this.mapGeoServerUrl + "/wms",
  591. params: {
  592. LAYERS: this.townBorderLayerName,
  593. // TILED: true,
  594. cql_filter: "parent_id = '" + deptId + "'",
  595. SRID: 3857,
  596. },
  597. }),
  598. name: 'townBorderLayer'
  599. });
  600. this.map.getLayers().insertAt(2, this.borderLayer);
  601. },
  602. // 添加村边界
  603. addVillageBorder(cqlFilter) {
  604. this.borderLayer = new ol.layer.Image({
  605. source: new ol.source.ImageWMS({
  606. url: this.mapGeoServerUrl + '/wms',
  607. params: {
  608. LAYERS: this.villageBorderLayerName,
  609. cql_filter: cqlFilter,
  610. SRID: 3857,
  611. },
  612. }),
  613. name: 'villageBorderLayer'
  614. });
  615. this.map.getLayers().insertAt(2, this.borderLayer);
  616. },
  617. // 创建矢量数据源
  618. addDeptLayer(depts) {
  619. const createFeatureStyle = function(feature) {
  620. return new ol.style.Style({
  621. image: new ol.style.Icon({
  622. //设置图标偏移
  623. anchor: [0.5, 1],
  624. //标注样式的起点位置
  625. anchorOrigin: "top-right",
  626. //X方向单位:分数
  627. anchorXUnits: "fraction",
  628. //Y方向单位:像素
  629. anchorYUnits: "pixels",
  630. //偏移起点位置的方向
  631. offsetOrigin: "top-right",
  632. //透明度
  633. opacity: 0.9,
  634. // rotation: (Math.PI / 180) * 20,
  635. //图片路径
  636. src: require("../../assets/images/plotPremises/mark.png"),
  637. }),
  638. text: new ol.style.Text({
  639. textAlign: "center", //位置
  640. textBaseline: "bottom", //基准线
  641. font: "normal 14px 微软雅黑", //文字样式
  642. text: feature.get("deptName"), //文本内容
  643. fill: new ol.style.Fill({
  644. //文本填充样式(即文字颜色)
  645. color: "#ffffff",
  646. }),
  647. }),
  648. });
  649. };
  650. let features = [];
  651. for (let i = 0; i < depts.length; i++) {
  652. let feature = new ol.Feature({
  653. geometry: new ol.geom.Point(
  654. ol.proj.fromLonLat([depts[i].lng, depts[i].lat])
  655. ),
  656. deptId: depts[i].id,
  657. deptName: depts[i].label,
  658. // orgCode: depts[i].orgCode,
  659. lat: depts[i].lat,
  660. lng: depts[i].lng,
  661. deptLevel: depts[i].deptLevel,
  662. level: 'deptPoint',
  663. });
  664. // 创建下级部门坐标点
  665. feature.setStyle(createFeatureStyle(feature));
  666. features.push(feature);
  667. }
  668. const vectorSource = new ol.source.Vector({
  669. features: features,
  670. });
  671. // 创建矢量图层
  672. this.deptLayer = new ol.layer.Vector({
  673. source: vectorSource,
  674. name: 'deptLayer'
  675. });
  676. // this.map.addLayer(this.deptLayer);
  677. this.map.getLayers().insertAt(3, this.deptLayer);
  678. },
  679. // 添加地块图层
  680. addLandLayer(deptId) {
  681. /* let params = {};
  682. if (this.street === '全部' && this.cun === '全部') {
  683. params = {
  684. LAYERS: this.homesteadLayerName,
  685. SRID: 3857,
  686. };
  687. } else if (this.street !== '全部' && this.cun === '全部') {
  688. let villageDeptIds = this.houseCunship.map(item => item.deptId);
  689. params = {
  690. LAYERS: this.homesteadLayerName,
  691. cql_filter: "dept_id in (" + villageDeptIds + ")",
  692. SRID: 3857,
  693. };
  694. } else if (this.street !== '全部' && this.cun !== '全部') {
  695. params = {
  696. LAYERS: "zjd_dc:t_sys_dk", // 测试用的图层,正式使用时要换成自己发布的图层
  697. cql_filter: "dept_id = '" + this.deptId + "'",
  698. SRID: 3857,
  699. };
  700. } */
  701. this.landLayer = new ol.layer.Image({
  702. source: new ol.source.ImageWMS({
  703. url: "http://218.59.175.43:8090/geoserver/zjd_dc/wms", // 测试用的geoserver服务器链接,正式使用时需要换掉
  704. params: {
  705. LAYERS: "zjd_dc:t_sys_dk_mobile", // 测试用的图层,正式使用时要换成自己发布的图层
  706. cql_filter: "dept_id = '" + deptId + "'",
  707. SRID: 3857,
  708. }
  709. }),
  710. name: 'landLayer'
  711. });
  712. this.map.addLayer(this.landLayer);
  713. // this.map.getLayers().insertAt(3, this.landLayer);
  714. },
  715. // 添加宅基地图层
  716. addHomesteadLayer(deptId) {
  717. /* let params = {};
  718. if (this.street === '全部' && this.cun === '全部') {
  719. params = {
  720. LAYERS: this.homesteadLayerName,
  721. SRID: 3857,
  722. };
  723. } else if (this.street !== '全部' && this.cun === '全部') {
  724. let villageDeptIds = this.houseCunship.map(item => item.deptId);
  725. params = {
  726. LAYERS: this.homesteadLayerName,
  727. cql_filter: "dept_id in (" + villageDeptIds + ")",
  728. SRID: 3857,
  729. };
  730. } else if (this.street !== '全部' && this.cun !== '全部') {
  731. params = {
  732. LAYERS: "zjd_dc:t_sys_dk", // 测试用的图层,正式使用时要换成自己发布的图层
  733. cql_filter: "dept_id = '" + this.deptId + "'",
  734. SRID: 3857,
  735. };
  736. } */
  737. this.homesteadLayer = new ol.layer.Image({
  738. source: new ol.source.ImageWMS({
  739. url: "http://218.59.175.43:8090/geoserver/zjd_dc/wms", // 测试用的geoserver服务器链接,正式使用时需要换掉
  740. params: {
  741. LAYERS: "zjd_dc:t_homestead_zjdzdxx_mobile", // 测试用的图层,正式使用时要换成自己发布的图层
  742. cql_filter: "dept_id = '" + deptId + "'",
  743. SRID: 3857,
  744. }
  745. }),
  746. name: 'homesteadLayer'
  747. });
  748. this.map.addLayer(this.homesteadLayer);
  749. // this.map.getLayers().insertAt(3, this.homesteadLayer);
  750. },
  751. },
  752. };
  753. </script>
  754. <style scoped lang="scss">
  755. .home_wrapper {
  756. background: #e9e9e9;
  757. min-height: 100vh;
  758. width: 100vw;
  759. }
  760. .num{
  761. font-family: Arial;
  762. }
  763. .map_main{
  764. width: 100%;
  765. height: 100vh;
  766. /*background: url("../../../static/images/plotPremises/map_bg.png") no-repeat center;*/
  767. /*background-size: 100%;*/
  768. }
  769. /deep/ .van-popup{
  770. background: #F1F0F5;
  771. }
  772. /deep/ .van-popup--right{
  773. top: 35%;
  774. .van-icon__image{
  775. width: .7em;
  776. height: .7em;
  777. display: block;
  778. }
  779. }
  780. .top_address{
  781. display: flex;
  782. align-items: center;
  783. position: absolute;
  784. top: 5vh;
  785. left: 3vw;
  786. padding: 1vh 2vh;
  787. background: #ffffff;
  788. border-radius: 5vh;
  789. p{font-size: 1.5vh}
  790. }
  791. .address_icon {
  792. width: 13PX;
  793. height: 17PX;
  794. background: url("../../../static/images/plotPremises/positioning.png") no-repeat;
  795. background-size: 100% 100%;
  796. margin-right: 1vw;
  797. }
  798. .pop_main{
  799. padding: 2vh 3vw;
  800. .pop_title{
  801. display: flex;
  802. align-items: center;
  803. font-size: 2.2vh;
  804. line-height: 1;
  805. }
  806. .pop_content{
  807. display: flex;
  808. justify-content: space-between;
  809. margin-top: 2vh;
  810. .pop_content_left{
  811. background: #ffffff;
  812. width: 48%;
  813. padding: 1.5vh 3vw;
  814. border-radius: 15PX;
  815. .pop_content_left_box{
  816. display: flex;
  817. justify-content: space-between;
  818. margin-top: .5vh;
  819. .border{
  820. border-left: 2PX dashed #DFDFDF;
  821. }
  822. div{
  823. p{
  824. &:first-child{
  825. font-size: 2vh;
  826. color: #797979;
  827. span{
  828. font-size: 1.5vh;
  829. }
  830. }
  831. &:last-child{
  832. font-size: 4vw;
  833. color: #333333;
  834. }
  835. }
  836. &:last-child{
  837. p:last-child{
  838. color: #1B65F8;
  839. }
  840. }
  841. }
  842. }
  843. }
  844. }
  845. .pop_content_zd{
  846. background: #ffffff;
  847. border-radius: 15PX;
  848. display: flex;
  849. justify-content: space-between;
  850. margin-top: 2vh;
  851. overflow: hidden;
  852. img{width: 40%;}
  853. .pop_content_zd_right{
  854. width: 60%;
  855. padding:1.5vh 2.5vh;
  856. font-size: 1.8vh;
  857. display: flex;
  858. flex-direction: column;
  859. justify-content: space-between;
  860. }
  861. }
  862. }
  863. .pop_main_right{
  864. .pop_title{
  865. font-size: 2.2vh;
  866. color: #1B65F8;
  867. padding: 1.5vh;
  868. }
  869. .pop_content_right{
  870. font-size: 1.8vh;
  871. height: 48vh;
  872. overflow-y: scroll;
  873. .active{
  874. box-shadow:0px 0px 5px #999999;
  875. }
  876. .van-row{
  877. padding: 1vh 0;
  878. }
  879. .num{text-align: center;}
  880. }
  881. .pop_btn_right{
  882. display: flex;
  883. width: 100%;
  884. position: absolute;
  885. bottom: 0;
  886. p{
  887. padding: 1.5vh 0;
  888. text-align: center;
  889. font-size: 2vh;
  890. flex: 1;
  891. background: #E1E0E4;
  892. color: #9F9F9F;
  893. }
  894. }
  895. }
  896. </style>