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.

187 lines
7.4 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">
<!-- 让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;
}
</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>&nbsp;单位类型:
</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">
<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 for="" 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>
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 level_id = "";
// 获取市区下单位类型
window.getOrgtype = function (level_id, org_type) {
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/baseService/base/getOrgTypePrincipalshipByParentId?type_id=0&parent_id=" + level_id,
success: function (data) {
var lis = [];
var list = {};
for (var i = 0; i < data.data.length; i++) {
if (data.data[i].is_school == 0) {
lis.push(data.data[i]);
}
}
list = {
data: lis
}
var getTpl = select_type_script.innerHTML
, select_type = document.getElementById('select_type');
laytpl(getTpl).render(list, function (html) {
select_type.innerHTML = html;
});
if (org_type != "-1") {
$("#service_type").val(org_type);
}
form.render();
}
})
$("#org_type").val($("#service_type option:selected").val());
}
$(function () {
level_id = GetQueryString("level_id");
area_id = GetQueryString("area_id");
var org_type = GetQueryString("org_type");
getOrgtype(level_id, org_type);
})
//校验长度有有效性
verifyLength();
//监听提交
form.on('submit(add)', function (data) {
var org_code = $("#code").val();
var org_name = $("#name").val();
var sort_id = $("#sort_id").val();
var data = {
org_code: org_code,
org_name: org_name,
parent_org_id: area_id,
org_type_id: $("#service_type option:selected").val(),
sort_id: sort_id,
school_type_id: -1,
property_id:24, //学校办别,(学校专有属性),这里维护的的是机构没有这个概念填写24表示是其他。
level_id:0,//隶属关系, 0普通 1省直 2市直 学校的概念这里维护的是机构没有这个概念填写0表示是普通
};
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/baseService/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: {
org_type_id: $("#service_type option:selected").val(),
parent_org_id: $("#area_id", parent.document).val()
},
page: {
curr: 1
}
});
$("#service_type", parent.document).val($("#service_type option:selected").val());
});
} else {
layer.msg(data.message, {icon: 2, time: 3000, shade: 0.1});
}
}
})
return false;
});
});
</script>
</body>
</html>