增加查看附件的功能

This commit is contained in:
duxp 2023-10-09 10:38:45 +08:00
parent 874c814188
commit 9973553975
6 changed files with 76 additions and 35 deletions

View File

@ -242,15 +242,16 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if (row.status === '2'){
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)">待审核</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if(row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
actions.push('<a data-type="view" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看附件</a> ');
}
return actions.join('');
}
@ -263,6 +264,7 @@
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
let _type = $(this)[0].dataset.type;
layer.open({
title:'上传附件',
area:['80%','90%'],
@ -275,7 +277,8 @@
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
url:'/base/affairs/commit',
type:_type
}
parent.a_upload_index = index;
},

View File

@ -267,15 +267,16 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if (row.status === '2'){
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)">待审核</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if(row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
actions.push('<a data-type="view" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看附件</a> ');
}
return actions.join('');
}
@ -288,6 +289,7 @@
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
let _type = $(this)[0].dataset.type;
layer.open({
title:'上传附件',
area:['80%','90%'],
@ -300,7 +302,8 @@
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
url:'/base/affairs/commit',
type:_type
}
parent.a_upload_index = index;
},

View File

@ -236,15 +236,16 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if (row.status === '2'){
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)">待审核</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if(row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
actions.push('<a data-type="view" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看附件</a> ');
}
return actions.join('');
}
@ -257,6 +258,7 @@
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
let _type = $(this)[0].dataset.type;
layer.open({
title:'上传附件',
area:['80%','90%'],
@ -269,7 +271,8 @@
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
url:'/base/affairs/commit',
type:_type
}
parent.a_upload_index = index;
},

View File

@ -100,6 +100,13 @@
})
})
//判断是否是可编辑状态
if(_data.type === 'edit'){
$(".upload_btn").show();
}else{
$(".upload_btn").hide();
}
//初始化文件列表
initFileList(_newFilesArr);
@ -225,22 +232,41 @@
if(data.length === 0){
_file_list_str += '<div class="no_data">暂无数据</div>'
}else{
data.forEach((item,index) => {
let _nameFile = item.name.substr(item.name.lastIndexOf('/')+1,item.name.length-1);
if(item.name.indexOf('png') > -1 || item.name.indexOf('jpg')>-1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left pre_img" data-img="'+item.name+'" style="cursor: pointer"><img src="'+window.location.origin+item.name+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}else if(item.name.indexOf('pdf') > -1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs pre_view_pdf">预览</span><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}else{
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}
})
if(_data.type === 'edit'){
data.forEach((item,index) => {
let _nameFile = item.name.substr(item.name.lastIndexOf('/')+1,item.name.length-1);
if(item.name.indexOf('png') > -1 || item.name.indexOf('jpg')>-1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left pre_img" data-img="'+item.name+'" style="cursor: pointer"><img src="'+window.location.origin+item.name+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}else if(item.name.indexOf('pdf') > -1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs pre_view_pdf">预览</span><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}else{
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}
})
}else{
data.forEach((item,index) => {
let _nameFile = item.name.substr(item.name.lastIndexOf('/')+1,item.name.length-1);
if(item.name.indexOf('png') > -1 || item.name.indexOf('jpg')>-1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left pre_img" data-img="'+item.name+'" style="cursor: pointer"><img src="'+window.location.origin+item.name+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span></div></div>';
}else if(item.name.indexOf('pdf') > -1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs pre_view_pdf">预览</span><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span></div></div>';
}else{
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="/img/file_word.png" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span></div></div>';
}
})
}
}
$(".pre_view_list").append(_file_list_str);
}

View File

@ -212,12 +212,13 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if (row.status === '2'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-score="'+row.score+'" data-updatetime="'+row.updateTime+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-reviewer="'+row.reviewer+'" data-detailed="'+row.detailed+'" data-demand="'+row.demand+'" data-type="'+row.type+'" data-nowscore="'+row.nowScore+'" class="shenhe btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)">审批</a> ');
actions.push('<a data-type="view" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看附件</a> ');
}else if (row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
}
return actions.join('');
}
@ -268,6 +269,7 @@
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
let _type = $(this)[0].dataset.type;
layer.open({
title:'上传附件',
area:['80%','90%'],
@ -280,7 +282,8 @@
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
url:'/base/affairs/commit',
type:_type
}
parent.a_upload_index = index;
},

View File

@ -261,15 +261,16 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if (row.status === '2'){
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)">待审核</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>上传附件</a> ');
}else if(row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
actions.push('<a data-type="edit" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>重新上传附件</a> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
actions.push('<a data-type="view" data-id="'+row.id+'" data-header="'+row.header+'" data-shotname="'+row.shotName+'" data-deptname="'+row.deptName+'" data-files="'+row.files+'" class="viewFiles912 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看附件</a> ');
}
return actions.join('');
}
@ -282,6 +283,7 @@
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
let _type = $(this)[0].dataset.type;
layer.open({
title:'上传附件',
area:['80%','90%'],
@ -294,7 +296,8 @@
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
url:'/base/affairs/commit',
type:_type
}
parent.a_upload_index = index;
},