|
@@ -4695,6 +4695,31 @@ $(document).ready(function() {
|
|
|
$(this).find('input:checkbox').prop("checked", isCheck);
|
|
|
})
|
|
|
});
|
|
|
+ $('body').on('click', 'a[name=att-delete]', function() {
|
|
|
+ const fid = this.getAttribute('file-id');
|
|
|
+ if (!fid) return;
|
|
|
+
|
|
|
+ const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
|
|
|
+ const data = {id: fid};
|
|
|
+ postData('/tender/' + tender.id + '/ledger/delete/file', data, function (result) {
|
|
|
+ // 删除到attData中
|
|
|
+ const att_index = attData.findIndex(function (item) {
|
|
|
+ return item.id === parseInt(fid);
|
|
|
+ });
|
|
|
+ attData.splice(att_index, 1);
|
|
|
+ // 重新生成List
|
|
|
+
|
|
|
+ if ($('#alllist-table tr').length === 1) {
|
|
|
+ getAllList(parseInt($('#currentPage').text()) - 1);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ getAllList(parseInt($('#currentPage').text()));
|
|
|
+ }
|
|
|
+ getNodeList(node.id);
|
|
|
+ $('#showAttachment').hide();
|
|
|
+ $('#showAttachment').attr('file-id', '');
|
|
|
+ });
|
|
|
+ })
|
|
|
});
|
|
|
// 生成当前节点列表
|
|
|
function getNodeList(node) {
|
|
@@ -4702,12 +4727,18 @@ function getNodeList(node) {
|
|
|
for(const att of attData) {
|
|
|
if (node === att.lid) {
|
|
|
// html += '<tr><td><a href="javascript:void(0)" file-id="'+ att.id +'">'+ att.filename + att.fileext +'</a></td><td>'+ att.username +'</td></tr>';
|
|
|
+ const delHtml = deleteFilePermission && parseInt(cur_uid) === att.uid
|
|
|
+ ? `<a class="ml-1 text-danger" href="javascript:void(0)" name="att-delete" file-id="${att.id}"><i class="fa fa-close" title="删除"></i></a>`
|
|
|
+ : '';
|
|
|
html += `<tr>
|
|
|
<td width="25"><input type="checkbox" class="check-file" file-id=${att.id}></td>
|
|
|
<td>
|
|
|
<div class="d-flex">
|
|
|
- <a href="javascript:void(0)" class="pl-0 col-11 att-file-name" file-id=${att.id}>${att.filename}${att.fileext}</a>
|
|
|
- <a href="/tender/${tender.id}/ledger/download/file/${att.id}" class="col-1 pl-0 att-file-btn"><i class="fa fa-download"></i></a>
|
|
|
+ <a href="javascript:void(0)" class="pl-0 col-10 att-file-name" file-id=${att.id}>${att.filename}${att.fileext}</a>
|
|
|
+ <div class="att-file-btn col-2">
|
|
|
+ <a href="/tender/${tender.id}/ledger/download/file/${att.id}" class="pl-0"><i class="fa fa-download"></i></a>
|
|
|
+ ${delHtml}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</td><td>${att.username}</td></tr>`
|
|
|
}
|
|
@@ -4734,12 +4765,18 @@ function getAllList(currPageNum = 1) {
|
|
|
currPageFileData = currPageAttData;
|
|
|
let html = '';
|
|
|
for(const att of currPageAttData) {
|
|
|
+ const delHtml = deleteFilePermission && parseInt(cur_uid) === att.uid
|
|
|
+ ? `<a class="ml-1 text-danger" href="javascript:void(0)" name="att-delete" file-id="${att.id}"><i class="fa fa-close" title="删除"></i></a>`
|
|
|
+ : '';
|
|
|
html += `<tr>
|
|
|
<td width="25"><input type="checkbox" class="check-file" file-id=${att.id}></td>
|
|
|
<td>
|
|
|
<div class="d-flex">
|
|
|
- <a href="javascript:void(0)" class="pl-0 col-11 att-file-name" file-id=${att.id}>${att.filename}${att.fileext}</a>
|
|
|
- <a href="/tender/${tender.id}/ledger/download/file/${att.id}" class="col-1 pl-0 att-file-btn"><i class="fa fa-download"></i></a>
|
|
|
+ <a href="javascript:void(0)" class="pl-0 col-10 att-file-name" file-id=${att.id}>${att.filename}${att.fileext}</a>
|
|
|
+ <div class="att-file-btn col-2">
|
|
|
+ <a href="/tender/${tender.id}/ledger/download/file/${att.id}" class="pl-0"><i class="fa fa-download"></i></a>
|
|
|
+ ${delHtml}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</td><td>${att.username}</td></tr>`
|
|
|
}
|