diff --git a/src/views/property-marketing/assignment-management/components/draw-popup.vue b/src/views/property-marketing/assignment-management/components/draw-popup.vue index c33eec4..8f20763 100644 --- a/src/views/property-marketing/assignment-management/components/draw-popup.vue +++ b/src/views/property-marketing/assignment-management/components/draw-popup.vue @@ -77,13 +77,12 @@ > {{ item }} -
- +
+
+
+ +
+
@@ -118,7 +117,7 @@ />
{{ selectedProducts.data[0].title }}
-
+
{{ selectedProducts.data[0].content }}
@@ -401,7 +400,7 @@ const handleProductConfirm = async (result) => { hasChoseFinishedProducts.value = true; // 取第一个选中的项目 const selectedProduct = result.selectedRows[0]; - + // 获取成品详情 try { const res = await getWorkDetail(selectedProduct.id); @@ -411,7 +410,7 @@ const handleProductConfirm = async (result) => { keys: [workDetail.id], data: [workDetail], text: workDetail.title || '1个稿件', - images: workDetail.files ? workDetail.files.filter(f => f.type === 0) : [], // 图片文件 + images: workDetail.files ? workDetail.files.filter((f) => f.type === 0) : [], // 图片文件 }; } } catch (error) { @@ -493,7 +492,7 @@ const showDrawer = (accountInfo = null, selectedDate = null) => { if (accountInfo && accountInfo.id) { nextTick(() => { // 查找账号列表中匹配的账号,包含平台信息和图标 - const matchedAccount = accountList.value.find(account => account.value === accountInfo.id); + const matchedAccount = accountList.value.find((account) => account.value === accountInfo.id); if (matchedAccount) { localQuery.value.accounts = [matchedAccount.name]; localQuery.value.ids = [accountInfo.id]; @@ -505,20 +504,24 @@ const showDrawer = (accountInfo = null, selectedDate = null) => { localQuery.value.ids = [accountInfo.id]; } else { // 账号列表尚未加载,等待加载完成后再设置 - const unwatch = watch(accountList, (newAccountList) => { - if (newAccountList.length > 0) { - const matched = newAccountList.find(account => account.value === accountInfo.id); - if (matched) { - localQuery.value.accounts = [matched.name]; - localQuery.value.ids = [accountInfo.id]; - } else { - localQuery.value.accounts = [`${accountInfo.name}(${getPlatformName(accountInfo.platform)})`]; - localQuery.value.ids = [accountInfo.id]; + const unwatch = watch( + accountList, + (newAccountList) => { + if (newAccountList.length > 0) { + const matched = newAccountList.find((account) => account.value === accountInfo.id); + if (matched) { + localQuery.value.accounts = [matched.name]; + localQuery.value.ids = [accountInfo.id]; + } else { + localQuery.value.accounts = [`${accountInfo.name}(${getPlatformName(accountInfo.platform)})`]; + localQuery.value.ids = [accountInfo.id]; + } + // 取消监听 + unwatch(); } - // 取消监听 - unwatch(); - } - }, { immediate: true }); + }, + { immediate: true }, + ); } } }); @@ -535,7 +538,7 @@ const showDrawer = (accountInfo = null, selectedDate = null) => { const fillTaskData = async (taskData) => { // 如果传入的数据包含完整信息,则直接使用,否则获取详情 let fullTaskData = taskData; - + // 如果没有work或raw_materials等详细信息,则需要获取完整详情 if ((!taskData.work && !taskData.raw_materials) || taskData.id) { try { @@ -547,7 +550,7 @@ const fillTaskData = async (taskData) => { console.error('获取任务详情失败:', error); } } - + // 设置账号信息 if (fullTaskData.media_account) { nextTick(() => { @@ -555,15 +558,15 @@ const fillTaskData = async (taskData) => { localQuery.value.ids = [fullTaskData.media_account.id]; }); } - + // 设置AI生成或成品库选择 isActive.value = fullTaskData.is_ai_generate ? 'ai' : 'chose'; - + // 设置任务描述(AI生成时) if (fullTaskData.is_ai_generate && fullTaskData.ai_prompt) { taskDescription.value = fullTaskData.ai_prompt; } - + // 设置发布时间 if (fullTaskData.publish_type === 1 && fullTaskData.execution_time) { // 定时发布 @@ -575,20 +578,20 @@ const fillTaskData = async (taskData) => { // 立即发布 publishType.value = 'immediate'; } - + // 设置选中的素材(AI生成时) if (fullTaskData.is_ai_generate && fullTaskData.raw_materials && fullTaskData.raw_materials.length > 0) { const materials = fullTaskData.raw_materials; selectedMaterials.value = { - keys: materials.map(m => m.id), + keys: materials.map((m) => m.id), data: materials, text: '', - images: materials.filter(m => m.type === 0), // 图片 - texts: materials.filter(m => m.type === 2), // 文本 + images: materials.filter((m) => m.type === 0), // 图片 + texts: materials.filter((m) => m.type === 2), // 文本 }; hasChoseMaterial.value = materials.length > 0; } - + // 设置选中的成品(成品库选择时) if (!fullTaskData.is_ai_generate && fullTaskData.work) { const work = fullTaskData.work; @@ -596,7 +599,7 @@ const fillTaskData = async (taskData) => { keys: [work.id], data: [work], text: work.title || '1个稿件', - images: work.files ? work.files.filter(f => f.type === 0) : [], // 图片文件 + images: work.files ? work.files.filter((f) => f.type === 0) : [], // 图片文件 }; hasChoseFinishedProducts.value = true; }