From f40e9672629a195989004a4ce51c3218258ba9b6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-ESU4BDD\\WeiZhiQiang" <598748873@qq.com> Date: Sat, 17 Feb 2024 23:28:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/fileconsole/fileconsolelist.js | 94 ++++++++++--------- .../js/fileconsole/fileconsoleupload.js | 6 +- .../js/fileconsole/filefolderupload.js | 6 +- .../template/js/fileconsole/recycleBinList.js | 49 +++++----- .../template/js/shareFile/shareFileList.js | 8 +- .../tpl/fileconsole/recycleBinList.html | 2 +- 6 files changed, 89 insertions(+), 76 deletions(-) diff --git a/disk-cloud/src/main/resources/template/js/fileconsole/fileconsolelist.js b/disk-cloud/src/main/resources/template/js/fileconsole/fileconsolelist.js index f984a3399..f4c0abab3 100644 --- a/disk-cloud/src/main/resources/template/js/fileconsole/fileconsolelist.js +++ b/disk-cloud/src/main/resources/template/js/fileconsole/fileconsolelist.js @@ -277,23 +277,22 @@ layui.config({ // 加载目录下的文件 loadThisFolderChild(); } else if ($.inArray(fileType, vedioType) >= 0){//视频 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: $(this).attr("rowid")}, type: 'json', callback: function (json) { - fileUrl = json.bean.fileAddress; - fileThumbnail = json.bean.fileThumbnail; + getFileMation($(this).attr("rowid"), function (file) { + fileUrl = file.address; + fileThumbnail = file.thumbnail; _openNewWindows({ url: "../../tpl/fileconsole/vedioshow.html", - title: json.bean.fileName, + title: file.name, pageId: "vedioShow", area: ['80vw', '80vh'], callBack: function (refreshCode) {}}); - }}); + }); } else if ($.inArray(fileType, officeType) >= 0){//office文件 - var thisId = $(this).attr("rowid"); - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: thisId}, type: 'json', callback: function (json) { - fileUrl = json.bean.fileAddress; - selFileType = json.bean.fileType; - window.open(sysMainMation.homePagePath + "/tpl/fileconsole/officeshow.html?fileUrl=" + fileUrl + "&selFileType=" + selFileType + "&title=" + json.bean.fileName + "&thisId=" + thisId); - }}); + getFileMation($(this).attr("rowid"), function (file) { + fileUrl = file.address; + selFileType = file.type; + window.open(sysMainMation.homePagePath + "/tpl/fileconsole/officeshow.html?fileUrl=" + fileUrl + "&selFileType=" + selFileType + "&title=" + file.name + "&thisId=" + file.id); + }); } else if ($.inArray(fileType, aceType) >= 0){//ace文件 var thisId = $(this).attr("rowid"); _openNewWindows({ @@ -303,30 +302,38 @@ layui.config({ area: ['90vw', '90vh'], callBack: function (refreshCode) {}}); } else if ($.inArray(fileType, epubType) >= 0){//电子书 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: $(this).attr("rowid")}, type: 'json', callback: function (json) { - fileUrl = json.bean.fileAddress; - fileThumbnail = json.bean.fileThumbnail; + getFileMation($(this).attr("rowid"), function (file) { + fileUrl = file.address; + fileThumbnail = file.thumbnail; _openNewWindows({ url: "../../tpl/fileconsole/epubShow.html", - title: json.bean.fileName, + title: file.name, pageId: "epubShow", area: ['90vw', '90vh'], callBack: function (refreshCode) {}}); - }}); + }); } else if ($.inArray(fileType, packageType) >= 0){//压缩包 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: $(this).attr("rowid")}, type: 'json', callback: function (json) { - fileUrl = json.bean.fileAddress; - fileThumbnail = json.bean.fileThumbnail; + getFileMation($(this).attr("rowid"), function (file) { + fileUrl = file.address; + fileThumbnail = file.thumbnail; _openNewWindows({ url: "../../tpl/fileconsole/zipShow.html", - title: '' + json.bean.fileName, + title: '' + file.name, pageId: "epubShow", area: ['630px', '450px'], skin: "zip-show", callBack: function (refreshCode) {}}); - }}); + }); } }); + + function getFileMation(id, callback) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryFileConsoleById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { + if (typeof callback == "function") { + callback(json.bean) + } + }}); + } // 文件夹或者文件重命名 $("body").on("click", ".fileReName", function (e) { @@ -386,7 +393,7 @@ layui.config({ $.each(checkItems, function(i, item) { var checkFile = $(item).parent().parent().parent(); deleteArray.push({ - rowId: checkFile.attr("rowid"), + id: checkFile.attr("rowid"), fileType: checkFile.attr("filetype") }); }); @@ -421,7 +428,7 @@ layui.config({ $(".layui-dropdown-menu").hide(); $(".select-op-more").hide(); var fileType = $("#file-content div[rowid='" + operaterId + "']").attr("filetype"); - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole013", params: {rowId: operaterId}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "insertFileCatalogToRecycle", params: {fileId: operaterId}, type: 'json', method: 'POST', callback: function (json) { winui.window.msg("已放入回收站", {icon: 1, time: 2000}); $("#file-content div[rowid='" + operaterId + "']").remove(); // 如果删除的对象是文件夹 @@ -510,21 +517,20 @@ layui.config({ // 通过onlyoffice打开office文件 $("body").on("click", ".openByOnlyOffice", function (e) { - var thisId = operaterId; $(".layui-dropdown-menu").hide(); - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: thisId}, type: 'json', callback: function (json) { - fileUrl = json.bean.fileAddress; - selFileType = json.bean.fileType; - window.open(sysMainMation.homePagePath + "/tpl/fileconsole/officeshow.html?fileUrl=" + fileUrl + "&selFileType=" + selFileType + "&title=" + json.bean.fileName + "&thisId=" + thisId); - }}); + getFileMation(operaterId, function (file) { + fileUrl = file.address; + selFileType = file.type; + window.open(sysMainMation.homePagePath + "/tpl/fileconsole/officeshow.html?fileUrl=" + fileUrl + "&selFileType=" + selFileType + "&title=" + file.name + "&thisId=" + file.id); + }); }); // 通过微软office打开office文件 $("body").on("click", ".openByMicrosoftOffice", function (e) { $(".layui-dropdown-menu").hide(); - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: operaterId}, type: 'json', callback: function (json) { - window.open('https://view.officeapps.live.com/op/view.aspx?src=http://gzwp.free.idcfengye.com/' + json.bean.fileAddress); - }}); + getFileMation(operaterId, function (file) { + window.open('https://view.officeapps.live.com/op/view.aspx?src=http://gzwp.free.idcfengye.com/' + file.address); + }) }); // 文件或者文件夹下载 @@ -571,14 +577,14 @@ layui.config({ } }}); } else { - //不包含文件夹 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: operaterId}, type: 'json', callback: function (json) { - if($.inArray(json.bean.fileType, imageType) >= 0){//图片 - downloadImage(fileBasePath + json.bean.fileAddress, json.bean.fileName); + // 不包含文件夹 + getFileMation(operaterId, function (file) { + if($.inArray(file.type, imageType) >= 0){//图片 + downloadImage(fileBasePath + file.address, file.name); } else { - download(json.bean.fileAddress, json.bean.fileName); + download(file.address, file.name); } - }}); + }) } }); @@ -713,7 +719,7 @@ layui.config({ layer.confirm("确定将该文件夹及其子文件放入回收站吗?", { icon: 3, title: '回收站' }, function (index) { layer.close(index); var fileType = 'folder'; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole013", params: {rowId: folderId}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "insertFileCatalogToRecycle", params: {fileId: folderId}, type: 'json', method: 'POST', callback: function (json) { winui.window.msg("已放入回收站", {icon: 1, time: 2000}); $("#file-content div[rowid='" + folderId + "']").remove(); var selNode = ztree.getNodeByParam("id", folderId, null); @@ -737,7 +743,7 @@ layui.config({ layer.close(index); var deleteArray = new Array(); deleteArray.push({ - rowId: folderId, + id: folderId, fileType: 'folder' }); deleteFolderAndChild(deleteArray, function() { @@ -1232,7 +1238,7 @@ layui.config({ //加载总文件大小 function loadFileSizeById(){ loadFileSizeCS = true; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole012", params: {}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryAllFileSizeByUserId", params: {}, type: 'json', method: 'GET', callback: function (json) { $(".memory-num").html(json.bean.size); }, async: false}); } @@ -1683,7 +1689,7 @@ layui.config({ //当前分块大小 "chunkSize": block.end - block.start }; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole008", params: params, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryUploadFileChunksByChunkMd5", params: params, type: 'json', method: 'POST', callback: function (json) { //分块存在,跳过 deferred.reject(); }, errorCallback: function (json) { @@ -1697,7 +1703,7 @@ layui.config({ //时间点3:所有分块上传成功后调用此函数 afterSendFile: function (data) { //如果分块上传成功,则通知后台合并分块 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole007", params: {md5: md5, folderId: folderId, name: data.name, size: data.size}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "insertUploadFileChunks", params: {md5: md5, folderId: folderId, name: data.name, size: data.size}, type: 'json', method: 'POST', callback: function (json) { }}); } }); @@ -1719,7 +1725,7 @@ layui.config({ fileSizeLimit: 2000 * 1024 * 1024,//最大2GB fileSingleSizeLimit: 2000 * 1024 * 1024, resize: false,//不压缩 - server: sysMainMation.diskCloudBasePath + 'fileconsole006', + server: sysMainMation.diskCloudBasePath + 'insertUploadFile', fileNumLimit: 300 }); // 添加“添加文件”的按钮, diff --git a/disk-cloud/src/main/resources/template/js/fileconsole/fileconsoleupload.js b/disk-cloud/src/main/resources/template/js/fileconsole/fileconsoleupload.js index e0f9cc536..627c31078 100644 --- a/disk-cloud/src/main/resources/template/js/fileconsole/fileconsoleupload.js +++ b/disk-cloud/src/main/resources/template/js/fileconsole/fileconsoleupload.js @@ -101,7 +101,7 @@ function loadUploadMethod(){ //当前分块大小 "chunkSize": block.end - block.start }; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole008", params: params, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryUploadFileChunksByChunkMd5", params: params, type: 'json', method: 'POST', callback: function (json) { //分块存在,跳过 deferred.reject(); }, errorCallback: function (json) { @@ -115,7 +115,7 @@ function loadUploadMethod(){ //时间点3:所有分块上传成功后调用此函数 afterSendFile: function (data) { //如果分块上传成功,则通知后台合并分块 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole007", params: {md5: md5, folderId: parent.folderId, name: data.name, size: data.size}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "insertUploadFileChunks", params: {md5: md5, folderId: parent.folderId, name: data.name, size: data.size}, type: 'json', method: 'POST', callback: function (json) { }}); } }); @@ -141,7 +141,7 @@ function loadUploadMethod(){ fileSizeLimit: 2000 * 1024 * 1024,//最大2GB fileSingleSizeLimit: 2000 * 1024 * 1024, resize: false,//不压缩 - server: sysMainMation.diskCloudBasePath + 'fileconsole006', + server: sysMainMation.diskCloudBasePath + 'insertUploadFile', fileNumLimit: 300, }); // 添加“添加文件”的按钮, diff --git a/disk-cloud/src/main/resources/template/js/fileconsole/filefolderupload.js b/disk-cloud/src/main/resources/template/js/fileconsole/filefolderupload.js index ef616ca85..0069c7852 100644 --- a/disk-cloud/src/main/resources/template/js/fileconsole/filefolderupload.js +++ b/disk-cloud/src/main/resources/template/js/fileconsole/filefolderupload.js @@ -101,7 +101,7 @@ function loadUploadMethod(){ //当前分块大小 "chunkSize": block.end - block.start }; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole008", params: params, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryUploadFileChunksByChunkMd5", params: params, type: 'json', method: 'POST', callback: function (json) { //分块存在,跳过 deferred.reject(); }, errorCallback: function (json) { @@ -115,7 +115,7 @@ function loadUploadMethod(){ //时间点3:所有分块上传成功后调用此函数 afterSendFile: function (data) { //如果分块上传成功,则通知后台合并分块 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole007", params: {md5: md5, folderId: parent.folderId, name: data.name, size: data.size}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "insertUploadFileChunks", params: {md5: md5, folderId: parent.folderId, name: data.name, size: data.size}, type: 'json', method: 'POST', callback: function (json) { }}); } }); @@ -142,7 +142,7 @@ function loadUploadMethod(){ fileSizeLimit: 2000 * 1024 * 1024,//最大2GB fileSingleSizeLimit: 2000 * 1024 * 1024, resize: false,//不压缩 - server: sysMainMation.diskCloudBasePath + 'fileconsole006', + server: sysMainMation.diskCloudBasePath + 'insertUploadFile', fileNumLimit: 300, }); // 添加“添加文件”的按钮, diff --git a/disk-cloud/src/main/resources/template/js/fileconsole/recycleBinList.js b/disk-cloud/src/main/resources/template/js/fileconsole/recycleBinList.js index 7698a3f0d..874194b29 100644 --- a/disk-cloud/src/main/resources/template/js/fileconsole/recycleBinList.js +++ b/disk-cloud/src/main/resources/template/js/fileconsole/recycleBinList.js @@ -4,10 +4,10 @@ layui.config({ version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui'], function (exports) { +}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) { winui.renderColor(); - var $ = layui.$, + form = layui.form, table = layui.table; table.render({ @@ -15,20 +15,23 @@ layui.config({ elem: '#messageTable', method: 'post', url: sysMainMation.diskCloudBasePath + 'fileconsole014', - where: {}, + where: getTableParams(), even: true, page: true, - limits: [8, 16, 24, 32, 40, 48, 56], - limit: 8, + limits: getLimits(), + limit: getLimit(), cols: [[ { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, - { field: 'recycleName', title: '文件名', width: 150 }, - { field: 'fileType', title: '文件类型', width: 120 }, + { field: 'fileName', title: '文件名', width: 150 }, + { field: 'fileTypeName', title: '文件类型', width: 120 }, { field: 'createTime', title: '删除时间', width: 180 }, { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar'} ]], done: function(json) { matchingLanguage(); + initTableSearchUtil.initAdvancedSearch(this, res.searchFilter, form, "请输入文件/文件夹名称", function () { + table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); + }); } }); @@ -36,31 +39,35 @@ layui.config({ var data = obj.data; var layEvent = obj.event; if (layEvent === 'reduction') { //还原 - reduction(data, obj); + reduction(data); } }); - //还原 - function reduction(data, obj){ - var msg = '确认还原' + obj.data.fileType + '【' + obj.data.recycleName + '】吗?'; + // 还原 + function reduction(data){ + var msg = '确认还原' + data.fileTypeName + '【' + data.fileName + '】吗?'; layer.confirm(msg, { icon: 3, title: '还原文件' }, function (index) { layer.close(index); parent.refreshCode = '0'; - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole015", params: {rowId: data.id}, type: 'json', callback: function (json) { + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "deleteFileRecycleBinById", params: {id: data.id}, type: 'json', method: 'DELETE', callback: function (json) { winui.window.msg("还原成功", {icon: 1, time: 2000}); loadTable(); }}); }); } - - //刷新数据 - $("body").on("click", "#reloadTable", function() { - loadTable(); - }); - - function loadTable() { - table.reloadData("messageTable", {where:{}}); - } + + form.render(); + $("body").on("click", "#reloadTable", function() { + loadTable(); + }); + + function loadTable() { + table.reloadData("messageTable", {where: getTableParams()}); + } + + function getTableParams() { + return $.extend(true, {}, initTableSearchUtil.getSearchValue("messageTable")); + } exports('recycleBinListPage', {}); }); diff --git a/disk-cloud/src/main/resources/template/js/shareFile/shareFileList.js b/disk-cloud/src/main/resources/template/js/shareFile/shareFileList.js index ca57de6fa..ebd7495aa 100644 --- a/disk-cloud/src/main/resources/template/js/shareFile/shareFileList.js +++ b/disk-cloud/src/main/resources/template/js/shareFile/shareFileList.js @@ -123,11 +123,11 @@ layui.config({ if(fileType === 'folder'){//文件夹 winui.window.msg('暂不提供文件夹的下载。', {icon: 2, time: 2000}); } else {//文件 - AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "fileconsole009", params: {rowId: operaterId}, type: 'json', callback: function (json) { - if($.inArray(json.bean.fileType, imageType) >= 0){//图片 - downloadImage(fileBasePath + json.bean.fileAddress, json.bean.fileName); + AjaxPostUtil.request({url: sysMainMation.diskCloudBasePath + "queryFileConsoleById", params: {id: operaterId}, type: 'json', method: 'GET', callback: function (json) { + if($.inArray(json.bean.type, imageType) >= 0){//图片 + downloadImage(fileBasePath + json.bean.address, json.bean.name); } else { - download(fileBasePath + json.bean.fileAddress, json.bean.fileName); + download(fileBasePath + json.bean.address, json.bean.name); } }}); } diff --git a/disk-cloud/src/main/resources/template/tpl/fileconsole/recycleBinList.html b/disk-cloud/src/main/resources/template/tpl/fileconsole/recycleBinList.html index 5204e69f9..5ad062481 100644 --- a/disk-cloud/src/main/resources/template/tpl/fileconsole/recycleBinList.html +++ b/disk-cloud/src/main/resources/template/tpl/fileconsole/recycleBinList.html @@ -9,7 +9,7 @@
- +
-- GitLab