Merge remote-tracking branch 'origin/main' into feature/0925_优化agent交互
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@vueuse/core": "^9.12.0",
|
"@vueuse/core": "^9.12.0",
|
||||||
"ali-oss": "^6.17.1",
|
"ali-oss": "^6.17.1",
|
||||||
"ant-design-vue": "~4.2.6",
|
"ant-design-vue": "^4.2.6",
|
||||||
"ant-design-x-vue": "^1.3.2",
|
"ant-design-x-vue": "^1.3.2",
|
||||||
"axios": "^1.3.0",
|
"axios": "^1.3.0",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
|
|||||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@ -27,7 +27,7 @@ importers:
|
|||||||
specifier: ^6.17.1
|
specifier: ^6.17.1
|
||||||
version: 6.20.0
|
version: 6.20.0
|
||||||
ant-design-vue:
|
ant-design-vue:
|
||||||
specifier: ~4.2.6
|
specifier: ^4.2.6
|
||||||
version: 4.2.6(vue@3.5.18(typescript@4.9.5))
|
version: 4.2.6(vue@3.5.18(typescript@4.9.5))
|
||||||
ant-design-x-vue:
|
ant-design-x-vue:
|
||||||
specifier: ^1.3.2
|
specifier: ^1.3.2
|
||||||
|
|||||||
@ -37,3 +37,9 @@ export const editTaskSchedulesTime = (id: string, params = {}) => {
|
|||||||
console.log('id', id);
|
console.log('id', id);
|
||||||
return Http.patch(`/v1/task-schedules/${id}/execution-time`, params);
|
return Http.patch(`/v1/task-schedules/${id}/execution-time`, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const getWorkDetail = (id: string) => {
|
||||||
|
console.log('id', id);
|
||||||
|
return Http.get(`/v1/works/${id}`);
|
||||||
|
};
|
||||||
@ -22,9 +22,9 @@
|
|||||||
<span>{{ item.label }}</span>
|
<span>{{ item.label }}</span>
|
||||||
</div>
|
</div>
|
||||||
</Option>
|
</Option>
|
||||||
<template #tag="{ label, icon }">
|
<template #tag="{ label, value }">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<img v-if="icon" :src="icon" class="w-16px h-16px mr-4px rounded-4px" />
|
<img v-if="getIconByValue(value)" :src="getIconByValue(value)" class="w-16px h-16px mr-4px rounded-4px" />
|
||||||
<span>{{ label }}</span>
|
<span>{{ label }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -39,6 +39,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { Select } from 'ant-design-vue';
|
import { Select } from 'ant-design-vue';
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
|
// 自定义搜索过滤逻辑
|
||||||
|
const filterOption = (input, option) => {
|
||||||
|
return option.label.toLowerCase().includes(input.toLowerCase());
|
||||||
|
};
|
||||||
import { ref, watch, computed } from 'vue';
|
import { ref, watch, computed } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -93,9 +98,16 @@ const validOptions = computed(() => {
|
|||||||
...item,
|
...item,
|
||||||
value: item.id !== undefined ? item.id : item.value,
|
value: item.id !== undefined ? item.id : item.value,
|
||||||
label: item.name !== undefined ? item.name : item.label,
|
label: item.name !== undefined ? item.name : item.label,
|
||||||
|
icon: item.icon, // 添加icon属性的映射
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 根据value获取对应的图标
|
||||||
|
const getIconByValue = (value) => {
|
||||||
|
const option = validOptions.value.find(option => option.value === value);
|
||||||
|
return option ? option.icon : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
|
|||||||
@ -7,13 +7,13 @@ import router from './router';
|
|||||||
import store from './stores';
|
import store from './stores';
|
||||||
import * as directives from '@/directives';
|
import * as directives from '@/directives';
|
||||||
|
|
||||||
import VueLazyLoad from "vue-lazyload";
|
import VueLazyLoad from 'vue-lazyload';
|
||||||
import NoData from '@/components/no-data/index.vue';
|
import NoData from '@/components/no-data/index.vue';
|
||||||
import SvgIcon from '@/components/svg-icon/index.vue';
|
import SvgIcon from '@/components/svg-icon/index.vue';
|
||||||
|
|
||||||
import '@/api/index';
|
import '@/api/index';
|
||||||
import './core';
|
import './core';
|
||||||
// import '@arco-design/web-vue/dist/arco.css'; // 已移除 Arco 样式
|
import '@arco-design/web-vue/dist/arco.css'; // 已移除 Arco 样式
|
||||||
|
|
||||||
import 'normalize.css';
|
import 'normalize.css';
|
||||||
import 'uno.css';
|
import 'uno.css';
|
||||||
@ -28,7 +28,6 @@ const app = createApp(App);
|
|||||||
|
|
||||||
app.component('NoData', NoData);
|
app.component('NoData', NoData);
|
||||||
app.component('SvgIcon', SvgIcon);
|
app.component('SvgIcon', SvgIcon);
|
||||||
(Object.keys(directives) as Array<keyof typeof directives>).forEach((k) => app.use(directives[k])); // 注册指令
|
|
||||||
|
|
||||||
app.use(store);
|
app.use(store);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
|||||||
@ -240,7 +240,6 @@ watch(
|
|||||||
dayModel.value = newVal.dayModel || new Date();
|
dayModel.value = newVal.dayModel || new Date();
|
||||||
weekModel.value = newVal.weekModel || new Date();
|
weekModel.value = newVal.weekModel || new Date();
|
||||||
monthModel.value = newVal.monthModel || new Date();
|
monthModel.value = newVal.monthModel || new Date();
|
||||||
emitChange();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
title="创建任务"
|
title="创建任务"
|
||||||
cancel-text="取消"
|
|
||||||
ok-text="创建任务"
|
|
||||||
placement="right"
|
placement="right"
|
||||||
v-model:visible="showDriwer"
|
v-model:visible="showDriwer"
|
||||||
@after-visible-change="showDriwerChange"
|
|
||||||
@ok="handleCreateTask"
|
@ok="handleCreateTask"
|
||||||
width="480px"
|
width="480px"
|
||||||
class="task-drawer"
|
class="task-drawer"
|
||||||
@ -120,7 +117,10 @@
|
|||||||
@click="handleDelte"
|
@click="handleDelte"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-12px">{{ selectedProducts.data[0].title }}</div>
|
<div class="mb-12px" v-if="selectedProducts.data.length > 0">{{ selectedProducts.data[0].title }}</div>
|
||||||
|
<div class="mb-12px color-#939499" v-if="selectedProducts.data.length > 0">
|
||||||
|
{{ selectedProducts.data[0].content }}
|
||||||
|
</div>
|
||||||
<div v-for="item in selectedProducts.images" :key="item.id">
|
<div v-for="item in selectedProducts.images" :key="item.id">
|
||||||
<img v-if="item.cover" :src="item.cover" class="w-88 h-88 mr-8px border-rounded-8px mb-12px" />
|
<img v-if="item.cover" :src="item.cover" class="w-88 h-88 mr-8px border-rounded-8px mb-12px" />
|
||||||
</div>
|
</div>
|
||||||
@ -183,6 +183,16 @@
|
|||||||
@confirm="handleProductConfirm"
|
@confirm="handleProductConfirm"
|
||||||
@cancel="handleProductCancel"
|
@cancel="handleProductCancel"
|
||||||
/>
|
/>
|
||||||
|
<!-- 底部操作栏 -->
|
||||||
|
<template #footer>
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div class="flex items-center"></div>
|
||||||
|
<div class="flex justify-end">
|
||||||
|
<Button @click="handleCancel">取消</Button>
|
||||||
|
<Button class="ml-16px" type="primary" @click="handleCreateTask">创建任务</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -205,6 +215,8 @@ import RawMaterialDrawer from './raw-material-drawer.vue';
|
|||||||
import FinishedProductDrawer from './finished-product-drawer.vue';
|
import FinishedProductDrawer from './finished-product-drawer.vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { getMediaAccountList } from '@/api/all/propertyMarketing';
|
import { getMediaAccountList } from '@/api/all/propertyMarketing';
|
||||||
|
// 导入任务详情API
|
||||||
|
import { getWorkDetail } from '@/api/all/assignment-management';
|
||||||
// 平台图标
|
// 平台图标
|
||||||
import iconDy from '@/assets/img/platform/icon-dy.png';
|
import iconDy from '@/assets/img/platform/icon-dy.png';
|
||||||
import iconXhs from '@/assets/img/platform/icon-xhs.png';
|
import iconXhs from '@/assets/img/platform/icon-xhs.png';
|
||||||
@ -377,19 +389,34 @@ const handleMaterialCancel = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 处理成品库选择确认
|
// 处理成品库选择确认
|
||||||
const handleProductConfirm = (result) => {
|
const handleProductConfirm = async (result) => {
|
||||||
selectedProducts.value = {
|
selectedProducts.value = {
|
||||||
keys: result.selectedKeys,
|
keys: result.selectedKeys,
|
||||||
data: result.selectedData,
|
data: result.selectedData,
|
||||||
text: result.choseText,
|
text: result.choseText,
|
||||||
images: result.choseImgArray,
|
images: result.choseImgArray,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 如果是单选模式,确保只选择一个项目
|
// 如果是单选模式,确保只选择一个项目
|
||||||
if (result.selectedRows && result.selectedRows.length > 0) {
|
if (result.selectedRows && result.selectedRows.length > 0) {
|
||||||
hasChoseFinishedProducts.value = true;
|
hasChoseFinishedProducts.value = true;
|
||||||
// 取第一个选中的项目
|
// 取第一个选中的项目
|
||||||
const selectedProduct = result.selectedRows[0];
|
const selectedProduct = result.selectedRows[0];
|
||||||
|
|
||||||
|
// 获取成品详情
|
||||||
|
try {
|
||||||
|
const res = await getWorkDetail(selectedProduct.id);
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
const workDetail = res.data;
|
||||||
|
selectedProducts.value = {
|
||||||
|
keys: [workDetail.id],
|
||||||
|
data: [workDetail],
|
||||||
|
text: workDetail.title || '1个稿件',
|
||||||
|
images: workDetail.files ? workDetail.files.filter(f => f.type === 0) : [], // 图片文件
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取成品详情失败:', error);
|
||||||
|
// 如果获取详情失败,使用原始数据
|
||||||
selectedProducts.value = {
|
selectedProducts.value = {
|
||||||
keys: [selectedProduct.id],
|
keys: [selectedProduct.id],
|
||||||
data: [selectedProduct],
|
data: [selectedProduct],
|
||||||
@ -397,6 +424,7 @@ const handleProductConfirm = (result) => {
|
|||||||
images: [selectedProduct],
|
images: [selectedProduct],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理成品库取消
|
// 处理成品库取消
|
||||||
@ -415,21 +443,6 @@ const handleDateChange = (date) => {
|
|||||||
// 日期处理逻辑
|
// 日期处理逻辑
|
||||||
};
|
};
|
||||||
|
|
||||||
// 抽屉显示状态变化
|
|
||||||
const showDriwerChange = (visible: boolean) => {
|
|
||||||
console.log('Main Drawer visible: ', visible);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 原料库抽屉显示状态变化
|
|
||||||
const handleMaterialDrawerVisibleChange = (visible: boolean) => {
|
|
||||||
console.log('Raw Material Drawer visible: ', visible);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 成品库抽屉显示状态变化
|
|
||||||
const handleProductDrawerVisibleChange = (visible: boolean) => {
|
|
||||||
console.log('Finished Product Drawer visible: ', visible);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理筛选条件变化
|
// 处理筛选条件变化
|
||||||
const handleChange = (field, value) => {
|
const handleChange = (field, value) => {
|
||||||
localQuery.value[field] = value;
|
localQuery.value[field] = value;
|
||||||
@ -439,6 +452,10 @@ const handleChange = (field, value) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
showDriwer.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
// 点击创建任务按钮时触发
|
// 点击创建任务按钮时触发
|
||||||
const handleCreateTask = () => {
|
const handleCreateTask = () => {
|
||||||
// 验证表单
|
// 验证表单
|
||||||
@ -452,12 +469,6 @@ const handleCreateTask = () => {
|
|||||||
message.error('请选择发布内容');
|
message.error('请选择发布内容');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isActive.value === 'ai' && selectedMaterials.value.keys.length === 0) {
|
|
||||||
// 可以添加错误提示:请选择发布内容
|
|
||||||
message.error('请选择发布内容');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log('有问题已返回');
|
|
||||||
// 准备提交的数据
|
// 准备提交的数据
|
||||||
const taskData = {
|
const taskData = {
|
||||||
media_account_id: localQuery.value.ids[0],
|
media_account_id: localQuery.value.ids[0],
|
||||||
@ -472,7 +483,6 @@ const handleCreateTask = () => {
|
|||||||
};
|
};
|
||||||
// 发射创建任务事件
|
// 发射创建任务事件
|
||||||
emit('create-task', taskData);
|
emit('create-task', taskData);
|
||||||
|
|
||||||
// 关闭抽屉
|
// 关闭抽屉
|
||||||
showDriwer.value = false;
|
showDriwer.value = false;
|
||||||
};
|
};
|
||||||
@ -482,8 +492,35 @@ const showDrawer = (accountInfo = null, selectedDate = null) => {
|
|||||||
showDriwer.value = true;
|
showDriwer.value = true;
|
||||||
if (accountInfo && accountInfo.id) {
|
if (accountInfo && accountInfo.id) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
localQuery.value.accounts = [accountInfo.name];
|
// 查找账号列表中匹配的账号,包含平台信息和图标
|
||||||
|
const matchedAccount = accountList.value.find(account => account.value === accountInfo.id);
|
||||||
|
if (matchedAccount) {
|
||||||
|
localQuery.value.accounts = [matchedAccount.name];
|
||||||
localQuery.value.ids = [accountInfo.id];
|
localQuery.value.ids = [accountInfo.id];
|
||||||
|
} else {
|
||||||
|
// 如果没有找到匹配项,检查账号列表是否已加载
|
||||||
|
if (accountList.value.length > 0) {
|
||||||
|
// 账号列表已加载但未找到匹配项,回退到原来的方式
|
||||||
|
localQuery.value.accounts = [`${accountInfo.name}(${getPlatformName(accountInfo.platform)})`];
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
// 取消监听
|
||||||
|
unwatch();
|
||||||
|
}
|
||||||
|
}, { immediate: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 如果传入了日期,则设置为默认日期
|
// 如果传入了日期,则设置为默认日期
|
||||||
@ -494,12 +531,84 @@ 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 {
|
||||||
|
const res = await getTaskSchedulesDetail(taskData.id);
|
||||||
|
if (res && res.code === 200) {
|
||||||
|
fullTaskData = res.data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取任务详情失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置账号信息
|
||||||
|
if (fullTaskData.media_account) {
|
||||||
|
nextTick(() => {
|
||||||
|
localQuery.value.accounts = [fullTaskData.media_account.name];
|
||||||
|
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) {
|
||||||
|
// 定时发布
|
||||||
|
publishType.value = 'timing';
|
||||||
|
const execTime = new Date(fullTaskData.execution_time * 1000);
|
||||||
|
currentDate.value = execTime;
|
||||||
|
strValue.value = dayjs(execTime).format('HH:mm');
|
||||||
|
} else {
|
||||||
|
// 立即发布
|
||||||
|
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),
|
||||||
|
data: materials,
|
||||||
|
text: '',
|
||||||
|
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;
|
||||||
|
selectedProducts.value = {
|
||||||
|
keys: [work.id],
|
||||||
|
data: [work],
|
||||||
|
text: work.title || '1个稿件',
|
||||||
|
images: work.files ? work.files.filter(f => f.type === 0) : [], // 图片文件
|
||||||
|
};
|
||||||
|
hasChoseFinishedProducts.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 定义事件发射器
|
// 定义事件发射器
|
||||||
const emit = defineEmits(['filter-change', 'create-task']);
|
const emit = defineEmits(['filter-change', 'create-task']);
|
||||||
|
|
||||||
// 暴露方法
|
// 暴露方法
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showDrawer,
|
showDrawer,
|
||||||
|
fillTaskData, // 暴露新的数据回填方法
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
placement="right"
|
placement="right"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
@after-visible-change="onAfterVisibleChange"
|
@after-visible-change="onAfterVisibleChange"
|
||||||
|
@close="handleClose"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
width="904px"
|
width="904px"
|
||||||
class="task-drawer"
|
class="task-drawer"
|
||||||
@ -246,25 +247,18 @@ const getStatus = (status: number) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 抽屉显示状态变化处理
|
// 抽屉关闭事件处理(右上角关闭按钮)
|
||||||
const onAfterVisibleChange = (visible: boolean) => {
|
const handleClose = () => {
|
||||||
emit('after-visible-change', visible);
|
console.log('关闭');
|
||||||
if (visible) {
|
emit('cancel');
|
||||||
// 当抽屉显示时,使用最新参数请求数据
|
emit('update:visible', false);
|
||||||
fetchProductData();
|
|
||||||
} else {
|
|
||||||
// 关闭时清空数据
|
|
||||||
materialData.value = [];
|
|
||||||
selectedRowKeys.value = [];
|
|
||||||
choseText.value = '';
|
|
||||||
choseImgArray.value = [];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消按钮处理
|
// 取消按钮处理
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
console.log('取消');
|
console.log('取消');
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
|
emit('update:visible', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 确定按钮处理
|
// 确定按钮处理
|
||||||
@ -282,6 +276,22 @@ const handleOk = () => {
|
|||||||
});
|
});
|
||||||
emit('update:visible', false);
|
emit('update:visible', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 抽屉显示状态变化处理
|
||||||
|
const onAfterVisibleChange = (visible: boolean) => {
|
||||||
|
emit('after-visible-change', visible);
|
||||||
|
if (visible) {
|
||||||
|
// 当抽屉显示时,使用最新参数请求数据
|
||||||
|
fetchProductData();
|
||||||
|
} else {
|
||||||
|
// 关闭时清空数据
|
||||||
|
materialData.value = [];
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
choseText.value = '';
|
||||||
|
choseImgArray.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-trigger trigger="click" position="br" @click.stop @popup-visible-change="onPopupVisibleChange">
|
<a-trigger
|
||||||
|
trigger="click"
|
||||||
|
position="br"
|
||||||
|
@click.stop
|
||||||
|
@popup-visible-change="onPopupVisibleChange"
|
||||||
|
v-model:popup-visible="popupVisible"
|
||||||
|
>
|
||||||
<div class="task-item">
|
<div class="task-item">
|
||||||
<div class="color-indicator" :style="{ background: getTaskColor() }"></div>
|
<div class="color-indicator" :style="{ background: getTaskColor() }"></div>
|
||||||
<div>{{ timestampToTime(task.execution_time) }}</div>
|
<div>{{ timestampToTime(task.execution_time) }}</div>
|
||||||
@ -31,17 +37,15 @@
|
|||||||
{{ timestampToTime1(task.execution_time) }}
|
{{ timestampToTime1(task.execution_time) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="font-size-14px color-#211F24 color-#211F24 task-description" :title="task.name || 'AI生成内容'">
|
<div class="font-size-14px color-#211F24 color-#211F24 task-description" :title="task.name || 'AI生成内容'">
|
||||||
{{ task.name || 'AI生成内容' }}
|
{{ task.name || 'AI生成内容' }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="task.ai_generate_status == 0" class="AILoding">
|
<div v-if="task.ai_generate_status == 1" class="AILoding">
|
||||||
<ASpin />
|
<ASpin />
|
||||||
<div style="color: #9a56ba">内容生成中...</div>
|
<div style="color: #9a56ba">内容生成中...</div>
|
||||||
<div style="color: #9a56ba">完成后将自动展示,您可先返回其他操作</div>
|
<div style="color: #9a56ba">完成后将自动展示,您可先返回其他操作</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="taskDetail" class="w-full pl-16px">
|
||||||
<div v-else-if="task.ai_generate_status == 1 && taskDetail" class="w-full pl-16px">
|
|
||||||
<div
|
<div
|
||||||
v-for="item in choseTextArray"
|
v-for="item in choseTextArray"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@ -66,28 +70,41 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-col w-full" v-if="task.status != 2">
|
||||||
<div class="flex items-center mt-12px w-full h-1px bg-#E6E6E8"></div>
|
<div class="flex items-center mt-12px w-full h-1px bg-#E6E6E8"></div>
|
||||||
<div class="flex items-center mt-12px mb-16px action-buttons w-full px-16px">
|
<div class="flex items-center mt-12px mb-16px action-buttons w-full px-16px">
|
||||||
<div class="flex items-center mr-12px" @click.stop="handleDelete" v-if="task.status != 1">
|
<div
|
||||||
|
class="flex items-center mr-12px"
|
||||||
|
@click.stop="handleDelete"
|
||||||
|
v-if="task.status == 0 || (task.status == 1 && task.ai_generate_status != 1)"
|
||||||
|
>
|
||||||
<icon-delete style="font-size: 20px; margin-left: 0" />
|
<icon-delete style="font-size: 20px; margin-left: 0" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex w-full" :class="{ 'justify-between': task.ai_generate_status == 0 }">
|
<div
|
||||||
<a-date-picker
|
class="flex w-full"
|
||||||
v-model="datePickerValue"
|
:class="{ 'justify-between': task.ai_generate_status == 0 }"
|
||||||
placeholder="修改发布时间"
|
v-if="task.status == 0"
|
||||||
:show-time="{ format: 'HH:mm' }"
|
>
|
||||||
format="YYYY-MM-DD HH:mm"
|
<button class="opt-btn flex-1" @click.stop="handleEditTask">修改任务</button>
|
||||||
value-format="YYYY-MM-DD HH:mm"
|
<button
|
||||||
@change="onChange"
|
v-if="task.ai_generate_status == 0 && task.status != 3"
|
||||||
@ok="onOk"
|
class="opt-btn ml-12px opt-right"
|
||||||
@click.stop
|
@click.stop="handleAICreate"
|
||||||
@mousedown.stop
|
>
|
||||||
@focus.stop
|
|
||||||
/>
|
|
||||||
<button v-if="task.ai_generate_status == 0" class="opt-btn ml-12px opt-right" @click.stop="handleAICreate">
|
|
||||||
AI立即生成
|
AI立即生成
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex w-full" :class="{ 'justify-between': task.ai_generate_status == 0 }" v-else>
|
||||||
|
<button
|
||||||
|
v-if="task.ai_generate_status == 0 && task.status != 3"
|
||||||
|
class="opt-btn flex-1"
|
||||||
|
@click.stop="handleAICreate"
|
||||||
|
>
|
||||||
|
删除任务
|
||||||
|
</button>
|
||||||
|
<button v-else class="opt-btn flex-1" @click.stop="handleEditTask">修改任务</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -113,17 +130,14 @@ const props = defineProps({
|
|||||||
task: Object,
|
task: Object,
|
||||||
record: Object,
|
record: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
const taskDetail = ref(null);
|
const taskDetail = ref(null);
|
||||||
const choseImgArray = ref([]);
|
const choseImgArray = ref([]);
|
||||||
const choseTextArray = ref([]);
|
const choseTextArray = ref([]);
|
||||||
const choseVideoArray = ref([]);
|
const choseVideoArray = ref([]);
|
||||||
const getTaskDetail = async () => {
|
const getTaskDetail = async () => {
|
||||||
if (!props.task || !props.task.id) return;
|
if (!props.task || !props.task.id) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getTaskSchedulesDetail(props.task.id);
|
const res = await getTaskSchedulesDetail(props.task.id);
|
||||||
|
|
||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
datePickerValue.value = dayjs(res.data.execution_time * 1000);
|
datePickerValue.value = dayjs(res.data.execution_time * 1000);
|
||||||
console.log('任务详情:', datePickerValue.value);
|
console.log('任务详情:', datePickerValue.value);
|
||||||
@ -156,6 +170,7 @@ const onOk = (value) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onPopupVisibleChange = (visible) => {
|
const onPopupVisibleChange = (visible) => {
|
||||||
|
popupVisible.value = visible;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
getTaskDetail();
|
getTaskDetail();
|
||||||
}
|
}
|
||||||
@ -168,21 +183,22 @@ const gotoDetail = () => {
|
|||||||
console.log('跳转详情');
|
console.log('跳转详情');
|
||||||
emit('handle-task', 'goto-detail', props.task, props.record);
|
emit('handle-task', 'goto-detail', props.task, props.record);
|
||||||
};
|
};
|
||||||
const handleTimeChange = (time: string) => {
|
|
||||||
// if (time) {
|
|
||||||
// emit('handle-task', 'edit-time', props.task, timestampToTime1() + ' ' + time + ':00');
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
const handleAICreate = () => {
|
const handleAICreate = () => {
|
||||||
emit('handle-task', 'ai-create', props.task, props.record);
|
emit('handle-task', 'ai-create', props.task, props.record);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleEditTask = () => {
|
||||||
|
// 关闭当前弹窗
|
||||||
|
popupVisible.value = false;
|
||||||
|
emit('handle-task', 'edit-task', props.task, props.record);
|
||||||
|
};
|
||||||
|
|
||||||
const timestampToTime = (timestamp: number): string => {
|
const timestampToTime = (timestamp: number): string => {
|
||||||
// 如果没有传入时间戳,则返回空字符串
|
// 如果没有传入时间戳,则返回空字符串
|
||||||
if (!timestamp) return '';
|
if (!timestamp) return '';
|
||||||
|
|
||||||
// 将时间戳转换为毫秒(如果时间戳是秒单位的话)
|
// 将时间戳转换为毫秒(如果时间戳是秒单位的话)
|
||||||
const date = new Date(timestamp * 1000);
|
const date = new Date(timestamp * 1000);
|
||||||
|
|
||||||
// 格式化为 HH:mm 格式
|
// 格式化为 HH:mm 格式
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
@ -205,6 +221,9 @@ const timestampToTime1 = (timestamp: number): string => {
|
|||||||
|
|
||||||
const emit = defineEmits(['filter-change', 'handle-task']);
|
const emit = defineEmits(['filter-change', 'handle-task']);
|
||||||
|
|
||||||
|
// 添加控制弹窗显示的响应式变量
|
||||||
|
const popupVisible = ref(false);
|
||||||
|
|
||||||
// 日期选择器的值
|
// 日期选择器的值
|
||||||
const datePickerValue = ref(null);
|
const datePickerValue = ref(null);
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="data"
|
:data="data"
|
||||||
:bordered="{ cell: true }"
|
:bordered="{ cell: true }"
|
||||||
:scroll="{ x: 'max-content', y: 600 }"
|
:scroll="{ x: 'max-content' }"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
@change="handleTableChange"
|
@change="handleTableChange"
|
||||||
@ -33,7 +33,7 @@
|
|||||||
>
|
>
|
||||||
<!-- 空数据显示 -->
|
<!-- 空数据显示 -->
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div class="flex flex-col items-center justify-center">
|
<div class="flex flex-col items-center justify-center" style="min-height: 400px">
|
||||||
<img :src="emptyIcon" class="img mt-20px" alt="暂无数据" width="106" height="72" />
|
<img :src="emptyIcon" class="img mt-20px" alt="暂无数据" width="106" height="72" />
|
||||||
<div class="text mt-36px">暂无数据</div>
|
<div class="text mt-36px">暂无数据</div>
|
||||||
<div class="mt-12px mb-12px">可通过账号管理添加账号,进行任务排期管理</div>
|
<div class="mt-12px mb-12px">可通过账号管理添加账号,进行任务排期管理</div>
|
||||||
@ -43,10 +43,10 @@
|
|||||||
|
|
||||||
<!-- 账号与平台列 -->
|
<!-- 账号与平台列 -->
|
||||||
<template #name="{ record }">
|
<template #name="{ record }">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center justify-start">
|
||||||
<img
|
<img
|
||||||
:src="getPlatformIcon(record.platform)"
|
:src="getPlatformIcon(record.platform)"
|
||||||
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px"
|
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px; margin-left: 20px"
|
||||||
:alt="getPlatformName(record.platform)"
|
:alt="getPlatformName(record.platform)"
|
||||||
/>
|
/>
|
||||||
{{ record.name || '-' }}
|
{{ record.name || '-' }}
|
||||||
@ -248,7 +248,6 @@ const processTableData = (apiData: any[]) => {
|
|||||||
|
|
||||||
// 创建任务
|
// 创建任务
|
||||||
const handleAddTask = () => {
|
const handleAddTask = () => {
|
||||||
console.log('handleAddTask');
|
|
||||||
drawerPopupRef.value?.showDrawer();
|
drawerPopupRef.value?.showDrawer();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -473,7 +472,7 @@ const handleCellClick = (record: any, rowIndex: any, column: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('selectedDate', selectedDate);
|
console.log('selectedDate', selectedDate, accountInfo);
|
||||||
drawerPopupRef.value.showDrawer(accountInfo, selectedDate);
|
drawerPopupRef.value.showDrawer(accountInfo, selectedDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -505,6 +504,25 @@ const handleTaskAction = async (action: string, task: any, ...args: any[]) => {
|
|||||||
message.success(res.message);
|
message.success(res.message);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'edit-task':
|
||||||
|
console.log('edit-task', args[0], typeof args[0]);
|
||||||
|
const accountInfo = {
|
||||||
|
id: args[0].id,
|
||||||
|
name: args[0].name,
|
||||||
|
platform: args[0].platform,
|
||||||
|
};
|
||||||
|
const selectedDate = task.execution_time;
|
||||||
|
const date = new Date(selectedDate);
|
||||||
|
|
||||||
|
// 显示抽屉
|
||||||
|
drawerPopupRef.value.showDrawer(accountInfo, date);
|
||||||
|
|
||||||
|
// 等待抽屉打开后再填充数据
|
||||||
|
nextTick(() => {
|
||||||
|
// 将任务信息回填到draw-popup组件
|
||||||
|
drawerPopupRef.value.fillTaskData(task);
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -589,7 +607,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.no-task {
|
.no-task {
|
||||||
height: 30px;
|
min-height: 42px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -623,7 +641,12 @@ onMounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
height: 42px;
|
min-height: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(td .arco-table-cell:first-child) {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(td.today-column) .arco-table-cell-wrap {
|
:deep(td.today-column) .arco-table-cell-wrap {
|
||||||
|
|||||||
Reference in New Issue
Block a user