From 0b8dd4b86af4cc33e55a7dbf0eb72f93ec15bf05 Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Thu, 14 Aug 2025 18:12:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=89=B9=E9=87=8F=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=88=97=E8=A1=A8=E6=96=B0=E5=A2=9Eid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../check/components/content-card/index.vue | 4 ++-- .../components/upload-manuscript-modal/index.vue | 14 +++++++++++++- .../check/components/content-card/index.vue | 4 ++-- .../components/upload-manuscript-modal/index.vue | 14 +++++++++++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/views/creative-generation-workshop/manuscript-writer/check/components/content-card/index.vue b/src/views/creative-generation-workshop/manuscript-writer/check/components/content-card/index.vue index f563bc1..7a0f169 100644 --- a/src/views/creative-generation-workshop/manuscript-writer/check/components/content-card/index.vue +++ b/src/views/creative-generation-workshop/manuscript-writer/check/components/content-card/index.vue @@ -344,7 +344,7 @@ export default {
- AI 审核建议 + AI 审核建议
@@ -371,7 +371,7 @@ export default {
- AI 审核建议 + AI 审核建议
{aiReview.value?.suggestion?.map((item, index) => ( diff --git a/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue b/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue index af091b3..2cca5f0 100644 --- a/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue +++ b/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue @@ -56,6 +56,15 @@ export default { const form = ref(cloneDeep(INITIAL_FORM)); const works = ref([]); + // 生成自增 id(基于当前列表中最大的 id) + const getNextWorkId = () => { + const currentMax = works.value.reduce((max, item) => { + const numericId = Number(item?.id); + return Number.isFinite(numericId) ? Math.max(max, numericId) : max; + }, 0); + return currentMax + 1; + }; + // 剪贴板功能 const isLink = computed(() => uploadType.value === UPLOAD_TYPE.LINK); @@ -136,7 +145,10 @@ export default { }); if (code === 200) { taskStatus.value = TASK_STATUS.SUCCESS; - data && works.value.push(data); + if (data) { + const id = data.id ?? getNextWorkId(); + works.value.push({ ...data, id }); + } } }; diff --git a/src/views/creative-generation-workshop/manuscript/check/components/content-card/index.vue b/src/views/creative-generation-workshop/manuscript/check/components/content-card/index.vue index 16d274f..bf90496 100644 --- a/src/views/creative-generation-workshop/manuscript/check/components/content-card/index.vue +++ b/src/views/creative-generation-workshop/manuscript/check/components/content-card/index.vue @@ -345,7 +345,7 @@ export default {
- AI 审核建议 + AI 审核建议
@@ -372,7 +372,7 @@ export default {
- AI 审核建议 + AI 审核建议
{aiReview.value?.suggestion?.map((item, index) => ( diff --git a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue index bd86962..c68e592 100644 --- a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue +++ b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue @@ -52,6 +52,15 @@ export default { const form = ref(cloneDeep(INITIAL_FORM)); const works = ref([]); + // 生成自增 id(基于当前列表中最大的 id) + const getNextWorkId = () => { + const currentMax = works.value.reduce((max, item) => { + const numericId = Number(item?.id); + return Number.isFinite(numericId) ? Math.max(max, numericId) : max; + }, 0); + return currentMax + 1; + }; + // 剪贴板功能 const { copy } = useClipboard({ source: form.value.writerLink }); @@ -158,7 +167,10 @@ export default { }); if (code === 200) { taskStatus.value = TASK_STATUS.SUCCESS; - data && works.value.push(data); + if (data) { + const id = data.id ?? getNextWorkId(); + works.value.push({ ...data, id }); + } } };