mirror of
https://github.com/pbrong/hrms.git
synced 2025-09-26 19:51:11 +08:00
feature:完成工资历史模块
This commit is contained in:
@@ -231,3 +231,25 @@ func PaySalaryRecordById(c *gin.Context) {
|
||||
"status": 2000,
|
||||
})
|
||||
}
|
||||
|
||||
func GetHadPaySalaryRecordByStaffId(c *gin.Context) {
|
||||
// 参数绑定
|
||||
staffId := c.Param("staff_id")
|
||||
start, limit := service.AcceptPage(c)
|
||||
// 业务处理
|
||||
list, total, err := service.GetHadPaySalaryRecordByStaffId(c, staffId, start, limit)
|
||||
if err != nil {
|
||||
log.Printf("[GetHadPaySalaryRecordByStaffId] err = %v", err)
|
||||
c.JSON(200, gin.H{
|
||||
"status": 5000,
|
||||
"total": 0,
|
||||
"msg": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(200, gin.H{
|
||||
"status": 2000,
|
||||
"total": total,
|
||||
"msg": list,
|
||||
})
|
||||
}
|
||||
|
1
main.go
1
main.go
@@ -125,6 +125,7 @@ func routerInit(server *gin.Engine) {
|
||||
salaryRecordGroup.GET("/query/:staff_id", handler.GetSalaryRecordByStaffId)
|
||||
salaryRecordGroup.GET("/get_salary_record_is_pay_by_id/:id", handler.GetSalaryRecordIsPayById)
|
||||
salaryRecordGroup.GET("/pay_salary_record_by_id/:id", handler.PaySalaryRecordById)
|
||||
salaryRecordGroup.GET("/query_history/:staff_id", handler.GetHadPaySalaryRecordByStaffId)
|
||||
}
|
||||
|
||||
func htmlInit(server *gin.Engine) {
|
||||
|
@@ -267,6 +267,9 @@ func GetSalaryRecordByStaffId(c *gin.Context, staffId string, start int, limit i
|
||||
}
|
||||
var total int64
|
||||
resource.HrmsDB(c).Model(&model.SalaryRecord{}).Count(&total)
|
||||
if staffId == "all" {
|
||||
total = 1
|
||||
}
|
||||
return salaryRecords, total, nil
|
||||
}
|
||||
|
||||
@@ -285,3 +288,33 @@ func PaySalaryRecordById(c *gin.Context, id int64) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetHadPaySalaryRecordByStaffId(c *gin.Context, staffId string, start int, limit int) ([]*model.SalaryRecord, int64, error) {
|
||||
var salaryRecords []*model.SalaryRecord
|
||||
var err error
|
||||
if start == -1 && limit == -1 {
|
||||
// 不加分页
|
||||
if staffId != "all" {
|
||||
err = resource.HrmsDB(c).Where("staff_id = ? and is_pay = 2", staffId).Find(&salaryRecords).Error
|
||||
} else {
|
||||
err = resource.HrmsDB(c).Where("is_pay = 2").Find(&salaryRecords).Error
|
||||
}
|
||||
|
||||
} else {
|
||||
// 加分页
|
||||
if staffId != "all" {
|
||||
err = resource.HrmsDB(c).Where("staff_id = ? and is_pay = 2", staffId).Offset(start).Limit(limit).Find(&salaryRecords).Error
|
||||
} else {
|
||||
err = resource.HrmsDB(c).Where("is_pay = 2").Find(&salaryRecords).Error
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
var total int64
|
||||
resource.HrmsDB(c).Model(&model.SalaryRecord{}).Where("is_pay = 2").Count(&total)
|
||||
if staffId == "all" {
|
||||
total = 1
|
||||
}
|
||||
return salaryRecords, total, nil
|
||||
}
|
||||
|
@@ -74,9 +74,23 @@
|
||||
form = layui.form,
|
||||
table = layui.table;
|
||||
|
||||
function getCookie(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 "";
|
||||
}
|
||||
|
||||
var staffId = getCookie("user_cookie").split("_")[1];
|
||||
|
||||
table.render({
|
||||
elem: '#currentTableId',
|
||||
url: '/salary/query/all',
|
||||
url: '/salary/query/' + staffId,
|
||||
toolbar: '#toolbarDemo',
|
||||
defaultToolbar: ['filter', 'exports', 'print', {
|
||||
title: '提示',
|
||||
|
286
views/normal_salary_history_manage.html
Executable file
286
views/normal_salary_history_manage.html
Executable file
@@ -0,0 +1,286 @@
|
||||
<!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, maximum-scale=1">
|
||||
<link rel="stylesheet" href="/static/lib/layui-v2.5.5/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="/static/css/public.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
<!-- {{ if .query }}-->
|
||||
<!-- <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">员工工号</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input type="text" name="staff_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>-->
|
||||
<!-- </form>-->
|
||||
|
||||
<!-- </div>-->
|
||||
<!-- </fieldset>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
|
||||
<!-- <script type="text/html" id="toolbarDemo">-->
|
||||
<!-- <div class="layui-btn-container">-->
|
||||
<!-- {{ if .create }}-->
|
||||
<!-- <button id="add_button" class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
<!-- </div>-->
|
||||
<!-- </script>-->
|
||||
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
<!-- <script type="text/html" id="currentTableBar">-->
|
||||
<!-- {{ if .query }}-->
|
||||
<!-- <a id="query_button" class="layui-btn layui-btn-warm layui-btn-xs data-count-get" lay-event="query">查看</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
|
||||
<!-- {{ if .update }}-->
|
||||
<!-- <a id="edit_button" class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
|
||||
<!-- {{ if .delete }}-->
|
||||
<!-- <a id="delete_button" class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
<!-- </script>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script src="/static/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
|
||||
|
||||
<script>
|
||||
{{ if .query }}
|
||||
layui.use(['form', 'table'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table;
|
||||
|
||||
function getCookie(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 "";
|
||||
}
|
||||
|
||||
var staffId = getCookie("user_cookie").split("_")[1];
|
||||
|
||||
table.render({
|
||||
elem: '#currentTableId',
|
||||
url: '/salary_record/query_history/' + staffId,
|
||||
toolbar: '#toolbarDemo',
|
||||
defaultToolbar: ['filter', 'exports', 'print', {
|
||||
title: '提示',
|
||||
layEvent: 'LAYTABLE_TIPS',
|
||||
icon: 'layui-icon-tips'
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 30},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'salary_record_id', width: 120, title: '工资ID', hide:true},
|
||||
{field: 'staff_id', width: 95, title: '工号'},
|
||||
{field: 'staff_name', width: 120, title: '姓名'},
|
||||
{field: 'base', width: 95, title: '基本(元)'},
|
||||
{field: 'subsidy', width: 95, title: '补贴(元)'},
|
||||
{field: 'benifits', width: 95, title: '福利(元)'},
|
||||
{field: 'fine', width: 95, title: '罚款(元)'},
|
||||
{field: 'total', width: 95, title: '合计(元)'},
|
||||
{field: 'salary_date', width: 95, title: '月份'},
|
||||
{field: 'is_pay', width: 95, title: '状态', templet: isPayFormat},
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 10,
|
||||
page: true,
|
||||
skin: 'line',
|
||||
parseData: function(res){ //res 即为原始返回的数据
|
||||
var code = 0, msg = "获取数据成功"
|
||||
if (res.status != 2000) {
|
||||
code = -1
|
||||
msg = "数据不存在"
|
||||
}
|
||||
return {
|
||||
"code": code, //解析接口状态
|
||||
"msg": msg, //解析提示文本
|
||||
"count": res.total, //解析数据长度
|
||||
"data": res.msg //解析数据列表
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
function isPayFormat(data) {
|
||||
if (data.is_pay == 1) {
|
||||
return "未发放"
|
||||
} else {
|
||||
return "已发放"
|
||||
}
|
||||
}
|
||||
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
layer.msg("搜索成功");
|
||||
var staff_id = data.field.staff_id;
|
||||
var reqUrl = "/salary_record/query_history/all"
|
||||
if (typeof staff_id != "undefined" && staff_id != null && staff_id != "") {
|
||||
//执行搜索重载
|
||||
reqUrl = "/salary_record/query_history/"+staff_id
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
url: reqUrl,
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'add') { // 监听添加操作
|
||||
var index = layer.open({
|
||||
title: '添加通知',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/salary_detail_add.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格复选框选择
|
||||
// table.on('checkbox(currentTableFilter)', function (obj) {
|
||||
// console.log(obj)
|
||||
// });
|
||||
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.ID;
|
||||
var salary_id = obj.data.salary_id;
|
||||
if (obj.event === 'edit') {
|
||||
// 本地缓存需要编辑的通知信息
|
||||
localStorage.setItem("salary_edit_info", JSON.stringify(obj.data))
|
||||
alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '编辑工资信息',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/salary_detail_edit.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
return false;
|
||||
} else if (obj.event === 'delete') {
|
||||
layer.confirm('确认删除吗?', function () {
|
||||
// alert(JSON.stringify(obj.data))
|
||||
// alert(depId)
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/salary/delete/" + salary_id,
|
||||
async: false,
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
if (resp.status == 2000) {
|
||||
layer.alert("删除信息成功",function(index) {
|
||||
// 重新渲染
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
layer.close(index)
|
||||
// alert("layer.close")
|
||||
});
|
||||
}
|
||||
},
|
||||
error:function (data) {
|
||||
console.log("error resp:" + JSON.stringify(data))
|
||||
layer.msg("系统异常");
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if(obj.event === 'query') {
|
||||
// alert("查看详情")
|
||||
// 本地缓存需要查看的通知信息
|
||||
localStorage.setItem("notification_detail_info", JSON.stringify(obj.data))
|
||||
// alert("待编辑:" + localStorage.getItem("staff_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '通知详情',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/admin_notification_detail.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
{{ else }}
|
||||
alert("你没有数据查询权限")
|
||||
{{ end }}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
272
views/salary_history_manage.html
Executable file
272
views/salary_history_manage.html
Executable file
@@ -0,0 +1,272 @@
|
||||
<!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, maximum-scale=1">
|
||||
<link rel="stylesheet" href="/static/lib/layui-v2.5.5/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="/static/css/public.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
|
||||
{{ if .query }}
|
||||
<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">员工工号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="staff_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>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
{{ else }}
|
||||
{{ end }}
|
||||
|
||||
<!-- <script type="text/html" id="toolbarDemo">-->
|
||||
<!-- <div class="layui-btn-container">-->
|
||||
<!-- {{ if .create }}-->
|
||||
<!-- <button id="add_button" class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加 </button>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
<!-- </div>-->
|
||||
<!-- </script>-->
|
||||
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
<!-- <script type="text/html" id="currentTableBar">-->
|
||||
<!-- {{ if .query }}-->
|
||||
<!-- <a id="query_button" class="layui-btn layui-btn-warm layui-btn-xs data-count-get" lay-event="query">查看</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
|
||||
<!-- {{ if .update }}-->
|
||||
<!-- <a id="edit_button" class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
|
||||
<!-- {{ if .delete }}-->
|
||||
<!-- <a id="delete_button" class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
|
||||
<!-- {{ else }}-->
|
||||
<!-- {{ end }}-->
|
||||
<!-- </script>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
|
||||
<script src="/static/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
|
||||
|
||||
<script>
|
||||
{{ if .query }}
|
||||
layui.use(['form', 'table'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table;
|
||||
|
||||
table.render({
|
||||
elem: '#currentTableId',
|
||||
url: '/salary_record/query_history/all',
|
||||
toolbar: '#toolbarDemo',
|
||||
defaultToolbar: ['filter', 'exports', 'print', {
|
||||
title: '提示',
|
||||
layEvent: 'LAYTABLE_TIPS',
|
||||
icon: 'layui-icon-tips'
|
||||
}],
|
||||
cols: [[
|
||||
// {type: "checkbox", width: 30},
|
||||
{field: 'ID', width: 60, title: 'ID', sort: true, hide:true},
|
||||
{field: 'salary_record_id', width: 120, title: '工资ID', hide:true},
|
||||
{field: 'staff_id', width: 95, title: '工号'},
|
||||
{field: 'staff_name', width: 120, title: '姓名'},
|
||||
{field: 'base', width: 95, title: '基本(元)'},
|
||||
{field: 'subsidy', width: 95, title: '补贴(元)'},
|
||||
{field: 'benifits', width: 95, title: '福利(元)'},
|
||||
{field: 'fine', width: 95, title: '罚款(元)'},
|
||||
{field: 'total', width: 95, title: '合计(元)'},
|
||||
{field: 'salary_date', width: 95, title: '月份'},
|
||||
{field: 'is_pay', width: 95, title: '状态', templet: isPayFormat},
|
||||
]],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 10,
|
||||
page: true,
|
||||
skin: 'line',
|
||||
parseData: function(res){ //res 即为原始返回的数据
|
||||
var code = 0, msg = "获取数据成功"
|
||||
if (res.status != 2000) {
|
||||
code = -1
|
||||
msg = "数据不存在"
|
||||
}
|
||||
return {
|
||||
"code": code, //解析接口状态
|
||||
"msg": msg, //解析提示文本
|
||||
"count": res.total, //解析数据长度
|
||||
"data": res.msg //解析数据列表
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
function isPayFormat(data) {
|
||||
if (data.is_pay == 1) {
|
||||
return "未发放"
|
||||
} else {
|
||||
return "已发放"
|
||||
}
|
||||
}
|
||||
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
layer.msg("搜索成功");
|
||||
var staff_id = data.field.staff_id;
|
||||
var reqUrl = "/salary_record/query_history/all"
|
||||
if (typeof staff_id != "undefined" && staff_id != null && staff_id != "") {
|
||||
//执行搜索重载
|
||||
reqUrl = "/salary_record/query_history/"+staff_id
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
url: reqUrl,
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'add') { // 监听添加操作
|
||||
var index = layer.open({
|
||||
title: '添加通知',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/salary_detail_add.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//监听表格复选框选择
|
||||
// table.on('checkbox(currentTableFilter)', function (obj) {
|
||||
// console.log(obj)
|
||||
// });
|
||||
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.ID;
|
||||
var salary_id = obj.data.salary_id;
|
||||
if (obj.event === 'edit') {
|
||||
// 本地缓存需要编辑的通知信息
|
||||
localStorage.setItem("salary_edit_info", JSON.stringify(obj.data))
|
||||
alert("待编辑:" + localStorage.getItem("salary_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '编辑工资信息',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/salary_detail_edit.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
return false;
|
||||
} else if (obj.event === 'delete') {
|
||||
layer.confirm('确认删除吗?', function () {
|
||||
// alert(JSON.stringify(obj.data))
|
||||
// alert(depId)
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/salary/delete/" + salary_id,
|
||||
async: false,
|
||||
success:function (data) {
|
||||
var resp = JSON.parse(JSON.stringify(data));
|
||||
if (resp.status == 2000) {
|
||||
layer.alert("删除信息成功",function(index) {
|
||||
// 重新渲染
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
layer.close(index)
|
||||
// alert("layer.close")
|
||||
});
|
||||
}
|
||||
},
|
||||
error:function (data) {
|
||||
console.log("error resp:" + JSON.stringify(data))
|
||||
layer.msg("系统异常");
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if(obj.event === 'query') {
|
||||
// alert("查看详情")
|
||||
// 本地缓存需要查看的通知信息
|
||||
localStorage.setItem("notification_detail_info", JSON.stringify(obj.data))
|
||||
// alert("待编辑:" + localStorage.getItem("staff_edit_info"))
|
||||
var index = layer.open({
|
||||
title: '通知详情',
|
||||
type: 2,
|
||||
shade: 0.2,
|
||||
maxmin:true,
|
||||
shadeClose: true,
|
||||
area: ['80%', '80%'],
|
||||
content: '/views/admin_notification_detail.html',
|
||||
end: function(){
|
||||
//执行搜索重载
|
||||
table.reload('currentTableId', {
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
}, 'data');
|
||||
}
|
||||
});
|
||||
$(window).on("resize", function () {
|
||||
layer.full(index);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
{{ else }}
|
||||
alert("你没有数据查询权限")
|
||||
{{ end }}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user