新增文档分类列表树

This commit is contained in:
hogan
2019-01-25 16:49:09 +08:00
parent a9afd0d23d
commit 96c2a66131
25 changed files with 875 additions and 515 deletions

View File

@ -59,6 +59,15 @@
skin: 'layer-ext-moon'
}, yes, no);
},
markDownEdit: function (id, option) {
var _option = $.extend({
width: "96%",
height: 640,
syncScrolling: "single",
path: "../../lib/editormd/lib/"
}, options);
return editormd(id, _option);
},
ajax: function (url, appendPostData, beforeFn, completeFn, successFn, errorFn, isShowLoading) {
jQuery.ajax({
type: "POST",
@ -113,8 +122,129 @@
}
}
});
},
dialogWindow: {
/*
url: "/Admin/Document/DocContentEditModule", //页面地址
paramters: { id: "" }, //参数
-------------------------------------------------------
title: "新增文档", //标题
area: ['1100px', '660px'], //尺寸
submit: { //提交参数
url: "/Admin/Document/DocContentCreate", // 提交的地址
}, //
callback: reloadTable //执行完成回调函数
*/
create: function (options, formpage) {
$("#docContentEdit").load(options.url, options.paramters, function (responseText, textStatus, jqXHR) {
switch (textStatus) {
case "success":
freejs.dialogWindow.open($.extend({
type: 1,
maxmin: true,
title: "编辑",
area: ['1100px', '660px'],
shadeClose: false, //点击遮罩关闭
content: responseText,
submit: {
url: "/Admin/Document/DocContentCreate",
}
}, options), form);
break;
case "error":
freejs.showMessage({ title: "提示", msg: "页面加载失败", type: 2 });
break;
}
});
},
/*
{
type: 1,
maxmin: true,
title: "编辑",
area: ['1100px', '660px'],
shadeClose: false, //点击遮罩关闭
content: responseText,
submit: {
url: "/Admin/Document/DocContentCreate",
}
}
*/
open: function (options, form) {
var base_options = {
type: 1,
maxmin: true,
title: "编辑",
area: ['1100px', '660px'],
shadeClose: false //点击遮罩关闭
};
var new_options = $.extend(base_options, options);
new_options.success = function (layero, index) {
form.render();
$(".form-module-content").height(dialog_Paramters.height - 110);
contentEdit = editormd("md_DocContent", {
width: "96%",
height: 640,
syncScrolling: "single",
path: "../../lib/editormd/lib/"
});
//监听提交
form.on('submit(formDemo)', function (data) {
$.ajax({
type: 'POST',
url: options.submit.url,//"/Admin/Document/DocContentCreate",
data: JSON.stringify(data.field),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (e) {
if (e.Status == 1) {
freejs.showMessage({ title: "提示", msg: e.Msg || "保存成功", type: 1 });
if ($.isFunction(new_options.callback)) new_options.callback();
layer.close(index);
}
else {
freejs.showMessage({ title: "提示", msg: e.Msg, type: 2 });
}
}
});
return false;
});
}
layer.open(new_options);
},
close: function () {
}
}
};
window.freejs = new base();
/**
* 数组扩展
* @param {any} func
*/
Array.prototype.select = function (func) {
var retValues = [];
if (this.length == 0) {
return retValues;
}
if (func == null) {
return this;
}
for (var i = 0; i < this.length; i++) {
retValues.push(func(this[i]));
}
return retValues;
};
Array.prototype.where = function (func) {
if (func == null) {
return this;
}
var retList = [];
for (var i = 0; i < this.length; i++) {
if (func(this[i]) != false) {
retList.push(this[i]);
}
}
return retList;
}
})(window);