给select框加上onchange事件,数据以json返回,异步刷新和js分页


页面展示代码

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="cn.net.sinodata.business.operate.dict.service.Dict" %>
<%@page import="cn.net.sinodata.business.operate.dict.po.Dictionary" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List<Dictionary> list=Dict.getDictByParId("7050000");
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <title>任务中心详情</title>
     <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.js"></script>
<script src="<%=path%>/js/datepicker/WdatePicker.js"></script> 
<script src="<%=path%>/js/tools.js"></script>
<link href="<%=path%>/css/workflow/style2.css" type="text/css" rel="stylesheet">
<style type="text/css">
td{
font-family:"宋体", Arial,Verdana, sans-serif, Helvetica;
font-size:12px;
 


}
.text2 {
   border: 1px solid #799AE1;
   height: 27px;
   width: 71%;
}
</style>
<script type="text/javascript">
function rollback(){
document.detail.action="<%=path%>/center/flowCenterAction/flowCenterAction!flowCenterMain.action"; 
document.detail.submit();
}
</script>
<script type="text/javascript">
/*翻页查询*/
// var pagecode = 5;//第几页
function prepage(){
var flowid = $("#flowid").val();
var tasktype = $("#tasktype").val();

var pagecode = $("#pagecode").val();
if(pagecode > 1){
pagecode--;
}
$("#pagecode").val(pagecode);
_showtasks(flowid,tasktype);
}
function nextpage(){
var flowid = $("#flowid").val();
var tasktype = $("#tasktype").val();

var pagecode = $("#pagecode").val();
var totalpage = $("#totalpage").val();

//if(pagecode < totalpage){
pagecode++;
//}
$("#pagecode").val(pagecode);
_showtasks(flowid,tasktype);
}
function turnNew(totalPage){
var temp = "^[0-9]*[1-9][0-9]*$";
var page = $("#turn").val();
if(!page.match(temp)){
alert('页码不合法');
$("#turn").select();
return;
}
var flowid = $("#flowid").val();
var tasktype = $("#tasktype").val();

if(page>=totalPage){
page = totalPage;
}
$("#pagecode").val(page);
_showtasks(flowid,tasktype);
}
</script>
<script type="text/javascript">
function isNumber(obj,value,name){
 
if(isNaN(value)){
   alert(name+"必须为数字!");
   obj.select();
   return false;
 }else{return true;}
}
function isNum(obj,value,name){
if(isNaN(value)){
   alert(name+"必须为数字!");
   obj.select();
   return false;
 }else{return true;}
}
 function checkRadio(){
var flag = false;
for(var i=0;i<document.getElementsByName("_taskid").length;i++){
if(document.getElementsByName("_taskid")[i].checked){
flag = true;
}
}
return flag;
}
</script>
<script type="text/javascript">
function _showtasks(flowid,tasktype){
$("#flowid").val(flowid);
$("#tasktype").val(tasktype);
var flag = isNum($("#sheetid"),$("#sheetid").val(),"工单编号");
if(flag){
document.detail.action="<%=path%>/center/flowCenterAction!reptasktype_param.action"; 
document.detail.submit(); 
}
}
function showtasks(flowid,tasktype){
$("#flowid").val(flowid);
$("#tasktype").val(tasktype);
$("#pagecode").val("1");
var flag = isNumber($("#sheetid"),$("#sheetid").val(),"工单编号");
if(flag){
document.detail.action="<%=path%>/center/flowCenterAction!reptasktype_param.action"; 
document.detail.submit(); 
}
}
function choosetask(){
if(!checkRadio()){
alert("请选择一条记录!");
return;
}
var temp = $('input:radio:checked').val();
$("#taskid").val(temp);
var type = $("input[name='"+temp+"']").val();
$("#sheet_type").val(type);
document.detail.action="<%=path%>/center/flowCenterAction!chooseTask.action"; 
document.detail.submit();
}
//重新发起工单
function startSheetidFun(sheetid,sheetType){
$("#startSheetid").val(sheetid);
$("#startSheetType").val(sheetType);
}
function startAgain(){
if(!checkRadio()){
alert("请选择一条记录!");
return;
}
var startSheetid = $("#startSheetid").val();
var startSheetType = $("#startSheetType").val();
document.detail.action="<%=path%>/center/flowCenterAction!startAgain.action?startSheetid="+startSheetid+"&startSheetType="+startSheetType; 
document.detail.submit();

}

//红色代表onchange事件

$(document).ready(function(){ 
var flowid1 =$("#flowid1").val();
var tasktype=$("#tasktype").val()
$("#flowid").val(flowid1);
$('#emcode').change(function(){ 
document.getElementById("sheetid").disabled=true;
document.getElementById("serch").disabled=true;   
var emcode=$("#emcode option:selected").val();//这就是selected的值  
 var savestatu=$("#savestatu option:selected").val();//获取本页面其他标签的值  
var searchorder=$("#searchorder option:selected").val();//获取本页面其他标签的值  
$.ajax({
    url:'<%=path%>/center/flowCenterAction!reptasktype.action',
       data:{'flowid':flowid1,'emcode':emcode,'savestatu':savestatu,'searchorder':searchorder,'tasktype':tasktype},
       type:'POST',
       dataType:'json',
       async:false,
       timeout:5000,
       success:function(data) {
        var html="";
       for(var i=0;i<data.length;i++){
       html =html+ "<tr width='96%' class='txlrow3'><td width='12%' class='number_font'><input type='radio' name='_taskid' value=" +
        data[i].task_id + ">"+"</td><td width='12%' class='number_font' id="+data[i].task_id+">"+ data[i].ws_id+"</td><td width='12%' class='number_font'>"+ 
        data[i].sheet_name+"<input type='hidden' value='"+data[i].sheet_type+"' name='"+data[i].task_id+"'/></td><td width='12%' class='number_font'>"+ data[i].sheet_level+"</td><td width='12%' class='number_font'>"+ 
        data[i].dispatch_time+"</td><td width='12%' class='number_font'>"+ (data[i].sheet_time_status==null?"--":data[i].sheet_time_status)+"</td><td width='12%' class='number_font'>"+ 
        data[i].step_name+"</td><td width='12%' class='number_font'>"+ (data[i].search_times==null?"--":data[i].sheet_time_status)+
      "</td></tr>";
       }
      $("#tabletask").empty();        
       $("#tabletask").html(html);
      $("#pagecode").val("1");
       }
   });
  });
$('#savestatu').change(function(){ 
document.getElementById("sheetid").disabled=true;
document.getElementById("serch").disabled=true;   
var emcode=$("#emcode option:selected").val();//这就是selected的值  
 var savestatu=$("#savestatu option:selected").val();//获取本页面其他标签的值  
var searchorder=$("#searchorder option:selected").val();//获取本页面其他标签的值  
$.ajax({
    url:'<%=path%>/center/flowCenterAction!reptasktype.action',
       data:{'flowid':flowid1,'emcode':emcode,'savestatu':savestatu,'searchorder':searchorder,'tasktype':tasktype},
       type:'POST',
       dataType:'json',
       async:false,
       timeout:5000,
       success:function(data) {
        var html="";
       for(var i=0;i<data.length;i++){
       html =html+ "<tr width='96%' class='txlrow3'><td width='12%' class='number_font'><input type='radio' name='_taskid' value=" +
        data[i].task_id + ">"+"</td><td width='12%' class='number_font' id="+data[i].task_id+">"+ data[i].ws_id+"</td><td width='12%' class='number_font'>"+ 
        data[i].sheet_name+"<input type='hidden' value='"+data[i].sheet_type+"' name='"+data[i].task_id+"'/></td><td width='12%' class='number_font'>"+ data[i].sheet_level+"</td><td width='12%' class='number_font'>"+ 
        data[i].dispatch_time+"</td><td width='12%' class='number_font'>"+ (data[i].sheet_time_status==null?"--":data[i].sheet_time_status)+"</td><td width='12%' class='number_font'>"+ 
        data[i].step_name+"</td><td width='12%' class='number_font'>"+ (data[i].search_times==null?"--":data[i].sheet_time_status)+
      "</td></tr>";
       }
      $("#tabletask").empty();        
       $("#tabletask").html(html);
      $("#pagecode").val("1");
       }
   });
  });
$('#searchorder').change(function(){
document.getElementById("sheetid").disabled=true;
document.getElementById("serch").disabled=true;   
var emcode=$("#emcode option:selected").val();//这就是selected的值  
 var savestatu=$("#savestatu option:selected").val();//获取本页面其他标签的值  
var searchorder=$("#searchorder option:selected").val();//获取本页面其他标签的值  
$.ajax({
    url:'<%=path%>/center/flowCenterAction!reptasktype.action',
    data:{'flowid':flowid1,'emcode':emcode,'savestatu':savestatu,'searchorder':searchorder,'tasktype':tasktype},
       type:'POST',
       dataType:'json',
       async:false,
       timeout:5000,
       success:function(data) {
    var html="";
       for(var i=0;i<data.length;i++){
       html =html+ "<tr width='96%' class='txlrow3'><td width='12%' class='number_font'><input type='radio' name='_taskid' value=" +
        data[i].task_id + ">"+"</td><td width='12%' class='number_font' id="+data[i].task_id+">"+ data[i].ws_id+"</td><td width='12%' class='number_font'>"+ 
        data[i].sheet_name+"<input type='hidden' value='"+data[i].sheet_type+"' name='"+data[i].task_id+"'/></td><td width='12%' class='number_font'>"+ data[i].sheet_level+"</td><td width='12%' class='number_font'>"+ 
        data[i].dispatch_time+"</td><td width='12%' class='number_font'>"+ (data[i].sheet_time_status==null?"--":data[i].sheet_time_status)+"</td><td width='12%' class='number_font'>"+ 
        data[i].step_name+"</td><td width='12%' class='number_font'>"+ (data[i].search_times==null?"--":data[i].sheet_time_status)+
      "</td></tr>";
       }
      $("#tabletask").empty();        
       $("#tabletask").html(html);
      $("#pagecode").val("1");
       }
   });
  });  
}) 

</script>
 </head> 
  
<body>
<div class="main">
<form name="detail">
<table cellpadding="2" cellspacing="1" class="tableBorder">
                <tr>
                <th colspan="6" class="title">任务中心</th>
                </tr>
                <tr class="txlrow">
                <td colspan="6">&nbsp;</td>
                </tr >
                <tr class="txlrow2">
                  <td colspan="4" width="50%">个人任务</td>
                  <td colspan="2" width="50%">队列任务列表</td>
                </tr>
                <tr class="txlrow2">
                <td width="12%">已获取任务</td>
                    <td width="13%">保存未发起任务</td>
                    <td width="13%" >转交</td>
                    <td width="12%" >催办任务</td>
                    <td width="25%" >转交队列</td>
                    <td width="25%" >普通对列</td>
                </tr>
                  <tr class="txlrow2">
               
                </tr>
<s:iterator value="reportFlowStatusMap" status="sta" id="column">
<tr class="txlrow3">
<s:if test="0==value.normal"><td>-</td></s:if>
<s:else><td class="number_font"><a href="" οnclick="showtasks('<s:property value="#column.key" />','normal');return false"><s:property value="value.normal" /></a></td></s:else>

<s:if test="0==value.unstart"><td>-</td></s:if>
<s:else><td class="number_font"><a href="" οnclick="showtasks('<s:property value="#column.key" />','unstart');return false"><s:property value="value.unstart" /></a></td></s:else>

<s:if test="0==value.normalAssign"><td>-</td></s:if>
<s:else><td class="number_font"><s:property value="value.normalAssign" /></td></s:else>

<s:if test="0==value.reminded"><td>-</td></s:if>
<s:else><td  class="number_font"><a href=""><s:property value="value.reminded" /></a></td></s:else>

<s:if test="0==value.queueAssign"><td>-</td></s:if>
<s:else><td class="number_font"><a href="" οnclick="showtasks('<s:property value="#column.key" />','queueAssign');return false"><s:property value="value.queueAssign" /></a></td></s:else>

<s:if test="0==value.queue"><td>-</td></s:if>
<s:else><td class="number_font"><a href="" οnclick="showtasks('<s:property value="#column.key" />','queue');return false"><s:property value="value.queue" /></a></td></s:else>

</tr>
<tr class="txlrow4">
             <td colspan="6"></td>
        </tr>
<input type="hidden" value="<s:property value="#column.key" />" id="flowid" name="flowid">
<input type="hidden" value="<s:property value="tasktype" />" id="tasktype" name="tasktype">
</s:iterator>
</table>

<table cellpadding="2" cellspacing="1" class="tableBorder">
<tr>
         <th colspan="12" class="title">正常普通任务列表</th>
        </tr>
<tr class="txlrow">
<td colspan="12">流程名称:<s:property value="flowid" /><input type="hidden" name="flowid1" id="flowid1" value="<s:property value="flowid" />"/></td>
</tr>
<tr bordercolor="black">
<td class="txlrow3" style="text-align: center;background-color:#dee5fa;width: 25%;" colspan="2" >
工单定位
</td>
<td nowrap="nowrap" style="text-align: center;background-color:#dee5fa;width: 25%;border-top-width:0px;border-bottom-width:0px;border-left-width:0px; border-right-width:0px;  border-color:white; border-style:solid;" colspan="3" class="txlrow3">
<input class="text2" type="text" id="sheetid" name="sheetid" width="70%" value="<s:property value="ws_id" />">&nbsp;
<input class="btn1" id="serch" type="button" style="cursor: pointer;" οnclick="showtasks('<s:property value="flowid" />','<s:property value="tasktype" />')" value="查询">
</td>
<td style="text-align: center;background-color:#dee5fa;width: 25%;border-top-width:0px;border-bottom-width:0px;border-left-width:1px; border-right-width:1px;border-color:white; border-style:solid;" colspan="2" class="txlrow3">
紧急程度
</td>
<td class="txlrow3" style="text-align: center;background-color:#dee5fa;width: 25%;border-top-width:0px;border-bottom-width:0px;border-left-width:0px; border-right-width:1px;border-color:white; border-style:solid;" colspan="3" >
 <select style="text-align: center;width:100%;" class="select1" id="emcode" name="emcode">
<option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----------请选择----------</option>
<% for(int i=0;i<list.size();i++){%>
<option value="<%=list.get(i).getDict_code() %>"><%=list.get(i).getDict_name() %></option>
<%}%>
</select></td>
<!-- <td style="background-color: #E4E8EF;width: 95px;" colspan="2">三级工单类型</td> -->
</tr>
<tr>
<td class="txlrow3" style="text-align: center;background-color:#dee5fa;width: 25%;" colspan="2" >
保存状态
</td>
<td class="txlrow3"  style="text-align: center;background-color:#dee5fa;width: 25%;" colspan="3" >
 <select style="text-align: center;width:100%;" class="select1" id="savestatu" name="savestatu">
<option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----------请选择----------</option>

   <option value="N">未保存</option> 
<option value="Y">已保存</option> 
</select></td>
<td class="txlrow3" style="text-align: center;background-color:#dee5fa;width: 25%;border-top-width:0px;border-bottom-width:0px;border-left-width:1px; border-right-width:1px; border-color:white; border-style:solid;" colspan="2" >
追查排序
</td>
<td class="txlrow3" style="text-align: center;background-color:#dee5fa;width: 25%;" colspan="3"  >
 <select style="text-align: center;width:100%;" class="select1" id="searchorder" name="searchorder">
<option value="" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----------请选择----------</option>
<option value="Y">升序</option>
<option value="N">降序</option>
</select></td>
</tr>
</table>
<div>
<table cellpadding="2" cellspacing="1" class="tableBorder">
<tr class="txlrow2">
<td width="12%">选择 </td>
<td width="12%">工单编号</td>
<td width="12%">工单类型</td>
<td width="12%">紧急程度</td>
<td width="12%">派单时间</td>
<td width="12%">工单状态</td> 
<td width="12%">步名称</td>
<td width="12%">追查次数</td>
</tr>
<s:if test="null == voresult || voresult.size==0 " >
<script type="text/javascript">
alert("没有查询结果");
document.detail.action="<%=path%>/center/flowCenterAction!reptask_byflow.action"; 
document.detail.submit(); 
</script>
</s:if>

</table>

 //异步更新

<table id="tabletask" cellpadding="2" cellspacing="1" class="tableBorder">
<s:iterator value="voresult" status="sta_dedail">
<tr class="txlrow3">
<td width="12%" οnclick="startSheetidFun('<s:property value="ws_id" />','<s:property value="sheet_type" />');"><input type="radio" name="_taskid" value="<s:property value="task_id" />">
</td>
<td width="12%" class="number_font" id="<s:property value="task_id" />"><s:property  value="ws_id" /></td>
<td  width="12%" class="number_font">
              <s:property  value='sheet_name' />
<input type="hidden" value="<s:property value="sheet_type" />" name="<s:property value="task_id" />">
</td>
<td width="12%" class="number_font"><s:property value="sheet_level" /></td>
<td width="12%" class="number_font"><s:property value="dispatch_time" /></td>
<td width="12%" class="number_font"><s:property value="sheet_time_status" /></td>
<td width="12%" class="number_font"><s:property value="step_name" /></td>
<td width="12%" class="number_font"><s:property value="search_times" /></td>
</tr>
</s:iterator>
</table>

</div>
<div style="margin-top:-1px;">
        <table cellpadding="2" cellspacing="1" class="tableBorder">
<tr class="txlrow3">
<td colspan="5">
<s:if test="pagecode==1">
<span>上一页</span>
</s:if>
<s:else>
<span style="cursor:pointer;text-decoration:underline" οnclick="prepage()">上一页</span>
</s:else>

   <input id="turn" name="turn" style="width:40px;" type="text" ><span style="cursor:pointer;text-decoration:underline" οnclick="turnNew(<s:property value="totalpage" />)">跳转</span>
   
   <s:if test="pagecode >= totalpage">
   <span>下一页</span>
   </s:if>
<s:else>
<span style="cursor:pointer;text-decoration:underline" οnclick="nextpage()">下一页</span>
</s:else>
<input type="hidden" name="pagecode" id="pagecode" value="<s:property value="pagecode" />"> 
</td>
<td colspan="7">
<span class="span"><a>共<s:property value="totalpage" />页</a></span>&nbsp;<span class="span"><a>当前第<s:property value="pagecode" />页</a></span>&nbsp;<span class="span"><a>合计<s:property value="count" />条</a></span>
</td>
</tr>
<tr class="txlrow3">
<td colspan="12">
<span class="span"><input type="button" οnclick="rollback()" value="返回"  class="btn_do"></span>
<s:if test="tasktype=='queue' || tasktype=='queueAssign' || tasktype == 'ALL_TASK'">
<input type="button" value="选取" οnclick="choosetask();" class="btn_do">
</s:if>
<s:elseif test="tasktype=='unstart'">
<input type="button" value="选择发起" οnclick="startAgain();" class="btn_do">
</s:elseif>
<s:else>
<input type="button" value="快速启动" οnclick="choosetask();" class="btn_do">
</s:else>
<input type="hidden" name="taskid" id="taskid" value="">
<input type="hidden" name="sheet_type" id="sheet_type" value="">
<input type="hidden" id="startSheetid" name="startSheetid" value="">
<input type="hidden" id="startSheetType" name="startSheetType" value="">
</td>
</tr>
<tr class="txlrow4">
         <td colspan="12"></td>
         </tr>
</table>
</div>
</form>
</div>  
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值