|
@@ -47,13 +47,13 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
_getFileHtml(file) {
|
|
_getFileHtml(file) {
|
|
const html = [];
|
|
const html = [];
|
|
- html.push('<tr>');
|
|
|
|
- html.push(`<tr><td><input type="checkbox" name="bd-check" fid="${file.id}"></td>`);
|
|
|
|
- const editHtml = file.canEdit ? '<a href="javascript: void(0);" class="mr-1"><i class="fa fa-pencil fa-fw"></i></a>' : '';
|
|
|
|
|
|
+ html.push(`<tr fid="${file.id}">`);
|
|
|
|
+ html.push(`<td><input type="checkbox" name="bd-check" fid="${file.id}"></td>`);
|
|
|
|
+ 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 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 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"><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>${file.filename}${file.fileext}</div><div class="btn-group-table" style="display: none;">${editHtml}${viewHtml}${downHtml}${delHtml}</div></div></td>`);
|
|
|
|
|
|
+ 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>` : '';
|
|
|
|
+ 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>${file.user_name}</td>`);
|
|
html.push(`<td>${moment(file.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>`);
|
|
html.push(`<td>${moment(file.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>`);
|
|
html.push(`<td>${file.fileext_str}</td>`);
|
|
html.push(`<td>${file.fileext_str}</td>`);
|
|
@@ -63,7 +63,10 @@ $(document).ready(function() {
|
|
refreshFilesTable() {
|
|
refreshFilesTable() {
|
|
const html = [];
|
|
const html = [];
|
|
const files = this.curFiling.source_node.files;
|
|
const files = this.curFiling.source_node.files;
|
|
- if (!files || files.length === 0) return;
|
|
|
|
|
|
+ if (!files || files.length === 0) {
|
|
|
|
+ $('#file-list').html('');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
const startIndex = (this.curPage - 1)*this.pageCount;
|
|
const startIndex = (this.curPage - 1)*this.pageCount;
|
|
const endIndex = this.curPage*this.pageCount;
|
|
const endIndex = this.curPage*this.pageCount;
|
|
@@ -193,6 +196,24 @@ $(document).ready(function() {
|
|
if (callback) callback();
|
|
if (callback) callback();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ renameFile(fileId, filename) {
|
|
|
|
+ const file = filingObj.curFiling.source_node.files.find(x => { return x.id === fileId });
|
|
|
|
+ if (!file) return;
|
|
|
|
+
|
|
|
|
+ const filenameDiv = $(`[name=filename][fid=${fileId}]`);
|
|
|
|
+ if (filename === file.filename + file.fileext) {
|
|
|
|
+ filenameDiv.html(file.filename + file.fileext);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ postData('file/save', { id: fileId, filename }, function(data) {
|
|
|
|
+ file.filename = data.filename;
|
|
|
|
+ file.fileext = data.fileext;
|
|
|
|
+ filenameDiv.html(file.filename + file.fileext);
|
|
|
|
+ }, function() {
|
|
|
|
+ filenameDiv.html(file.filename + file.fileext);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
relaFiles(files, callback) {
|
|
relaFiles(files, callback) {
|
|
postData('file/rela', { filing_id: this.curFiling.id, files: files }, async function(data) {
|
|
postData('file/rela', { filing_id: this.curFiling.id, files: files }, async function(data) {
|
|
filingObj.curFiling.source_node.files.unshift(...data.files);
|
|
filingObj.curFiling.source_node.files.unshift(...data.files);
|
|
@@ -378,6 +399,23 @@ $(document).ready(function() {
|
|
$('body').on('mouseleave', ".table-file", function(){
|
|
$('body').on('mouseleave', ".table-file", function(){
|
|
$(this).children(".btn-group-table").css("display","none");
|
|
$(this).children(".btn-group-table").css("display","none");
|
|
});
|
|
});
|
|
|
|
+ $('body').on('click', "a[name=del-file]", function() {
|
|
|
|
+ const del = [this.getAttribute('fid')];
|
|
|
|
+ filingObj.delFiles(del);
|
|
|
|
+ });
|
|
|
|
+ $('body').on('click', "a[name=edit-file]", function() {
|
|
|
|
+ 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}">`);
|
|
|
|
+ });
|
|
|
|
+ $('body').on('blur', "input[fid]", function() {
|
|
|
|
+ filingObj.renameFile(this.getAttribute('fid'), this.value);
|
|
|
|
+ });
|
|
|
|
+ $('body').on('keypress', "input[fid]", function(e) {
|
|
|
|
+ if (e.keyCode == 13) {
|
|
|
|
+ filingObj.renameFile(this.getAttribute('fid'), this.value);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
$('.page-select').click(function() {
|
|
$('.page-select').click(function() {
|
|
const content = this.getAttribute('content');
|
|
const content = this.getAttribute('content');
|
|
switch(content) {
|
|
switch(content) {
|