This commit is contained in:
liuye
2022-01-14 10:56:52 +08:00
parent 5959781e15
commit 78c8bd01f8
6 changed files with 230 additions and 252 deletions

View File

@@ -7,37 +7,17 @@
<div class="showTypes" v-if="!userList.length">
<div v-if="treeList.length > 0">
<div class="cards" v-for="(item, index) in treeList" :key="index" @click="itemClick(item)">
<div class="cards" v-for="(item, index) in treeList" :key="index">
<div class="imges">
<span v-if="item.girdLevel == 2">
<span v-if="item.girdRight == 1 && 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/gird--select-icon.png" alt="" class="avatras" />
</div>
<div class="rightes">
<div class="applicationNames">{{ item.girdName }}</div>
<img src="./components/img/right-icon.png" alt="" class="imgs" />
</div>
</div>
</div>
<AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
</div>
<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">
<img src="./components/img/xzh.png" alt="" class="imgselect" v-if="e.isChecked" @click="userClick(e, index)" />
<img src="./components/img/xz.png" alt="" class="imgselect" v-else @click="userClick(e, index)" />
<img src="./components/img/tx@2x.png" alt="" class="avatras" />
</div>
<div class="rights">
<div class="applicationNames">{{ e.name }}</div>
<div class="idNumbers">{{ e.phone }}</div>
<div class="applicationNames" @click="showGirdInfo(item)">{{ item.girdName }}</div>
<img src="./components/img/right-icon.png" alt="" class="imgs" v-if="item.girdLevel != 2" @click="itemClick(item)" />
</div>
</div>
</div>
@@ -54,25 +34,35 @@
<div class="popup">
<div class="bg"></div>
<div class="title">{{ form.girdName }}</div>
<div class="info-flex">
<div class="info-flex">
<span class="label">网格类型</span>
<span class="value">{{ }}</span>
<span class="value">{{ $dict.getLabel('girdType', form.girdType) }}</span>
</div>
<div class="info-flex">
<span class="label">网格层级</span>
<span class="value">{{ }}</span>
<span class="value">{{ $dict.getLabel('girdLevel', form.girdLevel) }}</span>
</div>
<div class="info-flex">
<span class="label">网格负责人</span>
<span class="value">{{ }}</span>
<div v-if="form.girdMemberManageList && form.girdMemberManageList.length">
<div class="info-flex" v-for="(item, index) in form.girdMemberManageList" :key="index">
<span class="label">网格负责人</span>
<span class="value">{{ item.name }}&nbsp;&nbsp;{{ item.phone }}
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon"
v-if="item.phone">
</span>
</div>
</div>
<div class="info-flex border-b0">
<span class="label">网格员</span>
<span class="value">{{ }}<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone('110')" class="phone-icon"></span>
<div v-if="form.girdMemberList && form.girdMemberList.length">
<div class="info-flex" v-for="(item, index) in form.girdMemberList" :key="index">
<span class="label">网格员</span>
<span class="value">{{ item.name }}&nbsp;&nbsp;{{ item.phone }}
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon"
v-if="item.phone">
</span>
</div>
</div>
<div class="btn">
<span class="del">删除网格</span>
<span class="edit">编辑网格</span>
<div class="btn" v-if="form.girdRight == 1">
<span class="del" @click="del">删除网格</span>
<span class="edit" @click="edit">编辑网格</span>
</div>
</div>
</u-popup>
@@ -91,17 +81,30 @@ export default {
slectList: [],
userList: [],
show: true,
form: {}
show: false,
form: {},
}
},
onLoad() {
this.getTree()
this.$dict.load('girdType', 'girdLevel')
this.isGirdUser()
},
methods: {
isGirdUser() {
this.$http.post('/app/appgirdmemberinfo/checkLogOnUser').then((res) => {
if (res.code == 0) {
if (res.data.checkType) {
this.userGird = res.data
this.getTree()
} else {
this.$u.toast('当前人员不是网格员或网格管理员')
}
}
})
},
getTree() {
this.slectList = []
this.$http.post('/app/appgirdinfo/listAllByTop').then((res) => {
this.$http.post(`/app/appgirdinfo/queryAppGirdInfoByGirdLevel?girdLevel=0&girdMemberId=${this.userGird.girdMemberId}&parentGirdId=`).then((res) => {
if (res?.data) {
this.allData = res.data
this.treeInit()
@@ -110,24 +113,20 @@ export default {
},
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
}
this.treeList = this.allData
this.treeList.map((item) => {
item.isChecked = false
})
var obj = {
girdName: this.allData[0].girdName,
id: this.allData[0].id,
girdLevel: this.allData[0].girdLevel
girdName: '可选范围',
id: '',
girdLevel: ''
}
this.slectList.push(obj)
},
itemClick(row) {
console.log(row)
if(row.girdLevel == 2) return
var obj = {
girdName: row.girdName,
id: row.id,
@@ -138,22 +137,13 @@ export default {
},
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/listByGirdIdByThree?girdId=${row.id}`).then((res) => {
if (res?.data) {
this.userList = res.data
this.userList.map((item) => {
item.isChecked = false
})
}
})
}
if(row.girdLevel == 2) return
var girdLevel = Number(row.girdLevel)+1
this.$http.post(`/app/appgirdinfo/queryAppGirdInfoByGirdLevel?girdLevel=${girdLevel}&girdMemberId=${this.userGird.girdMemberId}&parentGirdId=${row.id}`).then((res) => {
if (res?.data) {
this.treeList = res.data
}
})
},
girdNameClick(row, index) {
@@ -188,27 +178,25 @@ export default {
this.$forceUpdate()
},
userClick(row, index) {
if (this.userList[index].isChecked) {//取消
this.userList[index].isChecked = false
this.setGird = {}
} else {
this.userList.map((item) => {
item.isChecked = false
})
this.userList[index].isChecked = true
this.setGird = row
}
this.$forceUpdate()
showGirdInfo(row) {
this.show = true
this.form = row
},
submit() {
if (this.setGird.id != null) {
uni.$emit('goback', this.setGird)
uni.navigateBack()
} else {
return this.$u.toast('请选择网格或网格员')
}
del() {
this.$confirm(`是否删除该网格?`).then(() => {
this.$http.post(`/app/appgirdinfo/delete?ids=${this.form.id}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.treeList = []
this.isGirdUser()
}
})
})
},
edit() {
uni.navigateTo({url: `./AddGird?id=${this.form.id}&fromType=edit`})
},
callPhone(phone) {
@@ -216,7 +204,11 @@ export default {
},
toAddGird() {
uni.navigateTo({url: './AddGird'})
if (this.setGird.id != null) {
uni.navigateTo({url: `./AddGird?id=${this.setGird.id}&fromType=add`})
} else {
return this.$u.toast('请选择网格')
}
}
}
}