From 288d4ffddf37ed49f5579bec4f0b0089fe70c3b8 Mon Sep 17 00:00:00 2001 From: lq <121091329@qq.com> Date: Tue, 23 Sep 2025 17:11:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1-=E4=BB=8E?= =?UTF-8?q?=E5=8E=9F=E6=96=99=E5=BA=93=E4=B8=AD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/all/assignment-management.ts | 4 ++ .../components/draw-popup.vue | 63 +++++++++++++++++-- .../components/task-item.vue | 8 +-- .../assignment-management/index.vue | 35 ++++++++--- 4 files changed, 90 insertions(+), 20 deletions(-) diff --git a/src/api/all/assignment-management.ts b/src/api/all/assignment-management.ts index 2d7834f..0fdde3c 100644 --- a/src/api/all/assignment-management.ts +++ b/src/api/all/assignment-management.ts @@ -22,3 +22,7 @@ export const getTaskSchedulesDetail = (id: string) => { console.log('id', id); return Http.get(`/v1/task-schedules/${id}`); }; +//任务管理-手动添加 +export const createTask = (params = {}) => { + return Http.post(`/v1/task-schedules/manual`,params); +}; \ No newline at end of file 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 aa49955..6d173e7 100644 --- a/src/views/property-marketing/assignment-management/components/draw-popup.vue +++ b/src/views/property-marketing/assignment-management/components/draw-popup.vue @@ -6,6 +6,7 @@ placement="right" v-model:visible="showDriwer" @after-visible-change="showDriwerChange" + @ok="handleCreateTask" width="480px" class="task-drawer" style="z-index: 999" @@ -70,8 +71,22 @@ 从原料库添加 -
- +
+
+ {{ item }} +
+
+ +

AI会参考添加的文本、图片、视频等素材,完成符合需求的创作

@@ -206,7 +221,8 @@ const props = defineProps({ // 本地筛选状态(保持上次选择) const localQuery = ref({ - accounts: props.query?.ids || [], + accounts: props.query?.name || [], + ids: props.query?.ids || [], }); // 原料库查询参数 @@ -234,7 +250,7 @@ const selectedMaterials = ref({ data: [], text: '', images: [], - texts: [] + texts: [], }); const selectedProducts = ref({ @@ -276,7 +292,7 @@ const handleMaterialConfirm = (result) => { data: result.selectedData, text: result.choseText, images: result.choseImgArray, - texts: result.selectedTexts || [] + texts: result.selectedTexts || [], }; hasChoseMaterial.value = result.selectedKeys.length > 0; }; @@ -341,14 +357,49 @@ watch(showDriwer, (newVal) => { } }); +// 点击创建任务按钮时触发 +const handleCreateTask = () => { + // 验证表单 + if (isActive.value === 'chose' && selectedProducts.value.keys.length === 0) { + // 可以添加错误提示:请选择发布内容 + console.log('请选择发布内容'); + return; + } + console.log(localQuery.value); + // 准备提交的数据 + const taskData = { + media_account_id: localQuery.value.ids[0], + is_ai_generate: isActive.value == 'chose' ? 0 : 1, + description: taskDescription.value, + raw_material_ids: selectedMaterials.value.keys, + products: selectedProducts.value.keys, + publish_type: publishType.value == 'immediate' ? 0 : 1, + execution_time: + publishType.value === 'timing' ? `${dayjs(currentDate.value).format('YYYY-MM-DD')} ${strValue.value}` : null, + }; + // 发射创建任务事件 + emit('create-task', taskData); + + // 关闭抽屉 + showDriwer.value = false; +}; + // 暴露方法给父组件 -const showDrawer = (accountInfo = null) => { +const showDrawer = (accountInfo = null, selectedDate = null) => { showDriwer.value = true; if (accountInfo && accountInfo.id) { nextTick(() => { localQuery.value.accounts = [accountInfo.name]; + localQuery.value.ids = [accountInfo.id]; }); } + console.log('selectedDate', selectedDate); + // 如果传入了日期,则设置为默认日期 + if (selectedDate) { + currentDate.value = selectedDate; + console.log('currentDate', currentDate.value); + publishType.value = 'timing'; + } }; // 定义事件发射器 diff --git a/src/views/property-marketing/assignment-management/components/task-item.vue b/src/views/property-marketing/assignment-management/components/task-item.vue index 74cdd5d..e5098f9 100644 --- a/src/views/property-marketing/assignment-management/components/task-item.vue +++ b/src/views/property-marketing/assignment-management/components/task-item.vue @@ -2,7 +2,7 @@
-
{{ task?.name || '-' }}
+
{{ task?.name || 'AI生成内容' }}