easyui datagrid 增删改查示例

时间:2021-02-07 18:11:56

查询JSP页面

 <!doctype html>
<%@include file="/internet/common.jsp"%>
<!-- 新样式右侧菜单共用CSS和部分JS:在页面最前 -->
<%@include file="/ChangeFbrole/pageMain/Common_RightMenu.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>告警接单人查询</title>
<script src="/ChangeFbrole/pgYunWei/scripts/QueryStaff.js" type="text/javascript"></script> <script language="javascript">
var userID = '<bean:write property="SessionEntity/userID"/>';
var RegionID = '<bean:write property="SessionEntity/RegionID"/>';
// 查询条件
var search_input = '<bean:write property="search_input"/>';
// 工单调度条件
var dispatch = '';
</script>
</head>
<body scroll="no">
<!-- 告警方式-->
<html:hidden property="currentstate" value="1" />
<!--查询SQL-->
<html:hidden property="sToSelectSql" value="" />
<!--过长的查询SQL-->
<html:hidden property="sToSelectSql2" value="" />
<!--查询条件-->
<html:hidden property="queryCond/Entity" value="" />
<div class="autoheight"> <h2><b>告警接单人查询</b> <span> </span></h2> <div class="boxEdit" id='toolbar' style="padding-top: 10px;">
<div class="boxEditItem">
<p class="th_title">ITSM工号:</p>
<div class="textInputWrap w480"><input id='itsmno' class="textInput" type="text" value="请输入ITSM工号" onfocus="if(value=='请输入ITSM工号'){value=''}" onblur="if(value==''){value='请输入ITSM工号'}" /></div>
<div class="btnWrap"><a class="btn btnNormal" href="###" onclick="query()"><span></span><i>搜索</i></a></div>
<div class="btnWrap"><span class="tr_h">精简筛选条件</span></div>
</div> <div class="boxEditItem">
<p class="th_title">姓名:</p>
<div class="textInputWrap w190"><input id="staffname" class="textInput" type="text" value="请输入姓名" onfocus="if(value=='请输入姓名'){value=''}" onblur="if(value==''){value='请输入姓名'}" /></div>
<p class="th_title" id="bsn">BSN工号:</p>
<div class="textInputWrap w190" id="bsndiv"><input id="bsnid" class="textInput" type="text" value="请输入BSN工号" onfocus="if(value=='请输入BSN工号'){value=''}" onblur="if(value==''){value='请输入BSN工号'}" /></div>
</div> <div class="boxEditItem">
<p class="th_title">告警:</p>
<div>
<a class="tags active" href="####" onclick="stateClick('1',this)">BSN告警</a>
<a class="tags" href="####" onclick="stateClick('2',this)">IT基础设施告警</a>
</div>
</div> <div class="fn-clear"></div> </div>
<div id="datadiv1">
<table id='table1' style="width:799px; "></table>
</div>
<table id="ordertable" style="width:799px;" >
</table> <!-- BSN接单人增加窗口start -->
<div id="WinViewAdd" class="easyui-window" title="新增BSN接单人" data-options="iconCls:'icon-save',closed:true,minimizable:false,top:'0',right:'100'" style="width:500px;height:330px;padding:10px;">
<form id="viewaddform" name="viewaddform" style="padding:10px 20px 10px 40px;">
<div class="boxEditItem">
<p class="th_title"><span>*</span>BSN工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> BSN工号不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>姓名:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_NAME" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 姓名不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>联系电话:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_PHONE" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 联系电话不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>综服工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/ITSM_STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 综服工号不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>ITSM工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> ITSM工号不能为空</em></div>
</div> <div class="fn-clear h10"></div>
<div class="boxEditItem">
<p class="th_title">&nbsp;</p>
<div>
<a class="btnLarge" href="####" onclick="addBsnStaffView()"><i>保 存</i></a>  
<a class="btnLarge btnGray" href="####" onclick="$('#viewaddform')[0].reset()"><i>重 置</i></a>
</div>
</div>
</form>
</div>
<!-- BSN接单人增加窗口end --> <!-- BSN接单人修改窗口start -->
<div id="WinViewEdit" class="easyui-window" title="修改BSN接单人信息" data-options="iconCls:'icon-save',closed:true,minimizable:false,top:'0',right:'120'" style="width:500px;height:400px;padding:10px;">
<form id="vieweditform" name="vieweditform" style="padding:10px 20px 10px 40px;">
<input type="hidden" name="ITSM_BSN_STAFF/ID" />
<input type="hidden" name="updateChk" >
<div class="fn-clear h10"></div>
<div class="boxEdit">
<div class="boxEditItem">
<p class="th_title"><span>*</span>BSN工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> BSN工号不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>姓名:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_NAME" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 姓名不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>联系电话:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/STAFF_PHONE" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 联系电话不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>综服工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/ITSM_STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 综服工号不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>ITSM工号:</p>
<div class="textInputWrap w190"><input name="ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> ITSM工号不能为空</em></div>
</div> <div class="fn-clear h10"></div> <div class="boxEditItem">
<p class="th_title">&nbsp;</p>
<div>
<a class="btnLarge" href="####" onclick="UpdateBsnView()"><i>保 存</i></a>  
</div>
</div>
</div>
<div class="fn-clear h5"></div>
</form>
</div>
<!-- BSN接单人修改窗口end --> <!-- IT基础设施告警接单人增加窗口start -->
<div id="WinViewAddIt" class="easyui-window" title="新增IT基础设施告警接单人" data-options="iconCls:'icon-save',closed:true,minimizable:false,top:'0',right:'100'" style="width:500px;height:330px;padding:10px;">
<form id="viewItaddform" name="viewItaddform" style="padding:10px 20px 10px 40px;">
<div class="boxEditItem">
<p class="th_title"><span>*</span>ITSM工号:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> ITSM工号不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>姓名:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_NAME" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 姓名不能为空</em></div>
</div> <div class="boxEditItem">
<p class="th_title"><span>*</span>联系电话:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_PHONE" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 联系电话不能为空</em></div>
</div> <div class="fn-clear h10"></div>
<div class="boxEditItem">
<p class="th_title">&nbsp;</p>
<div>
<a class="btnLarge" href="####" onclick="addItStaffView()"><i>保 存</i></a>  
<a class="btnLarge btnGray" href="####" onclick="$('#viewItaddform')[0].reset()"><i>重 置</i></a>
</div>
</div>
</form>
</div>
<!-- IT基础设施告警接单人增加窗口end --> <!-- IT基础设施告警接单人修改窗口start -->
<div id="WinViewEditIt" class="easyui-window" title="修改IT基础设施告警接单人信息" data-options="iconCls:'icon-save',closed:true,minimizable:false,top:'0',right:'120'" style="width:500px;height:400px;padding:10px;">
<form id="vieweditItform" name="vieweditItform" style="padding:10px 20px 10px 40px;">
<input type="hidden" name="ITSM_C_ITJJSS_STAFF/ID" />
<input type="hidden" name="updateChk" >
<div class="fn-clear h10"></div>
<div class="boxEdit">
<div class="boxEditItem">
<p class="th_title"><span>*</span>ITSM工号:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_ID" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> ITSM工号不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>姓名:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_NAME" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 姓名不能为空</em></div>
</div>
<div class="boxEditItem">
<p class="th_title"><span>*</span>联系电话:</p>
<div class="textInputWrap w190"><input name="ITSM_C_ITJJSS_STAFF/STAFF_PHONE" class="textInput" type="text"/></div>
<div class="edit_red" style="display: none;"><em class="col_red"> 联系电话不能为空</em></div>
</div> <div class="fn-clear h10"></div> <div class="boxEditItem">
<p class="th_title">&nbsp;</p>
<div>
<a class="btnLarge" href="####" onclick="UpdateItView()"><i>保 存</i></a>  
</div>
</div>
</div>
<div class="fn-clear h5"></div>
</form>
</div>
<!-- IT基础设施告警接单人修改窗口end --> <!-- 页面底部留白 -->
<div class="clearfix h10"></div>
</div>
</body>
</html>

query.jsp

增删改查js

// 获取查询列表json数据的链接
var queryUrl = "";
// 第一次加载标志位。
var loadState = 0;
$(document).ready(function(){
SERVICEDATAGRID = $('#ordertable');
CreateParam();
// 设置查询链接
joinUrl();
loadgrid(); });
/**
* 接单人查询
*/
function query(){
// 查询时设置按钮不可用,防止重复查询
// 创建查询语句和查询条件
CreateParam();
// 设置查询链接
joinUrl();
$("#ordertable").datagrid('options').url = queryUrl;
$("#ordertable").datagrid('load');
//alert($("input[name='currentstate']").val());
//当查询IT基础设施的时候隐藏BSN工号、综服工号列
if($("input[name='currentstate']").val()==2){
$('#ordertable').datagrid('hideColumn','STAFF_ID');
$('#ordertable').datagrid('hideColumn','ITSM_STAFF_ID');
document.getElementById("bsn").style.display="none";
document.getElementById("bsnid").style.display="none";
document.getElementById("bsndiv").style.display="none";
//$('#bsnid').hide();
}else{
$('#ordertable').datagrid('showColumn','STAFF_ID');
$('#ordertable').datagrid('showColumn','ITSM_STAFF_ID');
document.getElementById("bsn").style.display="";
document.getElementById("bsnid").style.display="";
document.getElementById("bsndiv").style.display="";
}
// 清空选中行
SERVICEDATAGRID.datagrid('clearSelections');
}
// 选择告警
function stateClick(status,Obj){
$(Obj).parent().find('a').removeClass().addClass("tags");
$(Obj).removeClass().addClass("tags active");
$("input[name='currentstate']").val(status);
query();
} /**
* 创建查询语句
*/
function CreateParam(){
// ITSM工号
var itsmBaseID = $('#itsmno').val();
if(itsmBaseID == '请输入ITSM工号'){
itsmBaseID = "";
}
// 工单类型
var StaffName = $('#staffname').val();
if(StaffName == '请输入姓名'){
StaffName = "";
}
// BSN工号
var BsnId = $('#bsnid').val();
if(BsnId == '请输入BSN工号'){
BsnId = "";
}
// 告警
var CURRENTSTATE= $("input[name='currentstate']").val(); // 忽略空格
itsmBaseID = itsmBaseID.replace(/\s/g,'');
StaffName = StaffName.replace(/\s/g,'');
BsnId = BsnId.replace(/\s/g,''); var i=0;
var dt=[];
var Sql="";
if(CURRENTSTATE==1){
Sql = "SELECT a.ID,a.STAFF_ID,a.STAFF_NAME,a.STAFF_PHONE,a.ITSM_STAFF_ID,a.NEW_ITSM_STAFF_ID,a.UPDATE_TIME FROM itsm.ITSM_BSN_STAFF a where 1=1 ";
}else{
Sql = "select a.ID,'' as STAFF_ID,a.STAFF_NAME,a.STAFF_PHONE,'' as ITSM_STAFF_ID,a.STAFF_ID as NEW_ITSM_STAFF_ID,a.UPDATE_TIME from itsm.ITSM_C_ITJJSS_STAFF a where 1=1 ";
}
var whereSql = "";
if(BsnId!=""){
if(CURRENTSTATE==1){
whereSql = whereSql +" and a.STAFF_ID like {eos_string}" ;
dt.push({name:'FormEntity/A'+i++,value: '¥'+BsnId+'¥'});
}
}
if(StaffName!=""){
whereSql = whereSql +" and a.STAFF_NAME like {eos_string}" ;
dt.push({name:'FormEntity/A'+i++,value: '¥'+StaffName+'¥'});
}
if(itsmBaseID!=""){
if(CURRENTSTATE==1){
whereSql = whereSql +" and a.NEW_ITSM_STAFF_ID like {eos_string}" ;
dt.push({name:'FormEntity/A'+i++,value: '¥'+itsmBaseID+'¥'});
}else{
whereSql = whereSql +" and a.STAFF_ID like {eos_string}" ;
dt.push({name:'FormEntity/A'+i++,value: '¥'+itsmBaseID+'¥'});
}
}
var Sql = Sql+whereSql;
var order = " order by a.ID desc";
var xmlSql="<FormEntity>";
for(var k=0;k<dt.length;k++){
var tempNode=dt[k].name;
xmlSql+="<"+tempNode.substring(tempNode.indexOf("/")+1)+">"+dt[k].value+"</"+tempNode.substring(tempNode.indexOf("/")+1)+">";
}
xmlSql+="</FormEntity>";
// 由于url字符串长度限制,所以当长度大于1800时则自动截取,sToSelectSql2中不能有中文!
if(Sql.length > 1800){
$("input[name='sToSelectSql']").val(Sql.substr(0,1500));
$("input[name='sToSelectSql2']").val(Sql.substr(1500));
}else{
$("input[name='sToSelectSql']").val(Sql);
$("input[name='sToSelectSql2']").val("");
}
$("input[name='queryCond/Entity']").val(xmlSql);
}
// 查询url
function joinUrl(){
queryUrl = 'ChangeFbrole.prYunWei.prStaffQueryAll.do?sToSelectSql='+$('input[name="sToSelectSql"]').val()+"&queryCond/Entity="+$('input[name="queryCond/Entity"]').val();
}
/*
* 创建列表
*/
function loadgrid(){ $('#ordertable').datagrid({
// 设置宽高
width:'799',
// 可折叠
collapsible:true,
// 查询条件
toolbar: toolbar,
// 标题
title:'告警接单人查询列表',
// 表格自适应当前页面大小
fit:false,
// 长度超出列宽时自动截取
nowrap: false,
// 列自适应表格大小
fitColumns:true,
// 是否只能选中一行
singleSelect:false,
// 选中一行时则选中当前行的复选框
selectOnCheck:true,
// 查询逻辑逻辑
url:queryUrl,
// 排序字段,传入后台
sortName: 'STAFF_ID',
// 排序方式,传入后台
sortOrder: 'desc',
// 返回行样式
rowStyler:function(index,row){
if(row.PROCESSTIMEOUT == "Y"){
if(row.ACTIVITYTIMEOUT == "N"){
return "background-color: orange;color:#fff;";
}else{
return "background-color: red;color:#fff;";
}
}
},
// 查询参数
queryParams:{
/* 查询条件
* 拼接查询字段传入后台。
* 注意:查询条件的中文会出现乱码,所以存在中文的条件放在url?之后。
* 必须使用存在中文的查询参数时,需要进行编码之后传入后台进行解码
*/
'SortOrder/order':function(){ var ordersql = ""; sortName = $('#ordertable').datagrid('options').sortName; sortOrder = $('#ordertable').datagrid('options').sortOrder; ordersql = " order by " + sortName + " " + sortOrder; return ordersql;
}, 'PageCond/begin':function (){
var begin = 0;
// 每页记录数
var size = $('#ordertable').datagrid('getPager').pagination('options').pageSize;
// 页码
var page = $('#ordertable').datagrid('getPager').pagination('options').pageNumber;
if(page > 1){
begin = size * (page - 1);
}
return begin;
}, 'PageCond/length':function (){return $('#ordertable').datagrid('getPager').pagination('options').pageSize;}, 'fresh':false, 'dispatch':'', 'ReplaceType':1, 'sToSelectSql2':function (){return $('input[name="sToSelectSql2"]').val();} },
// 是否从服务器获取数据进行排序
remoteSort: true,
// id字段
idField:'ID',
// 设置标题和对应列数据的id
columns:[[ /*
*field:必须。对应查询结果的字段名称。
*titile:必须。对应列显示标题。
*width:必须。按照比例显示列宽。
*sortable:可选。是否可以排序。
*formatter:可选。格式化。
*hidden:可选。是否隐藏列。
*/
{field:'ck',checkbox:true}, {field:'ID',title:'id',hidden:true}, {field:'STAFF_ID',title:'BSN工号',width:2.5*80,align:'center',sortable:true}, {field:'STAFF_NAME',title:'姓名',width:2*80,align:'center',sortable:true}, {field:'STAFF_PHONE',title:'联系电话',width:2*80,align:'center',sortable:true}, {field:'ITSM_STAFF_ID',title:'综服工号',width:2*80,align:'center',sortable:true,hidden:true}, {field:'NEW_ITSM_STAFF_ID',title:'ITSM工号',width:2*80,align:'center',sortable:true}, {field:'UPDATE_TIME',title:'更新时间',width:2*80,align:'center',sortable:true,formatter:formatUpdateTime}, ]],
// 是否可以分页
pagination:true,
// 从第几页开始显示
pageNumber:1,
// 每页显示记录数
pageSize:10,
// 可供选择的每页记录数
pageList:[10],
// 是否显示行数:这里的行是显示所有记录的行,总数太多时不建议使用,因为默认的行列无法自适应,总数超过4位数时就无法全部显示。
rownumbers:false,
// 在请求载入数据之前触发,如果返回false将取消载入。
onBeforeLoad:function(){
},
// 当数据载入成功时触发:列表查询完成时使查询按钮可用
onLoadSuccess:function(){
},
// 当载入远程数据发生错误时触发。
onLoadError:function(){
$.messager.alert("提示信息","数据载入失败!","error");
}
});
} // 表格按钮
var toolbar = [{
text:'增加',
iconCls:'icon-add',
handler:function(){
//alert($("input[name='currentstate']").val());
if($("input[name='currentstate']").val()==1){
$('#viewaddform')[0].reset(); // 重置表单元素
$('#WinViewAdd').window('open'); // 打开服务增加窗口
}else{
$('#viewItaddform')[0].reset(); // 重置表单元素
$('#WinViewAddIt').window('open'); // 打开服务增加窗口
}
}
},{
text:'删除',
iconCls:'icon-remove',
handler:function(){
var row = SERVICEDATAGRID.datagrid('getSelections');
if(row.length == 0){
$.messager.alert('提示信息','请先选中一行!','warning');
}else{
$.messager.confirm('提示信息', '是否确认删除选中接单人?', function(r){
if (r){
if($("input[name='currentstate']").val()==1){
delBsnStaffViews();
}else{
delItStaffViews();
}
}
});
}
}
},{
text:'修改',
iconCls:'icon-edit',
handler:function(){
var row = SERVICEDATAGRID.datagrid('getSelections');
if(row.length == 0){
$.messager.alert('提示信息','请先选中一行!','warning');
}else if(row.length > 1){
$.messager.alert('提示信息','修改时只能选中一行!','warning');
}else{
if($("input[name='currentstate']").val()==1){
// 打开修改界面
$('#WinViewEdit').window('open');
// 赋值
var editObj = $('#vieweditform');
editObj.find("input[name='ITSM_BSN_STAFF/STAFF_ID']").val(row[0]['STAFF_ID']);
editObj.find("input[name='ITSM_BSN_STAFF/STAFF_NAME']").val(row[0]['STAFF_NAME']);
editObj.find("input[name='ITSM_BSN_STAFF/STAFF_PHONE']").val(row[0]['STAFF_PHONE']);
editObj.find("input[name='ITSM_BSN_STAFF/ITSM_STAFF_ID']").val(row[0]['ITSM_STAFF_ID']);
editObj.find("input[name='ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID']").val(row[0]['NEW_ITSM_STAFF_ID']);
editObj.find("input[name='ITSM_BSN_STAFF/ID']").val(row[0]['ID']);
}else{
// 打开修改界面
$('#WinViewEditIt').window('open');
// 赋值
var editObj = $('#vieweditItform');
editObj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_ID']").val(row[0]['NEW_ITSM_STAFF_ID']);
editObj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_NAME']").val(row[0]['STAFF_NAME']);
editObj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_PHONE']").val(row[0]['STAFF_PHONE']);
editObj.find("input[name='ITSM_C_ITJJSS_STAFF/ID']").val(row[0]['ID']);
}
}
}
}];
/**
保存新增BSN接单人
*/
function addBsnStaffView(){
// 定义所属form
var formobj = $('#viewaddform');
var staffId = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_ID']").val();
var staffName = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_NAME']").val();
var staffPhone = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_PHONE']").val();
var issId = formobj.find("input[name='ITSM_BSN_STAFF/ITSM_STAFF_ID']").val();
var itsmId = formobj.find("input[name='ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID']").val(); if(staffId == ""){
$.messager.alert('提示信息','BSN工号不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_ID']").parent().parent().find('.edit_red').show(); // 显示红字提示信息
return;
}else if(staffName == ""){
$.messager.alert('提示信息','姓名不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_NAME']").parent().parent().find('.edit_red').show();
return;
}else if(staffPhone == ""){
$.messager.alert('提示信息','联系电话不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_PHONE']").parent().parent().find('.edit_red').show();
return;
}else if(issId == ""){
$.messager.alert('提示信息','综服工号不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/ITSM_STAFF_ID']").parent().parent().find('.edit_red').show();
return;
}else if(itsmId == ""){
$.messager.alert('提示信息','综服工号不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID']").parent().parent().find('.edit_red').show();
return;
} var sub = new HiddenSubmit("ChangeFbrole.bizYunWei.bizSaveBsnStaff");
if(sub.submitForm(document.forms.viewaddform)){
// 保存成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'增加成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//关闭增加窗口
$('#WinViewAdd').window('close');
//刷新表格
SERVICEDATAGRID.datagrid('load');
}else{
$.messager.alert('提示信息','保存失败!','error');
}
}
//删除BSN接单人
function delBsnStaffViews(){
var selects = SERVICEDATAGRID.datagrid('getSelections');
var sub = new HiddenSubmit('ChangeFbrole.bizYunWei.bizDelBsnStaffViews');
var xmlstr = ''
for(var i=0;i<selects.length;i++){
xmlstr = xmlstr + '<ITSM_BSN_STAFF><ID>' + selects[i]['ID'] + '</ID></ITSM_BSN_STAFF>'
}
sub.add('xmlstr',xmlstr);
if(sub.submit()){
// 删除成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'删除成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//刷新表格
SERVICEDATAGRID.datagrid('load');
// 清空选中行
SERVICEDATAGRID.datagrid('clearSelections');
}else{
$.messager.alert('提示信息','删除失败!','error');
};
}
//修改Bsn接单人信息
function UpdateBsnView(){
// 定义所属form
var formobj = $('#vieweditform');
var staffId = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_ID']").val();
var staffName = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_NAME']").val();
var staffPhone = formobj.find("input[name='ITSM_BSN_STAFF/STAFF_PHONE']").val();
var issId=formobj.find("input[name='ITSM_BSN_STAFF/ITSM_STAFF_ID']").val();
var itsmId=formobj.find("input[name='ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID']").val();
var sc_id=formobj.find("input[name='ITSM_BSN_STAFF/ID']").val(); if(staffId == ""){
$.messager.alert('提示信息','BSN工号不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_ID']").parent().parent().find('.edit_red').show();
return;
}else if(staffName == ""){
$.messager.alert('提示信息','姓名不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_NAME']").parent().parent().find('.edit_red').show();
return;
}else if(staffPhone == ""){
$.messager.alert('提示信息','联系电话不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/STAFF_PHONE']").parent().parent().find('.edit_red').show();
return;
}else if(itsmId == ""){
$.messager.alert('提示信息','ITSM工号不能为空!','warning');
formobj.find("input[name='ITSM_BSN_STAFF/NEW_ITSM_STAFF_ID']").parent().parent().find('.edit_red').show();
return;
} var sub = new HiddenSubmit("ChangeFbrole.bizYunWei.bizUpdateBsnView");
if(sub.submitForm(document.forms.vieweditform)){
sub.add('ITSM_BSN_STAFF/ID',sc_id);
// 保存成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'修改成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//关闭增加窗口
$('#WinViewEdit').window('close');
//刷新当前页
SERVICEDATAGRID.datagrid('reload');
}else{
$.messager.alert('提示信息','保存失败!','error');
};
} /**
保存新增IT基础设施接单人
*/
function addItStaffView(){
// 定义所属form
var formobj = $('#viewItaddform');
var staffId = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_ID']").val();
var staffName = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_NAME']").val();
var staffPhone = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_PHONE']").val(); if(staffId == ""){
$.messager.alert('提示信息','ITSM工号不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_ID']").parent().parent().find('.edit_red').show(); // 显示红字提示信息
return;
}else if(staffName == ""){
$.messager.alert('提示信息','姓名不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_NAME']").parent().parent().find('.edit_red').show();
return;
}else if(staffPhone == ""){
$.messager.alert('提示信息','联系电话不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_PHONE']").parent().parent().find('.edit_red').show();
return;
}
//$("input[name='currentstate']").val()
var sub = new HiddenSubmit("ChangeFbrole.bizYunWei.bizSaveItStaff");
if(sub.submitForm(document.forms.viewItaddform)){
// 保存成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'增加成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//关闭增加窗口
$('#WinViewAddIt').window('close');
//刷新表格
SERVICEDATAGRID.datagrid('load');
}else{
$.messager.alert('提示信息','保存失败!','error');
}
} //删除IT基础设施告警接单人
function delItStaffViews(){
var selects = SERVICEDATAGRID.datagrid('getSelections');
var sub = new HiddenSubmit('ChangeFbrole.bizYunWei.bizDelItStaffViews');
var xmlstr = ''
for(var i=0;i<selects.length;i++){
xmlstr = xmlstr + '<ITSM_C_ITJJSS_STAFF><ID>' + selects[i]['ID'] + '</ID></ITSM_C_ITJJSS_STAFF>'
}
sub.add('xmlstr',xmlstr);
if(sub.submit()){
// 删除成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'删除成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//刷新表格
SERVICEDATAGRID.datagrid('load');
// 清空选中行
SERVICEDATAGRID.datagrid('clearSelections');
}else{
$.messager.alert('提示信息','删除失败!','error');
};
} //修改IT基础设施告警接单人信息
function UpdateItView(){
// 定义所属form
var formobj = $('#vieweditItform');
var staffId = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_ID']").val();
var staffName = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_NAME']").val();
var staffPhone = formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_PHONE']").val();
var sc_id=formobj.find("input[name='ITSM_C_ITJJSS_STAFF/ID']").val(); if(staffId == ""){
$.messager.alert('提示信息','ITSM工号不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_ID']").parent().parent().find('.edit_red').show();
return;
}else if(staffName == ""){
$.messager.alert('提示信息','姓名不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_NAME']").parent().parent().find('.edit_red').show();
return;
}else if(staffPhone == ""){
$.messager.alert('提示信息','联系电话不能为空!','warning');
formobj.find("input[name='ITSM_C_ITJJSS_STAFF/STAFF_PHONE']").parent().parent().find('.edit_red').show();
return;
} var sub = new HiddenSubmit("ChangeFbrole.bizYunWei.bizUpdateItView");
if(sub.submitForm(document.forms.vieweditItform)){
sub.add('ITSM_C_ITJJSS_STAFF/ID',sc_id);
// 保存成功提示信息,显示1秒
$.messager.show({
title:'提示信息',
msg:'修改成功.',
timeout:1000,
style:{
right:'',
top:'150'
}
});
//关闭增加窗口
$('#WinViewEditIt').window('close');
//刷新当前页
SERVICEDATAGRID.datagrid('reload');
}else{
$.messager.alert('提示信息','保存失败!','error');
};
} // 格式化时间
function formatUpdateTime(val,row){
var str
if(val != ""){
str= val.substr(0,4) + "-" + val.substr(4,2) + "-" + val.substr(6,2) + " " + val.substr(8,2) + ":" + val.substr(10,2) + ":" + val.substr(12,2);
}
return str
}

QueryStaff.js