ykt-wxapp/components/manage-plan/plan-node-item.vue

114 lines
2.6 KiB
Vue
Raw Normal View History

2026-01-26 15:39:14 +08:00
<template>
<view class="card" :class="classnames">
<view class="block">
<view class="label">待办类型</view>
<view class="value">{{ getTodoEventTypeLabel(item?.eventType) }}</view>
</view>
<view class="block">
<view class="label">任务内容</view>
<view
v-if="item?.taskContent"
class="value"
:class="{ clamp2: foldContent }"
@click="foldContent = !foldContent"
>
{{ item.taskContent }}
</view>
<view v-else class="value muted">暂无内容</view>
</view>
<view class="block">
<view class="label">向客户发送</view>
<view
v-if="item?.sendContent"
class="send"
:class="{ clamp1: foldSendContent }"
@click="foldSendContent = !foldSendContent"
>
<text class="muted">提醒</text>
<text>{{ item.sendContent }}</text>
</view>
<view v-if="sendFile" class="send">
<text class="muted">{{ sendFile.fileLabel }}</text>
<text class="link">{{ sendFile.name }}</text>
</view>
<view v-if="!item?.sendContent && !sendFile" class="send muted">暂无发送内容</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue';
import { getTodoEventTypeLabel } from '@/utils/todo-const';
const props = defineProps({
item: { type: Object, default: () => ({}) },
classnames: { type: String, default: '' },
});
const foldContent = ref(true);
const foldSendContent = ref(true);
const sendFile = computed(() => {
const file = props.item?.pannedEventSendFile;
if (!file || typeof file !== 'object') return null;
if (file.type === 'questionnaire' || file.type === 'article') {
return {
...file,
fileLabel: file.type === 'questionnaire' ? '问卷' : '文章',
name: String(file.name || file.title || file.url || ''),
};
}
return null;
});
</script>
<style scoped>
.card {
font-size: 28rpx;
background: #fff;
border-radius: 16rpx;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
}
.block {
padding: 20rpx;
border-bottom: 1px solid #eef0f2;
}
.block:last-child {
border-bottom: none;
}
.label {
margin-bottom: 20rpx;
color: #6b7280;
}
.value {
color: #111827;
line-height: 44rpx;
word-break: break-all;
}
.send {
margin-top: 20rpx;
color: #111827;
line-height: 44rpx;
word-break: break-all;
}
.muted {
color: #9ca3af;
}
.link {
color: #4f6ef7;
}
.clamp2 {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.clamp1 {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
</style>