|
@@ -630,22 +630,57 @@ const filePaneClick = (item) => {
|
|
|
};
|
|
|
// 创建文件的标签
|
|
|
const addFileTab = (data, bool) => {
|
|
|
- // console.log("fileTabdata", data);
|
|
|
- console.log();
|
|
|
+ // console.log("addFileTab", data);
|
|
|
const thisData = JSON.parse(JSON.stringify(toRaw(data)));
|
|
|
const oldIFrameData = iFrameData.value;
|
|
|
const canAdd = oldIFrameData.some((par) => par.src == ""); //是否达到上限
|
|
|
if (!canAdd) return ElMessage.error("已到最大数量,请先关闭其他文件!");
|
|
|
const hasThis = oldIFrameData.find((par) => par.docId == data.docId);//是否已存在
|
|
|
if (hasThis) {
|
|
|
+ // 已存在打开当前的并且改变编辑状态
|
|
|
const thisPane = toRaw(hasThis)
|
|
|
+ // 如果编辑状态改变了 先删除旧的 再新建
|
|
|
+ if(thisPane.src != `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}&canEdit=${bool}` ){
|
|
|
+ // console.log('buyiyang',`${window.location.origin}/fileEdit?clickRowId=${thisData.docId}&canEdit=${bool}`);
|
|
|
+ const arr = oldIFrameData.map((par) => {
|
|
|
+ if (par.id === thisPane.id) {
|
|
|
+ par.src = "";
|
|
|
+ par.show = false;
|
|
|
+ par.name = "";
|
|
|
+ par.docId = ''
|
|
|
+ }
|
|
|
+ return toRaw(par);
|
|
|
+ });
|
|
|
+ iFrameData.value = arr.map((par) => {
|
|
|
+ if (!par.src) {
|
|
|
+ if (thisData.docId) {
|
|
|
+ // par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}`;
|
|
|
+ par.src = `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}&canEdit=${bool}`;
|
|
|
+ par.name = data.fileName;
|
|
|
+ par.docId = data.docId
|
|
|
+ par.show = true
|
|
|
+ thisData.docId = "";
|
|
|
+ editableTabsValue.value = par.id// 新建时标签跳转
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ iframeSize(par.id)
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ par.show = false
|
|
|
+ }
|
|
|
+ return toRaw(par);
|
|
|
+ });
|
|
|
+ isAlive.value = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
// console.log('hasThis',thisPane);
|
|
|
const arr = oldIFrameData.map((par) => {
|
|
|
if (par.id == thisPane.id) {
|
|
|
+ `${window.location.origin}/fileEdit?clickRowId=${thisData.docId}&canEdit=${bool}`
|
|
|
par.show = true
|
|
|
editableTabsValue.value = par.id// 标签跳转
|
|
|
setTimeout(() => {
|
|
|
-
|
|
|
iframeSize(par.id)
|
|
|
}, 1000);
|
|
|
} else {
|
|
@@ -657,6 +692,7 @@ const addFileTab = (data, bool) => {
|
|
|
isAlive.value = false;
|
|
|
return
|
|
|
}
|
|
|
+ // 新增标签
|
|
|
const arr = oldIFrameData.map((par) => {
|
|
|
if (!par.src) {
|
|
|
if (thisData.docId) {
|