|
|
@@ -170,7 +170,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, onMounted, provide, ref,watchEffect,watch } 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";
|
|
|
@@ -343,6 +343,19 @@ onMounted(() => {
|
|
|
if(tmplist!=null)hasNewMessage.value = true
|
|
|
else hasNewMessage.value = false
|
|
|
}, 1000);
|
|
|
+ // console.log('onMt',editableTabsValue.value);
|
|
|
+ // console.log('type',typeof editableTabsValue.value);
|
|
|
+
|
|
|
+ nextTick(()=>{ // 要放在对响应式数据修改之后
|
|
|
+ if(typeof editableTabsValue.value == 'number'){
|
|
|
+ setTimeout(() => {
|
|
|
+ iframeSize(editableTabsValue.value)
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ // console.log('router',router)
|
|
|
});
|
|
|
|
|
|
function handleCommand(command) {
|
|
|
@@ -391,8 +404,8 @@ const toSearch = async () => {
|
|
|
// console.log("router", route.path);
|
|
|
if (route.path != "/search") {
|
|
|
router.push({
|
|
|
- path: "/search",
|
|
|
- query: {
|
|
|
+ name: "search",
|
|
|
+ params: {
|
|
|
searchData: JSON.stringify(res),
|
|
|
searchText: searchText.value,
|
|
|
},
|
|
|
@@ -596,6 +609,7 @@ const filePaneClick = (item) => {
|
|
|
const inIframe =
|
|
|
outIframe.contentDocument.getElementsByTagName("iframe")[0];
|
|
|
setTimeout(() => {
|
|
|
+ console.log('outIframe',outIframe.parentElement);
|
|
|
console.error(outIframe.parentElement);
|
|
|
inIframe.style.height = outIframe.style.height =
|
|
|
outIframe.parentElement.offsetHeight + "px";
|
|
|
@@ -625,11 +639,15 @@ const addFileTab = (data) => {
|
|
|
const hasThis = oldIFrameData.find((par) => par.docId == data.docId);//是否已存在
|
|
|
if (hasThis){
|
|
|
const thisPane = toRaw(hasThis)
|
|
|
- console.log('hasThis',thisPane);
|
|
|
+ // console.log('hasThis',thisPane);
|
|
|
const arr = oldIFrameData.map((par) => {
|
|
|
if (par.id == thisPane.id) {
|
|
|
par.show = true
|
|
|
editableTabsValue.value = par.id// 标签跳转
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ iframeSize(par.id)
|
|
|
+ }, 1000);
|
|
|
}else{
|
|
|
par.show = false
|
|
|
}
|
|
|
@@ -649,6 +667,10 @@ const addFileTab = (data) => {
|
|
|
par.show = true
|
|
|
thisData.docId = "";
|
|
|
editableTabsValue.value = par.id// 新建时标签跳转
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ iframeSize(par.id)
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
}else{
|
|
|
par.show = false
|
|
|
@@ -657,6 +679,20 @@ const addFileTab = (data) => {
|
|
|
});
|
|
|
iFrameData.value = arr;
|
|
|
isAlive.value = false;
|
|
|
+ // const outIframe = document.getElementById("iframe" + par.id);
|
|
|
+ // const inIframe =
|
|
|
+ // outIframe.contentDocument.getElementsByTagName("iframe")[0];
|
|
|
+ // setTimeout(() => {
|
|
|
+ // console.log('outIframe',outIframe.parentElement);
|
|
|
+ // console.error(outIframe.parentElement);
|
|
|
+ // inIframe.style.height = outIframe.style.height =
|
|
|
+ // outIframe.parentElement.offsetHeight + "px";
|
|
|
+ // inIframe.style.width = outIframe.style.width =
|
|
|
+ // outIframe.parentElement.offsetWidth + "px";
|
|
|
+
|
|
|
+ // // console.log('dom',outIframe.parentElement.offsetWidth);
|
|
|
+ // // console.log('inIframe',inIframe);
|
|
|
+ // }, 500);
|
|
|
console.log("addFileTab", arr);
|
|
|
};
|
|
|
//创建tab标签事件
|
|
|
@@ -718,7 +754,7 @@ const closeFileTab = (item, index, e) => {
|
|
|
e.stopPropagation();
|
|
|
const data = toRaw(item);
|
|
|
console.log("closeFileTab", data);
|
|
|
- const arr = iFrameData.value.map((par) => {
|
|
|
+ let arr = iFrameData.value.map((par) => {
|
|
|
if (par.id === data.id) {
|
|
|
par.src = "";
|
|
|
par.show = false;
|
|
|
@@ -727,28 +763,65 @@ const closeFileTab = (item, index, e) => {
|
|
|
}
|
|
|
return toRaw(par);
|
|
|
});
|
|
|
- iFrameData.value = arr;
|
|
|
if(data.id == editableTabsValue.value){
|
|
|
- isAlive.value = true;
|
|
|
+ console.log('data.id',data.id);
|
|
|
+ let isLeft = true
|
|
|
+ //如果不是第一个就左移
|
|
|
+ for (let thisId = data.id; thisId>0; thisId--) {
|
|
|
+ console.log(arr[thisId - 1].id,arr[thisId - 1].src);
|
|
|
+ if(arr[thisId - 1].src){
|
|
|
+ arr[thisId -1].show = true
|
|
|
+ isLeft = false
|
|
|
+ editableTabsValue.value = arr[thisId - 1].id
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 如果是第一个就跳到文件夹标签右一
|
|
|
+ if(isLeft){
|
|
|
+ const num = toRaw(editableTabs.value).length - 1
|
|
|
+ const nextTab = editableTabs.value[num]
|
|
|
+ paneClick(toRaw(nextTab));
|
|
|
+ console.log('left',nextTab);
|
|
|
+ }
|
|
|
+ // isAlive.value = true;
|
|
|
}
|
|
|
+ iFrameData.value = arr;
|
|
|
// console.log("index", index);
|
|
|
console.log("iFrameData", iFrameData.value);
|
|
|
};
|
|
|
+// 控制iframe大小
|
|
|
+const iframeSize = (id)=>{
|
|
|
+ const outIframe = document.getElementById("iframe" + id);
|
|
|
+ const inIframe =
|
|
|
+ outIframe.contentDocument.getElementsByTagName("iframe")[0];
|
|
|
+ console.log('outIframe',outIframe.parentElement);
|
|
|
+ console.error(outIframe.parentElement);
|
|
|
+ inIframe.style.height = outIframe.style.height =
|
|
|
+ outIframe.parentElement.offsetHeight + "px";
|
|
|
+ inIframe.style.width = outIframe.style.width =
|
|
|
+ outIframe.parentElement.offsetWidth + "px";
|
|
|
+
|
|
|
+ // console.log('dom',outIframe.parentElement.offsetWidth);
|
|
|
+ // console.log('inIframe',inIframe);
|
|
|
+}
|
|
|
+// 监听和保存标签信息
|
|
|
const setTabLocal = (data)=>{
|
|
|
- console.log('setTabLocal',data);
|
|
|
+ // console.log('setTabLocal',data);
|
|
|
sessionStorage.setItem('tabData', JSON.stringify(data))
|
|
|
}
|
|
|
const setFileTabLocal = (data)=>{
|
|
|
console.log('setFileTabLocal',data);
|
|
|
isSwitchFileIframe.value = true
|
|
|
+ // console.log('setFileTabLocal',data);
|
|
|
sessionStorage.setItem('fileTabData', JSON.stringify(data))
|
|
|
}
|
|
|
const setEditableTabsValue = (data)=>{
|
|
|
- console.log('setEditableTabsValue',data);
|
|
|
+ // console.log('setEditableTabsValue',data);
|
|
|
sessionStorage.setItem('editableTabsValue', JSON.stringify(data))
|
|
|
}
|
|
|
watch(() => iFrameData.value, (newValue, oldValue) => {
|
|
|
- console.log('iFrameData 发生改变了', newValue, oldValue);
|
|
|
+ // console.log('iFrameData 发生改变了', newValue, oldValue);
|
|
|
setFileTabLocal(toRaw(toRaw(newValue)))
|
|
|
|
|
|
}, {
|
|
|
@@ -756,14 +829,14 @@ watch(() => iFrameData.value, (newValue, oldValue) => {
|
|
|
deep: true
|
|
|
});
|
|
|
watch(() => editableTabs.value, (newValue, oldValue) => {
|
|
|
- console.log('editableTabs 发生改变了', newValue, oldValue);
|
|
|
+ // console.log('editableTabs 发生改变了', newValue, oldValue);
|
|
|
setTabLocal(toRaw(newValue))
|
|
|
}, {
|
|
|
immediate: true,
|
|
|
deep: true
|
|
|
});
|
|
|
watch(() => editableTabsValue.value, (newValue, oldValue) => {
|
|
|
- console.log('editableTabsValue 发生改变了', newValue, oldValue);
|
|
|
+ // console.log('editableTabsValue 发生改变了', newValue, oldValue);
|
|
|
setEditableTabsValue(toRaw(newValue))
|
|
|
let regExp = new RegExp(/^\//);
|
|
|
if(!regExp.test(editableTabsValue.value)){
|