Files
lingji-work-fe/src/views/property-marketing/assignment-management/components/task-item.vue

67 lines
1.7 KiB
Vue
Raw Normal View History

2025-09-18 14:40:47 +08:00
<template>
2025-09-19 16:08:00 +08:00
<a-trigger trigger="click" position="br">
<div class="task-item" @click="handleTask(task, record)">
<div class="w-4px h-18px rounded-2px" :style="{ background: getTaskColor() }"></div>
<div>{{ task?.name || '-' }}</div>
</div>
<template #content>
<div
class="flex flex-col items-start"
style="background-color: #fff; padding: 12px; box-shadow: #00000010 0px 2px 8px; border-radius: 4px"
></div>
</template>
</a-trigger>
2025-09-19 10:34:26 +08:00
</template>
<script setup lang="ts">
2025-09-19 15:53:12 +08:00
// 定义props和emit
const props = defineProps({
task: Object,
record: Object,
});
2025-09-19 16:08:00 +08:00
// 时间戳转时间格式 (HH:MM)
const timestampToTime = (timestamp: number): string => {
const date = new Date(timestamp * 1000); // 假设时间戳是秒级
// 获取小时和分钟
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
2025-09-19 10:34:26 +08:00
2025-09-19 16:08:00 +08:00
return `${hours}:${minutes}`;
2025-09-19 15:53:12 +08:00
};
2025-09-19 16:08:00 +08:00
const emit = defineEmits(['filter-change', 'handle-task']);
const handleTask = (task, record) => {};
2025-09-19 15:53:12 +08:00
// 根据任务类型获取颜色
const getTaskColor = () => {
if (!props.task) return '#000';
// 根据colorTip.vue中的颜色定义设置不同状态的颜色
switch (props.task.status) {
case 0: // 待生成
return '#ffae00';
case 1: // 待发布
return '#6d4cfe';
case 2: // 已发布
return '#939499';
case 3: // 发布失败
return '#f64b31';
default:
return props.task.color || '#939499';
}
};
2025-09-19 10:34:26 +08:00
</script>
<style lang="less" scoped>
.task-item {
width: 100%;
2025-09-19 15:53:12 +08:00
font-size: 12px;
height: 19px;
display: flex;
align-items: center;
gap: 4px;
&:last-child {
margin-bottom: 0;
}
2025-09-19 10:34:26 +08:00
}
</style>