|
|
<!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>
|
|
|
select {
|
|
|
width: 180px;
|
|
|
height: 38px;
|
|
|
line-height: 38px;
|
|
|
border: 1px solid #ccc;
|
|
|
border-radius: 3px;
|
|
|
font-size: 15px;
|
|
|
padding-left: 6px;
|
|
|
color:#666;
|
|
|
}
|
|
|
|
|
|
|
|
|
</style>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<div class="weadmin-body">
|
|
|
<form class="layui-form">
|
|
|
<div class="layui-form-item">
|
|
|
<label for="" class="layui-form-label">
|
|
|
<span class="we-red">*</span> 单位类型:
|
|
|
</label>
|
|
|
<div class="layui-input-inline" id="select_type"></div>
|
|
|
<script type="text/html" id="select_type_script">
|
|
|
<select name="service_type" id="service_type" >
|
|
|
{{#layui.each(d.data,function(index,item){ }}
|
|
|
<option value={{item.id}}>{{item.name}}</option>
|
|
|
{{# }) }}
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
<!--<div class="layui-form-item hide" id="schoolType">-->
|
|
|
<!--<label for="" class="layui-form-label" >-->
|
|
|
<!--<span class="we-red">*</span> 学校类型:-->
|
|
|
<!--</label>-->
|
|
|
<!--<div class="inline" id="school_type"></div>-->
|
|
|
<!--<script type="text/html" id="school_type_script">-->
|
|
|
<!--<select name="school_type" id="school">-->
|
|
|
<!--{{#layui.each(d.data,function(index,item){ }}-->
|
|
|
<!--<option value={{item.school_type_id}}>{{item.school_type_name}}</option>-->
|
|
|
<!--{{# }) }}-->
|
|
|
<!--{{# if(d.data.length === 0){ }}-->
|
|
|
<!--无数据-->
|
|
|
<!--{{# } }}-->
|
|
|
<!--</select>-->
|
|
|
<!--</script>-->
|
|
|
<!--</div>-->
|
|
|
<div class="layui-form-item hide" id="branch">
|
|
|
<label for="" class="layui-form-label" >
|
|
|
<span class="we-red">*</span> 是否是分校:
|
|
|
</label>
|
|
|
<input type="checkbox" id="chk" onclick="getSchList();">分校
|
|
|
</div>
|
|
|
<div class="layui-form-item hide" id="schoolList">
|
|
|
<label for="" class="layui-form-label" >
|
|
|
<span class="we-red">*</span>主校列表:
|
|
|
</label>
|
|
|
<div class="inline" id="school_list"></div>
|
|
|
<script type="text/html" id="school_list_script">
|
|
|
<select name="school_type" id="schools">
|
|
|
<%if(data.length==0){%>
|
|
|
<option value="0">暂无</option>
|
|
|
<%}else{%>
|
|
|
<% for (var i = 0; i < data.length; i ++) { %>
|
|
|
<option value="<%=data[i].school_type_id%>"><%=data[i].school_type_name%></option>
|
|
|
<% } %>
|
|
|
<% } %>
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
<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" min="2" max="64" autocomplete="off" class="layui-input" style=" width: 350px">
|
|
|
</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|contentLength" max="6" autocomplete="off" class="layui-input" style=" width: 350px">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<label for="code" class="layui-form-label">
|
|
|
<span class="we-red">*</span>单位编码:
|
|
|
</label>
|
|
|
<div class="layui-input-inline ">
|
|
|
<input type="text" id="code" name="code" lay-verify="required|string|contentLength" max="36" autocomplete="off" class="layui-input" style=" width: 350px">
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<label for="" class="layui-form-label">
|
|
|
</label>
|
|
|
<button class="layui-btn" lay-filter="save" lay-submit="" id="save">确定</button>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
<script src="../../lib/layui/layui.js" ></script>
|
|
|
<script src="../../lib/template.js"></script>
|
|
|
|
|
|
<script>
|
|
|
layui.extend({
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
});
|
|
|
layui.use(['form','jquery','admin', 'layer','laytpl'], function() {
|
|
|
var form = layui.form,
|
|
|
$ = layui.jquery,
|
|
|
admin = layui.admin,
|
|
|
layer = layui.layer,
|
|
|
laytpl = layui.laytpl;
|
|
|
var area_id="";
|
|
|
var org_id="";
|
|
|
var level_id="";
|
|
|
|
|
|
// 获取市区下单位类型
|
|
|
window.getOrgtype=function(level_id){
|
|
|
$.ajax({
|
|
|
type : "GET",
|
|
|
async : false,
|
|
|
dataType : "json",
|
|
|
url :"/FengHuang/base/getOrgTypePrincipalshipByParentId?type_id=0&parent_id="+level_id,
|
|
|
success : function(data) {
|
|
|
var getTpl = select_type_script.innerHTML
|
|
|
,select_type = document.getElementById('select_type');
|
|
|
laytpl(getTpl).render(data, function(html){
|
|
|
select_type.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
}
|
|
|
})
|
|
|
$("#org_type").val($("#service_type option:selected").val());
|
|
|
|
|
|
}
|
|
|
window.getOrgInfoById=function (id) {
|
|
|
$.ajax({
|
|
|
type:"GET",
|
|
|
dataType:"json",
|
|
|
url:"/FengHuang/organization/getOrgInfoById?org_id="+id,
|
|
|
success:function (data) {
|
|
|
$("#name").val(data.data[0].org_name);
|
|
|
$("#code").val(data.data[0].org_code);
|
|
|
$("#sort_id").val(data.data[0].sort_id);
|
|
|
$("#service_type option[value='"+data.data[0].org_type_id+"']").attr("selected",true);
|
|
|
$("#service_type").attr("disabled",true);
|
|
|
form.render();
|
|
|
// $.ajax({
|
|
|
// type:"GET",
|
|
|
// dataType:"json",
|
|
|
// url:"/FengHuang/organization/getSchoolType?org_type_id="+data.data[0].org_type_id,
|
|
|
// success:function (data) {
|
|
|
// var html=template.render('school_type_script',data);
|
|
|
// document.getElementById('school_type').innerHTML=html;
|
|
|
// }
|
|
|
// })
|
|
|
// if(data.data[0].school_type_id!== -1){
|
|
|
// $("#schoolType").removeClass("hide");
|
|
|
// setTimeout(function () {
|
|
|
// $("#school option[value='"+data.data[0].school_type_id+"']").attr("selected",true);
|
|
|
// },10)
|
|
|
// }
|
|
|
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
window.getSchList=function(){
|
|
|
if($("#chk").is(":checked")){
|
|
|
$("#schoolList").show();
|
|
|
$.ajax({
|
|
|
type:"GET",
|
|
|
dataType:"json",
|
|
|
url:"/FengHuang/organization/getSchoolList?school_type_ids="+$("#school option:selected").val()+"&parent_id="+area_id+"&page=1&limit=10",
|
|
|
success:function (data) {
|
|
|
var html=template.render('school_list_script',data);
|
|
|
document.getElementById('school_list').innerHTML=html;
|
|
|
}
|
|
|
})
|
|
|
}else{
|
|
|
$("#schoolList").hide();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 切换单位获取学校类型
|
|
|
window.getSchoolType=function(){
|
|
|
var is_school=$("#service_type option:selected").attr("type");
|
|
|
console.log(is_school)
|
|
|
if(is_school==0){
|
|
|
$("#schoolType").addClass("hide");
|
|
|
}else{
|
|
|
$("#schoolType").removeClass("hide");
|
|
|
$.ajax({
|
|
|
type:"GET",
|
|
|
dataType:"json",
|
|
|
url:"/FengHuang/organization/getSchoolType?org_type_id="+$("#service_type option:selected").val(),
|
|
|
success:function (data) {
|
|
|
var html=template.render('school_type_script',data);
|
|
|
document.getElementById('school_type').innerHTML=html;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
level_id=GetQueryString("level_id");
|
|
|
area_id=GetQueryString("area_id");
|
|
|
org_id=GetQueryString("org_id");
|
|
|
getOrgtype(level_id);
|
|
|
getOrgInfoById(org_id);
|
|
|
})
|
|
|
|
|
|
verifyLength();
|
|
|
|
|
|
|
|
|
//监听提交
|
|
|
form.on('submit(save)', function(data) {
|
|
|
var org_code=$("#code").val();
|
|
|
var org_name=$("#name").val();
|
|
|
var sort_id=$("#sort_id").val();
|
|
|
var data={};
|
|
|
data={
|
|
|
bureau_id:org_id,
|
|
|
org_code:org_code,
|
|
|
bureau_name:org_name,
|
|
|
parent_org_id:area_id,
|
|
|
org_type_id:$("#service_type option:selected").val(),
|
|
|
sort_id:sort_id,
|
|
|
main_school_id:-1,
|
|
|
master_id:-1,
|
|
|
school_type_id:-1
|
|
|
}
|
|
|
|
|
|
if(org_name==""){
|
|
|
layer.alert("请输入机构名称",{icon:0})
|
|
|
return;
|
|
|
}
|
|
|
if(sort_id==""){
|
|
|
layer.alert("请输入排序号",{icon:0})
|
|
|
return;
|
|
|
}
|
|
|
if(org_code==""){
|
|
|
layer.alert("请输入code",{icon:0});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type : "POST",
|
|
|
async : false,
|
|
|
dataType : "json",
|
|
|
url :"/FengHuang/organization/updateBureau",
|
|
|
data:data,
|
|
|
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);
|
|
|
parent.layui.table.reload('idTest', {
|
|
|
page: {
|
|
|
curr: 1
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
}else{
|
|
|
layer.alert(data.message, {icon: 0})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
|
|
|
</html> |