left.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. <template>
  2. <div class="left">
  3. <div class="top">
  4. <el-dropdown>
  5. <span class="mail">
  6. <el-badge
  7. :value="selectMail.allUnreadMessageCount"
  8. :max="99"
  9. class="item"
  10. >
  11. {{ selectMail.mailUser }}
  12. <el-icon class="el-icon--right" style="margin-right: 15px">
  13. <arrow-down />
  14. </el-icon>
  15. </el-badge>
  16. </span>
  17. <template #dropdown>
  18. <el-dropdown-menu>
  19. <el-dropdown-item
  20. v-for="item in mailList"
  21. :key="item.id"
  22. @click="handleClickMail(item)"
  23. >{{ item.mailUser }}</el-dropdown-item
  24. >
  25. </el-dropdown-menu>
  26. </template>
  27. </el-dropdown>
  28. <el-tabs v-model="activeName" class="demo-tabs" stretch>
  29. <el-tab-pane label="邮箱" name="first">
  30. <template #label>
  31. <div>
  32. <i
  33. class="iconfont icon-iconm_dianzyx"
  34. style="margin-right: 5px"
  35. ></i>
  36. <span>邮箱</span>
  37. </div>
  38. </template>
  39. </el-tab-pane>
  40. <el-tab-pane label="联系人" name="second">
  41. <template #label>
  42. <div>
  43. <i
  44. class="iconfont icon-icomm_contact"
  45. style="margin-right: 5px"
  46. ></i>
  47. <span>联系人</span>
  48. </div>
  49. </template>
  50. </el-tab-pane>
  51. <el-tab-pane label="客户" name="third">
  52. <template #label>
  53. <div>
  54. <i class="iconfont icon-icon_kh" style="margin-right: 5px"></i>
  55. <span>客户</span>
  56. </div>
  57. </template>
  58. </el-tab-pane>
  59. </el-tabs>
  60. <div>
  61. <el-button
  62. type="primary"
  63. style="width: 100%; font-size: 12px"
  64. @click="handleGoWrite()"
  65. >写信</el-button
  66. >
  67. </div>
  68. </div>
  69. <div class="body">
  70. <div v-if="activeName === 'first'">
  71. <ul class="mail-menu">
  72. <li
  73. class="menu-item"
  74. v-bind:class="{ 'select-menu': item.id === selectFloderId }"
  75. v-for="item in selectMail.mailFolderInfoListCopy"
  76. :key="item.id"
  77. @click="handleOpenMenu(item, '10')"
  78. >
  79. <i
  80. class="iconfont icon-iconm_inbox leftIcon"
  81. v-if="item.sort === 1"
  82. ></i>
  83. <i
  84. class="iconfont icon-iconm_unread leftIcon"
  85. v-else-if="item.sort === 2"
  86. ></i>
  87. <i
  88. class="iconfont icon-icomm_draftbox leftIcon"
  89. v-else-if="item.sort === 3"
  90. ></i>
  91. <i
  92. class="iconfont icon-iconm_sent leftIcon"
  93. v-else-if="item.sort === 4"
  94. ></i>
  95. <i
  96. class="iconfont icon-icomm_delete leftIcon"
  97. v-else-if="item.sort === 5"
  98. ></i>
  99. <i
  100. class="iconfont icon-iconm_ljyx leftIcon"
  101. v-else-if="item.sort === 6"
  102. ></i>
  103. <span style="margin-left: 5px">{{ item.name }}</span>
  104. <div v-if="item.sort === 1" class="badge">
  105. <span> {{ item.unreadMessageCount }} </span>
  106. </div>
  107. </li>
  108. </ul>
  109. <!-- 员工邮箱 -->
  110. <div class="tree" v-if="staffMailData && staffMailData.length > 0">
  111. <el-tree
  112. :data="staffMailData"
  113. node-key="id"
  114. :expand-on-click-node="false"
  115. default-expand-all
  116. @node-click="(data, node) => handleTreeNodeNewClick(data, node)"
  117. v-loading="staffLoading"
  118. >
  119. <template #default="{ node, data }">
  120. <span class="tree-content">
  121. <i
  122. class="iconfont icon-icomm_ygyx iconColor"
  123. v-if="data.id == '0'"
  124. style="margin-right: 5px"
  125. ></i>
  126. <span
  127. >{{ data.name }}
  128. <span v-if="data.userId && data.children.length === 0">
  129. (点击获取员工邮箱)</span
  130. ></span
  131. >
  132. <div v-if="data.isMailUser" class="badge">
  133. <span> {{ data.allUnreadMessageCount }} </span>
  134. </div>
  135. </span>
  136. </template>
  137. </el-tree>
  138. </div>
  139. <!-- 官方文件夹 -->
  140. <div
  141. class="tree"
  142. v-if="selectMail.otherFolder && selectMail.otherFolder.length > 0"
  143. >
  144. <el-tree
  145. :data="selectMail.otherFolder"
  146. node-key="id"
  147. default-expand-all
  148. :expand-on-click-node="false"
  149. @node-click="(data) => handleTreeNodeClick(data, 'official')"
  150. >
  151. <template #default="{ node, data }">
  152. <span class="tree-content">
  153. <i
  154. class="iconfont icon-iconm_gfwjj iconColor"
  155. v-if="data.id == '0'"
  156. style="margin-right: 5px"
  157. ></i>
  158. <span>{{ data.name }}</span>
  159. </span>
  160. </template></el-tree
  161. >
  162. </div>
  163. <!-- 我的文件夹 -->
  164. <div
  165. class="tree"
  166. v-if="myFolderTreeData && myFolderTreeData.length > 0"
  167. >
  168. <el-tree
  169. :data="myFolderTreeData"
  170. node-key="id"
  171. default-expand-all
  172. :expand-on-click-node="false"
  173. @node-click="(data) => handleTreeNodeClick(data, 'folder')"
  174. >
  175. <template #default="{ node, data }">
  176. <span class="tree-content">
  177. <i
  178. class="iconfont icon-icomm_wdwjj iconColor"
  179. v-if="data.id == '0'"
  180. style="margin-right: 5px"
  181. ></i>
  182. <span>{{ data.label }}</span>
  183. <el-popover
  184. placement="bottom-start"
  185. title=""
  186. :width="200"
  187. trigger="click"
  188. >
  189. <div default style="display: flex">
  190. <el-button
  191. size="small"
  192. @click.stop="handleEditFolder(data, 'add')"
  193. >添加</el-button
  194. >
  195. <el-button
  196. size="small"
  197. v-if="data.id != '0'"
  198. @click.stop="handleEditFolder(data, 'edit')"
  199. >编辑</el-button
  200. >
  201. <el-button
  202. size="small"
  203. v-if="data.id != '0'"
  204. @click.stop="handleDelFolder(data)"
  205. >删除</el-button
  206. >
  207. </div>
  208. <template #reference>
  209. <span
  210. class="iconfont icon_more iconColor"
  211. style="padding-bottom: 5px; margin-left: auto"
  212. >...</span
  213. >
  214. </template>
  215. </el-popover>
  216. </span>
  217. </template>
  218. </el-tree>
  219. </div>
  220. <!-- 我的标签 -->
  221. <div class="tree" v-if="tagsTreeData && tagsTreeData.length > 0">
  222. <el-tree
  223. :data="tagsTreeData"
  224. node-key="id"
  225. default-expand-all
  226. :expand-on-click-node="false"
  227. @node-click="(data) => handleTreeNodeClick(data, 'tag')"
  228. >
  229. <template #default="{ node, data }">
  230. <span class="tree-content">
  231. <i
  232. class="iconfont icon-icomm_label iconColor"
  233. v-if="data.id == '0'"
  234. style="margin-right: 5px"
  235. ></i>
  236. <span>{{ data.name }}</span>
  237. <el-popover
  238. placement="bottom-start"
  239. title=""
  240. :width="150"
  241. trigger="click"
  242. >
  243. <div default style="display: flex">
  244. <el-button
  245. size="small"
  246. v-if="data.id == '0'"
  247. @click.stop="handleEditTag(data, 'add')"
  248. >添加</el-button
  249. >
  250. <el-button
  251. size="small"
  252. v-if="data.id != '0'"
  253. @click.stop="handleEditTag(data, 'edit')"
  254. >编辑</el-button
  255. >
  256. <el-button
  257. size="small"
  258. v-if="data.id != '0'"
  259. @click.stop="handleDelTag(data)"
  260. >删除</el-button
  261. >
  262. </div>
  263. <template #reference>
  264. <span
  265. class="iconfont icon_more iconColor"
  266. style="padding-bottom: 5px; margin-left: auto"
  267. >...</span
  268. >
  269. </template>
  270. </el-popover>
  271. </span>
  272. </template>
  273. </el-tree>
  274. </div>
  275. </div>
  276. <div v-if="activeName === 'second'">暂未开放</div>
  277. <div v-if="activeName === 'third'">暂未开放</div>
  278. </div>
  279. <el-dialog
  280. :title="editType === 'add' ? '添加文件夹' : '编辑文件夹'"
  281. v-model="myFolderDialog"
  282. width="300px"
  283. destroy-on-close
  284. v-loading="submitLoading"
  285. >
  286. <byForm
  287. :formConfig="myFolderFormConfig"
  288. :formOption="formOption"
  289. v-model="formData.myFolderData"
  290. :rules="rules"
  291. ref="myFolderForm"
  292. >
  293. </byForm>
  294. <template #footer>
  295. <el-button @click="myFolderDialog = false" size="large"
  296. >取 消</el-button
  297. >
  298. <el-button
  299. type="primary"
  300. @click="submitMyFolderForm()"
  301. size="large"
  302. :loading="submitLoading"
  303. >
  304. 确 定
  305. </el-button>
  306. </template>
  307. </el-dialog>
  308. <el-dialog
  309. :title="editType === 'add' ? '添加标签' : '编辑标签'"
  310. v-model="tagDialog"
  311. width="300px"
  312. destroy-on-close
  313. v-loading="submitLoading"
  314. >
  315. <byForm
  316. :formConfig="tagFormConfig"
  317. :formOption="formOption"
  318. v-model="formData.tagData"
  319. :rules="tagRules"
  320. ref="tagForm"
  321. >
  322. </byForm>
  323. <template #footer>
  324. <el-button @click="tagDialog = false" size="large">取 消</el-button>
  325. <el-button
  326. type="primary"
  327. @click="submitTagForm()"
  328. size="large"
  329. :loading="submitLoading"
  330. >
  331. 确 定
  332. </el-button>
  333. </template>
  334. </el-dialog>
  335. </div>
  336. </template>
  337. <script setup>
  338. import useMailStore from "@/store/modules/mail";
  339. import useUserStore from "@/store/modules/user";
  340. import byForm from "@/components/byForm/index";
  341. import { ElMessage, ElMessageBox } from "element-plus";
  342. const mailStore = useMailStore();
  343. const { proxy } = getCurrentInstance();
  344. let selectMail = ref({});
  345. let activeName = ref("first");
  346. const mailMapData = {
  347. inbox: ["INBOX"],
  348. unread: ["UNREAD"],
  349. draft: ["草稿箱", "Drafts", "[Gmail]/草稿"],
  350. sent: ["已发送", "Sent Messages", "[Gmail]/已发邮件"],
  351. delete: ["已删除", "Deleted Messages", "[Gmail]/已删除邮件"],
  352. waste: ["垃圾邮件", "Junk", "[Gmail]/垃圾邮件"],
  353. };
  354. let selectFloderId = ref("");
  355. const mailList = ref([]);
  356. const staffMailData = ref([]);
  357. const staffLoading = ref(false);
  358. const userList = ref([]);
  359. const formOption = reactive({
  360. inline: true,
  361. labelWidth: 100,
  362. itemWidth: 100,
  363. });
  364. const myFolderForm = ref(null);
  365. const myFolderTreeData = ref([]);
  366. const myFolderDialog = ref(false);
  367. const submitLoading = ref(false);
  368. const editType = ref("add");
  369. const myFolderFormConfig = computed(() => [
  370. {
  371. type: "input",
  372. prop: "name",
  373. label: "文件夹名称",
  374. disabled: false,
  375. itemWidth: 100,
  376. },
  377. ]);
  378. const formData = reactive({
  379. myFolderData: {},
  380. tagData: {},
  381. });
  382. const rules = ref({
  383. name: [{ required: true, message: "请输入文件夹名称", trigger: "blur" }],
  384. });
  385. const tagForm = ref(null);
  386. const tagsTreeData = ref([]);
  387. const tagDialog = ref(false);
  388. const tagFormConfig = computed(() => [
  389. {
  390. type: "input",
  391. prop: "name",
  392. label: "标签名称",
  393. disabled: false,
  394. itemWidth: 100,
  395. },
  396. ]);
  397. const tagRules = ref({
  398. name: [{ required: true, message: "请输入标签名称", trigger: "blur" }],
  399. });
  400. const getTagsList = () => {
  401. proxy
  402. .post("/myTag/page", {
  403. pageNum: 1,
  404. pageSize: 9999,
  405. id: useUserStore().user.userId,
  406. })
  407. .then((res) => {
  408. tagsTreeData.value = [
  409. {
  410. name: "我的标签",
  411. id: "0",
  412. children: res.rows,
  413. },
  414. ];
  415. });
  416. };
  417. const submitTagForm = () => {
  418. tagForm.value.handleSubmit(() => {
  419. submitLoading.value = true;
  420. proxy.post("/myTag/" + editType.value, formData.tagData).then(
  421. (res) => {
  422. ElMessage({
  423. message: `操作成功!`,
  424. type: "success",
  425. });
  426. tagDialog.value = false;
  427. submitLoading.value = false;
  428. getTagsList(selectMail.value);
  429. },
  430. (err) => {
  431. submitLoading.value = false;
  432. }
  433. );
  434. });
  435. };
  436. const handleEditTag = (data, type) => {
  437. editType.value = type;
  438. if (type === "add") {
  439. formData.tagData.name = "";
  440. formData.tagData.type = selectMail.value.type;
  441. formData.tagData.mailboxId = selectMail.value.id;
  442. } else {
  443. formData.tagData = data;
  444. }
  445. tagDialog.value = true;
  446. };
  447. const handleDelTag = (data) => {
  448. ElMessageBox.confirm(`此操作将删除该标签, 是否继续?`, "提示", {
  449. confirmButtonText: "确定",
  450. cancelButtonText: "取消",
  451. type: "warning",
  452. }).then(() => {
  453. // 删除
  454. proxy.post("/myTag/delete", { id: data.id }).then((res) => {
  455. ElMessage({
  456. message: `操作成功!`,
  457. type: "success",
  458. });
  459. getTagsList();
  460. });
  461. });
  462. };
  463. const getMyFolderTree = (data) => {
  464. proxy.post("/myFolder/tree", { mailboxId: data.id }).then((res) => {
  465. myFolderTreeData.value = [
  466. {
  467. label: "我的文件夹",
  468. id: "0",
  469. children: res,
  470. },
  471. ];
  472. });
  473. };
  474. const submitMyFolderForm = () => {
  475. myFolderForm.value.handleSubmit(() => {
  476. submitLoading.value = true;
  477. proxy.post("/myFolder/" + editType.value, formData.myFolderData).then(
  478. (res) => {
  479. ElMessage({
  480. message: `操作成功!`,
  481. type: "success",
  482. });
  483. myFolderDialog.value = false;
  484. submitLoading.value = false;
  485. getMyFolderTree(selectMail.value);
  486. },
  487. (err) => {
  488. submitLoading.value = false;
  489. }
  490. );
  491. });
  492. };
  493. const handleEditFolder = (data, type) => {
  494. formData.myFolderData = {};
  495. editType.value = type;
  496. if (type === "add") {
  497. formData.myFolderData.parentId = data.id;
  498. } else {
  499. formData.myFolderData = data;
  500. formData.myFolderData.name = data.label;
  501. }
  502. formData.myFolderData.type = selectMail.value.type;
  503. formData.myFolderData.mailboxId = selectMail.value.id;
  504. myFolderDialog.value = true;
  505. };
  506. const handleDelFolder = (data) => {
  507. ElMessageBox.confirm(`此操作将删除该文件夹, 是否继续?`, "提示", {
  508. confirmButtonText: "确定",
  509. cancelButtonText: "取消",
  510. type: "warning",
  511. }).then(() => {
  512. // 删除
  513. proxy.post("/myFolder/delete", { id: data.id }).then((res) => {
  514. ElMessage({
  515. message: `操作成功!`,
  516. type: "success",
  517. });
  518. getMyFolderTree(selectMail.value);
  519. });
  520. });
  521. };
  522. const handleMapMailListData = (arr) => {
  523. for (let i = 0; i < arr.length; i++) {
  524. const iele = arr[i];
  525. iele.mailFolderInfoListCopy = [];
  526. iele.otherFolder = [];
  527. iele.allUnreadMessageCount = 0;
  528. for (let j = 0; j < iele.mailFolderInfoList.length; j++) {
  529. const jele = iele.mailFolderInfoList[j];
  530. iele.allUnreadMessageCount += jele.unreadMessageCount;
  531. if (mailMapData["inbox"].includes(jele.name)) {
  532. iele.mailFolderInfoListCopy.push({
  533. ...jele,
  534. name: "收件箱",
  535. sort: 1,
  536. });
  537. } else if (mailMapData["unread"].includes(jele.name)) {
  538. iele.mailFolderInfoListCopy.push({
  539. ...jele,
  540. name: "未读邮件",
  541. sort: 2,
  542. });
  543. } else if (mailMapData["draft"].includes(jele.name)) {
  544. iele.mailFolderInfoListCopy.push({
  545. ...jele,
  546. name: "草稿箱",
  547. sort: 3,
  548. });
  549. } else if (mailMapData["sent"].includes(jele.name)) {
  550. iele.mailFolderInfoListCopy.push({
  551. ...jele,
  552. name: "已发送",
  553. sort: 4,
  554. });
  555. } else if (mailMapData["delete"].includes(jele.name)) {
  556. iele.mailFolderInfoListCopy.push({
  557. ...jele,
  558. name: "已删除",
  559. sort: 5,
  560. });
  561. } else if (mailMapData["waste"].includes(jele.name)) {
  562. iele.mailFolderInfoListCopy.push({
  563. ...jele,
  564. name: "垃圾邮件",
  565. sort: 6,
  566. });
  567. } else {
  568. iele.otherFolder.push(jele);
  569. }
  570. }
  571. if (iele.otherFolder.length > 0) {
  572. iele.otherFolder = [
  573. {
  574. name: "官方文件夹",
  575. id: "0",
  576. children: iele.otherFolder,
  577. },
  578. ];
  579. }
  580. iele.mailFolderInfoListCopy.sort((a, b) => a.sort - b.sort);
  581. }
  582. return arr;
  583. };
  584. const getMialList = () => {
  585. proxy.get("/mailService/getUserEmailList").then((res) => {
  586. const arr = handleMapMailListData(res.data);
  587. mailList.value = arr;
  588. if (mailList.value.length) {
  589. // 默认赋值第一邮箱
  590. selectMail.value = mailList.value[0];
  591. mailStore.selectMail = mailList.value[0];
  592. // 获取我的文件夹树形
  593. getMyFolderTree(selectMail.value);
  594. // 默认打开第一邮箱文件夹
  595. if (selectMail.value.mailFolderInfoListCopy.length > 0) {
  596. handleOpenMenu(selectMail.value.mailFolderInfoListCopy[0], "10");
  597. }
  598. }
  599. });
  600. proxy.post("/mailInfo/getUserList").then((res) => {
  601. if (res && res.length > 0) {
  602. res = res.map((x) => ({
  603. ...x,
  604. name: x.nickName,
  605. children: [],
  606. }));
  607. }
  608. staffMailData.value = [
  609. {
  610. name: "员工邮箱",
  611. id: "0",
  612. children: res,
  613. },
  614. ];
  615. });
  616. };
  617. const handleClickMail = (item, flag = true) => {
  618. mailStore.mailMenuList = [];
  619. selectMail.value = item;
  620. mailStore.selectMail = item;
  621. // 默认打开第一邮箱文件夹
  622. if (selectMail.value.mailFolderInfoListCopy.length > 0 && flag) {
  623. handleOpenMenu(selectMail.value.mailFolderInfoListCopy[0], "10");
  624. }
  625. };
  626. const changeFloderId = (val) => {
  627. selectFloderId.value = val;
  628. };
  629. const handleOpenMenu = (item, listPageType = "10") => {
  630. // 10为官方文件夹以及六个外侧文件夹 20为我的文件夹 30为标签文件夹
  631. selectFloderId.value = item.id;
  632. const menu = {
  633. title: item.name,
  634. type: selectMail.value.type,
  635. folderId: item.id,
  636. id: "folder" + "," + item.id,
  637. listPageType,
  638. };
  639. // 如没有这个菜单则push
  640. const menuItem = mailStore.mailMenuList.find((x) => x.id === menu.id);
  641. if (menuItem === undefined) {
  642. mailStore.mailMenuList.push(menu);
  643. }
  644. // 更新当前选择的tab数据和tab的Id值
  645. mailStore.currentMenu = menu;
  646. mailStore.currentId = menu.id;
  647. };
  648. const handleGoWrite = (mail = "", pageType = "0") => {
  649. const menu = {
  650. title: "写信",
  651. type: selectMail.value.type,
  652. id: "write",
  653. pageType,
  654. };
  655. if (mail) {
  656. menu.reMail = mail;
  657. }
  658. const index = mailStore.mailMenuList.findIndex((x) => x.id === menu.id);
  659. if (index >= 0) {
  660. mailStore.mailMenuList[index] = menu;
  661. } else {
  662. mailStore.mailMenuList.push(menu);
  663. }
  664. mailStore.currentMenu = menu;
  665. mailStore.currentId = menu.id;
  666. };
  667. const handleTreeNodeClick = (data, type) => {
  668. if (data.id != "0") {
  669. let menuData = {
  670. id: data.id,
  671. };
  672. let listPageType = "10";
  673. if (type === "official") {
  674. menuData.name = data.name;
  675. } else if (type === "folder") {
  676. menuData.name = data.label;
  677. listPageType = "20";
  678. } else if (type === "tag") {
  679. menuData.name = data.name;
  680. listPageType = "30";
  681. }
  682. handleOpenMenu(menuData, listPageType);
  683. }
  684. };
  685. const clickTreeMail = (data, node) => {
  686. let mailData = node.parent.data;
  687. if (mailStore.selectMail.id === mailData.id) {
  688. const menuData = {
  689. id: data.id,
  690. name: data.name,
  691. };
  692. handleOpenMenu(menuData, "10");
  693. } else {
  694. handleClickMail(mailData, false);
  695. handleOpenMenu(data, "10");
  696. }
  697. };
  698. const handleTreeNodeNewClick = (data, node) => {
  699. if (data.id == "0") {
  700. return;
  701. } else if (data.userId) {
  702. const index = staffMailData.value[0].children.findIndex(
  703. (x) => x.userId === data.userId
  704. );
  705. if (index >= 0) {
  706. if (
  707. staffMailData.value[0].children[index].children &&
  708. staffMailData.value[0].children[index].children.length > 0
  709. ) {
  710. return;
  711. } else {
  712. staffLoading.value = true;
  713. proxy.post("/mailInfo/getUserEmailList", { id: data.userId }).then(
  714. (res) => {
  715. let arr = handleMapMailListData(res);
  716. arr = arr.map((x) => ({
  717. ...x,
  718. name: x.mailUser,
  719. isMailUser: true,
  720. children: x.mailFolderInfoList.map((x) => ({
  721. ...x,
  722. isFolder: true,
  723. })),
  724. }));
  725. staffMailData.value[0].children[index].children = arr;
  726. setTimeout(() => {
  727. staffLoading.value = false;
  728. }, 200);
  729. },
  730. (err) => {
  731. staffLoading.value = false;
  732. return ElMessage({
  733. message: `获取员工邮箱失败,请联系管理员`,
  734. type: "info",
  735. });
  736. }
  737. );
  738. }
  739. }
  740. } else if (data.isFolder) {
  741. clickTreeMail(data, node);
  742. }
  743. };
  744. onMounted(() => {
  745. getMialList();
  746. getTagsList();
  747. });
  748. defineExpose({
  749. handleGoWrite,
  750. changeFloderId,
  751. });
  752. </script>
  753. <style lang="scss" scoped>
  754. .left {
  755. font-size: 12px;
  756. .top {
  757. padding: 10px;
  758. text-align: center;
  759. border-bottom: 1px solid #ddd;
  760. .mail {
  761. color: #333333;
  762. font-weight: 700;
  763. font-size: 14px;
  764. }
  765. }
  766. .body {
  767. height: calc(100vh - 260px);
  768. overflow: auto;
  769. // padding: 10px;
  770. .mail-menu {
  771. list-style: none;
  772. margin-block-start: 0;
  773. margin-block-end: 0;
  774. padding: 0px;
  775. padding: 10px 10px 0 10px;
  776. .menu-item {
  777. display: flex;
  778. align-items: center;
  779. font-weight: 700;
  780. padding-left: 10px;
  781. font-size: 12px;
  782. width: 100%;
  783. height: 40px;
  784. line-height: 40px;
  785. border-radius: 3px;
  786. color: #333333;
  787. cursor: pointer;
  788. &:hover {
  789. background: #ddedfe;
  790. }
  791. .leftIcon {
  792. font-size: 16px;
  793. color: #999999;
  794. }
  795. }
  796. }
  797. }
  798. }
  799. .select-menu {
  800. // background: #ddedfe;
  801. color: #0084ff !important;
  802. .leftIcon {
  803. color: #0084ff !important;
  804. }
  805. }
  806. .tree {
  807. margin-top: 10px;
  808. border-top: 1px solid #ddd;
  809. padding: 10px 10px 0 10px;
  810. .tree-content {
  811. width: 100%;
  812. display: flex;
  813. // justify-content: space-between;
  814. padding-right: 10px;
  815. align-items: center;
  816. .iconColor {
  817. color: #666 !important;
  818. }
  819. }
  820. }
  821. .badge {
  822. background: #eeeeee;
  823. height: 20px;
  824. width: 30px;
  825. border-radius: 10px;
  826. line-height: 20px;
  827. text-align: center;
  828. font-weight: normal;
  829. margin-left: auto;
  830. margin-right: 10px;
  831. span {
  832. color: #666666;
  833. }
  834. }
  835. </style>
  836. <style lang="scss">
  837. .body {
  838. .el-tree-node__content {
  839. font-weight: 700;
  840. color: #333333 !important;
  841. font-size: 12px !important;
  842. }
  843. }
  844. .top {
  845. .el-tabs__item {
  846. color: #616161;
  847. font-size: 12px;
  848. }
  849. .el-tabs__item:hover {
  850. color: #409eff;
  851. }
  852. .el-tabs__item.is-active {
  853. color: #409eff;
  854. }
  855. }
  856. </style>