新增文档分类列表树

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

@ -16,7 +16,7 @@
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="add">添加</button>
@*<button class="layui-btn layui-btn-sm" lay-event="delete">删除</button>
<button class="layui-btn layui-btn-sm" lay-event="update">编辑</button>*@
<button class="layui-btn layui-btn-sm" lay-event="update">编辑</button>*@
<div style="float:right;border:0px solid red;">
<input type="text" name="search_txt" lay-verify="title" autocomplete="off" placeholder="标题" class="layui-input" style="height: 30px;width:160px;float:left;">
<a href="#" style="line-height:30px;margin-left:8px;">高级查询</a>
@ -30,21 +30,11 @@
</script>
<script>
var testEditor;
layui.use(['form', 'layedit', 'laydate', 'table'], function () {
var contentEdit;
layui.use(['form', 'table'], function () {
var table = layui.table;
var form = layui.form
, layer = layui.layer
, layedit = layui.layedit
, laydate = layui.laydate;
//日期
laydate.render({
elem: '#date'
});
laydate.render({
elem: '#date1'
});
, layer = layui.layer;
table.render({
@ -65,7 +55,7 @@
, { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
]]
, page: true
, id : 'docContentTable'
, id: 'docContentTable'
});
var reloadTable = function () {
@ -77,6 +67,26 @@
});
};
var deleteObj = function (removeRowDatas) {
layer.confirm('确定要删除吗?', function (index) {
//调用删除
$.ajax({
type: "POST",
url: "/Admin/Document/DocContentDelete",
data: { id: rowid },
dataType: "html",
success: function (data) {
obj.del();
layer.close(index);
},
error: function () {
layer.close(index);
layer.alert("删除失败!");
}
});
});
}
//监听事件
table.on('toolbar(test)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
@ -91,10 +101,11 @@
},
callback: reloadTable
};
dialogWindow.create(options);
freejs.dialogWindow.create(options);
break;
case 'delete':
layer.msg('删除');
var data = checkStatus.data;
deleteObj(data);
break;
case 'update':
layer.msg('编辑');
@ -106,6 +117,7 @@
table.on('tool(test)', function (obj) {
var data = obj.data;
if (obj.event === 'del') {
deleteObj(obj.data);
layer.confirm('确定要删除吗?', function (index) {
//调用删除
$.ajax({
@ -133,92 +145,10 @@
},
callback: reloadTable
};
dialogWindow.create(options);
//form.render();
//layer.prompt({
// formType: 2
// , value: data.email
//}, function (value, index) {
// obj.update({
// email: value
// });
// layer.close(index);
//});
freejs.dialogWindow.create(options);
}
});
//先简单封装下
var dialogWindow = {
create: function (options, formpage) {
$("#docContentEdit").load(options.url, options.paramters, function (responseText, textStatus, jqXHR) {
switch (textStatus) {
case "success":
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;
}
});
},
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);
testEditor = 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 () {
}
};
$(document).on('click', '#btnSubmit', function () {
layer.msg('响应点击事件');
});