<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%> <%@ include file="/common/taglibs.jsp"%> <!-- 自扩展的 --> <script type="text/javascript" src="<c:url value='/plugin/jqgrid40/common.jqgrid.js'/>"></script> <link rel="stylesheet" type="text/css" href="<c:url value='/plugin/jqgrid40/css/redmond/jquery-ui-1.8.2-for-jqgrid.custom.css'/>" /> <script language="javascript" type="text/javascript" src="<c:url value='/plugin/jqueryui/ui/jquery.ui.datepicker.js'/>"></script> <script language="javascript" type="text/javascript" src="<c:url value='/plugin/jqueryui/ui/i18n/jquery.ui.datepicker-zh-CN.js'/>"></script> <script type="text/javascript" charset="UTF-8"> var pageGrid ; $(document).ready(function(){ $("#searchCreateTimeStart").datepicker($.datepicker.regional[ "zh-CN" ]); $("#searchCreateTimeEnd").datepicker($.datepicker.regional[ "zh-CN" ]); var searchUrl = "<c:url value='/testcase/testProgramListSearch.action'/>"; var deleteUrl = "<c:url value='/testcase/testProgramDelete.action'/>" var detailUrl = "<c:url value='/testcase/testProgramDetailShow.action'/>"; var processUrl = "<c:url value='/bpmcommon/processDispatch.action' />"; var processDefinitionName = "${processDefinitionName}"; var pageGrid = { gridName:"testProgramListGrid", formName:"testProgramListForm", caption:"测试用例分派列表", pagerVar:"testProgramListPager", searchUrl : searchUrl, searchParameters:['searchTestObjectId','searchTestObjectName','searchCreateTimeStart','searchCreateTimeEnd','searchState','searchTestProgramName'], //multiselect : false, colNames:['ID','测试方案名称','需求单号','需求名称','编写时间', '测试方案状态','操作' ], colModel:[ {name : 'id',index : 'id',width : '10%',hidden:true}, {name : 'testProgramName',index : 'testProgramName',width : '13%'}, {name : 'testObjectId',index : 'testObjectId',width : '13%'}, {name : 'testObjectName',index : 'testObjectName',width : '13%'}, {name : 'createTime',index : 'createTime',width : '9%',formatter:'date',formatoptions:{srcformat: 'Y-m-d',newformat:"Y-m-d H:i"}}, {name : 'state',index : 'state',width : '7%'}, {name : 'operation',index:'operation',width:'9%', search:false,sortable:false,editable:false} ], //排序字段名称 sortName:"createTime", //排序类型 sortOrder:"desc", //作为行标识的ID rowId:"id", pageCache:"${pageCache}" }; //gridComplete调用的方法,每行完成后往operation列插入button $.rowComplete = function (rowId) { var rowData = $.jqgridGetRowData(pageGrid.gridName,rowId); var testProgramId = rowData.id; //var urlDetail = $.commonBuildUrl(detailUrl,"testProgramId=" + testProgramId); var urlDetail = detailUrl + "?testProgramId=" + testProgramId; urlDetail += "&showTestCaseNavigation=true"; urlDetail += "&hideBackButton=true"; //得到状态 var state = rowData.state; //声明operationHtml var operationHtml = ""; if(state == "${draftState}"){ operationHtml += "<input type='button' name='editBtn' value='编辑' onclick='$.editTestProgram(\"" + rowId + "\")'>"; operationHtml += "<input type='button' name='deleteBtn' value='删除' onclick='$.singleDeleteButtonClick(\"" + rowId + "\")'>"; } operationHtml += "<input type='button' value='查看' onclick='$.commonSubmitForm(\"" + pageGrid.formName + "\",\"" + urlDetail + "\")'/>"; $.jqgridSetRowData(pageGrid.gridName,rowId,{operation:operationHtml}); }; // 构建表格 $.jqgridBuildPageGrid(pageGrid); //删除 $.singleDeleteButtonClick = function (rowId) { $.jqgridSingleDeleteButtonClick(pageGrid.gridName,pageGrid.searchParameters,deleteUrl,rowId); //$.jqgridSingleDeleteButtonClick2(pageGrid.gridName,pageGrid.searchParameters,deleteUrl,rowId,"是否确定删除所选考","删除成功"); } //编辑 $.editTestProgram = function (rowId) { $.enterProcess(processUrl +"?processDefinitionName=" + processDefinitionName + "&businessId=" + rowId); } //新增 $("#createBtn").click(function(){ $.enterProcess(processUrl +"?processDefinitionName=" + processDefinitionName); }); //重置 $("#resetBtn").click(function(){ $("#searchTestObjectId").val(""); $("#searchTestObjectName").val(""); $("#searchCreateTimeStart").val(""); $("#searchCreateTimeEnd").val(""); $("#searchState").val(""); $("#searchTestProgramName").val(""); }); //查询 $("#searchBtn").click(function() { var startTime = $("#searchCreateTimeStart").val(); var endTime = $("#searchCreateTimeEnd").val(); if (startTime != "" && endTime != "") { if (startTime > endTime) { $.alert("开始时间不能晚于结束时间"); } } $.jqgridSearchButtonClick(pageGrid.gridName,pageGrid.searchParameters,searchUrl); }); }); </script> <form id="testProgramListForm" name="testProgramListForm" action="testProgramList.action" method="post"> <!-- 导航栏 --> <div class="span-24 last"> <nav:navigation name="测试方案列表" parameter="pageCache=true"/> </div> <div class="span-24 last"> <fieldset> <legend>查询条件</legend> <table> <tr> <td style="text-align:right;">测试方案名称:</td> <td> <s:textfield id="searchTestProgramName" name="searchTestProgramName" style="width:225px;"></s:textfield> </td> <td style="text-align:right;">测试方案状态:</td> <td> <s:select list="stateOptions" id="searchState" name="searchState" listKey="key" listValue="value" headerKey="" headerValue="全部" style="width:229px;"></s:select> </td> </tr> <tr> <td width="85px;" style="text-align:right;">需求单号:</td> <td> <s:textfield id="searchTestObjectId" name="searchTestObjectId" style="width:225px;"></s:textfield> </td> <td width="85px;" style="text-align:right;">需求名称:</td> <td> <s:textfield id="searchTestObjectName" name="searchTestObjectName" style="width:225px;"></s:textfield> </td> </tr> <tr> <td style="text-align:right;">创建时间:</td> <td> <s:textfield id="searchCreateTimeStart" name="searchCreateTimeStart" style="width:100px;" readOnly="true"></s:textfield> 至 <s:textfield id="searchCreateTimeEnd" name="searchCreateTimeEnd" style="width:100px;" readOnly="true"></s:textfield> </td> </tr> </table> </fieldset> </div> <div class="span-24 last"> <fieldset> <input type="button" value="查询" id="searchBtn"/> <input type="button" value="重置" id="resetBtn"/> <input type="button" value="新增" id="createBtn"/> </fieldset> </div> <!-- 列表栏 --> <div class="span-24 last"> <table id="testProgramListGrid"></table> <div id="testProgramListPager"></div> <div id="tblMasterMessage"></div> </div> </form>