mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 07:22:49 +08:00
重构:JS框架内部变量 admin 统一重命名为 ua,移除无用的 window.ulAdmin
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
var admin = window.UA_ADMIN;
|
||||
var ua = window.UA_ADMIN;
|
||||
var form = window.UA_CORE.form,
|
||||
layer = window.UA_CORE.layer,
|
||||
upload = window.UA_CORE.upload,
|
||||
@@ -8,10 +8,10 @@
|
||||
var { init, extGroup } = window.UA_SHARED;
|
||||
const { createEditor, createToolbar } = window.wangEditor;
|
||||
|
||||
admin.api = {
|
||||
ua.api = {
|
||||
button: function () {
|
||||
$('button[target="_blank"]').click(function () {
|
||||
window.open(admin.url($(this).attr('href')));
|
||||
window.open(ua.url($(this).attr('href')));
|
||||
});
|
||||
},
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
var backWindow = window.parent;
|
||||
if (option.backHref) {
|
||||
// 标签打开页面,需要返回上一个标签刷新的情况
|
||||
backWindow = admin.findPageId(option.backHref);
|
||||
backWindow = ua.findPageId(option.backHref);
|
||||
if (backWindow) {
|
||||
backWindow.layui.table.reloadData(option.refreshTable);
|
||||
} else {
|
||||
admin.findIndexPage(function (w) {
|
||||
ua.findIndexPage(function (w) {
|
||||
var menu = w.miniTab.searchMenu(option.backHref);
|
||||
var title = option.backHref;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
admin.findIndexPage(function (w) {
|
||||
w.layui.element.tabDelete('layuiminiTab', admin.getCurrentPageId());
|
||||
ua.findIndexPage(function (w) {
|
||||
w.layui.element.tabDelete('layuiminiTab', ua.getCurrentPageId());
|
||||
w.layui.element.tabChange('layuiminiTab', option.backHref);
|
||||
});
|
||||
return;
|
||||
@@ -143,7 +143,7 @@
|
||||
if (url === undefined || url === '' || url === null) {
|
||||
url = window.location.href;
|
||||
} else {
|
||||
url = admin.url(url);
|
||||
url = ua.url(url);
|
||||
}
|
||||
form.on('submit(' + filter + ')', function (data) {
|
||||
|
||||
@@ -161,12 +161,12 @@
|
||||
data.field[btnName] = btnValue;
|
||||
}
|
||||
if (!backHref) {
|
||||
backHref = admin.getQueryVariable('backTagId');
|
||||
backHref = ua.getQueryVariable('backTagId');
|
||||
}
|
||||
|
||||
var dataField = data.field;
|
||||
dataField = admin.api.formSubmitEditor(dataField, v);
|
||||
dataField = admin.api.formSubmitCity(dataField, v);
|
||||
dataField = ua.api.formSubmitEditor(dataField, v);
|
||||
dataField = ua.api.formSubmitCity(dataField, v);
|
||||
|
||||
if (typeof preposeCallback === 'function') {
|
||||
dataField = preposeCallback(dataField);
|
||||
@@ -184,10 +184,10 @@
|
||||
} else {
|
||||
ok = function (res) {
|
||||
res.msg = res.msg || '';
|
||||
admin.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
if (close) {
|
||||
|
||||
admin.api.closeCurrentOpen({
|
||||
ua.api.closeCurrentOpen({
|
||||
refreshTable: refresh,
|
||||
backHref: backHref,
|
||||
onClose: function () {
|
||||
@@ -201,7 +201,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
admin.request.post({
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: dataField,
|
||||
}, ok, no, ex, complete);
|
||||
@@ -313,12 +313,12 @@
|
||||
// 监听上传事件
|
||||
upload.render({
|
||||
elem: this,
|
||||
url: admin.url(init.uploadUrl),
|
||||
url: ua.url(init.uploadUrl),
|
||||
exts: uploadExts,
|
||||
accept: uploadAccept,//指定允许上传时校验的文件类型
|
||||
acceptMime: uploadAcceptMime,//规定打开文件选择框时,筛选出的文件类型
|
||||
multiple: uploadNumber !== 'one',//是否多文件上传
|
||||
headers: admin.headers(),
|
||||
headers: ua.headers(),
|
||||
done: function (res) {
|
||||
if (res.code === 0) {
|
||||
var url = res.data.url;
|
||||
@@ -341,9 +341,9 @@
|
||||
}
|
||||
$(elem).val(url);
|
||||
$(elem).trigger("input");
|
||||
admin.msg.success(res.msg);
|
||||
ua.msg.success(res.msg);
|
||||
} else {
|
||||
admin.msg.error(res.msg);
|
||||
ua.msg.error(res.msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -382,7 +382,7 @@
|
||||
// 不是图片
|
||||
// 遍历extGroup数组找到扩展名所在的索引
|
||||
|
||||
uploadIcon = admin.getExtGroupName(ext);
|
||||
uploadIcon = ua.getExtGroupName(ext);
|
||||
|
||||
liHtml += '<li><a title="点击打开文件" target="_blank" href="' + v + '" ><img src="/static/admin/images/upload-icons/' + uploadIcon + '.png"></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-filename-field="' + uploadFilenameField + '" data-upload-url="' + v + '" data-upload-sign="' + uploadSign + '" data-upload-filename="' + currentFilename + '">×</small></li>\n';
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
deleteUrl = $(this).attr('data-upload-url'),
|
||||
uploadFilenameField = $(this).attr('data-upload-filename-field'),
|
||||
sign = $(this).attr('data-upload-sign');
|
||||
var confirm = admin.msg.confirm('确定删除?', function () {
|
||||
var confirm = ua.msg.confirm('确定删除?', function () {
|
||||
var elem = "input[name='" + uploadName + "']";
|
||||
var elemFilenameField = "[name='" + uploadFilenameField + "']";
|
||||
var currentUrl = $(elem).val();
|
||||
@@ -453,7 +453,7 @@
|
||||
$(elemFilenameField).val(currentFilenameList.join(sign));
|
||||
}
|
||||
|
||||
admin.msg.close(confirm);
|
||||
ua.msg.close(confirm);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
@@ -490,7 +490,7 @@
|
||||
title: '选择文件',
|
||||
type: 2,
|
||||
area: [clienWidth, clientHeight],
|
||||
content: admin.url('system.uploadfile/index') + '?select_mode=' + selectCheck,
|
||||
content: ua.url('system.uploadfile/index') + '?select_mode=' + selectCheck,
|
||||
success(layero, index) {
|
||||
window.onTableDataConfirm = function (data) {
|
||||
var currentUrl = $(elem).val();
|
||||
@@ -527,7 +527,7 @@
|
||||
}
|
||||
$(elem).trigger("input");
|
||||
layer.close(index);
|
||||
admin.msg.success('选择成功');
|
||||
ua.msg.success('选择成功');
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -548,7 +548,7 @@
|
||||
},
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
server: admin.url('ajax/uploadEditor'),
|
||||
server: ua.url('ajax/uploadEditor'),
|
||||
maxFileSize: 10 * 1024 * 1024,
|
||||
fieldName: 'upload',
|
||||
},
|
||||
@@ -617,9 +617,9 @@
|
||||
|
||||
var fields = selectFields.replace(/\s/g, "").split(',');
|
||||
if (fields.length < 2) {
|
||||
return admin.msg.error('下拉选择字段有误');
|
||||
return ua.msg.error('下拉选择字段有误');
|
||||
}
|
||||
admin.request.get(
|
||||
ua.request.get(
|
||||
{
|
||||
url: url,
|
||||
data: {
|
||||
@@ -751,11 +751,11 @@
|
||||
var clipboard = new ClipboardJS(v);
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
admin.msg.success('复制成功');
|
||||
ua.msg.success('复制成功');
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
admin.msg.error('复制失败');
|
||||
ua.msg.error('复制失败');
|
||||
|
||||
});
|
||||
});
|
||||
@@ -776,7 +776,7 @@
|
||||
var targetElemName = $(v).data('paste-target');
|
||||
$(v).on('click', function () {
|
||||
if (!navigator.clipboard) {
|
||||
admin.msg.error('您的当前不支持粘贴操作');
|
||||
ua.msg.error('您的当前不支持粘贴操作');
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.readText()
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
init.uploadExts += allExtGroup.join('|');
|
||||
init.extGroup = extGroup;
|
||||
|
||||
var admin = {
|
||||
var ua = {
|
||||
init: init,
|
||||
config: {
|
||||
shade: [0.02, '#000'],
|
||||
@@ -122,10 +122,10 @@
|
||||
},
|
||||
request: {
|
||||
post: function (option, ok, no, ex, complete) {
|
||||
return admin.request.ajax('post', option, ok, no, ex, complete);
|
||||
return ua.request.ajax('post', option, ok, no, ex, complete);
|
||||
},
|
||||
get: function (option, ok, no, ex, complete) {
|
||||
return admin.request.ajax('get', option, ok, no, ex, complete);
|
||||
return ua.request.ajax('get', option, ok, no, ex, complete);
|
||||
},
|
||||
ajax: function (type, option, ok, no, ex, complete) {
|
||||
type = type || 'get';
|
||||
@@ -153,7 +153,7 @@
|
||||
} else {
|
||||
no = function (res) {
|
||||
var msg = res.msg == undefined ? '返回数据格式有误' : res.msg;
|
||||
admin.msg.error(msg);
|
||||
ua.msg.error(msg);
|
||||
complete();
|
||||
return false;
|
||||
};
|
||||
@@ -171,11 +171,11 @@
|
||||
};
|
||||
}
|
||||
if (option.url == '') {
|
||||
admin.msg.error('请求地址不能为空');
|
||||
ua.msg.error('请求地址不能为空');
|
||||
return false;
|
||||
}
|
||||
if (option.prefix == true) {
|
||||
option.url = admin.url(option.url);
|
||||
option.url = ua.url(option.url);
|
||||
}
|
||||
loading.show();
|
||||
$.ajax({
|
||||
@@ -183,7 +183,7 @@
|
||||
type: type,
|
||||
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
dataType: "json",
|
||||
headers: admin.headers(),
|
||||
headers: ua.headers(),
|
||||
data: option.data,
|
||||
timeout: 60000,
|
||||
success: function (res) {
|
||||
@@ -200,7 +200,7 @@
|
||||
errorMsg = xhr.responseJSON.message;
|
||||
}
|
||||
loading.hide();
|
||||
admin.msg.error('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!<br/>' + errorMsg, function () {
|
||||
ua.msg.error('Status:' + xhr.status + ',' + xhr.statusText + ',请稍后再试!<br/>' + errorMsg, function () {
|
||||
ex(this);
|
||||
});
|
||||
return false;
|
||||
@@ -215,7 +215,7 @@
|
||||
if (key === 0) {
|
||||
val = val.split('.');
|
||||
$.each(val, function (i, v) {
|
||||
val[i] = admin.common.humpToLine(v.replace(v[0], v[0].toLowerCase()));
|
||||
val[i] = ua.common.humpToLine(v.replace(v[0], v[0].toLowerCase()));
|
||||
});
|
||||
val = val.join(".");
|
||||
array[key] = val;
|
||||
@@ -240,7 +240,7 @@
|
||||
callback = function () {
|
||||
};
|
||||
}
|
||||
var index = layer.msg(msg, { icon: 1, shade: admin.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback);
|
||||
var index = layer.msg(msg, { icon: 1, shade: ua.config.shade, scrollbar: false, time: 800, shadeClose: true }, callback);
|
||||
return index;
|
||||
},
|
||||
// 失败消息
|
||||
@@ -249,7 +249,7 @@
|
||||
callback = function () {
|
||||
};
|
||||
}
|
||||
var index = layer.msg(msg, { icon: 2, shade: admin.config.shade, scrollbar: false, time: -1, shadeClose: true }, callback);
|
||||
var index = layer.msg(msg, { icon: 2, shade: ua.config.shade, scrollbar: false, time: -1, shadeClose: true }, callback);
|
||||
return index;
|
||||
},
|
||||
// 警告消息框
|
||||
@@ -285,5 +285,5 @@
|
||||
|
||||
window.UA_CORE = { form: form, layer: layer, laydate: laydate, upload: upload, element: element, laytpl: laytpl, util: util, table: table };
|
||||
window.UA_SHARED = { init: init, extGroup: extGroup };
|
||||
window.UA_ADMIN = admin;
|
||||
window.UA_ADMIN = ua;
|
||||
})();
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
|
||||
(function () {
|
||||
var admin = window.UA_ADMIN;
|
||||
var ua = window.UA_ADMIN;
|
||||
var { form, table } = window.UA_CORE;
|
||||
var { init } = window.UA_SHARED;
|
||||
|
||||
admin.listen = function (preposeCallback, ok, no, ex, complete) {
|
||||
ua.listen = function (preposeCallback, ok, no, ex, complete) {
|
||||
|
||||
// 监听表单是否为必填项
|
||||
admin.api.formRequired();
|
||||
ua.api.formRequired();
|
||||
|
||||
// 监听表单提交事件
|
||||
admin.api.formSubmit(preposeCallback, ok, no, ex, complete);
|
||||
ua.api.formSubmit(preposeCallback, ok, no, ex, complete);
|
||||
|
||||
// 监听按钮操作
|
||||
admin.api.button();
|
||||
ua.api.button();
|
||||
|
||||
// 初始化图片显示以及监听上传事件
|
||||
admin.api.upload();
|
||||
ua.api.upload();
|
||||
|
||||
// 监听富文本初始化
|
||||
admin.api.editor();
|
||||
ua.api.editor();
|
||||
|
||||
// 监听下拉选择生成
|
||||
admin.api.select();
|
||||
ua.api.select();
|
||||
|
||||
// 监听原生单选框选中
|
||||
admin.api.nativeRadio();
|
||||
admin.api.nativeSelect();
|
||||
ua.api.nativeRadio();
|
||||
ua.api.nativeSelect();
|
||||
|
||||
// 监听时间控件生成
|
||||
admin.api.date();
|
||||
ua.api.date();
|
||||
|
||||
// 监听通用表格数据控件生成
|
||||
admin.api.tableData();
|
||||
ua.api.tableData();
|
||||
// 监听地图组件
|
||||
admin.api.mapLocation();
|
||||
ua.api.mapLocation();
|
||||
|
||||
// 监听标签输入控件生成
|
||||
admin.api.tagInput();
|
||||
ua.api.tagInput();
|
||||
// 监听属性输入控件生成
|
||||
admin.api.propertyInput();
|
||||
ua.api.propertyInput();
|
||||
|
||||
// 监听点击复制
|
||||
admin.api.copyText();
|
||||
ua.api.copyText();
|
||||
|
||||
// 监听点击粘贴
|
||||
admin.api.pasteText();
|
||||
ua.api.pasteText();
|
||||
|
||||
// 监听tab操作
|
||||
miniTab.listen();
|
||||
@@ -74,7 +74,7 @@
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
admin.msg.error('请勾选需要操作的数据');
|
||||
ua.msg.error('请勾选需要操作的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
@@ -105,12 +105,12 @@
|
||||
}
|
||||
|
||||
// 如果是手机版,则直接跳转
|
||||
if (admin.checkMobile()) {
|
||||
location.href = external ? url : admin.url(url);
|
||||
if (ua.checkMobile()) {
|
||||
location.href = external ? url : ua.url(url);
|
||||
} else {
|
||||
admin.open(
|
||||
ua.open(
|
||||
$(this).attr('data-title'),
|
||||
external ? url : admin.url(url),
|
||||
external ? url : ua.url(url),
|
||||
clienWidth,
|
||||
clientHeight
|
||||
);
|
||||
@@ -202,7 +202,7 @@
|
||||
if (val !== '') {
|
||||
formatFilter[key] = val;
|
||||
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key);
|
||||
var elemId = ua.table.renderSearchFormItemElementId(key);
|
||||
|
||||
var op = $('#c-' + elemId).attr('data-search-op');
|
||||
op = op || '%*%';
|
||||
@@ -236,7 +236,7 @@
|
||||
title = title || '确定进行该操作?';
|
||||
|
||||
if (direct === 'true') {
|
||||
admin.msg.confirm(title, function () {
|
||||
ua.msg.confirm(title, function () {
|
||||
window.location.href = url;
|
||||
});
|
||||
return false;
|
||||
@@ -248,7 +248,7 @@
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
admin.msg.error('请勾选需要操作的数据');
|
||||
ua.msg.error('请勾选需要操作的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
@@ -258,14 +258,14 @@
|
||||
postData[field] = ids;
|
||||
}
|
||||
|
||||
url = admin.url(url);
|
||||
url = ua.url(url);
|
||||
|
||||
admin.msg.confirm(title, function () {
|
||||
admin.request.post({
|
||||
ua.msg.confirm(title, function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: postData,
|
||||
}, function (res) {
|
||||
admin.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
if (endMethod == 'reload-table') {
|
||||
tableId = tableId || init.tableRenderId;
|
||||
table.reloadData(tableId);
|
||||
@@ -285,25 +285,25 @@
|
||||
var tableId = $(this).attr('data-table-delete'),
|
||||
url = $(this).attr('data-url');
|
||||
tableId = tableId || init.tableRenderId;
|
||||
url = url !== undefined ? admin.url(url) : window.location.href;
|
||||
url = url !== undefined ? ua.url(url) : window.location.href;
|
||||
var checkStatus = table.checkStatus(tableId),
|
||||
data = checkStatus.data;
|
||||
if (data.length <= 0) {
|
||||
admin.msg.error('请勾选需要删除的数据');
|
||||
ua.msg.error('请勾选需要删除的数据');
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
$.each(data, function (i, v) {
|
||||
ids.push(v.id);
|
||||
});
|
||||
admin.msg.confirm('确定删除?', function () {
|
||||
admin.request.post({
|
||||
ua.msg.confirm('确定删除?', function () {
|
||||
ua.request.post({
|
||||
url: url,
|
||||
data: {
|
||||
id: ids
|
||||
},
|
||||
}, function (res) {
|
||||
admin.msg.success(res.msg, function () {
|
||||
ua.msg.success(res.msg, function () {
|
||||
table.reloadData(tableId);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
var admin = window.UA_ADMIN;
|
||||
var ua = window.UA_ADMIN;
|
||||
var form = window.UA_CORE.form,
|
||||
layer = window.UA_CORE.layer,
|
||||
table = window.UA_CORE.table,
|
||||
@@ -10,20 +10,20 @@
|
||||
var lastTableWhere = {};
|
||||
var selectMode, selectConfirmCallback;
|
||||
|
||||
admin.table = {
|
||||
ua.table = {
|
||||
render: function (options) {
|
||||
options.init = options.init || admin.init;
|
||||
options.modifyReload = admin.parame(options.modifyReload, true);
|
||||
options.init = options.init || ua.init;
|
||||
options.modifyReload = ua.parame(options.modifyReload, true);
|
||||
options.elem = options.elem || options.init.tableElem;
|
||||
options.id = options.id || options.init.tableRenderId;
|
||||
options.scrollPos = options.scrollPos || 'fixed';
|
||||
options.layFilter = options.id + '_LayFilter';
|
||||
options.url = options.url || admin.url(options.init.indexUrl);
|
||||
options.headers = admin.headers();
|
||||
options.page = admin.parame(options.page, true);
|
||||
options.search = admin.parame(options.search, true);
|
||||
options.layout = admin.parame(options.layout, true);
|
||||
options.layoutList = admin.parame(options.layoutList,
|
||||
options.url = options.url || ua.url(options.init.indexUrl);
|
||||
options.headers = ua.headers();
|
||||
options.page = ua.parame(options.page, true);
|
||||
options.search = ua.parame(options.search, true);
|
||||
options.layout = ua.parame(options.layout, true);
|
||||
options.layoutList = ua.parame(options.layoutList,
|
||||
[
|
||||
'table',
|
||||
'card',
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
]
|
||||
);
|
||||
options.layoutDefault = admin.parame(options.layoutDefault, true);
|
||||
options.layoutDefault = ua.parame(options.layoutDefault, true);
|
||||
options.skin = options.skin || 'line';
|
||||
options.autoSort = options.autoSort || false;
|
||||
options.limit = options.limit || 15;
|
||||
@@ -67,14 +67,14 @@
|
||||
|
||||
if (options.layoutDefault === true) {
|
||||
// 自动判断,手机端默认card,电脑端默认table
|
||||
if (admin.checkMobile()) {
|
||||
if (ua.checkMobile()) {
|
||||
options.layoutDefault = 'card';
|
||||
} else {
|
||||
options.layoutDefault = 'table';
|
||||
}
|
||||
}
|
||||
|
||||
options.layoutDefault = admin.trySetPageSetting('table-layout-default', options.layoutDefault);
|
||||
options.layoutDefault = ua.trySetPageSetting('table-layout-default', options.layoutDefault);
|
||||
|
||||
|
||||
}
|
||||
@@ -108,15 +108,15 @@
|
||||
optionDone(res, curr, count);
|
||||
|
||||
// 监听表格内的复制组件
|
||||
admin.api.copyText('[lay-id=' + options.id + ']');
|
||||
ua.api.copyText('[lay-id=' + options.id + ']');
|
||||
};
|
||||
|
||||
/**
|
||||
* 为空时认为自己是普通状态,否则是单选、多选、子页面,此时添加等默认行为走弹框而不是新标签页
|
||||
*/
|
||||
selectMode = admin.getQueryVariable("select_mode");
|
||||
selectMode = ua.getQueryVariable("select_mode");
|
||||
|
||||
selectConfirmCallback = admin.getQueryVariable('select_confirm_callback', 'onTableDataConfirm');
|
||||
selectConfirmCallback = ua.getQueryVariable('select_confirm_callback', 'onTableDataConfirm');
|
||||
|
||||
if (selectMode == 'checkbox') {
|
||||
if (options.cols[0][0].type == 'radio') {
|
||||
@@ -137,27 +137,27 @@
|
||||
|
||||
}
|
||||
} else {
|
||||
if(!admin.isParentIndex()){
|
||||
if(!ua.isParentIndex()){
|
||||
selectMode = 'childPage'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断元素对象是否有嵌套的
|
||||
options.cols = admin.table.formatCols(options.cols, options.init);
|
||||
options.cols = ua.table.formatCols(options.cols, options.init);
|
||||
|
||||
// 初始化表格lay-filter
|
||||
$(options.elem).attr('lay-filter', options.layFilter);
|
||||
|
||||
// 初始化表格搜索
|
||||
if (options.search === true) {
|
||||
options = admin.table.renderSearch(options.cols, options.elem, options.id, options);
|
||||
options = ua.table.renderSearch(options.cols, options.elem, options.id, options);
|
||||
}
|
||||
|
||||
// 初始化模板切换
|
||||
if (options.layout === true) {
|
||||
|
||||
options = admin.table.renderLayout(options);
|
||||
options = ua.table.renderLayout(options);
|
||||
}
|
||||
|
||||
// 初始化表格左上方工具栏
|
||||
@@ -175,13 +175,13 @@
|
||||
options.init.formFullScreen = 'false';
|
||||
}
|
||||
|
||||
options.toolbar = admin.table.renderToolbar(options.toolbar, options.elem, options.id, options.init);
|
||||
options.toolbar = ua.table.renderToolbar(options.toolbar, options.elem, options.id, options.init);
|
||||
|
||||
// 判断是否有操作列表权限
|
||||
options.cols = admin.table.renderOperat(options.cols, options.elem);
|
||||
options.cols = ua.table.renderOperat(options.cols, options.elem);
|
||||
|
||||
// 判断是否有操作列表权限
|
||||
options.cols = admin.table.renderTrueHide(options.cols, options);
|
||||
options.cols = ua.table.renderTrueHide(options.cols, options);
|
||||
|
||||
|
||||
var parseData = function (res) { return res; };
|
||||
@@ -205,7 +205,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
var selectedIds = admin.getQueryVariable('selectedIds', '');
|
||||
var selectedIds = ua.getQueryVariable('selectedIds', '');
|
||||
|
||||
if (selectedIds.length > 0) {
|
||||
var selectedIdArr = selectedIds.split(',');
|
||||
@@ -229,22 +229,22 @@
|
||||
var newTable = table.render(options);
|
||||
|
||||
// 监听表格搜索开关显示
|
||||
admin.table.listenToolbar(options.layFilter, options.id);
|
||||
ua.table.listenToolbar(options.layFilter, options.id);
|
||||
|
||||
// 监听表格瓶排序
|
||||
admin.table.listenTableSort(options);
|
||||
ua.table.listenTableSort(options);
|
||||
|
||||
// 监听表格开关切换
|
||||
admin.table.renderSwitch(options.cols, options.init, options.id, options.modifyReload);
|
||||
ua.table.renderSwitch(options.cols, options.init, options.id, options.modifyReload);
|
||||
|
||||
// 监听表格开关切换
|
||||
admin.table.listenEdit(options.init, options.layFilter, options.id, options.modifyReload);
|
||||
ua.table.listenEdit(options.init, options.layFilter, options.id, options.modifyReload);
|
||||
|
||||
// 监听导出事件
|
||||
admin.table.listenExport(options);
|
||||
ua.table.listenExport(options);
|
||||
|
||||
// 监听表格选择器
|
||||
admin.table.listenTableSelectConfirm(options);
|
||||
ua.table.listenTableSelectConfirm(options);
|
||||
|
||||
return newTable;
|
||||
},
|
||||
@@ -255,7 +255,7 @@
|
||||
if (v === 'refresh') {
|
||||
toolbarHtml += ' <button class="layui-btn layui-btn-sm layuimini-btn-primary" data-table-refresh="' + tableId + '"><i class="fa fa-refresh"></i> </button>\n';
|
||||
} else if (v === 'add') {
|
||||
if (admin.checkAuth('add', elem)) {
|
||||
if (ua.checkAuth('add', elem)) {
|
||||
if(selectMode){
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-normal layui-btn-sm" data-open="' + init.addUrl + '" data-title="添加" data-full="' + init.formFullScreen + '"><i class="fa fa-plus"></i> 添加</button>\n';
|
||||
}else{
|
||||
@@ -263,11 +263,11 @@
|
||||
}
|
||||
}
|
||||
} else if (v === 'delete') {
|
||||
if (admin.checkAuth('delete', elem)) {
|
||||
if (ua.checkAuth('delete', elem)) {
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-sm layui-btn-danger" data-url="' + init.deleteUrl + '" data-table-delete="' + tableId + '"><i class="fa fa-trash-o"></i> 删除</button>\n';
|
||||
}
|
||||
} else if (v === 'export') {
|
||||
if (admin.checkAuth('export', elem)) {
|
||||
if (ua.checkAuth('export', elem)) {
|
||||
toolbarHtml += '<button class="layui-btn layui-btn-sm layui-btn-success easyadmin-export-btn" data-url="' + init.exportUrl + '" data-table-export="' + tableId + '"><i class="fa fa-file-excel-o"></i> 导出</button>\n';
|
||||
}
|
||||
} else if (v === 'selectConfirm') {
|
||||
@@ -283,8 +283,8 @@
|
||||
vv.text = vv.text || vv.title;
|
||||
vv.extend = vv.extend || '';
|
||||
vv.checkbox = vv.checkbox || false;
|
||||
if (admin.checkAuth(vv.auth, elem)) {
|
||||
toolbarHtml += admin.table.buildToolbarHtml(vv, tableId);
|
||||
if (ua.checkAuth(vv.auth, elem)) {
|
||||
toolbarHtml += ua.table.buildToolbarHtml(vv, tableId);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -301,10 +301,10 @@
|
||||
formatOp = {};
|
||||
$.each(cols, function (i, d) {
|
||||
d.field = d.field || false;
|
||||
d.fieldAlias = admin.parame(d.fieldAlias, d.field);
|
||||
d.fieldAlias = ua.parame(d.fieldAlias, d.field);
|
||||
d.title = d.title || d.field || '';
|
||||
d.selectList = d.selectList || {};
|
||||
d.search = admin.parame(d.search, true);
|
||||
d.search = ua.parame(d.search, true);
|
||||
d.searchTip = d.searchTip || '请输入' + d.title || '';
|
||||
d.searchValue = d.searchValue || undefined;
|
||||
d.searchHide = d.searchHide || '';
|
||||
@@ -336,7 +336,7 @@
|
||||
}
|
||||
} else {
|
||||
if (d.field) {
|
||||
d.defaultSearchValue = admin.getQueryVariable(d.field);
|
||||
d.defaultSearchValue = ua.getQueryVariable(d.field);
|
||||
if (d.defaultSearchValue != undefined) {
|
||||
d.searchValue = d.defaultSearchValue;
|
||||
}
|
||||
@@ -530,7 +530,7 @@
|
||||
'</form>' +
|
||||
'</fieldset>');
|
||||
|
||||
admin.table.listenTableSearch(tableId);
|
||||
ua.table.listenTableSearch(tableId);
|
||||
|
||||
// 初始化form表单
|
||||
form.render();
|
||||
@@ -689,7 +689,7 @@
|
||||
optionBefore(res, curr, count);
|
||||
console.log('layout before fun');
|
||||
|
||||
var currentLayout = admin.getPageSetting('table-layout-default', 'table');
|
||||
var currentLayout = ua.getPageSetting('table-layout-default', 'table');
|
||||
// 隐藏所有数据体内容
|
||||
var layuiTableElem = $(layuiTableElemName);
|
||||
|
||||
@@ -719,7 +719,7 @@
|
||||
optionDone(res, curr, count);
|
||||
console.log('layout done fun');
|
||||
|
||||
var currentLayout = admin.getPageSetting('table-layout-default', 'table');
|
||||
var currentLayout = ua.getPageSetting('table-layout-default', 'table');
|
||||
// 隐藏所有数据体内容
|
||||
var layuiTableElem = $(layuiTableElemName);
|
||||
|
||||
@@ -756,12 +756,12 @@
|
||||
renderSwitch: function (cols, tableInit, tableId, modifyReload) {
|
||||
tableInit.modifyUrl = tableInit.modifyUrl || false;
|
||||
cols = cols[0] || {};
|
||||
tableId = tableId || admin.init.tableRenderId;
|
||||
tableId = tableId || ua.init.tableRenderId;
|
||||
if (cols.length > 0) {
|
||||
$.each(cols, function (i, v) {
|
||||
v.filter = v.filter || false;
|
||||
if (v.filter !== false && tableInit.modifyUrl !== false) {
|
||||
admin.table.listenSwitch({ filter: v.filter, url: tableInit.modifyUrl, tableId: tableId, modifyReload: modifyReload });
|
||||
ua.table.listenSwitch({ filter: v.filter, url: tableInit.modifyUrl, tableId: tableId, modifyReload: modifyReload });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -775,7 +775,7 @@
|
||||
for (key in operat) {
|
||||
var item = operat[key];
|
||||
if (typeof item === 'string') {
|
||||
if (admin.checkAuth(item, elem)) {
|
||||
if (ua.checkAuth(item, elem)) {
|
||||
check = true;
|
||||
break;
|
||||
}
|
||||
@@ -785,7 +785,7 @@
|
||||
if (v.auth == undefined) {
|
||||
v.auth = 'add';
|
||||
}
|
||||
if (admin.checkAuth(v.auth, elem)) {
|
||||
if (ua.checkAuth(v.auth, elem)) {
|
||||
check = true;
|
||||
break;
|
||||
}
|
||||
@@ -811,7 +811,7 @@
|
||||
if (typeof colItem.trueHide == 'function') {
|
||||
trueHide = colItem.trueHide(colItem, col, options);
|
||||
} else if (typeof colItem.trueHide == 'string') {
|
||||
trueHide = !admin.checkAuth(colItem.trueHide, options.elem);
|
||||
trueHide = !ua.checkAuth(colItem.trueHide, options.elem);
|
||||
} else {
|
||||
trueHide = colItem.trueHide;
|
||||
}
|
||||
@@ -957,16 +957,16 @@
|
||||
}
|
||||
|
||||
// 格式化列操作栏
|
||||
if (val.templet === admin.table.tool && val.operat === undefined) {
|
||||
if (val.templet === ua.table.tool && val.operat === undefined) {
|
||||
cols[i][index]['operat'] = ['edit', 'delete'];
|
||||
}
|
||||
// 格式化列操作栏
|
||||
if (val.templet === admin.table.tool) {
|
||||
if (val.templet === ua.table.tool) {
|
||||
cols[i][index]['sort'] = false;
|
||||
}
|
||||
|
||||
// 判断是否包含开关组件
|
||||
if (val.templet === admin.table.switch && val.filter === undefined) {
|
||||
if (val.templet === ua.table.switch && val.filter === undefined) {
|
||||
cols[i][index]['filter'] = val.field;
|
||||
}
|
||||
|
||||
@@ -987,34 +987,34 @@
|
||||
}
|
||||
|
||||
// 初始化图片高度
|
||||
if (val.templet === admin.table.image && val.imageHeight === undefined) {
|
||||
if (val.templet === ua.table.image && val.imageHeight === undefined) {
|
||||
cols[i][index]['imageHeight'] = 26;
|
||||
cols[i][index]['sort'] = false;
|
||||
}
|
||||
// 图片默认不搜索
|
||||
if (val.templet === admin.table.image && val.search === undefined) {
|
||||
if (val.templet === ua.table.image && val.search === undefined) {
|
||||
cols[i][index]['search'] = false;
|
||||
}
|
||||
|
||||
// 判断是否列表数据转换
|
||||
if (val.selectList !== undefined && val.templet === undefined) {
|
||||
cols[i][index]['templet'] = admin.table.list;
|
||||
cols[i][index]['templet'] = ua.table.list;
|
||||
}
|
||||
|
||||
// 判断是否多层对象
|
||||
if (val.field !== undefined && val.field.split(".").length > 1) {
|
||||
if (val.templet === undefined) {
|
||||
cols[i][index]['templet'] = admin.table.value;
|
||||
cols[i][index]['templet'] = ua.table.value;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果未定义则默认使用value
|
||||
if (cols[i][index]['templet'] === undefined) {
|
||||
cols[i][index]['templet'] = admin.table.value;
|
||||
cols[i][index]['templet'] = ua.table.value;
|
||||
} else {
|
||||
// 针对特定的模板做数据调整
|
||||
|
||||
if (cols[i][index]['templet'] == admin.table.list) {
|
||||
if (cols[i][index]['templet'] == ua.table.list) {
|
||||
if (val.selectValue) {
|
||||
|
||||
var newSelectList = {};
|
||||
@@ -1031,10 +1031,10 @@
|
||||
if (val.fieldFormat == undefined) {
|
||||
|
||||
switch (val.templet) {
|
||||
case admin.table.image:
|
||||
case ua.table.image:
|
||||
val.fieldFormat = 'image';
|
||||
break;
|
||||
case admin.table.date:
|
||||
case ua.table.date:
|
||||
val.fieldFormat = 'date';
|
||||
break;
|
||||
default:
|
||||
@@ -1053,7 +1053,7 @@
|
||||
tool: function (data) {
|
||||
var option = data.LAY_COL;
|
||||
option.operat = option.operat || ['edit', 'delete'];
|
||||
var elem = option.init.tableElem || admin.init.tableElem;
|
||||
var elem = option.init.tableElem || ua.init.tableElem;
|
||||
var html = '';
|
||||
$.each(option.operat, function (i, item) {
|
||||
if (typeof item === 'string') {
|
||||
@@ -1074,9 +1074,9 @@
|
||||
url: option.init.editUrl,
|
||||
extend: option.init.formFullScreen == 'true' ? ' data-full="true"' : ''
|
||||
};
|
||||
operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
if (admin.checkAuth(operat.auth, elem)) {
|
||||
html += admin.table.buildOperatHtml(operat, data);
|
||||
operat.url = ua.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
if (ua.checkAuth(operat.auth, elem)) {
|
||||
html += ua.table.buildOperatHtml(operat, data);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
@@ -1091,9 +1091,9 @@
|
||||
url: option.init.deleteUrl,
|
||||
extend: ""
|
||||
};
|
||||
operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
if (admin.checkAuth(operat.auth, elem)) {
|
||||
html += admin.table.buildOperatHtml(operat, data);
|
||||
operat.url = ua.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
if (ua.checkAuth(operat.auth, elem)) {
|
||||
html += ua.table.buildOperatHtml(operat, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1117,7 +1117,7 @@
|
||||
return '';
|
||||
}
|
||||
} else if (typeof operat._if == 'string') {
|
||||
var ifValue = admin.table.returnColumnValue(data, operat._if, false);
|
||||
var ifValue = ua.table.returnColumnValue(data, operat._if, false);
|
||||
if (!ifValue) {
|
||||
return '';
|
||||
}
|
||||
@@ -1135,8 +1135,8 @@
|
||||
|
||||
|
||||
if (typeof operat.field != 'function') {
|
||||
if (!admin.empty(operat.field)) {
|
||||
operat.url = admin.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
if (!ua.empty(operat.field)) {
|
||||
operat.url = ua.table.toolSpliceUrl(operat.url, operat.field, data);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1158,8 +1158,8 @@
|
||||
|
||||
}
|
||||
|
||||
if (admin.checkAuth(operat.auth, elem)) {
|
||||
html += admin.table.buildOperatHtml(operat, data);
|
||||
if (ua.checkAuth(operat.auth, elem)) {
|
||||
html += ua.table.buildOperatHtml(operat, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@
|
||||
var option = data.LAY_COL;
|
||||
option.selectList = option.selectList || {};
|
||||
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
if (option.selectList[value] === undefined || option.selectList[value] === '' || option.selectList[value] === null) {
|
||||
return value;
|
||||
} else {
|
||||
@@ -1181,12 +1181,12 @@
|
||||
var mimeName = data.mime_type.split('/')[0];
|
||||
|
||||
if (mimeName == 'image') {
|
||||
return admin.table.image(data);
|
||||
return ua.table.image(data);
|
||||
} else {
|
||||
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
|
||||
var groupName = admin.getExtGroupName(data.file_ext);
|
||||
var groupName = ua.getExtGroupName(data.file_ext);
|
||||
|
||||
return '<a href="' + value + '"><img style="height:40px;width:40px" src="/static/admin/images/upload-icons/' + groupName + '.png" /></a>';
|
||||
}
|
||||
@@ -1200,7 +1200,7 @@
|
||||
option.imageJoin = option.imageJoin || '<br>';
|
||||
option.title = option.title || option.field;
|
||||
var title = data[option.title];
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
if (value === undefined || value === null) {
|
||||
return '<img style="max-width: ' + option.imageWidth + 'px; max-height: ' + option.imageHeight + 'px;" src="' + value + '" data-image="' + title + '">';
|
||||
} else {
|
||||
@@ -1217,9 +1217,9 @@
|
||||
|
||||
var urlNameField = option.urlNameField || '';
|
||||
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
|
||||
if (admin.empty(value)) {
|
||||
if (ua.empty(value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1245,56 +1245,56 @@
|
||||
switch: function (data) {
|
||||
var option = data.LAY_COL;
|
||||
|
||||
if (!admin.checkAuth('modify', option.init.tableElem)) {
|
||||
return admin.table.list(data);
|
||||
if (!ua.checkAuth('modify', option.init.tableElem)) {
|
||||
return ua.table.list(data);
|
||||
}
|
||||
|
||||
option.filter = option.filter || option.field || null;
|
||||
option.checked = option.checked || 1;
|
||||
|
||||
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
var checked = value === option.checked ? 'checked' : '';
|
||||
return laytpl('<input type="checkbox" name="' + option.field + '" value="' + data.id + '" lay-skin="switch" lay-filter="' + option.filter + '" ' + checked + ' >').render(data);
|
||||
},
|
||||
price: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
return '<span>¥' + value + '</span>';
|
||||
},
|
||||
percent: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
return '<span>' + value + '%</span>';
|
||||
},
|
||||
icon: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
return '<i class="' + value + '"></i>';
|
||||
},
|
||||
text: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
return '<span class="line-limit-length">' + value + '</span>';
|
||||
},
|
||||
value: function (data) {
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
return '<span>' + value + '</span>';
|
||||
},
|
||||
//时间戳转日期
|
||||
date: function (data) {
|
||||
var option = data.LAY_COL;
|
||||
|
||||
value = admin.table.returnColumnValue(data);
|
||||
if (!admin.empty(value)) {
|
||||
value = ua.table.returnColumnValue(data);
|
||||
if (!ua.empty(value)) {
|
||||
value = util.toDateString(value * 1000, option.format || 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
return '<span>' + value + '</span>';
|
||||
},
|
||||
bytes: (data) => {
|
||||
var size = admin.table.returnColumnValue(data);
|
||||
sizeReadable = admin.bytes(size);
|
||||
var size = ua.table.returnColumnValue(data);
|
||||
sizeReadable = ua.bytes(size);
|
||||
return sizeReadable;
|
||||
},
|
||||
copyText(data) {
|
||||
var option = data.LAY_COL;
|
||||
var value = admin.table.returnColumnValue(data);
|
||||
var value = ua.table.returnColumnValue(data);
|
||||
var copyValue = value;
|
||||
var copyText = option.copyText;
|
||||
|
||||
@@ -1340,7 +1340,7 @@
|
||||
if (val !== '') {
|
||||
formatFilter[key] = val;
|
||||
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key);
|
||||
var elemId = ua.table.renderSearchFormItemElementId(key);
|
||||
|
||||
var op = $('#c-' + elemId).attr('data-search-op');
|
||||
op = op || '%*%';
|
||||
@@ -1366,7 +1366,7 @@
|
||||
option.filter = option.filter || '';
|
||||
option.url = option.url || '';
|
||||
option.field = option.field || option.filter || '';
|
||||
option.tableId = option.tableId || admin.init.tableRenderId;
|
||||
option.tableId = option.tableId || ua.init.tableRenderId;
|
||||
option.modifyReload = option.modifyReload || false;
|
||||
form.on('switch(' + option.filter + ')', function (obj) {
|
||||
var checked = obj.elem.checked ? 1 : 0;
|
||||
@@ -1381,7 +1381,7 @@
|
||||
field: option.field,
|
||||
value: checked,
|
||||
};
|
||||
admin.request.post({
|
||||
ua.request.post({
|
||||
url: option.url,
|
||||
prefix: true,
|
||||
data: data,
|
||||
@@ -1390,7 +1390,7 @@
|
||||
table.reloadData(option.tableId);
|
||||
}
|
||||
}, function (res) {
|
||||
admin.msg.error(res.msg, function () {
|
||||
ua.msg.error(res.msg, function () {
|
||||
table.reloadData(option.tableId);
|
||||
});
|
||||
}, function () {
|
||||
@@ -1435,7 +1435,7 @@
|
||||
var layoutElemId = 'layout-list-option-' + tableId;
|
||||
var layoutElemIdName = '#' + layoutElemId;
|
||||
|
||||
var currentLayout = admin.getPageSetting('table-layout-default', 'table');
|
||||
var currentLayout = ua.getPageSetting('table-layout-default', 'table');
|
||||
|
||||
// 构建下拉选择
|
||||
var layoutHtml = '<div id="' + layoutElemId + '" class="ul-nav-block table-tpl-container">';
|
||||
@@ -1471,7 +1471,7 @@
|
||||
item.addClass('current').siblings().removeClass('current');
|
||||
|
||||
var layoutName = item.data('name');
|
||||
admin.setPageSetting('table-layout-default', layoutName);
|
||||
ua.setPageSetting('table-layout-default', layoutName);
|
||||
|
||||
table.reloadData(tableId, {}, true);
|
||||
} else {
|
||||
@@ -1496,7 +1496,7 @@
|
||||
},
|
||||
listenEdit: function (tableInit, layFilter, tableId, modifyReload) {
|
||||
tableInit.modifyUrl = tableInit.modifyUrl || false;
|
||||
tableId = tableId || admin.init.tableRenderId;
|
||||
tableId = tableId || ua.init.tableRenderId;
|
||||
if (tableInit.modifyUrl !== false) {
|
||||
table.on('edit(' + layFilter + ')', function (obj) {
|
||||
var value = obj.value,
|
||||
@@ -1508,7 +1508,7 @@
|
||||
field: field,
|
||||
value: value,
|
||||
};
|
||||
admin.request.post({
|
||||
ua.request.post({
|
||||
url: tableInit.modifyUrl,
|
||||
prefix: true,
|
||||
data: _data,
|
||||
@@ -1517,7 +1517,7 @@
|
||||
table.reloadData(tableId);
|
||||
}
|
||||
}, function (res) {
|
||||
admin.msg.error(res.msg, function () {
|
||||
ua.msg.error(res.msg, function () {
|
||||
table.reloadData(tableId);
|
||||
});
|
||||
}, function () {
|
||||
@@ -1598,7 +1598,7 @@
|
||||
if (val !== '') {
|
||||
formatFilter[key] = val;
|
||||
|
||||
var elemId = admin.table.renderSearchFormItemElementId(key);
|
||||
var elemId = ua.table.renderSearchFormItemElementId(key);
|
||||
|
||||
var op = $('#c-' + elemId).attr('data-search-op');
|
||||
op = op || '%*%';
|
||||
@@ -1617,9 +1617,9 @@
|
||||
|
||||
var query = $.param(searchQuery);
|
||||
|
||||
var index = admin.msg.confirm('根据查询进行导出,确定导出?', function () {
|
||||
var index = ua.msg.confirm('根据查询进行导出,确定导出?', function () {
|
||||
|
||||
toUrl = admin.url(url);
|
||||
toUrl = ua.url(url);
|
||||
if (toUrl.indexOf('?') < 0) {
|
||||
toUrl += '?';
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
(function () {
|
||||
var admin = window.UA_ADMIN;
|
||||
var ua = window.UA_ADMIN;
|
||||
var { layer, table } = window.UA_CORE;
|
||||
|
||||
admin.checkMobile = function () {
|
||||
ua.checkMobile = function () {
|
||||
return tools.checkMobile();
|
||||
};
|
||||
admin.open = function (title, url, width, height, isResize, shadeClose = false) {
|
||||
ua.open = function (title, url, width, height, isResize, shadeClose = false) {
|
||||
isResize = isResize === undefined ? true : isResize;
|
||||
var index = layer.open({
|
||||
title: title,
|
||||
@@ -34,7 +34,7 @@
|
||||
index = null;
|
||||
}
|
||||
});
|
||||
if (admin.checkMobile() || width === undefined || height === undefined) {
|
||||
if (ua.checkMobile() || width === undefined || height === undefined) {
|
||||
layer.full(index);
|
||||
}
|
||||
if (isResize) {
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
admin.getQueryVariable = function (variable, defaultValue) {
|
||||
ua.getQueryVariable = function (variable, defaultValue) {
|
||||
if (typeof defaultValue == 'undefined') {
|
||||
defaultValue = undefined;
|
||||
}
|
||||
@@ -60,8 +60,8 @@
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
admin.dataBrage = null;
|
||||
admin.getDataBrage = function (keys, defaultValue) {
|
||||
ua.dataBrage = null;
|
||||
ua.getDataBrage = function (keys, defaultValue) {
|
||||
if (this.dataBrage == null) {
|
||||
this.dataBrage = JSON.parse($('#data-brage').text());
|
||||
}
|
||||
@@ -70,9 +70,9 @@
|
||||
defaultValue = undefined;
|
||||
}
|
||||
|
||||
return admin.dataGet(this.dataBrage, keys, defaultValue);
|
||||
return ua.dataGet(this.dataBrage, keys, defaultValue);
|
||||
};
|
||||
admin.dataGet = function (data, keys, defaultValue) {
|
||||
ua.dataGet = function (data, keys, defaultValue) {
|
||||
return (
|
||||
(!Array.isArray(keys)
|
||||
? keys.replace(/\[/g, '.').replace(/\]/g, '').split('.')
|
||||
@@ -80,8 +80,8 @@
|
||||
).reduce((o, k) => (o || {})[k], data) || defaultValue
|
||||
);
|
||||
};
|
||||
admin.getExtGroupName = function (ext) {
|
||||
var extGroup = admin.init.extGroup;
|
||||
ua.getExtGroupName = function (ext) {
|
||||
var extGroup = ua.init.extGroup;
|
||||
var groupName = 'file';
|
||||
for (const extGroupName in extGroup) {
|
||||
if (Object.hasOwnProperty.call(extGroup, extGroupName)) {
|
||||
@@ -96,7 +96,7 @@
|
||||
return groupName;
|
||||
};
|
||||
//js版empty,判断变量是否为空
|
||||
admin.empty = function (r) {
|
||||
ua.empty = function (r) {
|
||||
var n, t, e, f = [void 0, null, !1, 0, "", "0"];
|
||||
for (t = 0, e = f.length; t < e; t++) if (r === f[t]) return !0;
|
||||
if ("object" == typeof r) {
|
||||
@@ -106,7 +106,7 @@
|
||||
return !1;
|
||||
};
|
||||
|
||||
admin.bytes = function (size) {
|
||||
ua.bytes = function (size) {
|
||||
if (size > 0) {
|
||||
const kb = 1024;
|
||||
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
@@ -117,16 +117,16 @@
|
||||
}
|
||||
return '0B';
|
||||
};
|
||||
admin.triggerEventReplaceJs = function (name, defaultCallback, replaceCallback) {
|
||||
ua.triggerEventReplaceJs = function (name, defaultCallback, replaceCallback) {
|
||||
var code = $('#event-replace-js-' + name).html();
|
||||
|
||||
if (admin.empty(code)) {
|
||||
if (ua.empty(code)) {
|
||||
defaultCallback();
|
||||
} else {
|
||||
replaceCallback(code);
|
||||
}
|
||||
};
|
||||
admin.randdomString = function (len) {
|
||||
ua.randdomString = function (len) {
|
||||
len = len || 32;
|
||||
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
||||
var maxPos = $chars.length;
|
||||
@@ -136,13 +136,13 @@
|
||||
}
|
||||
return pwd;
|
||||
};
|
||||
admin.getPageSetting = function (key, defaultValue, global = false) {
|
||||
ua.getPageSetting = function (key, defaultValue, global = false) {
|
||||
if (!global) {
|
||||
key = window.CONFIG.PAGE_KEY_NAME + '_' + key;
|
||||
}
|
||||
return tools.getLocal(key, defaultValue);
|
||||
};
|
||||
admin.setPageSetting = function (key, value, global) {
|
||||
ua.setPageSetting = function (key, value, global) {
|
||||
if (!global) {
|
||||
key = window.CONFIG.PAGE_KEY_NAME + '_' + key;
|
||||
}
|
||||
@@ -157,22 +157,22 @@
|
||||
* @param {boolean} global
|
||||
* @returns
|
||||
*/
|
||||
admin.trySetPageSetting = function (key, value, global) {
|
||||
var oldValue = admin.getPageSetting(key, undefined, global);
|
||||
ua.trySetPageSetting = function (key, value, global) {
|
||||
var oldValue = ua.getPageSetting(key, undefined, global);
|
||||
if (!oldValue) {
|
||||
admin.setPageSetting(key, value, global);
|
||||
ua.setPageSetting(key, value, global);
|
||||
return value;
|
||||
}
|
||||
|
||||
return oldValue;
|
||||
};
|
||||
admin.isCurrentIndex = function () {
|
||||
ua.isCurrentIndex = function () {
|
||||
if (window.pageType && window.pageType == 'index') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
admin.isParentIndex = function () {
|
||||
ua.isParentIndex = function () {
|
||||
try {
|
||||
if (window.parent && window.parent.pageType && window.parent.pageType == 'index') {
|
||||
return true;
|
||||
@@ -182,7 +182,7 @@
|
||||
}
|
||||
return false;
|
||||
};
|
||||
admin.findIndexPage = function (findCallback, missCallback) {
|
||||
ua.findIndexPage = function (findCallback, missCallback) {
|
||||
if (!findCallback) {
|
||||
findCallback = function (w) { return w; };
|
||||
}
|
||||
@@ -200,13 +200,13 @@
|
||||
|
||||
return missCallback(null);
|
||||
};
|
||||
admin.getCurrentPageId = function () {
|
||||
ua.getCurrentPageId = function () {
|
||||
// pageId就是路径加参数
|
||||
var path = location.pathname;
|
||||
var params = location.search;
|
||||
return path + params;
|
||||
};
|
||||
admin.findPageId = function (tabId) {
|
||||
ua.findPageId = function (tabId) {
|
||||
var iframeWindow;
|
||||
this.findIndexPage(function (window) {
|
||||
// 查找对应的tab内容区域
|
||||
@@ -220,7 +220,7 @@
|
||||
});
|
||||
return iframeWindow;
|
||||
};
|
||||
admin.getMenuInfoByTabId = function (tabId) {
|
||||
ua.getMenuInfoByTabId = function (tabId) {
|
||||
var menuValue = null;
|
||||
this.findIndexPage(function (w) {
|
||||
var menu = w.miniTab.searchMenu(tabId);
|
||||
@@ -230,7 +230,7 @@
|
||||
});
|
||||
return menuValue;
|
||||
};
|
||||
admin.getMenuTitleByTabId = function (tabId, defaultValue) {
|
||||
ua.getMenuTitleByTabId = function (tabId, defaultValue) {
|
||||
var menuTitle = defaultValue;
|
||||
var menu = this.getMenuInfoByTabId(tabId);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
(function () {
|
||||
var admin = window.UA_ADMIN;
|
||||
var ua = window.UA_ADMIN;
|
||||
|
||||
window.ulAdmin = window.ua = admin;
|
||||
window.ua = ua;
|
||||
|
||||
// 清理临时全局变量
|
||||
delete window.UA_CORE;
|
||||
|
||||
Reference in New Issue
Block a user