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