代码拉取完成,页面将自动刷新
<!--
<th data-options="field:'detail',width:30,align:'center',formatter:eventDetail">详细</th>
function eventDetail(val,row,index){
return '<img src="<%=request.getContextPath() %>/itsm/image/btn_search.png" width="20" height="20" onclick="queryDialog('+index+')"/>';
}
//页面详情函数
function queryDialog(index){
var detailRow = $('#eventDatagrid').datagrid('getRows')[index];
$("#operateDialog").dialog({
href : '<%=request.getContextPath()%>/incident/event_initEventDetail.action',
closed : false,
title : '详细信息',
padding: '10px',
closable : false,
modal : true,
width:'750px',
height:'500px',
//查询表单的数据初始化
queryParams:{
"eventInfoVO.id":detailRow.id
}
});
}
-->
EasyUI学习笔记---Datagrid真分页
EasyUI Datagrid组件在我看来功能还是很强大的,在我使用过程中遇到分页请求的问题困扰了一天才解决,下面我就把我遇到的问题分享一下
//datagrid数据表格渲染
$("#dg").datagrid({
loader: function(param, success, error) {
var pageNumber = param.page;
var pageSize = param.rows;
$.ajax({
type: "get",
url: url,
dataType: 'jsonp',
data: "pageNum=" + pageNumber + "&pageSize=" + pageSize,
success: function(data) {
if(data.code == 0) {
var arr = data.result.content;
$("#dg").datagrid('loadData', { total: data.result.page.totalRecord, rows: arr })
}
},
error: function() {
error.apply(this, arguments);
}
});
}
})
传入的参数有param, success, error可选
这里我主要用到了param,param有param.page(页码)和param.rows(每页显示行数)两个属性,由于页面载入之后就要进行查询,所以这个参数是必须的;
一 遇到的第一个问题是跨域,这个在之前的文章有些过,这里就不赘述了;
二 其次就是请求回的数据怎么渲染到表格中,由于是真分页,所以每次查询的数据只是当前页面的数据,并不是所有的数据,但是页脚显示数据总数必须是所有数据,这样才能就行分页。
最后通过查看资料发现,loadData方法可以传入一个json格式的数据$("#dg").datagrid('loadData', { total: data.result.page.totalRecord, rows: arr }),这样就解决了数据渲染分页请求的问题
三 由于我启用了loadMsg属性,即在请求后台数据的时候会显示正在加载的状态,但是请求成功之后此状态并未隐藏,最后通过设置
onLoadSuccess: function(data) {
//查询成功是隐藏正在加载状态。
$(this).datagrid("loaded");
}
在数据加载成功之后隐藏正在加载状态
四 点击下一页进行查询
//点击下一页
$('#dg').datagrid('getPager').pagination({
//刷新按钮执行的操作
onBeforeRefresh: function() {},
onSelectPage: function(pageNumber, pageSize) {
$("#dg").datagrid('loading'); //显示加载信息
$.ajax({
type: "get",
url: url,
dataType: 'jsonp',
data: "pageNum=" + pageNumber + "&pageSize=" + pageSize ,
success: function(data) {
if(data.code == 0) {
//数据返回成功后填充到表格中
var arr = data.result.content;
$("#dg").datagrid('loadData', { total: data.result.page.totalRecord, rows: arr })
}
},
error: function() {
error.apply(this, arguments);
}
})
}
});
//这里的rows page是自动的 不用去写 直接获得就能得到当前的数据 rows是pagesize page是第几页
//只要代码写的没问题,easyui下面的分页插件中,比如选择每页显示多少行和上一页、下一页事件是自动触发的。
//page和rows也是esyui每次自动传到后台的,不需要自己手写
int rows = Request["rows"] == null ? 10 : int.Parse(Request["rows"]);
int page = Request["page"] == null ? 1 : int.Parse(Request["page"]);
List<VehicleModel> lst = new List<VehicleModel>();
var array = Fquery.ToArray();
for (int i = (page - 1) * rows; i < page * rows && i < array.Length; i++)
{
lst.Add(array[i]);
}
//最重要的是在后台取数据放在json中要添加个参数total来存放数据的总行数,如果没有这个参数则不能分页
int total = array.Length;
var result = new { total = total, rows = lst };
return Json(result);
<div id="tb" style="padding: 2px; height: auto">
<div>
@*<a href="javascript:void(0)" onclick="cre('@Url.Action("VeCreate")')" class="easyui-linkbutton" iconcls="icon-add" plain="true">添加</a>*@
<a href="javascript:void(0)" onclick="mod('@Url.Action("VeEdit")')" class="easyui-linkbutton" iconcls="icon-edit" plain="true">修改</a>
<a href="javascript:void(0)" onclick="del('@Url.Action("VeDelete")')" class="easyui-linkbutton" iconcls="icon-remove" plain="true">删除</a>
<a id="btnSel" href="javascript:void(0)" onclick="sel()" class="easyui-linkbutton" iconcls="icon-search" plain="true">查询</a>
</div>
</div>
<table id="dgVehicle" class="easyui-datagrid" data-options="singleSelect:true,toolbar:'#tb',fit:true,fitColumns:true" title="车辆信息"
rownumbers="true" pagination="true" url="@Url.Action("VehicleData")">
<thead>
<tr>
<th data-options="field:'strVehicleModel'">
车辆型号
</th>
<th data-options="field:'strBatchNo'">
车辆批次
</th>
<th data-options="field:'strVIN'">
VIN码
</th>
<th data-options="field:'strEngineModel'">
发动机型号
</th>
<th data-options="field:'strEngineNo'">
发动机编号
</th>
<th data-options="field:'strEngineMaker'">
发动机制造商
</th>
<th data-options="field:'strEngineLineage'">
发动机系族
</th>
<th data-options="field:'strEngineAddress'">
发动机生产厂地址
</th>
<th data-options="field:'strBrand'">
发动机厂牌
</th>
<th data-options="field:'strStatus'">
状态
</th>
</tr>
</thead>
</table>
$(function (){
var p = $('#dgVehicle').datagrid().datagrid('getPager');
p.pagination({
pageSize: 20,
pageList:[10,20,30,40,50],
beforePageText: '第',
afterPageText:'共{pages}页',
displayMsg: '当前显示 {from} 到 {to} ,共{total}记录'
//onBeforeRefresh: function () {
// alert('before refresh');
//},
//onRefresh: function (pageNumber, pageSize) {
// alert(pageNumber);
// alert(pageSize);
//},
//onChangePageSize: function () {
// alert('pagesize changed');
//},
//onSelectPage: function (pageNumber, pageSize) {
// alert(pageNumber);
// alert(pageSize);
//}
});
var pager = $('#tt').datagrid('getPager'); // get the pager of datagrid
pager.pagination({
showPageList:false,
buttons:[{
iconCls:'icon-search',
handler:function(){
alert('search');
}
},{
iconCls:'icon-add',
handler:function(){
alert('add');
}
},{
iconCls:'icon-edit',
handler:function(){
alert('edit');
}
}],
onBeforeRefresh:function(){
alert('before refresh');
return true;
}
});
<table id="tt" title="Load Data" class="easyui-datagrid" style="width:550px;height:250px"
url="data/datagrid_data.json"
iconCls="icon-save" pagination="true">
<thead>
<tr>
<th field="itemid" width="80">Item ID</th>
<th field="productid" width="80">Product ID</th>
<th field="listprice" width="80" align="right">List Price</th>
<th field="unitcost" width="80" align="right">Unit Cost</th>
<th field="attr1" width="100">Attribute</th>
<th field="status" width="60" align="center">Stauts</th>
</tr>
</thead>
</table>
$('#dg_query').datagrid({
toolbar:toolbar,
loadMsg:'数据加载中....',
columns:[[
{field:'ckSelect',title:'选择',width:50,checkbox:true},
{field:'WBSH',title:'发货方',width:120,align:'left', sortable:true},
{field:'APPLY_TIME',title:'申请时间',width:70,align:'left', sortable:true},
{field:'WBWAYBILLID',title:'确认号',width:120,align:'left', sortable:true},
{field:'WBAPPSTATE',title:'WBAPPSTATE',hidden:true},
{field:'APL_STAT',title:'申请状态',width:60,align:'left', sortable:true},
{field:'WBCHKSTATE',title:'WBCHKSTATE',hidden:true},
{field:'CHK_STAT',title:'确认状态',width:60,align:'left', sortable:true, styler:cellStyler},
{field:'WBUPLSTATE',title:'WBUPLSTATE',hidden:true},
{field:'UPL_STAT',title:'上传标记',width:60,align:'left', sortable:true},
{field:'WBCHKUPLST',title:'WBCHKUPLST',hidden:true},
{field:'UPLCHK_STAT',title:'保函<br/>审核状态',width:60,align:'left', sortable:true, styler:cellStyler},
{field:'HAVE_DAY',title:'有效期<br/>天数还有',width:70,align:'left', sortable:true},
{field:'BEG_TIME',title:'有效期<br/>起始时间',width:70,align:'left', sortable:true},
{field:'END_TIME',title:'有效期<br/>结束时间',width:70,align:'left', sortable:true},
{field:'WBLDNM',title:'起运港口',width:70,align:'left', sortable:true},
{field:'POD_PORT',title:'卸货港口',width:120,align:'left', sortable:true},
{field:'WBCONTRACT',title:'合约号',width:70,align:'left', sortable:true},
{field:'WBIVLD',title:'WBIVLD',hidden:true},
{field:'DEL_STAT',title:'是否删除',width:70,align:'left', sortable:true},
{field:'WBKEY',title:'WBKEY',hidden:true}
]],
border: true,
nowrap: false,
fit: true,
fitColumns: false,
//striped: true,
singleSelect: true,
remoteSort: false,
rownumbers: true,
pagination: true,
pageSize: 10,
pageList: [10,20,50,100,200],
loadFilter: pagerFilter,
rowStyler: function(index, row) {
if ($.trim(row.WBIVLD) != '') {
return 'color:#ff0000';
} else if ($.trim(row.WBCHKSTATE) == 'C' && $.trim(row.WBCHKUPLST) == 'C') {
return 'background-color:#c4e1ff';
}
}
});
function cellStyler(value, row, index) {
if ($.trim(value) == '已拒绝') {
return 'color:#ff0000';
}
}
//分页功能
function pagerFilter(data) {
if (typeof data.length == 'number' && typeof data.splice == 'function') {
data = {
total: data.length,
rows: data
}
}
var dg = $(this);
var opts = dg.datagrid('options');
var pager = dg.datagrid('getPager');
pager.pagination({
onSelectPage: function (pageNum, pageSize) {
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber: pageNum,
pageSize: pageSize
});
dg.datagrid('loadData', data);
}
});
if (!data.originalRows) {
if(data.rows)
data.originalRows = (data.rows);
else if(data.data && data.data.rows)
data.originalRows = (data.data.rows);
else
data.originalRows = [];
}
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
var end = start + parseInt(opts.pageSize);
data.rows = (data.originalRows.slice(start, end));
return data;
}
通过 $.fn.pagination.defaults 重写默认的 defaults。
分页(pagination)允许用户通过翻页导航数据。它支持页面导航和页面长度选择的可配置选项。用户可以在分页的右侧添加自定义按钮来增强功能。
依赖
linkbutton
用法
通过标记创建分页(pagination)。
<div id="pp" class="easyui-pagination" style="background:#efefef;border:1px solid #ccc;"
data-options="total:2000,pageSize:10">
</div>
使用 javascript 创建分页(pagination)。
<div id="pp" style="background:#efefef;border:1px solid #ccc;"></div>
$('#pp').pagination({
total:2000,
pageSize:10
});
让我们通过面板(panel)和分页(pagination)插件创建 ajax 分页(pagination)。当用户选择一个新的页面时,面板(panel)将显示指定页面的相应内容。
<div id="content" class="easyui-panel" style="height:200px"
data-options="href:'show_content.php?page=1'">
</div>
<div class="easyui-pagination" style="border:1px solid #ccc;"
data-options="
total: 2000,
pageSize: 10,
onSelectPage: function(pageNumber, pageSize){
$('#content').panel('refresh', 'show_content.php?page='+pageNumber);
}">
</div>
顶部的面板(panel)默认显示第一个页面的内容。当用户导航页面时,'onSelectPage' 事件将被触发,该事件为内容面板(panel)调用 'refresh' 方法来加载带有一个新的 URL 参数的新页面内容。
属性
名称 类型 描述 默认值
total number 记录总数,应该在创建分页(pagination)时设置。 1
pageSize number 页面尺寸。(注:每页显示的最大记录数) 10
pageNumber number 创建分页(pagination)时显示的页码。 1
pageList array 用户能改变页面尺寸。pageList 属性定义了能改成多大的尺寸。
代码实例:
$('#pp').pagination({
pageList: [10,20,50,100]
});
[10,20,30,50]
loading boolean 定义数据是否正在加载。 false
buttons array,selector 定义自定义按钮,可能的值:
1、数组,每个按钮包含两个属性:
iconCls:CSS class,它将显示一个背景图片
handler:当按钮被点击时的处理函数
2、选择器,指示按钮。
按钮可通过标记声明:
<div class="easyui-pagination" style="border:1px solid #ccc" data-options="
total: 114,
buttons: [{
iconCls:'icon-add',
handler:function(){alert('add')}
},'-',{
iconCls:'icon-save',
handler:function(){alert('save')}
}]">
</div>
按钮也可以使用 javascript 创建:
$('#pp').pagination({
total: 114,
buttons: [{
iconCls:'icon-add',
handler:function(){alert('add')}
},'-',{
iconCls:'icon-save',
handler:function(){alert('save')}
}]
});
null
layout array 分页布局定义。该属性自版本 1.3.5 起可用。
布局项目包括一个或多个下列值:
1、list:页面尺寸列表。
2、sep:页面按钮分割。
3、first:第一个按钮。
4、prev:前一个按钮。
5、next:后一个按钮。
6、last:最后一个按钮。
7、efresh:刷新按钮。
8、manual:允许输入域页码的手动页码输入框。
9、links:页码链接。
代码实例:
$('#pp').pagination({
layout:['first','links','last']
});
links number 链接数量,只有当 'links' 项包含在 'layout' 中时才是有效的。该属性自版本 1.3.5 起可用。 10
showPageList boolean 定义是否显示页面列表。 true
showRefresh boolean 定义是否显示刷新按钮。 true
beforePageText string 在 input 组件之前显示 label。 Page
afterPageText string 在 input 组件之后显示 label。 of {pages}
displayMsg string Display a page information. 显示 {from} to {to} of {total} 页面信息。
事件
名称 参数 描述
onSelectPage pageNumber, pageSize 当用户选择新的页面时触发。回调函数包含两个参数:
pageNumber:新的页码
pageSize:新的页面尺寸
代码实例:
$('#pp').pagination({
onSelectPage:function(pageNumber, pageSize){
$(this).pagination('loading');
alert('pageNumber:'+pageNumber+',pageSize:'+pageSize);
$(this).pagination('loaded');
}
});
onBeforeRefresh pageNumber, pageSize 刷新按钮点击之前触发,返回 false 就取消刷新动作。
onRefresh pageNumber, pageSize 刷新之后触发。
onChangePageSize pageSize 当用户改变页面尺寸时触发。
方法
名称 参数 描述
options none 返回选项(options)对象。
loading none 把分页(pagination)变成正在加载(loading)状态。
loaded none 把分页(pagination)变成加载完成(loaded)状态。
refresh options 刷新并显示分页信息。该方法自版本 1.3 起可用。
代码实例:
$('#pp').pagination('refresh'); // 刷新分页栏信息
$('#pp').pagination('refresh',{ // 改变选项,并刷新分页栏信息
total: 114,
pageNumber: 6
});
select page 选择一个新页面。页面索引从 1 开始。该方法从版本 1.3 起可用。
代码实例:
$('#pp').pagination('select'); // 刷新当前页面
$('#pp').pagination('select', 2); // 选择第二页
$('#datagrid').datagrid({
url : '<%=request.getContextPath()%>/incident/incident_queryIncidentInfo.action',
idField : 'wsdId',
toolbar : '#toolbar',
pageList : [10,20,30,40,50],
pagination : true,
rownumbers : true,
fitColumns : true,
singleSelect:true,
fit : true,
nowrap : true,
multiSort : true,
border : false,
striped : true,
queryParams:{
menuCode:theCurrentPageMenuCode
}
});
$('#datagrid').datagrid({
onSelect: function(rowIndex,rowData){
var status = rowData.incidentStatusShow;
if(status == "等待提交"){
//编辑、删除、提交、维护可用,关闭,挂起
$("#edit").removeAttr("disabled");
$("#edit").css("background-color","#56B3EE");
$("#del").removeAttr("disabled");
$("#del").css("background-color","#56B3EE");
$("#submit").removeAttr("disabled");
$("#submit").css("background-color","#56B3EE");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").removeAttr("disabled");
$("#gq").css("background-color","#56B3EE");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "等待处理"){
//新增,维护,分配可用,关闭,挂起
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").removeAttr("disabled");
$("#fp").css("background-color","#56B3EE");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").removeAttr("disabled");
$("#handle").css("background-color","#56B3EE");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").removeAttr("disabled");
$("#gq").css("background-color","#56B3EE");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "已挂起"){
//新增,处理,关闭,重启,维护
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").attr("disabled","disabled");
$("#gq").css("background-color","gray");
$("#cq").removeAttr("disabled");
$("#cq").css("background-color","#56B3EE");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "已重启"){
//新增,关闭,维护,提交
$("#edit").removeAttr("disabled");
$("#edit").css("background-color","#56B3EE");
$("#del").removeAttr("disabled");
$("#del").css("background-color","#56B3EE");
$("#submit").removeAttr("disabled");
$("#submit").css("background-color","#56B3EE");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").attr("disabled","disabled");
$("#gq").css("background-color","gray");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "已关闭"){
//新增,维护
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").attr("disabled","disabled");
$("#gq").css("background-color","gray");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "负责人打回"){
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").removeAttr("disabled");
$("#fp").css("background-color","#56B3EE");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").removeAttr("disabled");
$("#handle").css("background-color","#56B3EE");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").removeAttr("disabled");
$("#gq").css("background-color","#56B3EE");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "已处理"){
//新增,维护,关闭,挂起
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").removeAttr("disabled");
$("#close").css("background-color","#56B3EE");
$("#gq").removeAttr("disabled");
$("#gq").css("background-color","#56B3EE");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").removeAttr("disabled");
$("#wh").css("background-color","#56B3EE");
$("#stop").removeAttr("disabled");
$("#stop").css("background-color","#56B3EE");
}
if(status == "异常中止"){
$("#edit").attr("disabled","disabled");
$("#edit").css("background-color","gray");
$("#del").attr("disabled","disabled");
$("#del").css("background-color","gray");
$("#submit").attr("disabled","disabled");
$("#submit").css("background-color","gray");
$("#fp").attr("disabled","disabled");
$("#fp").css("background-color","gray");
$("#receive").attr("disabled","disabled");
$("#receive").css("background-color","gray");
$("#refuse").attr("disabled","disabled");
$("#refuse").css("background-color","gray");
$("#handle").attr("disabled","disabled");
$("#handle").css("background-color","gray");
$("#close").attr("disabled","disabled");
$("#close").css("background-color","gray");
$("#gq").attr("disabled","disabled");
$("#gq").css("background-color","gray");
$("#cq").attr("disabled","disabled");
$("#cq").css("background-color","gray");
$("#wh").attr("disabled","disabled");
$("#wh").css("background-color","gray");
$("#stop").attr("disabled","disabled");
$("#stop").css("background-color","gray");
}
}
});
var sel = $('#datagrid').datagrid('getSelections');
$("#datagrid").datagrid("reload");
$("#datagrid").datagrid("unselectAll");
var fireSafeRow = $('#datagrid').datagrid('getRows')[index];
$('#datagrid').datagrid({
url : '<%=request.getContextPath()%>/incident/incident_queryIncidentInfosByCondition.action',
idField : 'wsdId',
toolbar : '#toolbar',
pageList : [10,20,30,40,50],
pagination : true,
rownumbers : true,
fitColumns : true,
fit : true,
nowrap : true,
multiSort : true,
border : true,
striped : true,
queryParams :
{
condition : con,
menuCode:theCurrentPageMenuCode
} ,
onClickRow : function(index,row){
},
rowStyler: function(index,row){
if (index%2==1){
//return 'background-color:#efefef;';
}
}
});
<table id="datagrid"><!-- 数据列表区域 -->
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'incidentName',width:20,align:'center'">事件</th>
<th data-options="field:'incidentUrgencyShow',width:10,align:'center'">紧急度</th>
<th data-options="field:'incidentPriorityShow',width:10,align:'center'">优先度</th>
<th data-options="field:'incidentAppTime',width:20,align:'center'">申报时间</th>
<th data-options="field:'appStaffName',width:15,align:'center'">申报人</th>
<th data-options="field:'manager',width:15,align:'center'">负责人</th>
<th data-options="field:'incidentStatusShow',width:10,align:'center'">事件状态</th>
<th data-options="field:'sss',width:10,align:'center',formatter: formatOper">详情</th>
<th data-options="field:'sss1',width:10,align:'center',formatter: formatOper1">超时标志</th>
</tr>
</thead>
</table><!-- end 数据列表区域 -->
<div id="toolbar" class="gridHeader" style="background-color: white;">
<table style="width:100%;">
<tr style="height: 40px;">
<!-- <td class="gridToolbarTdLeft">
如果特殊情况,需要在数据展示区的表头显示文字,可以写在这里
</td> -->
<td class="gridToolbarTdLeft">
<wsd:button type="button" styleClass="btn-classname btn-add-img" value="新增" onclick="myAdd()" style="function:sjgl,ADD"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-edit-img" value="编辑" onclick="edit()" style="function:sjgl,MODIFY"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-del-img" value="删除" onclick="del()" style="function:sjgl,DELETE"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-tijiao-img" value="提交" onclick="mySubmit()" style="function:sjgl,SUBMIT"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-fp-img" value="分配" onclick="myfp()" style="display: none;function:sjgl,DISTRIBUTION"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-receive-img" value="接受" onclick="receive()" style="display: none;function:sjgl,ACCEPT"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-refuse-img" value="拒绝" onclick="refuse()" style="display: none;function:sjgl,REFUSED"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-handle-img" value="处理" onclick="myHandle()" style="function:sjgl,HANDLED"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-close-img" value="确认" onclick="myConfirm()" style="function:sjgl,CONFIRM"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-hang-img" value="挂起" onclick="hangIncident()" style="function:sjgl,UP"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-cq-img" value="重启" onclick="restartIncident()" style="function:sjgl,RESTART"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-close-img" value="中止" onclick="stopIncident()" style="function:sjgl,SUSPEND"></wsd:button>
<wsd:button type="button" styleClass="btn-classname btn-wh-img" value="维护" onclick="maintain()" style="display:none;function:sjgl,MAINTENANCE"></wsd:button>
<wsd:button type="button" styleClass="btn-classname-long btn-wh-img" value="关联信息" onclick="glxx()" style="function:sjgl,CORRELATION"></wsd:button>
<wsd:button type="button" styleClass="btn-classname-long btn-refuse-img" value="生成问题" onclick="createProblem()" style="function:sjgl,GENERATES"></wsd:button>
<input type="button" id="" class="btn-classname-long btn-refuse-img" value="发起变更" onclick="createChange()">
<!-- <input type="button" id="add" class="btn-classname btn-add-img" value="新增" onclick="myAdd()">
<input type="button" id="edit" class="btn-classname btn-edit-img" value="编辑" onclick="edit()">
<input type="button" id="del" class="btn-classname btn-del-img" value="删除" onclick="del()">
<input type="button" id="submit" class="btn-classname btn-tijiao-img" value="提交" onclick="mySubmit()">
<input type="button" id="fp" class="btn-classname btn-fp-img" value="分配" onclick="myfp()" style="display: none">
<input type="button" id="receive" class="btn-classname btn-receive-img" value="接受" onclick="receive()" style="display: none">
<input type="button" id="refuse" class="btn-classname btn-refuse-img" value="拒绝" onclick="refuse()" style="display: none">
<input type="button" id="handle" class="btn-classname btn-handle-img" value="处理" onclick="myHandle()">
<input type="button" id="close" class="btn-classname btn-close-img" value="确认" onclick="myConfirm()">
<input type="button" id="gq" class="btn-classname btn-hang-img" value="挂起" onclick="hangIncident()">
<input type="button" id="cq" class="btn-classname btn-cq-img" value="重启" onclick="restartIncident()">
<input type="button" id="stop" class="btn-classname btn-close-img" value="中止" onclick="stopIncident()">
<input type="button" id="wh" class="btn-classname btn-wh-img" value="维护" onclick="maintain()" style="display: none">
<input type="button" id="" class="btn-classname-long btn-wh-img" value="关联信息" onclick="glxx()">
<input type="button" id="" class="btn-classname-long btn-refuse-img" value="生成问题" onclick="createProblem()">
<input type="button" id="" class="btn-classname-long btn-refuse-img" value="发起变更" onclick="createChange()">
<input type="button" id="" class="btn-classname-long btn-refuse-img" value="生成问题" onclick="createProblem()"> -->
<div style="float: right">
<div class="input-container" style="width: 200px;">
<input type="text" name="" class="input-input" style="width: 160px;" id="query"/>
<a class="input-btn-search" onclick="query()"></a>
</div>
</div>
</td>
</tr>
</table>
</div><!-- end数据列表表头区域 -->
$('#eventDatagrid').datagrid({
url : '${pageContext.request.contextPath}/incident/event_findEventInfoList.action',
method : 'post',
pageSize : 50,
pagination : true,
rownumbers : true,
multiSort : true,
singleSelect:true,
striped : true,
bodyCls:'sideBorder',
queryParams :{
'theCurrentPageMenuCode' :menuCode,
'isInit':'true',
'remindType':remindType
},
onClickRow: function(index, row){
document.getElementById("btnfla").style.display="none";
document.getElementById("btnflh").style.display="none";
document.getElementById("btnasl").style.display="none";
document.getElementById("btnsla").style.display="none";
document.getElementById("btnslh").style.display="none";
document.getElementById("btnhs").style.display="none";
document.getElementById("btnhs1").style.display="none";
document.getElementById("btnqr").style.display="none";
document.getElementById("btnrtf").style.display="none";
document.getElementById("btnatc").style.display="none";
document.getElementById("btnchange").style.display="none";
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_isMember.action',
data: {
'theCurrentPageMenuCode': menuCode,
'eventInfoVO.id':row.id
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
var r = eval('(' + res + ')');
if(r==true){
document.getElementById("btnchange").style.display = "";
// 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题 转问题
}else{
document.getElementById("btnchange").style.display = "none";
}
}
});
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_isDutyMan.action',
data: {
'theCurrentPageMenuCode': menuCode,
'eventInfoVO.id':row.id
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
console.log('res');
console.log(res);
var r = eval('(' + res + ')');
console.log('r1');
console.log(r);
if (r) {
document.getElementById("btnhangup").style.display = "";
document.getElementById("btnhangdown").style.display = "";
document.getElementById("btnrts").style.display = "";
document.getElementById("btnhangupdetail").style.display = "";
}else{
document.getElementById("btnhangup").style.display = "none";
document.getElementById("btnhangdown").style.display = "none";
document.getElementById("btnrts").style.display = "none";
document.getElementById("btnhangupdetail").style.display = "none";
}
}
});
$("#eventResolveDatagrid").datagrid({
url : '${pageContext.request.contextPath}/incident/event_findEventResolveInfoListByEventId.action',
method : 'post',
pageSize : 10,
pagination : true,
rownumbers : true,
multiSort : true,
singleSelect:true,
striped : true,
bodyCls:'sideBorder',
queryParams :{
'eventInfoVO.id' :row.id
},
onClickRow: function(index, row1){
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_isMyEvent.action',
data: {
// 'eventInfoVO.id': row.id
'eventResolveInfoVO.id':row1.id
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
var r = eval('(' + res + ')');
if(r.status){
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_getMemberLevel.action',
data: {
'theCurrentPageMenuCode': menuCode
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_isMyFrontEvent.action',
data: {
'eventResolveInfoVO.id':row1.id
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
var r = eval('(' + res + ')');
console.log('r2');
console.log(r);
if(r){
front=true;
if(row1.status==2||row1.status==3
||row1.status==4||row1.status==9||row1.status==13){
document.getElementById("btnfla").style.display="";
document.getElementById("btnflh").style.display="";
document.getElementById("btnasl").style.display="";
document.getElementById("btnqr").style.display="";
document.getElementById("btnhs1").style.display="";
}
}
else{
document.getElementById("btnfla").style.display="none";
document.getElementById("btnflh").style.display="none";
document.getElementById("btnqr").style.display="none";
document.getElementById("btnasl").style.display="none";
document.getElementById("btnhs1").style.display="none";
}
}
});
$.ajax({
url: '<%=request.getContextPath() %>/incident/event_isMySecondEvent.action',
data: {
'eventResolveInfoVO.id':row1.id
},
dataType: 'text',
method: 'post',
cache: false,
success: function (res) {
var r = eval('(' + res + ')');
console.log('r3');
console.log(r);
if(r){
second=true;
if((row1.status==6||row1.status==7
||row1.status==8)){
document.getElementById("btnsla").style.display="";
document.getElementById("btnslh").style.display="";
document.getElementById("btnhs").style.display="";
document.getElementById("btnrtf").style.display="";
document.getElementById("btnatc").style.display="";
}
}else{
document.getElementById("btnsla").style.display="none";
document.getElementById("btnslh").style.display="none";
document.getElementById("btnhs").style.display="none";
document.getElementById("btnrtf").style.display="none";
document.getElementById("btnatc").style.display="none";
}
}
});
}
});
}else{
document.getElementById("btnfla").style.display="none";
document.getElementById("btnflh").style.display="none";
document.getElementById("btnasl").style.display="none";
document.getElementById("btnhs").style.display="none";
document.getElementById("btnhs1").style.display="none";
document.getElementById("btnsla").style.display="none";
document.getElementById("btnslh").style.display="none";
document.getElementById("btnqr").style.display="none";
document.getElementById("btnrtf").style.display="none";
document.getElementById("btnatc").style.display="none";
}
}
});
}
});
}
});
$("#eventResolveDatagrid").datagrid('loadData',{ 'total': 0,'rows':''});
$("#eventDatagrid").datagrid("reload");
var sel = $('#eventDatagrid').datagrid('getSelected');
$('#eventDatagrid').datagrid('reload',{
isQuery:"true",
'eventQueryVO.eventNo':eventNo,
'eventQueryVO.declarantName':queryDeclarantName,
'eventQueryVO.declarantNo':queryDeclarantNo,
'eventQueryVO.department' : queryDeptCode,
'eventQueryVO.mainEvent' : queryMainEvent,
'eventQueryVO.subEvent' : querySubEvent,
'eventQueryVO.application' : queryApplication,
'eventQueryVO.priorityLevel' : queryPriority,
'eventQueryVO.title':title,
'eventQueryVO.status':queryStatus,
'eventQueryVO.declareTimeBefore':queryDStartDate,
'eventQueryVO.declareTimeAfter':queryDEndDate,
'eventQueryVO.closeTimeBefore':queryEStartDate,
'eventQueryVO.closeTimeAfter':queryEEndDate,
'eventQueryVO.secondlineMember':secondlineMember,
'eventQueryVO.frontlineMember':frontlineMember,
'eventQueryVO.remindType':queryRemindType,
'menuCode' : menuCode//当前页面的菜单代码
}).datagrid('unselectAll');
$('#eventResolveDatagrid').datagrid('reload');
var detailRow = $('#eventDatagrid').datagrid('getRows')[index];
$('#eventDatagrid').datagrid('reload');
var sel1 = $('#eventDatagrid').datagrid('getSelected');
<table id="eventDatagrid" style="border: #DCDCDC 1px solid;margin: auto;" data-options="idField : 'id',
rownumbers : true,
fitColumns : true,
fit : true,
nowrap : true,
multiSort : true,
border : true,
striped : true,
bodyCls:'sideBorder'">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'id',hidden:true"/>
<th data-options="field:'majorStatus',width:40,align:'center',formatter:emergencyMarker">重大标识</th>
<th data-options="field:'timeoutState',width:40,align:'center',formatter:timeoutMarker">超时标识</th>
<th data-options="field:'eventNo',width:60,align:'center'">事件编号</th>
<th data-options="field:'title',width:70,align:'center'">标题</th>
<!-- <th data-options="field:'mainEventName',width:50,align:'center'">事件分类</th>
<th data-options="field:'subEventName',width:50,align:'center'">事件子类</th> -->
<th data-options="field:'declarantName',width:50,align:'center'">事件申报人</th>
<!-- <th data-options="field:'location',width:100,align:'center'">发生地点</th> -->
<th data-options="field:'priorityLevel',width:50,align:'center',formatter:priorityFormatter">优先级</th>
<th data-options="field:'declareTimeStr',width:80,align:'center'">申报时间</th>
<th data-options="field:'status',width:50,align:'center',formatter:statusFormatter">状态</th>
<th data-options="field:'detail',width:30,align:'center',formatter:eventDetail">详细</th>
</tr>
</thead>
</table>
$('#changeDatagrid').datagrid({
url : '${pageContext.request.contextPath}/change/change_findChangeInfoList.action',
method : 'post',
pageSize : 10,
pagination : true,
rownumbers : true,
multiSort : true,
singleSelect:true,
striped : true,
bodyCls:'sideBorder',
queryParams :{
'theCurrentPageMenuCode' :menuCode,
'changeQueryVO.remindType':remindType
},onClickRow: function(index, row) {
//console.log("index-=>"+index);
//console.log("row-=>"+row.id)
//console.log(row);
$.ajax({
url: '<%=request.getContextPath() %>/change/change_isMySecondLineMember.action',
data: {
'theCurrentPageMenuCode': menuCode,
'changeInfoVO.id': row.id
},
dataType: 'text',
method: 'post',
cache: false,
async:false,
success: function (res) {
var r = eval('(' + res + ')');
//console.log(r);
console.log("row.changeStatus");
console.log(row.changeStatus);
console.log("r");
console.log(r);
if (r) {
if(row.changeStatus==1||row.changeStatus==10){
document.getElementById("btnmodify").style.display = "";
document.getElementById("btndelete").style.display = "";
document.getElementById("btn_change_assign").style.display = "";
document.getElementById("btn_change_annul").style.display = "none";
} else {
document.getElementById("btnmodify").style.display = "none";
document.getElementById("btndelete").style.display = "none";
document.getElementById("btn_change_assign").style.display = "none";
document.getElementById("btn_change_annul").style.display = "none";
}
} else {
document.getElementById("btnmodify").style.display = "none";
document.getElementById("btndelete").style.display = "none";
document.getElementById("btn_change_assign").style.display = "none";
document.getElementById("btn_change_annul").style.display = "none";
}
}
});
//判断
$.ajax({
url: '<%=request.getContextPath() %>/change/change_isMyDutyMan.action',
data: {
'theCurrentPageMenuCode': menuCode,
'changeInfoVO.id': row.id
},
dataType: 'text',
method: 'post',
cache: false,
async:false,
success: function (res) {
var r = eval('(' + res + ')');
if (r==true) {
if(row.changeStatus==2||row.changeStatus==8||row.changeStatus==11){
document.getElementById("btn_manager_approve").style.display = "";
}
else{
document.getElementById("btn_manager_approve").style.display = "none";
}
if(row.changeStatus==7){
document.getElementById("btn_check").style.display = "";
}
else{
document.getElementById("btn_check").style.display = "none";
}
} else {
document.getElementById("btn_manager_approve").style.display = "none";
document.getElementById("btn_check").style.display = "none";
}
}
});
//判断 流程管理员
$.ajax({
url:'<%=request.getContextPath() %>/change/change_isMyAdmin.action',
data:{
},
dataType:'text',
method:'post',
cache:false,
async:false,
success:function(res){
var r = eval("("+res+")")
if(r==true){
if(row.changeStatus==8||row.changeStatus==12){
document.getElementById("btn_close").style.display = "";
}
else{
document.getElementById("btn_close").style.display = "none";
}
if(row.changeStatus==3){
document.getElementById("btn_authorize").style.display = "";
}
else{
document.getElementById("btn_authorize").style.display = "none";
}
} else {
document.getElementById("btn_authorize").style.display = "none";
document.getElementById("btn_close").style.display = "none";
}
}
});
$.ajax({
url: '<%=request.getContextPath() %>/change/change_isMyKLeader.action',
data: {
'theCurrentPageMenuCode': menuCode,
'changeInfoVO.id': row.id
},
dataType: 'text',
method: 'post',
cache: false,
async:false,
success: function (res) {
var r = eval('(' + res + ')');
if (r==true) {
if(row.changeStatus==4){
document.getElementById("btn_examine_k").style.display = "";
}
else{
document.getElementById("btn_examine_k").style.display = "none";
}
} else {
document.getElementById("btn_examine_k").style.display = "none";
}
}
});
$.ajax({
url: '<%=request.getContextPath() %>/change/change_isMyCLeader.action',
data: {
'theCurrentPageMenuCode': menuCode,
'changeInfoVO.id': row.id
},
dataType: 'text',
method: 'post',
cache: false,
async:false,
success: function (res) {
var r = eval('(' + res + ')');
if (r==true) {
if(row.changeStatus==5){
document.getElementById("btn_examine_c").style.display = "";
}
else{
document.getElementById("btn_examine_c").style.display = "none";
}
} else {
document.getElementById("btn_examine_c").style.display = "none";
}
}
});
$.ajax({
url:'<%=request.getContextPath() %>/change/change_isMyDeploy.action',
data:{
},
dataType:'text',
method:'post',
cache:false,
async:false,
success:function(res){
var r = eval("("+res+")")
if (r==true) {
if(row.changeStatus==6){
document.getElementById("btn_deploy").style.display = "";
document.getElementById("btn_deploy_cancel").style.display="";
}
else{
document.getElementById("btn_deploy").style.display = "none";
document.getElementById("btn_deploy_cancel").style.display="none";
}
} else {
document.getElementById("btn_deploy").style.display = "none";
document.getElementById("btn_deploy_cancel").style.display="none";
}
}
});
}
});
var sel = $('#changeDatagrid').datagrid('getSelected');
$('#changeDatagrid').datagrid('reload',{
'changeQueryVO.infoCode':qInfoCode,
'changeQueryVO.declareNo':queryDeclareNo,
'changeQueryVO.changeObject':queryChangeObject,
'changeQueryVO.dStartTimeStr':queryChangeDStartTimeStr,
'changeQueryVO.dEndTimeStr':queryChangeDEndTimeStr,
'changeQueryVO.changeType':queryChangeType,
'changeQueryVO.changeResult':queryChangeResult,
'changeQueryVO.mainChange':queryMainChange,
'changeQueryVO.subChange':querySubChange,
'changeQueryVO.changeStatus':queryChangeStatus,
'changeQueryVO.deployResult':queryDeployResult,
'changeQueryVO.deployCloseStartTimeStr':queryDeployCloseStartTime,
'changeQueryVO.deployCloseEndTimeStr':queryDeployCloseEndTime,
'changeQueryVO.changeCloseStartTimeStr':queryChangeCloseStartTime,
'changeQueryVO.changeCloseEndTimeStr':queryChangeCloseEndTime,
'changeQueryVO.changeCheckResult':queryChangeCheckResult,
'changeQueryVO.remindType':queryRemindType,
'menuCode' : menuCode//当前页面的菜单代码
}).datagrid('unselectAll');
$('#changeDatagrid').datagrid('reload');
var detailRow = $('#changeDatagrid').datagrid('getRows')[index];
<table id="changeDatagrid" data-options="idField : 'id',
rownumbers : true,
fitColumns : true,
fit : true,
nowrap : true,
multiSort : true,
border : true,
striped : true,
bodyCls:'sideBorder'">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'id',hidden:true"/>
<th data-options="field:'infoCode',width:70,align:'center'">变更单编号</th>
<th data-options="field:'changeObject',width:50,align:'center',formatter:changeObjectDetail">变更对象</th>
<th data-options="field:'changeType',width:50,align:'center'">变更类型</th>
<!-- <th data-options="field:'mainChange',width:70,align:'center'">变更分类</th>
<th data-options="field:'subChange',width:50,align:'center'">变更子类</th> -->
<th data-options="field:'deployResult',width:50,align:'center',formatter:resultFormatter">发布结果</th>
<th data-options="field:'checkResult',width:50,align:'center',formatter:resultFormatter">变更结果</th>
<th data-options="field:'deployCloseTimeStr',width:60,align:'center'">发布关闭时间</th>
<th data-options="field:'expectTimeStr',width:60,align:'center'">期望完成时间</th>
<th data-options="field:'changeStatus',width:50,align:'center',formatter:statusFormatter">变更单状态</th>
<th data-options="field:'detail',width:30,align:'center',formatter:changeDetail">详细</th>
</tr>
</thead>
</table>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。