quanyawei
2024-01-10 e13367edf304cb78f978e321f1679299a66b3a23
pages/actionChange/newPage/index.vue
@@ -10,11 +10,18 @@
               @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">
            <view style="display: flex;align-items: center;">
               <u--textarea v-model="form.pollutePosition" border="none" placeholder="请输入"
                  autoHeight></u--textarea>
               <view style="width: 60px;">
                  <u-button @tap="authVerification()" text="地图选择" type="success" size="mini"></u-button>
               </view>
            </view>
            <!-- <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-input> -->
         </u-form-item>
         <u-form-item border-bottom label="责任主体:" prop="unitId" required @click="
               showCheckBox = true;
@@ -88,6 +95,7 @@
</template>
<script>
   import fileUpload from '../components/fileUpload.vue'
   import amap from '../../../libs/amap-wx.js'
   export default {
      components: {
         fileUpload
@@ -175,11 +183,18 @@
            unitList: [],
            polluteList: [],
            fileBaseList: [],
            key: '04a1196c84f5d193c7d91c66150908be',
            amapPlugin: null,
         }
      },
      onReady() {
         //onReady 为uni-app支持的生命周期之一
         this.$refs.uForm.setRules(this.rules)
      },
      onLoad() {
         this.amapPlugin = new amap.AMapWX({
            key: this.key //该key 是在高德中申请的微信小程序key
         })
      },
      onShow() {
         uni.hideTabBar()
@@ -230,7 +245,8 @@
         handerLocation() {
            let that = this
            uni.getLocation({
               type: 'wgs84',
               type: 'gcj02',
               isHighAccuracy: true, //开启高精度定位
               success: function(res) {
                  console.log('111', res)
                  that.handerChooseLocation(res.latitude, res.longitude)
@@ -338,12 +354,14 @@
               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', {
                  ...this.sumbitForm
               }).then(res => {
                  uni.$u.toast('提交成功')
                  this.close()
               }).catch(errors => {
                  uni.$u.toast(errors.split(',')[0])
                  console.log(errors)
               })
            }).catch(errors => {
               uni.$u.toast('校验失败')
@@ -366,12 +384,39 @@
               this.sumbitForm.unitId = userInfor.unitId
               this.form.escalationUnitId = data
               this.sumbitForm.escalationUnitId = userInfor.unitId
            } else {
               if (this.unitList.length > 0) {
                  this.form.unitId = this.unitList[0].unitName
                  this.sumbitForm.unitId = this.unitList[0].unitId
                  this.form.escalationUnitId = this.unitList[0].unitName
                  this.sumbitForm.escalationUnitId = this.unitList[0].unitId
               }
            }
            this.form.escalationName = userInfor.userName || ''
            this.sumbitForm.escalationName = userInfor.userName || ''
            this.form.investigationType = 1
            this.sumbitForm.investigationType = 1
            console.log('this.sumbitForm', this.sumbitForm)
            let that = this
            uni.getLocation({
               type: 'gcj02',
               isHighAccuracy: true, //开启高精度定位
               success: function(res) {
                  that.amapPlugin.getRegeo({
                     type: 'gcj02',
                     location: '' + res.longitude + ',' + res.latitude + '',
                     success: function(e) {
                        that.addressInfor.address = e[0].regeocodeData.name
                        that.addressInfor.latitude = e[0].latitude
                        that.addressInfor.longitude = e[0].longitude
                        that.addressInfor.name = e[0].desc
                        that.form.pollutePosition = e[0].regeocodeData.formatted_address
                     },
                     fail: res => {
                        console.log(JSON.stringify(res))
                     }
                  })
               }
            })
         },
         // 获取责任单位list
         getUnitList() {
@@ -413,6 +458,11 @@
         padding-left: 10px;
      }
      /deep/.u-textarea {
         padding: 0 !important;
         width: calc(100%-70px);
      }
      // /deep/.u-form-item__body {
      //    padding: 8px 0px !important;
      //    font-size: 15px !important;