2025-01-07 10:57:29 +00:00
|
|
|
|
<template>
|
2025-01-17 05:56:06 +00:00
|
|
|
|
<div class="outer-layer manage-group-admin-page">
|
2025-01-07 10:57:29 +00:00
|
|
|
|
<div class="root">
|
|
|
|
|
<ZPaging ref="zPaging" :show-scrollbar="false">
|
|
|
|
|
<template #top>
|
2025-01-24 09:01:50 +00:00
|
|
|
|
<customNavbar :title="$t('chat.settings.groupAdmin')"></customNavbar>
|
2025-01-07 10:57:29 +00:00
|
|
|
|
</template>
|
2025-01-17 05:56:06 +00:00
|
|
|
|
<div class="manage-group-admin">
|
|
|
|
|
<span class="manage-group-admin-title text-[28rpx] font-regular">
|
2025-01-07 10:57:29 +00:00
|
|
|
|
{{ $t('chat.settings.groupAdmin') }}
|
|
|
|
|
</span>
|
|
|
|
|
<div
|
2025-01-17 05:56:06 +00:00
|
|
|
|
class="group-admin-list chat-settings-card"
|
|
|
|
|
:style="{
|
2025-01-21 10:43:14 +00:00
|
|
|
|
margin: state?.groupAdminList?.length > 0 ? '20rpx 0 0' : '',
|
2025-01-17 05:56:06 +00:00
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="group-admin-list-each"
|
2025-01-22 08:37:28 +00:00
|
|
|
|
:style="{
|
|
|
|
|
padding:
|
|
|
|
|
groupParams?.groupInfo?.group_type == 1 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 3
|
|
|
|
|
? '18rpx 26rpx 18rpx 14rpx'
|
|
|
|
|
: '',
|
|
|
|
|
}"
|
2025-01-21 10:43:14 +00:00
|
|
|
|
v-for="(item, index) in state?.groupAdminList"
|
2025-01-17 05:56:06 +00:00
|
|
|
|
:key="index"
|
|
|
|
|
>
|
2025-01-22 08:37:28 +00:00
|
|
|
|
<selectMemberItem
|
|
|
|
|
v-if="
|
|
|
|
|
groupParams?.groupInfo?.group_type == 1 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 3
|
|
|
|
|
"
|
|
|
|
|
:groupType="groupParams.groupInfo.group_type"
|
|
|
|
|
:memberItem="item"
|
|
|
|
|
></selectMemberItem>
|
|
|
|
|
<span
|
|
|
|
|
v-if="
|
|
|
|
|
groupParams?.groupInfo?.group_type == 2 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 4
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ item.deptPos }}
|
|
|
|
|
</span>
|
2025-01-21 10:43:14 +00:00
|
|
|
|
<div class="group-admin-list-each-btns">
|
|
|
|
|
<img
|
|
|
|
|
v-if="item.is_mine"
|
|
|
|
|
src="/src/static/image/chatSettings/is-mine.png"
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
class="group-admin-list-each-btns-each"
|
|
|
|
|
v-if="!item.cannotRemove"
|
|
|
|
|
@click="removeGroupAdmin(item)"
|
|
|
|
|
>
|
|
|
|
|
<span class="text-[28rpx] font-regular">
|
|
|
|
|
{{ $t('chatSettings.btn.removeAdmin') }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-17 05:56:06 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="add-admin-member-btn chat-settings-card"
|
2025-01-07 10:57:29 +00:00
|
|
|
|
@click="toSelectMembersPage"
|
2025-01-17 05:56:06 +00:00
|
|
|
|
:style="{
|
2025-01-21 10:43:14 +00:00
|
|
|
|
margin: state?.groupAdminList.length == 0 ? '20rpx 0 0' : '',
|
2025-01-17 05:56:06 +00:00
|
|
|
|
}"
|
2025-01-07 10:57:29 +00:00
|
|
|
|
>
|
|
|
|
|
<img src="/src/static/image/chatSettings/add-btn.png" />
|
|
|
|
|
<span class="text-[28rpx] font-medium">
|
|
|
|
|
{{ $t('chat.manage.addAdmin') }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</ZPaging>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
2025-01-22 08:37:28 +00:00
|
|
|
|
import selectMemberItem from '../components/select-member-item.vue'
|
2025-01-07 10:57:29 +00:00
|
|
|
|
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
|
|
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
2025-01-21 10:43:14 +00:00
|
|
|
|
import { computed, onMounted, reactive, watch } from 'vue'
|
2025-01-07 10:57:29 +00:00
|
|
|
|
|
2025-01-22 08:37:28 +00:00
|
|
|
|
import {
|
|
|
|
|
ServeEditGroupAdmin,
|
|
|
|
|
ServeGroupAssignAdmin,
|
|
|
|
|
} from '@/api/group/index.js'
|
2025-01-07 10:57:29 +00:00
|
|
|
|
import { useGroupStore, useDialogueStore } from '@/store'
|
|
|
|
|
|
2025-01-21 10:43:14 +00:00
|
|
|
|
import { useAuth } from '@/store/auth'
|
|
|
|
|
const { userInfo } = useAuth()
|
|
|
|
|
|
2025-01-07 10:57:29 +00:00
|
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
|
|
|
|
const groupStore = useGroupStore()
|
2025-01-17 05:56:06 +00:00
|
|
|
|
const groupParams = reactive({
|
|
|
|
|
groupInfo: computed(() => groupStore.groupInfo),
|
|
|
|
|
})
|
2025-01-07 10:57:29 +00:00
|
|
|
|
const dialogueStore = useDialogueStore()
|
|
|
|
|
const dialogueParams = reactive({
|
2025-01-08 08:31:31 +00:00
|
|
|
|
adminList: computed(() => dialogueStore.getAdminList),
|
2025-01-21 10:43:14 +00:00
|
|
|
|
receiverId: computed(() => dialogueStore.talk.receiver_id),
|
2025-01-07 10:57:29 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const state = reactive({
|
2025-01-17 05:56:06 +00:00
|
|
|
|
groupAdminList: [], //群管理员列表
|
2025-01-07 10:57:29 +00:00
|
|
|
|
})
|
|
|
|
|
|
2025-01-21 10:43:14 +00:00
|
|
|
|
watch(
|
2025-01-22 08:37:28 +00:00
|
|
|
|
[() => groupParams?.groupInfo, , () => dialogueParams?.adminList],
|
2025-01-21 10:43:14 +00:00
|
|
|
|
(newGroupInfo) => {
|
|
|
|
|
getGroupAdminList()
|
|
|
|
|
},
|
|
|
|
|
{ deep: true },
|
|
|
|
|
)
|
|
|
|
|
|
2025-01-07 10:57:29 +00:00
|
|
|
|
onLoad((options) => {
|
|
|
|
|
console.log(options)
|
|
|
|
|
})
|
|
|
|
|
|
2025-01-13 08:56:13 +00:00
|
|
|
|
onMounted(async () => {
|
2025-01-21 10:43:14 +00:00
|
|
|
|
getGroupAdminList()
|
2025-01-07 10:57:29 +00:00
|
|
|
|
})
|
|
|
|
|
|
2025-01-21 10:43:14 +00:00
|
|
|
|
//加载群聊管理员列表
|
|
|
|
|
const getGroupAdminList = () => {
|
|
|
|
|
if (
|
2025-01-22 08:37:28 +00:00
|
|
|
|
groupParams?.groupInfo?.group_type == 1 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 3
|
2025-01-21 10:43:14 +00:00
|
|
|
|
) {
|
2025-01-22 08:37:28 +00:00
|
|
|
|
if (dialogueParams?.adminList?.length > 0) {
|
|
|
|
|
dialogueParams?.adminList.forEach((item) => {
|
|
|
|
|
if (item?.erp_user_id == userInfo?.value?.ID) {
|
2025-01-21 10:43:14 +00:00
|
|
|
|
item.is_mine = true
|
2025-01-22 08:37:28 +00:00
|
|
|
|
item.cannotRemove = true
|
2025-01-21 10:43:14 +00:00
|
|
|
|
}
|
2025-01-17 05:56:06 +00:00
|
|
|
|
})
|
2025-01-22 08:37:28 +00:00
|
|
|
|
}
|
|
|
|
|
state.groupAdminList = dialogueParams?.adminList
|
|
|
|
|
} else if (
|
|
|
|
|
groupParams?.groupInfo?.group_type == 2 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 4
|
|
|
|
|
) {
|
|
|
|
|
let myPositionsList = []
|
|
|
|
|
if (groupParams?.groupInfo?.groupAdminList?.length > 0) {
|
|
|
|
|
groupParams?.groupInfo?.groupAdminList.forEach((groupAdminItem) => {
|
|
|
|
|
if (userInfo?.value?.PositionUsers?.length > 0) {
|
|
|
|
|
userInfo?.value?.PositionUsers.forEach((item) => {
|
|
|
|
|
// console.log(item.DepartmentId + '-' + item.PositionID)
|
|
|
|
|
if (item.PositionID === groupAdminItem.position_id) {
|
|
|
|
|
myPositionsList.push(groupAdminItem)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
groupParams?.groupInfo?.groupAdminList?.length > 0 &&
|
|
|
|
|
myPositionsList?.length > 0
|
|
|
|
|
) {
|
|
|
|
|
groupParams.groupInfo.groupAdminList.forEach((ele) => {
|
|
|
|
|
myPositionsList.forEach((item) => {
|
|
|
|
|
if (ele.deptPos === item.deptPos) {
|
|
|
|
|
item.is_mine = true
|
|
|
|
|
if (myPositionsList?.length == 1) {
|
|
|
|
|
item.cannotRemove = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
state.groupAdminList = groupParams?.groupInfo?.groupAdminList
|
2025-01-17 05:56:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-07 10:57:29 +00:00
|
|
|
|
//点击跳转到添加禁言成员页面
|
|
|
|
|
const toSelectMembersPage = () => {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/chatSettings/groupManage/selectMembers?manageType=admin',
|
|
|
|
|
})
|
|
|
|
|
}
|
2025-01-21 10:43:14 +00:00
|
|
|
|
|
|
|
|
|
//点击移除群管理员
|
|
|
|
|
const removeGroupAdmin = (adminItem) => {
|
2025-01-22 08:37:28 +00:00
|
|
|
|
if (
|
|
|
|
|
groupParams?.groupInfo?.group_type == 1 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 3
|
|
|
|
|
) {
|
2025-01-21 10:43:14 +00:00
|
|
|
|
let params = {
|
2025-01-22 08:37:28 +00:00
|
|
|
|
mode: 2, //1管理员,2不是管理员
|
|
|
|
|
group_id: dialogueParams.receiverId, //群id
|
|
|
|
|
user_ids: String(adminItem.id),
|
2025-01-21 10:43:14 +00:00
|
|
|
|
}
|
|
|
|
|
console.log(params)
|
2025-01-22 08:37:28 +00:00
|
|
|
|
const resp = ServeGroupAssignAdmin(params)
|
2025-01-21 10:43:14 +00:00
|
|
|
|
resp.then(({ code, data }) => {
|
|
|
|
|
console.log(data)
|
|
|
|
|
if (code == 200) {
|
2025-01-22 08:37:28 +00:00
|
|
|
|
useDialogueStore().updateGroupMembers()
|
2025-01-21 10:43:14 +00:00
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
resp.catch(() => {})
|
2025-01-22 08:37:28 +00:00
|
|
|
|
} else if (
|
|
|
|
|
groupParams?.groupInfo?.group_type == 2 ||
|
|
|
|
|
groupParams?.groupInfo?.group_type == 4
|
|
|
|
|
) {
|
|
|
|
|
let positionInfos = []
|
|
|
|
|
if (state?.groupAdminList?.length > 0) {
|
|
|
|
|
state?.groupAdminList.forEach((item) => {
|
|
|
|
|
if (
|
|
|
|
|
item.dept_id != adminItem.dept_id ||
|
|
|
|
|
item.position_id != adminItem.position_id
|
|
|
|
|
) {
|
|
|
|
|
positionInfos.push({
|
|
|
|
|
position_id: item.position_id,
|
|
|
|
|
position_name: item.deptPos,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
let params = {
|
|
|
|
|
source: 'app',
|
|
|
|
|
id: dialogueParams.receiverId,
|
|
|
|
|
deptInfos: groupParams.groupInfo.deptInfos,
|
|
|
|
|
positionInfos: positionInfos,
|
|
|
|
|
}
|
|
|
|
|
console.log(params)
|
|
|
|
|
const resp = ServeEditGroupAdmin(params)
|
|
|
|
|
resp.then(({ code, data }) => {
|
|
|
|
|
console.log(data)
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
groupStore.ServeGroupDetail()
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
resp.catch(() => {})
|
|
|
|
|
}
|
2025-01-21 10:43:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-07 10:57:29 +00:00
|
|
|
|
</script>
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.outer-layer {
|
|
|
|
|
flex: 1;
|
|
|
|
|
background-image: url('@/static/image/clockIn/z3280@3x.png');
|
|
|
|
|
background-size: cover;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-17 05:56:06 +00:00
|
|
|
|
.manage-group-admin {
|
2025-01-07 10:57:29 +00:00
|
|
|
|
padding: 20rpx 32rpx;
|
2025-01-17 05:56:06 +00:00
|
|
|
|
.manage-group-admin-title {
|
2025-01-07 10:57:29 +00:00
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
color: #959598;
|
|
|
|
|
}
|
2025-01-17 05:56:06 +00:00
|
|
|
|
|
|
|
|
|
.group-admin-list {
|
|
|
|
|
.group-admin-list-each {
|
2025-01-22 08:37:28 +00:00
|
|
|
|
padding: 36rpx 26rpx 36rpx 14rpx;
|
|
|
|
|
margin: 0 18rpx;
|
2025-01-17 05:56:06 +00:00
|
|
|
|
border-bottom: 1px solid $theme-border-color;
|
2025-01-21 10:43:14 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
2025-01-22 08:37:28 +00:00
|
|
|
|
::v-deep .select-member-item {
|
|
|
|
|
padding: 0;
|
|
|
|
|
border-bottom: 0;
|
|
|
|
|
}
|
2025-01-21 10:43:14 +00:00
|
|
|
|
.group-admin-list-each-btns {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-start;
|
2025-01-22 08:37:28 +00:00
|
|
|
|
flex-shrink: 0;
|
2025-01-21 10:43:14 +00:00
|
|
|
|
img {
|
|
|
|
|
width: 52rpx;
|
|
|
|
|
height: 52rpx;
|
|
|
|
|
}
|
|
|
|
|
.group-admin-list-each-btns-each {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
padding: 10rpx 30rpx;
|
|
|
|
|
border: 2rpx solid #eeeeee;
|
|
|
|
|
margin: 0 0 0 20rpx;
|
|
|
|
|
span {
|
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
color: #191919;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-01-17 05:56:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.add-admin-member-btn {
|
2025-01-07 10:57:29 +00:00
|
|
|
|
padding: 32rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
img {
|
|
|
|
|
width: 40rpx;
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
margin: 0 22rpx 0 0;
|
|
|
|
|
}
|
|
|
|
|
span {
|
|
|
|
|
line-height: 40rpx;
|
|
|
|
|
color: $theme-text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.chat-settings-card {
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|