123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- <template>
- <div>
- <div style="padding-left: 20px; display: flex; align-items: center">
- <el-icon @click="handleRefresh" style="cursor: pointer">
- <Refresh />
- </el-icon>
- <!-- <div class="vertical-line"></div>
- <div>
- <el-checkbox
- v-model="isCheckAll"
- label="全选"
- size="default"
- @change="handleChangeCheckAll"
- />
- </div>
- <div style="color: #666666">
- <span
- >(共998封,其中<span style="color: #39c55a"> 未读邮件 </span
- >6封)</span
- >
- </div>
- <el-button
- @click="handleMove"
- :disabled="selectData.length === 0"
- style="margin-left: 10px"
- >全部标为已读</el-button
- >
- <el-select
- v-model="selectTag"
- placeholder="标记为"
- style="margin: 0 10px; width: 120px"
- :disabled="selectData.length === 0"
- >
- <el-option
- v-for="item in tagData"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- />
- </el-select>
- <el-tree-select
- v-model="selectFolder"
- :data="myFolderTreeData"
- :disabled="selectData.length === 0"
- placeholder="移动到"
- style="margin-right: 10px; width: 120px"
- check-strictly
- :render-after-expand="false"
- />
- <el-button @click="handleMove" :disabled="selectData.length === 0"
- >删除</el-button
- > -->
- </div>
- <div style="padding: 10px 15px; width: 100%">
- <el-table
- :data="tableData.data"
- style="width: 100%"
- :height="tableHeight"
- @selection-change="handleSelectionChange"
- v-loading="loading"
- >
- <!-- <el-table-column label=" " width="40" align="center">
- <template #default="{ row, $index }">
- <div>
- <el-checkbox
- v-model="row.isCheck"
- label=""
- size="default"
- @change="handleChangeCheck"
- />
- </div>
- </template>
- </el-table-column> -->
- <el-table-column label="状态" width="70">
- <template #default="{ row, $index }">
- <div style="cursor: pointer" @click="handleRowClick(row, $index)">
- <span v-if="row.flags && !row.flags.includes('6')">
- <img
- src="@/assets/images/mail/message.png"
- alt=""
- title="未读"
- class="messageImg"
- />
- </span>
- <span
- v-if="
- row.flags !== undefined &&
- row.flags !== null &&
- row.flags === ''
- "
- >
- <img
- src="@/assets/images/mail/message.png"
- alt=""
- title="未读"
- class="messageImg"
- />
- </span>
- <span
- v-if="
- row.flags &&
- row.flags.includes('6') &&
- row.flags.includes('1')
- "
- >
- <img
- src="@/assets/images/mail/replied.png"
- alt=""
- title="已回复"
- class="messageImg"
- />
- </span>
- <span v-if="row.flags && row.flags.includes('6')">
- <img
- src="@/assets/images/mail/message-open.png"
- alt=""
- title="已读"
- class="messageImg"
- />
- </span>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="fromPersonalName" label="发件人" width="150">
- <template #default="{ row, $index }">
- <div class="contentClass" @click="handleRowClick(row, $index)">
- {{ row.fromPersonalName }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="fromEmail" label="发件人地址" width="210">
- <template #default="{ row, $index }">
- <el-tooltip
- class="box-item"
- effect="dark"
- :content="row.fromEmail"
- placement="top"
- >
- <div class="contentClass" @click="handleRowClick(row, $index)">
- {{ row.fromEmail }}
- </div>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column prop="subject" label="主题">
- <template #default="{ row, $index }">
- <div class="contentClass" @click="handleRowClick(row, $index)">
- {{ row.subject }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="sendDate" label="时间" width="160">
- <template #default="{ row, $index }">
- <div style="cursor: pointer" @click="handleRowClick(row, $index)">
- {{ row.sendDate }}
- </div>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- style="margin-top: 15px"
- v-model:current-page="tableData.pagination.pageNum"
- v-model:page-size="tableData.pagination.pageSize"
- :page-sizes="[15, 30, 50, 100]"
- layout="sizes, prev, pager, next"
- :total="tableData.pagination.total"
- prev-text="上一页"
- next-text="下一页"
- @current-change="handleCurrentChange"
- @size-change="handleSizeChange"
- />
- </div>
- </div>
- </template>
- <script setup>
- import byTable from "@/components/byTable/index";
- import useMailStore from "@/store/modules/mail";
- import useUserStore from "@/store/modules/user";
- const { proxy } = getCurrentInstance();
- const mailStore = useMailStore();
- let loading = ref(false);
- const tableHeight = ref(0);
- const getTableHeight = () => {
- tableHeight.value = window.innerHeight - 280;
- };
- getTableHeight();
- window.addEventListener("resize", () => {
- getTableHeight();
- });
- const tableData = reactive({
- data: [],
- pagination: {
- pageNum: 1,
- pageSize: 15,
- total: 0,
- },
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "状态",
- slot: "icon",
- width: 70,
- },
- },
- {
- attrs: {
- label: "发件人",
- prop: "fromPersonalName",
- },
- },
- {
- attrs: {
- label: "发件人地址",
- prop: "fromEmail",
- },
- },
- {
- attrs: {
- label: "主题",
- prop: "subject",
- },
- },
- {
- attrs: {
- label: "时间",
- prop: "sendDate",
- },
- },
- ];
- });
- const getList = () => {
- if (mailStore.currentMenu.listPageType === "10") {
- loading.value = true;
- proxy
- .post("/mailService/getMessagePage", {
- ...mailStore.currentMenu,
- ...tableData.pagination,
- })
- .then((res) => {
- tableData.data = res.rows.map((x) => ({ ...x, isCheck: false }));
- mailStore.mailDataList = res.rows.map((x) => ({
- ...x,
- isCheck: false,
- }));
- tableData.pagination.total = res.total;
- loading.value = false;
- });
- } else if (mailStore.currentMenu.listPageType === "20") {
- loading.value = true;
- proxy
- .post("/myFolderMessage/page", {
- myFolderId: mailStore.currentMenu.folderId,
- type: mailStore.selectMail.type,
- ...tableData.pagination,
- })
- .then((res) => {
- tableData.data = res.rows.map((x) => ({
- ...x,
- isCheck: false,
- }));
- mailStore.mailDataList = res.rows.map((x) => ({
- ...x,
- isCheck: false,
- }));
- tableData.pagination.total = res.total;
- loading.value = false;
- });
- } else if (mailStore.currentMenu.listPageType === "30") {
- loading.value = true;
- proxy
- .post("/myTagMessage/page", {
- myTagId: mailStore.currentMenu.folderId,
- type: mailStore.selectMail.type,
- ...tableData.pagination,
- })
- .then((res) => {
- tableData.data = res.rows.map((x) => ({
- ...x,
- isCheck: false,
- }));
- mailStore.mailDataList = res.rows.map((x) => ({
- ...x,
- isCheck: false,
- }));
- tableData.pagination.total = res.total;
- loading.value = false;
- });
- }
- };
- const handleRefresh = () => {
- tableData.pagination = {
- pageNum: 1,
- pageSize: 15,
- };
- // getList();
- };
- const handleRowClick = (row, index) => {
- mailStore.currentMailIndex = index;
- const menu = {
- title: row.subject.slice(0, 4) + "...",
- type: mailStore.selectMail.type,
- messageId: row.id,
- id: "detail" + "," + row.id,
- time: row.sendDate,
- subject: row.subject,
- row: { ...row },
- };
- const menuItem = mailStore.mailMenuList.find((x) => x.id === menu.id);
- if (menuItem === undefined) {
- mailStore.mailMenuList.push(menu);
- }
- mailStore.currentMenu = menu;
- mailStore.currentId = menu.id;
- };
- const init = () => {
- getList();
- };
- const handleCurrentChange = (val) => {
- tableData.pagination.pageNum = val;
- getList();
- };
- const handleSizeChange = (val) => {
- tableData.pagination.pageSize = val;
- getList();
- };
- const myFolderTreeData = ref([]);
- const tagData = ref([]);
- const getOtherData = () => {
- setTimeout(() => {
- proxy
- .post("/myFolder/tree", { mailboxId: mailStore.selectMail.id })
- .then((res) => {
- myFolderTreeData.value = res.map((x) => ({ ...x, value: x.id }));
- });
- }, 1000);
- setTimeout(() => {
- proxy
- .post("/myTag/page", {
- pageNum: 1,
- pageSize: 9999,
- id: useUserStore().user.userId,
- })
- .then((res) => {
- tagData.value = res.rows;
- });
- }, 1000);
- };
- // getOtherData();
- const isCheckAll = ref(false);
- const selectTag = ref("");
- const selectFolder = ref("");
- const selectData = ref([]);
- const handleChangeCheck = () => {
- selectData.value = tableData.data.filter((x) => x.isCheck === true);
- if (selectData.value.length === tableData.data.length) {
- isCheckAll.value = true;
- }
- };
- const handleChangeCheckAll = () => {
- tableData.data.forEach((x) => {
- x.isCheck = isCheckAll.value;
- });
- if (isCheckAll.value) {
- selectData.value = tableData.data;
- } else {
- selectData.value = [];
- }
- };
- defineExpose({
- initFn: init,
- });
- </script>
- <style lang="scss" scoped>
- // * {
- // font-size: 12px;
- // }
- .messageImg {
- width: 18px;
- height: 18px;
- transform: translateY(5px);
- }
- .el-pagination {
- padding-left: 30vw;
- }
- .contentClass {
- cursor: pointer;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .vertical-line {
- width: 2px;
- height: 14px;
- background: #dddddd;
- margin: 0 10px;
- }
- </style>
|