删除任务
This commit is contained in:
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<div class="flex flex-col items-start cell-detail">
|
||||
<div class="flex items-center">
|
||||
<img
|
||||
:src="getPlatformIcon(record.platform)"
|
||||
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px; font-size: 14px"
|
||||
/>
|
||||
{{ record.name || '-' }}
|
||||
</div>
|
||||
<div class="size-12px color-#939499 mt-2px">
|
||||
{{ timestampToTime1(task.execution_time) }}
|
||||
</div>
|
||||
<div class="size-14px color-#211F24 mt-12px">{{ task.name || '未命名' }}</div>
|
||||
<div class="flex items-center mt-12px">
|
||||
<div class="opt-btn" @click.stop="handleEditTime">修改发布时间</div>
|
||||
<div class="opt-btn" @click.stop="handleDelete" style="margin-right: 0px">删除</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineProps, defineEmits } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
task: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
record: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
getPlatformIcon: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['editTime', 'delete']);
|
||||
|
||||
// 时间戳转时间格式 (MM月DD HH:MM)
|
||||
const timestampToTime1 = (timestamp: number): string => {
|
||||
const date = new Date(timestamp * 1000); // 假设时间戳是秒级
|
||||
// 获取月份和日期(注意:月份从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 handleEditTime = () => {
|
||||
emit('editTime', props.task);
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
emit('delete', props.task);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cell-detail {
|
||||
background-color: #fff;
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 4px;
|
||||
box-shadow: #00000010 0px 2px 8px;
|
||||
padding: 8px 16px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.opt-btn {
|
||||
font-size: 12px;
|
||||
width: 138px;
|
||||
height: 28px;
|
||||
background-color: #f2f3f5;
|
||||
text-align: center;
|
||||
line-height: 28px;
|
||||
border-radius: 4px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user