whx 11 months ago
parent
commit
8a982953fb

+ 23 - 0
virgo.wzfrontend/console/package-lock.json

@@ -13743,6 +13743,21 @@
 				"picocolors": "^1.0.0"
 			}
 		},
+		"uppercamelcase": {
+			"version": "1.1.0",
+			"resolved": "https://registry.npmmirror.com/uppercamelcase/-/uppercamelcase-1.1.0.tgz",
+			"integrity": "sha512-C7YEMvhgrvTEKEEVqA7LXNID/1TvvIwYZqNIKLquS6y/MGSkRQAav9LnTTILlC1RqUM8eTVBOe1U/fnB652PRA==",
+			"requires": {
+				"camelcase": "^1.2.1"
+			},
+			"dependencies": {
+				"camelcase": {
+					"version": "1.2.1",
+					"resolved": "https://registry.npmmirror.com/camelcase/-/camelcase-1.2.1.tgz",
+					"integrity": "sha512-wzLkDa4K/mzI1OSITC+DUyjgIl/ETNHE9QvYgy6J6Jvqyyz4C0Xfd+lQhb19sX2jMpZV4IssUn0VDVmglV+s4g=="
+				}
+			}
+		},
 		"uri-js": {
 			"version": "4.4.1",
 			"resolved": "https://registry.npmmirror.com/uri-js/-/uri-js-4.4.1.tgz",
@@ -13877,6 +13892,14 @@
 				"csstype": "^3.1.0"
 			}
 		},
+		"vue-amap": {
+			"version": "0.5.10",
+			"resolved": "https://registry.npmmirror.com/vue-amap/-/vue-amap-0.5.10.tgz",
+			"integrity": "sha512-9ViNCev1vx32+zZ5RvF/TmUZNbwL9QrdA2/OnD2GlXMfQBkJy7D08Vb7379t6guqnopDPtWJ8K6gg72h9+4GUg==",
+			"requires": {
+				"uppercamelcase": "^1.1.0"
+			}
+		},
 		"vue-eslint-parser": {
 			"version": "5.0.0",
 			"resolved": "https://registry.npmmirror.com/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz",

+ 1 - 0
virgo.wzfrontend/console/package.json

@@ -18,6 +18,7 @@
 		"svg-sprite-loader": "^6.0.11",
 		"terser-webpack-plugin": "^3.0.1",
 		"vue": "^2.6.10",
+		"vue-amap": "^0.5.10",
 		"vue-router": "^3.1.3",
 		"vuex": "^3.0.1"
 	},

+ 1 - 1
virgo.wzfrontend/console/src/components/system/field/edit.vue

@@ -48,7 +48,7 @@
 		created() {
 			this.mapDatas = this.getCityName(mapData.data);
 			if (this.isUpdate) {
-				this.form = JSON.parse(JSOn.stringify(this.detail));
+				this.form = JSON.parse(JSON.stringify(this.detail));
 				this.address = findParentLabel(this.mapDatas, this.form.code);
 			}
 		},

+ 13 - 1
virgo.wzfrontend/console/src/components/work/space/project/edit.vue

@@ -12,6 +12,12 @@
 						</el-option>
 					</el-select>
 				</el-form-item>
+				<el-form-item label="经度" prop="longitude" :rules="[{required: true, message: '请输入经度'}]">
+					<el-input type="text" v-model="projectForm.longitude" placeholder="请输入经度"></el-input>
+				</el-form-item>
+				<el-form-item label="纬度" prop="latitude" :rules="[{required: true, message: '请输入纬度'}]">
+					<el-input type="text" v-model="projectForm.latitude" placeholder="请输入纬度"></el-input>
+				</el-form-item>
 				<el-form-item label="项目区域" prop="address" :rules="[{required: true, message: '请选择项目区域'}]">
 					<city v-model="projectForm.address"></city>
 				</el-form-item>
@@ -61,7 +67,9 @@
 					organizationId: '',
 					picture: '',
 					tagIds: '',
-					type: 1
+					type: 1,
+					longitude: '',
+					latitude: ''
 				},
 				specific: '',
 				responsibility: []
@@ -73,6 +81,9 @@
 				getProjectDetailById(this.detailId).then(res => {
 					if (res.state) {
 						this.projectForm = res.data;
+						let address = res.data.coordinates.split(',');
+						this.projectForm.longitude = address[0];
+						this.projectForm.latitude = address[1];
 						this.projectForm.address = JSON.parse(this.projectForm.address);
 						if (this.projectForm.picture) this.responsibility = JSON.parse(this.projectForm.picture);
 						if (this.projectForm.data) {
@@ -94,6 +105,7 @@
 						postData['picture'] = JSON.stringify(this.$refs.upload.fileList);
 						postData['address'] = JSON.stringify(this.projectForm.address);
 						postData['tagIds'] = this.$refs.tag.tagIds();
+						postData['coordinates'] = postData.longitude + ',' + postData.latitude;
 						if (this.isUpdate) {
 							updateProject(postData).then(this.successFunc);
 						} else {

+ 10 - 0
virgo.wzfrontend/console/src/main.js

@@ -35,6 +35,16 @@ Vue.prototype.$confirm = (title, callback) => {
 		type: 'warning'
 	}).then(callback).catch(() => {});
 };
+
+import VueAMap from "vue-amap"; //导入
+Vue.use(VueAMap); //使用
+// 初始化vue-amap
+VueAMap.initAMapApiLoader({
+	key: "8d6519155e085eb1b83d1de7953b2414", // 你申请的高德地图的key 
+	plugin: ["AMap.Autocomplete", "AMap.Geocoder", "AMap.Geolocation"],
+	v: "1.4.15",
+	uiVersion: "1.1"
+});
 //router拦截器
 import './uitls/permission'
 new Vue({

+ 9 - 0
virgo.wzfrontend/console/src/router/modules/work.js

@@ -0,0 +1,9 @@
+const work = [{
+	path: '',
+	component: () => import('@/views/work'),
+	name: '首页',
+	meta: {
+		title: '首页'
+	}
+}]
+export default work;

+ 29 - 3
virgo.wzfrontend/console/src/views/work/index.vue

@@ -1,12 +1,38 @@
 <template>
-	<div class="work">
-		
+	<div id="map">
+		<iframe id="test"
+			src="https://m.amap.com/picker?key=880f8193c52d9dee80cd82212d9508cf&keywords=3e392dc7eb2cf2c04b1b8899776e8905"></iframe>
 	</div>
 </template>
 
 <script>
+	export default {
+		data() {
+			return {
+				serachValue: ''
+			}
+		},
+		created() {
+			this.$nextTick(() => {
+				var iframe = document.getElementById('test').contentWindow;
+				document.getElementById('test').onload = function() {
+					iframe.postMessage('hello', 'https://m.amap.com/picker/');
+				};
+				window.addEventListener("message", function(e) {
+					console.log(e)
+				}, false);
+			})
+		},
+		methods: {
+			initSearch() {}
+		},
+	}
 </script>
 
 <style lang="scss">
-	
+	#test,
+	#map {
+		width: 100%;
+		height: 100%;
+	}
 </style>