huangyinfeng
6 天以前 a9a03d64cf190188d3db04d14970fc0908b03491
提交 | 用户 | age
12f730 1 <template>
H 2   <div class="left-box">
3     <!-- 分发 -->
4     <a-tooltip placement="bottom">
5       <template #title>
6         <span>分发</span>
7       </template>
74a35f 8       <ExportOutlined class="icon" />
12f730 9     </a-tooltip>
74a35f 10     <!-- 待处理 -->
H 11     <TooltipAndDropdown
12       class="icon"
13       v-show="checked"
14       :tooltipTitle="'待处理邮件'"
15       :initialDropdownOpen="false"
16       :initialTooltipOpen="false"
17       :showTooltip="false"
18       :docCodeS="getSelectAllBocCode"
19     />
12f730 20     <!-- 删除 -->
H 21     <a-tooltip placement="bottom">
22       <template #title>
23         <span>删除</span>
24       </template>
74a35f 25       <DeleteOutlined v-show="checked" class="icon" @click="fuDeleteEmail" />
12f730 26     </a-tooltip>
H 27
28     <!-- 收藏 -->
29     <a-tooltip placement="bottom">
30       <template #title>
31         <span>标志</span>
32       </template>
33       <TagOutlined class="icon" v-show="checked" />
34     </a-tooltip>
35
36     <!-- 文件夹 -->
37     <a-tooltip placement="bottom">
38       <template #title>
39         <span>文件夹</span>
40       </template>
41       <FolderOutlined class="icon" v-show="checked" />
42     </a-tooltip>
43     <!-- 更多 -->
44     <a-tooltip placement="bottom">
45       <template #title>
46         <span>更多</span>
47       </template>
48       <a-dropdown :arrow="{ pointAtCenter: true }" placement="bottom" :trigger="['click']">
49         <template #overlay>
a9a03d 50           <a-menu v-if="checked">
12f730 51             <a-menu-item key="2" @click="fnSelectAllRead(true)"> 标为已读</a-menu-item>
H 52             <a-menu-item key="3" @click="fnSelectAllRead(false)"> 标为未读</a-menu-item>
53             <a-menu-item key="4"> 设为置顶</a-menu-item>
54             <a-divider style="margin: 2px; padding: 2px" />
55             <a-menu-item key="5"> 标记为垃圾邮件</a-menu-item>
56           </a-menu>
a9a03d 57           <!-- </template>
H 58         <MoreOutlined v-if="checked" class="icon" />
12f730 59       </a-dropdown>
H 60       <a-dropdown :arrow="{ pointAtCenter: true }" placement="bottom" :trigger="['click']">
a9a03d 61         <template #overlay> -->
H 62           <a-menu v-else>
12f730 63             <a-menu-item key="1" @click="fnAllRead">全部标记为已读</a-menu-item>
H 64             <a-divider style="margin: 2px; padding: 2px" />
65             <p style="color: #999; font-size: 12px">勾选邮件即可查看更多操作</p>
66           </a-menu>
67         </template>
a9a03d 68         <MoreOutlined class="icon" />
12f730 69       </a-dropdown>
H 70     </a-tooltip>
71   </div>
72 </template>
73
74 <script lang="ts" setup>
74a35f 75   import TooltipAndDropdown from './TooltipAndDropdown .vue';
12f730 76   import {
H 77     ExportOutlined,
78     ClockCircleOutlined,
79     DeleteOutlined,
80     TagOutlined,
81     FolderOutlined,
82     MoreOutlined,
83   } from '@ant-design/icons-vue';
84   import { ref, defineProps, defineEmits, computed, reactive, inject } from 'vue';
85   interface Props {
86     checked: boolean;
87     handleId?: number;
88     selectAllRow?: Array<any>;
ccfd07 89     parentTableList?: Array<any>;
12f730 90   }
H 91
74a35f 92   const props = defineProps<Props>();
H 93
94   const checked = computed(() => props.checked);
95   import { updateReadApi, deleteEmailAPi } from '@/api/email/userList';
96   import { useMessage } from '@/hooks/web/useMessage';
97
98   const { createMessage } = useMessage();
12f730 99   const getDataList = inject('getDataList');
H 100   function fnSelectAllRead(is) {
101     const data = {
102       status: is,
103       list: getReadId(),
104     };
105     pushUpdateReadApi(data);
106   }
74a35f 107   const getSelectAllBocCode = computed(() => {
a9a03d 108     try {
H 109       if (props.parentTableList?.length == 0) {
110         return [];
111       }
112       let data = props.selectAllRow.map((item) => item.docCode);
113       console.log(data, '00003');
74a35f 114
a9a03d 115       return data;
H 116     } catch (error) {
117       return [];
118     }
74a35f 119   });
12f730 120   function pushUpdateReadApi(data) {
H 121     updateReadApi(data).then((res) => {
122       if (res.code == 0) {
123         //
124         getDataList({});
125       }
126     });
127   }
128   function fnAllRead() {
129     fnGetTableList();
130   }
131
132   function fnGetTableList() {
133     const data = {
134       status: true,
74a35f 135       list: getReadId(),
12f730 136     };
H 137     pushUpdateReadApi(data);
138   }
74a35f 139   function getReadId() {
a9a03d 140     try {
H 141       const ids = [];
142       if (props.parentTableList?.length == 0) {
143         return [];
144       }
145       props.parentTableList.forEach((item: Record<string, any>) => {
146         ids.push(item.docCode);
147       });
148       return ids;
149     } catch (error) {
150       return [];
151     }
74a35f 152   }
H 153   const emit = defineEmits(['nextNum']);
154   function fuDeleteEmail() {
155     deleteEmailAPi(getSelectAllBocCode.value).then((res) => {
156       if (res.code == 0) {
157         createMessage.success(res.msg);
158         // 区分操作
159         getDataList({});
160         if (!props.parentTableList) {
161           emit('nextNum');
162         }
163       }
164     });
12f730 165   }
H 166 </script>
167
168 <style lang="less" scoped>
169   .left-box {
170     display: flex;
171     align-items: center;
172     justify-content: space-flex-start;
173     width: 100%;
174
175     & .icon {
176       margin-right: 15px;
177       font-size: 16px;
178     }
179   }
180 </style>