Files
dvcp_v2_wxcp_app/src/project/police/AppMessageNotification/SelectUser.vue
2022-06-07 09:11:47 +08:00

202 lines
4.6 KiB
Vue

<template>
<section class="SelectUser">
<div class="select-content">
<div class="area-flex">
<p class="title">地区</p>
<AiAreaPicker v-model="areaList" multiple>
<span class="label" v-if="areaList.length">已选择</span>
<span v-else style="color:#999;">请选择</span>
<u-icon name="arrow-down" color="#666" size="24"/>
</AiAreaPicker>
</div>
<div class="type-content">
<p class="title">选择标签</p>
<div class="type-list">
<div v-for="(item, index) in tagList" :key="index">
<p>{{item.name}}</p>
<div class="list">
<div class="item" :class="items.isCheck ? 'active' : ''" v-for="(items, indexs) in item.tagList" :key="indexs" @click="typeClick(index, indexs)">{{items.name}}</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-144"></div>
<div class="footer">
<div class="confirm" @click="confirm">确定</div>
</div>
</section>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: "SelectUser",
data() {
return {
value: '',
areaId: '',
areaName: '',
areaList: [],
tagList: [],
tagIdList: []
}
},
computed: {...mapState(['user'])},
methods: {
getTagList() {
this.$http.post("/app/wxcp/wxcorptag/listAll?size=100").then(res => {
if (res?.code == 0) {
res.data.records.map((item) => {
item.tagList.map((items) => {
items.isCheck = false
if(this.tagIdList.includes(items.id)) {
items.isCheck = true
}
})
})
this.tagList = res.data.records
}
})
},
typeClick(index, indexs) {
this.tagList[index].tagList[indexs].isCheck = !this.tagList[index].tagList[indexs].isCheck
},
confirm() {
// if(!this.areaList.length) {
// return this.$u.toast('请选择地区')
// }
this.tagIdList = []
this.tagList.map((item) => {
item.tagList.map((items) => {
if(items.isCheck) {
this.tagIdList.push(items.id)
}
})
})
// if(!this.tagIdList.length) {
// return this.$u.toast('请选择标签')
// }
uni.$emit('selectTag', {
areaIdList: this.areaList,
tagIdList: this.tagIdList
})
uni.navigateBack({})
}
},
onShow() {
document.title = '人员选择'
},
onLoad(option) {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
if(option.areaList) {
this.areaList = option.areaList.split(',')
this.tagIdList = option.tagIdList.split(',')
}
this.getTagList()
},
}
</script>
<style lang="scss" scoped>
.SelectUser {
.select-content{
background-color: #fff;
.area-flex{
display: flex;
justify-content: space-between;
padding: 34px 32px 0;
line-height: 44px;
}
.area-content{
padding: 16px 32px 32px;
border-bottom: 1px solid #ddd;
.area-item{
display: inline-block;
margin-right: 16px;
.u-icon{
margin-left: 4px;
}
}
}
.title{
line-height: 44px;
margin-bottom: 16px;
font-size: 32px;
color: #666;
.tips{
font-size: 34px;
color: #f46;
vertical-align: middle;
}
}
.local-icon{
width: 32px;
height: 32px;
margin-right: 4px;
}
.AiAreaPicker{
margin-bottom: 24px;
}
.type-content{
padding: 34px 32px;
}
.type-list{
padding-left: 16px;
margin-top: 32px;
p{
line-height: 44px;
margin-bottom: 24px;
font-size: 30px;
color: #666;
}
.list{
overflow: hidden;
margin-bottom: 32px;
.item{
width: 150px;
line-height: 68px;
float: left;
text-align: center;
border-radius: 34px;
border: 1px solid #ddd;
margin: 0 16px 16px 0;
font-size: 30px;
}
.active{
background-color: #3192F4;
border: 1px solid #3192F4;
color: #fff;
}
}
}
}
.bg-144{
height: 144px;
}
.footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 112px;
line-height: 112px;
background: #fff;
display: flex;
font-size: 36px;
font-family: PingFangSC-Regular, PingFang SC;
.confirm {
color: #fff;
background: #1365dd;
}
div {
flex: 1;
text-align: center;
color: #333;
}
}
}
</style>