From 659d09ec24dab6c451220c8f3bb3943b0fdb3ba1 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 08 Jan 2024 16:16:12 +0800
Subject: [PATCH] fix:地图导航

---
 pages/actionChange/newPage/index.vue |  143 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 123 insertions(+), 20 deletions(-)

diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue
index e84ee88..6c34083 100644
--- a/pages/actionChange/newPage/index.vue
+++ b/pages/actionChange/newPage/index.vue
@@ -10,7 +10,11 @@
 					@confirm="checkTime" @cancel='showeEscalationTime=false' />
 			</u-form-item>
 			<u-form-item border-bottom label="������������:" prop="pollutePosition" required>
-				<u-input v-model="form.pollutePosition" border="none" placeholder="���������" type="text" />
+				<u-input v-model="form.pollutePosition" border="none" placeholder="���������" type="text">
+					<template slot="suffix">
+						<u-button @tap="authVerification()" text="������������" type="success" size="mini"></u-button>
+					</template>
+				</u-input>
 			</u-form-item>
 			<u-form-item border-bottom label="������������:" prop="unitId" required @click="
 					showCheckBox = true;
@@ -27,16 +31,14 @@
 					type="select" />
 				<u-icon slot="right" name="arrow-right" />
 			</u-form-item>
-			<u-form-item border="none" border-bottom label="������������:" prop="changeType" required @click="
-					showCheckBox = true;
-					hideKeyboard('changeEnum', 'changeType');
-				">
-				<u-input v-model="form.changeType" border="none" disabled disabled-color="#ffffff" placeholder="���������"
-					type="select" />
-				<u-icon slot="right" name="arrow-right" />
+			<u-form-item border="none" border-bottom label="������������:" prop="changeType" required>
+				<u-radio-group v-model="form.changeType" style="font-size: 13px;">
+					<u-radio :key="index" v-for="(item, index) in changeEnum" :customStyle="{marginRight: '16px'}"
+						:label="item.name" :name="item.value" />
+				</u-radio-group>
 			</u-form-item>
-			<u-form-item border-bottom label="������������:" placeholder="���������" required>
-				<u-input v-model="form.changeDay" border="none" type="number" />
+			<u-form-item border-bottom label="������������:" placeholder="���������" required :disabled='Number(form.changeType)===1'>
+				<u-input v-model="form.changeDay" border="none" type="number" :disabled='Number(form.changeType)===1' />
 			</u-form-item>
 			<u-form-item border-bottom label="������������:" prop="escalationUnitId" required @click="
 					showCheckBox = true;
@@ -52,7 +54,13 @@
 			<u-form-item border-bottom label="������������:" prop="investigationType" required>
 				<u-radio-group v-model="form.investigationType" style="font-size: 13px;">
 					<u-radio :key="index" v-for="(item, index) in Dic.investigationEnum"
-						:custom-style="{marginRight: '8px'}" :label="item.name" :name="item.value" />
+						:customStyle="{marginRight: '16px'}" :label="item.name" :name="item.value" />
+				</u-radio-group>
+			</u-form-item>
+			<u-form-item border-bottom label="������������:" prop="keyPoint">
+				<u-radio-group v-model="form.keyPoint" style="font-size: 13px;" placement='column'>
+					<u-radio :key="index" v-for="(item, index) in Dic.emphasisEnum" :customStyle="{marginTop: '10px'}"
+						:label="item.name" :name="item.value" />
 				</u-radio-group>
 			</u-form-item>
 			<u-form-item border-bottom label="������������:" prop="problemDescribe" required>
@@ -65,7 +73,7 @@
 			</u-form-item>
 		</u-form>
 		<u-picker :show="showCheckBox" keyName="label" :columns="actionOptionList" @cancel="showCheckBox = false"
-			@confirm="selectBack"></u-picker>
+			:default-selector="[0]" :immediateChange='true' @confirm="selectBack"></u-picker>
 		<!-- 	<u-action-sheet v-if="actionOptionList.length > 0" :actions="actionOptionList" :show="showCheckBox" title="���������"
 			@close="showCheckBox = false" @select="selectBack" /> -->
 		<view class="bunts">
@@ -91,6 +99,7 @@
 				labelStyle: {
 					fontSize: '30.77rpx'
 				},
+				addressInfor: {},
 				showeEscalationTime: false,
 				actionOptionList: [],
 				rules: {
@@ -100,11 +109,6 @@
 						trigger: ['blur', 'change']
 					},
 					'polluteType': {
-						required: true,
-						message: '���������',
-						trigger: ['blur', 'change']
-					},
-					'changeType': {
 						required: true,
 						message: '���������',
 						trigger: ['blur', 'change']
@@ -154,6 +158,7 @@
 					escalationTime: '',
 					problemDescribe: '',
 					pollutePosition: '',
+					keyPoint: 0
 				},
 				sumbitForm: {
 					unitId: '',
@@ -165,6 +170,7 @@
 					escalationTime: '',
 					problemDescribe: '',
 					pollutePosition: '',
+					keyPoint: null
 				},
 				unitList: [],
 				polluteList: [],
@@ -189,7 +195,88 @@
 			return false
 		},
 		methods: {
+			authVerification() {
+				uni.getSetting({
+					success: res => {
+						if (res.authSetting['scope.userLocation']) {
+							/* ������������������������������ */
+							this.handerLocation()
+						} else if (res.authSetting['scope.userLocation'] === undefined) {
+							/* ��������������������������� */
+							console.log('������������', res)
+							this.handleOpenSetting()
+						} else {
+							/* ��������������������������������� */
+							console.log('��������������� false')
+							this.handleOpenSetting()
+						}
+					},
+				})
+			},
+			handerChooseLocation(latitude, longitude) {
+				uni.chooseLocation({
+					latitude: latitude || '',
+					longitude: longitude || '',
+					success: res => {
+						console.log('������������', res)
+						this.addressInfor = res
+						this.form.pollutePosition = res.address
+					},
+					fail: function(err) {
+						console.log('������������', err)
+					}
+				})
+			},
+			handerLocation() {
+				let that = this
+				uni.getLocation({
+					type: 'wgs84',
+					success: function(res) {
+						console.log('111', res)
+						that.handerChooseLocation(res.latitude, res.longitude)
+					},
+					fail(error) {
+						console.log('������', error)
+					}
+				})
+			},
+			handleOpenSetting() {
+				let that = this
+				uni.authorize({
+					scope: 'scope.userLocation',
+					success() {
+						console.log('res', '1111')
+						//���������������--��������������������������������������� ���������������������������������
+						that.handerLocation()
+					},
+					fail(error) {
+						//������������������������--������������������������������������--������������������������������������������������
+						console.log('������������', error)
+						uni.showModal({
+							title: '������',
+							content: '������������������������������������������������',
+							cancelText: '���������',
+							confirmText: '������',
+							success(res) {
+								console.log(res)
+								if (res.confirm) {
+									// ���������������������
+									uni.openSetting({
+										success(res) {
+											that.handerLocation()
+										}
+									})
+								} else if (res.cancel) {
+									// ��������������� ���������
+									console.log('���������������������')
+								}
+							}
+						})
+					}
+				})
+			},
 			handleFile(data) {
+				console.log('datadata', data)
 				this.fileBaseList = data
 			},
 			close() {
@@ -218,6 +305,14 @@
 				console.log(e)
 				this.form[this.currentKey] = e.value[0].label
 				this.sumbitForm[this.currentKey] = e.value[0].id
+				console.log('this.form.changeType', this.currentKey)
+				if (Number(this.sumbitForm.changeType) !== 1) {
+					this.sumbitForm.changeDay = '0'
+					this.form.changeDay = '0'
+				} else {
+					this.sumbitForm.changeDay = ''
+					this.form.changeDay = ''
+				}
 				this.showCheckBox = false
 			},
 			checkTime(e) {
@@ -228,13 +323,20 @@
 				this.sumbitForm.escalationTime = data
 			},
 			submit() {
+				console.log('this.sumbitForm', this.form)
 				this.$refs.uForm.validate().then(res => {
 					this.sumbitForm.problemDescribe = this.form.problemDescribe
 					this.sumbitForm.pollutePosition = this.form.pollutePosition
+					this.sumbitForm.address = this.addressInfor.address
+					this.sumbitForm.latitude = this.addressInfor.latitude
+					this.sumbitForm.longitude = this.addressInfor.longitude
+					this.sumbitForm.name = this.addressInfor.name
 					this.sumbitForm.changeDay = this.form.changeDay
 					this.sumbitForm.escalationName = this.form.escalationName
 					this.sumbitForm.investigationType = this.form.investigationType
 					this.sumbitForm.fileBaseList = this.fileBaseList
+					this.sumbitForm.changeType = this.form.changeType
+					this.sumbitForm.keyPoint = this.form.keyPoint
 					this.sumbitForm.state = '20'
 					console.log('this.sumbitForm', this.sumbitForm)
 					this.$http.httpPost('/allocation/insert', {
@@ -253,7 +355,7 @@
 				this.form.escalationTime = data
 				this.sumbitForm.escalationTime = data
 				if (this.changeEnum.length > 0) {
-					this.form.changeType = this.changeEnum[0].name
+					this.form.changeType = this.changeEnum[0].value
 					this.sumbitForm.changeType = this.changeEnum[0].value
 				}
 				let userInfor = JSON.parse(uni.getStorageSync('userInfor') || '{}')
@@ -265,8 +367,8 @@
 					this.form.escalationUnitId = data
 					this.sumbitForm.escalationUnitId = userInfor.unitId
 				}
-				this.form.escalationName = userInfor.name || ''
-				this.sumbitForm.escalationName = userInfor.name || ''
+				this.form.escalationName = userInfor.userName || ''
+				this.sumbitForm.escalationName = userInfor.userName || ''
 				this.form.investigationType = 1
 				this.sumbitForm.investigationType = 1
 				console.log('this.sumbitForm', this.sumbitForm)
@@ -277,6 +379,7 @@
 					this.unitList = res.data
 					this.Dic = JSON.parse(uni.getStorageSync('dict') || '[]')
 					this.changeEnum = this.Dic.changeEnum
+					this.changeEnum = this.Dic.changeEnum
 					this.setDefaultValue()
 				})
 			},

--
Gitblit v1.8.0