perf: 审批内容禁止转发

This commit is contained in:
Pang 2024-04-17 08:10:08 +08:00
parent 3c93ad18b2
commit 8d39b4aa0d
2 changed files with 21 additions and 4 deletions

View File

@ -993,14 +993,14 @@ class ApproveController extends AbstractController
if ($action == 'withdraw' || $action == 'pass' || $action == 'refuse') { if ($action == 'withdraw' || $action == 'pass' || $action == 'refuse') {
// 任务完成,给发起人发送消息 // 任务完成,给发起人发送消息
if ($type == 'approve_submitter' && $action != 'withdraw') { if ($type == 'approve_submitter' && $action != 'withdraw') {
return WebSocketDialogMsg::sendMsg($msg_action, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true); return WebSocketDialogMsg::sendMsg($msg_action, $dialog->id, 'text', ['text' => $text, 'approve_type' => $type], $botUser->userid, false, false, true);
} }
// 查找最后一条消息msg_id // 查找最后一条消息msg_id
$msg_action = 'change-' . $toUser['msg_id']; $msg_action = 'change-' . $toUser['msg_id'];
} }
// //
try { try {
$msg = WebSocketDialogMsg::sendMsg($msg_action, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true); $msg = WebSocketDialogMsg::sendMsg($msg_action, $dialog->id, 'text', ['text' => $text, 'approve_type' => $type], $botUser->userid, false, false, true);
// 关联信息 // 关联信息
if ($action == 'start') { if ($action == 'start') {
$proc_msg = new ApproveProcMsg(); $proc_msg = new ApproveProcMsg();

View File

@ -298,7 +298,7 @@
<i class="taskfont" v-html="item.icon"></i> <i class="taskfont" v-html="item.icon"></i>
<span>{{ $L(item.label) }}</span> <span>{{ $L(item.label) }}</span>
</li> </li>
<li v-if="operateItem.type !== 'word-chain' && operateItem.type !== 'vote'" @click="onOperate('forward')"> <li v-if="actionPermission(operateItem, 'forward')" @click="onOperate('forward')">
<i class="taskfont">&#xe638;</i> <i class="taskfont">&#xe638;</i>
<span>{{ $L('转发') }}</span> <span>{{ $L('转发') }}</span>
</li> </li>
@ -320,7 +320,7 @@
<i class="taskfont">&#xe61e;</i> <i class="taskfont">&#xe61e;</i>
<span>{{ $L(operateItem.tag ? '取消标注' : '标注') }}</span> <span>{{ $L(operateItem.tag ? '取消标注' : '标注') }}</span>
</li> </li>
<li v-if="operateItem.type === 'text'" @click="onOperate('newTask')"> <li v-if="actionPermission(operateItem, 'newTask')" @click="onOperate('newTask')">
<i class="taskfont">&#xe7b8;</i> <i class="taskfont">&#xe7b8;</i>
<span>{{ $L('新任务') }}</span> <span>{{ $L('新任务') }}</span>
</li> </li>
@ -3437,6 +3437,23 @@ export default {
}) })
}, },
actionPermission(item, permission) {
if (permission === 'forward') {
if (['word-chain', 'vote'].includes(item.type)) {
return false //
}
if (item.type === 'text') {
return typeof item.msg.approve_type === 'undefined' //
}
} else if (permission === 'newTask') {
if (item.type === 'text') {
return typeof item.msg.approve_type === 'undefined' //
}
return false
}
return true // true
},
findOperateFile(msgId, link) { findOperateFile(msgId, link) {
const file = this.fileLinks.find(item => item.link === link) const file = this.fileLinks.find(item => item.link === link)
if (file) { if (file) {