消息发送

This commit is contained in:
liuye
2022-06-24 20:18:31 +08:00
parent cbf3af6aa2
commit 8e807e785f
14 changed files with 995 additions and 358 deletions

View File

@@ -5,25 +5,18 @@
<span>居民群</span>
<u-icon name="arrow-right" color="#ddd" size="32"></u-icon>
</div>
<div class="num"><span>12</span></div>
<p class="text">201位群成员</p>
<div class="num"><span>{{totalInfo.groupNumber}}</span></div>
<p class="text">{{totalInfo.userNumber}}位群成员</p>
</div>
<div class="list">
<div class="title">
<span>组织信息</span>
<i>72</i>
<i>{{orgInfo.total}}</i>
</div>
<div class="item" @click="linkTo('./orgDetail')">
<div class="item" v-for="(item, index) in orgInfo.Organizational" :key="index" @click="linkTo(`./orgList?id=${item.corpId}`)">
<div class="left">
<img src="./img/gird--select-icon.png" alt="">
<span>曼城去应急管理处曼城去应急管理处曼城去应急管理处曼城去应急管理处</span>
</div>
<u-icon name="arrow-right" color="#ddd" size="32"></u-icon>
</div>
<div class="item">
<div class="left">
<img src="./img/gird--select-icon.png" alt="">
<span>曼城去应急管理处曼城</span>
<span>{{item.name}}</span>
</div>
<u-icon name="arrow-right" color="#ddd" size="32"></u-icon>
</div>
@@ -40,11 +33,13 @@ export default {
appName: "数据总览",
data() {
return {
totalInfo: {},
orgInfo: {}
}
},
computed: {...mapState(['user'])},
created() {
this.getTotal()
},
onShow() {
document.title = '数据总览'
@@ -52,6 +47,19 @@ export default {
methods: {
linkTo(url) {
uni.navigateTo({ url })
},
getTotal() {
this.$http.post(`/app/wxcp/wxgroup/getGoupAndUserCount`).then(res => {
if (res?.code == 0) {
this.totalInfo = res.data
}
})
this.$http.post(`/app/appdvcpconfig/getOrganizationalInfo`).then(res => {
if (res?.code == 0) {
this.orgInfo = res.data
}
})
}
},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,11 +1,16 @@
<template>
<div class="orgDetail">
<p class="total">组织内共72人</p>
<div class="title">
<span>管理局/什么部门</span>
<i>共72人</i>
</div>
<div class="list">
<div class="item">
<div class="user-item">
<div class="left">
<img src="./img/gird--select-icon.png" alt="">
<span>曼城去应急管理处曼城去应急管理处曼城去应急管理处曼城去应急管理处</span>
<img src="./img/user-img.png" alt="">
</div>
<div class="right">
<p>王一一 (13303256321)</p>
</div>
</div>
<div class="item">
@@ -45,6 +50,7 @@ export default {
.list{
padding-left: 32px;
background-color: #fff;
margin-top: 16px;
.item{
padding: 34px 32px 34px 0;
box-sizing: border-box;
@@ -67,12 +73,47 @@ export default {
}
}
}
.user-item{
padding: 34px 32px 34px 0;
box-sizing: border-box;
border-bottom: 1px solid #ddd;
display: flex;
.left{
width: 70px;
img{
width: 56px;
height: 56px;
vertical-align: bottom;
margin-right: 14px;
}
}
.right{
width: calc(100% - 70px);
p{
line-height: 44px;
font-size: 30px;
color: #333;
}
}
}
}
.total{
.title{
display: flex;
justify-content: space-between;
font-size: 32px;
font-weight: 500;
line-height: 44px;
font-size: 30px;
color: #666;
padding: 32px 32px 24px 32px;
color: #333;
font-family: PingFangSC-Regular, PingFang SC;
padding: 32px;
box-sizing: border-box;
background-color: #fff;
i{
font-style: normal;
padding-right: 32px;
font-size: 28px;
color: #666;
}
}
}
</style>

View File

@@ -0,0 +1,272 @@
<template>
<section class="selectDeptUser">
<div class="header-middle">
<div class="hint">
<span v-for="(item, index) in selectDeptPath" :key="index">
<span v-if="index>0" class="mar-h4">/</span>
<span class="color-3F8DF5" @click="deptNameClick(item, index)">{{ item.name }}</span>
</span>
</div>
<div class="cards" v-for="item in treeList" :key="item.id" @click="itemClick(item)">
<div class="imges">
<!-- <div class="imgselect" :class="{checked:item.isChecked}" @click.stop="itemCheck(item, 'dept')"/> -->
<img src="./img/gird--select-icon.png" alt="" class="avatras"/>
</div>
<div class="rightes">
<div class="applicationNames">{{ item.name }}</div>
<img src="./img/right-icon.png" alt="" class="imgs"/>
</div>
</div>
<div class="userCards" v-for="e in userList" :key="e.id">
<div class="imges">
<!-- <div class="imgselect" :class="{checked:e.isChecked}" @click.stop="itemCheck(e, 'user')"/> -->
<img src="./img/tx@2x.png" alt="" class="avatras"/>
</div>
<div class="rights fill">
<div class="applicationNames" v-text="e.name"/>
<div class="idNumbers">{{ e.phone }}</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!hasData"/>
</div>
<!-- <div class="subBtn" @click="submit">
<div>确定选择</div>
</div> -->
</section>
</template>
<script>
export default {
name: "orgList",
data() {
return {
selected: [],
allData: null,
treeList: [],
selectDeptPath: [],
userList: [],
}
},
computed: {
hasData() {
return this.treeList?.length > 0 || this.userList?.length > 0
}
},
onLoad(option) {
this.getAllDepts(option.id)
},
methods: {
isSelected(id) {
return !!this.selected.find(e => e.id == id)
},
getAllDepts(id) {
this.$http.post(`/app/wxcp/wxdepartment/listAllByCid?cid=${id}`).then((res) => {
if (res?.data) {
let parents = res.data.map(e => e.parentid)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id), isChecked: this.isSelected(e.id)}))
this.deptInit()
}
})
},
deptInit() {
this.treeList = this.allData.filter(e => !e.parentid)
this.selectDeptPath = [{name: "可选范围", id: ''}]
},
itemClick({id, name}) {
let index = this.selectDeptPath.findIndex(e => e.id == id)
if (index == -1) {
this.selectDeptPath.push({name, id})
this.getDeptsAndUsersByParent(id)
}
},
getDeptsAndUsersByParent(departmentId) {
this.treeList = this.allData.filter(e => e.parentid == departmentId)
this.userList = []
this.$http.post(`/app/wxcp/wxuser/listByDeptId`, null, {
params: {departmentId, status: 1}
}).then(res => {
if (res?.data) {
this.userList = res.data.map(e => ({...e, isChecked: this.isSelected(e.id)}))
}
})
},
deptNameClick(row, index) {
this.userList = []
if (!index) { //第一级别
this.deptInit()
} else {
let length = this.selectDeptPath.length - index
this.selectDeptPath.splice(index + 1, length)
this.getDeptsAndUsersByParent(row.id)
}
},
itemCheck(row, kind) {
row.isChecked = !row.isChecked
if (row.isChecked) {
this.selected.push({...row, kind})
} else {
let index = this.selected.findIndex(e => e.id == row.id)
this.selected.splice(index, 1)
}
this.$forceUpdate()
},
submit() {
// uni.navigateBack({
// success: () => {
// uni.$emit("pagePicker:custom", [this.selected].flat())
// }
// })
// uni.$emit("selectDept", [this.selected].flat())
console.log([this.selected].flat())
uni.$emit("pagePicker:custom", [this.selected].flat())
uni.setStorageSync('selectDeptUser', [this.selected].flat())
uni.navigateTo({url: `./selectTag`})
},
}
}
</script>
<style lang="scss" scoped>
.selectDeptUser {
height: 100%;
background: #fff;
.header-top {
background: #fff;
padding: 20px 32px;
}
.header-middle {
padding-bottom: 140px;
.hint {
padding: 28px 20px 28px 32px;
line-height: 56px;
box-shadow: 0 1px 0 0 #e4e5e6;
font-size: 30px;
font-weight: 500;
word-break: break-all;
}
.empty-div {
height: 16px;
background: #f5f5f5;
}
.imges {
display: flex;
align-items: center;
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
img {
width: 74px;
height: 74px;
border-radius: 8px;
}
.rightes {
width: calc(100% - 160px);
display: flex;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
.applicationNames {
flex: 1;
min-width: 0;
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.imgs {
flex-shrink: 0;
width: 40px;
height: 40px;
margin-right: 20px;
}
}
}
.userCards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
.rights {
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
padding-right: 40px;
height: inherit;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.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;
}
}
.color-3F8DF5 {
color: #3F8DF5;
}
.mar-h4 {
margin: 0 4px;
}
}
</style>

View File

@@ -1,22 +1,25 @@
<template>
<div class="userDetail">
<div class="list">
<div class="item">
<AiTopFixed>
<div class="currentLeft-top">
<div class="left">
<img src="./img/user-img.png" alt="">
</div>
<div class="right">
<p>群聊</p>
<div>3 | 群主张三</div>
<AiAreaPicker v-model="areaId" :areaId="user.areaId" @select="getList" :name.sync="areaName" selectRoot>
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-down" color="#666" size="24" style="margin-left: 4px" />
</AiAreaPicker>
</div>
<u-search v-model="groupName" :clearabled="true" placeholder="请输入群昵称" :show-action="false" bg-color="#F5F5F5" search-icon-color="#ccc" color="#666" height="58" @search="getList" @clear="handerClear"></u-search>
</div>
<div class="item">
</AiTopFixed>
<div class="list">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="left">
<img src="./img/user-img.png" alt="">
</div>
<div class="right">
<p>群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊群聊</p>
<div>3 | 群主张三</div>
<p>{{item.groupName || '群聊'}}</p>
<div>{{item.personCount}} | 群主{{item.ownerName}}</div>
</div>
</div>
</div>
@@ -30,26 +33,58 @@ export default {
name: "userDetail",
data() {
return {
areaId: '',
areaName: '',
groupName: '',
list: []
}
},
computed: {...mapState(['user'])},
created() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.getList()
},
onShow() {
document.title = '居民群详情'
},
methods: {
handerClear() {
this.groupName = ''
this.getList()
},
getList() {
this.$http.post(`/app/wxcp/wxgroup/allGroupInfo?areaId=${this.areaId}&groupName=${this.groupName}`).then(res => {
if (res?.code == 0) {
this.list = res.data
}
})
}
},
}
</script>
<style lang="scss" scoped>
.userDetail {
.currentLeft-top {
display: flex;
align-items: center;
.left {
width: 200px;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
.list{
background-color: #fff;
padding-left: 32px;
margin-top: 16px;
.item{
padding: 34px 32px 34px 0;
display: flex;

View File

@@ -6,45 +6,40 @@
<p>个人群发每天可以给用户发送10条群发消息</p>
</div>
<div class="select-user">
<div class="label color-666">用户选择</div>
<div class="right" @click="toSelect">
<span>
<span v-if="!areaIdList.length && !tagIdList.length">全部</span>
<span v-else>已选择<!-- <span class="color-1365DD">10</span> --></span>
</span>
<img src="./components/img/right-icon.png" alt="">
<div class="label color-666"><span class="tips">*</span>发送方式</div>
<div class="right">
<u-radio-group v-model="form.sendType" @change="radioGroupChange">
<u-radio v-for="(item, index) in typeList" :key="index" :label="item.name" :name="item.type">{{item.name}}</u-radio>
</u-radio-group>
</div>
</div>
<div class="select-user">
<div class="label color-666"><span class="tips">*</span>部门选择</div>
<div class="right">
<AiPagePicker type="custom" :selected.sync="deptUserList" nodeKey="id" :ops="{url:`./selectDeptUser`,label:'name'}" valueObj>
<span class="label" v-if="deptUserList.length">已选择</span>
<span v-else style="color:#999;">请选择</span>
<u-icon name="arrow-right" color="#999" size="24" style="margin-left:8px;"/>
</AiPagePicker>
</div>
</div>
<div class="select-user">
<div class="label color-666">发送地区</div>
<div class="right">
<AiAreaPicker v-model="areaIdList" multiple>
<span class="label" v-if="areaIdList.length">已选择</span>
<span v-else style="color:#999;">请选择</span>
<u-icon name="arrow-down" color="#666" size="24"/>
</AiAreaPicker>
</div>
</div>
<div class="content">
<p class="title fw500 mar-b32">群发消息设置</p>
<div class="select-user pad-lr0">
<div class="label color-666"><span class="tips">*</span>群发方式</div>
<div class="right">
<u-radio-group v-model="form.sendType">
<u-radio v-for="(item, index) in sendTypeList" :key="index" :label="item.name" :name="item.type">{{item.name}}</u-radio>
</u-radio-group>
</div>
<u-picker mode="time" v-model="timeShow" :params="timeParams" @confirm="timeSelect"></u-picker>
</div>
<div class="select-user pad-lr0" v-if="form.sendType == 1">
<div class="label color-666"><span class="tips">*</span>群发时间</div>
<div class="right" @click="timeShow=true">
<span v-if="form.sendTime">{{form.sendTime}}</span>
<span class="color-999" v-else>请选择</span>
</div>
<u-picker mode="time" v-model="timeShow" :params="timeParams" @confirm="timeSelect"></u-picker>
</div>
<div class="mini-title color-666"><span class="tips">*</span>文本内容</div>
<div class="textarea">
<u-input v-model="form.content" type="textarea" :height="400" auto-height maxlength="1000" placeholder="请输入文本内容" />
<div class="hint">{{ form.content.length }}/1000</div>
</div>
<!-- <div class="type">
<p class="color-666">其它类型</p>
<u-radio-group v-model="form.contentType">
<u-radio v-for="(item, index) in typeList" :key="index" :name="item.type" @change="radioChange" > {{item.name}}</u-radio>
</u-radio-group>
</div> -->
<div class="type-content">
<div class="flex">
<p class="label" style="width:40px;">图片</p>
@@ -58,50 +53,7 @@
<p class="label" style="width:40px;">附件</p>
<AiUploader type="file" :limit="1" placeholder="上传附件" :def.sync="formData.fileListFile" @data="(v) => fileDataFile = v"></AiUploader>
</div>
<div v-if="form.contentType == 'link'">
<div class="flex border-b">
<p class="label">链接地址</p>
<div class="value">
<u-input v-model="formData.accessUrl" type="text" input-align="right" placeholder="请输入链接地址" height="44" />
</div>
</div>
<div class="flex border-b">
<p class="label">链接图片</p>
<AiUploader multiple :def.sync="formData.imgList" :limit="1" action="/admin/file/add2"></AiUploader>
</div>
<div class="flex">
<p class="label">链接标题</p>
<div class="value">
<u-input v-model="formData.accessTitle" type="text" input-align="right" placeholder="请输入链接标题" height="44" />
</div>
</div>
</div>
<div v-if="form.contentType == 'miniapp'" class="flex-label">
<div class="flex border-b">
<p class="label">小程序标题</p>
<div class="value">
<u-input v-model="formData.accessTitle" type="text" input-align="right" placeholder="请输入小程序标题" height="44" />
</div>
</div>
<div class="flex border-b">
<p class="label">小程序APPID</p>
<div class="value">
<u-input v-model="formData.accessAppid" type="text" input-align="right" placeholder="请输入小程序APPID" height="44" />
</div>
</div>
<div class="flex border-b">
<p class="label">小程序跳转页面</p>
<div class="value">
<u-input v-model="formData.accessUrl" type="text" input-align="right" placeholder="如pages/home/home" height="44" />
</div>
</div>
<div class="flex">
<p class="label" style="width:80px;">小程序图片</p>
<AiUploader multiple :def.sync="formData.imgList" :limit="1" action="/admin/file/add2"></AiUploader>
</div>
</div>
</div>
<!-- <div class="upload"><u-icon name="plus-circle-fill" color="#1365DD" size="32"></u-icon>添加附件</div> -->
</div>
<div class="bg-144"></div>
<div class="footer">
@@ -129,55 +81,47 @@ export default {
data() {
return {
typeList: [
{name: '图片', type: 'image'},
{name: '视频', type: 'video'},
{name: '文件', type: 'file'}
],
sendTypeList: [
{name: '立即发送', type: '0'},
{name: '定时发送', type: '1'}
{name: '居民群', type: '0'},
{name: '居民', type: '1'}
],
form: {
content: '',
contentType: 'text',
sendType: '0',
sendTime: ''
sendType: '1',
},
formData: {
fileListImg: [],
fileListVideo: [],
fileListFile: [],
fileList: [],
imgList: [],
accessImgurl: '',
accessTitle: '',
accessUrl: '',
accessAppid: '',
file: {},
mediaId: ''
},
areaIdList: [],
tagIdList: [],
timeShow: false,
timeParams: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true
},
fileDataImg: null,
fileDataVideo: null,
fileDataFile: null
fileDataFile: null,
userList: [],
deptList: [],
deptUserTagList: []
}
},
computed: {
...mapState(['user']),
deptUserList: {
set(v) {
this.userList = v.filter(e => e.kind == 'user')
this.deptList = v.filter(e => e.kind == 'dept')
},
get() {
let {userList, deptList} = this
return [userList, deptList].flat()
}
}
},
computed: {...mapState(['user'])},
methods: {
radioChange(e) {
// this.$nextTick(() => {
// this.form.contentType = e
// })
radioGroupChange(e) {
this.form.sendType = e
uni.setStorageSync('sendType', e)
},
toSelect() {
uni.navigateTo({url: `./SelectUser?tagIdList=${this.tagIdList}&areaList=${this.areaIdList}`})
@@ -285,13 +229,17 @@ export default {
}
},
created() {
uni.setStorageSync('sendType', this.form.sendType)
this.areaId = this.user.areaId
this.areaName = this.user.areaName
uni.$on('selectTag', res => {
this.tagIdList = res.tagIdList
this.areaIdList = res.areaIdList
})
// uni.$on('selectTag', res => {
// this.tagIdList = res.tagIdList
// this.areaIdList = res.areaIdList
// })
},
onShow() {
this.deptUserTagList = uni.getStorageSync('selectDeptUser')
}
}
</script>
<style lang="scss" scoped>

View File

@@ -1,217 +0,0 @@
<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="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="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">
<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>
</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{
.area-flex{
display: flex;
justify-content: space-between;
padding: 34px 32px 0;
line-height: 44px;
margin-bottom: 16px;
background-color: #fff;
}
.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{
}
.type-list{
padding-left: 16px;
margin-bottom: 16px;
padding: 34px 32px 32px;
background-color: #fff;
p{
line-height: 44px;
margin-bottom: 24px;
font-size: 30px;
color: #666;
}
.list{
overflow: hidden;
.item{
padding: 12px 32px;
float: left;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
background-color: #F3F4F7;
border-radius: 4px;
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;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,288 @@
<template>
<section class="selectDeptUser">
<div class="header-middle">
<div class="hint">
<span v-for="(item, index) in selectDeptPath" :key="index">
<span v-if="index>0" class="mar-h4">/</span>
<span class="color-3F8DF5" @click="deptNameClick(item, index)">{{ item.name }}</span>
</span>
</div>
<div class="cards" v-for="item in treeList" :key="item.id" @click="itemClick(item)">
<div class="imges">
<div class="imgselect" :class="{checked:item.isChecked}" @click.stop="itemCheck(item, 'dept')"/>
<img src="./components/img/gird--select-icon.png" alt="" class="avatras"/>
</div>
<div class="rightes">
<div class="applicationNames">{{ item.name }}</div>
<img src="./components/img/right-icon.png" alt="" class="imgs"/>
</div>
</div>
<div class="userCards" v-for="e in userList" :key="e.id">
<div class="imges">
<div class="imgselect" :class="{checked:e.isChecked}" @click.stop="itemCheck(e, 'user')"/>
<img src="./components/img/tx@2x.png" alt="" class="avatras"/>
</div>
<div class="rights fill">
<div class="applicationNames" v-text="e.name"/>
<div class="idNumbers">{{ e.phone }}</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!hasData"/>
</div>
<div class="subBtn" @click="submit">
<div>确定选择</div>
</div>
</section>
</template>
<script>
export default {
name: "selectDeptUser",
appName: "选择部门/人员",
data() {
return {
selected: [],
allData: null,
treeList: [],
selectDeptPath: [],
userList: [],
}
},
computed: {
hasData() {
return this.treeList?.length > 0 || this.userList?.length > 0
}
},
onLoad() {
console.log(this.$route.query.selected)
// this.selected = [this.$route.query.selected].flat().filter(e => !!e)?.map(id => ({id, kind: /^\d{1,5}}$/.test(id) ? 'dept' : 'user'})) || []
this.getAllDepts()
},
methods: {
isSelected(id) {
return !!this.selected.find(e => e.id == id)
},
getAllDepts() {
this.$http.post('/app/wxcp/wxdepartment/listAllByCorp').then((res) => {
if (res?.data) {
let parents = res.data.map(e => e.parentid)
this.allData = res.data.map(e => ({...e, hasChildren: parents.includes(e.id), isChecked: this.isSelected(e.id)}))
this.deptInit()
}
})
},
deptInit() {
this.treeList = this.allData.filter(e => !e.parentid)
this.selectDeptPath = [{name: "可选范围", id: ''}]
},
itemClick({id, name}) {
let index = this.selectDeptPath.findIndex(e => e.id == id)
if (index == -1) {
this.selectDeptPath.push({name, id})
this.getDeptsAndUsersByParent(id)
}
},
getDeptsAndUsersByParent(departmentId) {
this.treeList = this.allData.filter(e => e.parentid == departmentId)
this.userList = []
this.$http.post(`/app/wxcp/wxuser/listByDeptId`, null, {
params: {departmentId, status: 1}
}).then(res => {
if (res?.data) {
this.userList = res.data.map(e => ({...e, isChecked: this.isSelected(e.id)}))
}
})
},
deptNameClick(row, index) {
this.userList = []
if (!index) { //第一级别
this.deptInit()
} else {
let length = this.selectDeptPath.length - index
this.selectDeptPath.splice(index + 1, length)
this.getDeptsAndUsersByParent(row.id)
}
},
itemCheck(row, kind) {
row.isChecked = !row.isChecked
if (row.isChecked) {
this.selected.push({...row, kind})
} else {
let index = this.selected.findIndex(e => e.id == row.id)
this.selected.splice(index, 1)
}
this.$forceUpdate()
},
submit() {
// uni.navigateBack({
// success: () => {
// uni.$emit("pagePicker:custom", [this.selected].flat())
// }
// })
// uni.$emit("selectDept", [this.selected].flat())
console.log([this.selected].flat())
uni.$emit("pagePicker:custom", [this.selected].flat())
uni.setStorageSync('selectDeptUser', [this.selected].flat())
uni.navigateTo({url: `./selectTag`})
},
}
}
</script>
<style lang="scss" scoped>
.selectDeptUser {
height: 100%;
background: #fff;
.header-top {
background: #fff;
padding: 20px 32px;
}
.header-middle {
padding-bottom: 140px;
.hint {
padding: 28px 20px 28px 32px;
line-height: 56px;
box-shadow: 0 1px 0 0 #e4e5e6;
font-size: 30px;
font-weight: 500;
word-break: break-all;
}
.empty-div {
height: 16px;
background: #f5f5f5;
}
.imges {
display: flex;
align-items: center;
.imgselect {
width: 48px;
height: 48px;
vertical-align: middle;
background-image: url("./components/img/xz.png");
background-position: center;
background-size: 100% 100%;
&.checked {
background-image: url("./components/img/xzh.png");
}
}
.avatras {
width: 74px;
height: 74px;
border-radius: 8px;
margin-left: 36px;
}
}
.cards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
img {
width: 74px;
height: 74px;
border-radius: 8px;
}
.rightes {
width: calc(100% - 160px);
display: flex;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
.applicationNames {
flex: 1;
min-width: 0;
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.imgs {
flex-shrink: 0;
width: 40px;
height: 40px;
margin-right: 20px;
}
}
}
.userCards {
display: flex;
align-items: center;
height: 120px;
line-height: 120px;
padding: 0 0 0 32px;
.rights {
display: flex;
justify-content: space-between;
align-items: center;
margin-left: 32px;
border-bottom: 1px solid #e4e5e6;
padding-right: 40px;
height: inherit;
.applicationNames {
font-size: 36px;
font-weight: 500;
color: #333333;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.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;
}
}
.color-3F8DF5 {
color: #3F8DF5;
}
.mar-h4 {
margin: 0 4px;
}
}
</style>

View File

@@ -0,0 +1,262 @@
<template>
<section class="selectTag">
<p class="title">已选择部门</p>
<div class="list">
<div class="item" v-for="(item, index) in deptList" :key="index">
<div class="name-flex">
<div class="name">{{ item.name }}</div>
<div class="btn" @click="chooseTag(index)">添加标签</div>
</div>
<div class="tag-list" v-if="item.tagList && item.tagList.length">
<span v-for="(items, indexs) in item.tagList" :key="indexs">{{items.name}}</span>
</div>
</div>
</div>
<div class="bg-144"></div>
<div class="footer">
<div @click="back">上一步</div>
<div class="confirm" @click="confirm">确定</div>
</div>
<u-popup v-model="showTagList" mode="bottom" class="popup">
<div class="popup-title">
<div class="btn" @click="cancelTag">取消</div>
<div class="text">选择标签</div>
<div class="btn confirm" @click="confirmTag">确认</div>
</div>
<div class="popup-tag">
<div class="type-list" v-for="(item, index) in tagList" :key="index">
<p>{{ item.name }}</p>
<div class="tag-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>
</u-popup>
</section>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: "selectTag",
data() {
return {
deptList: [],
userList: [],
showTagList: false,
sendType: '', //0居民群 1居民
tagList: [],
deptIndex: 0
}
},
computed: {...mapState(['user'])},
methods: {
chooseTag(index) {
this.deptIndex = index
this.getTagList(this.deptList[index].id)
// if(this.deptList[index].tagIdList) {
// this.tagList.map((item) => {
// item.tagList.map((items) => {
// if(this.deptList[index].tagIdList.includes(items.id)) {
// items.isCheck = true
// }
// })
// })
// }
// this.showTagList = true
},
typeClick(index, indexs) {
this.tagList[index].tagList[indexs].isCheck = !this.tagList[index].tagList[indexs].isCheck
},
confirmTag() {
this.deptList[this.deptIndex].tagList = []
this.deptList[this.deptIndex].tagIdList = []
this.tagList.map((item) => {
item.tagList.map((items) => {
if(items.isCheck) {
this.deptList[this.deptIndex].tagList.push(items)
this.deptList[this.deptIndex].tagIdList.push(items.id)
}
})
})
this.cancelTag()
},
cancelTag() {
this.tagList.map((item) => {
item.tagList.map((items) => {
items.isCheck = false
})
})
this.showTagList=false
},
getTagList(id) {
var url = this.sendType == 1 ? `/app/wxcp/wxgroupchattag/listAllByCorp?dvcpId=${id}` : '/wxcp/wxgroupchattag/listAllTag?size=100'
this.$http.post(url).then(res => {
if (res?.code == 0) {
res.data.records.map((item) => {
item.tagList.map((items) => {
items.isCheck = false
})
})
this.tagList = res.data.records
}
})
},
confirm() {
uni.setStorageSync('selectDeptUser', [this.deptList, ...this.userList])
uni.navigateBack({ delta: 2 })
},
back() {
uni.navigateBack()
}
},
onShow() {
document.title = '选择部门'
},
onLoad() {
var list = uni.getStorageSync('selectDeptUser')
this.sendType = uni.getStorageSync('sendType')
list.map((item) => {
if(item.kind == 'dept') {
this.deptList.push(item)
}else {
this.userList.push(item)
}
})
// this.getTagList()
},
}
</script>
<style lang="scss" scoped>
.selectTag {
.title{
padding: 32px;
line-height: 44px;
font-size: 32px;
color: #333;
}
.list{
padding: 0 32px;
.item{
width: 100%;
padding: 32px;
box-sizing: border-box;
background-color: #fff;
margin-bottom: 16px;
border-radius: 8px;
.name-flex{
display: flex;
justify-content: space-between;
margin-bottom: 8px;
font-size: 32px;
line-height: 44px;
.name{
width: calc(100% - 138px);
word-break: break-all;
}
.btn{
width: 120px;
text-align: right;
color: #3192F4;
font-size: 30px;
}
}
.tag-list{
span{
display: inline-block;
padding: 12px 32px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
background-color: #F3F4F7;
border-radius: 4px;
margin: 0 16px 16px 0;
}
}
}
}
.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;
}
}
.popup{
.popup-title{
display: flex;
line-height: 44px;
padding: 32px;
.text{
width: calc(100% - 400px);
color: #333;
text-align: center;
}
.btn{
width: 200px;
color: #999;
}
.confirm{
text-align: right;
color: #1365dd;
}
}
.popup-tag{
height: 500px;
overflow-y: scroll;
}
.type-list {
padding: 0 32px;
background-color: #fff;
p {
line-height: 44px;
margin-bottom: 24px;
font-size: 30px;
color: #666;
}
.tag-list {
overflow: hidden;
.item {
padding: 12px 32px;
float: left;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #333;
line-height: 40px;
background-color: #F3F4F7;
border-radius: 4px;
margin: 0 16px 16px 0;
}
.active {
background-color: #3192F4;
color: #fff;
}
}
}
}
}
</style>