修改发布时间
This commit is contained in:
@ -31,3 +31,9 @@ export const createTask = (params = {}) => {
|
||||
export const generateContent = (id: string) => {
|
||||
return Http.post(`/v1/task-schedules/${id}/generate-content`);
|
||||
};
|
||||
|
||||
// 任务管理-修改
|
||||
export const editTaskSchedulesTime = (id: string, params = {}) => {
|
||||
console.log('id', id);
|
||||
return Http.patch(`/v1/task-schedules/${id}/execution-time`, params);
|
||||
};
|
||||
|
||||
@ -35,13 +35,13 @@
|
||||
<div class="font-size-14px color-#211F24 color-#211F24 task-description" :title="task.name || 'AI生成内容'">
|
||||
{{ task.name || 'AI生成内容' }}
|
||||
</div>
|
||||
<div v-if="task.ai_generate_status == 1" class="AILoding">
|
||||
<div v-if="task.ai_generate_status == 0" class="AILoding">
|
||||
<ASpin />
|
||||
<div style="color: #9a56ba">内容生成中...</div>
|
||||
<div style="color: #9a56ba">完成后将自动展示,您可先返回其他操作</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="task.ai_generate_status == 0 && taskDetail" class="w-full pl-16px">
|
||||
<div v-else-if="task.ai_generate_status == 1 && taskDetail" class="w-full pl-16px">
|
||||
<div
|
||||
v-for="item in choseTextArray"
|
||||
:key="item.id"
|
||||
@ -67,12 +67,30 @@
|
||||
</div>
|
||||
</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">
|
||||
<div class="flex items-center mr-12px" @click.stop="handleDelete">
|
||||
<icon-delete style="font-size: 20px; margin-left: 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">
|
||||
<icon-delete style="font-size: 20px; margin-left: 0" />
|
||||
</div>
|
||||
<div class="flex w-full" :class="{ 'justify-between': task.ai_generate_status == 0 }">
|
||||
<!-- <button class="opt-btn" :class="{ 'flex-1': task.ai_generate_status != 0 }" @click.stop="handleTimeChange">
|
||||
修改发布时间
|
||||
</button> -->
|
||||
<a-date-picker
|
||||
v-model="datePickerValue"
|
||||
placeholder="修改发布时间"
|
||||
show-time
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm"
|
||||
@change="onChange"
|
||||
@ok="onOk"
|
||||
@click.stop
|
||||
@mousedown.stop
|
||||
@focus.stop
|
||||
/>
|
||||
<button v-if="task.ai_generate_status == 0" class="opt-btn ml-12px opt-right" @click.stop="handleAICreate">
|
||||
AI立即生成
|
||||
</button>
|
||||
</div>
|
||||
<button class="opt-btn" @click.stop="handleTimeChange">修改发布时间</button>
|
||||
<button class="opt-btn ml-12px opt-right mr-16px" @click.stop="handleAICreate">AI立即生成</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -82,6 +100,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { Spin as ASpin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import iconDy from '@/assets/img/platform/icon-dy.png';
|
||||
import iconXhs from '@/assets/img/platform/icon-xhs.png';
|
||||
import iconBilibili from '@/assets/img/platform/icon-bilibili.png';
|
||||
@ -91,6 +110,7 @@ import iconWb from '@/assets/img/platform/icon-wb.png';
|
||||
import iconGzh from '@/assets/img/platform/icon-gzh.png';
|
||||
import iconWarn from '@/assets/img/media-account/icon-warn.png';
|
||||
import { getTaskSchedulesDetail } from '@/api/all/assignment-management';
|
||||
import { DatePicker } from '@arco-design/web-vue';
|
||||
// 定义props和emit
|
||||
const props = defineProps({
|
||||
task: Object,
|
||||
@ -106,19 +126,20 @@ const getTaskDetail = async () => {
|
||||
|
||||
try {
|
||||
const res = await getTaskSchedulesDetail(props.task.id);
|
||||
|
||||
if (res && res.data) {
|
||||
if (res.data.type == 1) {
|
||||
datePickerValue.value = dayjs(res.data.execution_time * 1000);
|
||||
console.log('任务详情:', datePickerValue.value);
|
||||
if ('work' in res.data && res.data.work) {
|
||||
taskDetail.value = res.data.work;
|
||||
choseImgArray.value = res.data.work.files.filter((item) => [0].includes(item.type));
|
||||
choseTextArray.value = res.data.work.files.filter((item) => [2].includes(item.type));
|
||||
choseVideoArray.value = res.data.work.files.filter((item) => [1].includes(item.type));
|
||||
} else {
|
||||
taskDetail.value = res.data.raw_materials;
|
||||
console.log('任务详情:', res.data, taskDetail.value);
|
||||
choseImgArray.value = taskDetail.value.filter((item) => [0].includes(item.type));
|
||||
choseTextArray.value = taskDetail.value.filter((item) => [2].includes(item.type));
|
||||
choseVideoArray.value = taskDetail.value.filter((item) => [1].includes(item.type));
|
||||
console.log('任务详情:', choseImgArray.value, choseTextArray.value);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -126,6 +147,17 @@ const getTaskDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const onChange = (date, dateString) => {
|
||||
console.log('Selected Date: ', date, dateString);
|
||||
};
|
||||
|
||||
const onOk = (value) => {
|
||||
if (value) {
|
||||
console.log('DatePicker OK: ', value);
|
||||
emit('handle-task', 'edit-time', props.task, value);
|
||||
}
|
||||
};
|
||||
|
||||
const onPopupVisibleChange = (visible) => {
|
||||
if (visible) {
|
||||
getTaskDetail();
|
||||
@ -139,11 +171,7 @@ const gotoDetail = () => {
|
||||
console.log('跳转详情');
|
||||
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 = () => {
|
||||
emit('handle-task', 'ai-create', props.task, props.record);
|
||||
};
|
||||
@ -160,10 +188,13 @@ const timestampToTime = (timestamp: number): string => {
|
||||
|
||||
return `${hours}:${minutes}`;
|
||||
};
|
||||
const timestampToTime1 = (): string => {
|
||||
const timestamp = Date.now();
|
||||
const date = new Date(timestamp);
|
||||
const timestampToTime1 = (timestamp: number): string => {
|
||||
// 如果没有传入时间戳,则使用当前时间
|
||||
if (!timestamp) {
|
||||
timestamp = Date.now() / 1000; // 使用秒级时间戳保持一致性
|
||||
}
|
||||
|
||||
const date = new Date(timestamp * 1000);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 补零
|
||||
const day = String(date.getDate()).padStart(2, '0'); // 补零
|
||||
@ -173,6 +204,9 @@ const timestampToTime1 = (): string => {
|
||||
|
||||
const emit = defineEmits(['filter-change', 'handle-task']);
|
||||
|
||||
// 日期选择器的值
|
||||
const datePickerValue = ref('2025-09-25 16:18');
|
||||
|
||||
// 平台配置
|
||||
const platformConfig = {
|
||||
icons: {
|
||||
|
||||
@ -131,7 +131,7 @@ import TaskItem from './components/task-item.vue';
|
||||
import {
|
||||
getTaskSchedules,
|
||||
delTaskSchedules,
|
||||
editTaskSchedules,
|
||||
editTaskSchedulesTime,
|
||||
createTask,
|
||||
generateContent,
|
||||
} from '@/api/all/assignment-management';
|
||||
@ -370,7 +370,9 @@ const handleSearch = () => {
|
||||
.then((response) => {
|
||||
if (response.data) {
|
||||
const apiData = response.data.data || response.data;
|
||||
if (apiData) {
|
||||
data.value = processTableData(apiData);
|
||||
}
|
||||
pageInfo.value.total = response.data.total || apiData.length;
|
||||
}
|
||||
})
|
||||
@ -487,7 +489,13 @@ const handleTaskAction = async (action: string, task: any, ...args: any[]) => {
|
||||
showModal.value = true;
|
||||
break;
|
||||
case 'edit-time':
|
||||
editTaskSchedules(task.id, { execution_time: args[0] }).then(() => handleSearch());
|
||||
console.log('handleTaskAction edit-time', task, args);
|
||||
editTaskSchedulesTime(task.id, { execution_time: args[0] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
message.success(res.message);
|
||||
handleSearch();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'goto-detail':
|
||||
router.push(`/media-account/management-detail/${task.id}`);
|
||||
@ -495,7 +503,7 @@ const handleTaskAction = async (action: string, task: any, ...args: any[]) => {
|
||||
case 'ai-create':
|
||||
const res = await generateContent(task.id);
|
||||
if (res.code === 200) {
|
||||
message.success(res.data.message);
|
||||
message.success(res.message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user