Explorar o código

闲置厂房地图功能

yin_yu820 hai 16 horas
pai
achega
efccd34c0f

+ 2 - 1
jp-console/jeeplus-module/ly/src/main/java/com/jeeplus/idlefactorybuildings/mapper/xml/IdleFactoryBuildingsMapper.xml

@@ -71,7 +71,8 @@
 				 ON a.value = b.park
 				 AND b.del_flag = 0 and b.state=1
 		WHERE a.dict_type_id = '1995785139824984065'
-		GROUP BY a.label;
+		GROUP BY a.label
+		ORDER BY a.sort asc;
 	</select>
 
 </mapper>

+ 12 - 12
jp-mobile/pages/factoryBuildings/factoryBuildingsList.vue

@@ -152,29 +152,29 @@
 		    this.$nextTick(() => {
 		      if (query.parkid === '台创园') {
 		        this.searchForm.park = '1';
-		      } else if (query.parkid === '大冈镇') {
+		      } else if (query.parkid === '大冈镇'|| query.parkid === '大冈') {
 		        this.searchForm.park = '2';
-		      } else if (query.parkid === '大纵湖镇' || query.parkid === '大纵湖旅游度假区') {
+		      } else if (query.parkid === '大纵湖镇' || query.parkid === '大纵湖旅游度假区'|| query.parkid === '大纵湖') {
 		        this.searchForm.park = '3';
-		      } else if (query.parkid === '学富镇') {
+		      } else if (query.parkid === '学富镇'|| query.parkid === '学富') {
 		        this.searchForm.park = '4';
-		      } else if (query.parkid === '尚庄镇') {
+		      } else if (query.parkid === '尚庄镇'|| query.parkid === '尚庄') {
 		        this.searchForm.park = '5';
-		      } else if (query.parkid === '张庄街道') {
+		      } else if (query.parkid === '张庄街道'|| query.parkid === '张庄') {
 		        this.searchForm.park = '6';
-		      } else if (query.parkid === '楼王镇') {
+		      } else if (query.parkid === '楼王镇'|| query.parkid === '楼王') {
 		        this.searchForm.park = '7';
-		      } else if (query.parkid === '潘黄街道') {
+		      } else if (query.parkid === '潘黄街道'|| query.parkid === '潘黄') {
 		        this.searchForm.park = '8';
-		      } else if (query.parkid === '盐渎街道') {
+		      } else if (query.parkid === '盐渎街道'|| query.parkid === '盐渎') {
 		        this.searchForm.park = '9';
-		      } else if (query.parkid === '秦南镇') {
+		      } else if (query.parkid === '秦南镇'|| query.parkid === '秦南') {
 		        this.searchForm.park = '10';
-		      } else if (query.parkid === '郭猛镇') {
+		      } else if (query.parkid === '郭猛镇'|| query.parkid === '郭猛') {
 		        this.searchForm.park = '11';
-		      } else if (query.parkid === '盐龙街道') {
+		      } else if (query.parkid === '盐龙街道'|| query.parkid === '高新区') {
 		        this.searchForm.park = '12';
-		      } else if (query.parkid === '龙冈镇') {
+		      } else if (query.parkid === '龙冈镇'|| query.parkid === '龙冈') {
 		        this.searchForm.park = '13';
 		      }
 		    });

+ 75 - 24
jp-mobile/pages/index/factoryindex.vue

@@ -1,9 +1,16 @@
 <template>
   <view class="page">
-    <!-- 1. 顶部标题 -->
-    <view class="header">
-      <text class="title">{{title}}</text>
-    </view>
+	<!-- 1. 顶部标题 -->
+	<view class="header">
+	  <text class="title">{{title}}</text>
+	  <!-- 新增地图按钮 -->
+	  <image
+	    class="map-btn"
+	    src="/static/img/map.png"
+	    mode="aspectFit"
+	    @tap="goMap"
+	  />
+	</view>
 
     <!-- 2. 轮播图 -->
     <swiper
@@ -20,16 +27,33 @@
     </swiper>
 
     <!-- 3. 九宫格导航 -->
-    <view class="grid-box">
+<!--    <view class="grid-box">
       <view
         v-for="(item,index) in parkList2"
         :key="index"
         class="grid-card"
-        @tap="goListByValue(item.value)"
+        @tap="goListByValue(item.label)"
       >
         <text class="grid-label">{{item.label}}</text>
       </view>
-    </view>
+    </view> -->
+	
+	<!-- 3. 九宫格导航 -->
+	<view class="grid-box">
+	  <view
+	    v-for="(item,index) in parkList2"
+	    :key="index"
+	    class="grid-card"
+	    @tap="goListByValue(item.label)"
+	  >
+	    <!-- 上:名称 -->
+	    <text class="grid-label">{{item.label}}</text>
+	    <!-- 下:数量 -->
+	    <text class="grid-num">闲置厂房{{item.building_cnt}} 处</text>
+	  </view>
+	</view>
+	
+	
 
     <!-- 地图已注释,如需恢复直接放开即可 -->
     <!--
@@ -44,6 +68,7 @@
 
 <script>
 // import * as echarts from 'echarts'   // 如不用地图可注释
+import loginService from "@/api/auth/loginService";
 
 export default {
   data() {
@@ -55,22 +80,7 @@ export default {
         'https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg',
         'https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg'
       ],
-      parkList2: [
-        { label: '全部', value: '' },
-        { label: '台创园', value: '台创园' },
-        { label: '大冈', value: '大冈镇' },
-        { label: '大纵湖', value: '大纵湖镇' },
-        { label: '学富', value: '学富镇' },
-        { label: '尚庄', value: '尚庄镇' },
-        { label: '张庄', value: '张庄街道' },
-        { label: '楼王', value: '楼王镇' },
-        { label: '潘黄', value: '潘黄街道' },
-        { label: '盐渎', value: '盐渎街道' },
-        { label: '秦南', value: '秦南镇' },
-        { label: '郭猛', value: '郭猛镇' },
-        { label: '高新区', value: '盐龙街道' },
-        { label: '龙冈', value: '龙冈镇' }
-      ]
+      parkList2: []
     }
   },
 
@@ -87,13 +97,37 @@ export default {
   }
   */
 
+  onShow() {
+  	loginService.getParkList().then(({
+  		data
+  	}) => {
+		let alls=0;
+		for(var i = 0; i < data.length; i++){
+			alls=alls+data[i].building_cnt;
+		}
+		
+		this.allcount=alls;		
+		this.parkList2=data;
+		this.parkList2.unshift({total_area: 0, total_idle_area: 0, building_cnt: alls, label: "全部"})
+		
+  	}).catch(e => {
+  		
+  	})
+  	
+  },
+
   methods: {
     // 九宫格跳转
     goListByValue(val) {
       uni.navigateTo({
         url: `/pages/factoryBuildings/factoryBuildingsList?parkid=${val}`
       })
-    }
+    },
+	goMap() {
+		uni.navigateTo({
+		  url: `/pages/index/factoryindex4`   // 换成你的地图页面路径
+		})
+	  }
   }
 }
 </script>
@@ -108,6 +142,7 @@ export default {
 
 /* 顶部标题 */
 .header {
+  position: relative;   /* 让子元素绝对定位参照它 */
   padding: 20rpx 0;
   text-align: center;
   background: #fff;
@@ -117,6 +152,15 @@ export default {
   font-weight: bold;
   color: #333;
 }
+/* 右上角地图按钮 */
+.map-btn {
+  position: absolute;
+  right: 30rpx;
+  top: 50%;
+  transform: translateY(-50%);
+  width: 48rpx;
+  height: 48rpx;
+}
 
 /* 轮播图 */
 .swiper {
@@ -139,6 +183,12 @@ export default {
   background: #fff;
 }
 
+.grid-num {
+  margin-top: 8rpx;
+  font-size: 24rpx;
+  color: rgba(255,255,255,.85);
+}
+
 .grid-card {
   display: flex;
   align-items: center;
@@ -148,6 +198,7 @@ export default {
   border-radius: 16rpx;
   box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.08);
   transition: transform 0.15s;
+  flex-direction: column;
 }
 .grid-card:active {
   transform: scale(0.96);

+ 103 - 2
jp-mobile/pages/index/factoryindex4.vue

@@ -3,6 +3,13 @@
     <!-- 1. 顶部标题 -->
     <view class="header">
       <text class="title">{{title}}</text>
+	  <!-- 新增地图按钮 -->
+	  <image
+	    class="map-btn"
+	    src="/static/img/tab.png"
+	    mode="aspectFit"
+	    @tap="goMap"
+	  />
     </view>
 
     <!-- 2. 轮播图 -->
@@ -30,6 +37,7 @@
 
 <script>
 import * as echarts from 'echarts'
+import loginService from "@/api/auth/loginService";
 
 export default {
   data() {
@@ -41,6 +49,8 @@ export default {
       "https://ydwqfw.com.cn/yd_qycpfbH5/bg2.jpg",
       "https://ydwqfw.com.cn/yd_qycpfbH5/bg3.jpg",
       "https://ydwqfw.com.cn/yd_qycpfbH5/bg4.jpg"],
+	  parkList2: [],
+	  buildingMap: new Map()   // 新增
     }
   },
   async onReady() {
@@ -65,9 +75,69 @@ export default {
       width : uni.getSystemInfoSync().windowWidth,
       height: uni.getSystemInfoSync().windowHeight * 0.6   // 地图占屏幕 50%
     })
-    this.renderMap()
+	this.getList()    
   },
+  
   methods: {
+	getList() {
+	  	loginService.getParkList().then(({
+	  		data
+	  	}) => {		
+			
+			let alls = 0
+			  data.forEach(item => { alls += item.building_cnt })
+			  
+			  for(var i = 0; i < data.length; i++){
+			  	alls=alls+data[i].building_cnt;
+				
+				if(data[i].label.indexOf("高新区") != -1){
+					data[i].label='盐龙'
+				}
+				// if(data[i].label.indexOf("大冈") != -1){
+				// 	data[i].label='大冈镇'
+				// }else if(data[i].label.indexOf("大纵湖") != -1){
+				// 	data[i].label='大纵湖镇'
+				// }else if(data[i].label.indexOf("学富") != -1){
+				// 	data[i].label='学富镇'
+				// }else if(data[i].label.indexOf("尚庄") != -1){
+				// 	data[i].label='尚庄镇'
+				// }else if(data[i].label.indexOf("张庄") != -1){
+				// 	data[i].label='张庄镇'
+				// }else if(data[i].label.indexOf("楼王") != -1){
+				// 	data[i].label='楼王镇'
+				// }else if(data[i].label.indexOf("潘黄") != -1){
+				// 	data[i].label='潘黄街道'
+				// }else if(data[i].label.indexOf("盐渎") != -1){
+				// 	data[i].label='盐渎街道'
+				// }else if(data[i].label.indexOf("秦南") != -1){
+				// 	data[i].label='秦南镇'
+				// }else if(data[i].label.indexOf("郭猛") != -1){
+				// 	data[i].label='郭猛镇'
+				// }else if(data[i].label.indexOf("高新区") != -1){
+				// 	data[i].label='盐龙街道'
+				// }else if(data[i].label.indexOf("龙冈") != -1){
+				// 	data[i].label='龙冈镇'
+				// }
+				
+			  }
+			  
+		
+			  this.allcount = alls
+			  this.parkList2 = data
+		
+			  /* 构造 name -> building_cnt 映射表 */
+			  this.buildingMap = new Map(data.map(item => [item.label, item.building_cnt]))
+		
+			  /* 插入“全部”汇总行 */
+			  this.parkList2.unshift({ total_area: 0, total_idle_area: 0, building_cnt: alls, label: '全部' })
+		
+			  this.renderMap()
+			
+	  	}).catch(e => {
+	  		
+	  	})
+	  	
+	},
     loadGeoJSON() {
       return new Promise((resolve, reject) => {
         uni.request({
@@ -85,6 +155,11 @@ export default {
 	      url: `/pages/factoryBuildings/factoryBuildingsList?parkid=${parkName}`
 	    })
 	},
+	goMap() {
+		uni.navigateTo({
+		  url: `/pages/index/factoryindex`   // 换成你的地图页面路径
+		})
+	},
 	onTouchEnd(e) {
 		
 	  const touch = e.changedTouches[0]
@@ -121,6 +196,16 @@ export default {
 	},
 	
     renderMap() {
+		const mapData = []
+		/* 如果你知道所有镇名,可以写死;否则把 geoJSON 里的名字读出来即可 */
+		const townNames = ['台创园', '大冈镇', '大纵湖镇', '学富镇', '尚庄镇', '张庄街道', '楼王镇','潘黄街道','盐渎街道', '秦南镇', '郭猛镇', '盐龙街道', '龙冈镇']
+		townNames.forEach(name => {
+		  mapData.push({
+			name,
+			value: this.buildingMap.get(name) || 0   // 没有就按 0 处理
+		  })
+		})
+		
       const option = {
          geo: [{
               map: 'yanduqu',
@@ -174,9 +259,15 @@ export default {
                 color: '#fff',       // 文字颜色
                 fontSize: 12,        // 字号
                 fontWeight: 'bold',
+				/* 关键:让标签显示两行 */
+				  formatter: params => {
+					const cnt = this.buildingMap.get(params.name) || 0
+					return `${params.name} ${cnt} 处`
+					//return `${params.name}`
+				  }
               }
             }],
-            series: [{ type: 'map', geoIndex: 0, data: [] }]
+            series: [{ type: 'map', geoIndex: 0, data: mapData    },]
       }
       this.chart.setOption(option)
 
@@ -201,6 +292,7 @@ export default {
 
 /* 顶部标题 */
 .header {
+  position: relative;   /* 让子元素绝对定位参照它 */
   padding: 20rpx 0;
   text-align: center;
   background: #fff;
@@ -210,6 +302,15 @@ export default {
   font-weight: bold;
   color: #333;
 }
+/* 右上角地图按钮 */
+.map-btn {
+  position: absolute;
+  right: 30rpx;
+  top: 50%;
+  transform: translateY(-50%);
+  width: 48rpx;
+  height: 48rpx;
+}
 
 /* 轮播图 */
 .swiper {

+ 13 - 13
jp-mobile/static/yandu.json

@@ -3,7 +3,7 @@
     "features": [
         {
             "properties": {
-                "name": "楼王",
+                "name": "楼王",
                 "center": "",
                 "id": "2200414339a4ca2183f2864cc5b63e37",
                 "type": "wangge",
@@ -822,7 +822,7 @@
         },
         {
             "properties": {
-                "name": "学富",
+                "name": "学富",
                 "id": "401a8b59e74f609c2c4c549be0476c17",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -1644,7 +1644,7 @@
         },
         {
             "properties": {
-                "name": "龙冈",
+                "name": "龙冈",
                 "id": "900da5ce6157746da71fda5a29baf45f",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -3124,7 +3124,7 @@
         },
         {
             "properties": {
-                "name": "大纵湖",
+                "name": "大纵湖",
                 "id": "7bcd4243221b10c8b809a1589da225b5",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -4446,7 +4446,7 @@
         },
         {
             "properties": {
-                "name": "尚庄",
+                "name": "尚庄",
                 "id": "b9f6b35850f4c50056a56cb8c6c1b40c",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -5100,7 +5100,7 @@
         },
         {
             "properties": {
-                "name": "秦南",
+                "name": "秦南",
                 "id": "06893a14707961bbdca74368876cda12",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -5798,7 +5798,7 @@
         },
         {
             "properties": {
-                "name": "大冈镇",
+                "name": "台创园",
                 "id": "3ca773e2d93fe9458136eed3402488a8",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -6648,7 +6648,7 @@
         },
         {
             "properties": {
-                "name": "郭猛",
+                "name": "郭猛",
                 "id": "bf864b0a71f7fb1f0c4b12de60156385",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -7266,7 +7266,7 @@
         },
         {
             "properties": {
-                "name": "盐龙街道",
+                "name": "盐龙",
                 "id": "aa9a4915432685f50edf75a10330b6d0",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -7876,7 +7876,7 @@
         },
         {
             "properties": {
-                "name": "张庄街道",
+                "name": "张庄",
                 "id": "10a9e3834af6eb2e8873ce785eb8933d",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -8275,7 +8275,7 @@
         
         {
             "properties": {
-                "name": "盐渎街道",
+                "name": "盐渎",
                 "id": "5a22be16d1854c8d3ceacc4f6a78cf6e",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -8761,7 +8761,7 @@
         },
         {
             "properties": {
-                "name": "潘黄街道",
+                "name": "潘黄",
                 "id": "70f3b37cc798f7d58c49e668d74a1f28",
                 "type": "wangge",
                 "color": "#e6f6ff",
@@ -9499,7 +9499,7 @@
         },
         {
             "properties": {
-                "name": "大冈",
+                "name": "大冈",
                 "id": "ec8c33738b027a3cce3590a823a70c24",
                 "type": "wangge",
                 "color": "#e6f6ff",