|
@@ -52,7 +52,7 @@ $(document).ready(function() {
|
|
|
const editHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1" name="edit-file" fid="${file.id}"><i class="fa fa-pencil fa-fw"></i></a>` : '';
|
|
|
const viewHtml = file.viewpath ? `<a href="${file.viewpath}" class="mr-1" target="_blank"><i class="fa fa-eye fa-fw"></i></a>` : '';
|
|
|
const downHtml = `<a href="javascript: void(0);" onclick="AliOss.downloadFile('${file.filepath}', '${file.filename + file.fileext}')" class="mr-1"><i class="fa fa-download fa-fw"></i></a>`;
|
|
|
- const delHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1" name="del-file" fid="${file.id}"><i class="fa fa-trash-o fa-fw"></i></a>` : '';
|
|
|
+ const delHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1 text-danger" name="del-file" fid="${file.id}"><i class="fa fa-trash-o fa-fw"></i></a>` : '';
|
|
|
html.push(`<td><div class="d-flex justify-content-between align-items-center table-file"><div name="filename" fid="${file.id}">${file.filename}${file.fileext}</div><div class="btn-group-table" style="display: none;">${editHtml}${viewHtml}${downHtml}${delHtml}</div></div></td>`);
|
|
|
html.push(`<td>${file.user_name}</td>`);
|
|
|
html.push(`<td>${moment(file.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>`);
|
|
@@ -406,14 +406,18 @@ $(document).ready(function() {
|
|
|
filingObj.delFiles(del);
|
|
|
});
|
|
|
$('body').on('click', "a[name=edit-file]", function() {
|
|
|
+ const check = $('[name=filename] input[fid]');
|
|
|
+ if (check.length > 0 && check[0].getAttribute('fid') === this.getAttribute('fid')) return;
|
|
|
+
|
|
|
const id = this.getAttribute('fid');
|
|
|
const filename = $(`[name=filename][fid=${id}]`);
|
|
|
- filename.html(`<input type="text" class="form-control form-control-sm" maxlength="100" value="${filename[0].innerHTML}" fid="${id}">`);
|
|
|
+ const file = filingObj.curFiling.source_node.files.find(x => { return x.id === id });
|
|
|
+ filename.html(`<input type="text" class="form-control form-control-sm" maxlength="100" value="${file.filename + file.fileext}" fid="${id}">`);
|
|
|
});
|
|
|
- $('body').on('blur', "input[fid]", function() {
|
|
|
+ $('body').on('blur', "[name=filename] input[fid]", function() {
|
|
|
filingObj.renameFile(this.getAttribute('fid'), this.value);
|
|
|
});
|
|
|
- $('body').on('keypress', "input[fid]", function(e) {
|
|
|
+ $('body').on('keypress', "[name=filename] input[fid]", function(e) {
|
|
|
if (e.keyCode == 13) {
|
|
|
filingObj.renameFile(this.getAttribute('fid'), this.value);
|
|
|
}
|