From 6ba9003cafb0ca00f89db6f6f58edcf13ffa764b Mon Sep 17 00:00:00 2001 From: duxp Date: Mon, 28 Aug 2023 15:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E7=9C=8B=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TAmentPartyAffairsController.java | 1 - cyx-admin/src/main/resources/application.yml | 4 +- .../base/advanceddept/advanceddept.html | 51 +++++++++++++- .../base/advancedparty/advancedparty.html | 51 +++++++++++++- .../templates/base/affairs/affairs.html | 52 +++++++++++++- .../resources/templates/base/affairs/day.html | 67 +++++++++++++++++++ .../templates/base/affairs/partystyle.html | 67 +++++++++++++++++++ .../templates/base/affairs/upload.html | 6 +- .../templates/base/affairs/year.html | 67 +++++++++++++++++++ 9 files changed, 357 insertions(+), 9 deletions(-) diff --git a/cyx-admin/src/main/java/com/cyx/web/base/controller/TAmentPartyAffairsController.java b/cyx-admin/src/main/java/com/cyx/web/base/controller/TAmentPartyAffairsController.java index 6ab53a4..83f7e48 100644 --- a/cyx-admin/src/main/java/com/cyx/web/base/controller/TAmentPartyAffairsController.java +++ b/cyx-admin/src/main/java/com/cyx/web/base/controller/TAmentPartyAffairsController.java @@ -6,7 +6,6 @@ import java.util.Map; import com.cyx.common.annotation.Log; import com.cyx.common.core.controller.BaseController; import com.cyx.common.core.domain.AjaxResult; -import com.cyx.common.core.domain.entity.SysDept; import com.cyx.common.core.page.TableDataInfo; import com.cyx.common.enums.BusinessType; import com.cyx.common.utils.poi.ExcelUtil; diff --git a/cyx-admin/src/main/resources/application.yml b/cyx-admin/src/main/resources/application.yml index 93365ec..c53bd27 100644 --- a/cyx-admin/src/main/resources/application.yml +++ b/cyx-admin/src/main/resources/application.yml @@ -7,7 +7,7 @@ ruoyi: # 版权年份 copyrightYear: 2023 # 实例演示开关 - demoEnabled: false + demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 @@ -16,7 +16,7 @@ ruoyi: # 开发环境配置 server: # 服务器的HTTP端口,默认为80 - port: 8088 + port: 8101 servlet: # 应用的访问路径 context-path: / diff --git a/cyx-admin/src/main/resources/templates/base/advanceddept/advanceddept.html b/cyx-admin/src/main/resources/templates/base/advanceddept/advanceddept.html index e2af08b..401603b 100644 --- a/cyx-admin/src/main/resources/templates/base/advanceddept/advanceddept.html +++ b/cyx-admin/src/main/resources/templates/base/advanceddept/advanceddept.html @@ -121,6 +121,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); // actions.push('删除'); @@ -146,7 +148,54 @@ $.table.search() } }) - }) + }); + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); }); diff --git a/cyx-admin/src/main/resources/templates/base/advancedparty/advancedparty.html b/cyx-admin/src/main/resources/templates/base/advancedparty/advancedparty.html index 13464b1..db5b101 100644 --- a/cyx-admin/src/main/resources/templates/base/advancedparty/advancedparty.html +++ b/cyx-admin/src/main/resources/templates/base/advancedparty/advancedparty.html @@ -105,6 +105,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -132,7 +134,54 @@ $.table.search() } }) - }) + }); + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); }); diff --git a/cyx-admin/src/main/resources/templates/base/affairs/affairs.html b/cyx-admin/src/main/resources/templates/base/affairs/affairs.html index e4c387c..f2c652b 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/affairs.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/affairs.html @@ -177,6 +177,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -187,7 +189,7 @@ }] }; $.table.init(options); - $("#bootstrap-table").on('click','.openUpload',function () { + $("#bootstrap-table").on('click',".openUpload",function () { let _id = $(this)[0].dataset.id; layer.open({ title:'上传附件', @@ -205,8 +207,54 @@ } }) }) + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); }); - \ No newline at end of file diff --git a/cyx-admin/src/main/resources/templates/base/affairs/day.html b/cyx-admin/src/main/resources/templates/base/affairs/day.html index 3083fca..59e20a2 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/day.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/day.html @@ -185,6 +185,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -212,7 +214,72 @@ $.table.search() } }) + }); + $("#bootstrap-table").on('click',".openUpload",function () { + let _id = $(this)[0].dataset.id; + layer.open({ + title:'上传附件', + area:['80%','80%'], + type:2, + content:'/base/affairs/upload', + success(res,index){ + //传值 + parent.a_upload_id = _id; + parent.a_upload_index = index; + parent.a_upload_type = "1"; + }, + end(){ + $.table.search() + } + }) }) + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); }); diff --git a/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html b/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html index 7ac59d9..f2f9f39 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html @@ -177,6 +177,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -204,7 +206,72 @@ $.table.search() } }) + }); + $("#bootstrap-table").on('click',".openUpload",function () { + let _id = $(this)[0].dataset.id; + layer.open({ + title:'上传附件', + area:['80%','80%'], + type:2, + content:'/base/affairs/upload', + success(res,index){ + //传值 + parent.a_upload_id = _id; + parent.a_upload_index = index; + parent.a_upload_type = "1"; + }, + end(){ + $.table.search() + } + }) }) + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); }); diff --git a/cyx-admin/src/main/resources/templates/base/affairs/upload.html b/cyx-admin/src/main/resources/templates/base/affairs/upload.html index 1a8317a..d02b798 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/upload.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/upload.html @@ -13,7 +13,7 @@
- +
@@ -31,7 +31,9 @@ uploadAsync: false, layoutTemplates: { actionUpload:'' - } + }, + allowedFileExtensions:['jpg','png','pdf','docx','doc','xlsx','xls'], + // allowedFileExtensions: "image/*,.pdf,.xls,.xlsx,.docx,.doc", //接收的文件后缀 }).on('filebatchuploadsuccess', function (event, data, previewId, index) { let _type = parent.parent.a_upload_type; let _url = _type === '1'?'/base/affairs/edit':'/base/advancedparty/edit'; diff --git a/cyx-admin/src/main/resources/templates/base/affairs/year.html b/cyx-admin/src/main/resources/templates/base/affairs/year.html index 9a3ca90..a22fd2d 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/year.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/year.html @@ -161,6 +161,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -188,7 +190,72 @@ $.table.search() } }) + }); + $("#bootstrap-table").on('click',".openUpload",function () { + let _id = $(this)[0].dataset.id; + layer.open({ + title:'上传附件', + area:['80%','80%'], + type:2, + content:'/base/affairs/upload', + success(res,index){ + //传值 + parent.a_upload_id = _id; + parent.a_upload_index = index; + parent.a_upload_type = "1"; + }, + end(){ + $.table.search() + } + }) }) + $("#bootstrap-table").on("click",".viewFiles0828",function () { + let _files = $(this)[0].dataset.files.split(','); + let _type = $(this)[0].dataset.type; + let _dataImg = []; + let _downData = []; + _files.forEach((item,index) => { + if(item.indexOf(".jpg")>-1 || item.indexOf(".png")>-1){ + _dataImg.push({ + "alt": "", + "pid": index, //图片id + "src": window.location.origin+item, //原图地址 + "thumb": window.location.origin+item //缩略图地址 + }) + }else if(item.indexOf(".docx")> -1 || item.indexOf(".doc") > -1 || item.indexOf(".xlsx") > -1 || item.indexOf(".xls") > -1 || item.indexOf(".pdf") > -1){ + _downData.push(item); + } + }) + if(_type === '1'){ //查看图片 + let json = { + "title": "查看图片", //相册标题 + "id": 123, //相册id + "start": 0, //初始显示的图片序号,默认0 + "data": _dataImg + }; + layer.photos({ + photos: json, + closeBtn: 0, //右上角按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0 + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }else{ //下载附件 + if(_downData.length === 0){ + $.modal.msgError('暂无文件!') + return false; + } + _downData.forEach(item => { + let _lastNum = item.lastIndexOf('/')+1; + let _title = item.substr(_lastNum,item.length-1); + const a = document.createElement('a'); + a.style.display = 'none'; + a.download = _title; + a.href = window.location.origin+item; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }) + } + }); });