<div class="ne-div-query horizon-list" id="bizDocumentUserChoose_admin_query"> <input type="hidden" id="groupId" name="groupId" value="{{groupId}}"/> <input type="hidden" id="taskUuid" name="taskUuid"/> <input type="hidden" id="taskName" name="taskName"/> <input type="hidden" id="mainUuid" name="mainUuid"> <input type="hidden" id="mainUserId" name="mainUserId"> <input type="hidden" id="payUuid" name="payUuid"> <textarea style="display:none" class="txt" id="taskUuidArray"name="txt" ></textarea> <textarea style="display:none" class="txt" id="taskNameArray"name="txt" ></textarea> <textarea style="display:none" class="txt" id="payUuidArray"name="txt" ></textarea> <div class="am-input-group am-input-group-lg"> <span class="am-input-group-label">姓名</span><input type="text" name="userName" class="am-form-field" placeholder="请输入姓名" id="userName" maxlength="255"/> </div> <div class="am-input-group am-input-group-lg"> <span class="am-input-group-label">审核层级</span> <select name="approveRate" id="approveRate" data-am-selected> </select> </div> <div class="am-input-group am-input-group-lg"> <span class="am-input-group-label">任务类型</span> <select name="taskId" id="taskId" data-am-selected multiple > <!-- <option value="">--请选择--</option> --> </select> </div> <button type="button" class="am-btn am-btn-primary" id="searchBtn"> 查询</button> </div> <div id="bizDocumentUserChoose_admin_wrapper" class="dataTables_wrapper am-datatable am-form-inline dt-amazeui"> <div class="am-g"> <div id="bizDocumentUserChoose_admin_div" class="am-u-sm-12 am-scrollable-horizontal"> <table class="am-table am-table-striped am-table-bordered am-table-compact dataTable" id="bizDocumentUserChoose_admin_dt" role="grid" aria-describedby="bodyFinancialManageHistory_admin_info"> <thead> <tr class="am-text-nowrap" role="row"> <th class="" tabindex="0" style="text-align: center;" aria-controls="bizDocumentAddMemberEdit_dt" rowspan="1" colspan="1" aria-label="全选: 以升序排列此列"> <input type="checkbox" name="SelectAll" id="SelectAll" />全选</th> <th class="" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="姓名">姓名</th> <th class="" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="账号">账号</th> <th class="" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="在线状态">在线状态</th> <th class="sorting" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="待审总数">待审总数</th> <th class="sorting" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="待审急单">待审急单</th> <th class="" style="text-align: center;" tabindex="0" aria-controls="bizDocumentUserChoose_admin_dt" rowspan="1" colspan="1" aria-label="审核层级">审核层级</th> </tr> </thead> </table> </div> <div class="am-cf am-padding"> <button type="button" class="am-btn am-btn-primary" id="comfirDistrbute">确认分配</button> </div> </div> </div> <script type="text/javascript"> //每个模块都应该提供一个init方法用来进行事件注册什么的 function bizDocumentUserChoose() { }// 定义一个类(函数) // 为该类(函数)添加一个静态方法extend bizDocumentUserChoose.extend = function(obj) { for ( var a in obj) this[a] = obj[a];// 注意:这里的this即bizDocumentUserChoose } bizDocumentUserChoose.dt = null; bizDocumentUserChoose.comfirBtnName = "关闭"; // 调用extend为该类添加静态方法init bizDocumentUserChoose .extend({ init : function(initData) { // 获取上个窗口的传过来的值 var count=initData.count var mainUuid=initData.mainUuid; var mainUserId=initData.mainUserId; if ("1" === count) { var taskUuid=initData.taskUuid; var taskName=initData.taskName; //获取付款确认书的uuid var payUuid=initData.payUuid; // 并设置对应的value 值 $("#bizDocumentUserChoose_admin_query").find("#taskUuid").val(taskUuid); $("#bizDocumentUserChoose_admin_query").find("#taskName").val(taskName); $("#bizDocumentUserChoose_admin_query").find("#mainUuid").val(mainUuid); $("#bizDocumentUserChoose_admin_query").find("#mainUserId").val(mainUserId); // 设置付款确认书的uuid的value 值 $("#bizDocumentUserChoose_admin_query").find("#payUuid").val(payUuid); } else { //获取批量分配传过来的相关参数 var taskManyArray= initData.taskManyArray ; taskManyArray = JSON.parse(taskManyArray); var taskUuidArray = "" var taskNameArray = "" var payUuidArray = "" for (var i=0 ;i<taskManyArray.length;i++ ){ taskUuidArray += (isNotBlank(taskUuidArray)? ",":"") + taskManyArray[i].taskUuidArray taskNameArray += (isNotBlank(taskNameArray)? ",":"") + taskManyArray[i].taskNameArray payUuidArray += (isNotBlank(payUuidArray)? ",":"") + taskManyArray[i].payUuidArray $("#bizDocumentUserChoose_admin_query").find("#taskUuidArray").val(taskUuidArray); $("#bizDocumentUserChoose_admin_query").find("#taskNameArray").val(taskNameArray); $("#bizDocumentUserChoose_admin_query").find("#payUuidArray").val(payUuidArray); } } //加载下拉列表 ajax_jsonp("/app/bl/documenttaskdeploy/getapproverate/", null, function(response) { if (!checkResponseData(response)){ return; } //审核层级 addOption($('#bizDocumentUserChoose_admin_query').find("#approveRate"),"--请选择层级--",""); $.each(response.data[0], function(index, obj) { addOption($('#bizDocumentUserChoose_admin_query').find("#approveRate"),obj.levelName,obj.uuid); }); }, null, "GET"); //单证人员信息列表 var column = autoBuildDtColumns(["userUuid","userName","userId","onlineState","yilingqustatus","paypriority","levelName"]); var dtConfigs = { "columns" : column, "ordering" : true, "columnDefs" : [ { "targets" : [ 0 ], "orderable" : false, "render" : function(data, type, full) { return "<input type='checkbox' id='passFlag' name='passFlag' class='dt-input-element dt-select-click' " + " data-option='def:0,choosed:1'/>"; }}, { "targets" : [ 3 ], "orderable" : false, "render" : function(data, type, full) { if(full.onlineState == "1"){ return "<span>在线</span>"; }else{ return "<span style='color:red'>离线</span>"; } }}, ] }; //dataTable 绑定 bizDocumentUserChoose.dt = dtInit( "#bizDocumentUserChoose_admin_dt", "/app/bl/documenttaskdeploy/getuserlist/", null, dtConfigs,true,bizDocumentUserChoose.getQueryPara); // 初始化下拉列表 bizDocumentUserChoose.initSelect(); //注册查询按钮点击事件 $('#bizDocumentUserChoose_admin_query').find('#searchBtn').on('click',function(){ var userName=$('#bizDocumentUserChoose_admin_query').find('#userName').val(); var approveRate=$('#bizDocumentUserChoose_admin_query').find('#approveRate').val(); var taskId=$('#bizDocumentUserChoose_admin_query').find('#taskId').val(); bizDocumentUserChoose.dt.draw(); }); //注册【确认分配】按钮事件 $('#bizDocumentUserChoose_admin_wrapper').on( 'click', '#comfirDistrbute', function() { var selectedData = getDtRowInfo(bizDocumentUserChoose.dt, 0); // 当前选中的值 数据库的值 var documentUsers = new Array(); if (!isNotNull(selectedData) || selectedData.length <= 0) { getAlertInfo("ME477I003"); // alert("请选择你要勾选的单证人员") return; } if (!isNotNull(selectedData) || selectedData.length > 1) { getAlertInfo("ME477I006"); // alert("对不起,只能勾选一个单证人员") return; } $.each(selectedData, function (index, data) { var taskUuid= $("#bizDocumentUserChoose_admin_query").find("#taskUuid").val(); // 主界面的userID var mainUserId= $("#bizDocumentUserChoose_admin_query").find("#mainUserId").val(); // 获取付款确认书的uuid var payUuid= $("#bizDocumentUserChoose_admin_query").find("#payUuid").val(); var temp = { "userUuid": data.data.userUuid, "uuid": data.data.uuid, "userName" : data.data.userName, // 用戶名 "taskUuid": taskUuid , // 任務的uuid "taskId": data.data.taskId , "userId":data.data.userId , "mainUserId": mainUserId , "payUuid":payUuid } documentUsers.push(temp); }); ajax_jsonp("/app/bl/documenttaskdeploy/comfirdistribute/", { "documentUsers": JSON.stringify(documentUsers) }, function (response) { if (!checkResponseData(response)) { //alertMsg("分配失败!") getAlertInfo("ME477I005"); } else { if (response.data[0] == true) { // alertMsg("分配成功!") getAlertInfo("ME477I004"); bizDocumentUserChoose.dt.draw(); return } else { // alertMsg("分配失败!") getAlertInfo("ME477I005"); } } }, null, "POST"); });//注册【确认分配】按钮事件结束 //注册全选按钮点击事件 /* $('#bizDocumentUserChoose_admin_dt').find("#SelectAll").attr("checked", false); $('#bizDocumentUserChoose_admin_dt').find("#SelectAll").click(function(){ var checkFlags = $('#bizDocumentUserChoose_admin_dt').find('input[name=passFlag]'); if (this.checked) { for(var i = 0; i < checkFlags.length; i++){ checkFlags[i].checked = true; } }else{ for(var i = 0; i < checkFlags.length; i++){ checkFlags[i].checked = false; } } }); */ $("#bizDocumentUserChoose_admin_dt").on('draw.dt',function(){ // 初始化时勾选SelectAll,存在未勾选的checkbox,则取消勾选SelectAll var backManageSelectAllbox = $("#bizDocumentUserChoose_admin_dt").find("input[name=SelectAll]"); backManageSelectAllbox.attr("checked", true); $("#bizDocumentUserChoose_admin_dt tr:gt(0)").each(function(){ backManageSelectAllbox[0].checked = false; return false; }); //注册checkbox点击事件 $("#bizDocumentUserChoose_admin_dt").find(":checkbox").change(function() { // 设置全选 $("#bizDocumentUserChoose_admin_dt").find("input[name=SelectAll]")[0].checked = true; // 遍历表格,当存在未勾选的checkbox,取消勾选全选 $("#bizDocumentUserChoose_admin_dt tr:gt(0)").each(function(){ if($(this).find("#passFlag").length == 1){ var checkTest = $(this).find("#passFlag")[0].checked; // 若存在 if(checkTest == false){ backManageSelectAllbox[0].checked = false; return false; } } }); }); }); }, // 查询输入框里面的 任务类型的查询 加载下拉列表 initSelect : function() { //加载下拉列表 ajax_jsonp("/app/bl/documenttaskdeploy/initselect/", null, function(response) { if (!checkResponseData(response)){ return; } //任务类型 var taskUuid= $("#bizDocumentUserChoose_admin_query").find('#taskUuid').val(); if (!isNotBlank(taskUuid)){ taskUuid= $("#bizDocumentUserChoose_admin_query").find('#taskUuidArray').val(); } $.each(response.data[0], function(index, obj) { var taskId=$('#bizDocumentUserChoose_admin_query').find("#taskId").val(taskUuid) if (!isNotBlank(taskId)) { taskId=$('#bizDocumentUserChoose_admin_query').find("#taskUuidArray").val(taskUuid) } addOption($('#bizDocumentUserChoose_admin_query').find("#taskId"),obj.taskName,obj.fuuid); }); var taskUuids=taskUuid.split(",") // 字符窜数组去重 var len = taskUuids.length; taskUuids.sort(); for(var i1=len-1;i1>0;i1--){ if(taskUuids[i1]==taskUuids[i1-1]){ taskUuids.splice(i1,1); } } for (var i=0 ; i<taskUuids.length;i++){ $("#bizDocumentUserChoose_admin_query").find("#taskId").find("option[value='"+taskUuids[i]+"']").attr("selected",true); } }, null, "GET"); }, // initSelect end //获取查询条件的值 getQueryPara : function() { //获取查询条件参数值 var adminQueryDiv = $("#bizDocumentUserChoose_admin_query"); return { "userName" : $.trim(adminQueryDiv.find("#userName").val()), "approveRate":adminQueryDiv.find('#approveRate').val(), "taskId":getAmazeSelect(adminQueryDiv.find('#taskId')), "taskUuid":adminQueryDiv.find('#taskUuid').val(), "taskName":adminQueryDiv.find('#taskName').val(), "mainUuid":adminQueryDiv.find('#mainUuid').val() // "mainUserId":adminQueryDiv.find('#mainUserId').val() } }//getQueryPara() END }); </script>