|
@@ -1939,20 +1939,21 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'config'], f
|
|
|
options = $.extend({
|
|
|
type: "POST",
|
|
|
dataType: 'json',
|
|
|
- success: function (data) {
|
|
|
+ success: function (ret) {
|
|
|
Backend.api.layer.close(index);
|
|
|
- if (data.hasOwnProperty("code")) {
|
|
|
- var content = data.hasOwnProperty("content") && data.content != "" ? data.content : "";
|
|
|
- if (data.code === 1) {
|
|
|
+ if (ret.hasOwnProperty("code")) {
|
|
|
+ var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
|
|
+ var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
|
|
+ if (ret.code === 1) {
|
|
|
if (typeof success == 'function') {
|
|
|
- var onAfterResult = success.call(undefined, content);
|
|
|
+ var onAfterResult = success.call(undefined, data);
|
|
|
if (!onAfterResult) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
- Toastr.success(content ? content : __('Operation completed'));
|
|
|
+ Toastr.success(msg ? msg : __('Operation completed'));
|
|
|
} else {
|
|
|
- Toastr.error(content ? content : __('Operation failed'));
|
|
|
+ Toastr.error(msg ? msg : __('Operation failed'));
|
|
|
}
|
|
|
} else {
|
|
|
Toastr.error(__('Unknown data format'));
|
|
@@ -2000,14 +2001,23 @@ define('backend',['jquery', 'bootstrap', 'toastr', 'layer', 'lang', 'config'], f
|
|
|
processData: false,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
- success: function (data) {
|
|
|
- if (data.hasOwnProperty("code")) {
|
|
|
- var content = data.hasOwnProperty("content") && data.content != "" ? data.content : "";
|
|
|
- if (data.code === 1) {
|
|
|
- $('.summernote').summernote("insertImage", data.content, 'filename');
|
|
|
+ success: function (ret) {
|
|
|
+ if (ret.hasOwnProperty("code")) {
|
|
|
+ var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
|
|
+ var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
|
|
+ if (ret.code === 1) {
|
|
|
+ if (typeof callback == 'function') {
|
|
|
+ var onAfterResult = success.call(undefined, data);
|
|
|
+ if (!onAfterResult) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($('.summernote').size() > 0 && data && typeof data.url !== 'undefined') {
|
|
|
+ $('.summernote').summernote("insertImage", data.url, 'filename');
|
|
|
+ }
|
|
|
Toastr.success(__('Operation completed'));
|
|
|
} else {
|
|
|
- Toastr.error(content ? content : __('Operation failed'));
|
|
|
+ Toastr.error(msg ? msg : __('Operation failed'));
|
|
|
}
|
|
|
} else {
|
|
|
Toastr.error(__('Unknown data format'));
|
|
@@ -7381,7 +7391,7 @@ define('table',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment',
|
|
|
table: table.bootstrapTable('getOptions').extend.table
|
|
|
}
|
|
|
};
|
|
|
- Backend.api.ajax(options, function (content) {
|
|
|
+ Backend.api.ajax(options, function (data) {
|
|
|
Toastr.success(__('Operation completed'));
|
|
|
table.bootstrapTable('refresh');
|
|
|
});
|
|
@@ -7400,7 +7410,7 @@ define('table',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment',
|
|
|
var url = action == "del" ? options.extend.del_url : options.extend.multi_url;
|
|
|
url = url + "/ids/" + ($.isArray(ids) ? ids.join(",") : ids);
|
|
|
var options = {url: url, data: {action: action, ids: ids, params: element ? $(element).data("params") : ''}};
|
|
|
- Backend.api.ajax(options, function (content) {
|
|
|
+ Backend.api.ajax(options, function (data) {
|
|
|
Toastr.success(__('Operation completed'));
|
|
|
table.bootstrapTable('refresh');
|
|
|
});
|
|
@@ -7438,6 +7448,8 @@ define('table',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment',
|
|
|
// 单元格数据格式化
|
|
|
formatter: {
|
|
|
icon: function (value, row, index) {
|
|
|
+ if (!value)
|
|
|
+ return '';
|
|
|
value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
|
|
|
//渲染fontawesome图标
|
|
|
return '<i class="' + value + '"></i> ' + value;
|
|
@@ -7564,6 +7576,7 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|
|
var maxsize = $(this).data("maxsize");
|
|
|
var mimetype = $(this).data("mimetype");
|
|
|
var multipart = $(this).data("multipart");
|
|
|
+ var multiple = $(this).data("multiple");
|
|
|
//上传URL
|
|
|
url = url ? url : Config.upload.uploadurl;
|
|
|
//最大可上传
|
|
@@ -7572,10 +7585,13 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|
|
mimetype = mimetype ? mimetype : Config.upload.mimetype;
|
|
|
//请求的表单参数
|
|
|
multipart = multipart ? multipart : Config.upload.multipart;
|
|
|
+ //是否支持批量上传
|
|
|
+ multiple = multiple ? multiple : Config.upload.multiple;
|
|
|
+ //生成Plupload实例
|
|
|
Upload.list[id] = new Plupload.Uploader({
|
|
|
runtimes: 'html5,flash,silverlight,html4',
|
|
|
- multi_selection: false, //是否允许多选批量上传
|
|
|
- browse_button: id, // you can pass an id...
|
|
|
+ multi_selection: multiple, //是否允许多选批量上传
|
|
|
+ browse_button: id, // 浏览按钮的ID
|
|
|
container: $(this).parent().get(0), //取按钮的上级元素
|
|
|
flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
|
|
|
silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
|
|
@@ -7612,13 +7628,13 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|
|
//document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML += (' [Url]: ' + '<a href="' + url + '" target="_blank">' + url + '</a>');
|
|
|
//这里建议不修改
|
|
|
try {
|
|
|
- var data = JSON.parse(info.response);
|
|
|
- if (data.hasOwnProperty('code')) {
|
|
|
- data.code = data.code == 200 ? 0 : data.code;
|
|
|
- if (data.hasOwnProperty("url")) {
|
|
|
- data.content = data.url;
|
|
|
- }
|
|
|
- $("input[data-plupload-id='" + id + "-text']").val(data.content);
|
|
|
+ var ret = JSON.parse(info.response);
|
|
|
+ if (ret.hasOwnProperty('code')) {
|
|
|
+ ret.data = ret.code == 200 ? ret : ret.data;
|
|
|
+ ret.code = ret.code == 200 ? 1 : ret.code;
|
|
|
+ var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
|
|
+ var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
|
|
+ $("input[data-plupload-id='" + id + "-text']").val(data.url);
|
|
|
var afterUpload = $("#" + id).data("after-upload");
|
|
|
if (afterUpload && typeof Upload.api.custom[afterUpload] == 'function') {
|
|
|
Upload.api.custom[afterUpload].call(info, id, data);
|
|
@@ -7656,22 +7672,21 @@ define('upload',['jquery', 'bootstrap', 'backend', 'config', 'plupload'], functi
|
|
|
processData: false,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
- success: function (data) {
|
|
|
- if (data.hasOwnProperty("code")) {
|
|
|
- data.code = data.code == 200 ? 1 : data.code;
|
|
|
- if (data.hasOwnProperty("url")) {
|
|
|
- data.content = data.url;
|
|
|
- }
|
|
|
- var content = data.hasOwnProperty("content") && data.content != "" ? data.content : "";
|
|
|
- if (data.code === 1) {
|
|
|
+ success: function (ret) {
|
|
|
+ if (ret.hasOwnProperty("code")) {
|
|
|
+ ret.data = ret.code == 200 ? ret : ret.data;
|
|
|
+ ret.code = ret.code == 200 ? 1 : ret.code;
|
|
|
+ var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
|
|
+ var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
|
|
+ if (ret.code === 1) {
|
|
|
// 如果回调存在,则直接调用回调
|
|
|
if (typeof callback == 'function') {
|
|
|
callback.call(this, data);
|
|
|
} else {
|
|
|
- Toastr.success(content ? content : __('Operation completed'));
|
|
|
+ Toastr.success(msg ? msg : __('Operation completed'));
|
|
|
}
|
|
|
} else {
|
|
|
- Toastr.error(content ? content : __('Operation failed'));
|
|
|
+ Toastr.error(msg ? msg : __('Operation failed'));
|
|
|
}
|
|
|
} else {
|
|
|
Toastr.error(__('Unknown data format'));
|
|
@@ -8251,28 +8266,29 @@ define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', '
|
|
|
url: url,
|
|
|
data: form.serialize(),
|
|
|
dataType: 'json',
|
|
|
- success: function (data) {
|
|
|
- if (data.hasOwnProperty("code")) {
|
|
|
- var content = data.hasOwnProperty("content") && data.content != "" ? data.content : "";
|
|
|
- if (data.code === 1) {
|
|
|
+ success: function (ret) {
|
|
|
+ if (ret.hasOwnProperty("code")) {
|
|
|
+ var data = ret.hasOwnProperty("data") && ret.data != "" ? ret.data : null;
|
|
|
+ var msg = ret.hasOwnProperty("msg") && ret.msg != "" ? ret.msg : "";
|
|
|
+ if (ret.code === 1) {
|
|
|
$('.form-group', form).removeClass('has-feedback has-success has-error');
|
|
|
//成功提交后事件
|
|
|
var afterSubmit = form.data("after-submit");
|
|
|
//元素绑定函数
|
|
|
if (afterSubmit && typeof Form.api.custom[afterSubmit] == 'function') {
|
|
|
- if (!Form.api.custom[afterSubmit].call(form, content)) {
|
|
|
+ if (!Form.api.custom[afterSubmit].call(form, data)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
//自定义函数
|
|
|
if (typeof onAfterSubmit == 'function') {
|
|
|
- if (!onAfterSubmit.call(form, content)) {
|
|
|
+ if (!onAfterSubmit.call(form, data)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
- Toastr.success(content ? content : __('Operation completed'));
|
|
|
+ Toastr.success(msg ? msg : __('Operation completed'));
|
|
|
} else {
|
|
|
- Toastr.error(content ? content : __('Operation failed'));
|
|
|
+ Toastr.error(msg ? msg : __('Operation failed'));
|
|
|
}
|
|
|
} else {
|
|
|
Toastr.error(__('Unknown data format'));
|
|
@@ -8289,19 +8305,16 @@ define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', '
|
|
|
if (e.isDefaultPrevented()) {
|
|
|
//验证不通过
|
|
|
Toastr.error("验证失败,请检查表单输入是否正确");
|
|
|
- //Backend.api.error();
|
|
|
} else {
|
|
|
//验证通过提交表单
|
|
|
- Form.api.submit(form, onBeforeSubmit, function (content) {
|
|
|
+ Form.api.submit(form, onBeforeSubmit, function (data) {
|
|
|
if (typeof onAfterSubmit == 'function') {
|
|
|
- if (!onAfterSubmit.call(form, content)) {
|
|
|
+ if (!onAfterSubmit.call(form, data)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
//提示及关闭当前窗口
|
|
|
- parent.Layer.msg(__('Operation completed'), {
|
|
|
- offset: 0, icon: 1
|
|
|
- });
|
|
|
+ parent.Toastr.success(__('Operation completed'));
|
|
|
parent.$(".btn-refresh").trigger("click");
|
|
|
var index = parent.Layer.getFrameIndex(window.name);
|
|
|
parent.Layer.close(index);
|
|
@@ -8336,8 +8349,8 @@ define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', '
|
|
|
remote: {
|
|
|
url: '/ajax/typeahead?search=%QUERY&field=' + $(input).attr("name"),
|
|
|
wildcard: '%QUERY',
|
|
|
- transform: function (data) {
|
|
|
- return data.content.searchlist;
|
|
|
+ transform: function (ret) {
|
|
|
+ return ret.data.searchlist;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -8437,7 +8450,7 @@ define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', '
|
|
|
//依次上传图片
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
Upload.api.send(files[i], function (data) {
|
|
|
- var url = Config.upload.cdnurl + data.content;
|
|
|
+ var url = Config.upload.cdnurl + data.url;
|
|
|
$(that).summernote("insertImage", url, 'filename');
|
|
|
});
|
|
|
}
|