|
|
<!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>
|
|
|
.layui-form-label {
|
|
|
width: 90px !important;
|
|
|
}
|
|
|
|
|
|
input {
|
|
|
width: 320px !important;
|
|
|
}
|
|
|
|
|
|
.layui-form-select {
|
|
|
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" min="2" max="32"
|
|
|
autocomplete="off" class="layui-input">
|
|
|
</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 " id="view"></div>
|
|
|
<script type="text/html" id="demo">
|
|
|
{{# layui.each(d.data, function(index,item){ }}
|
|
|
<span style="margin-right:55px">
|
|
|
<input type="radio" value={{item.xb_id}} name="sex" title={{item.xb_name}}
|
|
|
lay-verify="required">
|
|
|
</span>
|
|
|
{{# }); }}
|
|
|
</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="telephone" name="telephone" lay-verify="required|contentLength" min="11" max="11"
|
|
|
autocomplete="off" class="layui-input">
|
|
|
</div>
|
|
|
</div>
|
|
|
<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="mz" lay-filter="mz" lay-verify="required" id="mz">
|
|
|
|
|
|
{{#layui.each(d.data,function(index,item){ }}
|
|
|
<option value={{item.mz_id}}>{{item.mz_name}}</option>
|
|
|
{{# }) }}
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<label for="" class="layui-form-label">
|
|
|
<span class="we-red">*</span>政治面貌:
|
|
|
</label>
|
|
|
<div class="layui-input-inline " id="zzmm_type"></div>
|
|
|
<script type="text/html" id="zzmm_type_script">
|
|
|
<select name="zzmm" lay-filter="zzmm" lay-verify="required" id="zzmm">
|
|
|
|
|
|
{{#layui.each(d.data,function(index,item){ }}
|
|
|
<option value={{item.zzmm_id}}>{{item.zzmm_name}}</option>
|
|
|
{{# }) }}
|
|
|
</select>
|
|
|
</script>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<label for="duty_charge" class="layui-form-label">
|
|
|
职务分管:
|
|
|
</label>
|
|
|
<div class="layui-input-inline duty">
|
|
|
<button type="button" class="layui-btn layui-btn-normal hide" lay-filter="duty_charge" id="duty_charge">
|
|
|
职务与分管工作
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="layui-form-item dutys">
|
|
|
<label for="duty_charge" class="layui-form-label">
|
|
|
已配置职务:
|
|
|
</label>
|
|
|
<div style="padding-top:9px;margin-left: 120px" id="select_6"></div>
|
|
|
<script type="text/html" id="test6">
|
|
|
{{#layui.each(d,function(index,item){ }}
|
|
|
<div style="display:inline-block;margin:0 15px 5px 0;"><i title="删除" class="layui-icon"
|
|
|
style="cursor:pointer" onclick="delDuty(this)"
|
|
|
id={{item.nodeId}}
|
|
|
pId={{item.pId}}>ဇ</i><span>{{item.nodeName}}</span>--<span>{{item.treeNodeName}}</span>
|
|
|
</div>
|
|
|
{{# }) }}
|
|
|
</script>
|
|
|
</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>
|
|
|
layui.extend({
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
});
|
|
|
|
|
|
layui.use(['form', 'jquery', 'admin', 'layer', 'laytpl', 'laydate'], function () {
|
|
|
var form = layui.form,
|
|
|
$ = layui.jquery,
|
|
|
admin = layui.admin,
|
|
|
layer = layui.layer,
|
|
|
laytpl = layui.laytpl,
|
|
|
laydate = layui.laydate;
|
|
|
|
|
|
$(function () {
|
|
|
dep_id = GetQueryString("dep_id");
|
|
|
person_id = GetQueryString("person_id");
|
|
|
bureau_id = GetQueryString("bureau_id");
|
|
|
laydate.render({
|
|
|
elem: '#test'
|
|
|
});
|
|
|
laydate.render({
|
|
|
elem: '#rjrq'
|
|
|
});
|
|
|
getSex();
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
type : "GET",
|
|
|
async : false,
|
|
|
url : '/dsBase/base/getPrincipalshipTreeByBureauId?bureau_id='+bureau_id,
|
|
|
dataType : "json",
|
|
|
success: function (data) {
|
|
|
if(data.code==0){
|
|
|
for (var i=0;i<data.data.length;i++){
|
|
|
if(data.data[i].parent_id==-1){
|
|
|
if(data.data[i].is_leaf==0){
|
|
|
$("#duty_charge").hide();
|
|
|
var ht="<p style='padding-top:10px'>暂无职务分管工作</p>";
|
|
|
$(".duty").html(ht);
|
|
|
$(".dutys").hide();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
// 获取性别
|
|
|
function getSex() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
dataType: 'json',
|
|
|
url: '/dsBase/dm/getDmXb',
|
|
|
success: function (data) {
|
|
|
var getTpl = demo.innerHTML
|
|
|
, view = document.getElementById('view');
|
|
|
laytpl(getTpl).render(data, function (html) {
|
|
|
view.innerHTML = html;
|
|
|
});
|
|
|
getDmMz();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 获取民族
|
|
|
function getDmMz() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
dataType: 'json',
|
|
|
url: ' /dsBase/dm/getDmMz',
|
|
|
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;
|
|
|
});
|
|
|
getZzmm();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// 获取职称
|
|
|
function getZzmm() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
dataType: 'json',
|
|
|
url: '/dsBase/dm/getDmZzmm',
|
|
|
success: function (data) {
|
|
|
var getTpl = zzmm_type_script.innerHTML
|
|
|
, zzmm_type = document.getElementById('zzmm_type');
|
|
|
laytpl(getTpl).render(data, function (html) {
|
|
|
zzmm_type.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
getTeacherInfoByTeacherId();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getTeacherInfoByTeacherId() {
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
async: false,
|
|
|
dataType: "json",
|
|
|
url: "/dsBase/teacher/getTeacherInfoByTeacherId?person_id=" + person_id,
|
|
|
success: function (data) {
|
|
|
form.val('editForm', {
|
|
|
name: data.person_name,
|
|
|
card: data['idcard_code'],
|
|
|
birthday: data.birthday.substr(0, 10),
|
|
|
rjrq: data.t_teaching_date,
|
|
|
sort_id: data.sort_id,
|
|
|
telephone:data.telephone
|
|
|
})
|
|
|
$("#xl option[value='" + data.t_xl_id + "']").attr("selected", true);
|
|
|
$("#sel3 option[value='" + data.t_stage_id + "']").attr("selected", true);
|
|
|
//getSubject(data.t_stage_id);
|
|
|
$("#subject option[value='" + data.t_subject_id + "']").attr("selected", true);
|
|
|
$("#zc option[value='" + data.t_zc_id + "']").attr("selected", true);
|
|
|
$("#mz option[value='" + data.mz + "']").attr("selected", true);
|
|
|
$("#zzmm option[value='" + data.zzmm + "']").attr("selected", true);
|
|
|
$("input:radio[value='" + data.xb + "']").attr("checked", 'checked');
|
|
|
form.render();//一定要render!!!
|
|
|
setSaveList(data.t_duty_charge);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
$("#duty_charge").click(function () {
|
|
|
WeAdminShow('职务与分管工作', './selectIdentity.html?bureau_id=' + bureau_id, 350, window.height);
|
|
|
})
|
|
|
|
|
|
$("#card").blur(function () {
|
|
|
var Card = $("#card").val();
|
|
|
if (Card != null && Card != '') {
|
|
|
if (Card.length == 15) {
|
|
|
var birthdayValue = Card.charAt(6) + Card.charAt(7);//年份
|
|
|
if (parseInt(birthdayValue) < 14) {
|
|
|
birthdayValue = '20' + birthdayValue;//年份
|
|
|
}
|
|
|
else {
|
|
|
birthdayValue = '19' + birthdayValue;//年份
|
|
|
}
|
|
|
var birthday = birthdayValue + "-" + Card.substring(8, 10) + "-" + Card.substring(10, 12);
|
|
|
} else {
|
|
|
var birthday = Card.substring(6, 10) + "-" + Card.substring(10, 12) + "-" + Card.substring(12, 14);
|
|
|
}
|
|
|
form.val('editForm', {
|
|
|
birthday: birthday
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var jsonData = [];
|
|
|
var saveIdList = [];
|
|
|
// 选择职务分管后处理
|
|
|
window.chooseIds = function (str) {
|
|
|
jsonData = [];
|
|
|
var jsonStr = JSON.parse(str);
|
|
|
for (var i = 0; i < jsonStr.length; i++) {
|
|
|
jsonData.push(jsonStr[i])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// 获取职务 分管信息modelList:name; saveIdList:id
|
|
|
window.setSaveList = function (ids) {
|
|
|
var modelList = [];
|
|
|
for (var i = 0; i < ids.length; i++) {
|
|
|
saveIdList.push(ids[i].duties_id, ids[i].in_charge_id);
|
|
|
modelList.push({
|
|
|
nodeName: ids[i].duties_name,
|
|
|
treeNodeName: ids[i].in_charge_name,
|
|
|
nodeId: ids[i].duties_id,
|
|
|
pId: ids[i].in_charge_id
|
|
|
})
|
|
|
}
|
|
|
var getTpl = test6.innerHTML
|
|
|
, select_duty = document.getElementById('select_6');
|
|
|
laytpl(getTpl).render(modelList, function (html) {
|
|
|
select_duty.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
jsonData = [];
|
|
|
for (var i = 0; i < modelList.length; i++) {
|
|
|
jsonData.push({
|
|
|
duties_id:modelList[i].nodeId,
|
|
|
in_charge_id: modelList[i].pId
|
|
|
})
|
|
|
}
|
|
|
newArr = saveIdList;
|
|
|
}
|
|
|
window.getSaveProductList = function () {
|
|
|
var dataListObj = {};
|
|
|
dataListObj.saveIdList = newArr;
|
|
|
return dataListObj;
|
|
|
};
|
|
|
var newArr = [];
|
|
|
window.addDuty = function (saveProductList) {
|
|
|
var modelList = [];
|
|
|
newArr = [];
|
|
|
for (var i = 0; i < saveProductList.length; i++) {
|
|
|
for (var j = 0; j < saveProductList.length; j++) {
|
|
|
if (saveProductList[i].id == saveProductList[j].parent_id) {
|
|
|
modelList.push({
|
|
|
nodeName: saveProductList[i].name,
|
|
|
treeNodeName: saveProductList[j].name,
|
|
|
nodeId: saveProductList[j].id,
|
|
|
pId: saveProductList[i].id
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!saveProductList[i].isParent && saveProductList[i].level == 1 || saveProductList[i].isParent && saveProductList[i].check_Child_State == 0) {
|
|
|
modelList.push({
|
|
|
nodeName: saveProductList[i].name,
|
|
|
treeNodeName: "",
|
|
|
nodeId: -1,
|
|
|
pId: saveProductList[i].id
|
|
|
})
|
|
|
}
|
|
|
newArr.push(saveProductList[i].id)
|
|
|
}
|
|
|
|
|
|
|
|
|
var getTpl = test6.innerHTML
|
|
|
, select_duty = document.getElementById('select_6');
|
|
|
laytpl(getTpl).render(modelList, function (html) {
|
|
|
select_duty.innerHTML = html;
|
|
|
});
|
|
|
form.render();
|
|
|
jsonData = [];
|
|
|
for (var i = 0; i < modelList.length; i++) {
|
|
|
jsonData.push({
|
|
|
duties_id: modelList[i].pId,
|
|
|
in_charge_id: modelList[i].nodeId
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
window.delDuty = function (tag) {
|
|
|
$(tag).parent()[0].remove();
|
|
|
var id = $(tag).attr("id");
|
|
|
var pId = $(tag).attr("pId");
|
|
|
for (var i = 0; i < jsonData.length; i++) {
|
|
|
// 分管为 -1 局长--
|
|
|
if (jsonData[i].in_charge_id == -1) {
|
|
|
if (jsonData[i].duties_id == id) {
|
|
|
jsonData.splice(i, 1);
|
|
|
}
|
|
|
} else {
|
|
|
if (jsonData[i].in_charge_id == pId) {
|
|
|
jsonData.splice(i, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
newArr = [];
|
|
|
for (var i = 0; i < jsonData.length; i++) {
|
|
|
newArr.push(jsonData[i].duties_id, jsonData[i].in_charge_id)
|
|
|
}
|
|
|
}
|
|
|
verifyLength();
|
|
|
|
|
|
//监听提交
|
|
|
form.on('submit(save)', function (data) {
|
|
|
var f = data.field;
|
|
|
if(parseInt(f.rjrq)<parseInt(f.birthday)){
|
|
|
layer.msg("从教日期不能早于出生日期",{icon:0});
|
|
|
return false;
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
async: false,
|
|
|
dataType: "json",
|
|
|
url: "/dsBase/teacher/updateTeacher",
|
|
|
data: {
|
|
|
person_id: person_id,
|
|
|
org_id: dep_id,
|
|
|
person_name: f.name,
|
|
|
xb: f.sex,
|
|
|
mz: f.mz,
|
|
|
id_card: "",
|
|
|
birthday: "1990-10-10",
|
|
|
sort_id: "1",
|
|
|
xl_id: "01",
|
|
|
stage_id: "4",
|
|
|
subject_id: "2",
|
|
|
zc_id: "01",
|
|
|
t_teaching_date: "1990-10-10",
|
|
|
t_duty_charge: JSON.stringify(jsonData),
|
|
|
zzmm:f.zzmm,
|
|
|
telephone:f.telephone
|
|
|
},
|
|
|
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> |