|
@@ -169,7 +169,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, onMounted, provide, ref,watchEffect } from "vue";
|
|
|
+import { nextTick, onMounted, provide, ref,watchEffect,watch } from "vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import useAppStore from "@/store/modules/app";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
@@ -214,7 +214,7 @@ const isAlive = ref(true);
|
|
|
const toFileData = ref();
|
|
|
const uid = useUserStore().uid;
|
|
|
let hasNewMessage=ref(false)
|
|
|
-const iFrameData = ref([
|
|
|
+const iFrameData = ref(JSON.parse(sessionStorage.getItem('fileTabData')) || [
|
|
|
{
|
|
|
id: 1,
|
|
|
// src: `${window.location.origin}/fileEdit?clickRowId=113`,
|
|
@@ -289,8 +289,9 @@ const iFrameData = ref([
|
|
|
]);
|
|
|
//--------tabs-----------------
|
|
|
let tabIndex = 2;
|
|
|
-const editableTabsValue = ref("/index");
|
|
|
-const editableTabs = ref([{label:'首页',path:'/reindex'}]);
|
|
|
+const editableTabsValue = ref(JSON.parse(sessionStorage.getItem('editableTabsValue')) ||"/index");
|
|
|
+// const editableTabsValue = ref("/index");
|
|
|
+const editableTabs = ref(JSON.parse(sessionStorage.getItem('tabData')) ||[{label:'首页',path:'/reindex'}]);
|
|
|
|
|
|
// const removeTab = (targetName) => {
|
|
|
// const tabs = editableTabs.value;
|
|
@@ -327,6 +328,7 @@ function toggleSideBar() {
|
|
|
const logingName = ref("");
|
|
|
onMounted(() => {
|
|
|
logingName.value = Cookies.get("username");
|
|
|
+
|
|
|
// console.log('router',router)
|
|
|
});
|
|
|
watchEffect(async() => {
|
|
@@ -337,6 +339,7 @@ watchEffect(async() => {
|
|
|
console.log("===============websoctStore.noReadList:",websoctStore.noReadList,'===========',hasNewMessage.value)
|
|
|
});
|
|
|
|
|
|
+
|
|
|
function handleCommand(command) {
|
|
|
switch (command) {
|
|
|
case "setLayout":
|
|
@@ -357,6 +360,7 @@ function logout() {
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
|
+ sessionStorage.clear()
|
|
|
userStore.logOut().then(() => {
|
|
|
location.href = "/index";
|
|
|
});
|
|
@@ -506,6 +510,7 @@ const clickTab = (item) => {
|
|
|
"tofolder",
|
|
|
JSON.stringify(toRaw(toFileData.value.clickRowId))
|
|
|
);
|
|
|
+ editableTabsValue.value = toFileData.value.path
|
|
|
router.push({
|
|
|
path: toFileData.value.path,
|
|
|
query: {
|
|
@@ -534,6 +539,7 @@ const clickTab = (item) => {
|
|
|
},
|
|
|
});
|
|
|
} else {
|
|
|
+ editableTabsValue.value = item
|
|
|
router.push({
|
|
|
path: item,
|
|
|
});
|
|
@@ -671,9 +677,14 @@ const closeTab = (item, index, e) => {
|
|
|
e.stopPropagation();
|
|
|
editableTabs.value.splice(index, 1);
|
|
|
editableTabs.value = JSON.parse(JSON.stringify(editableTabs.value));
|
|
|
- const nextTab =
|
|
|
- editableTabs.value[index + 1] || editableTabs.value[index - 1];
|
|
|
- clickTab(nextTab.path);
|
|
|
+ const nextTab = editableTabs.value[index - 1];
|
|
|
+ // console.log('nextTab',toRaw(nextTab));
|
|
|
+ // console.log('item',item);
|
|
|
+ // console.log('editableTabsValue',editableTabsValue.value);
|
|
|
+ if(editableTabsValue.value == item.path){
|
|
|
+
|
|
|
+ paneClick(toRaw(nextTab));
|
|
|
+ }
|
|
|
// console.log("item", item);
|
|
|
// console.log("index", index);
|
|
|
// console.log("e", e);
|
|
@@ -689,15 +700,55 @@ const closeFileTab = (item, index, e) => {
|
|
|
par.src = "";
|
|
|
par.show = false;
|
|
|
par.name = "";
|
|
|
- par.docId = ''
|
|
|
+ par.docId = ''
|
|
|
}
|
|
|
return toRaw(par);
|
|
|
});
|
|
|
iFrameData.value = arr;
|
|
|
- isAlive.value = true;
|
|
|
+ if(data.id == editableTabsValue.value){
|
|
|
+ isAlive.value = true;
|
|
|
+ }
|
|
|
// console.log("index", index);
|
|
|
console.log("iFrameData", iFrameData.value);
|
|
|
};
|
|
|
+const setTabLocal = (data)=>{
|
|
|
+ console.log('setTabLocal',data);
|
|
|
+ sessionStorage.setItem('tabData', JSON.stringify(data))
|
|
|
+}
|
|
|
+const setFileTabLocal = (data)=>{
|
|
|
+ console.log('setFileTabLocal',data);
|
|
|
+ sessionStorage.setItem('fileTabData', JSON.stringify(data))
|
|
|
+}
|
|
|
+const setEditableTabsValue = (data)=>{
|
|
|
+ console.log('setEditableTabsValue',data);
|
|
|
+ sessionStorage.setItem('editableTabsValue', JSON.stringify(data))
|
|
|
+}
|
|
|
+watch(() => iFrameData.value, (newValue, oldValue) => {
|
|
|
+ console.log('iFrameData 发生改变了', newValue, oldValue);
|
|
|
+ setFileTabLocal(toRaw(toRaw(newValue)))
|
|
|
+
|
|
|
+}, {
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+});
|
|
|
+watch(() => editableTabs.value, (newValue, oldValue) => {
|
|
|
+ console.log('editableTabs 发生改变了', newValue, oldValue);
|
|
|
+ setTabLocal(toRaw(newValue))
|
|
|
+}, {
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+});
|
|
|
+watch(() => editableTabsValue.value, (newValue, oldValue) => {
|
|
|
+ console.log('editableTabsValue 发生改变了', newValue, oldValue);
|
|
|
+ setEditableTabsValue(toRaw(newValue))
|
|
|
+ let regExp = new RegExp(/^\//);
|
|
|
+ if(!regExp.test(editableTabsValue.value)){
|
|
|
+ isAlive.value = false;
|
|
|
+ }
|
|
|
+}, {
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|