风一程

导航

移动端转派

惠州资源小灵通项目

dituTaskInfo.jsp页面

 <!--  转派  -->
  <div id="open-transferId" class="modal" tabindex="-1" role="dialog">
   <input type="hidden" id="userIds" value="" />
      <div class="modal-dialog"> 
        <div class="modal-content" >
          <div class="modal-header">
                 <button type="button"  id="close-transferId" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" style="color: green;">X</span></button>
                  <h5 class="modal-title">转派</h5>
               </div>
          <div class="modal-body" style="overflow-y:auto; overflow-x:hidden; max-height:570px;">
                  <div class="form-group">
                       <label class="sr-only">选择转派人</label>
                          <div class="input-group">
                           <input type="text" id="transferId-name" autocomplete="false" readonly="readonly" class="form-control" placeholder="选择转派人">
                               <div class="input-group-btn">
                                    <button id="transferId-search" class="btn btn-default" type="button" style="height: 34px;">
                                        <span class="glyphicon glyphicon-search"></span>
                                    </button>
                               </div>
                             </div>
                     <span class="help-block"></span>
                   </div>
                   <textarea id="apprivalContent" class="form-control" rows="8" style="width: 100%;"></textarea>
                  
                  <div class="modal-footer">                   
                   <button id="transferIdSubmit" type="button" class="btn btn-primary" >确定</button>
                  </div>
          </div>
         </div> 
     </div> 
    </div>
  
  
  
  <div id="select-transferId" class="modal" tabindex="-1" role="dialog" >
     <div class="modal-dialog" role="document" style="5px auto">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button"  id="close-select-transferId" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" style="color: green;">X</span></button>
                  <h5 class="modal-title" style="cursor:pointer;color: green;opacity: 10;">返回</h5>
               </div>
             <div class="modal-body" style="overflow-y:auto; overflow-x:hidden; max-height:350px;">                 
                 <ul class="list-group" id="dianji-transferId" >
                </ul>
                </div>
         </div>
     </div>
  </div>

main.js页面

    $('#close-transferId').click(function(){
        $('#open-transferId').hide()
    
    });
        
        
    $('#close-select-transferId').click(function(){
        $('#select-transferId').hide()
    
    });
    var ids=[];
    function searchInit(id){       
        $.ajax({
            type: 'POST',
            url: app.dituCtx + "/a/dituCollectionWorkFlowTask/getUserNodes",
            dataType: 'json',
            data: {                    
                id:id
            },
            success: function(data){
                var dataJson = eval(data);                
                $('#dianji-transferId').empty();
                $.each(dataJson,function (index , item) {    
                    
                      var contentHtml='<li class="list-group-item text-muted" style="cursor:pointer;" data-id="'+item.id+'" data-value="'+item.name+'" data-man="'+item.isMan+'" data-parent="'+item.isParent+'">';
                      contentHtml+='<div class="iradio_square-blue" style="position: relative;">';
                      contentHtml+='<input tabindex="15" type="radio" id="flat-radio-1" name="flat-radio" data-id="'+item.id+'" data-value="'+item.name+'" data-man="'+item.isMan+'" data-parent="'+item.isParent+'" data-radius="10" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;">';
                      contentHtml+='</div>&nbsp;&nbsp;';                     
                      
                      if(item.isParent){
                          contentHtml+='<img src="'+app.ctxBasePath+'/images/dituImg/icon1.png" style="width:25px;height:25px;">&nbsp;&nbsp;';
                      }else{
                          contentHtml+='<img src="'+app.ctxBasePath+'/images/dituImg/icon2.png" style="width:25px;height:25px;">&nbsp;&nbsp;';                          
                      }
                    
                      contentHtml+=''+item.name+'</li>';
                      $('#dianji-transferId').append(contentHtml);
                  
            
                });
                
                
                var id;
                $("#dianji-transferId li").unbind('click');//解绑click事件
                $("#dianji-transferId li").on('click',function(){    
                    var isParent=$(this).attr("data-parent");
                    id=$(this).attr("data-id");    
                    if(isParent=='false'){
                        new Noty({
                            type: "warning",
                            text: "不存在子节点了!",
                            layout: "topCenter",
                            timeout: 2000
                        }).show();
                        return;
                    }else{
                        searchInit(id);                
                        ids.push(id);    
                    }                
                });    
                
                //返回上一级
                $("#select-transferId h5").unbind('click');//解绑click事件
                $("#select-transferId h5").on('click',function(){
                     for(var i=0;i<ids.length;i++){
                        id=ids[i-1];                            
                    }                        
                    searchInit(id);
                    ids.pop();                        
                });
                
                //选择转派人
                $("#dianji-transferId li input").unbind('click');//解绑click事件                
                $("#dianji-transferId li input").on('click',function(e){    
                    e.stopPropagation();
                    var userIds=$(this).attr("data-id");
                    var userNames=$(this).attr("data-value");
                    var isMan=$(this).attr("data-man");
                    
                    if(isMan=='true'){    
                        $("#userIds").val(userIds);
                        $("#transferId-name").val(userNames);                        
                         $(this).iCheck({
                            radioClass: 'iradio_square-blue',
                            increaseArea: '20%' 
                         });    
                        setTimeout(function(){$("#select-transferId").hide()},100);
                        ids=[];
                    }else{                        
                        new Noty({
                            type: "warning",
                            text: "不能选择机构部门!",
                            layout: "topCenter",
                            timeout: 2000
                        }).show();
                        return;
                    }
                    
                });
                    
        
            }
      });
    }
         
    $('#transferId-search').click(function(){
        $('#dianji-transferId').empty();
        searchInit(null);        
        $('#select-transferId').show();
    }); 

ajax提交到后台

$("#open-transferId").show();
                            var taskId=$(this).attr("taskId");
                            $("#transferIdSubmit").unbind('click');//解绑click事件
                            $("#transferIdSubmit").on('click',function(){
                                $.ajax({
                                    type: 'POST',
                                    url: app.dituCtx + "/a/dituCollectionWorkFlowTaskAct/transferTask",
                                    dataType: 'json',
                                    data: {
                                        taskId:taskId,
                                        apprivalContent:$("#apprivalContent").val(),
                                        userNames:$("#transferId-name").val(),
                                        userIds:$("#userIds").val()
                                        
                                    },                    
                                 }).done(function(data){
                                         try{
                                             unLoading();
                                             if(data && data.success){
                                                 transferTask = true;
                                                 $.jBox.tip(data.message, 'success');
                                                 loadWgJzwListInfo(1,10,'3',null,null,null,null);
                                                 setTimeout(function(){$("#open-transferId").hide()},2000);
                                             }else{
                                                 var tipMsg = data.message;
                                                 if(data.resultMsg == null || data.resultMsg == '') {
                                                     tipMsg = "操作失败!";
                                                 }
                                                 $.jBox.tip(tipMsg, 'error');
                                             }
                                         }catch(err) {
                                             unLoading();
                                        }
                                     }); 
                                
                            });

 

posted on 2019-12-05 18:26  风一程  阅读(155)  评论(0编辑  收藏  举报