Files
dvcp_v2_wxcp_app/src/project/police/AppMessageNotification/chooseUser.vue

266 lines
6.3 KiB
Vue
Raw Normal View History

2022-05-31 10:04:46 +08:00
<template>
2022-06-14 11:07:50 +08:00
<section class="chooseUser">
2022-05-31 10:04:46 +08:00
<div class="select-content">
<div class="area-flex">
2022-06-07 09:11:47 +08:00
<p class="title">地区</p>
2022-06-14 11:07:50 +08:00
<AiAreaPicker v-model="areaList" multiple class="value">
2022-06-06 12:03:55 +08:00
<span class="label" v-if="areaList.length">已选择</span>
<span v-else style="color:#999;">请选择</span>
2022-06-14 11:07:50 +08:00
<u-icon name="arrow-right" color="#999" size="24" style="margin-left:8px;" />
2022-05-31 10:04:46 +08:00
</AiAreaPicker>
</div>
2022-06-13 16:25:17 +08:00
<div class="area-flex">
<p class="title">部门</p>
2022-06-14 11:07:50 +08:00
<div class="value">
<AiPagePicker type="dept" :selected.sync="deptList" nodeKey="id">
<AiMore v-model="moreTextDept" />
</AiPagePicker>
</div>
2022-06-13 16:25:17 +08:00
</div>
<div class="area-flex">
<p class="title">人员</p>
2022-06-14 11:07:50 +08:00
<div class="value">
<AiPagePicker type="sysUser" :selected.sync="userList" action="/app/wxcp/wxuser/list?status=1" nodeKey="id">
<AiMore v-model="moreText" />
</AiPagePicker>
</div>
2022-06-13 16:25:17 +08:00
</div>
2022-05-31 10:04:46 +08:00
<div class="type-content">
2022-06-14 11:07:50 +08:00
<div class="type-list" 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>
2022-05-31 10:04:46 +08:00
</div>
</div>
</div>
</div>
<div class="bg-144"></div>
<div class="footer">
2022-06-06 12:03:55 +08:00
<div class="confirm" @click="confirm">确定</div>
2022-05-31 10:04:46 +08:00
</div>
</section>
</template>
<script>
import {mapState} from 'vuex'
export default {
2022-06-14 11:07:50 +08:00
name: "chooseUser",
2022-05-31 10:04:46 +08:00
data() {
return {
value: '',
areaId: '',
2022-06-06 12:03:55 +08:00
areaName: '',
areaList: [],
tagList: [],
2022-06-14 11:07:50 +08:00
tagIdList: [],
userList: [],
deptList: [],
2022-05-31 10:04:46 +08:00
}
},
2022-06-14 11:07:50 +08:00
computed: {
...mapState(['user']),
moreText() {
if(this.userList.length) return '已选择'
},
moreTextDept() {
if(this.deptList.length) return '已选择'
},
},
2022-05-31 10:04:46 +08:00
methods: {
2022-06-06 12:03:55 +08:00
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() {
2022-06-07 09:11:47 +08:00
// if(!this.areaList.length) {
// return this.$u.toast('请选择地区')
// }
2022-06-06 12:03:55 +08:00
this.tagIdList = []
this.tagList.map((item) => {
item.tagList.map((items) => {
if(items.isCheck) {
this.tagIdList.push(items.id)
}
})
})
2022-06-07 09:11:47 +08:00
// if(!this.tagIdList.length) {
// return this.$u.toast('请选择标签')
// }
2022-06-14 11:07:50 +08:00
var userIdList = [], deptIdList = []
this.userList.map((item) => {
userIdList.push(item.id)
})
this.deptList.map((item) => {
deptIdList.push(item.id)
})
2022-06-06 12:03:55 +08:00
uni.$emit('selectTag', {
areaIdList: this.areaList,
2022-06-14 11:07:50 +08:00
tagIdList: this.tagIdList,
userList: userIdList,
deptList: deptIdList
2022-06-06 12:03:55 +08:00
})
uni.navigateBack({})
2022-06-14 11:07:50 +08:00
},
toSelectDept() {
uni.navigateTo({ url: `./selectDept` })
},
2022-05-31 10:04:46 +08:00
},
onShow() {
document.title = '人员选择'
},
2022-06-06 12:03:55 +08:00
onLoad(option) {
2022-06-14 11:07:50 +08:00
console.log(option)
2022-05-31 10:04:46 +08:00
this.areaId = this.user.areaId
this.areaName = this.user.areaName
2022-06-06 12:03:55 +08:00
if(option.areaList) {
this.areaList = option.areaList.split(',')
2022-06-14 11:07:50 +08:00
}
if(option.tagIdList) {
2022-06-06 12:03:55 +08:00
this.tagIdList = option.tagIdList.split(',')
}
2022-06-14 11:07:50 +08:00
if(option.userList) {
var list = option.userList.split(',')
list.map(item => {
var info = {
id: item
}
this.userList.push(info)
})
}
if(option.deptList) {
var list = option.deptList.split(',')
list.map(item => {
var info = {
id: item
}
this.deptList.push(info)
})
}
2022-06-06 12:03:55 +08:00
this.getTagList()
2022-05-31 10:04:46 +08:00
},
}
</script>
<style lang="scss" scoped>
2022-06-14 11:07:50 +08:00
.chooseUser {
2022-05-31 10:04:46 +08:00
.select-content{
.area-flex{
display: flex;
justify-content: space-between;
2022-06-14 11:07:50 +08:00
padding: 32px;
2022-05-31 10:04:46 +08:00
line-height: 44px;
2022-06-13 16:25:17 +08:00
margin-bottom: 16px;
background-color: #fff;
2022-06-14 11:07:50 +08:00
.title{
width: 150px;
margin-bottom: 0;
}
.value{
width: calc(100% - 150px);
text-align: right;
}
2022-06-06 12:03:55 +08:00
}
.area-content{
padding: 16px 32px 32px;
2022-05-31 10:04:46 +08:00
border-bottom: 1px solid #ddd;
2022-06-06 12:03:55 +08:00
.area-item{
display: inline-block;
margin-right: 16px;
.u-icon{
margin-left: 4px;
}
}
2022-05-31 10:04:46 +08:00
}
.title{
line-height: 44px;
margin-bottom: 16px;
font-size: 32px;
color: #666;
2022-06-06 12:03:55 +08:00
.tips{
font-size: 34px;
color: #f46;
vertical-align: middle;
}
2022-05-31 10:04:46 +08:00
}
.local-icon{
width: 32px;
height: 32px;
margin-right: 4px;
}
.type-list{
padding-left: 16px;
2022-06-14 11:07:50 +08:00
margin-bottom: 16px;
padding: 34px 32px 32px;
background-color: #fff;
2022-05-31 10:04:46 +08:00
p{
line-height: 44px;
margin-bottom: 24px;
font-size: 30px;
color: #666;
}
.list{
overflow: hidden;
.item{
2022-06-14 11:07:50 +08:00
padding: 12px 32px;
2022-05-31 10:04:46 +08:00
float: left;
2022-06-14 11:07:50 +08:00
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
background-color: #F3F4F7;
border-radius: 4px;
2022-05-31 10:04:46 +08:00
margin: 0 16px 16px 0;
}
.active{
background-color: #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;
}
}
2022-06-14 11:07:50 +08:00
::v-deep .u-icon__label{
font-size: 28px!important;
}
2022-05-31 10:04:46 +08:00
}
</style>