2024-11-21 16:29:40 +08:00
|
|
|
<script setup lang="ts">
|
2024-12-12 16:07:42 +08:00
|
|
|
import type { TaskInfo } from '#/api/workflow/task/model';
|
|
|
|
|
|
|
|
import { VbenAvatar } from '@vben/common-ui';
|
|
|
|
import { DictEnum } from '@vben/constants';
|
|
|
|
|
|
|
|
import { Descriptions, DescriptionsItem } from 'ant-design-vue';
|
|
|
|
|
|
|
|
import { renderDict } from '#/utils/render';
|
|
|
|
|
|
|
|
interface Props extends TaskInfo {
|
2024-11-21 19:21:20 +08:00
|
|
|
active: boolean;
|
2024-11-21 16:29:40 +08:00
|
|
|
}
|
|
|
|
|
2024-12-18 14:10:50 +08:00
|
|
|
const props = withDefaults(defineProps<{ info: Props; rowKey?: string }>(), {
|
|
|
|
rowKey: 'id',
|
|
|
|
});
|
2024-11-21 19:21:20 +08:00
|
|
|
|
|
|
|
const emit = defineEmits<{ click: [string] }>();
|
|
|
|
|
2024-12-18 14:10:50 +08:00
|
|
|
/**
|
|
|
|
* TODO: 这里要优化 事件没有用到
|
|
|
|
*/
|
2024-11-21 19:21:20 +08:00
|
|
|
function handleClick() {
|
2024-12-18 14:10:50 +08:00
|
|
|
console.log('click');
|
|
|
|
const idKey = props.rowKey as keyof TaskInfo;
|
|
|
|
emit('click', props.info[idKey]);
|
2024-11-21 19:21:20 +08:00
|
|
|
}
|
2024-11-21 16:29:40 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
2024-11-21 19:53:16 +08:00
|
|
|
:class="{
|
|
|
|
'border-primary': info.active,
|
|
|
|
'border-[2px]': info.active,
|
|
|
|
}"
|
|
|
|
class="cursor-pointer rounded-lg border-[1px] border-solid p-3 transition-shadow duration-300 ease-in-out hover:shadow-lg"
|
2024-11-21 19:21:20 +08:00
|
|
|
@click.stop="handleClick"
|
2024-11-21 16:29:40 +08:00
|
|
|
>
|
2024-12-12 16:07:42 +08:00
|
|
|
<Descriptions :column="1" :title="info.flowName" size="middle">
|
2024-11-21 16:29:40 +08:00
|
|
|
<template #extra>
|
2024-12-12 16:07:42 +08:00
|
|
|
<component
|
|
|
|
:is="renderDict(info.flowStatus, DictEnum.WF_BUSINESS_STATUS)"
|
|
|
|
/>
|
2024-11-21 16:29:40 +08:00
|
|
|
</template>
|
2024-12-19 08:22:14 +08:00
|
|
|
<DescriptionsItem label="当前任务名称">
|
2024-12-12 16:07:42 +08:00
|
|
|
<div class="font-bold">{{ info.nodeName }}</div>
|
|
|
|
</DescriptionsItem>
|
|
|
|
<DescriptionsItem label="开始时间">
|
|
|
|
{{ info.createTime }}
|
|
|
|
</DescriptionsItem>
|
|
|
|
<!-- <DescriptionsItem label="更新时间">
|
|
|
|
{{ info.updateTime }}
|
|
|
|
</DescriptionsItem> -->
|
2024-11-21 16:29:40 +08:00
|
|
|
</Descriptions>
|
2024-12-18 17:01:02 +08:00
|
|
|
<div class="flex w-full items-center justify-between text-[14px]">
|
|
|
|
<div class="flex items-center gap-1 overflow-hidden whitespace-nowrap">
|
2024-12-16 17:23:05 +08:00
|
|
|
<VbenAvatar
|
|
|
|
:alt="info.createByName"
|
2024-12-18 13:38:42 +08:00
|
|
|
class="bg-primary size-[24px] rounded-full text-[10px] text-white"
|
2024-12-16 17:23:05 +08:00
|
|
|
src=""
|
|
|
|
/>
|
2024-12-18 17:01:02 +08:00
|
|
|
<span class="overflow-hidden text-ellipsis opacity-50">
|
|
|
|
{{ info.createByName }}
|
|
|
|
</span>
|
2024-11-21 16:29:40 +08:00
|
|
|
</div>
|
2024-12-18 17:01:02 +08:00
|
|
|
<div class="text-nowrap opacity-50">{{ info.updateTime }}更新</div>
|
2024-11-21 16:29:40 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
:deep(.ant-descriptions .ant-descriptions-header) {
|
|
|
|
margin-bottom: 12px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
:deep(.ant-descriptions-item) {
|
|
|
|
padding-bottom: 8px !important;
|
|
|
|
}
|
|
|
|
</style>
|