|
@@ -122,12 +122,15 @@ function getAllList(currPageNum = 1) {
|
|
|
let html = '';
|
|
|
// '/tender/' + tender.id + '/measure/stage/' + stage.order + '/download/file/' + att.id
|
|
|
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}/measure/stage/${stage.order}/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>`
|
|
|
}
|
|
@@ -135,20 +138,23 @@ function getAllList(currPageNum = 1) {
|
|
|
$('#alllist-table').on('click', 'tr', function() {
|
|
|
$('#alllist-table tr').removeClass('bg-light')
|
|
|
$(this).addClass('bg-light')
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
// 生成当前节点列表
|
|
|
function getNodeList(node) {
|
|
|
let html = '';
|
|
|
for(const att of attData) {
|
|
|
if (node === att.lid) {
|
|
|
+ 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><a href="javascript:void(0)" file-id="'+ att.id +'">'+ att.filename + att.fileext +'</a></td><td>'+ att.username +'</td></tr>';
|
|
|
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}/measure/stage/${stage.order}/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>`
|
|
|
}
|
|
@@ -3151,7 +3157,7 @@ $(document).ready(() => {
|
|
|
let html = [];
|
|
|
if (data.attachment) {
|
|
|
for (const att of data.attachment) {
|
|
|
- const delHtml = (parseInt(att.uid) === userID && (att.renew || stage.status !== auditConst.status.checked))
|
|
|
+ const delHtml = (parseInt(att.uid) === userID && (att.renew || stage.status !== auditConst.status.checked || deleteFilePermission))
|
|
|
? '<a class="delete-att text-danger ml-1" href="javascript:void(0);" data-imid="'+ data.att_uuid +'" data-attid="'+ att.file_id +'" title="删除"><i class="fa fa-remove "></i></a>'
|
|
|
: '';
|
|
|
const viewHtml = att.viewpath ? `<a class="ml-1" href="${att.viewpath}" target="_blank" title="预览"><i class="fa fa-eye"></i></a>` : '';
|
|
@@ -5320,6 +5326,31 @@ $(document).ready(() => {
|
|
|
stageAssistRela.refreshAssistTable();
|
|
|
});
|
|
|
});
|
|
|
+ $('body').on('click', 'a[name=att-delete]', function() {
|
|
|
+ const fid = this.getAttribute('file-id');
|
|
|
+ if (!fid) return;
|
|
|
+
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ const data = {id: fid};
|
|
|
+ postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/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 makeOneShouFang(sf) {
|
|
|
const lData = _.find(ledgerData, { id: sf.lid });
|