You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
11 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加会员-WeAdmin Frame型后台管理系统-WeAdmin 1.0</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">
<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">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
.layui-form-label {
width: 90px !important;
}
input[type='text'] {
width: 320px !important;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form" lay-filter="editForm">
<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 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="128"
autocomplete="off" class="layui-input">
</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>
</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>
</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" title="二级审核员" lay-filter="chk" value="4">
</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" name="school" title="学校管理员">
</span>
<span style="display: inline-block;margin:0 10px 8px 10px">
<input type="checkbox" lay-filter="bureau" name="bureau" title="非学校管理员">
</span>
</div>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="save" lay-submit="">确定</button>
</div>
</form>
</div>
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'admin', 'layer'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer;
var for_school = "";//学校管理员
var for_bureau = "";//非学校管理员
var id;
$(function () {
id = GetQueryString("id");
selectSingle();
})
// 根据id获取信息
function selectSingle() {
$.ajax({
url: '/baseService/menu/selectSingle?menu_id=' + id,
type: "GET",
dataType: 'json',
success: function (data) {
var lis1 = data.menu_info[0];
form.val('editForm', {
name: lis1.menu_name,
memo: lis1.memo,
sort_id: lis1.sort_id,
url: lis1.url
});
for_bureau = lis1.for_bureau;
for_school = lis1.for_school;
for (var i = 0; i < data.identity_info.length; i++) {
$("input[type='checkbox'][value=" + data.identity_info[i].identity_id + "]").attr("checked", true);
if (data.identity_info[i].identity_id == 4) {
$("#school").show();
if (lis1.for_school == 1) {
$("input[type='checkbox'][name='school']").attr("checked", true);
}
if (lis1.for_bureau == 1) {
$("input[type='checkbox'][name='bureau']").attr("checked", true);
}
}
}
form.render();
}
})
}
// 选中学校管理员 for_school=1
form.on('checkbox(school)', function (data) {
if (data.elem.checked) {
for_school = 1;
} else {
for_school = 0;
}
});
// 选中非学校管理员 for_bureau=1
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();
}
});
verifyLength();
//监听提交
form.on('submit(save)', 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;
}
}
console.log(f);
$.ajax({
url: '/baseService/menu/UpdateMenu',
type: "POST",
dataType: 'json',
data: {
menu_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) {
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.treeReload(id);
});
} else {
layer.alert(data.message, {icon: 0})
}
}
})
return false;
});
});
</script>
</body>
</html>