增加查看附件的功能
This commit is contained in:
parent
940ad0168e
commit
6ba9003caf
|
@ -6,7 +6,6 @@ import java.util.Map;
|
||||||
import com.cyx.common.annotation.Log;
|
import com.cyx.common.annotation.Log;
|
||||||
import com.cyx.common.core.controller.BaseController;
|
import com.cyx.common.core.controller.BaseController;
|
||||||
import com.cyx.common.core.domain.AjaxResult;
|
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.core.page.TableDataInfo;
|
||||||
import com.cyx.common.enums.BusinessType;
|
import com.cyx.common.enums.BusinessType;
|
||||||
import com.cyx.common.utils.poi.ExcelUtil;
|
import com.cyx.common.utils.poi.ExcelUtil;
|
||||||
|
|
|
@ -7,7 +7,7 @@ ruoyi:
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2023
|
copyrightYear: 2023
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: false
|
demoEnabled: true
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/ruoyi/uploadPath
|
profile: D:/ruoyi/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
|
@ -16,7 +16,7 @@ ruoyi:
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为80
|
# 服务器的HTTP端口,默认为80
|
||||||
port: 8088
|
port: 8101
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /
|
||||||
|
|
|
@ -121,6 +121,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.events+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.events+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
|
@ -146,7 +148,54 @@
|
||||||
$.table.search()
|
$.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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -105,6 +105,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.events+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.events+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
|
|
||||||
|
@ -132,7 +134,54 @@
|
||||||
$.table.search()
|
$.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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -177,6 +177,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
|
|
||||||
|
@ -187,7 +189,7 @@
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
$("#bootstrap-table").on('click','.openUpload',function () {
|
$("#bootstrap-table").on('click',".openUpload",function () {
|
||||||
let _id = $(this)[0].dataset.id;
|
let _id = $(this)[0].dataset.id;
|
||||||
layer.open({
|
layer.open({
|
||||||
title:'上传附件',
|
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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -185,6 +185,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
|
|
||||||
|
@ -212,7 +214,72 @@
|
||||||
$.table.search()
|
$.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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -177,6 +177,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
|
|
||||||
|
@ -204,7 +206,72 @@
|
||||||
$.table.search()
|
$.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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="font-noraml">多文件上传</label>
|
<label class="font-noraml">多文件上传</label>
|
||||||
<div class="file-loading">
|
<div class="file-loading">
|
||||||
<input id="multipleFile" multiple name="files" type="file">
|
<input id="multipleFile" multiple name="files" type="file" accept="image/*,.pdf,.xls,.xlsx,.docx,.doc">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,9 @@
|
||||||
uploadAsync: false,
|
uploadAsync: false,
|
||||||
layoutTemplates: {
|
layoutTemplates: {
|
||||||
actionUpload:''
|
actionUpload:''
|
||||||
}
|
},
|
||||||
|
allowedFileExtensions:['jpg','png','pdf','docx','doc','xlsx','xls'],
|
||||||
|
// allowedFileExtensions: "image/*,.pdf,.xls,.xlsx,.docx,.doc", //接收的文件后缀
|
||||||
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
||||||
let _type = parent.parent.a_upload_type;
|
let _type = parent.parent.a_upload_type;
|
||||||
let _url = _type === '1'?'/base/affairs/edit':'/base/advancedparty/edit';
|
let _url = _type === '1'?'/base/affairs/edit':'/base/advancedparty/edit';
|
||||||
|
|
|
@ -161,6 +161,8 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="1" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>查看图片</a> ');
|
||||||
|
actions.push('<a data-files="'+row.files+'" data-type="2" class="viewFiles0828 btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>下载文件</a> ');
|
||||||
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
actions.push('<a data-id="'+row.id+'" class="openUpload btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>上传附件</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
|
||||||
|
|
||||||
|
@ -188,7 +190,72 @@
|
||||||
$.table.search()
|
$.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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue