indexCommon.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. <template>
  2. <div class="common-layout">
  3. <el-container>
  4. <el-header
  5. class="nav"
  6. style="position: sticky; top: 0; left: 0; width: 100%; z-index: 999"
  7. >
  8. <div class="nav-top">
  9. <div>
  10. <img class="logoImg" src="@/assets/images/logos.png" /><span
  11. >聚合智慧文档管理系统</span
  12. >
  13. </div>
  14. <div class="search">
  15. <el-input
  16. v-model="searchText"
  17. maxlength="32"
  18. class="w-50 m-2"
  19. size="small"
  20. placeholder="搜索文件"
  21. suffix-icon="Search"
  22. clearable
  23. @change="toSearch"
  24. @@keyup.enter="toSearch"
  25. />
  26. </div>
  27. <div>
  28. <el-dropdown
  29. @command="handleCommand"
  30. class="right-menu-item hover-effect"
  31. trigger="click"
  32. >
  33. <div class="avatar-wrapper">
  34. <img
  35. :src="
  36. userStore.avatar
  37. ? userStore.avatar
  38. : '@/assets/images/profile.png'
  39. " class="head-img" /><span style="cursor: pointer;margin-right: 6px;">{{ userStore.name }}</span>
  40. <el-icon><ArrowDown /></el-icon>
  41. </div>
  42. <template #dropdown>
  43. <el-dropdown-menu>
  44. <router-link to="/user/profile">
  45. <el-dropdown-item>个人中心</el-dropdown-item>
  46. </router-link>
  47. <el-dropdown-item divided command="logout">
  48. <span>退出登录</span>
  49. </el-dropdown-item>
  50. </el-dropdown-menu>
  51. </template>
  52. </el-dropdown>
  53. </div>
  54. </div>
  55. </el-header>
  56. <el-container>
  57. <el-aside width="92px" class="asides">
  58. <div class="aside-con">
  59. <router-link :to="item.path" v-for="(item, index) in menuList.data" :key="index"
  60. @click="clickPath(index, item)">
  61. <div style="position: relative" :class="
  62. $route.path == item.path
  63. ? 'acitve-img-style img-style'
  64. : 'img-style'
  65. ">
  66. <img :src="$route.path == item.path ? item.beimgs : item.imgs" />
  67. <div class="text-style" v-if="$route.path != item.path">
  68. {{ item.label }}
  69. </div>
  70. <span class="yuandian" v-if="
  71. hasNewMessage &&
  72. item.path == '/index' &&
  73. $route.path != item.path
  74. "></span>
  75. </div>
  76. </router-link><br />
  77. </div>
  78. </el-aside>
  79. <el-main class="main">
  80. <div class="tab_box">
  81. <!-- <el-tabs
  82. v-model="editableTabsValue"
  83. @tab-change="clickTab"
  84. @tab-add="addTab"
  85. type="card"
  86. class="common-tabs"
  87. > -->
  88. <el-tabs
  89. v-model="editableTabsValue"
  90. @tab-add="addTab"
  91. type="card"
  92. class="common-tabs"
  93. >
  94. <!-- <el-tab-pane label="首页" @click="clickTab('/index')"> </el-tab-pane> -->
  95. <el-tab-pane
  96. v-for="(item, index) in toRaw(editableTabs)"
  97. :key="item.path"
  98. :label="item.label"
  99. :name="item.path"
  100. :data-item="JSON.stringify(item)"
  101. >
  102. <template #label>
  103. <div class="tab_pane" @click="paneClick(item)">
  104. <div class="tab_text">{{ item.label }}</div>
  105. <img
  106. v-if="item.label != '首页'"
  107. src="@/assets/images/close.png"
  108. @click="closeTab(item, index, $event)"
  109. alt=""
  110. />
  111. </div>
  112. <!-- <router-link
  113. :key="item"
  114. :data-path="item.path"
  115. :to="{
  116. path: item.path,
  117. query: { row: item.clickRowId },
  118. }"
  119. @click="paneClick(item)"
  120. class="tags-view-item"
  121. >
  122. {{ item.label }}
  123. </router-link> -->
  124. </template>
  125. </el-tab-pane>
  126. <!-- 文件的iframe -->
  127. <div v-for="item in iFrameData" :key="item.id">
  128. <el-tab-pane :label="item.name" :name="item.id" v-if="item.src">
  129. <template #label>
  130. <div class="tab_pane" @click="filePaneClick(item)">
  131. <div class="tab_text">{{ item.name }}</div>
  132. <img
  133. src="@/assets/images/close.png"
  134. @click="closeFileTab(item, index, $event)"
  135. alt=""
  136. />
  137. </div>
  138. </template>
  139. </el-tab-pane>
  140. </div>
  141. </el-tabs>
  142. </div>
  143. <div v-show="isAlive">
  144. <router-view v-slot="{ Component }">
  145. <KeepAlive :exclude="['identifyFont', 'allback', 'search']">
  146. <component :is="Component" />
  147. </KeepAlive>
  148. </router-view>
  149. </div>
  150. <div v-show="!isAlive" style="width: 100%">
  151. <div v-for="item in iFrameData" :key="item.id">
  152. <div style="width: 100%" v-show="item.show">
  153. <iframe
  154. :src="item.src"
  155. frameborder="0"
  156. :id="`iframe${item.id}`"
  157. width="100%"
  158. height="800px"
  159. class="iframeBox"
  160. v-show="item.show"
  161. ></iframe>
  162. </div>
  163. </div>
  164. </div>
  165. </el-main>
  166. </el-container>
  167. </el-container>
  168. </div>
  169. </template>
  170. <script setup>
  171. import { nextTick, onMounted, provide, ref,watchEffect,watch } from "vue";
  172. import { ElMessageBox, ElMessage } from "element-plus";
  173. import useAppStore from "@/store/modules/app";
  174. import useUserStore from "@/store/modules/user";
  175. import useSettingsStore from "@/store/modules/settings";
  176. import Cookies from "js-cookie";
  177. import chat from "@/assets/images/chat.png";
  178. import bechat from "@/assets/images/bechat.png";
  179. import zuijin from "@/assets/images/zuijin.png";
  180. import bezuijin from "@/assets/images/bezuijin.png";
  181. import colloect from "@/assets/images/colloect.png";
  182. import becolloect from "@/assets/images/becolloect.png";
  183. import system from "@/assets/images/system.png";
  184. import issystem from "@/assets/images/issystem.png";
  185. import my from "@/assets/images/my.png";
  186. import bemy from "@/assets/images/bemy.png";
  187. import bumen from "@/assets/images/bumen.png";
  188. import bebumen from "@/assets/images/bebumen.png";
  189. import common from "@/assets/images/common.png";
  190. import becommon from "@/assets/images/becommon.png";
  191. import chuanshu from "@/assets/images/chuanshu.png";
  192. import bechuanshu from "@/assets/images/bechuanshu.png";
  193. import highsearch from "@/assets/images/highsearch.png";
  194. import behighsearch from "@/assets/images/behighsearch.png";
  195. import manyBody from "@/assets/images/manyBody.png";
  196. import manyBodyFalse from "@/assets/images/manyBodyFalse.png";
  197. import { AppMain, Navbar, Settings, TagsView } from "./components";
  198. import { flieSearch } from "@/api/search/search.js";
  199. import { useRouter, useRoute } from "vue-router";
  200. import useWebsoctStore from "@/store/modules/websocket";
  201. import { toRaw } from "@vue/reactivity";
  202. import iFrame from "@/components/iFrame/index.vue";
  203. const websoctStore = useWebsoctStore();
  204. const router = useRouter(); //注册路由
  205. const route = useRoute();
  206. const appStore = useAppStore();
  207. const userStore = useUserStore();
  208. const settingsStore = useSettingsStore();
  209. const searchText = ref(""); //搜索ipt的值
  210. const selectValue = ref(1); //文档空间类型
  211. const wangzhi = import.meta.env.VITE_APP_BASE_API;
  212. const isAlive = ref(true);
  213. const toFileData = ref();
  214. const uid = useUserStore().uid;
  215. let hasNewMessage=ref(false)
  216. const iFrameData = ref(JSON.parse(sessionStorage.getItem('fileTabData')) || [
  217. {
  218. id: 1,
  219. // src: `${window.location.origin}/fileEdit?clickRowId=113`,
  220. show: false,
  221. name: "file1",
  222. docId:''
  223. },
  224. {
  225. id: 2,
  226. src: ``,
  227. // src: `http://192.168.1.9:81/fileEdit?clickRowId=1198`,
  228. show: false,
  229. name: "file2",
  230. docId:''
  231. },
  232. {
  233. id: 3,
  234. src: ``,
  235. show: false,
  236. name: "",
  237. docId:''
  238. },
  239. {
  240. id: 4,
  241. src: ``,
  242. show: false,
  243. name: "",
  244. docId:''
  245. },
  246. {
  247. id: 5,
  248. src: ``,
  249. show: false,
  250. name: "",
  251. docId:''
  252. },
  253. {
  254. id: 6,
  255. src: ``,
  256. show: false,
  257. name: "",
  258. docId:''
  259. },
  260. {
  261. id: 7,
  262. src: ``,
  263. show: false,
  264. name: "",
  265. docId:''
  266. },
  267. {
  268. id: 8,
  269. src: ``,
  270. show: false,
  271. name: "",
  272. docId:''
  273. },
  274. {
  275. id: 9,
  276. src: ``,
  277. show: false,
  278. name: "",
  279. docId:''
  280. },
  281. {
  282. id: 10,
  283. src: ``,
  284. show: false,
  285. name: "",
  286. docId:''
  287. },
  288. ]);
  289. //--------tabs-----------------
  290. let tabIndex = 2;
  291. const editableTabsValue = ref(JSON.parse(sessionStorage.getItem('editableTabsValue')) ||"/index");
  292. // const editableTabsValue = ref("/index");
  293. const editableTabs = ref(JSON.parse(sessionStorage.getItem('tabData')) ||[{label:'首页',path:'/reindex'}]);
  294. // const removeTab = (targetName) => {
  295. // const tabs = editableTabs.value;
  296. // let activeName = editableTabsValue.value;
  297. // if (activeName === targetName) {
  298. // tabs.forEach((tab, index) => {
  299. // if (tab.name === targetName) {
  300. // const nextTab = tabs[index + 1] || tabs[index - 1];
  301. // if (nextTab) {
  302. // activeName = nextTab.name;
  303. // }
  304. // }
  305. // });
  306. // }
  307. // editableTabsValue.value = activeName;
  308. // editableTabs.value = tabs.filter((tab) => tab.name !== targetName);
  309. // };
  310. //-------------------------
  311. function reload() {
  312. isAlive.value = false;
  313. console.log(11);
  314. nextTick(() => {
  315. isAlive.value = true;
  316. });
  317. }
  318. provide("reload", reload);
  319. function toggleSideBar() {
  320. appStore.toggleSideBar();
  321. }
  322. const logingName = ref("");
  323. onMounted(() => {
  324. logingName.value = Cookies.get("username");
  325. // console.log('router',router)
  326. });
  327. watchEffect(async() => {
  328. if(router.currentRoute.value.path=='/index') return;
  329. if(websoctStore.noReadList!=null)hasNewMessage.value = true
  330. else hasNewMessage.value = false
  331. // console.log("===============websoctStore.noReadList:",websoctStore.noReadList,'===========',hasNewMessage.value)
  332. });
  333. function handleCommand(command) {
  334. switch (command) {
  335. case "setLayout":
  336. setLayout();
  337. break;
  338. case "logout":
  339. logout();
  340. break;
  341. default:
  342. break;
  343. }
  344. }
  345. function logout() {
  346. ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
  347. confirmButtonText: "确定",
  348. cancelButtonText: "取消",
  349. type: "warning",
  350. })
  351. .then(() => {
  352. sessionStorage.clear()
  353. userStore.logOut().then(() => {
  354. location.href = "/index";
  355. });
  356. })
  357. .catch(() => {});
  358. }
  359. // 跳转到全文搜索
  360. const toSearch = async () => {
  361. if (!searchText.value) return;
  362. // console.log('searchText = ',searchText.value);
  363. const query = {
  364. keyword: searchText.value,
  365. isAsc: "asc",
  366. orderByColumn: "createTime",
  367. pageSize: 3,
  368. pageNum: 1,
  369. };
  370. const res = await flieSearch(query);
  371. // console.log("res", res);
  372. if (res) {
  373. // console.log("res", res);
  374. // console.log("router", route.path);
  375. if (route.path != "/search") {
  376. router.push({
  377. path: "/search",
  378. query: {
  379. searchData: JSON.stringify(res),
  380. searchText: searchText.value,
  381. },
  382. });
  383. } else {
  384. router.replace({
  385. path: "/allback",
  386. query: {
  387. searchData: JSON.stringify(res),
  388. searchText: searchText.value,
  389. },
  390. });
  391. }
  392. }
  393. };
  394. const emits = defineEmits(["setLayout"]);
  395. function setLayout() {
  396. emits("setLayout");
  397. }
  398. const clickId = ref("");
  399. const menuList = reactive({
  400. data: [
  401. {
  402. label: "会话消息",
  403. path: "/index",
  404. imgs: chat,
  405. beimgs: bechat,
  406. },
  407. // {
  408. // label: "接口",
  409. // path: "/swagger",
  410. // imgs: chat,
  411. // beimgs: bechat,
  412. // disabled:true
  413. // },
  414. {
  415. label: "最近文件",
  416. path: "/recent",
  417. imgs: zuijin,
  418. beimgs: bezuijin,
  419. },
  420. {
  421. label: "收藏文件",
  422. path: "/collect",
  423. imgs: colloect,
  424. beimgs: becolloect,
  425. },
  426. {
  427. label: "我的文件",
  428. path: "/myfile",
  429. imgs: my,
  430. beimgs: bemy,
  431. },
  432. {
  433. label: "部门文件",
  434. path: "/department",
  435. imgs: bumen,
  436. beimgs: bebumen,
  437. },
  438. {
  439. label: "公共文件",
  440. path: "/publicment",
  441. imgs: common,
  442. beimgs: becommon,
  443. },
  444. {
  445. label: "高级搜索",
  446. path: "/highsearch",
  447. imgs: highsearch,
  448. beimgs: behighsearch,
  449. },
  450. // {
  451. // label: "传输列表",
  452. // path: "/transFile",
  453. // imgs: chuanshu,
  454. // beimgs: bechuanshu,
  455. // },
  456. // {
  457. // label: "系统管理",
  458. // path: "/admin",
  459. // imgs: system,
  460. // beimgs: issystem,
  461. // },
  462. {
  463. label: "我的协作",
  464. path: "/myjoin",
  465. imgs: manyBody,
  466. beimgs: manyBodyFalse,
  467. },
  468. ],
  469. });
  470. const roles = useUserStore().roles;
  471. const permissionRoles = ['admin','dept','system','audit']
  472. const super_admin = "admin";
  473. const hasRole = roles.some(role => {
  474. return super_admin === role || permissionRoles.includes(role)
  475. })
  476. if(hasRole){
  477. menuList.data.push(
  478. {
  479. label: "系统管理",
  480. path: "/admin",
  481. imgs: system,
  482. beimgs: issystem,
  483. }
  484. );
  485. }
  486. const clickPath = (index, items) => {
  487. items = toRaw(items);
  488. // toFileData.value = null
  489. console.log("clickPathitems", items);
  490. // editableTabs.value = arr;
  491. const arr = toRaw(editableTabs.value);
  492. if (!arr.some((item) => item.label == items.label)) {
  493. editableTabs.value.push({
  494. label: items.label,
  495. path: items.path,
  496. });
  497. //需要jSON去转 否则页面无变化 离谱得很
  498. editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
  499. } else {
  500. toFileData.value = null;
  501. clickTab(items.path);
  502. }
  503. editableTabsValue.value = items.path;
  504. isAlive.value = true;
  505. // console.log("editableTabs", editableTabs.value);
  506. };
  507. const clickTab = (item) => {
  508. console.log("item", toRaw(item));
  509. setTimeout(() => {
  510. console.log("toFileData.value", toFileData.value);
  511. if (toFileData.value) {
  512. console.log(
  513. "tofolder",
  514. JSON.stringify(toRaw(toFileData.value.clickRowId))
  515. );
  516. editableTabsValue.value = toFileData.value.path
  517. router.push({
  518. path: toFileData.value.path,
  519. query: {
  520. // row: JSON.stringify(toRaw(toFileData.value.clickRowId)),
  521. },
  522. });
  523. // router.push({
  524. // path: toFileData.value.path,
  525. // query: {
  526. // row: toFileData.value.row,
  527. // },
  528. // });
  529. return;
  530. }
  531. let regExp = new RegExp(/^\//);
  532. if (!regExp.test(toRaw(item))) {
  533. const data = JSON.parse(toRaw(item));
  534. console.log("data", data);
  535. router.push({
  536. // path: "/fileEdit" + data.docId,
  537. path: "/fileEdit",
  538. query: {
  539. clickRowId: data.docId,
  540. // row:JSON.stringify(toFileData.value)
  541. // copyRow: JSON.stringify(data),
  542. },
  543. });
  544. } else {
  545. editableTabsValue.value = item
  546. router.push({
  547. path: item,
  548. });
  549. }
  550. }, 0);
  551. };
  552. const paneClick = (item) => {
  553. // 可以拿到当前的标签对象
  554. isAlive.value = true;
  555. console.log("paneItem", item);
  556. if (item.clickRowId) {
  557. // 判断是菜单还是目录
  558. toFileData.value = item;
  559. } else {
  560. toFileData.value = null;
  561. }
  562. clickTab(item.path);
  563. // console.log("isAlive", isAlive.value);
  564. };
  565. // 点击文件标签
  566. const filePaneClick = (item) => {
  567. console.log("filePaneClickitem", item);
  568. const row = toRaw(item);
  569. const arr = iFrameData.value.map((par) => {
  570. if (par.id === row.id) {
  571. // editableTabsValue.value = row.id
  572. par.show = true;
  573. // document.getElementById('iframe'+par.id).window.document.iframe[0]
  574. const outIframe = document.getElementById("iframe" + par.id);
  575. const inIframe =
  576. outIframe.contentDocument.getElementsByTagName("iframe")[0];
  577. setTimeout(() => {
  578. console.error(outIframe.parentElement);
  579. inIframe.style.height = outIframe.style.height =
  580. outIframe.parentElement.offsetHeight + "px";
  581. inIframe.style.width = outIframe.style.width =
  582. outIframe.parentElement.offsetWidth + "px";
  583. // console.log('dom',outIframe.parentElement.offsetWidth);
  584. // console.log('inIframe',inIframe);
  585. }, 500);
  586. } else {
  587. par.show = false;
  588. }
  589. return toRaw(par);
  590. });
  591. iFrameData.value = arr;
  592. // console.log("Clicknewfilearr", iFrameData.value);
  593. isAlive.value = false;
  594. // console.log("editableTabsValue", editableTabsValue.value);
  595. };
  596. // 创建文件的标签
  597. const addFileTab = (data) => {
  598. console.log("fileTabdata", data);
  599. console.log();
  600. const thisData = JSON.parse(JSON.stringify(toRaw(data)));
  601. const oldIFrameData = iFrameData.value;
  602. const canAdd = oldIFrameData.some((par) => par.src == ""); //是否达到上限
  603. if (!canAdd) return ElMessage.error("已到最大数量,请先关闭其他文件!");
  604. const hasThis = oldIFrameData.find((par) => par.docId == data.docId);//是否已存在
  605. if (hasThis){
  606. const thisPane = toRaw(hasThis)
  607. console.log('hasThis',thisPane);
  608. const arr = oldIFrameData.map((par) => {
  609. if (par.id == thisPane.id) {
  610. par.show = true
  611. editableTabsValue.value = par.id// 标签跳转
  612. }else{
  613. par.show = false
  614. }
  615. return toRaw(par);
  616. });
  617. iFrameData.value = arr;
  618. isAlive.value = false;
  619. return
  620. }
  621. const arr = oldIFrameData.map((par) => {
  622. if (!par.src) {
  623. if (thisData.docId) {
  624. // par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
  625. par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
  626. par.name = data.fileName;
  627. par.docId = data.docId
  628. par.show = true
  629. thisData.docId = "";
  630. editableTabsValue.value = par.id// 新建时标签跳转
  631. }
  632. }else{
  633. par.show = false
  634. }
  635. return toRaw(par);
  636. });
  637. iFrameData.value = arr;
  638. isAlive.value = false;
  639. console.log("addFileTab", arr);
  640. };
  641. //创建tab标签事件
  642. const addTab = (data) => {
  643. console.log("addTab", data);
  644. const arr = toRaw(editableTabs.value);
  645. if (!arr.some((item) => item.label == data.fileName)) {
  646. // editableTabs.value.push({
  647. // label: data.fileName,
  648. // path: JSON.stringify(data),
  649. // });
  650. editableTabs.value.push({
  651. label: data.fileName,
  652. path: JSON.stringify(data),
  653. });
  654. //需要jSON去转 否则页面无变化 离谱得很
  655. editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
  656. // editableTabsValue.value = data.path;
  657. }
  658. };
  659. const addFolderAdd = (data) => {
  660. console.log("data", data);
  661. const arr = toRaw(editableTabs.value);
  662. if (!arr.some((item) => item.label == data.row.dirName)) {
  663. editableTabs.value.push({
  664. label: data.name,
  665. path: data.path,
  666. clickRowId: data.row,
  667. });
  668. //需要jSON去转 否则页面无变化 离谱得很
  669. editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
  670. }
  671. console.log("editableTabs", toRaw(editableTabs.value));
  672. };
  673. provide("addTab", addTab);
  674. provide("addFolderAdd", addFolderAdd);
  675. provide("addFileTab", addFileTab);
  676. // TODO 删除tab事件
  677. const closeTab = (item, index, e) => {
  678. e.preventDefault();
  679. e.stopPropagation();
  680. editableTabs.value.splice(index, 1);
  681. editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
  682. const nextTab = editableTabs.value[index - 1];
  683. // console.log('nextTab',toRaw(nextTab));
  684. // console.log('item',item);
  685. // console.log('editableTabsValue',editableTabsValue.value);
  686. if(editableTabsValue.value == item.path){
  687. paneClick(toRaw(nextTab));
  688. }
  689. // console.log("item", item);
  690. // console.log("index", index);
  691. // console.log("e", e);
  692. };
  693. // TODO 删除tab事件
  694. const closeFileTab = (item, index, e) => {
  695. e.preventDefault();
  696. e.stopPropagation();
  697. const data = toRaw(item);
  698. console.log("closeFileTab", data);
  699. const arr = iFrameData.value.map((par) => {
  700. if (par.id === data.id) {
  701. par.src = "";
  702. par.show = false;
  703. par.name = "";
  704. par.docId = ''
  705. }
  706. return toRaw(par);
  707. });
  708. iFrameData.value = arr;
  709. if(data.id == editableTabsValue.value){
  710. isAlive.value = true;
  711. }
  712. // console.log("index", index);
  713. console.log("iFrameData", iFrameData.value);
  714. };
  715. const setTabLocal = (data)=>{
  716. console.log('setTabLocal',data);
  717. sessionStorage.setItem('tabData', JSON.stringify(data))
  718. }
  719. const setFileTabLocal = (data)=>{
  720. console.log('setFileTabLocal',data);
  721. sessionStorage.setItem('fileTabData', JSON.stringify(data))
  722. }
  723. const setEditableTabsValue = (data)=>{
  724. console.log('setEditableTabsValue',data);
  725. sessionStorage.setItem('editableTabsValue', JSON.stringify(data))
  726. }
  727. watch(() => iFrameData.value, (newValue, oldValue) => {
  728. console.log('iFrameData 发生改变了', newValue, oldValue);
  729. setFileTabLocal(toRaw(toRaw(newValue)))
  730. }, {
  731. immediate: true,
  732. deep: true
  733. });
  734. watch(() => editableTabs.value, (newValue, oldValue) => {
  735. console.log('editableTabs 发生改变了', newValue, oldValue);
  736. setTabLocal(toRaw(newValue))
  737. }, {
  738. immediate: true,
  739. deep: true
  740. });
  741. watch(() => editableTabsValue.value, (newValue, oldValue) => {
  742. console.log('editableTabsValue 发生改变了', newValue, oldValue);
  743. setEditableTabsValue(toRaw(newValue))
  744. let regExp = new RegExp(/^\//);
  745. if(!regExp.test(editableTabsValue.value)){
  746. isAlive.value = false;
  747. }
  748. }, {
  749. immediate: true,
  750. deep: true
  751. });
  752. </script>
  753. <style lang="scss" scoped>
  754. @import "@/assets/styles/mixin.scss";
  755. @import "@/assets/styles/variables.module.scss";
  756. //整体布局css
  757. .common-layout,
  758. .el-container {
  759. height: 94vh;
  760. }
  761. :deep .el-main {
  762. --el-main-padding: 8px !important;
  763. }
  764. .nav {
  765. background: #06286c;
  766. height: 48px;
  767. .nav-top {
  768. width: 98%;
  769. display: flex;
  770. justify-content: space-between;
  771. & > div:first-child {
  772. font-family: "Inter-SemiBold";
  773. }
  774. & > div:first-child,
  775. & > div:last-child {
  776. display: flex;
  777. align-items: center;
  778. color: #fff;
  779. & > img {
  780. width: 48px;
  781. height: 48px;
  782. }
  783. }
  784. .logoImg {
  785. width: 150px !important;
  786. height: 100%;
  787. margin-right: 10px;
  788. }
  789. }
  790. .head-img {
  791. border-radius: 12px;
  792. width: 24px;
  793. height: 24px;
  794. margin-right: 10px;
  795. }
  796. .avatar-wrapper {
  797. color: #fff;
  798. display: flex;
  799. align-items: center;
  800. }
  801. .search {
  802. .w-50,
  803. :deep .el-input {
  804. width: 400px;
  805. height: 32px;
  806. border-radius: 4px;
  807. margin-top: 8px;
  808. background: #6f85b5 !important;
  809. --el-input-border-color: #6f85b5;
  810. }
  811. ::v-deep .el-input__inner {
  812. color: #fff !important;
  813. }
  814. }
  815. :deep .el-input__wrapper {
  816. background: #1f3f7e !important;
  817. }
  818. }
  819. .asides {
  820. padding: 8px 10px !important;
  821. font-size: 14px;
  822. color: #000;
  823. background: #fff;
  824. }
  825. .main {
  826. background: #c7cbd8;
  827. }
  828. // tabs标签
  829. .tab_box {
  830. width: 100%;
  831. height: 32px;
  832. border-radius: 4px 4px 4px 4px;
  833. background-color: #fff;
  834. margin-bottom: 8px;
  835. .common-tabs {
  836. height: 32px;
  837. // display: flex;
  838. // align-items: center;
  839. }
  840. .tab_pane {
  841. display: flex;
  842. align-items: center;
  843. justify-content: space-between;
  844. img {
  845. margin-left: 8px;
  846. width: 10px;
  847. height: 10px;
  848. }
  849. }
  850. }
  851. :deep(.common-tabs .el-tabs__item) {
  852. height: 24px !important;
  853. padding: 0px 8px !important;
  854. margin-top: 4px !important;
  855. margin-left: 4px !important;
  856. border: 1px solid #c1cce3 !important;
  857. color: #505870 !important;
  858. font-size: 12px !important;
  859. line-height: 24px;
  860. font-weight: 400 !important;
  861. }
  862. // tag选中颜色
  863. :deep(.common-tabs .el-tabs__item.is-active) {
  864. color: #fff !important;
  865. font-weight: normal;
  866. background-color: #6f85b5;
  867. }
  868. //侧边栏css
  869. .acitve-img-style {
  870. background-color: #f5f7f9;
  871. border-radius: 4px;
  872. }
  873. .img-style {
  874. width: 72px;
  875. height: 72px;
  876. display: flex;
  877. margin-bottom: 8px;
  878. flex-direction: column;
  879. align-items: center;
  880. justify-content: center;
  881. & > img {
  882. width: 40px;
  883. height: 40px;
  884. }
  885. }
  886. .text-style {
  887. text-align: center;
  888. color: #000;
  889. }
  890. </style>
  891. <style lang="scss" scoped>
  892. .el-popper.is-light.type_popper {
  893. background-color: #1f3f7e !important;
  894. border-radius: 4px 4px 4px 4px !important;
  895. border: none !important;
  896. // padding: 0 16px !important;
  897. // box-sizing: border-box !important;
  898. }
  899. .el-popper__arrow::before {
  900. content: none;
  901. }
  902. //鼠标移动上去的选中色
  903. .type_popper {
  904. .el-select-dropdown__item.hover,
  905. .el-select-dropdown__item:hover {
  906. background: #6f85b5 !important;
  907. }
  908. //下拉框的文本颜色
  909. .el-select-dropdown__item {
  910. color: #a4b0d8 !important;
  911. }
  912. //选中之后的颜色
  913. .el-select-dropdown__item.selected {
  914. background: #6f85b5 !important;
  915. color: #fff !important;
  916. }
  917. }
  918. .yuandian {
  919. width: 8px;
  920. height: 8px;
  921. position: absolute;
  922. right: 8px;
  923. top: 6px;
  924. background: #fa5151;
  925. border-radius: 4px;
  926. }
  927. ::v-deep .qualityManual-container-office {
  928. width: 1000px !important;
  929. height: 1000px !important;
  930. iframe {
  931. width: 1000px !important;
  932. height: 1000px !important;
  933. }
  934. }
  935. </style>