|
@@ -117,16 +117,18 @@ $(document).ready(function () {
|
|
|
})
|
|
|
// 生成所有附件列表
|
|
|
function getAllList(currPageNum = 1) {
|
|
|
+ const isCheckAll = $('#dropdownMenuButton').attr('btn-type') === 'all'
|
|
|
// 未选中checkbox,需要过滤出来当前期的数据
|
|
|
- const filterFileData = fileData && fileData.filter(file => file.mid === parseInt(mid) && file.tid === parseInt(tid))
|
|
|
- const total = calcCount(filterFileData);
|
|
|
+ const filterFileData = fileData && isCheckAll ? fileData : fileData.filter(file => file.mid === parseInt(mid) && file.tid === parseInt(tid))
|
|
|
+ const total = calcCount();
|
|
|
// 总页数
|
|
|
const pageNum = Math.ceil(total/pageCount);
|
|
|
// 当前页附件内容
|
|
|
- const currPageAttData = fileData && $('#dropdownMenuButton').attr('type') === 'all' ? fileData.slice((currPageNum-1)*pageCount, currPageNum*pageCount) : filterFileData.map((v, index) => {
|
|
|
+ const currPageAttData = fileData && isCheckAll ? fileData.slice((currPageNum-1)*pageCount, currPageNum*pageCount) : filterFileData.map((v, index) => {
|
|
|
return {...v, index }
|
|
|
}).slice((currPageNum-1)*pageCount, currPageNum*pageCount);
|
|
|
|
|
|
+ console.log(currPageAttData)
|
|
|
renderHtml(currPageAttData)
|
|
|
// 渲染分页器
|
|
|
renderPagination(currPageNum, pageNum)
|
|
@@ -212,7 +214,7 @@ $(document).ready(function () {
|
|
|
<td>${fileInfo.file_size}</td>
|
|
|
<td>第${fileInfo.s_order}期</td>
|
|
|
<td>${fileInfo.upload_time}</td>`
|
|
|
- if (fileInfo.canDel ) {
|
|
|
+ if (fileInfo.showDel ) {
|
|
|
html += `<td>
|
|
|
<a href="/${fileInfo.filepath}" class="btn btn-light btn-sm" title="下载"><span class="fa fa-download text-primary"></span></a>
|
|
|
<a href="javascript:void(0);" class="btn btn-light btn-sm delete-file" data-attid="${fileInfo.id}" title="删除附件">
|
|
@@ -263,22 +265,26 @@ $(document).ready(function () {
|
|
|
let showDel = false
|
|
|
// 只判断当前期,因为以往期都是只读的
|
|
|
if (file.mid === parseInt(mid) && file.tid === parseInt(tid) && file.user_id === parseInt(cur_uid)) {
|
|
|
+ if (materialStatus === auditConst.status.checked) {
|
|
|
+ showDel = Boolean(file.extra_upload )
|
|
|
+ } else {
|
|
|
+ showDel = true
|
|
|
+ }
|
|
|
// if (!curAuditor) {
|
|
|
// materialStatus === auditConst.status.uncheck && parseInt(cur_uid) === materialUid && (showDel = true)
|
|
|
// materialStatus === auditConst.status.checkNo && parseInt(cur_uid) === materialUid && (showDel = true)
|
|
|
// } else {
|
|
|
// curAuditor.aid === parseInt(cur_uid) && (showDel = true)
|
|
|
// }
|
|
|
- showDel = true
|
|
|
}
|
|
|
- return showDel ? {...file, canDel: true, index} : {...file, index}
|
|
|
+ return {...file, index, showDel}
|
|
|
})
|
|
|
};
|
|
|
|
|
|
function calcCount() {
|
|
|
// 附件总数
|
|
|
let total = fileData && fileData.length;
|
|
|
- if(!$('#file-checkbox').is(':checked')) {
|
|
|
+ if(!$('#dropdownMenuButton').attr('btn-type') === 'all') {
|
|
|
total = fileData && fileData.filter(file => file.mid === parseInt(mid) && file.tid === parseInt(tid)).length
|
|
|
}
|
|
|
return total
|