|
@@ -104,6 +104,7 @@
|
|
|
type="card"
|
|
|
class="common-tabs"
|
|
|
>
|
|
|
+ <el-tab-pane label="首页"> </el-tab-pane>
|
|
|
<el-tab-pane
|
|
|
v-for="(item, index) in toRaw(editableTabs)"
|
|
|
:key="item.path"
|
|
@@ -120,27 +121,47 @@
|
|
|
alt=""
|
|
|
/>
|
|
|
</div>
|
|
|
- <!-- <router-link
|
|
|
- :key="item"
|
|
|
- :data-path="item.path"
|
|
|
- :to="{
|
|
|
- path: item.path,
|
|
|
- query: {row:item.row},
|
|
|
- }"
|
|
|
- @click="paneClick(item)"
|
|
|
- class="tags-view-item"
|
|
|
- >
|
|
|
- {{item.label}}
|
|
|
- </router-link> -->
|
|
|
</template>
|
|
|
</el-tab-pane>
|
|
|
+ <!-- 文件的iframe -->
|
|
|
+ <div v-for="item in iFrameData" :key="item.id">
|
|
|
+ <el-tab-pane :label="item.name" v-if="item.src">
|
|
|
+ <template #label>
|
|
|
+ <div class="tab_pane" @click="filePaneClick(item)">
|
|
|
+ <div class="tab_text">{{ item.name }}</div>
|
|
|
+ <img
|
|
|
+ src="@/assets/images/close.png"
|
|
|
+ @click="closeFileTab(item, index, $event)"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-tab-pane>
|
|
|
+ </div>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
- <router-view v-slot="{ Component }" v-if="isAlive">
|
|
|
- <KeepAlive :exclude="['identifyFont']">
|
|
|
- <component :is="Component" />
|
|
|
- </KeepAlive>
|
|
|
- </router-view>
|
|
|
+ <div v-show="isAlive">
|
|
|
+ <router-view v-slot="{ Component }">
|
|
|
+ <KeepAlive :exclude="['identifyFont', 'allback', 'search']">
|
|
|
+ <component :is="Component" />
|
|
|
+ </KeepAlive>
|
|
|
+ </router-view>
|
|
|
+ </div>
|
|
|
+ <div v-show="!isAlive" style="width: 100%">
|
|
|
+ <div v-for="item in iFrameData" :key="item.id">
|
|
|
+ <div style="width: 100%" v-show="item.show">
|
|
|
+ <iframe
|
|
|
+ :src="item.src"
|
|
|
+ frameborder="0"
|
|
|
+ :id="`iframe${item.id}`"
|
|
|
+ width="100%"
|
|
|
+ height="1000px"
|
|
|
+ class="iframeBox"
|
|
|
+ v-show="item.show"
|
|
|
+ ></iframe>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
</el-container>
|
|
@@ -149,7 +170,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { nextTick, onMounted, provide, ref } from "vue";
|
|
|
-import { ElMessageBox } from "element-plus";
|
|
|
+import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import useAppStore from "@/store/modules/app";
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
import useSettingsStore from "@/store/modules/settings";
|
|
@@ -191,10 +212,38 @@ const selectValue = ref(1); //文档空间类型
|
|
|
const wangzhi = import.meta.env.VITE_APP_BASE_API;
|
|
|
const isAlive = ref(true);
|
|
|
const toFileData = ref();
|
|
|
+const uid = useUserStore().uid;
|
|
|
+const iFrameData = ref([
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ src: `http://192.168.1.9:81/fileEdit?clickRowId=1197`,
|
|
|
+ show: false,
|
|
|
+ name: "file1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ src: ``,
|
|
|
+ // src: `http://192.168.1.9:81/fileEdit?clickRowId=1198`,
|
|
|
+ show: false,
|
|
|
+ name: "file2",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ src: ``,
|
|
|
+ show: false,
|
|
|
+ name: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ src: ``,
|
|
|
+ show: false,
|
|
|
+ name: "",
|
|
|
+ },
|
|
|
+]);
|
|
|
//--------tabs-----------------
|
|
|
let tabIndex = 2;
|
|
|
const editableTabsValue = ref("/index");
|
|
|
-const editableTabs = ref([{ label: "会话消息", path: "/index" }]);
|
|
|
+const editableTabs = ref([]);
|
|
|
|
|
|
// const removeTab = (targetName) => {
|
|
|
// const tabs = editableTabs.value;
|
|
@@ -393,7 +442,10 @@ const clickTab = (item) => {
|
|
|
setTimeout(() => {
|
|
|
console.log("toFileData.value", toFileData.value);
|
|
|
if (toFileData.value) {
|
|
|
- console.log('tofolder',JSON.stringify(toRaw(toFileData.value.clickRowId)));
|
|
|
+ console.log(
|
|
|
+ "tofolder",
|
|
|
+ JSON.stringify(toRaw(toFileData.value.clickRowId))
|
|
|
+ );
|
|
|
router.push({
|
|
|
path: toFileData.value.path,
|
|
|
query: {
|
|
@@ -414,7 +466,8 @@ const clickTab = (item) => {
|
|
|
const data = JSON.parse(toRaw(item));
|
|
|
console.log("data", data);
|
|
|
router.push({
|
|
|
- path: "/fileEdit" + data.docId,
|
|
|
+ // path: "/fileEdit" + data.docId,
|
|
|
+ path: "/fileEdit",
|
|
|
query: {
|
|
|
clickRowId: data.docId,
|
|
|
// row:JSON.stringify(toFileData.value)
|
|
@@ -430,6 +483,7 @@ const clickTab = (item) => {
|
|
|
};
|
|
|
const paneClick = (item) => {
|
|
|
// 可以拿到当前的标签对象
|
|
|
+ isAlive.value = true;
|
|
|
console.log("paneItem", item);
|
|
|
if (item.clickRowId) {
|
|
|
// 判断是菜单还是目录
|
|
@@ -437,7 +491,58 @@ const paneClick = (item) => {
|
|
|
} else {
|
|
|
toFileData.value = null;
|
|
|
}
|
|
|
- clickTab(item.path)
|
|
|
+ clickTab(item.path);
|
|
|
+ console.log("isAlive", isAlive.value);
|
|
|
+};
|
|
|
+// 点击文件标签
|
|
|
+const filePaneClick = (item) => {
|
|
|
+ console.log("filePaneClickitem", item);
|
|
|
+ const row = toRaw(item);
|
|
|
+ const arr = iFrameData.value.map((par) => {
|
|
|
+ if (par.id === row.id) {
|
|
|
+ par.show = true;
|
|
|
+ // document.getElementById('iframe'+par.id).window.document.iframe[0]
|
|
|
+ const outIframe = document.getElementById("iframe" + par.id);
|
|
|
+ const inIframe =
|
|
|
+ outIframe.contentDocument.getElementsByTagName("iframe")[0];
|
|
|
+ setTimeout(() => {
|
|
|
+ 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);
|
|
|
+ } else {
|
|
|
+ par.show = false;
|
|
|
+ }
|
|
|
+ return toRaw(par);
|
|
|
+ });
|
|
|
+ iFrameData.value = arr;
|
|
|
+ // console.log("Clicknewfilearr", iFrameData.value);
|
|
|
+ isAlive.value = false;
|
|
|
+ // console.log("isAlive", isAlive.value);
|
|
|
+};
|
|
|
+// 创建文件的标签
|
|
|
+const addFileTab = (data) => {
|
|
|
+ console.log("fileTabdata", data);
|
|
|
+ const thisData = toRaw(data);
|
|
|
+ const oldIFrameData = iFrameData.value;
|
|
|
+ const canAdd = oldIFrameData.some((par) => par.src == "");
|
|
|
+ if (!canAdd) return ElMessage.error("已到最大数量,请先关闭其他文件!");
|
|
|
+ const arr = oldIFrameData.map((par) => {
|
|
|
+ if (!par.src) {
|
|
|
+ if (thisData.docId) {
|
|
|
+ par.src = `http://192.168.1.9:81/fileEdit?clickRowId=${thisData.docId}`;
|
|
|
+ par.name = data.fileName;
|
|
|
+ thisData.docId = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toRaw(par);
|
|
|
+ });
|
|
|
+ iFrameData.value = arr;
|
|
|
+ console.log("addFileTab", arr);
|
|
|
};
|
|
|
//创建tab标签事件
|
|
|
const addTab = (data) => {
|
|
@@ -473,6 +578,7 @@ const addFolderAdd = (data) => {
|
|
|
};
|
|
|
provide("addTab", addTab);
|
|
|
provide("addFolderAdd", addFolderAdd);
|
|
|
+provide("addFileTab", addFileTab);
|
|
|
// TODO 删除tab事件
|
|
|
const closeTab = (item, index, e) => {
|
|
|
e.preventDefault();
|
|
@@ -486,6 +592,24 @@ const closeTab = (item, index, e) => {
|
|
|
// console.log("index", index);
|
|
|
// console.log("e", e);
|
|
|
};
|
|
|
+// TODO 删除tab事件
|
|
|
+const closeFileTab = (item, index, e) => {
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopPropagation();
|
|
|
+ const data = toRaw(item);
|
|
|
+ console.log("closeFileTab", data);
|
|
|
+ const arr = iFrameData.value.map((par) => {
|
|
|
+ if (par.id === data.id) {
|
|
|
+ par.src = "";
|
|
|
+ par.show = false;
|
|
|
+ par.name = "";
|
|
|
+ }
|
|
|
+ return toRaw(par);
|
|
|
+ });
|
|
|
+ iFrameData.value = arr;
|
|
|
+ // console.log("index", index);
|
|
|
+ // console.log("e", e);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -519,7 +643,7 @@ const closeTab = (item, index, e) => {
|
|
|
height: 48px;
|
|
|
}
|
|
|
}
|
|
|
- .logoImg{
|
|
|
+ .logoImg {
|
|
|
width: 150px !important;
|
|
|
height: 100%;
|
|
|
margin-right: 10px;
|
|
@@ -663,4 +787,12 @@ const closeTab = (item, index, e) => {
|
|
|
background: #fa5151;
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
+::v-deep .qualityManual-container-office {
|
|
|
+ width: 1000px !important;
|
|
|
+ height: 1000px !important;
|
|
|
+ iframe {
|
|
|
+ width: 1000px !important;
|
|
|
+ height: 1000px !important;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|