feat: 完成分享、单会话与发布审批改造

- 增加工作流协作分享与知识库卡片分享入口,统一低版本浏览器复制反馈

- Web 新登录替换旧会话,并保持 API Key 会话隔离

- 发布审批增加必填说明并在审批详情展示

- 账号重置与导入改用可配置默认强密码
This commit is contained in:
2026-07-23 16:09:31 +08:00
parent caa1f07b66
commit 5a42826d44
71 changed files with 3191 additions and 132 deletions

View File

@@ -14,18 +14,20 @@ import {getOptions, sortNodes} from '@easyflow/utils';
import {Tinyflow} from '@tinyflow-ai/vue';
import {ArrowLeft, CircleCheck, Close, Promotion,} from '@element-plus/icons-vue';
import {ElButton, ElDrawer, ElMessage, ElMessageBox, ElSkeleton,} from 'element-plus';
import {ElButton, ElDrawer, ElMessage, ElSkeleton,} from 'element-plus';
import {api} from '#/api/request';
import CommonSelectDataModal from '#/components/commonSelectModal/CommonSelectDataModal.vue';
import {$t} from '#/locales';
import {router} from '#/router';
import { resolveWorkflowShareWorkflowId } from '#/utils/workflow-share-context';
import {getIconByValue} from '#/views/ai/model/modelUtils/defaultIcon';
import {
canAiResourceRepublish,
isAiResourceApprovalPending,
resolveAiResourceDisplayStatus,
} from '#/views/ai/shared/publish-status';
import { confirmPublishSubmission } from '#/views/ai/shared/approval-application-reason';
import ExecResult from '#/views/ai/workflow/components/ExecResult.vue';
import SingleRun from '#/views/ai/workflow/components/SingleRun.vue';
import WorkflowForm from '#/views/ai/workflow/components/WorkflowForm.vue';
@@ -52,6 +54,10 @@ const { isDark } = usePreferences();
// vue
onMounted(async () => {
document.addEventListener('keydown', handleKeydown);
await resolveSharedWorkflowId();
if (!workflowId.value) {
return;
}
await Promise.all([
loadCustomNode(),
getLlmList(),
@@ -88,6 +94,21 @@ const codeEngineList = ref<any[]>([
available: true,
},
]);
async function resolveSharedWorkflowId() {
workflowId.value = await resolveWorkflowShareWorkflowId({
currentWorkflowId: workflowId.value,
shareKey: route.query.shareKey,
resolve: async () => {
const res = await api.get('/api/v1/workflowShare/resolve');
return res.data?.workflowId;
},
onFailure: async () => {
ElMessage.error($t('aiWorkflow.shareExpired'));
await router.replace({ path: '/ai/workflow' });
},
});
}
const WORKFLOW_DRAFT_WRITE_DELAY = 320;
let draftWriteTimer: ReturnType<typeof setTimeout> | undefined;
let pendingDraftContent: any = null;
@@ -372,8 +393,11 @@ async function handleSave(showMsg: boolean = false): Promise<boolean> {
const res = await api.post('/api/v1/workflow/update', {
id: workflowId.value,
content,
revision: workflowInfo.value?.revision ?? 0,
});
if (res.errorCode === 0) {
workflowInfo.value.revision =
res.data?.revision ?? (workflowInfo.value?.revision ?? 0) + 1;
reconcileWorkflowDraftAfterSave(savedContentSignature);
if (showMsg) {
ElMessage.success(res.message);
@@ -640,22 +664,19 @@ async function handlePublishAction() {
ElMessage.warning($t('aiWorkflow.publishPendingHint'));
return;
}
try {
await ElMessageBox.confirm(
canAiResourceRepublish(
const confirmation = await confirmPublishSubmission({
api,
confirmMessage: canAiResourceRepublish(
workflowInfo.value?.displayPublishStatus,
workflowInfo.value?.publishStatus,
)
? $t('aiWorkflow.submitRepublishApprovalConfirm')
: $t('aiWorkflow.submitPublishApprovalConfirm'),
$t('message.noticeTitle'),
{
confirmButtonText: $t('button.confirm'),
cancelButtonText: $t('button.cancel'),
type: 'info',
},
);
} catch {
id: String(workflowId.value),
resourcePath: '/api/v1/workflow',
title: $t('message.noticeTitle'),
});
if (!confirmation) {
return;
}
const saved = await handleSave();
@@ -665,6 +686,7 @@ async function handlePublishAction() {
publishLoading.value = true;
try {
const res = await api.post('/api/v1/workflow/submitPublishApproval', {
applicationReason: confirmation.applicationReason,
id: workflowId.value,
});
if (res.errorCode === 0) {