mirror of
https://github.com/pbrong/hrms.git
synced 2025-09-26 19:51:11 +08:00
update:超级管理员部分页面优化完成
This commit is contained in:
@@ -21,3 +21,8 @@ type Department struct {
|
||||
DepDescribe string `gorm:"column:dep_describe" json:"dep_describe"`
|
||||
DepName string `gorm:"column:dep_name" db:"column:dep_name" json:"dep_name"`
|
||||
}
|
||||
|
||||
func (d *Department) AfterFind(tx *gorm.DB) (err error) {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@@ -54,6 +54,7 @@ type StaffEditDTO struct {
|
||||
BirthdayStr string `json:"birthday_str"`
|
||||
IdentityNum string `json:"identity_num"`
|
||||
SexStr string `json:"sex_str"`
|
||||
Sex int64 `gorm:"column:sex" json:"sex"`
|
||||
Nation string `json:"nation"`
|
||||
School string `json:"school"`
|
||||
Major string `json:"major"`
|
||||
|
@@ -71,10 +71,10 @@ func Time2Str(curTime time.Time, typ int) string {
|
||||
|
||||
func SexStr2Int64(sexStr string) int64 {
|
||||
var sex int64
|
||||
if sexStr == "男" {
|
||||
if sexStr == "1" || sexStr == "男" {
|
||||
sex = 1
|
||||
}
|
||||
if sexStr == "女" {
|
||||
if sexStr == "2" || sexStr == "女" {
|
||||
sex = 2
|
||||
}
|
||||
return sex
|
||||
|
@@ -68,8 +68,9 @@
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true},
|
||||
{field: 'staff_id', width: 80, title: '员工ID'},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'staff_id', width: 80, title: '员工ID', hide:true},
|
||||
{width: 60, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'staff_name', width: 120, title: '员工姓名'},
|
||||
{field: 'identity_num', width: 180, title: '身份证号'},
|
||||
{field: 'rank_name', title: '职位名称', minWidth: 140},
|
||||
|
@@ -83,7 +83,7 @@
|
||||
//编辑器外部操作
|
||||
var active = {
|
||||
content: function(){
|
||||
alert(layedit.getContent(index)); //获取编辑器内容
|
||||
// alert(layedit.getContent(index)); //获取编辑器内容
|
||||
}
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
// alert(JSON.stringify(req.field))
|
||||
req.field.notice_content = layedit.getContent(index)
|
||||
req.field.ID = editInfo.ID
|
||||
alert(JSON.stringify(req.field))
|
||||
// alert(JSON.stringify(req.field))
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/notification/edit",
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@@ -47,9 +47,10 @@
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'id', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'user_type', width: 150, title: '角色标识', hide:true},
|
||||
{width: 60, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'name', width: 150, title: '模块名称'},
|
||||
{field: 'model', width: 150, title: '模块标识'},
|
||||
{field: 'authority_content', width: 450, title: '权限详情'},
|
||||
{field: 'model', width: 250, title: '模块标识'},
|
||||
{field: 'authority_content', width: 200, title: '权限详情'},
|
||||
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
|
@@ -13,35 +13,35 @@
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<fieldset class="table-search-fieldset">
|
||||
<legend>搜索信息</legend>
|
||||
<div style="margin: 10px 10px 10px 10px">
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">部门ID</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="dep_id" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">部门名称</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input type="text" name="dep_name" autocomplete="off" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <fieldset class="table-search-fieldset">-->
|
||||
<!-- <legend>搜索信息</legend>-->
|
||||
<!-- <div style="margin: 10px 10px 10px 10px">-->
|
||||
<!-- <form class="layui-form layui-form-pane" action="">-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">部门ID</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input type="text" name="dep_id" autocomplete="off" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <!– <div class="layui-form-item">–>-->
|
||||
<!-- <!– <div class="layui-inline">–>-->
|
||||
<!-- <!– <label class="layui-form-label">部门名称</label>–>-->
|
||||
<!-- <!– <div class="layui-input-inline">–>-->
|
||||
<!-- <!– <input type="text" name="dep_name" autocomplete="off" class="layui-input">–>-->
|
||||
<!-- <!– </div>–>-->
|
||||
<!-- <!– </div>–>-->
|
||||
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">上级部门ID</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input type="text" name="pre_dep_id" autocomplete="off" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
<!-- </div>-->
|
||||
</fieldset>
|
||||
<!-- <!– <div class="layui-inline">–>-->
|
||||
<!-- <!– <label class="layui-form-label">上级部门ID</label>–>-->
|
||||
<!-- <!– <div class="layui-input-inline">–>-->
|
||||
<!-- <!– <input type="text" name="pre_dep_id" autocomplete="off" class="layui-input">–>-->
|
||||
<!-- <!– </div>–>-->
|
||||
<!-- <!– </div>–>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <!– </div>–>-->
|
||||
<!-- </fieldset>-->
|
||||
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
@@ -88,13 +88,18 @@
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true},
|
||||
{field: 'dep_id', width: 150, title: '部门ID'},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'dep_id', width: 150, title: '部门ID', hide:true},
|
||||
{width: 60, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'dep_name', width: 150, title: '部门名称'},
|
||||
{field: 'dep_describe', width: 200, title: '部门描述'},
|
||||
{field: 'CreatedAt', title: '创建时间', minWidth: 150, sort: true},
|
||||
{field: 'UpdatedAt', width: 150, title: '更新时间', sort: true},
|
||||
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
|
||||
{field: 'dep_describe', width: 300, title: '部门描述'},
|
||||
{field: 'CreatedAt', title: '创建时间', minWidth: 150, sort: true, templet: function(data) {
|
||||
return data.CreatedAt.slice(0, 10)
|
||||
}},
|
||||
{field: 'UpdatedAt', width: 150, title: '更新时间', sort: true, templet: function(data) {
|
||||
return data.UpdatedAt.slice(0, 10)
|
||||
}},
|
||||
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 10,
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<a href="javascript:;">{{.staff_name}} - {{.staff_id}}</a>
|
||||
<dl class="layui-nav-child">
|
||||
<dd>
|
||||
<a href="javascript:;" layuimini-content-href="user-password.html" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
|
||||
<a href="javascript:;" class="change-password" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<hr>
|
||||
@@ -177,6 +177,44 @@
|
||||
// ],
|
||||
// });
|
||||
|
||||
function getCookie2(cname)
|
||||
{
|
||||
var name = cname + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0; i<ca.length; i++)
|
||||
{
|
||||
var c = ca[i].trim();
|
||||
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
$('.change-password').on("click", function (obj) {
|
||||
localStorage.setItem("password_staff_id", getCookie2("user_cookie").split("_")[1])
|
||||
// alert("localStorage, staff_id=" + obj.data.staff_id)
|
||||
var index = layer.open({
|
||||
title: '编辑密码',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['50%', '50%'],
|
||||
content: '/views/password_edit.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.login-out').on("click", function () {
|
||||
layer.msg('正在退出登陆中...', function () {
|
||||
var userNo = localStorage.getItem("userNo");
|
||||
|
@@ -183,7 +183,7 @@
|
||||
if (obj.event === 'edit') {
|
||||
// 本地缓存需要编辑的通知信息
|
||||
localStorage.setItem("salary_edit_info", JSON.stringify(obj.data))
|
||||
alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
// alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '编辑工资信息',
|
||||
type: 2,
|
||||
|
@@ -38,7 +38,7 @@
|
||||
layer = layui.layer,
|
||||
$ = layui.$;
|
||||
var staffId = localStorage.getItem("password_staff_id");
|
||||
alert("localStorage, staff_id=" + staffId)
|
||||
// alert("localStorage, staff_id=" + staffId)
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (req) {
|
||||
req.field.staff_id = staffId
|
||||
|
@@ -58,7 +58,8 @@
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'id', width: 60, title: 'ID', sort: true},
|
||||
{field: 'id', width: 60, title: 'ID', sort: true,hide:true},
|
||||
{width: 60, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'staff_id', width: 150, title: '员工工号'},
|
||||
{field: 'staff_name', width: 150, title: '员工姓名'},
|
||||
{field: 'password', width: 150, title: '登陆密码'},
|
||||
|
@@ -57,12 +57,17 @@
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true},
|
||||
{field: 'rank_id', width: 150, title: '职级ID'},
|
||||
{field: 'rank_name', width: 150, title: '职级名称'},
|
||||
{field: 'CreatedAt', title: '创建时间', minWidth: 150, sort: true},
|
||||
{field: 'UpdatedAt', width: 150, title: '更新时间', sort: true},
|
||||
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'rank_id', width: 150, title: '职级ID', hide:true},
|
||||
{width: 150, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'rank_name', width: 250, title: '职级名称'},
|
||||
{field: 'CreatedAt', title: '创建时间', minWidth: 150, sort: true, templet: function(data) {
|
||||
return data.CreatedAt.slice(0, 10)
|
||||
}},
|
||||
{field: 'UpdatedAt', width: 150, title: '更新时间', sort: true, templet: function(data) {
|
||||
return data.UpdatedAt.slice(0, 10)
|
||||
}},
|
||||
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 10,
|
||||
|
@@ -169,7 +169,7 @@
|
||||
if (obj.event === 'edit') {
|
||||
// 本地缓存需要编辑的通知信息
|
||||
localStorage.setItem("salary_edit_info", JSON.stringify(obj.data))
|
||||
alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
// alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '编辑工资信息',
|
||||
type: 2,
|
||||
|
@@ -42,10 +42,11 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">员工性别</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="sex_str" value="男" title="男" checked="">
|
||||
<input type="radio" name="sex_str" value="女" title="女">
|
||||
</div>
|
||||
<select name="sex_str" id="sex_str" lay-verify="required" lay-search>
|
||||
<option value="-1">请选择</option>
|
||||
<option value="1">男</option>
|
||||
<option value="2">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -59,7 +60,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">出生日期</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="birthday_str" lay-verify="required" value="" placeholder="1999-05-21" class="layui-input">
|
||||
<input type="date" name="birthday_str" lay-verify="required" value="" placeholder="1999-05-21" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -140,7 +141,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">入职日期</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="entry_date_str" lay-verify="required" value="" class="layui-input">
|
||||
<input type="date" name="entry_date_str" lay-verify="required" value="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -26,10 +26,10 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">员工性别</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="sex_str" value="1" title="男" checked>
|
||||
<input type="radio" name="sex_str" value="2" title="女">
|
||||
</div>
|
||||
<select id="sex_str" name="sex_str" lay-verify="required">
|
||||
<option value="1">男</option>
|
||||
<option value="2">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">出生日期</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="birthday_str" lay-verify="required" value="" placeholder="1999-05-21" class="layui-input">
|
||||
<input type="date" name="birthday_str" lay-verify="required" value="" placeholder="1999-05-21" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,14 +92,17 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="rank_id" lay-verify="required" value="" class="layui-input">
|
||||
<select name="rank_id" id="rank_select" lay-verify="required" lay-search>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">部门</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="dep_id" lay-verify="required" value="" class="layui-input">
|
||||
<select name="dep_id" id="dep_select" lay-verify="required" lay-search>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -113,7 +116,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">入职日期</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="entry_date_str" lay-verify="required" value="" class="layui-input">
|
||||
<input type="date" name="entry_date_str" lay-verify="required" value="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,6 +129,38 @@
|
||||
|
||||
<script src="/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script>
|
||||
|
||||
function loadRankSelect(rankId) {
|
||||
$ = layui.$
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/rank/query/all",
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
$.each(resp.msg, function (index, item) {
|
||||
$('#rank_select').append(new Option(item.rank_name, item.rank_id));// 下拉菜单里添加元素
|
||||
});
|
||||
// 选中所属职位
|
||||
$('#rank_select').val(rankId)
|
||||
layui.form.render("select");
|
||||
}});
|
||||
}
|
||||
|
||||
function loadDepSelect(depId) {
|
||||
$ = layui.$
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/depart/query/all",
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
$.each(resp.msg, function (index, item) {
|
||||
$('#dep_select').append(new Option(item.dep_name, item.dep_id));// 下拉菜单里添加元素
|
||||
});
|
||||
$('#dep_select').val(depId)
|
||||
layui.form.render("select");
|
||||
}});
|
||||
}
|
||||
|
||||
layui.use(['form'], function () {
|
||||
var form = layui.form,
|
||||
layer = layui.layer,
|
||||
@@ -141,7 +176,7 @@
|
||||
var staffId = JSON.parse(editInfo).staff_id
|
||||
req.staff_id = staffId
|
||||
req.base_salary = parseInt(req.base_salary)
|
||||
alert(JSON.stringify(req))
|
||||
// alert(JSON.stringify(req))
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/staff/edit",
|
||||
@@ -169,23 +204,26 @@
|
||||
});
|
||||
|
||||
function recallData(editInfo) {
|
||||
alert(editInfo)
|
||||
// alert(editInfo)
|
||||
var $ = layui.$
|
||||
editInfo = JSON.parse(editInfo)
|
||||
$("input[name=staff_name]").val(editInfo.staff_name)
|
||||
$("input[type='radio'][name='sex_str'][value='"+editInfo.sex+"']").attr("checked", true)
|
||||
$("#sex_str").val(editInfo.sex)
|
||||
layui.form.render("select")
|
||||
$("input[name=identity_num]").val(editInfo.identity_num)
|
||||
$("input[name=birthday_str]").val(editInfo.birthday)
|
||||
$("input[name=birthday_str]").val(editInfo.birthday.slice(0, 10))
|
||||
$("input[name=nation]").val(editInfo.nation)
|
||||
$("input[name=school]").val(editInfo.school)
|
||||
$("input[name=major]").val(editInfo.major)
|
||||
$("input[name=edu_level]").val(editInfo.edu_level)
|
||||
$("input[name=base_salary]").val(editInfo.base_salary)
|
||||
$("input[name=card_num]").val(editInfo.card_num)
|
||||
$("input[name=rank_id]").val(editInfo.rank_id)
|
||||
$("input[name=dep_id]").val(editInfo.dep_id)
|
||||
// $("input[name=rank_id]").val(editInfo.rank_id)
|
||||
loadRankSelect(editInfo.rank_id)
|
||||
loadDepSelect(editInfo.dep_id)
|
||||
// $("input[name=dep_id]").val(editInfo.dep_id)
|
||||
$("input[name=email]").val(editInfo.email)
|
||||
$("input[name=entry_date_str]").val(editInfo.entry_date)
|
||||
$("input[name=entry_date_str]").val(editInfo.entry_date.slice(0, 10))
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -83,24 +83,38 @@
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 50},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true},
|
||||
{field: 'staff_id', width: 150, title: '员工ID'},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide: true},
|
||||
{field: 'staff_id', width: 100, title: '员工ID', hide: true},
|
||||
{width: 60, title: '序号', sort: true, type:'numbers'},
|
||||
{field: 'staff_name', width: 150, title: '员工姓名'},
|
||||
{field: 'birthday', width: 150, title: '出生日期', templet: dateFormat1},
|
||||
{field: 'identity_num', width: 150, title: '身份证号'},
|
||||
{field: 'sex', width: 150, title: '性别', templet: sexFormat},
|
||||
{field: 'nation', width: 150, title: '民族'},
|
||||
{field: 'birthday', width: 150, title: '出生日期', templet: function(data) {
|
||||
return data.birthday.slice(0, 10)
|
||||
}},
|
||||
{field: 'identity_num', width: 180, title: '身份证号'},
|
||||
{field: 'sex', width: 60, title: '性别', templet: function (data) {
|
||||
var sex = data.sex;
|
||||
var sexStr
|
||||
if (sex == 1) {
|
||||
sexStr = "男"
|
||||
} else {
|
||||
sexStr = "女"
|
||||
}
|
||||
return sexStr
|
||||
}},
|
||||
{field: 'nation', width: 60, title: '民族'},
|
||||
{field: 'school', title: '毕业院校', minWidth: 150},
|
||||
{field: 'major', title: '毕业专业', minWidth: 150},
|
||||
{field: 'edu_level', title: '最高学历', minWidth: 150},
|
||||
{field: 'base_salary', title: '基本工资', minWidth: 150},
|
||||
{field: 'card_num', title: '银行卡号', minWidth: 150},
|
||||
{field: 'card_num', title: '银行卡号', minWidth: 180},
|
||||
{field: 'rank_id', title: '职位ID', minWidth: 150, hide:true},
|
||||
{field: 'rank_name', title: '职位名称', minWidth: 150},
|
||||
{field: 'dep_id', title: '部门ID', minWidth: 150, hide:true},
|
||||
{field: 'dep_name', title: '部门名称', minWidth: 150},
|
||||
{field: 'email', title: '电子邮箱', minWidth: 150},
|
||||
{field: 'entry_date', title: '入职时间', minWidth: 150, templet: dateFormat2},
|
||||
{field: 'email', title: '电子邮箱', minWidth: 170},
|
||||
{field: 'entry_date', title: '入职时间', minWidth: 150,templet: function(data) {
|
||||
return data.birthday.slice(0, 10)
|
||||
}},
|
||||
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
@@ -122,33 +136,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 性别格式化
|
||||
function sexFormat(data) {
|
||||
var sex = data.sex;
|
||||
var sexStr
|
||||
if (sex == 1) {
|
||||
sexStr = "男"
|
||||
} else {
|
||||
sexStr = "女"
|
||||
}
|
||||
return sexStr
|
||||
}
|
||||
|
||||
// 时间格式化
|
||||
function dateFormat1(data) {
|
||||
if (data.birthday != "undefined") {
|
||||
return data.birthday.slice(0, 10)
|
||||
}
|
||||
}
|
||||
|
||||
function dateFormat2(data) {
|
||||
if (data.entry_date != "undefined") {
|
||||
return data.entry_date.slice(0, 10)
|
||||
}
|
||||
}
|
||||
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
layer.msg("搜索成功");
|
||||
|
@@ -26,10 +26,10 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">员工性别</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-block" readonly="readonly" >
|
||||
<input type="radio" name="sex_str" value="1" title="男" checked>
|
||||
<input type="radio" name="sex_str" value="2" title="女">
|
||||
</div>
|
||||
<select disabled="disabled" id="sex_str" name="sex_str" lay-verify="required">
|
||||
<option value="1">男</option>
|
||||
<option value="2">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -92,14 +92,17 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="rank_id" readonly="readonly" class="layui-input">
|
||||
<select disabled="disabled" name="rank_id" id="rank_select" lay-verify="required" lay-search>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">部门</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="dep_id" readonly="readonly" class="layui-input">
|
||||
<select disabled="disabled" name="dep_id" id="dep_select" lay-verify="required" lay-search>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -121,6 +124,40 @@
|
||||
|
||||
<script src="/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script>
|
||||
|
||||
|
||||
function loadRankSelect(rankId) {
|
||||
$ = layui.$
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/rank/query/all",
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
$.each(resp.msg, function (index, item) {
|
||||
$('#rank_select').append(new Option(item.rank_name, item.rank_id));// 下拉菜单里添加元素
|
||||
});
|
||||
// 选中所属职位
|
||||
$('#rank_select').val(rankId)
|
||||
layui.form.render("select");
|
||||
}});
|
||||
}
|
||||
|
||||
function loadDepSelect(depId) {
|
||||
$ = layui.$
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/depart/query/all",
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
$.each(resp.msg, function (index, item) {
|
||||
$('#dep_select').append(new Option(item.dep_name, item.dep_id));// 下拉菜单里添加元素
|
||||
});
|
||||
$('#dep_select').val(depId)
|
||||
layui.form.render("select");
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
layui.use(['form'], function () {
|
||||
var form = layui.form,
|
||||
layer = layui.layer,
|
||||
@@ -136,7 +173,7 @@
|
||||
var staffId = JSON.parse(editInfo).staff_id
|
||||
req.staff_id = staffId
|
||||
req.base_salary = parseInt(req.base_salary)
|
||||
alert(JSON.stringify(req))
|
||||
// alert(JSON.stringify(req))
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/staff/edit",
|
||||
@@ -164,23 +201,26 @@
|
||||
});
|
||||
|
||||
function recallData(editInfo) {
|
||||
alert(editInfo)
|
||||
// alert(editInfo)
|
||||
var $ = layui.$
|
||||
editInfo = JSON.parse(editInfo)
|
||||
$("input[name=staff_name]").val(editInfo.staff_name)
|
||||
$("input[type='radio'][name='sex_str'][value='"+editInfo.sex+"']").attr("checked", true)
|
||||
$("#sex_str").val(editInfo.sex)
|
||||
layui.form.render("select")
|
||||
$("input[name=identity_num]").val(editInfo.identity_num)
|
||||
$("input[name=birthday_str]").val(editInfo.birthday)
|
||||
$("input[name=birthday_str]").val(editInfo.birthday.slice(0, 10))
|
||||
$("input[name=nation]").val(editInfo.nation)
|
||||
$("input[name=school]").val(editInfo.school)
|
||||
$("input[name=major]").val(editInfo.major)
|
||||
$("input[name=edu_level]").val(editInfo.edu_level)
|
||||
$("input[name=base_salary]").val(editInfo.base_salary)
|
||||
$("input[name=card_num]").val(editInfo.card_num)
|
||||
$("input[name=rank_id]").val(editInfo.rank_id)
|
||||
$("input[name=dep_id]").val(editInfo.dep_id)
|
||||
// $("input[name=rank_id]").val(editInfo.rank_id)
|
||||
loadRankSelect(editInfo.rank_id)
|
||||
loadDepSelect(editInfo.dep_id)
|
||||
// $("input[name=dep_id]").val(editInfo.dep_id)
|
||||
$("input[name=email]").val(editInfo.email)
|
||||
$("input[name=entry_date_str]").val(editInfo.entry_date)
|
||||
$("input[name=entry_date_str]").val(editInfo.entry_date.slice(0, 10))
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user