|
@@ -0,0 +1,343 @@
|
|
|
+<script>
|
|
|
+
|
|
|
+import {getGardenHouseInfo, getGridInfo, getStreetInfo, getUnitHouseInfo} from "@/api/digitalDoor";
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ streetDialogShow: false,
|
|
|
+ streetList: [],
|
|
|
+ communityList: [],
|
|
|
+ communityDialogShow: false,
|
|
|
+ gridList: [],
|
|
|
+ gridDialogShow: false,
|
|
|
+ gardenDialogShow: false,
|
|
|
+ gardenList: [],
|
|
|
+ buildingDialogShow: false,
|
|
|
+ buildingList: [],
|
|
|
+ unitDialogShow: false,
|
|
|
+ unitList: [],
|
|
|
+ roomDialogShow:false,
|
|
|
+ roomList: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleStreetSelect(item) {
|
|
|
+ this.form.streetName = item.streetName
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 街道
|
|
|
+ */
|
|
|
+ handleLinkStreet() {
|
|
|
+ this.streetDialogShow = true
|
|
|
+ this.getStreetList()
|
|
|
+ },
|
|
|
+ async getStreetList() {
|
|
|
+ try {
|
|
|
+ const res = await getStreetInfo()
|
|
|
+ if (res.code !== 0) {
|
|
|
+ this.list = []
|
|
|
+ } else {
|
|
|
+ this.handleGetStreetInfo(res.data.children)
|
|
|
+ }
|
|
|
+ this.list = res.data
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleGetStreetInfo(streetResData) {
|
|
|
+ const deptList = JSON.parse(localStorage.getItem('userInfo')).userInfo.deptIdList || []
|
|
|
+ //只保留当前用户所属部门的街道
|
|
|
+ // 如果有奉化区的区权限,就显示全部街道
|
|
|
+ if (deptList.includes('330213') && deptList.length === 1) {
|
|
|
+ this.streetList = streetResData
|
|
|
+ } else {
|
|
|
+ // 找出授权街道代码
|
|
|
+ let authStreetCode = null
|
|
|
+ if (deptList.length >= 2) {
|
|
|
+ authStreetCode = deptList[1]
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.streetList = []
|
|
|
+
|
|
|
+ //筛选出授权的街道
|
|
|
+ if (authStreetCode) {
|
|
|
+ this.streetList = streetResData.filter(item => item.code === authStreetCode)
|
|
|
+ }
|
|
|
+ if (!authStreetCode && deptList && deptList.length > 0) {
|
|
|
+ this.streetList = streetResData
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.streetList.length === 1) {
|
|
|
+ this.handleGetCommunityList(this.streetList[0].code)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleGetCommunityList(fatherCode) {
|
|
|
+ const deptList = JSON.parse(localStorage.getItem('userInfo')).deptIdList || []
|
|
|
+ this.communityList = null
|
|
|
+ this.streetList.forEach(item => {
|
|
|
+ //只保留当前用户所属部门的社区
|
|
|
+ if (item.code === fatherCode) {
|
|
|
+ this.communityList = item.children
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ //是否限制村社一级
|
|
|
+ let limitCommunityFlag = deptList.length >= 3
|
|
|
+
|
|
|
+ // 找出授权代码
|
|
|
+ if (limitCommunityFlag) {
|
|
|
+ let authCommunityCode = deptList[2]
|
|
|
+ if (authCommunityCode) {
|
|
|
+ this.communityList = this.communityList.filter(item => item.code === authCommunityCode)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleStreetClick(item) {
|
|
|
+ this.streetDialogShow = false
|
|
|
+ this.form.streetName = item.label
|
|
|
+ this.form.streetId = item.code
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 所属村社
|
|
|
+ */
|
|
|
+ handleLinkCommunity() {
|
|
|
+ this.communityDialogShow = true
|
|
|
+ this.handleGetCommunityList(this.form.streetCode)
|
|
|
+ },
|
|
|
+ handleCommunityClick(item) {
|
|
|
+ this.communityDialogShow = false
|
|
|
+ this.form.communityName = item.label
|
|
|
+ this.form.communityId = item.code
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 网格
|
|
|
+ */
|
|
|
+ handleLinkGrid() {
|
|
|
+ this.gridDialogShow = true
|
|
|
+ this.getGridList()
|
|
|
+ },
|
|
|
+ async getGridList() {
|
|
|
+ try {
|
|
|
+ getGridInfo({
|
|
|
+ communityCode: this.form.communityCode
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code !== 0) {
|
|
|
+ this.gridList = []
|
|
|
+ } else {
|
|
|
+ this.gridList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleGridClick(item) {
|
|
|
+ this.gridDialogShow = false
|
|
|
+ this.form.gridName = item.label
|
|
|
+ this.form.grid = item.code
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 小区
|
|
|
+ */
|
|
|
+ handleLinkGarden() {
|
|
|
+ this.gardenDialogShow = true
|
|
|
+ this.getGardenList()
|
|
|
+ },
|
|
|
+ getGardenList() {
|
|
|
+ try {
|
|
|
+ getGardenHouseInfo({
|
|
|
+ districtId: '330213',
|
|
|
+ streetId:this.form.streetCode,
|
|
|
+ communityCode: this.form.communityCode,
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code !== 0) {
|
|
|
+ this.gardenList = []
|
|
|
+ } else {
|
|
|
+ this.gardenList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleGardenClick(item) {
|
|
|
+ this.gardenDialogShow = false
|
|
|
+ this.form.gardenName = item.label
|
|
|
+ this.form.gardenId = item.code
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 幢号
|
|
|
+ */
|
|
|
+ handleLinkBuilding() {
|
|
|
+ this.buildingDialogShow = true
|
|
|
+ this.getBuildingList()
|
|
|
+ },
|
|
|
+ getBuildingList() {
|
|
|
+ try {
|
|
|
+ getUnitHouseInfo({
|
|
|
+ districtId: '330213',
|
|
|
+ streetId: this.form.streetCode,
|
|
|
+ gardenCode: this.form.gardenCode,
|
|
|
+ communityCode: this.form.communityCode
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code !== 0) {
|
|
|
+ this.buildingList = []
|
|
|
+ } else {
|
|
|
+ this.buildingList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleBuildingClick(item) {
|
|
|
+ this.buildingDialogShow = false
|
|
|
+ this.form.buildingName = item.label
|
|
|
+ this.form.buildingId = item.code
|
|
|
+ },
|
|
|
+ handleUnitClick(item) {
|
|
|
+ this.unitDialogShow = false
|
|
|
+ this.form.unitName = item.label
|
|
|
+ this.form.unitId = item.code
|
|
|
+ },
|
|
|
+ handleRoomClick(item) {
|
|
|
+ this.roomDialogShow = false
|
|
|
+ this.form.roomName = item.label
|
|
|
+ this.form.room = item.code
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+ <van-form>
|
|
|
+ <view class="box">
|
|
|
+ <view class="title">所属范围</view>
|
|
|
+ <view class="content">
|
|
|
+ <van-field v-model="form.streetName" label="所属镇街"
|
|
|
+ readonly
|
|
|
+ @click="handleLinkStreet"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入所属镇街"/>
|
|
|
+ <van-popup v-model="streetDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in streetList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleStreetClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--所属村社-->
|
|
|
+ <van-field v-model="form.communityName" label="所属村社"
|
|
|
+ readonly
|
|
|
+ @click="handleLinkCommunity"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入所属村社"/>
|
|
|
+ <van-popup v-model="communityDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in communityList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleCommunityClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--所属网格-->
|
|
|
+ <van-field v-model="form.gridName" label="所属网格"
|
|
|
+ readonly
|
|
|
+ @click="handleLinkGrid"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入所属网格"/>
|
|
|
+ <van-popup v-model="gridDialogShow"
|
|
|
+ position="bottom"
|
|
|
+
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in gridList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleGridClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--所属小区-->
|
|
|
+ <van-field v-model="form.gardenName" label="所属小区"
|
|
|
+ readonly
|
|
|
+ @click="handleLinkGarden"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入所属小区"/>
|
|
|
+ <van-popup v-model="gardenDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in gardenList" :key="item.code" :title="item.lable"
|
|
|
+ @click="handleGardenClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--幢号-->
|
|
|
+ <van-field v-model="form.buildingName" label="幢号"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入幢号"/>
|
|
|
+ <van-popup v-model="buildingDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ @click="handleLinkBuilding"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in buildingList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleBuildingClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--单元-->
|
|
|
+ <van-field v-model="form.unitName" label="单元"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入单元"/>
|
|
|
+ <van-popup v-model="unitDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in unitList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleUnitClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ <!--房号-->
|
|
|
+ <van-field v-model="form.roomName" label="房号"
|
|
|
+ is-link
|
|
|
+ placeholder="请输入房号"/>
|
|
|
+ <van-popup v-model="roomDialogShow"
|
|
|
+ position="bottom"
|
|
|
+ :style="{ height: '35%' }"
|
|
|
+ >
|
|
|
+ <van-list finished-text="没有更多了">
|
|
|
+ <van-cell v-for="item in roomList" :key="item.code" :title="item.label"
|
|
|
+ @click="handleRoomClick(item)"/>
|
|
|
+ </van-list>
|
|
|
+ </van-popup>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </van-form>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+
|
|
|
+</style>
|