Ver código fonte

feat(digitalDoor): 新增标准地址选择功能

- 添加门牌列表接口和相关组件
- 实现标准地址选择弹窗和搜索功能
- 在人口管理页面集成标准地址选择
- 优化兴趣点选择样式
- 更新请求头中的 Token 获取方式
梦辉 4 dias atrás
pai
commit
799132544f

+ 9 - 0
src/api/digitalDoor.js

@@ -62,4 +62,13 @@ export function getAllStripLineInfo (data) {
  */
 export function getOfficeAll (data) {
     return myFetch('/system/bk/getOfficeAll', 'get', data, 'json');
+}
+
+/**
+ * 门牌列表
+ * 获取标准地址
+ * getHouseNumberList
+ */
+export function getHouseNumberList (data) {
+    return myFetch('/house-number/getHouseNumberList', 'get', data, 'json');
 }

+ 1 - 0
src/pages/components/addressSelect/index.vue

@@ -327,6 +327,7 @@ export default {
                         @click="handleRoomClick(item)"/>
             </van-list>
           </van-popup>
+          <slot></slot>
         </view>
       </view>
     </van-form>

+ 1 - 1
src/pages/components/interestSelect/index.vue

@@ -175,7 +175,7 @@ export default {
   line-height: 40rpx;
   border-radius: 8rpx;
   text-align: center;
-  background-color: #f2f2f2;
+  background-color: #191c1f33;
   color: black;
 }
 .tagSelected {

+ 111 - 0
src/pages/components/standAddressSelect/index.vue

@@ -0,0 +1,111 @@
+<script>
+import {getHouseNumberList} from "@/api/digitalDoor";
+
+export default {
+  props: {
+    show: {
+      type: Boolean,
+      default: false
+    }
+  },
+  computed: {
+    houseNumberDialogShow: {
+      get() {
+        return this.show
+      },
+      set(val) {
+        this.$emit('update:show', val)
+      }
+    }
+  },
+  data() {
+    return {
+      form: {
+        houseNumberAddress: '',
+      },
+      finished: false,
+      loading: false,
+      list: [],
+      queryParams:{
+        current: 1,
+        size: 10
+      }
+    }
+  },
+  methods: {
+    async getList() {
+      try {
+        this.loading = true
+        const res = await getHouseNumberList({
+          ...this.queryParams,
+          houseNumberAddress: this.form.houseNumberAddress
+        })
+        this.list = this.list.concat(res.data)
+        this.finished = res.data.length < 10
+        this.loading = false
+        this.queryParams.current++
+      } catch (e) {
+        console.log(e)
+        this.finished = true
+        this.loading = false
+      }
+    },
+    submit() {
+      this.queryParams.current = 1
+      this.list = []
+      this.getList()
+    },
+    handleAddressClick(item) {
+      this.$emit('click', item)
+    }
+  }
+}
+</script>
+
+<template>
+  <view>
+    <van-popup v-model="houseNumberDialogShow" position="bottom" :style="{ height: '35%' }">
+      <view class="popup-box">
+        <view class="search-group">
+          <van-field v-model="form.houseNumberAddress" placeholder="请搜索关键词"></van-field>
+          <van-button size="small" color="#198bfe" type="primary" @click="submit">搜索</van-button>
+        </view>
+        <view class="list-content">
+          <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getList">
+            <van-cell v-for="(item,index) in list" :key="index" :title="item.houseNumberAddress" @click="handleAddressClick(item)"/>
+          </van-list>
+        </view>
+      </view>
+    </van-popup>
+  </view>
+</template>
+
+<style scoped lang="scss">
+.popup-box {
+  height: 100%;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
+}
+.list-content {
+  flex:1;
+  overflow: scroll;
+}
+
+.search-group {
+  padding: 5px;
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+
+  ::v-deep .van-cell {
+    flex: 1;
+  }
+
+  ::v-deep .van-button {
+    width: 80px;
+  }
+}
+
+</style>

+ 16 - 3
src/subPages/pages/digitalDoor/personManagement/index.vue

@@ -1,12 +1,14 @@
 <script>
 import AddressSelect from '@/pages/components/addressSelect/index'
 import InterestSelect from '@/pages/components/interestSelect/index'
+import StandAddressSelect from '@/pages/components/standAddressSelect/index'
 import {getDicInfo} from "@/api/digitalDoor";
 
 export default {
   components: {
     AddressSelect,
-    InterestSelect
+    InterestSelect,
+    StandAddressSelect
   },
   data() {
     return {
@@ -14,7 +16,8 @@ export default {
       householdRegistrationTypeDialogShow: false,
       householdRegistrationTypeList: [],
       domicileDialogShow: false,
-      residenceDialogShow: false
+      residenceDialogShow: false,
+      houseNumberNameShow:false,
     }
   },
   onLoad() {
@@ -55,7 +58,17 @@ export default {
 <template>
   <view class="page-container">
     <view class="container-center">
-      <AddressSelect title="所属范围" ref="addressSelectRef"></AddressSelect>
+      <AddressSelect title="所属范围" ref="addressSelectRef">
+        <template>
+          <van-field v-model="form.houseNumberName"
+                     @click="houseNumberNameShow = true"
+                     label="标准地址"
+                     is-link
+                     readonly
+                     placeholder="请选择标准地址"/>
+          <StandAddressSelect :show.sync="houseNumberNameShow"></StandAddressSelect>
+        </template>
+      </AddressSelect>
       <view class="box">
         <view class="title">
           <text>管理地</text>

+ 1 - 1
src/utils/fetch/index.js

@@ -19,7 +19,7 @@ export const myFetch = async (url, type = "get", data = {}, dataType) => {
         timeout: 60000,
         header: {
             'content-type': 'application/json',
-            Token: '1',
+            Token: JSON.parse(uni.getStorageSync('userInfo')).token || '',
             appId:'2002407848',
         },
     }