|
|
|
@ -6,7 +6,8 @@
|
|
|
|
|
<title>增加菜单</title>
|
|
|
|
|
<meta name="renderer" content="webkit">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
|
|
|
<meta name="viewport"
|
|
|
|
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
|
|
|
<link rel="stylesheet" href="../../static/css/font.css">
|
|
|
|
|
<link rel="stylesheet" href="../../static/css/weadmin.css">
|
|
|
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
|
|
|
@ -17,172 +18,232 @@
|
|
|
|
|
<![endif]-->
|
|
|
|
|
<style>
|
|
|
|
|
.layui-form-label {
|
|
|
|
|
width: 100px!important;
|
|
|
|
|
width: 100px !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input[type='text'] {
|
|
|
|
|
width: 320px!important;
|
|
|
|
|
width: 320px !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<div class="weadmin-body">
|
|
|
|
|
<form class="layui-form">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="name" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>菜单名称:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="name" name="name" lay-verify="required|contentLength" max="64" autocomplete="off" class="layui-input">
|
|
|
|
|
<div class="weadmin-body">
|
|
|
|
|
<form class="layui-form">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="name" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>菜单名称:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="name" name="name" lay-verify="required|contentLength" max="64"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="url" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>url地址:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="url" name="url" lay-verify="required|contentLength" max="64" autocomplete="off" class="layui-input">
|
|
|
|
|
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="url" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>url地址:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="url" name="url" lay-verify="required|contentLength" max="64"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="sort_id" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>排序号:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="sort_id" name="sort_id" lay-verify="required|number" autocomplete="off" class="layui-input">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="name" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>图标:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline" style="display: flex;width: 300px;align-items: center;">
|
|
|
|
|
<input type="text" id="icon" name="icon" lay-verify="required" disabled value="Menu"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
<div style="width: 50px;text-align: right;color: #1e9fff;cursor: pointer;" id="selectIcon">选择</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="memo" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>描述信息:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="memo" name="memo" lay-verify="required|contentLength" max="64" autocomplete="off" class="layui-input">
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="name" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>是否全屏:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline" style="display: flex;width: 300px;align-items: center;">
|
|
|
|
|
<input type="checkbox" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="是|否">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="memo" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>可用身份:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-item" style="width: 70%;float: left;padding-top:8px;margin-left: -10px">
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk" title="超级管理员" value="1"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk" title="市级管理员" value="2"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk" title="县区管理员" value="3"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk" lay-filter="chk" title="单位管理员" value="4"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk" title="普通教师" value="5"></span>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="sort_id" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>排序号:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="sort_id" name="sort_id" lay-verify="required|number" autocomplete="off"
|
|
|
|
|
class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item" id="school" style="display: none">
|
|
|
|
|
<label for="" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>学校管理员:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-item" style="width: 70%;float: left;padding-top:8px;margin-left: -10px">
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" lay-filter="school" title="学校管理员" ></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" lay-filter="bureau" title="非学校管理员"></span>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="memo" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>描述信息:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-inline ">
|
|
|
|
|
<input type="text" id="memo" name="memo" lay-verify="required|contentLength" max="64"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="" class="layui-form-label">
|
|
|
|
|
</label>
|
|
|
|
|
<button class="layui-btn" lay-filter="add" lay-submit="">确定</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
layui.extend({
|
|
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
|
|
});
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="memo" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>可用身份:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-item" style="width: 70%;float: left;padding-top:8px;margin-left: -10px">
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk"
|
|
|
|
|
title="超级管理员" value="1"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk"
|
|
|
|
|
title="市级管理员" value="2"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk"
|
|
|
|
|
title="县区管理员" value="3"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk"
|
|
|
|
|
lay-filter="chk" title="单位管理员" value="4"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox" name="chk"
|
|
|
|
|
title="普通教师" value="5"></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item" id="school" style="display: none">
|
|
|
|
|
<label for="" class="layui-form-label">
|
|
|
|
|
<span class="we-red">*</span>学校管理员:
|
|
|
|
|
</label>
|
|
|
|
|
<div class="layui-input-item" style="width: 70%;float: left;padding-top:8px;margin-left: -10px">
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox"
|
|
|
|
|
lay-filter="school" title="学校管理员"></span>
|
|
|
|
|
<span style="display: inline-block;margin:0 10px 8px 10px"><input type="checkbox"
|
|
|
|
|
lay-filter="bureau" title="非学校管理员"></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label for="" class="layui-form-label">
|
|
|
|
|
</label>
|
|
|
|
|
<button class="layui-btn" lay-filter="add" lay-submit="">确定</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
|
|
|
|
|
|
|
|
|
|
layui.use(['form','jquery','admin', 'layer'], function() {
|
|
|
|
|
var form = layui.form,
|
|
|
|
|
$ = layui.jquery,
|
|
|
|
|
admin = layui.admin,
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
var id;
|
|
|
|
|
$(function () {
|
|
|
|
|
id=GetQueryString("id");
|
|
|
|
|
form.render();
|
|
|
|
|
})
|
|
|
|
|
verifyLength();
|
|
|
|
|
var for_school=0;
|
|
|
|
|
var for_bureau=0;
|
|
|
|
|
form.on('checkbox(school)', function(data){
|
|
|
|
|
if(data.elem.checked){
|
|
|
|
|
for_school=1;
|
|
|
|
|
}else{
|
|
|
|
|
for_school=0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
form.on('checkbox(bureau)', function(data){
|
|
|
|
|
if(data.elem.checked){
|
|
|
|
|
for_bureau=1;
|
|
|
|
|
}else{
|
|
|
|
|
for_bureau=0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 点击单位管理员 显示是否学校
|
|
|
|
|
form.on('checkbox(chk)', function(data){
|
|
|
|
|
if(data.elem.checked){
|
|
|
|
|
$("#school").show();
|
|
|
|
|
}else{
|
|
|
|
|
$("#school").hide();
|
|
|
|
|
}
|
|
|
|
|
<script>
|
|
|
|
|
layui.extend({
|
|
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//监听提交
|
|
|
|
|
form.on('submit(add)', function(data) {
|
|
|
|
|
var arr = new Array();
|
|
|
|
|
$("input:checkbox[name='chk']:checked").each(function(i){
|
|
|
|
|
arr[i] = $(this).val();
|
|
|
|
|
layui.use(['form', 'jquery', 'admin', 'layer'], function () {
|
|
|
|
|
var form = layui.form,
|
|
|
|
|
$ = layui.jquery,
|
|
|
|
|
admin = layui.admin,
|
|
|
|
|
layer = layui.layer;
|
|
|
|
|
var id;
|
|
|
|
|
|
|
|
|
|
var isfullFlag = 0;
|
|
|
|
|
$(function () {
|
|
|
|
|
id = GetQueryString("id");
|
|
|
|
|
form.render();
|
|
|
|
|
})
|
|
|
|
|
verifyLength();
|
|
|
|
|
var for_school = 0;
|
|
|
|
|
var for_bureau = 0;
|
|
|
|
|
form.on('checkbox(school)', function (data) {
|
|
|
|
|
if (data.elem.checked) {
|
|
|
|
|
for_school = 1;
|
|
|
|
|
} else {
|
|
|
|
|
for_school = 0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
data.field.chk = arr.join(",");//将数组合并成字符串
|
|
|
|
|
var f=data.field;
|
|
|
|
|
if(f.chk==""){
|
|
|
|
|
layer.msg("请选择可用身份",{icon:5})
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if($("#school").is(":visible")){
|
|
|
|
|
if(for_school==0&&for_bureau==0){
|
|
|
|
|
layer.msg("请选择是否为学校管理员",{icon:5})
|
|
|
|
|
return false;
|
|
|
|
|
form.on('checkbox(bureau)', function (data) {
|
|
|
|
|
if (data.elem.checked) {
|
|
|
|
|
for_bureau = 1;
|
|
|
|
|
} else {
|
|
|
|
|
for_bureau = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$.ajax({
|
|
|
|
|
type : "POST",
|
|
|
|
|
async : false,
|
|
|
|
|
dataType : "json",
|
|
|
|
|
url :"/dsBase/menu/AddMenu",
|
|
|
|
|
data:{
|
|
|
|
|
parent_id:id,
|
|
|
|
|
sort_id:f.sort_id,
|
|
|
|
|
menu_name:f.name,
|
|
|
|
|
url:f.url,
|
|
|
|
|
memo:f.memo,
|
|
|
|
|
identity_ids:f.chk,
|
|
|
|
|
for_school:for_school,
|
|
|
|
|
for_bureau:for_bureau
|
|
|
|
|
},
|
|
|
|
|
success : function(data) {
|
|
|
|
|
if(data.success){
|
|
|
|
|
var nodeId=data.result["menu_id"];
|
|
|
|
|
layer.msg("增加成功", {icon: 1,time:1000,shade : [0.5 , '#000' , true]},function() {
|
|
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
|
|
parent.layer.close(index);
|
|
|
|
|
window.parent.reloadTree(id,nodeId);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// 点击单位管理员 显示是否学校
|
|
|
|
|
form.on('checkbox(chk)', function (data) {
|
|
|
|
|
if (data.elem.checked) {
|
|
|
|
|
$("#school").show();
|
|
|
|
|
} else {
|
|
|
|
|
$("#school").hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
layer.alert(data.message, {icon: 0});
|
|
|
|
|
//监听提交
|
|
|
|
|
form.on('submit(add)', function (data) {
|
|
|
|
|
var arr = new Array();
|
|
|
|
|
$("input:checkbox[name='chk']:checked").each(function (i) {
|
|
|
|
|
arr[i] = $(this).val();
|
|
|
|
|
});
|
|
|
|
|
data.field.chk = arr.join(",");//将数组合并成字符串
|
|
|
|
|
var f = data.field;
|
|
|
|
|
if (f.chk == "") {
|
|
|
|
|
layer.msg("请选择可用身份", { icon: 5 })
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if ($("#school").is(":visible")) {
|
|
|
|
|
if (for_school == 0 && for_bureau == 0) {
|
|
|
|
|
layer.msg("请选择是否为学校管理员", { icon: 5 })
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return false;
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
async: false,
|
|
|
|
|
dataType: "json",
|
|
|
|
|
url: "/dsBase/menu/AddMenu",
|
|
|
|
|
data: {
|
|
|
|
|
parent_id: id,
|
|
|
|
|
sort_id: f.sort_id,
|
|
|
|
|
menu_name: f.name,
|
|
|
|
|
url: f.url,
|
|
|
|
|
memo: f.memo,
|
|
|
|
|
identity_ids: f.chk,
|
|
|
|
|
for_school: for_school,
|
|
|
|
|
for_bureau: for_bureau,
|
|
|
|
|
icon: $("#icon").val(),
|
|
|
|
|
isFull: isfullFlag
|
|
|
|
|
},
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.success) {
|
|
|
|
|
var nodeId = data.result["menu_id"];
|
|
|
|
|
layer.msg("增加成功", { icon: 1, time: 1000, shade: [0.5, '#000', true] }, function () {
|
|
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
|
|
parent.layer.close(index);
|
|
|
|
|
window.parent.reloadTree(id, nodeId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
layer.alert(data.message, { icon: 0 });
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.setIconName = function (iconName) {
|
|
|
|
|
$("#icon").val(iconName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#selectIcon").click(function () {
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 2,
|
|
|
|
|
area: ['500px', '450px'],
|
|
|
|
|
fix: false, //不固定
|
|
|
|
|
maxmin: true,
|
|
|
|
|
shadeClose: false,
|
|
|
|
|
shade: 0.4,
|
|
|
|
|
title: '选择图标',
|
|
|
|
|
content: './icons.html'
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
form.on('switch(switchTest)', function (data) {
|
|
|
|
|
if (this.checked) {
|
|
|
|
|
isfullFlag = 1;
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|