Bladeren bron

修正下载文件sk处理和协同文件接口,同时注释掉一些尚不能工作的功能入口

master
unknown 4 jaren geleden
bovenliggende
commit
6a8131344c
3 gewijzigde bestanden met toevoegingen van 137 en 182 verwijderingen
  1. +3
    -0
      src/services/system.js
  2. +6
    -6
      src/views/main_web/workspace/service.js
  3. +128
    -176
      src/views/main_web/workspace/workspace.vue

+ 3
- 0
src/services/system.js Bestand weergeven

@@ -58,6 +58,9 @@ const system = {
socket.close();
});
const watchSocket = io('subscriptionFileChange');
watchSocket.on('open', () => {
watchSocket.send(projName);
});
watchSocket.on('message', fileChangeHandler);
return watchSocket
}),


+ 6
- 6
src/views/main_web/workspace/service.js Bestand weergeven

@@ -1,4 +1,4 @@
import { fetchApi ,wrapErrorHint} from '@/utils/request';
import { fetchApi, wrapErrorHint } from '@/utils/request';
import { firstCharToLowerCase, firstCharToUpperCase } from '@/utils/tool';


@@ -18,10 +18,10 @@ export async function fetchWorkFlow(projectId, userId) {
* @param {*} folderId
* @param {*} userId
*/
export async function fetchFolderFileList(folderId, userId) {
const res = await fetchApi('folder/QueryFileListByFolderIdAndUserId', {folderId, userId});
export async function fetchFolderFileList(folderId, userId, commonFolderId) {
const res = await fetchApi('folder/QueryFileListByFolderIdAndUserId', { folderId, userId, publicFolderId: commonFolderId });
wrapErrorHint(res);
if(res.Code !== 0) return null;
if (res.Code !== 0) return null;
const data = res.Data || {};
const outputObj = {
folder: data.folder.map(firstCharToLowerCase),
@@ -42,8 +42,8 @@ export async function createSubFolder(folderGroupData) {
/**
* 添加历史文件
*/
export async function AddArchMilesStone(fileInfo){
fileInfo=firstCharToUpperCase(fileInfo);
export async function AddArchMilesStone(fileInfo) {
fileInfo = firstCharToUpperCase(fileInfo);
delete fileInfo.IsShowFile;

const res = await fetchApi('file/AddArchMilesStone', fileInfo);


+ 128
- 176
src/views/main_web/workspace/workspace.vue Bestand weergeven

@@ -797,7 +797,7 @@
>
<span>复制至其他工作</span>
</el-dropdown-item>
<el-dropdown-item
<!-- <el-dropdown-item
divided
@click.native="downLoadMyFile(file)"
v-if="
@@ -806,8 +806,8 @@
"
>
<span>下载至本地</span>
</el-dropdown-item>
<el-dropdown-item
</el-dropdown-item> -->
<!-- <el-dropdown-item
v-if="
file.extension == 'svfzip' &&
!isShowMenuFile == true
@@ -815,19 +815,19 @@
@click.native="shareMyFile(file)"
>
<span>分享</span>
</el-dropdown-item>
</el-dropdown-item> -->
<el-dropdown-item
@click.native="reNameyMyFile(file)"
v-if="!isShowMenuFile == true"
>
<span>重命名</span>
</el-dropdown-item>
<el-dropdown-item
<!-- <el-dropdown-item
@click.native="delMyFile(file)"
v-if="!isShowMenuFile == true"
>
<span>移到回收站</span>
</el-dropdown-item>
</el-dropdown-item> -->
<el-dropdown-item
divided
@click.native="
@@ -1808,77 +1808,32 @@
class="contextmenu"
>
<ul class="rightMenu" v-if="showType == 1">
<li
<!-- <li
@click="openOffice(BtnRightFile)"
v-if="
(BtnRightFile.extension == 'pdf' ||
BtnRightFile.extension == 'xls' ||
BtnRightFile.extension == 'xlsx' ||
BtnRightFile.extension == 'doc' ||
BtnRightFile.extension == 'docx' ||
BtnRightFile.extension == 'ppt' ||
BtnRightFile.extension == 'pptx' ||
BtnRightFile.extension == 'txt') &&
isShowMenuFile == true
"
>
在线查看
</li>
<li
@click="openOffice(BtnRightFile)"
v-else-if="
BtnRightFile.extension == 'pdf' ||
BtnRightFile.extension == 'xls' ||
BtnRightFile.extension == 'xlsx' ||
BtnRightFile.extension == 'doc' ||
BtnRightFile.extension == 'docx' ||
BtnRightFile.extension == 'ppt' ||
BtnRightFile.extension == 'pptx' ||
BtnRightFile.extension == 'txt'
oneOf(BtnRightFile.extension, ['pdf','xls','xlsx','doc','docx','ppt','pptx','txt'])
"
>
在线查看
</li>
</li> -->
<li
@click="fileClick(BtnRightFile)"
v-if="
isClient &&
BtnRightFile.downloadStatus == 2 &&
isShowMenuFile == true
"
>
打开
</li>
<li
@click="fileClick(BtnRightFile)"
v-else-if="
isClient &&
BtnRightFile.downloadStatus == 2 &&
!isShowMenuFile == true
BtnRightFile.downloadStatus == 2
"
>
打开
</li>
<li
<!-- <li
@click="fileClickSelect(BtnRightFile)"
v-if="
isClient &&
BtnRightFile.downloadStatus == 2 &&
isShowMenuFile == true
"
>
打开方式
</li>
<li
@click="fileClickSelect(BtnRightFile)"
v-else-if="
isClient &&
BtnRightFile.downloadStatus == 2 &&
!isShowMenuFile == true
BtnRightFile.downloadStatus == 2
"
>
打开方式
</li>
</li> -->
<div class="line"></div>
<li
@click="setFileStatus(BtnRightFile, 2, '更新为已完成', 1)"
@@ -1939,8 +1894,8 @@
>
建立副本
</li>
<div class="line"></div>
<li
<!-- <div class="line"></div> -->
<!-- <li
@click="updateToPublicFile(BtnRightFile, 0)"
v-if="
isUseCommon &&
@@ -1964,8 +1919,8 @@
v-else-if="isUseCommon && BtnRightFile.commonStatus == 1"
>
取消至项目公共文件夹
</li>
<li
</li> -->
<!-- <li
@click="copyAndMoveFolder(BtnRightFile, 'move')"
v-if="!isShowMenuFile"
>
@@ -1982,40 +1937,26 @@
v-else-if="!isShowMenuFile == true"
>
复制至其他工作
</li>
</li> -->
<div class="line"></div>
<li
@click="downLoadMyFile(BtnRightFile)"
v-if="
BtnRightFile.extension != 'map' &&
BtnRightFile.extension != 'supermap' &&
isShowMenuFile == true
"
>
下载至本地
</li>
<li
<!-- <li
@click="downLoadMyFile(BtnRightFile)"
v-else-if="
BtnRightFile.extension != 'map' &&
BtnRightFile.extension != 'supermap' &&
!isShowMenuFile == true
"
v-if="!oneOf(BtnRightFile.extension, ['map', 'supermap'])"
>
下载至本地
</li>
<li
</li> -->
<!-- <li
@click="shareMyFile(BtnRightFile)"
v-if="BtnRightFile.extension == 'svfzip'"
>
分享
</li>
<li @click="reNameyMyFile(BtnRightFile)" v-if="!isShowMenuFile">
</li> -->
<!-- <li @click="reNameyMyFile(BtnRightFile)" v-if="!isShowMenuFile">
重命名
</li>
<li @click="delMyFile(BtnRightFile)" v-if="!isShowMenuFile">
</li> -->
<!-- <li @click="delMyFile(BtnRightFile)" v-if="!isShowMenuFile">
移到回收站
</li>
</li> -->
<div class="line" v-if="BtnRightFile.status != 3"></div>
<li
@click="setFileStatus(BtnRightFile, 3, '文件已取消协同', 1)"
@@ -2137,13 +2078,6 @@
>
<li
@click="newCreateFolderGroup"
v-if="isShowMenuItemCreateFoldergroup == true"
>
新建文件夹
</li>
<li
@click="newCreateFolderGroup"
v-else-if="!isShowMenuItemCreateFoldergroup == true"
>
新建文件夹
</li>
@@ -2155,18 +2089,18 @@
</li>
<!-- <li @click="copyAndMoveFoldergroup(btnRightFoldergoup,'move')">转移至其他工作</li>
<li @click="copyAndMoveFoldergroup(btnRightFoldergoup,'copy')">复制至其它工作</li>-->
<li
<!-- <li
@click="renameFoldergroup(btnRightFoldergoup)"
v-if="!isShowMenuItemCreateFoldergroup == true"
>
重命名
</li>
<li
</li> -->
<!-- <li
@click="removeRecycle(btnRightFoldergoup)"
v-if="!isShowMenuItemCreateFoldergroup == true"
>
移到回收站
</li>
</li> -->
</ul>
</div>
</div>
@@ -2207,7 +2141,7 @@
<img src="static\img\upload.png" alt class="uploadBtnImg" />
<span class="uploadText">点击上传本地文件</span>
</div>
<div class="creatbox_mid mt-10">
<div class="creatbox_mid mt-10" v-show="false">
<div class="diahead">
<div class="fl">
<b class="diaTitle">创建 云应用文件</b>
@@ -2249,7 +2183,7 @@
</ul>
</div>
</div>
<div class="creatbox_mid mt-10" v-if="this.listCloudFiles.length != 0">
<div class="creatbox_mid mt-10" v-if="this.listCloudFiles.length != 0" v-show="false">
<div class="diahead">
<div class="fl">
<b class="diaTitle">创建 云文件</b>
@@ -3019,7 +2953,7 @@ export default {
//添加鼠标移入齿轮事件
window.addEventListener("mouseenter", this.setIconMouseEnter, true);

this.socketIns = system.entryProject(sessionStorage.projName, sessionStorage.userId);
this.socketIns = system.entryProject(sessionStorage.projName, sessionStorage.userId, this.onSocketFileChangeDetected.bind(this));
},
computed: {
/**
@@ -3049,6 +2983,21 @@ export default {
},
},
methods: {
onSocketFileChangeDetected({ data }){
try {
/**
* 格式:
* {
* `${节点名称}\\${文件名称}.${文件扩展名}`: `${ipfsCid}`
* }
*/
const hash = JSON.parse(data);

}catch(e) {
console.log('socket file change message error:', e);
}
// console.log('socket file change message detected:', args);
},
removeMilestone(filesList){
return filesList.filter(file=>{
return file.milestone != 2;
@@ -3060,15 +3009,15 @@ export default {
/**
* 打开帮助
*/
showHelp: function () {
this.$emit("showHelp", true);
},
// showHelp: function () {
// this.$emit("showHelp", true);
// },
/**
* 打开意见反馈
*/
showOption: function () {
this.$emit("showOption", true);
},
// showOption: function () {
// this.$emit("showOption", true);
// },
// downLoadStatus: function () {
// var data = system.getProgress();
// },
@@ -3187,37 +3136,37 @@ export default {
* 获取设置信息
*/
loadSettings() {
var thisApp = this;
this.$axios({
method: "get",
url: encodeURI(process.env.API_HOST + "sysinfo/setting"),
})
.then((response) => {
response.data.forEach((element) => {
if (element.shortName == "公共文件夹") {
if (element.status == 1) {
this.isUseCommon = true;
} else {
this.isUseCommon = false;
}
} else if (element.shortName == "协同") {
if (element.status == 1) {
this.isUseShare = true;
} else {
this.isUseShare = false;
}
} else if (element.shortName == "文件交换") {
if (element.status == 1) {
this.isUseFolderChange = true;
} else {
this.isUseFolderChange = false;
}
}
});
})
.catch((error) => {
console.log(error);
});
// var thisApp = this;
// this.$axios({
// method: "get",
// url: encodeURI(process.env.API_HOST + "sysinfo/setting"),
// })
// .then((response) => {
// response.data.forEach((element) => {
// if (element.shortName == "公共文件夹") {
// if (element.status == 1) {
// this.isUseCommon = true;
// } else {
// this.isUseCommon = false;
// }
// } else if (element.shortName == "协同") {
// if (element.status == 1) {
// this.isUseShare = true;
// } else {
// this.isUseShare = false;
// }
// } else if (element.shortName == "文件交换") {
// if (element.status == 1) {
// this.isUseFolderChange = true;
// } else {
// this.isUseFolderChange = false;
// }
// }
// });
// })
// .catch((error) => {
// console.log(error);
// });
},
/**
* todo
@@ -3841,6 +3790,8 @@ export default {
async listFiles() {
const currentFolderIdx = this.nowFolderIndex;
const currentFolder = this.listUserFolders[currentFolderIdx];
const commonFolder = this.listUserFolders.find(f => f.folderName === '公共文件夹');
const commonFolderId = commonFolder && commonFolder.id;
const userId = this.userId;
this.isCommonPage = false;
this.nowFolderId = currentFolder.id; // 设置当前打开工作文件夹ID
@@ -3860,7 +3811,7 @@ export default {
this.isCommonPage = true;
} else if (this.fileindex == 2) { this.fileindex = 0; }

const data = await services.fetchFolderFileList(currentFolder.id, userId);
const data = await services.fetchFolderFileList(currentFolder.id, userId, commonFolderId);
if(!data) return;
const folderResInfo = data;
const folderFileList = this.folderFileList = {
@@ -3972,42 +3923,42 @@ export default {
* 获取协作文件
*/
listCollaborationFiles: function () {
var thisApp = this;
thisApp.nowFolderId =
thisApp.listUserFolders[thisApp.nowFolderIndex].folderID; // 设置当前打开工作文件夹ID
this.$axios({
method: "get",
url: encodeURI(
process.env.API_HOST +
"archives/collaboration/" +
thisApp.nowFolderId +
"/" +
sessionStorage.userId
),
})
.then((response) => {
response.data.data.forEach((arch) => {
if (arch.createTime != null && arch.modifyTime != null) {
arch.createTime = arch.createTime.replace(/T/g, " ");
arch.createTime = arch.createTime.replace(/\+/g, " ");
arch.modifyTime = arch.modifyTime.replace(/T/g, " ");
arch.modifyTime = arch.modifyTime.replace(/\+/g, " ");
}
arch.isShowFile = true;
});
thisApp.myCollFilesList = [];
if (response.data.data != null && response.data.data.length > 0) {
thisApp.myCollFilesList = response.data.data;
}
if (thisApp.myCollFilesList.length > 0) {
this.myCollaborationFilesList = this.myCollFilesList;
} else {
this.myCollaborationFilesList = [];
}
})
.catch((error) => {
console.log(error);
});
// var thisApp = this;
// thisApp.nowFolderId =
// thisApp.listUserFolders[thisApp.nowFolderIndex].folderID; // 设置当前打开工作文件夹ID
// this.$axios({
// method: "get",
// url: encodeURI(
// process.env.API_HOST +
// "archives/collaboration/" +
// thisApp.nowFolderId +
// "/" +
// sessionStorage.userId
// ),
// })
// .then((response) => {
// response.data.data.forEach((arch) => {
// if (arch.createTime != null && arch.modifyTime != null) {
// arch.createTime = arch.createTime.replace(/T/g, " ");
// arch.createTime = arch.createTime.replace(/\+/g, " ");
// arch.modifyTime = arch.modifyTime.replace(/T/g, " ");
// arch.modifyTime = arch.modifyTime.replace(/\+/g, " ");
// }
// arch.isShowFile = true;
// });
// thisApp.myCollFilesList = [];
// if (response.data.data != null && response.data.data.length > 0) {
// thisApp.myCollFilesList = response.data.data;
// }
// if (thisApp.myCollFilesList.length > 0) {
// this.myCollaborationFilesList = this.myCollFilesList;
// } else {
// this.myCollaborationFilesList = [];
// }
// })
// .catch((error) => {
// console.log(error);
// });
},
/**
* 获取公共文件
@@ -4622,9 +4573,10 @@ export default {
*/
clientDownLoad: function (file, type) {
if(!this.isClient) return;
const { ipfsCid, archName: fileName, } = file;
const { ipfsCid, archName: fileName, extension } = file;
const { folderName, levelId, id: folderId } = this.nowFolder;
system.downloadFile(ipfsCid, sessionStorage.projName, fileName, folderName, (resMessage, socketIns) => {
const extensionedFileName = `${fileName}${extension ? `.${extension}`:''}`;
system.downloadFile(ipfsCid, sessionStorage.projName, extensionedFileName, folderName, (resMessage, socketIns) => {
console.log('receive download file message:', resMessage, socketIns);
// {"size":"11","currentSize":"11","unit":"B","process":100,"hash":""}
try {


Laden…
Annuleren
Opslaan