<template>
|
<a-drawer
|
v-model:open="drawerOpen"
|
:placement="placement"
|
width="68%"
|
:body-style="{ paddingBottom: '80px' }"
|
:footer-style="{ textAlign: 'right' }"
|
@after-open-change="afterOpenChange"
|
@close="drawerClose"
|
>
|
<template #title>
|
<div>
|
<pageHeadLeft
|
:checked="true"
|
:selectAllRow="[{ docCode }]"
|
@nextNum="drawerClose"
|
></pageHeadLeft>
|
</div>
|
</template>
|
<template #extra>
|
<div style="font-size: 16px">
|
共<span class="m-1">{{ props.allList.length }}</span
|
>封
|
<LeftOutlined style="padding: 0 20px" @click="fnPrev" />
|
<RightOutlined @click="fnNext" />
|
</div>
|
</template>
|
<template #footer>
|
<div style="display: flex">
|
<a-textarea autoSize size="large" v-model:value="content" placeholder="快速回复">
|
<template #prefix>
|
<RollbackOutlined style="color: #999" />
|
</template>
|
</a-textarea>
|
<a-button size="large" type="primary" style="margin-left: 10px" @click="fnQuickReply"
|
>发送
|
</a-button>
|
</div>
|
</template>
|
<div class="ct-top" :class="isOpen ? 'isOpenTop' : 'onOpenTop'">
|
<div class="title">
|
<div class="left">
|
<span style="margin-right: 20px; font-size: 24px; font-weight: 700">
|
<a-tooltip placement="bottom">
|
<template #title>
|
<span>{{ tableRowData.subject }}</span>
|
</template>
|
<div :style="{ maxWidth: isOpen ? '300px' : '600px' }" class="text-ellipsis">{{
|
tableRowData.subject
|
}}</div>
|
</a-tooltip>
|
</span>
|
<span style="margin-right: 10px; font-size: 16px">
|
<PushpinOutlined />
|
</span>
|
</div>
|
<div class="right">
|
<div class="tate">{{ formatToDateDay(tableRowData.receiveTime || tableRowData.updateTime) }}</div>
|
<div>
|
<a-dropdown-button>
|
<div v-if="!isDrafts">
|
<span>
|
<a-tooltip placement="bottom">
|
<template #title>
|
<span>回复</span>
|
</template>
|
<LeftOutlined @click="replyEmail(tableRowData, 'reply')" />
|
</a-tooltip>
|
</span>
|
<a-divider type="vertical" />
|
<span>
|
<a-tooltip placement="bottom">
|
<template #title>
|
<span>快速回复</span>
|
</template>
|
<DoubleLeftOutlined />
|
</a-tooltip>
|
</span>
|
</div>
|
<div v-else>
|
<span @click="replyEmail(tableRowData, 'edit')">再次编辑</span>
|
</div>
|
|
<template #overlay>
|
<a-menu>
|
<a-menu-item key="1">
|
<UserOutlined />
|
1st menu item
|
</a-menu-item>
|
<a-menu-item key="2">
|
<UserOutlined />
|
2nd menu item
|
</a-menu-item>
|
<a-menu-item key="3">
|
<UserOutlined />
|
3rd item
|
</a-menu-item>
|
</a-menu>
|
</template>
|
</a-dropdown-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div>
|
<div class="flex-between">
|
<div class="ct-left p-2" :class="isOpen ? 'isOpen' : 'onOpen'">
|
<div class="user p-1 f-z-14" style="margin-top: 40px">
|
<div style="display: flex; align-items: center">
|
<a-avatar size="small" style="margin-right: 8px" src="#" />
|
<div>
|
<span>{{ tableRowData.senderName }} {{ `<${tableRowData.sender}>` }}</span>
|
</div>
|
<span style="margin: 0 10px">发送</span>
|
<a-popover placement="bottom">
|
<template #content>
|
<div
|
class="p-2"
|
style="
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid rgb(5 5 5 / 6%);
|
"
|
>
|
<a-avatar size="small" style="margin-right: 8px" src="#" />
|
<span style="color: #000; font-weight: 700">
|
{{ `${tableRowData.receiver}` }}</span
|
>
|
<CopyOutlined />
|
</div>
|
<div class="display-flex p-2">
|
<a-button type="link" size="small">往来邮件</a-button>
|
</div>
|
</template>
|
<a-avatar size="small" style="margin-right: 8px" src="#" />
|
{{ `${tableRowData.receiver}` }}<span>{{ `<${tableRowData.receiver}>` }}</span>
|
</a-popover>
|
</div>
|
<div type="info" class="p-2 f-z-14" style="margin-top: 10px; background-color: #e4f1ff">
|
<span>{{ `<${tableRowData.sender}>` }}</span>
|
<span>暂未查询到该客户的当地时间</span>
|
<!-- <span>2024-06-08 22:22</span> -->
|
</div>
|
<div class="ct">
|
<div v-if="tableRowData.content">
|
<TinymcePw ref="TinymcePwRef" v-model="tableRowData.content" />
|
</div>
|
</div>
|
</div>
|
</div>
|
<div v-show="isOpen" class="ct-right">
|
<div style="position: relative">
|
<div style="position: absolute; top: 0; left: 10px">
|
<UserTips></UserTips>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div @click="fuToggleContent" class="toggle-btn" :class="isOpen ? 'onIconOpen' : 'iconOpen'">
|
<LeftOutlined v-if="!isOpen" />
|
<RightOutlined v-else />
|
</div>
|
</div>
|
</a-drawer>
|
</template>
|
|
<script lang="ts" setup>
|
name: 'drawerDetail';
|
|
import { ref, watch, defineProps, defineEmits, computed } from 'vue';
|
import {
|
LeftOutlined,
|
RightOutlined,
|
DoubleLeftOutlined,
|
PushpinOutlined,
|
CopyOutlined,
|
UserOutlined,
|
RollbackOutlined,
|
} from '@ant-design/icons-vue';
|
import pageHeadLeft from './pageHeadLeft.vue';
|
import UserTips from '@/views/email/components/userTips/index.vue';
|
import { TinymcePw } from '@/components/Tinymce';
|
import { getMailInfoApi, setQuickReplyAPi } from '@/api/email/userList';
|
import { useCollapseStore } from '@/store/modules/useCollapseStore';
|
import { nextTick } from 'vue';
|
import { formatToDateDay } from '@/utils/dateUtil';
|
import { useLoading } from '@/components/Loading';
|
|
// const [open, close, setTip] = useLoading();
|
// 定义属性
|
interface Props {
|
modelValue: boolean;
|
title?: string;
|
placement?: 'left' | 'right' | 'top' | 'bottom';
|
idName?: string;
|
selectIds?: number[];
|
mailId?: string;
|
selectAllRow: Array<any>;
|
allList;
|
isDrafts?: boolean;
|
}
|
|
const props = defineProps<Props>();
|
|
const tableRowData = ref<Record<string, any>>({});
|
const emit = defineEmits(['update:modelValue', 'updateData']);
|
const drawerOpen = ref(props.modelValue);
|
const TinymcePwRef = ref();
|
const docCode = ref(props.mailId);
|
watch(
|
() => props.mailId,
|
(newVal) => {
|
docCode.value = newVal;
|
},
|
);
|
// 监听属性变化
|
watch(
|
() => props.modelValue,
|
(newValue) => {
|
nextTick(() => {
|
drawerOpen.value = newValue;
|
setTimeout(() => {
|
console.log(newValue, '---------4', TinymcePwRef.value);
|
tableRowData.value.content = tableRowData.value.content;
|
}, 500);
|
});
|
if (newValue) {
|
fnGetMailInfo(props.mailId);
|
}
|
},
|
);
|
|
function fnGetMailInfo(id) {
|
getMailInfoApi({ docCode: id })
|
.then((res) => {
|
nextTick(() => {
|
docCode.value = id;
|
tableRowData.value = res.data;
|
});
|
})
|
.catch(() => {});
|
}
|
// 更新外部属性
|
watch(drawerOpen, (newValue) => {
|
emit('update:modelValue', newValue);
|
});
|
|
// 方法
|
const collapseStore = useCollapseStore();
|
const afterOpenChange = (bool: boolean) => {
|
if (bool) {
|
fnGetUserList({ page: 1, pageSize: 30 });
|
}
|
collapseStore.toggle(false);
|
};
|
const drawerClose = (e) => {
|
drawerOpen.value = false;
|
};
|
|
const fnGetUserList = (params) => {
|
// 调用接口逻辑
|
};
|
|
// 计算属性
|
const placement = computed(() => props.placement || 'right');
|
|
const content = ref('');
|
const isOpen = ref(false);
|
|
function fuToggleContent() {
|
isOpen.value = !isOpen.value;
|
}
|
|
function fnPrev() {
|
const id = getPrevId(props.allList, docCode.value);
|
fnGetMailInfo(id);
|
}
|
function fnNext() {
|
const id = getNextId(props.allList, docCode.value);
|
fnGetMailInfo(id);
|
}
|
function getNextId(list, id) {
|
const index = list.findIndex((item) => item.docCode === id);
|
if (index < list.length - 1) {
|
return list[index + 1].docCode;
|
} else {
|
return list[0].docCode;
|
}
|
}
|
function getPrevId(list, id) {
|
const index = list.findIndex((item) => item.docCode === id);
|
if (index > 0) {
|
return list[index - 1].docCode;
|
} else {
|
return list[list.length - 1].docCode;
|
}
|
}
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
const { createMessage } = useMessage();
|
function fnQuickReply() {
|
if (!content.value) {
|
createMessage.warning('请输入回复内容');
|
return;
|
}
|
const data = {
|
docCode: docCode.value,
|
content: content.value,
|
};
|
setQuickReplyAPi(data).then((res) => {
|
if (res.code == 0) {
|
createMessage.success(res.msg);
|
|
fnGetMailInfo(props.mailId);
|
}
|
});
|
}
|
import { useRouter } from 'vue-router';
|
const router = useRouter();
|
function replyEmail(row, type) {
|
router.push({ path: '/email/edit', query: { docCode: row.docCode, type: type } });
|
}
|
</script>
|
|
<style scoped lang="less">
|
.table-content {
|
display: flex;
|
justify-content: space-between;
|
border-top: 1px solid #f0f0f0;
|
|
.left {
|
width: 80%;
|
height: 100%;
|
border-right: 1px solid #f0f0f0;
|
}
|
|
.right {
|
height: 100%;
|
}
|
}
|
|
::v-deep(.ant-table) {
|
min-height: 355px !important;
|
}
|
|
.title {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
|
& .left {
|
display: flex;
|
align-items: center;
|
width: 50%;
|
}
|
|
& .right {
|
display: flex;
|
flex: 1;
|
align-items: center;
|
justify-content: flex-end;
|
|
& .tate {
|
margin-right: 10px;
|
}
|
}
|
}
|
|
.ct {
|
margin: 20px 0;
|
}
|
|
.flex-between {
|
display: flex;
|
}
|
|
.ct-left {
|
padding-right: 20px;
|
}
|
|
.ct-right {
|
flex: 1;
|
}
|
|
.toggle-btn {
|
display: flex;
|
position: absolute;
|
z-index: 99;
|
top: 50%;
|
width: 20px;
|
height: 54px;
|
padding-left: 5px;
|
transform: translateY(-50%);
|
border: 1px solid #f0f0f0;
|
border-right: none;
|
border-radius: 10px 0 0 10px;
|
background: #fafafa;
|
}
|
|
.onOpen {
|
width: 100%;
|
}
|
|
.isOpen {
|
width: calc(100% - 420px);
|
}
|
|
.onOpenTop {
|
width: 98%;
|
}
|
|
.isOpenTop {
|
width: calc(98% - 460px);
|
}
|
|
.iconOpen {
|
right: 0%;
|
}
|
|
.onIconOpen {
|
right: 425px;
|
}
|
|
.ctb {
|
position: relative;
|
}
|
|
.ct-top {
|
position: absolute;
|
z-index: 99;
|
top: 57px;
|
left: 10px;
|
padding: 10px;
|
background: #fff;
|
}
|
|
.text-ellipsis {
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
|
.f-z-14 {
|
font-size: 12px;
|
}
|
</style>
|