123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <div>
- <div style="padding-left: 20px">
- <el-icon @click="handleRefresh" style="cursor: pointer">
- <Refresh />
- </el-icon>
- </div>
- <div style="padding: 10px 15px; width: 100%">
- <el-table
- :data="tableData.data"
- style="width: 100%"
- :height="tableHeight"
- v-loading="loading"
- >
- <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 style="cursor: pointer" @click="handleRowClick(row, $index)">
- {{ row.fromPersonalName }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="fromEmail" label="发件人地址" width="210">
- <template #default="{ row, $index }">
- <div style="cursor: pointer" @click="handleRowClick(row, $index)">
- {{ row.fromEmail }}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="subject" label="主题">
- <template #default="{ row, $index }">
- <div style="cursor: pointer" @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>
- <!-- <byTable
- :source="tableData.data"
- :pagination="tableData.pagination"
- :config="config"
- :loading="loading"
- :hideSearch="true"
- highlight-current-row
- :action-list="[]"
- :table-events="{
- //element talbe事件都能传
- 'row-click': handleRowClick,
- }"
- @get-list="getList"
- >
- <template #icon="{ item }">
- <div>
- <span v-if="!item.flags.includes('6')">
- <img
- src="@/assets/images/mail/message.png"
- alt=""
- title="未读"
- class="messageImg"
- />
- </span>
- <span v-if="item.flags.includes('6') && item.flags.includes('1')">
- <img
- src="@/assets/images/mail/replied.png"
- alt=""
- title="已回复"
- class="messageImg"
- />
- </span>
- <span v-if="item.flags.includes('6')">
- <img
- src="@/assets/images/mail/message-open.png"
- alt=""
- title="已读"
- class="messageImg"
- />
- </span>
- </div>
- </template>
- </byTable> -->
- </div>
- </template>
- <script setup>
- import byTable from "@/components/byTable/index";
- import useMailStore from "@/store/modules/mail";
- const { proxy } = getCurrentInstance();
- const mailStore = useMailStore();
- let loading = ref(false);
- const tableHeight = ref(0);
- tableHeight.value = window.innerHeight - 270;
- 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;
- mailStore.mailDataList = res.rows;
- 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;
- mailStore.mailDataList = res.rows;
- 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;
- mailStore.mailDataList = res.rows;
- 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,
- 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();
- };
- defineExpose({
- initFn: init,
- });
- </script>
- <style lang="scss" scoped>
- .messageImg {
- width: 18px;
- height: 18px;
- transform: translateY(5px);
- }
- .el-pagination {
- padding-left: 30vw;
- }
- </style>
|