perf: 支持在团队管理打开群聊

This commit is contained in:
kuaifan 2025-03-01 11:54:20 +08:00
parent 1dd4e8da71
commit 3cafac99ff
5 changed files with 37 additions and 6 deletions

View File

@ -259,6 +259,9 @@ class DialogController extends AbstractController
->where('d.id', $dialog_id)
->whereNull('d.deleted_at')
->first();
if (empty($item)) {
return Base::retError('不在成员列表内');
}
return Base::retSuccess('success', WebSocketDialog::synthesizeData($item, $user->userid));
}

View File

@ -1959,3 +1959,4 @@ API请求的URL路径
获取本地模型列表
任务超期未完成
打开部门群

View File

@ -299,7 +299,7 @@
v-model="allUserShow"
placement="right"
:size="1380">
<TeamManagement v-if="allUserShow"/>
<TeamManagement v-if="allUserShow" @on-close="allUserShow=false"/>
</DrawerOverlay>
<!--查看所有项目-->

View File

@ -31,7 +31,7 @@
<li
v-for="item in departmentList"
:key="item.id"
:class="[`level-${item.level}`, departmentSelect === item.id ? 'active' : '']"
:class="[`level-${item.level}`, departmentSelect === item.id || departmentOperation === item.id ? 'active' : '']"
@click="onSelectDepartment(item.id)">
<UserAvatarTip :userid="item.owner_userid" :size="20" class="department-icon">
<p><strong>{{$L('部门负责人')}}</strong></p>
@ -40,12 +40,16 @@
<EDropdown
size="medium"
trigger="click"
@visible-change="onVcDepartment($event, item.id)"
@command="onOpDepartment">
<i @click.stop="" class="taskfont department-menu">&#xe6e9;</i>
<EDropdownMenu slot="dropdown">
<EDropdownItem v-if="item.level <= 2" :command="`add_${item.id}`">
<div>{{$L('添加子部门')}}</div>
</EDropdownItem>
<EDropdownItem v-if="item.dialog_id" :command="`dialog_${item.dialog_id}`">
<div>{{$L('打开部门群')}}</div>
</EDropdownItem>
<EDropdownItem :command="`edit_${item.id}`">
<div>{{$L('编辑')}}</div>
</EDropdownItem>
@ -795,6 +799,7 @@ export default {
dialog_useid: 0
},
departmentList: [],
departmentOperation: 0,
dialogLoad: false,
dialogList: [],
@ -1259,17 +1264,38 @@ export default {
this.departmentSelect = id
},
onVcDepartment(visible, id) {
this.departmentOperation = visible ? id : 0;
},
onOpDepartment(val) {
if ($A.leftExists(val, 'add_')) {
this.onShowDepartment({
parent_id: parseInt(val.substr(4))
})
} else if ($A.leftExists(val, 'edit_')) {
return
}
if ($A.leftExists(val, 'edit_')) {
const editItem = this.departmentList.find(({id}) => id === parseInt(val.substr(5)))
if (editItem) {
this.onShowDepartment(editItem)
}
} else if ($A.leftExists(val, 'del_')) {
return;
}
if ($A.leftExists(val, 'dialog_')) {
const dialogId = parseInt(val.substr(7))
this.$store.dispatch("openDialog", dialogId).then(() => {
this.goForward({name: 'manage-messenger'})
this.$emit('on-close')
}).catch(({msg}) => {
$A.modalError(msg || this.$L('打开会话失败'))
})
return;
}
if ($A.leftExists(val, 'del_')) {
const delItem = this.departmentList.find(({id}) => id === parseInt(val.substr(4)))
if (delItem) {
$A.modalConfirm({

View File

@ -2919,7 +2919,7 @@ export default {
* @returns {Promise<unknown>}
*/
openDialog({state, dispatch}, dialog_id) {
return new Promise(async resolve => {
return new Promise(async (resolve, reject) => {
let search_msg_id;
let dialog_msg_id;
if ($A.isJson(dialog_id)) {
@ -2933,7 +2933,8 @@ export default {
try {
await dispatch("getDialogOne", dialog_id)
} catch (e) {
console.warn(e);
reject(e);
return;
} finally {
dispatch("hiddenSpinner")
}