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 cc014f3..6ba4546 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 @@ -7,7 +7,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 e0d247a..9e1201d 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 898ebf1..9be8f7a 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 2f16a0f..a78be16 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/affairs.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/affairs.html @@ -185,6 +185,10 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); + actions.push('上传附件 '); + actions.push('查看详情 '); if (row.status === '1'){ actions.push('上传附件 '); }else if (row.status === '2'){ @@ -204,7 +208,7 @@ }] }; $.table.init(options); - $("#bootstrap-table").on('click','.openUpload',function () { + $("#bootstrap-table").on('click',".openUpload",function () { let _id = $(this)[0].dataset.id; let header = $(this)[0].dataset.header; let deptName = $(this)[0].dataset.deptname; @@ -228,8 +232,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 0db143b..3360b17 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/day.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/day.html @@ -189,6 +189,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -216,7 +218,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 ae94f6f..5434b93 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/partystyle.html @@ -186,6 +186,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -213,7 +215,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 574b75e..4d14ad2 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/commit':'/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 2871dd3..cddf4ed 100644 --- a/cyx-admin/src/main/resources/templates/base/affairs/year.html +++ b/cyx-admin/src/main/resources/templates/base/affairs/year.html @@ -165,6 +165,8 @@ align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push('查看图片 '); + actions.push('下载文件 '); actions.push('上传附件 '); actions.push('查看详情 '); @@ -192,7 +194,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); + }) + } + }); });