转交
This commit is contained in:
		@@ -1,14 +1,20 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="SelectUser" v-if="showPage">
 | 
			
		||||
  <div class="SelectUser">
 | 
			
		||||
    <div class="header-middle">
 | 
			
		||||
      <div class="hint">
 | 
			
		||||
        <span style="color:#3F8DF5" v-for="(item, index) in slectList" :key="index">{{item.girdName}}</span>
 | 
			
		||||
        <span v-for="(item, index) in slectList" :key="index"><span v-if="index" style="margin:0 4px;">/</span><span style="color:#3F8DF5" @click="girdNameClick(item, index)">{{item.girdName}}</span></span>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div class="showTypes">
 | 
			
		||||
      <div class="showTypes" v-if="!userList.length">
 | 
			
		||||
        <div v-if="treeList.length > 0">
 | 
			
		||||
          <div class="cards" v-for="(item, i) in treeList" :key="i" @click="itemClick(item)">
 | 
			
		||||
            <img src="./components/img/tx@2x.png" alt="" />
 | 
			
		||||
          <div class="cards" v-for="(item, index) in treeList" :key="index" @click="itemClick(item)">
 | 
			
		||||
            <div class="imges">
 | 
			
		||||
              <span v-if="item.girdLevel == 2">
 | 
			
		||||
                <img src="./components/img/xzh.png" alt="" class="imgselect" v-if="item.isChecked" @click.stop="girdClick(item, index)" />
 | 
			
		||||
                <img src="./components/img/xz.png" alt="" class="imgselect" v-else @click.stop="girdClick(item, index)" />
 | 
			
		||||
              </span>
 | 
			
		||||
              <img src="./components/img/tx@2x.png" alt="" class="avatras" />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="rightes">
 | 
			
		||||
              <div class="applicationNames">{{ item.girdName }}</div>
 | 
			
		||||
              <img src="./components/img/right-icon.png" alt="" class="imgs" />
 | 
			
		||||
@@ -19,7 +25,7 @@
 | 
			
		||||
        <AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <!-- <div class="showUsers" v-else>
 | 
			
		||||
      <div class="showUsers" v-else>
 | 
			
		||||
        <div v-if="userList.length > 0">
 | 
			
		||||
          <div class="cards" v-for="(e, index) in userList" :key="index">
 | 
			
		||||
            <div class="imges">
 | 
			
		||||
@@ -31,20 +37,19 @@
 | 
			
		||||
 | 
			
		||||
            <div class="rights">
 | 
			
		||||
              <div class="applicationNames">{{ e.name }}</div>
 | 
			
		||||
              <div class="idNumbers">{{ e.idNumber && e.idNumber.replace(/^(\w{6})\w{8}(.*)$/, '$1******$2') }}</div>
 | 
			
		||||
              <div class="idNumbers">{{ e.phone }}</div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
 | 
			
		||||
      </div> -->
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="subBtn" @click="submit">
 | 
			
		||||
      <div>确定选择</div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <!-- <AiBck /> -->
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -53,20 +58,11 @@ export default {
 | 
			
		||||
  name: 'SelectUser',
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      
 | 
			
		||||
      typeList: [],
 | 
			
		||||
      userList: [],
 | 
			
		||||
      keyword: '',
 | 
			
		||||
      current: 1,
 | 
			
		||||
      showType: true,
 | 
			
		||||
      applicationName: '',
 | 
			
		||||
      applicationId: '',
 | 
			
		||||
      selectUser: {},
 | 
			
		||||
 | 
			
		||||
      allData: null,
 | 
			
		||||
      showPage: false,
 | 
			
		||||
      treeList: [],
 | 
			
		||||
      slectList: []
 | 
			
		||||
      slectList: [],
 | 
			
		||||
      userList: [],
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onLoad() {
 | 
			
		||||
@@ -74,47 +70,100 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getTree() {
 | 
			
		||||
      this.slectList = []
 | 
			
		||||
      this.$http.post('/app/appgirdinfo/listAllByTop').then((res) => {
 | 
			
		||||
        if (res?.data) {
 | 
			
		||||
          this.allData = res.data
 | 
			
		||||
          if(this.allData[0].isLastLevel == 1) {
 | 
			
		||||
            this.treeList = this.allData[0].girdMemberList
 | 
			
		||||
          }else {
 | 
			
		||||
            this.treeList = this.allData[0].girdList
 | 
			
		||||
          }
 | 
			
		||||
          var obj = {
 | 
			
		||||
            girdName: this.allData[0].girdName,
 | 
			
		||||
            girdId: this.allData[0].girdId
 | 
			
		||||
          }
 | 
			
		||||
          this.slectList.push(obj)
 | 
			
		||||
          this.showPage = true
 | 
			
		||||
          this.treeInit()
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    treeInit() {
 | 
			
		||||
      if(this.allData[0].isLastLevel == 1) {
 | 
			
		||||
        this.userList = this.allData[0].girdMemberList
 | 
			
		||||
        this.userList.map((item) => {
 | 
			
		||||
          item.isChecked = false
 | 
			
		||||
        })
 | 
			
		||||
      }else {
 | 
			
		||||
        this.treeList = this.allData[0].girdList
 | 
			
		||||
      }
 | 
			
		||||
      var obj = {
 | 
			
		||||
        girdName: this.allData[0].girdName,
 | 
			
		||||
        id: this.allData[0].id,
 | 
			
		||||
        girdLevel: this.allData[0].girdLevel
 | 
			
		||||
      }
 | 
			
		||||
      this.slectList.push(obj)
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    itemClick(row) {
 | 
			
		||||
      console.log(row)
 | 
			
		||||
      this.$http.post(`/app/appgirdinfo/listAll2?id=${row.id}`).then((res) => {
 | 
			
		||||
        if (res?.data) {
 | 
			
		||||
          // this.allData = res.data
 | 
			
		||||
          // if(this.allData[0].isLastLevel == 1) {
 | 
			
		||||
          //   this.treeList = this.allData[0].girdMemberList
 | 
			
		||||
          // }else {
 | 
			
		||||
          //   this.treeList = this.allData[0].girdList
 | 
			
		||||
          // }
 | 
			
		||||
          // var obj = {
 | 
			
		||||
          //   girdName: this.allData[0].girdName,
 | 
			
		||||
          //   girdId: this.allData[0].girdId
 | 
			
		||||
          // }
 | 
			
		||||
          // this.slectList.push(obj)
 | 
			
		||||
          // this.showPage = true
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      var obj = {
 | 
			
		||||
        girdName: row.girdName,
 | 
			
		||||
        id: row.id,
 | 
			
		||||
        girdLevel: row.girdLevel
 | 
			
		||||
      }
 | 
			
		||||
      this.slectList.push(obj)
 | 
			
		||||
      this.searckGird(row)
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    searckGird(row) {
 | 
			
		||||
      if(row.girdLevel != 2) { //查网格
 | 
			
		||||
        this.$http.post(`/app/appgirdinfo/list?parentGirdId=${row.id}&size=999`).then((res) => {
 | 
			
		||||
          if (res?.data) {
 | 
			
		||||
            this.treeList = res.data.records
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }else { //查网格员
 | 
			
		||||
        this.$http.post(`/app/appgirdmemberinfo/listByGirdId`, {
 | 
			
		||||
          appGirdMemberInfo: {
 | 
			
		||||
            girdId: row.id
 | 
			
		||||
          }
 | 
			
		||||
        }).then((res) => {
 | 
			
		||||
          if (res?.data) {
 | 
			
		||||
            this.userList = res.data
 | 
			
		||||
            this.userList.map((item) => {
 | 
			
		||||
              item.isChecked = false
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    girdNameClick(row, index) {
 | 
			
		||||
      this.userList = []
 | 
			
		||||
      if(!index) { //第一级别
 | 
			
		||||
        this.slectList = []
 | 
			
		||||
        this.treeInit()
 | 
			
		||||
      }else {
 | 
			
		||||
        var list = []
 | 
			
		||||
        this.slectList.map((item, i) => {
 | 
			
		||||
          if(i <= index) {
 | 
			
		||||
            list.push(item)
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        this.slectList = list
 | 
			
		||||
        this.searckGird(row)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    girdClick(row, index) {
 | 
			
		||||
      if (this.treeList[index].isChecked) {//取消
 | 
			
		||||
        this.treeList[index].isChecked = false
 | 
			
		||||
        this.selectUser = {}
 | 
			
		||||
      } else {
 | 
			
		||||
        this.treeList.map((item) => {
 | 
			
		||||
          item.isChecked = false
 | 
			
		||||
        })
 | 
			
		||||
        this.treeList[index].isChecked = true
 | 
			
		||||
        this.selectUser = row
 | 
			
		||||
      }
 | 
			
		||||
      this.$forceUpdate()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    userClick(row, index) {
 | 
			
		||||
      if (this.userList[index].isChecked) {
 | 
			
		||||
        //取消
 | 
			
		||||
      if (this.userList[index].isChecked) {//取消
 | 
			
		||||
        this.userList[index].isChecked = false
 | 
			
		||||
        this.selectUser = {}
 | 
			
		||||
      } else {
 | 
			
		||||
@@ -124,74 +173,18 @@ export default {
 | 
			
		||||
        this.userList[index].isChecked = true
 | 
			
		||||
        this.selectUser = row
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getTypeList() {
 | 
			
		||||
      this.userList = []
 | 
			
		||||
      this.$http.post(`/app/appapplicationinfo/queryApplicationListByType?type=0&status=1`).then((res) => {
 | 
			
		||||
        if (res.code == 0) {
 | 
			
		||||
          this.typeList = res.data
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getUsers() {
 | 
			
		||||
      uni.showLoading({
 | 
			
		||||
        title: '加载中',
 | 
			
		||||
      })
 | 
			
		||||
      this.$http.post(`/app/appapplicationinfo/list?appId=${this.appId}¤t=${this.current}&size=${999}`, { searchParam: this.keyword }).then((res) => {
 | 
			
		||||
        if (res.code == 0) {
 | 
			
		||||
          res.data.records.map((item) => {
 | 
			
		||||
            item.isChecked = false
 | 
			
		||||
          })
 | 
			
		||||
          uni.hideLoading()
 | 
			
		||||
          this.userList = res.data.records
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      this.$forceUpdate()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    submit() {
 | 
			
		||||
      if (this.selectUser.id != null) {
 | 
			
		||||
        uni.$emit('goBack', { selectUser: this.selectUser, applicationName: this.applicationName, applicationId: this.applicationId })
 | 
			
		||||
        uni.$emit('goback', this.selectUser)
 | 
			
		||||
        uni.navigateBack()
 | 
			
		||||
      } else {
 | 
			
		||||
        return this.$u.toast('请选择人员')
 | 
			
		||||
        return this.$u.toast('请选择网格或网格员')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    toUserSelect(item) {
 | 
			
		||||
      this.applicationName = item.applicationName
 | 
			
		||||
      this.applicationId = item.id
 | 
			
		||||
      this.appId = item.id
 | 
			
		||||
      this.getUsers()
 | 
			
		||||
 | 
			
		||||
      this.showType = false
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    back() {
 | 
			
		||||
      this.keyword = ''
 | 
			
		||||
      this.typeList = []
 | 
			
		||||
      this.userList = []
 | 
			
		||||
      this.applicationName = ''
 | 
			
		||||
      this.showType = true
 | 
			
		||||
      this.getTypeList()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    handerSearch(e) {
 | 
			
		||||
      if (!this.showType) {
 | 
			
		||||
        this.keyword = e
 | 
			
		||||
        this.current = 1
 | 
			
		||||
        // this.getUser()
 | 
			
		||||
        this.getUsers()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    handerClear() {
 | 
			
		||||
      this.keyword = ''
 | 
			
		||||
      this.current = 1
 | 
			
		||||
      this.getUsers()
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
@@ -229,6 +222,23 @@ export default {
 | 
			
		||||
        // background: pink;
 | 
			
		||||
        padding: 0 0 0 32px;
 | 
			
		||||
 | 
			
		||||
        .imges {
 | 
			
		||||
          display: flex;
 | 
			
		||||
          align-items: center;
 | 
			
		||||
          // width: 200px;
 | 
			
		||||
          .imgselect {
 | 
			
		||||
            width: 48px;
 | 
			
		||||
            height: 48px;
 | 
			
		||||
            vertical-align: middle;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          .avatras {
 | 
			
		||||
            width: 74px;
 | 
			
		||||
            height: 74px;
 | 
			
		||||
            border-radius: 8px;
 | 
			
		||||
            margin-left: 36px;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        img {
 | 
			
		||||
          width: 74px;
 | 
			
		||||
          height: 74px;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user