202 lines
7.3 KiB
HTML
202 lines
7.3 KiB
HTML
{extend name="common/base"/}
|
|
<!-- 样式 -->
|
|
{block name="style"}
|
|
<link rel="stylesheet" href="{__JS__}/module/dtree/dtree.css">
|
|
<link rel="stylesheet" href="{__JS__}/module/dtree/font/dtreefont.css">
|
|
{/block}
|
|
<!-- /样式 -->
|
|
<!-- 主体 -->
|
|
{block name="body"}
|
|
<form class="layui-form body-content">
|
|
<h3 class="h3-title">离职档案</h3>
|
|
{if condition="$id eq 0"}
|
|
<table class="layui-table">
|
|
<tr>
|
|
<td class="layui-td-gray">离职员工<font>*</font></td>
|
|
<td>
|
|
<input type="hidden" name="uid" value="0" autocomplete="off">
|
|
<input type="text" name="name" placeholder="请选择离职员工" lay-reqText="请选择离职员工" lay-verify="required" autocomplete="off" class="layui-input" readonly>
|
|
</td>
|
|
<td class="layui-td-gray">所在部门</td>
|
|
<td>
|
|
<input type="text" name="department" autocomplete="off" class="layui-input" readonly>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">离职日期<font>*</font></td>
|
|
<td><input type="text" id="quit_time" name="quit_time" lay-verify="required" autocomplete="off" placeholder="请选择离职日期" lay-reqText="请选择离职日期" readonly class="layui-input">
|
|
</td>
|
|
<td class="layui-td-gray">部门负责人<font>*</font></td>
|
|
<td>
|
|
<input type="text" name="lead_admin_name" autocomplete="off" lay-verify="required" placeholder="请选择部门负责人" lay-reqText="请选择部门负责人" readonly class="layui-input">
|
|
<input type="hidden" name="lead_admin_id" autocomplete="off" value="0">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">交接人员<font>*</font></td>
|
|
<td colspan="3">
|
|
<input type="text" name="connect_names" autocomplete="off" lay-verify="required" placeholder="请选择交接人员" lay-reqText="请选择交接人员" readonly class="layui-input">
|
|
<input type="hidden" name="connect_uids" class="layui-input">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">离职原因<font>*</font></td>
|
|
<td colspan="3">
|
|
<textarea name="remark" lay-verify="required" placeholder="请输入离职原因" lay-reqText="请输入离职原因" class="layui-textarea"></textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
{else/}
|
|
<table class="layui-table">
|
|
<tr>
|
|
<td class="layui-td-gray">离职员工<font>*</font></td>
|
|
<td>
|
|
<input type="hidden" name="uid" value="{$detail.uid}" autocomplete="off">
|
|
<input type="text" name="name" value="{$detail.name}" placeholder="请选择离职员工" lay-reqText="请选择离职员工" lay-verify="required" autocomplete="off" class="layui-input" readonly>
|
|
</td>
|
|
<td class="layui-td-gray">所在部门</td>
|
|
<td>
|
|
<input type="text" name="department" value="{$detail.department}" autocomplete="off" class="layui-input" readonly>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">离职日期<font>*</font></td>
|
|
<td><input type="text" id="quit_time" name="quit_time" value="{$detail.quit_time}" lay-verify="required" autocomplete="off" placeholder="请选择离职日期" lay-reqText="请选择离职日期" readonly class="layui-input">
|
|
</td>
|
|
<td class="layui-td-gray">部门负责人<font>*</font></td>
|
|
<td>
|
|
<input type="text" name="lead_admin_name" autocomplete="off" value="{$detail.lead_admin_name}" lay-verify="required" placeholder="请选择部门负责人" lay-reqText="请选择部门负责人" readonly class="layui-input">
|
|
<input type="hidden" name="lead_admin_id" autocomplete="off" value="{$detail.lead_admin_id}">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">交接人员<font>*</font></td>
|
|
<td colspan="3">
|
|
<input type="text" name="connect_names" autocomplete="off" lay-verify="required" placeholder="请选择交接人员" lay-reqText="请选择交接人员" readonly class="layui-input" value="{$detail.connect_names}">
|
|
<input type="hidden" name="connect_uids" class="layui-input" value="{$detail.connect_uids}">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="layui-td-gray">离职原因<font>*</font></td>
|
|
<td colspan="3">
|
|
<textarea name="remark" lay-verify="required" placeholder="请输入离职原因" lay-reqText="请输入离职原因" class="layui-textarea">{$detail.remark}</textarea>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
{/if}
|
|
<div style="padding: 10px 0">
|
|
<input type="hidden" name="id" value="{$id}" />
|
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
|
</div>
|
|
</form>
|
|
{/block}
|
|
<!-- /主体 -->
|
|
|
|
<!-- 脚本 -->
|
|
{block name="script"}
|
|
<script>
|
|
function init(layui) {
|
|
var form = layui.form
|
|
, layer = layui.layer
|
|
, laydate = layui.laydate
|
|
,employeepicker = layui.employeepicker;
|
|
|
|
laydate.render({
|
|
elem: '#quit_time',
|
|
showBottom:false
|
|
});
|
|
|
|
$('.body-content').on('click','[name="department"]',function(){
|
|
var val=$(this).val();
|
|
if(val==''){
|
|
layer.msg('请选择离职员工');
|
|
}
|
|
});
|
|
|
|
|
|
//选择员工弹窗
|
|
$('.body-content').on('click','[name="name"]',function () {
|
|
var ids=$('[name="uid"]').val(),names=$('[name="name"]').val(),departments=$('[name="department"]').val();
|
|
employeepicker.init({
|
|
ids:ids,
|
|
names:names,
|
|
departments:departments,
|
|
department_url: "/home/api/get_department_tree",
|
|
employee_url: "/home/api/get_employee",
|
|
type:0,
|
|
callback:function(ids,names,dids,departments){
|
|
$('[name="uid"]').val(ids);
|
|
$('[name="name"]').val(names);
|
|
$('[name="department"]').val(departments);
|
|
}
|
|
});
|
|
});
|
|
|
|
//监听部门负责人
|
|
$('.body-content').on('click','[name="lead_admin_name"]',function () {
|
|
var ids=$('[name="lead_admin_id"]').val(),names=$('[name="lead_admin_name"]').val();
|
|
employeepicker.init({
|
|
ids:ids,
|
|
names:names,
|
|
department_url: "/home/api/get_department_tree",
|
|
employee_url: "/home/api/get_employee",
|
|
type:0,
|
|
callback:function(ids,names,dids,departments){
|
|
$('[name="lead_admin_id"]').val(ids);
|
|
$('[name="lead_admin_name"]').val(names);
|
|
}
|
|
});
|
|
});
|
|
|
|
//监听交接成员
|
|
$('.body-content').on('click','[name="connect_names"]',function () {
|
|
var ids=$('[name="connect_uids"]').val(),names=$('[name="connect_names"]').val(),idsArray=[],namesArray=[];
|
|
if(ids!=''){
|
|
idsArray=ids.split(',');
|
|
namesArray=names.split(',');
|
|
}
|
|
employeepicker.init({
|
|
ids:idsArray,
|
|
names:namesArray,
|
|
department_url: "/home/api/get_department_tree",
|
|
employee_url: "/home/api/get_employee",
|
|
callback:function(ids,names){
|
|
$('[name="connect_uids"]').val(ids.join(',')),
|
|
$('[name="connect_names"]').val(names.join(','));
|
|
}
|
|
});
|
|
});
|
|
|
|
//监听提交
|
|
form.on('submit(webform)', function (data) {
|
|
if(data.field.uid==0){
|
|
layer.msg('请选择离职员工');
|
|
return false;
|
|
}
|
|
if(data.field.uid==data.field.lead_admin_id){
|
|
layer.msg('离职员工和部门负责人不能是同一个人');
|
|
return false;
|
|
}
|
|
$.ajax({
|
|
url: "/home/personal/leave_add",
|
|
type: 'post',
|
|
data: data.field,
|
|
success: function (e) {
|
|
if(e.code==0){
|
|
layer.confirm('保存成功,返回列表页吗?', {icon: 3, title:'提示'}, function(index){
|
|
parent.location.reload();
|
|
})
|
|
}else{
|
|
layer.msg(e.msg);
|
|
}
|
|
}
|
|
})
|
|
return false;
|
|
});
|
|
}
|
|
|
|
</script>
|
|
{include file="common/layui" base='base' extend="['employeepicker']" callback="init" /}
|
|
{/block}
|
|
<!-- /脚本 --> |