修复网格选择

This commit is contained in:
2022-05-04 23:52:14 +08:00
parent 23d7d41515
commit bf50aaa5da
3 changed files with 52 additions and 406 deletions

View File

@@ -3,10 +3,12 @@
<AiTopFixed v-if="isAdmin">
<div class="pad-t32"></div>
<div class="select-gird">
<AiPagePicker type="gird" girdLevel="2" class="gird-name-div" @select="confirmSelect" :isMyGird="true">
<img src="./components/img/gird-icon.png" alt="" class="gird-icon">
<div class="gird-name">{{ girdName }}</div>
<img src="./components/img/down-icon.png" alt="" class="down-icon">
<AiPagePicker type="custom" @select="confirmSelect"
:ops="{url:'../AppGridManagement/SelectGird',label: 'girdName'}">
<div flex class="center">
<img src="./components/img/gird-icon.png" alt="" class="gird-icon">
<AiMore v-model="girdName" icon="arrow-down"/>
</div>
</AiPagePicker>
</div>
<div class="header">
@@ -111,7 +113,6 @@ export default {
onLoad() {
this.isGirdUser()
uni.$on('updateBackList', () => {
console.log(123)
this.getListInit()
this.getTotal()
})
@@ -122,7 +123,6 @@ export default {
methods: {
...mapActions(['injectJWeixin', 'wxInvoke']),
confirmSelect(v) {
console.log(v)
this.girdId = v?.[0].id
this.girdName = v?.[0].girdName
this.getListInit()
@@ -143,14 +143,14 @@ export default {
status = 0
}
this.$http.post(`/app/appepidemicbackhomerecord/list?current=${this.current}&size=10&status=${status}&name=${this.name}&arriveGirdId=${this.girdId}`)
.then((res) => {
if (res.code == 0) {
res.data.records.map((item) => {
item.idNumber = item.idNumber.replace(/(.{6}).*(.{4})/, "$1********$2")
.then((res) => {
if (res.code == 0) {
res.data.records.map((item) => {
item.idNumber = item.idNumber.replace(/(.{6}).*(.{4})/, "$1********$2")
})
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
}
})
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
}
})
},
getTotal() {
this.$http.post(`/app/appepidemicbackhomerecord/statistic?arriveGirdId=${this.girdId}`).then((res) => {
@@ -171,21 +171,10 @@ export default {
if (res?.data) {
if (res.data.checkType != '0') {
this.isAdmin = true
this.getGirdList()
}
}
})
},
getGirdList() {
this.$http.post('/app/appgirdmemberinfo/queryMyGirdListByLevel2AndUser').then((res) => {
if (res.code == 0) {
this.girdId = res.data[0].id
this.girdName = res.data[0].girdName
this.getListInit()
this.getTotal()
}
})
},
close() {
this.show = false
},
@@ -398,48 +387,12 @@ export default {
width: 32px;
height: 32px;
vertical-align: middle;
margin-right: 8px;
}
.center{
justify-content: center;
}
div {
display: inline-block;
padding-left: 20px;
box-sizing: border-box;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 48px;
img {
margin-left: 8px;
}
}
span {
display: inline-block;
width: 112px;
height: 48px;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #3F8DF5;
line-height: 48px;
}
.gird-name-div {
display: inline-block;
width: 100%;
padding-left: 0;
}
.gird-name {
display: inline-block;
max-width: calc(100% - 80px);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
}
}
.empty {

View File

@@ -1,306 +0,0 @@
<template>
<div class="SelectGird">
<div class="header-middle">
<div class="hint">
<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 v-if="treeList.length > 0">
<div class="cards" v-for="(item, index) in treeList" :key="index" @click="itemClick(item)">
<div class="imges">
<span>
<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" v-if="item.girdLevel != 2"/>
</div>
</div>
</div>
<AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>
</div>
</div>
<!-- <div style="padding-bottom: 70px;"></div> -->
<div class="subBtn" @click="submit">
<div>确定选择</div>
</div>
</div>
</template>
<script>
export default {
name: 'SelectGird',
data() {
return {
SelectGird: {},
allData: null,
treeList: [],
slectList: [],
userGird: {},
userList: [],
girdLevel: 0,
parentGirdId: ''
}
},
onLoad() {
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/queryAppGirdInfoByGirdLevel?girdLevel=${this.girdLevel}&girdMemberId=${this.userGird.girdMemberId}&parentGirdId=${this.parentGirdId}`).then((res) => {
if (res?.data) {
this.allData = res.data
this.treeInit()
}
})
},
treeInit() {
this.treeList = this.allData
this.treeList.map((item) => {
item.isChecked = false
})
var obj = {
girdName: '可选范围',
id: '',
girdLevel: ''
}
this.slectList.push(obj)
},
itemClick(row) {
if(row.girdLevel == 2) return
var obj = {
girdName: row.girdName,
id: row.id,
girdLevel: row.girdLevel
}
this.slectList.push(obj)
this.searckGird(row)
},
searckGird(row) {
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) {
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.SelectGird = {}
} else {
this.treeList.map((item) => {
item.isChecked = false
})
this.treeList[index].isChecked = true
this.SelectGird = row
}
this.$forceUpdate()
},
submit() {
if (this.SelectGird.id != null) {
uni.$emit('goback', this.SelectGird)
console.log(this.SelectGird)
uni.navigateBack()
} else {
return this.$u.toast('请选择网格')
}
},
}
}
</script>
<style scoped lang="scss">
.SelectGird {
height: 100%;
background: #fff;
padding-bottom: 140px;
.header-top {
background: #fff;
padding: 20px 32px;
}
.header-middle {
.hint {
padding: 28px 20px 28px 32px;
line-height: 56px;
box-shadow: 0px 1px 0px 0px #e4e5e6;
font-size: 30px;
font-weight: 500;
word-break: break-all;
}
.showTypes {
.empty-div {
height: 16px;
background: #f5f5f5;
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
// 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;
border-radius: 8px;
}
.rightes {
width: calc(100% - 188px);
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
.applicationNames {
width: calc(100% - 56px);
font-size: 36px;
font-weight: 500;
color: #333333;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.imgs {
width: 40px;
height: 40px;
vertical-align: middle;
}
}
}
}
.showUsers {
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
// background: pink;
padding: 0 0 0 32px;
.imges {
display: flex;
align-items: center;
width: 200px;
.imgselect {
width: 48px;
height: 48px;
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.rights {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
padding-right: 40px;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
}
.idNumbers {
color: #666;
}
}
}
}
}
.subBtn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 118px;
background: #f4f8fb;
div {
width: 192px;
height: 80px;
line-height: 80px;
text-align: center;
background: #1365dd;
border-radius: 4px;
font-size: 32px;
color: #fff;
margin: 20px 34px 0 0;
float: right;
}
}
}
</style>

View File

@@ -24,7 +24,8 @@
</div>
<div class="form-item__right">
<!-- <AiUploader :def.sync="form.files" :limit="9" action="/admin/file/add2"></AiUploader> -->
<AiUploader :def.sync="form.files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
<AiUploader :def.sync="form.files" multiple placeholder="上传图片" :limit="9"
action="/admin/file/add2"></AiUploader>
</div>
</div>
</div>
@@ -50,7 +51,7 @@
<div class="form-item__right" @click="chooseAddress">
<span v-if="form.address">{{ form.address }}</span>
<i v-else>点击定位</i>
<u-icon name="arrow-right" color="#ddd" />
<u-icon name="arrow-right" color="#ddd"/>
</div>
</div>
</div>
@@ -60,10 +61,11 @@
<i>*</i>
<h2>上报网格</h2>
</div>
<div class="form-item__right" @click="showSelect = true">
<span v-if="form.girdName">{{ form.girdName }}</span>
<i v-else>请选择</i>
<u-icon name="arrow-right" color="#ddd" />
<div class="form-item__right">
<AiPagePicker type="custom" v-model="form.girdId" @select="handleSelectGrid"
:ops="{url:'../AppGridManagement/SelectGird',label: 'girdName'}">
<AiMore v-model="form.girdName"/>
</AiPagePicker>
</div>
</div>
</div>
@@ -105,7 +107,8 @@
<span>(最多9张)</span>
</div>
<div class="form-item__right">
<AiUploader :def.sync="form.finishFiles" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
<AiUploader :def.sync="form.finishFiles" multiple placeholder="上传图片" :limit="9"
action="/admin/file/add2"></AiUploader>
</div>
</div>
</div>
@@ -113,12 +116,12 @@
</div>
<div class="btn" @click="submit">上报</div>
<u-select v-model="showSelect" :list="girdList" label-name="girdName" value-name="id" @confirm="confirmSelect" />
<u-select v-model="showSelect" :list="girdList" label-name="girdName" value-name="id" @confirm="confirmSelect"/>
</div>
</template>
<script>
import { mapState } from 'vuex'
import {mapState} from 'vuex'
export default {
appName: '新增事件',
@@ -164,6 +167,9 @@ export default {
},
methods: {
handleSelectGrid(v) {
this.form.girdName = v?.[0]?.girdName || ""
},
chooseAddress() {
uni.chooseLocation({
success: (res) => {
@@ -174,15 +180,6 @@ export default {
})
},
confirmSelect(e) {
this.form.girdId = e[0].value
this.girdList.map((item) => {
if (item.id == this.form.girdId) {
this.form.girdName = item.girdName
}
})
},
getDict() {
this.$http.post(`/app/appclapeventgroup/list`).then((res) => {
if (res.code == 0) {
@@ -253,24 +250,24 @@ export default {
this.flag = true
this.$http
.post(`/app/appclapeventinfo/addOrUpdate?`, {
...this.form,
files: this.form.files,
finishFiles: this.form.finishFiles,
groupName: this.dictList.filter((v) => v.value === this.form.groupId)[0].label,
eventStatus: this.form.opts == 0 ? '2' : '0',
})
.then((res) => {
this.$u.toast('上报成功')
this.flag = false
if (res.code == 0) {
uni.$emit('update')
this.$forceUpdate()
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
.post(`/app/appclapeventinfo/addOrUpdate?`, {
...this.form,
files: this.form.files,
finishFiles: this.form.finishFiles,
groupName: this.dictList.filter((v) => v.value === this.form.groupId)[0].label,
eventStatus: this.form.opts == 0 ? '2' : '0',
})
.then((res) => {
this.$u.toast('上报成功')
this.flag = false
if (res.code == 0) {
uni.$emit('update')
this.$forceUpdate()
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
},
},
}
@@ -402,6 +399,7 @@ export default {
font-size: 30px;
color: #333333;
}
.current {
color: #1174fe;
background: #e7f1fe !important;
@@ -419,6 +417,7 @@ export default {
text-align: center;
color: #ffffff;
}
::v-deep .ai-uploader .fileList .default {
width: 160px;
height: 160px;