修改任务
This commit is contained in:
@ -12,9 +12,9 @@ export const delTaskSchedules = (id: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 任务管理-修改
|
// 任务管理-修改
|
||||||
export const editTaskSchedules = (id: string) => {
|
export const editTaskSchedules = (id: string, params = {}) => {
|
||||||
console.log('id', id);
|
console.log('id', id);
|
||||||
return Http.put(`/v1/task-schedules/${id}`);
|
return Http.put(`/v1/task-schedules/${id}`,params);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 任务管理-详情
|
// 任务管理-详情
|
||||||
|
|||||||
@ -1,36 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col items-start cell-detail" @click="gotoDetail">
|
<div class="flex flex-col items-start cell-detail">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center" @click="gotoDetail">
|
||||||
<img
|
<img
|
||||||
:src="getPlatformIcon(record.platform)"
|
:src="getPlatformIcon(record.platform)"
|
||||||
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px; font-size: 14px"
|
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px; font-size: 14px"
|
||||||
/>
|
/>
|
||||||
{{ record.name || '-' }}
|
{{ record.name || '-' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="size-12px color-#939499 mt-2px">
|
<div class="size-12px color-#939499 mt-2px" @click="gotoDetail">
|
||||||
{{ timestampToTime1(task.execution_time) }}
|
{{ timestampToTime1(task.execution_time) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="size-14px color-#211F24 mt-12px color-#6D4CFE">{{ task.name || '未命名' }}</div>
|
<div class="size-14px color-#211F24 mt-12px color-#6D4CFE" @click="gotoDetail">{{ task.name || '未命名' }}</div>
|
||||||
<div class="flex items-center mt-12px">
|
<div class="flex items-center mt-12px">
|
||||||
<a-trigger trigger="click" align-point>
|
<div class="custom-time-picker">
|
||||||
<div class="opt-btn" @click.stop="handleEditTime">修改发布时间</div>
|
<a-time-picker
|
||||||
<template #content>
|
format="HH:mm"
|
||||||
<div class="custom-time-picker">
|
size="small"
|
||||||
<!-- 1. 自定义触发按钮(替代原输入框,点击弹出面板) -->
|
:visible="isPanelVisible"
|
||||||
<!-- <button @click="toggleTimePanel" class="trigger-btn">选择时间(点击弹出面板)</button> -->
|
@visible-change="handleVisibleChange"
|
||||||
|
@change="handleTimeChange"
|
||||||
<!-- 2. a-time-picker 核心:隐藏输入框容器,仅保留弹出面板 -->
|
placeholder="修改发布时间"
|
||||||
<a-time-picker
|
class="hide-input-container opt-btn mr-12px"
|
||||||
format="HH:mm"
|
/>
|
||||||
:defaultValue="defaultValue"
|
</div>
|
||||||
:visible="isPanelVisible"
|
|
||||||
@visible-change="handleVisibleChange"
|
|
||||||
@change="handleTimeChange"
|
|
||||||
class="hide-input-container"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</a-trigger>
|
|
||||||
<div class="opt-btn" @click.stop="handleDelete" style="margin-right: 0px">删除</div>
|
<div class="opt-btn" @click.stop="handleDelete" style="margin-right: 0px">删除</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -38,6 +30,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineProps, defineEmits } from 'vue';
|
import { defineProps, defineEmits } from 'vue';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
task: {
|
task: {
|
||||||
@ -60,29 +53,24 @@ const toggleTimePanel = () => {
|
|||||||
const handleVisibleChange = (visible: boolean) => {
|
const handleVisibleChange = (visible: boolean) => {
|
||||||
isPanelVisible.value = visible;
|
isPanelVisible.value = visible;
|
||||||
};
|
};
|
||||||
const handleTimeChange = (time: Date | null) => {
|
const handleTimeChange = (time: string) => {
|
||||||
if (time) {
|
if (time) {
|
||||||
console.log('Selected time:', time);
|
emit('edit-time', props.task, timestampToTime1() + ' ' + time + ':00');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const defaultValue = ref(new Date());
|
|
||||||
const emit = defineEmits(['editTime', 'delete', 'gotoDetail']);
|
|
||||||
|
|
||||||
// 时间戳转时间格式 (MM月DD HH:MM)
|
const timestampToTime1 = (): string => {
|
||||||
const timestampToTime1 = (timestamp: number): string => {
|
const timestamp = Date.now();
|
||||||
const date = new Date(timestamp * 1000); // 假设时间戳是秒级
|
const date = new Date(timestamp);
|
||||||
// 获取月份和日期(注意:月份从0开始,需要+1)
|
|
||||||
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
||||||
const day = date.getDate().toString().padStart(2, '0');
|
|
||||||
const hours = date.getHours().toString().padStart(2, '0');
|
|
||||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
||||||
|
|
||||||
return `${month}月${day} ${hours}:${minutes}`;
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0'); // 补零
|
||||||
|
const day = String(date.getDate()).padStart(2, '0'); // 补零
|
||||||
|
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditTime = () => {
|
const emit = defineEmits(['edit-time', 'delete', 'gotoDetail']);
|
||||||
emit('editTime', props.task);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
emit('delete', props.task);
|
emit('delete', props.task);
|
||||||
|
|||||||
@ -325,17 +325,12 @@
|
|||||||
{{ deleteContent }}
|
{{ deleteContent }}
|
||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<!-- 添加 TimePicker 组件 -->
|
|
||||||
<a-modal v-model:visible="timePickerVisible" @ok="onTimeConfirm" @cancel="onTimeCancel" title="选择时间">
|
|
||||||
<TimePicker />
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, onMounted, watch, computed, nextTick } from 'vue';
|
import { ref, reactive, onMounted, watch, computed, nextTick } from 'vue';
|
||||||
import type { TableColumnData } from '@arco-design/web-vue';
|
import type { TableColumnData } from '@arco-design/web-vue';
|
||||||
import { getTaskSchedules, delTaskSchedules, getTaskSchedulesDetail } from '@/api/all/assignment-management';
|
import { getTaskSchedules, delTaskSchedules, editTaskSchedules } from '@/api/all/assignment-management';
|
||||||
import { fetchAccountOperators, getMediaAccountList } from '@/api/all/propertyMarketing';
|
import { fetchAccountOperators, getMediaAccountList } from '@/api/all/propertyMarketing';
|
||||||
import icon1 from '@/assets/img/platform/icon-dy.png';
|
import icon1 from '@/assets/img/platform/icon-dy.png';
|
||||||
import icon2 from '@/assets/img/platform/icon-xhs.png';
|
import icon2 from '@/assets/img/platform/icon-xhs.png';
|
||||||
@ -477,9 +472,11 @@ const handleCancel = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleAddAccount = () => {};
|
const handleAddAccount = () => {};
|
||||||
const handleModifyTime = (task: any) => {
|
const handleModifyTime = (task: any, time: any) => {
|
||||||
selectedTask.value = task;
|
editTaskSchedules(task.id, { execution_time: time }).then(() => {
|
||||||
timePickerVisible.value = true;
|
handleSearch();
|
||||||
|
timePickerVisible.value = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTimeConfirm = () => {
|
const onTimeConfirm = () => {
|
||||||
@ -492,9 +489,6 @@ const onTimeConfirm = () => {
|
|||||||
timePickerVisible.value = false;
|
timePickerVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTimeCancel = () => {
|
|
||||||
timePickerVisible.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 计算当前日期范围内的所有日期,统一返回 number 数组
|
// 计算当前日期范围内的所有日期,统一返回 number 数组
|
||||||
const currentDateHeaders = computed(() => {
|
const currentDateHeaders = computed(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user