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.

259 lines
10 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>添加</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">
<script src="../../lib/jquery-3.6.0.min.js"></script>
<!-- 让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: 150px;
height: 38px;
line-height: 38px;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 15px;
padding-left: 6px;
color: #666;
}
#div2, #div3 {
float: left;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form">
<div id="div3" class="layui-form-item">
<label class="layui-form-label">
<span class="we-red">*</span>办学类型:
</label>
<div class="layui-input-inline" id="select_3"></div>
<script type="text/html" id="test3">
<select name="service_type" id="sel3">
{{#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 id="div4" class="layui-form-item">
<label class="layui-form-label">
<span class="we-red">*</span>举办者:
</label>
<div class="layui-input-inline" id="select_4"></div>
<script type="text/html" id="test4">
<select name="service_type" id="sel4">
{{#layui.each(d.data,function(index,item){ }}
<option value={{item.property_id}}>{{item.property_name}}</option>
{{# }) }}
{{# if(d.data.length === 0){ }}
无数据
{{# } }}
</select>
</script>
</div>
<div id="div5" class="layui-form-item" style="display: none;">
<label class="layui-form-label">
<span class="we-red">*</span>隶属关系:
</label>
<div class="layui-input-inline" id="select_5" style="width: 400px;"></div>
<script type="text/html" id="test5">
{{# layui.each(d, function(index,item){ }}
<span style="margin-right:0">
<input type="radio" value={{item.level_id}} name="level" title={{item.level_name}}
lay-verify="required">
</span>
{{# }); }}
</script>
</div>
<div class="layui-form-item" style="display: none;">
<label for="name" class="layui-form-label">
<span class="we-red">*</span>城乡类型:
</label>
<div class="layui-input-block">
<input type="radio" name="chengxiang" value="1" title="城区" checked="">
<input type="radio" name="chengxiang" value="2" title="镇区">
<input type="radio" name="chengxiang" value="3" title="乡村">
</div>
</div>
<div class="layui-form-item">
<label for="name" class="layui-form-label">
<span class="we-red">*</span>机构名称:
</label>
<div class="layui-input-inline textinput">
<input type="text" id="name" name="name" lay-verify="required|contentLength" min="2" max="64"
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 textinput">
<input type="text" id="sort_id" name="sort_id" lay-verify="required|number|contentLength" max="6"
autocomplete="off"
class="layui-input">
</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 textinput">
<input type="text" id="code" name="code" lay-verify="required|string|contentLength" max="36"
autocomplete="off"
class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" 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;
// 获取学校类型
window.getSchoolType = function () {
$.ajax({
type: "GET",
dataType: "json",
url: "/FengHuang/organization/getSchoolType",
success: function (data) {
var getTpl = test3.innerHTML
, select_3 = document.getElementById('select_3');
laytpl(getTpl).render(data, function (html) {
select_3.innerHTML = html;
});
var school_type = GetQueryString("school_type");
if (school_type != "-1") {
$("#sel3").val(school_type);
}
form.render();
}
});
};
// 获取学校办别
window.getDmSchoolProperty = function () {
$.ajax({
type: "GET",
dataType: "json",
url: "/FengHuang/dm/getDmSchoolProperty",
success: function (data) {
var getTpl = test4.innerHTML
, select_4 = document.getElementById('select_4');
laytpl(getTpl).render(data, function (html) {
select_4.innerHTML = html;
});
form.render();
}
});
};
// 获取隶属关系
window.getDmSchoolLevel = function () {
$.ajax({
type: "GET",
dataType: "json",
url: "/FengHuang/dm/getDmSchoolLevel",
success: function (data) {
var getTpl = test5.innerHTML
, select_5 = document.getElementById('select_5');
laytpl(getTpl).render(data, function (html) {
select_5.innerHTML = html;
});
$('input:radio[name=level]')[0].checked = true;
form.render();
}
});
};
//绑定学校类型
getSchoolType();
getDmSchoolProperty();
getDmSchoolLevel();
verifyLength();
//监听提交
form.on('submit(add)', function (data) {
var org_code = $("#code").val();
var org_name = $("#name").val();
var sort_id = $("#sort_id").val();
//城乡类型
var chengxiang = $("input[name='chengxiang']:checked").val();
var f = data.field;
var data = {
org_code: org_code,
org_name: org_name,
parent_org_id: GetQueryString("area_id"),
org_type_id: "2", //org_type_id int 4 组织机构类型 1教育局 2学校 3部门 4院 5系 6专业 7教辅单位,8:大学区
sort_id: sort_id,
school_type_id: $("#sel3 option:selected").val(),
property_id: $("#sel4 option:selected").val(),
level_id: f.level,
chengxiang: chengxiang,
};
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/FengHuang/organization/addBureau",
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', {
where: {
school_type_id: $("#sel3 option:selected").val(),
parent_org_id: $("#area_id", parent.document).val()
}
, page: {
curr: 1
}
});
$("#sel3", parent.document).val($("#sel3 option:selected").val());
});
} else {
layer.msg(data.message, {icon: 2, time: 2000, shade: 0.1});
}
}
});
return false;
});
});
</script>
</body>
</html>