feat: 完成分享、单会话与发布审批改造
- 增加工作流协作分享与知识库卡片分享入口,统一低版本浏览器复制反馈 - Web 新登录替换旧会话,并保持 API Key 会话隔离 - 发布审批增加必填说明并在审批详情展示 - 账号重置与导入改用可配置默认强密码
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
Plus,
|
||||
Promotion,
|
||||
Search,
|
||||
Share,
|
||||
} from '@element-plus/icons-vue';
|
||||
import {
|
||||
ElForm,
|
||||
@@ -43,8 +44,10 @@ import HeaderSearch from '#/components/headerSearch/HeaderSearch.vue';
|
||||
import CardPage from '#/components/page/CardList.vue';
|
||||
import PageData from '#/components/page/PageData.vue';
|
||||
import PageSide from '#/components/page/PageSide.vue';
|
||||
import { copyTextWithFeedback } from '#/utils/clipboard-feedback';
|
||||
import DocumentCollectionModal from '#/views/ai/documentCollection/DocumentCollectionModal.vue';
|
||||
import AiResourceCornerMeta from '#/views/ai/shared/AiResourceCornerMeta.vue';
|
||||
import { confirmPublishSubmission } from '#/views/ai/shared/approval-application-reason';
|
||||
import {
|
||||
buildOfflineImpactMessage,
|
||||
type OfflineImpactCheck,
|
||||
@@ -70,6 +73,7 @@ type VisibilityScope = 'DEPT' | 'PRIVATE' | 'PUBLIC';
|
||||
const canManageKnowledgePermission = computed(() =>
|
||||
hasAccessByCodes(['/api/v1/documentCollection/save']),
|
||||
);
|
||||
const sharingKnowledgeId = ref<null | number | string>(null);
|
||||
const updatingScopeId = ref<null | number | string>(null);
|
||||
const visibilityScopePopoverRefs = ref<Record<string, any>>({});
|
||||
const visibilityScopeMeta = computed(() => ({
|
||||
@@ -140,6 +144,30 @@ function openKnowledgeDetail(row: {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function shareKnowledge(row: Record<string, any>) {
|
||||
if (!row?.id || sharingKnowledgeId.value === row.id) {
|
||||
return;
|
||||
}
|
||||
sharingKnowledgeId.value = row.id;
|
||||
try {
|
||||
const res = await api.post('/api/v1/knowledgeShare/url/create', {
|
||||
knowledgeId: row.id,
|
||||
});
|
||||
const shareUrl = String(res.data?.shareUrl || '').trim();
|
||||
if (res.errorCode !== 0 || !shareUrl) {
|
||||
return;
|
||||
}
|
||||
await copyTextWithFeedback(
|
||||
shareUrl,
|
||||
$t('message.copySuccess'),
|
||||
$t('message.copyFail'),
|
||||
);
|
||||
} finally {
|
||||
sharingKnowledgeId.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
interface FieldDefinition {
|
||||
// 字段名称
|
||||
prop: string;
|
||||
@@ -208,6 +236,20 @@ const actions: ActionButton[] = [
|
||||
submitPublishAction(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: Share,
|
||||
text: $t('button.share'),
|
||||
permission: '/api/v1/documentCollection/save',
|
||||
placement: 'menu',
|
||||
disabled: (row) => sharingKnowledgeId.value === row.id,
|
||||
loading: (row) => sharingKnowledgeId.value === row.id,
|
||||
onClick(row) {
|
||||
if (!ensureManageKnowledgeItem(row)) {
|
||||
return;
|
||||
}
|
||||
shareKnowledge(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: Promotion,
|
||||
text: $t('button.offline'),
|
||||
@@ -251,24 +293,22 @@ const submitPublishAction = async (item: any) => {
|
||||
ElMessage.warning($t('documentCollection.publishPendingHint'));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
isRepublishAction(item)
|
||||
const confirmation = await confirmPublishSubmission({
|
||||
api,
|
||||
confirmMessage: isRepublishAction(item)
|
||||
? $t('documentCollection.submitRepublishApprovalConfirm')
|
||||
: $t('documentCollection.submitPublishApprovalConfirm'),
|
||||
$t('message.noticeTitle'),
|
||||
{
|
||||
confirmButtonText: $t('button.confirm'),
|
||||
cancelButtonText: $t('button.cancel'),
|
||||
type: 'info',
|
||||
},
|
||||
);
|
||||
} catch {
|
||||
id: item.id,
|
||||
resourcePath: '/api/v1/documentCollection',
|
||||
title: $t('message.noticeTitle'),
|
||||
});
|
||||
if (!confirmation) {
|
||||
return;
|
||||
}
|
||||
const res = await api.post(
|
||||
'/api/v1/documentCollection/submitPublishApproval',
|
||||
{
|
||||
applicationReason: confirmation.applicationReason,
|
||||
id: item.id,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { CopyDocument } from '@element-plus/icons-vue';
|
||||
import { ElButton, ElCard, ElIcon, ElInput, ElMessage } from 'element-plus';
|
||||
|
||||
import { api } from '#/api/request';
|
||||
import { copyTextWithFeedback } from '#/utils/clipboard-feedback';
|
||||
|
||||
type EndpointParam = {
|
||||
location: 'body' | 'query';
|
||||
@@ -202,18 +203,15 @@ const copyGeneratedUrl = async () => {
|
||||
ElMessage.warning('请先生成分享链接');
|
||||
return;
|
||||
}
|
||||
await navigator.clipboard.writeText(generatedUrl.value);
|
||||
ElMessage.success('已复制分享链接');
|
||||
await copyTextWithFeedback(generatedUrl.value, '已复制分享链接');
|
||||
};
|
||||
|
||||
const copyApiExample = async (content: string) => {
|
||||
await navigator.clipboard.writeText(content);
|
||||
ElMessage.success('已复制调用示例');
|
||||
await copyTextWithFeedback(content, '已复制调用示例');
|
||||
};
|
||||
|
||||
const copyEndpointUrl = async (url: string) => {
|
||||
await navigator.clipboard.writeText(url);
|
||||
ElMessage.success('已复制接口地址');
|
||||
await copyTextWithFeedback(url, '已复制接口地址');
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user