Examination_system/Examination_system-1/.svn/pristine/58/582b2d46b4c8d1b82f7ad2a5cab...

244 lines
6.6 KiB
Plaintext

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html >
<html lang="en">
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<style type="text/css">
.ui-state-focus{
display: none !important;
}
</style>
</head>
<body>
<div class="page-content">
<div class="row-fluid">
<div class="col-xs-12">
<form id="baseForm" class="form-inline" method="POST" onsubmit="return false;">
<div class="widget-header widget-header-large" style="padding:10px;">
<div class="widget-main customBtn" >
<input id="keyWord" type="text" name="keyWord" placeholder="请输入关键词..." />
<button class="btn btn-success btn-sm" onclick="getbaseList(1)" id="search" title="查询" type="button">查询</button>
</div>
<div class="widget-toolbar customBtn">
<a title="增加" id="addBtn" onclick="addPost()" class="lrspace3" ><i class='icon-plus-sign color bigger-180'></i></a>
<a title="查看" onclick="updateOrViewPost('view')" class="lrspace3" ><i class='icon-info-sign color bigger-180'></i></a>
<a title="编辑" onclick="updateOrViewPost('edit')" class="lrspace3" ><i class='icon-edit-sign color bigger-180'></i></a>
<a title="刷新" id="searchBtn" onclick="getbaseList(1)" class="lrspace3" ><i class='icon-refresh bigger-180 orange'></i></a>
</div>
</div>
</form>
<table id="baseTable" class="table table-striped table-bordered table-hover" >
<thead>
<tr>
<th style="width:5%" class="center">选择</th>
<th style="width:5%" class="center">序号</th>
<th style="width:10%" class="center">岗位名称</th>
<th style="width:10%" class="center">岗位描述</th>
<th style="width:10%" class='center'>是否启用</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<%@include file="../dialog.jsp" %>
</div>
</div>
</div>
<script type="text/javascript">
/**
* @author 无畏
* @date 2019-05-24
* @function 启动执行
* @returns
*/
$(function () {
$.fn.modal.Constructor.prototype.enforceFocus = function(){};
$(".js-example-basic-single").select2({
"language": "zh-CN"
});
$("#baseForm").keydown(function(e) {
keycode = e.which || e.keyCode;
if (keycode == 13) {
search();
}
});
getbaseList(1);
});
/**
* @author 无畏
* @date 2019-05-26
* @function 条件查询
* @returns
*/
function search(){
$("#search").trigger("click")
}
/**
* @author 姜山
* @date 2019-08-16
* @function 初始化页面ajax请求 返回html页面
* @returns
*/
function getbaseList(init){
obj = {};
if(!JY.Object.notNull(init)){
init = $("#pageNum").val();
}
var size = $("#pageSize").val();
var data = {pageNum:init,pageSize:size};
data.obj = getObjParam("baseForm");
var idx = layer.msg('正在加载数据,请稍等...', {
icon: 16
,shade: 0.01
,time:'-1'
});
$.ajax({
type:"POST",
url:bonuspath +'/backstage/post/findByPage',
data: JSON.stringify(data),
dataType:"html",
contentType:"application/json",
success:function(data){
$("#baseTable tbody").html(data);
layer.close(idx);
}
})
}
/**
* @author 姜山
* @date 2019-08-04
* @function 逻辑删除采购任务
* @returns
*/
function del(id) {
JY.Model.confirm("确认删除吗?", function() {
JY.Ajax.doRequestPlus(null, bonuspath + '/backstage/newRole/del', {
id : id
}, function(data) {
JY.Model.info(data.resMsg, function() {
search();
});
});
});
}
/**
* @author 无畏
* @date 2020-03-13
* @function 新增岗位
* @returns
*/
function addPost(){
var index = layer.open({
type: 2,
title: "新增岗位",
shade: [0],
btn: ['保存', '取消'], //按钮组
area: ['40%', '45%'],
scrollbar: true,
anim: 2,
yes: function(index,layero){
var obj = $(layero).find("iframe")[0].contentWindow;
var valid = obj.formValid();
if(!valid){
return;
}
var post=obj.getInfo();
console.log(post);
$.ajax({
type:'POST',
url:bonuspath +'/backstage/post/add',
data:JSON.stringify(post),
dataType:'json',
contentType: "application/json",
success:function(data) {
console.log(data);
if(data.res == 1){
layer.msg(data.resMsg,{icon:1,time:1500},function(){
layer.close(index);
search();
});
}else{
layer.msg(data.resMsg,{icon:2,time:1500});
}
},
error:function(data){
layer.msg('请求发送失败',{icon:2,time:2000})
}
});
},
content: [bonuspath +'/backstage/post/toPostForm?keyWord=add']
});
}
/**
* @author 无畏
* @date 2020-03-13
* @function 修改岗位信息
* @returns
*/
function updateOrViewPost(opt){
if(validCheckboxCheckedNum(1)){
var id = $(".cb:checked:eq(0)").val();
var btns = ['保存', '取消'];
var title = '修改信息';
if(opt == 'view'){
btns = ['关闭']
title = '查看信息';
}
var index = layer.open({
type: 2,
title:title,
shade: [0],
btn: btns,
area: ['40%', '45%'],
scrollbar: true,
anim: 2,
yes: function(index,layero){
var obj = $(layero).find("iframe")[0].contentWindow;
if(opt == 'edit'){
var valid = obj.formValid();
if(!valid){
return;
}
var role=obj.getInfo();
console.log(role);
$.ajax({
type:'POST',
url:bonuspath +'/backstage/post/update',
data:JSON.stringify(role),
contentType: "application/json",
dataType:'json',
success:function(data) {
if(data.res == 1){
layer.msg(data.resMsg,{icon:1,time:1500},function(){
layer.close(index);
search();
});
}else{
layer.msg(data.resMsg,{icon:2,time:1500});
}
},
error:function(data){
layer.msg('请求发送失败',{icon:2,time:2000})
}
});
}else{
layer.close(index);
}
},
content: [bonuspath +'/backstage/post/toPostForm?keyWord='+opt+'&id='+id]
});
}
}
</script>
</body>
</html>