Browse Source

feat(digitalDoor): 新增兴趣点查询功能

- 在 digitalDoor 模块中添加兴趣点查询相关 API
- 实现兴趣点查询组件 InterestSelect
- 在人员管理页面中集成兴趣点查询功能
- 优化人员管理页面布局,添加重置和查询按钮
梦辉 4 days ago
parent
commit
757e35e66c

+ 24 - 0
src/api/digitalDoor.js

@@ -39,3 +39,27 @@ export function getUnitHouseInfo (data) {
 export function getDicInfo (data) {
     return myFetch('/common/getInfo', 'get', data, 'json');
 }
+
+/**
+ * 标签 不分页
+ * /system/bq/allTabInfo
+ */
+export function allTabInfo (data) {
+    return myFetch('/system/bq/allTabInfo', 'get', data, 'json');
+}
+
+/**
+ * 获取全部条线
+ * /system/tx/allStripLineInfo
+ */
+export function getAllStripLineInfo (data) {
+    return myFetch('/system/tx/allStripLineInfo', 'get', data, 'json');
+}
+
+/**
+ * 获取所有的部门
+ * /system/bk/getOfficeAll
+ */
+export function getOfficeAll (data) {
+    return myFetch('/system/bk/getOfficeAll', 'get', data, 'json');
+}

+ 3 - 8
src/pages/components/addressSelect/index.vue

@@ -5,7 +5,7 @@ import {getGardenHouseInfo, getGridInfo, getStreetInfo, getUnitHouseInfo} from "
 export default {
   data() {
     return {
-      form: {},
+      form:{},
       streetDialogShow: false,
       streetList: [],
       communityList: [],
@@ -23,10 +23,6 @@ export default {
     }
   },
   methods: {
-    handleStreetSelect(item) {
-      this.form.streetName = item.streetName
-    },
-
     /**
      * 街道
      */
@@ -77,7 +73,7 @@ export default {
       }
     },
     handleGetCommunityList(fatherCode) {
-      const deptList = JSON.parse(localStorage.getItem('userInfo')).deptIdList || []
+      const deptList = JSON.parse(localStorage.getItem('userInfo')).userInfo.deptIdList || []
       this.communityList = null
       this.streetList.forEach(item => {
         //只保留当前用户所属部门的社区
@@ -85,7 +81,6 @@ export default {
           this.communityList = item.children
         }
       })
-
       //是否限制村社一级
       let limitCommunityFlag = deptList.length >= 3
 
@@ -108,7 +103,7 @@ export default {
      */
     handleLinkCommunity() {
       this.communityDialogShow = true
-      this.handleGetCommunityList(this.form.streetCode)
+      this.handleGetCommunityList(this.form.streetId)
     },
     handleCommunityClick(item) {
       this.communityDialogShow = false

+ 185 - 0
src/pages/components/interestSelect/index.vue

@@ -0,0 +1,185 @@
+<script>
+import {allTabInfo, getAllStripLineInfo, getOfficeAll} from "@/api/digitalDoor";
+
+export default {
+  data() {
+    return {
+      lineList: [],
+      allTag: {},
+      deptList: [],
+      lineInfoObject: {},
+      deptInfoObject: {},
+      allInterestObject: {},
+    }
+  },
+  props: {
+    // 用来区分人房企模块
+    useFlag: {
+      type: String,
+      default: "person"
+    }
+  },
+  computed: {
+    objectFlag() {
+      switch (this.useFlag) {
+        case "person":
+          return "1"
+        case "house":
+          return "2"
+        case "enterprise":
+          return "3"
+        default:
+          return "1"
+      }
+    },
+  },
+  mounted() {
+    this.init()
+  },
+  methods: {
+    async init() {
+      console.log("deptAuthList",)
+      try {
+        const deptAuthList = JSON.parse(localStorage.getItem('userInfo')).deptIdList || []
+
+
+        //获取所有的标签
+        const tagRes = await allTabInfo({
+          object: this.objectFlag,
+          jurisdiction: deptAuthList[deptAuthList.length - 1],
+          seniorCode: deptAuthList[deptAuthList.length - 2] ? deptAuthList[deptAuthList.length - 2] : undefined,
+        }).catch(e => {
+          console.log(e)
+        })
+        this.allTag = tagRes.data
+        //获取所有的条线
+        const allLine = (await getAllStripLineInfo()).data
+        //获取所有部门的接口
+        const allDept = (await getOfficeAll()).data
+
+        //筛选出来有标签的部门,根据allTag的lineId和allLine的id进行匹配,lineId为null的为系统自建
+        this.lineList = this.allTag.filter(item => {
+          //lineId为null的为系统自建
+          if (item.poiType === '0') {
+            item["lineName"] = "系统自建"
+            return true
+          } else {
+            return allLine.some(tag => {
+              if (tag.id === item.superiorId) {
+                item["lineName"] = tag.striplineNaem
+                return true
+              }
+            })
+          }
+        })
+
+        this.deptList = this.allTag.filter(item => {
+          if (item.poiType !== '0') {
+            return allDept.some(tag => {
+              if (tag.id === item.superiorId) {
+                item["deptName"] = tag.officeName
+                return true
+              }
+            })
+          }
+        })
+
+        this.initLineInfoObject()
+        this.initDeptInfoObject()
+
+        this.allInterestObject = {
+          ...this.deptInfoObject,
+          ...this.lineInfoObject
+        }
+      } catch (e) {
+        console.log(e)
+      }
+    },
+    //初始化lineInfoObject,lineList分类根据lineName,格式为:{'系统自建':[{},{}],'xx':[{}]}
+    initLineInfoObject() {
+      this.lineInfoObject = this.lineList.reduce((prev, cur) => {
+        if (prev[cur.lineName]) {
+          prev[cur.lineName].push({
+            value: String(cur.id),
+            label: cur.poiName,
+            formKey: cur.id,
+            formName: '兴趣点查询',
+            dept: cur.lineName,
+          })
+        } else {
+          prev[cur.lineName] = [{
+            value: String(cur.id),
+            label: cur.poiName,
+            formKey: cur.id,
+            formName: '兴趣点查询',
+            dept: cur.lineName,
+          }]
+        }
+        return prev
+      }, {})
+    },
+    initDeptInfoObject() {
+      this.deptInfoObject = this.deptList.reduce((prev, cur) => {
+        if (prev[cur.superiorName]) {
+          prev[cur.superiorName].push({
+            value: String(cur.id),
+            label: cur.poiName,
+            formKey: cur.id,
+            formName: '兴趣点查询',
+            dept: cur.superiorName,
+          })
+        } else {
+          prev[cur.superiorName] = [{
+            value: String(cur.id),
+            label: cur.poiName,
+            formKey: cur.id,
+            formName: '兴趣点查询',
+            dept: cur.superiorName,
+          }]
+        }
+        return prev
+      }, {})
+    },
+    handleInterestClick(tagItem) {
+      this.$set(tagItem, 'select', !!!tagItem.select)
+    }
+  }
+}
+</script>
+
+<template>
+  <view>
+    <van-form>
+      <view v-for="(item,key) in allInterestObject" :key="key"  class="box">
+        <view class="title">{{key}}</view>
+        <view class="list">
+          <view v-for="(tagItem,index) in item" :key="index"
+                  :class="tagItem.select ? 'tagSelected' : ''"
+                  @click="handleInterestClick(tagItem)"
+                  class="btn">{{tagItem.label}}
+          </view>
+        </view>
+      </view>
+    </van-form>
+  </view>
+</template>
+
+<style scoped lang="scss">
+.btn {
+  display: inline-block;
+  padding: 5px;
+  margin: 5px;
+  width: auto;
+  font-size: 12px;
+  height: 40rpx;
+  line-height: 40rpx;
+  border-radius: 8rpx;
+  text-align: center;
+  background-color: #f2f2f2;
+  color: black;
+}
+.tagSelected {
+  background: #198bfe;
+  color: #fff;
+}
+</style>

+ 92 - 48
src/subPages/pages/digitalDoor/personManagement/index.vue

@@ -1,17 +1,20 @@
 <script>
 import AddressSelect from '@/pages/components/addressSelect/index'
+import InterestSelect from '@/pages/components/interestSelect/index'
 import {getDicInfo} from "@/api/digitalDoor";
+
 export default {
   components: {
-    AddressSelect
+    AddressSelect,
+    InterestSelect
   },
   data() {
     return {
-      form:{},
+      form: {},
       householdRegistrationTypeDialogShow: false,
       householdRegistrationTypeList: [],
-      domicileDialogShow:false,
-      residenceDialogShow:false
+      domicileDialogShow: false,
+      residenceDialogShow: false
     }
   },
   onLoad() {
@@ -25,18 +28,24 @@ export default {
         })
   },
   methods: {
-    handleHouseholdRegistrationTypeClick(item){
+    handleHouseholdRegistrationTypeClick(item) {
       this.householdRegistrationTypeDialogShow = false
       this.form.householdRegistrationTypeName = item.remark
       this.form.householdRegistrationType = item.value
     },
-    handleDomicileClick(item){
+    handleDomicileClick(item) {
       this.domicileDialogShow = false
       this.form.domicile = item
     },
     handleResidenceClick(item) {
       this.domicileDialogShow = false
       this.form.domicile = item
+    },
+    reset() {
+      this.form = {}
+    },
+    submit() {
+      console.log(this.$refs.addressSelectRef.form)
     }
 
   }
@@ -44,54 +53,89 @@ export default {
 </script>
 
 <template>
-  <view>
-    <AddressSelect title="所属范围"></AddressSelect>
-    <view class="box">
-      <view class="title">
-        <text>管理地</text>
-      </view>
-      <view class="content">
-        <van-field v-model="form.householdRegistrationTypeName"
-                   @click="householdRegistrationTypeDialogShow = true"
-                   label="户类型"
-                   is-link placeholder="请选择" />
-        <van-popup v-model="householdRegistrationTypeDialogShow" position="bottom" :style="{ height: '35%' }">
-          <van-list>
-            <van-cell v-for="(item,index) in householdRegistrationTypeList"
-                      :key="index" :title="item.remark"
-                      @click="handleHouseholdRegistrationTypeClick(item)"></van-cell>
-          </van-list>
-        </van-popup>
-        <!--户籍地-->
-        <van-field v-model="form.domicile"
-                    label="户籍地"
-                   is-link
-                   @click="domicileDialogShow = true"
-                    placeholder="请输入户籍地" />
-        <van-popup v-model="domicileDialogShow" position="bottom" :style="{ height: '35%' }">
-          <van-list>
-            <van-cell title="在" @click="handleDomicileClick('在')"></van-cell>
-            <van-cell title="不在" @click="handleDomicileClick('不在')"></van-cell>
-          </van-list>
-        </van-popup>
-        <!--居住地-->
-        <van-field v-model="form.residence"
-                   label="居住地"
-                   is-link
-                   @click="residenceDialogShow = true"
-                   placeholder="请输入居住地" />
-        <van-popup v-model="residenceDialogShow" position="bottom" :style="{ height: '35%' }">
-          <van-list>
-            <van-cell title="在" @click="handleResidenceClick('在')"></van-cell>
-            <van-cell title="不在" @click="handleResidenceClick('不在')"></van-cell>
-          </van-list>
-        </van-popup>
+  <view class="page-container">
+    <view class="container-center">
+      <AddressSelect title="所属范围" ref="addressSelectRef"></AddressSelect>
+      <view class="box">
+        <view class="title">
+          <text>管理地</text>
+        </view>
+        <view class="content">
+          <van-field v-model="form.householdRegistrationTypeName"
+                     @click="householdRegistrationTypeDialogShow = true"
+                     label="户类型"
+                     is-link placeholder="请选择"/>
+          <van-popup v-model="householdRegistrationTypeDialogShow" position="bottom" :style="{ height: '35%' }">
+            <van-list>
+              <van-cell v-for="(item,index) in householdRegistrationTypeList"
+                        :key="index" :title="item.remark"
+                        @click="handleHouseholdRegistrationTypeClick(item)"></van-cell>
+            </van-list>
+          </van-popup>
+          <!--户籍地-->
+          <van-field v-model="form.domicile"
+                     label="户籍地"
+                     is-link
+                     @click="domicileDialogShow = true"
+                     placeholder="请输入户籍地"/>
+          <van-popup v-model="domicileDialogShow" position="bottom" :style="{ height: '35%' }">
+            <van-list>
+              <van-cell title="在" @click="handleDomicileClick('在')"></van-cell>
+              <van-cell title="不在" @click="handleDomicileClick('不在')"></van-cell>
+            </van-list>
+          </van-popup>
+          <!--居住地-->
+          <van-field v-model="form.residence"
+                     label="居住地"
+                     is-link
+                     @click="residenceDialogShow = true"
+                     placeholder="请输入居住地"/>
+          <van-popup v-model="residenceDialogShow" position="bottom" :style="{ height: '35%' }">
+            <van-list>
+              <van-cell title="在" @click="handleResidenceClick('在')"></van-cell>
+              <van-cell title="不在" @click="handleResidenceClick('不在')"></van-cell>
+            </van-list>
+          </van-popup>
 
+        </view>
       </view>
+      <InterestSelect useFlag="person" ref="interestSelectRef"></InterestSelect>
+    </view>
+    <view class="container-footer">
+      <van-button type="primary" color="#198bfe" @click="reset">重置</van-button>
+      <van-button type="primary" color="#198bfe" @click="submit">执行查询</van-button>
     </view>
   </view>
 </template>
 
 <style scoped lang="scss">
+.page-container {
+  background-color: #f5f5f5;
+  height: 100%;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
+  box-sizing: border-box;
+}
 
+.container-center {
+  flex: 1;
+  padding: 30rpx;
+  overflow: auto;
+}
+
+.container-footer {
+  height: 100rpx;
+  display: flex;
+  gap: 40px;
+  justify-content: center;
+  align-items: center;
+  padding: 0 30rpx;
+  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.2); /* 只显示上方阴影 */
+
+  ::v-deep .van-button {
+    width: 30%;
+    height: 30px;
+  }
+}
 </style>