修改ry-ui.js中判断是否为空函数,增加对undefined的判断,优化if判断
This commit is contained in:
parent
dc07b97cdb
commit
36ddf23f27
|
|
@ -61,10 +61,16 @@
|
||||||
// 请求获取数据后处理回调函数
|
// 请求获取数据后处理回调函数
|
||||||
responseHandler: function(res) {
|
responseHandler: function(res) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
return { rows: res.rows, total: res.total };
|
return {
|
||||||
|
rows: res.rows,
|
||||||
|
total: res.total
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
$.modal.alertWarning(res.msg);
|
$.modal.alertWarning(res.msg);
|
||||||
return { rows: [], total: 0 };
|
return {
|
||||||
|
rows: [],
|
||||||
|
total: 0
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 序列号生成
|
// 序列号生成
|
||||||
|
|
@ -234,7 +240,11 @@
|
||||||
// 消息提示
|
// 消息提示
|
||||||
msg: function(content, type) {
|
msg: function(content, type) {
|
||||||
if (type != undefined) {
|
if (type != undefined) {
|
||||||
layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 });
|
layer.msg(content, {
|
||||||
|
icon: $.modal.icon(type),
|
||||||
|
time: 1000,
|
||||||
|
shift: 5
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(content);
|
layer.msg(content);
|
||||||
}
|
}
|
||||||
|
|
@ -358,7 +368,8 @@
|
||||||
btn: ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 关闭'],
|
btn: ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 关闭'],
|
||||||
yes: function(index, layero) {
|
yes: function(index, layero) {
|
||||||
options.callBack(index, layero)
|
options.callBack(index, layero)
|
||||||
}, cancel: function () {
|
},
|
||||||
|
cancel: function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -406,7 +417,9 @@
|
||||||
},
|
},
|
||||||
// 打开遮罩层
|
// 打开遮罩层
|
||||||
loading: function(message) {
|
loading: function(message) {
|
||||||
$.blockUI({ message: '<div class="loaderbox"><div class="loading-activity"></div> ' + message + '</div>' });
|
$.blockUI({
|
||||||
|
message: '<div class="loaderbox"><div class="loading-activity"></div> ' + message + '</div>'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 关闭遮罩层
|
// 关闭遮罩层
|
||||||
closeLoading: function() {
|
closeLoading: function() {
|
||||||
|
|
@ -477,7 +490,9 @@
|
||||||
remove: function(id) {
|
remove: function(id) {
|
||||||
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
|
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
|
||||||
var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id);
|
var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id);
|
||||||
var data = { "ids": id };
|
var data = {
|
||||||
|
"ids": id
|
||||||
|
};
|
||||||
$.operate.submit(url, "post", "json", data);
|
$.operate.submit(url, "post", "json", data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -490,7 +505,9 @@
|
||||||
}
|
}
|
||||||
$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
|
$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
|
||||||
var url = $.table._option.removeUrl;
|
var url = $.table._option.removeUrl;
|
||||||
var data = { "ids": rows.join() };
|
var data = {
|
||||||
|
"ids": rows.join()
|
||||||
|
};
|
||||||
$.operate.submit(url, "post", "json", data);
|
$.operate.submit(url, "post", "json", data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -629,9 +646,21 @@
|
||||||
// 树结构初始化加载
|
// 树结构初始化加载
|
||||||
var setting = {
|
var setting = {
|
||||||
check: options.check,
|
check: options.check,
|
||||||
view: { selectedMulti: false, nameIsHTML: true },
|
view: {
|
||||||
data: { key: { title: "title" }, simpleData: { enable: true } },
|
selectedMulti: false,
|
||||||
callback: { onClick: options.onClick }
|
nameIsHTML: true
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
title: "title"
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: options.onClick
|
||||||
|
}
|
||||||
};
|
};
|
||||||
$.get(options.url, function(data) {
|
$.get(options.url, function(data) {
|
||||||
var treeName = $("#treeName").val();
|
var treeName = $("#treeName").val();
|
||||||
|
|
@ -794,10 +823,7 @@
|
||||||
common: {
|
common: {
|
||||||
// 判断字符串是否为空
|
// 判断字符串是否为空
|
||||||
isEmpty: function(value) {
|
isEmpty: function(value) {
|
||||||
if (value == null || this.trim(value) == "") {
|
return value == null || this.trim(value) === "" || typeof(value) == "undefined";
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
// 判断一个字符串是否为非空串
|
// 判断一个字符串是否为非空串
|
||||||
isNotEmpty: function(value) {
|
isNotEmpty: function(value) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue