Compare commits

...

2 Commits

Author SHA1 Message Date
duxp d0838394c4 Merge remote-tracking branch 'origin/master' 2023-09-20 11:21:49 +08:00
duxp 85e1feb420 文件调整 2023-09-20 11:21:38 +08:00
6 changed files with 254 additions and 189 deletions

View File

@ -230,58 +230,42 @@
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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>上传附件</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> ');
}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> ');
}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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>重新上传附件</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> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
}
if (row.files && row.status !=='3'){
actions.push('<a 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 class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
$("#bootstrap-table").on('click',".openUpload",function () {
$("#bootstrap-table").on("click",".viewFiles912",function () {
let _id = $(this)[0].dataset.id;
let header = $(this)[0].dataset.header;
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
layer.open({
title:'上传附件',
area:['80%','80%'],
type:2,
content:'/base/affairs/upload',
success(res,index){
//传值
parent.a_upload_id = _id;
parent.a_header = header;
parent.a_deptName = deptName;
parent.a_shotName = shotName;
parent.a_upload_index = index;
parent.a_upload_type = "1";
},
end(){
$.table.search()
}
})
})
$("#bootstrap-table").on("click",".viewFiles912",function () {
let _files = $(this)[0].dataset.files;
layer.open({
title:'查看附件',
title:'上传附件',
area:['80%','90%'],
type:2,
content:'/base/affairs/viewFiles',
success(res,index){
parent.a_upload_obj = {
id:_id,
header:header,
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
}
parent.a_upload_index = index;
parent.a_upload_files = _files;
},
end(){
$.table.search()

View File

@ -255,52 +255,42 @@
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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>上传附件</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> ');
}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> ');
}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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>重新上传附件</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> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
}
if (row.files && row.status !=='3'){
actions.push('<a 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 class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
$("#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",".viewFiles912",function () {
let _id = $(this)[0].dataset.id;
let header = $(this)[0].dataset.header;
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
layer.open({
title:'查看附件',
title:'上传附件',
area:['80%','90%'],
type:2,
content:'/base/affairs/viewFiles',
success(res,index){
parent.a_upload_obj = {
id:_id,
header:header,
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
}
parent.a_upload_index = index;
parent.a_upload_files = _files;
},
end(){
$.table.search()

View File

@ -224,52 +224,42 @@
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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>上传附件</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> ');
}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> ');
}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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>重新上传附件</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> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
}
if (row.files && row.status !=='3'){
actions.push('<a 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 class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
$("#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",".viewFiles912",function () {
let _id = $(this)[0].dataset.id;
let header = $(this)[0].dataset.header;
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
layer.open({
title:'查看附件',
title:'上传附件',
area:['80%','90%'],
type:2,
content:'/base/affairs/viewFiles',
success(res,index){
parent.a_upload_obj = {
id:_id,
header:header,
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
}
parent.a_upload_index = index;
parent.a_upload_files = _files;
},
end(){
$.table.search()

View File

@ -6,22 +6,15 @@
.pre_view{
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 10px;
position: relative;
}
.pdf_pre_view{
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(61, 61, 61, 0.47);
top: 0;
left: 0;
display: none;
}
.pre_view_list{
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 10px;
height: 80vh;
overflow-y: auto;
margin-top: 10px;
border:1px solid #e3e3e3;
border-radius: 8px;
display: flex;
@ -56,35 +49,86 @@
display: flex;
justify-content: center;
}
.upload_input{
margin-bottom: 10px;
}
.err_tips{
font-size: 14px;
color: #e32525;
}
.no_data{
margin-top: 4%;
width: 100%;
font-size: 16px;
color: #5d5d5d;
text-align: center;
}
</style>
</head>
<body>
<div class="pre_view">
<div class="upload_btn">
<div class="upload_input">
<input type="file" multiple="multiple" />
</div>
<span class="err_tips"></span>
</div>
<div class="pre_view_list"></div>
<div style="width: 96%;margin: 10px auto 0;text-align: right">
<span class="btn btn-primary submit_files">保存</span>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
setTimeout(function () {
let _files = parent.parent.a_upload_files.split(',');
//初始化文件列表
let _file_list_str = "";
//限制文件的数据格式
let _typeArr = ['jpg','png','pdf','docx','xlsx','xls','zip','rar','7z'];
//传过来的参数
let _data= parent.parent.a_upload_obj;
let _closeIndex = parent.parent.a_upload_index;
let _files;
if(_data.files === 'null' || !_data.files){
_files = [];
}else{
_files = _data.files.split(',');
}
//重新编译的新文件数组
let _newFilesArr = [];
_files.forEach((item,index) => {
let _nameFile = item.substr(item.lastIndexOf('/')+1,item.length-1);
if(item.indexOf('png') > -1 || item.indexOf('jpg')>-1){
_file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="'+window.location.origin+item+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item+'" class="btn btn-primary btn-xs down_load_file">下载</span></div></div>';
}else if(item.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+'" class="btn btn-primary btn-xs pre_view_pdf">预览</span><span data-url="'+item+'" 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+'" class="btn btn-primary btn-xs down_load_file">下载</span></div></div>';
}
_newFilesArr.push({
name:item,index:index
})
})
$(".pre_view_list").append(_file_list_str);
//初始化文件列表
initFileList(_newFilesArr);
//选择文件后的事件
$('input[type="file"]').on('change',function(e){
let _files = e.currentTarget.files;
if(_files.length === 0){
$(".err_tips").text("请先选择文件!");
}else{
let _isFlag = false;
_files.forEach(item => {
let _lastNum = item.name.lastIndexOf('.')+1;
let _endType = item.name.substr(_lastNum,item.name.length);
if(!_typeArr.includes(_endType)){
_isFlag = true;
}
})
if(_isFlag){
$(".err_tips").text("文件格式有误上传文件格式以jpg、png、pdf、docx、xlsx、xls、zip、rar、7z为结尾");
$(this).val("");
}else{
$(".err_tips").text("");
_files.forEach(item => {
uploadFileFn(item)
})
}
}
});
//PDF文件进行预览查看
$(".pre_view_list").on("click",'.pre_view_pdf',function () {
@ -116,6 +160,98 @@
a.click();
document.body.removeChild(a);
});
//文件删除
$(".pre_view_list").on('click','.del_file',function () {
let _index = $(this).attr('data-index');
_newFilesArr.forEach((item,index) => {
if(String(item.index) === _index){
_newFilesArr.splice(index,1);
}
})
_newFilesArr.forEach((item,index) => {
item.index = index;
})
initFileList(_newFilesArr);
})
//保存文件
$(".submit_files").click(function () {
let _filsArr = [];
_newFilesArr.forEach(item => {
_filsArr.push(item.name);
})
let _submitData = {
id:_data.id,
header:_data.header,
deptName:_data.deptName,
shotName:_data.shotName,
files:_filsArr.join(',')
}
$.ajax({
url:_data.url,
type:'post',
dataType:'json',
data:_submitData,
success(res){
if(res.code === 0){
layer.msg('保存成功', {icon: 1});
setTimeout(function () {
parent.layer.close(_closeIndex);
},1000)
}
}
})
})
//渲染文件列表的方法
function initFileList(data){
$(".pre_view_list").empty();
let _file_list_str = "";
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"><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>';
}
})
}
$(".pre_view_list").append(_file_list_str);
}
//上传附件的方法
function uploadFileFn(_file){
let _formData = new FormData();
_formData.append("file",_file);
$.ajax({
url:'/common/upload',
type:'POST',
data:_formData,
processData:false,
contentType:false,
success:function (res) {
_newFilesArr.push({
name:res.fileName,index:_newFilesArr.length
})
initFileList(_newFilesArr);
},
error:function () {
}
})
}
}, 500)
</script>
</body>

View File

@ -171,16 +171,12 @@
formatter: function(value, row, index) {
var actions = [];
if (row.status === '1'){
actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.upload(\'' + row.id + '\')"><i class="fa fa-edit"></i>上传附件</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> ');
}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> ');
}else if (row.status === '3'){
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)">已驳回</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.upload(\'' + row.id + '\')"><i class="fa fa-edit"></i>重新上传附件</a> ');
}
if (row.files && row.status !=='3'){
actions.push('<a data-files="'+row.files+'" data-type="1" class="viewFiles0828 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-picture-o"></i>查看图片</a> ');
actions.push('<a data-files="'+row.files+'" data-type="2" class="viewFiles0828 btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-download"></i>下载附件</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> ');
}
return actions.join('');
}
@ -225,54 +221,33 @@
}
})
})
$("#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);
$("#bootstrap-table").on("click",".viewFiles912",function () {
let _id = $(this)[0].dataset.id;
let header = $(this)[0].dataset.header;
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
layer.open({
title:'上传附件',
area:['80%','90%'],
type:2,
content:'/base/affairs/viewFiles',
success(res,index){
parent.a_upload_obj = {
id:_id,
header:header,
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
}
parent.a_upload_index = index;
},
end(){
$.table.search()
}
})
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);
})
}
});
})
});

View File

@ -249,52 +249,42 @@
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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>上传附件</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> ');
}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> ');
}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+'" class="openUpload btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)"><i class="fa fa-upload"></i>重新上传附件</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> ');
}else if (row.status === '4'){
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)">已完成</a> ');
}
if (row.files && row.status !=='3'){
actions.push('<a 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 class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
$("#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",".viewFiles912",function () {
let _id = $(this)[0].dataset.id;
let header = $(this)[0].dataset.header;
let deptName = $(this)[0].dataset.deptname;
let shotName = $(this)[0].dataset.shotname;
let _files = $(this)[0].dataset.files;
layer.open({
title:'查看附件',
title:'上传附件',
area:['80%','90%'],
type:2,
content:'/base/affairs/viewFiles',
success(res,index){
parent.a_upload_obj = {
id:_id,
header:header,
deptName:deptName,
shotName:shotName,
files:_files,
url:'/base/affairs/commit'
}
parent.a_upload_index = index;
parent.a_upload_files = _files;
},
end(){
$.table.search()