left.vue 24 KB

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