增加菜单到导出和导入;增加粘贴全局操作;优化表单错误表现;

This commit is contained in:
augushong
2024-10-15 16:06:36 +08:00
parent b04321e380
commit 008e781d6b
8 changed files with 185 additions and 3 deletions

View File

@@ -171,7 +171,12 @@
}
},
error: function (xhr, textstatus, thrown) {
admin.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!', function () {
var errorMsg = '';
if(xhr.responseJSON.message){
errorMsg = xhr.responseJSON.message;
}
loading.hide();
admin.msg.error('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!<br/>'+errorMsg, function () {
ex(this);
});
return false;
@@ -1570,6 +1575,9 @@
// 监听点击复制
admin.api.copyText();
// 监听点击粘贴
admin.api.pasteText();
// 监听tab操作
miniTab.listen();
@@ -2414,6 +2422,33 @@
});
});
},
pasteText(elem) {
if (elem == undefined) {
elem = 'body';
}
var list = $(elem).find('[data-toggle="paste-text"]');
$.each(list, function (i, v) {
if ($(v).hasClass('paste-rendered')) {
return false;
}
$(v).addClass('paste-rendered');
var targetElemName = $(v).data('paste-target');
$(v).on('click', function () {
navigator.clipboard.readText()
.then(text => {
$(targetElemName).val(text);
layer.msg('粘贴成功');
})
.catch(err => {
console.error('Failed to read clipboard contents: ', err);
layer.msg('粘贴失败,请手动粘贴');
});
});
});
}
},
getQueryVariable(variable, defaultValue) {