@@ -200,7 +221,7 @@
import { getWorksPage } from '@/api/all/generationWorkshop.ts';
import { ref, reactive, watch, nextTick } from 'vue';
import aiIcon from '@/assets/img/media-account/icon-AI.png';
-import { SwapOutlined, DeleteOutlined } from '@ant-design/icons-vue';
+import { SwapOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons-vue';
import { Button, DatePicker, TimePicker } from 'ant-design-vue';
import { TABS_LIST, ORIGIN_LIST, RawMaterialType } from '@/views/material-center/components/raw-material/constants';
import dayjs from 'dayjs';
@@ -369,6 +390,30 @@ const handleDelte = () => {
images: [],
};
};
+
+// 删除文本项
+const handleDeleteText = (id) => {
+ selectedMaterials.value.texts = selectedMaterials.value.texts.filter((item) => item !== id);
+ selectedMaterials.value.keys = selectedMaterials.value.keys.filter((key) => key !== id);
+
+ // 更新hasChoseMaterial状态
+ updateHasChoseMaterial();
+};
+
+// 删除图片项
+const handleDeleteImage = (id) => {
+ selectedMaterials.value.images = selectedMaterials.value.images.filter((item) => item.id !== id);
+ selectedMaterials.value.keys = selectedMaterials.value.keys.filter((key) => key !== id);
+
+ // 更新hasChoseMaterial状态
+ updateHasChoseMaterial();
+};
+
+// 更新hasChoseMaterial状态
+const updateHasChoseMaterial = () => {
+ hasChoseMaterial.value = selectedMaterials.value.texts.length > 0 || selectedMaterials.value.images.length > 0;
+};
+
// 处理原料库选择确认
const handleMaterialConfirm = (result) => {
console.log('handleMaterialConfirm', result);
@@ -379,6 +424,28 @@ const handleMaterialConfirm = (result) => {
images: result.choseImgArray,
texts: result.selectedTexts || [],
};
+
+ // 为每个文本项添加showDelete属性(如果它们是对象)
+ if (selectedMaterials.value.texts.length > 0 && typeof selectedMaterials.value.texts[0] === 'object') {
+ selectedMaterials.value.texts = selectedMaterials.value.texts.map((text) => ({
+ ...text,
+ showDelete: false,
+ }));
+ } else {
+ // 如果是字符串,则包装成对象
+ selectedMaterials.value.texts = selectedMaterials.value.texts.map((text, index) => ({
+ id: `text_${index}`,
+ name: text,
+ showDelete: false,
+ }));
+ }
+
+ // 为每个图片项添加showDelete属性
+ selectedMaterials.value.images = selectedMaterials.value.images.map((image) => ({
+ ...image,
+ showDelete: false,
+ }));
+
hasChoseMaterial.value = result.selectedKeys.length > 0;
};
@@ -401,7 +468,7 @@ const handleProductConfirm = async (result) => {
hasChoseFinishedProducts.value = true;
// 取第一个选中的项目
const selectedProduct = result.selectedRows[0];
-
+
// 获取成品详情
try {
const res = await getWorkDetail(selectedProduct.id);
@@ -411,7 +478,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 +560,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 +572,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 +606,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 +618,7 @@ const fillTaskData = async (taskData) => {
console.error('获取任务详情失败:', error);
}
}
-
+
// 设置账号信息
if (fullTaskData.media_account) {
nextTick(() => {
@@ -555,15 +626,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 +646,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 +667,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;
}
diff --git a/src/views/property-marketing/assignment-management/index.vue b/src/views/property-marketing/assignment-management/index.vue
index d67b3af..fab1855 100644
--- a/src/views/property-marketing/assignment-management/index.vue
+++ b/src/views/property-marketing/assignment-management/index.vue
@@ -1,10 +1,10 @@
-
+
-
+
-
-
-
+
+
-
-
-
-
![暂无数据]()
-
暂无数据
-
可通过账号管理添加账号,进行任务排期管理
-
去添加
-
-
-
-
-
-
![]()
- {{ record.name || '-' }}
-
-
-
-
-
-
-
-
-
-
-
- 还有{{ record[column.dataIndex].length - 1 }}项
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
![]()
+ {{ record.name || '-' }}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 还有{{ record[column.dataIndex].length - 1 }}项
+
+
+
+
+
+
+
+
+
+
@@ -95,38 +89,48 @@
+
-
- {{ deleteTitle }}
+
{{ deleteContent }}
-
+
+