var fields = []; var checkedProjectList = []; function setLayuiData(_data, type, version) { //高度最大化 var layuiTableCol = [[ //标题栏 { field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "37" } , { field: 'BJQX', event: "event2", unresize: false, width: "3%" } , { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" } , { field: 'PROJECTCODE', title: '项目编号', width: "8%", event: "eventProjectcode" } , { field: 'PROJECTNAME', title: '项目名称', width: "8%", event: "eventProjectname" } , { field: 'FLOWNAME', title: '业务类型', width: "12%", event: "eventflowname" } , { field: 'BINDINGUNIT', title: '发起部门', width: "10%", event: "eventBindingunit" } , { field: 'REGISTERTIME', title: '上报时间', width: "8%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME.split(" ")[0] } } ]]; if (orign == 'ghsc') { // 规划审查 已办项目 表头设置 // "<th width=\"5%\"><div class=\"tableCell\">状态</div></th> " + // "<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" + // "<th width=\"8%\"><div class=\"tableCell\">规划类型</div></th>" + // -- // "<th width=\"30%\"><div class=\"tableCell\">项目名称</div></th>" + // "<th width=\"10%\"><div class=\"tableCell\">行政辖区</div></th>" + //"<th width=\"12%\"><div class=\"tableCell\">业务类型</div></th>" + // "<th width=\"10%\"><div class=\"tableCell\">项目版本</div></th>" + //"<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" + // "<th width=\"10%\"><div class=\"tableCell\">当前环节</div></th>" + // -- // "<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" + // -- // "<th width=\"8%\"><div class=\"tableCell\">报送日期</div></th>" + // isType; // 1 数据申请 2 成果审查 if(isType == 1) { // -- 数据申请 layuiTableCol = [[ //标题栏 { field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "31" } , { field: 'BJQX', event: "event2", unresize: false, width: "3%" } , { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" } , { field: 'PROJECTCODE', title: '项目编号', width: "10%", event: "eventProjectcode" } // 数据类型 , { field: 'FLOWNAME', title: '数据类型', width: "8%", event: "eventProjectstatus" } // -- 数据用途 暂无字段 , { field: 'YT', title: '数据用途', width: "20%", event: "eventProjectname" } // 密级 暂无字段 , { field: 'MJ', title: '密级', width: "10%", event: "eventProjectstatus" } , { field: 'ACTIVITYNAME', title: '当前环节', width: "10%", event: "eventProjectstatus" } , { field: 'BINDINGASSIGNEE', title: '申请部门', width: "8%", event: "eventInterconnect" } , { field: 'REGISTERTIME', title: '申请时间', width: "10%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : ''} } // , { field: 'FLOWNAME', title: '业务类型', width: "12%", event: "eventflowname" } ]]; // "<th width=\"1%\" class=\"checkboxCls\">" + '<input class="parent_check" type="checkbox" name="" lay-skin="primary" title="" >' + "</th>" + // "<th width=\"3%\" class=\"statusIcon\"></th>" + // "<th width=\"5%\"><div class=\"tableCell\">状态</div></th> " + // "<th width=\"8%\"><div class=\"tableCell\">项目编号</div></th>" + // // "<th width=\"8%\"><div class=\"tableCell\">数据类型</div></th>" + // -- // "<th width=\"20%\"><div class=\"tableCell\">数据用途</div></th>" + // "<th width=\"10%\"><div class=\"tableCell\">密级</div></th>" + //"<th width=\"12%\"><div class=\"tableCell\">业务类型</div></th>" + // // "<th width=\"10%\"><div class=\"tableCell\">项目版本</div></th>" + //"<th width=\"8%\"><div class=\"tableCell\">发起部门</div></th>" + // "<th width=\"10%\"><div class=\"tableCell\">当前环节</div></th>" + // -- // "<th width=\"8%\"><div class=\"tableCell\">申请部门</div></th>" + // -- // "<th width=\"11%\"><div class=\"tableCell\">申请日期</div></th>" + }else { layuiTableCol = [[ //标题栏 { field: 'CHECKBOX', type: 'checkbox', title: '复选框', unresize: false, event: "eventCheckbox", width: "31" } , { field: 'BJQX', event: "event2", unresize: false, width: "3%" } , { field: 'PROJECTSTATUS', title: '状态', width: "5%", event: "eventProjectstatus" } , { field: 'PROJECTCODE', title: '项目编号', width: "10%", event: "eventProjectcode" } // 规划类型 暂无字段 , { field: 'XMLX', title: '规划类型', width: "8%", event: "eventProjectstatus" } , { field: 'PROJECTNAME', title: '项目名称', width: "20%", event: "eventProjectname" } // 行政辖区 暂无字段 , { field: 'XZQHBSM', title: '行政辖区', width: "5%", event: "eventProjectstatus" } // 项目版本 暂无字段 , { field: 'CGBBH', title: '项目版本', width: "5%", event: "eventProjectstatus" } , { field: 'ACTIVITYNAME', title: '当前环节', width: "10%", event: "eventProjectstatus" } , { field: 'SPJD', title: '审批阶段', width: "10%", event: "eventProjectstatus" } , { field: 'BINDINGASSIGNEE', title: '发起部门', width: "8%", event: "eventInterconnect" } , { field: 'REGISTERTIME', title: '报送时间', width: "10%", event: "eventRegistertime", templet: function (d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : '' } } // , { field: 'FLOWNAME', title: '业务类型', width: "12%", event: "eventflowname" } ]]; } } else if (orign == 'ywxt') { // 业务协同 策划生成 layuiTableCol = [[ //标题栏 {field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"} ,{field: 'BJQX', event:"event2",unresize:false, width:"3%"} ,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"} ,{field: 'FLOWNAME', title: '业务类型',width:"16%",event:"eventflowname"} ,{field: 'PROJECTNAME', title: '项目名称',width:"20%", event:"eventProjectname"} ,{field: 'PROJECTCODE', title: '储备编号', width:"7%", event:"eventProjectcode"} ,{field: 'PROJECTCODE', title: '项目编号', width:"10%", event:"eventProjectcode"} ,{field: 'CASECODE', title: '建设地点', width:"7%", event:"eventProjectcode"} ,{field: 'BUILDADDRESS', title: '建设单位', width:"7%",event:"eventBuildadddress"} ,{field: 'BUILDUNIT', title: '当前阶段', width:"7%", event:"eventBuildunit"} ,{field: 'ACTIVITYNAME', title: '当前环节', width:"7%", event:"eventBuildunit"} ,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) {return d.REGISTERTIME.split(" ")[0]}} ,{field: 'BINDINGASSIGNEE', title: '经办人', width:"5%", event:"eventInterconnect"} ,{field: 'BINDINGUNIT', title: '所属部门', width:"5%", event:"eventInterconnect"} ,{field: 'BINDINGASSIGNEE', title: '策划结论', event:"eventBindingunit"} ]]; } else if (orign === 'ywxt-xmcb') { // 业务协同 项目储备 layuiTableCol = [[ //标题栏 {field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"} ,{field: 'BJQX', event:"event2",unresize:false, width:"3%"} ,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"} ,{field: 'FLOWNAME', title: '业务类型',width:"15%",event:"eventflowname"} ,{field: 'PROJECTNAME', title: '项目名称',width:"20%", event:"eventProjectname"} ,{field: 'PROJECTCODE', title: '储备编号', width:"10%", event:"eventProjectcode"} ,{field: 'CASECODE', title: '建设地点', width:"7%", event:"eventProjectcode"} ,{field: 'BUILDADDRESS', title: '建设单位', width:"7%",event:"eventBuildadddress"} ,{field: 'BUILDUNIT', title: '当前阶段', width:"7%", event:"eventBuildunit"} ,{field: 'ACTIVITYNAME', title: '当前环节', width:"7%", event:"eventBuildunit"} ,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) {return d.REGISTERTIME.split(" ")[0]}} ,{field: 'BINDINGASSIGNEE', title: '经办人', width:"5%", event:"eventInterconnect"} ,{field: 'BINDINGUNIT', title: '所属部门', width:"5%", event:"eventInterconnect"} ,{field: 'BINDINGASSIGNEE', title: '是否反库', event:"eventBindingunit"} ]]; } else if (orign === 'ywxt-xmsp' || orign === 'ywxt-all') { // 业务协同 项目审批 layuiTableCol = [[ //标题栏 {field: 'CHECKBOX', type: 'checkbox', title: '复选框',unresize:false,event:"eventCheckbox", width:"25"} ,{field: 'BJQX', event:"event2",unresize:false, width:"3%"} ,{field: 'PROJECTSTATUS', title: '状态', width:"5%", event:"eventProjectstatus"} ,{field: 'PROJECTCODE', title: '项目编号', width:"10%", event:"eventProjectcode"} ,{field: 'PROJECTNAME', title: '项目名称',width:"15%", event:"eventProjectname"} ,{field: 'FLOWNAME', title: '业务类型',width:"20%",event:"eventflowname"} ,{field: 'BINDINGUNIT', title: '发起部门', width:"10%", event:"eventInterconnect"} ,{field: 'REGISTERTIME', title: '接收时间', width:"10%", event:"eventRegistertime",templet : function(d) { return d.REGISTERTIME ? d.REGISTERTIME.substring(0, 16) : ''}} ]]; } var tableTop = $("#nvaTab").offset().top-10; var bodyPadding = parseInt($("body").css("padding")); var iframeTop = window.parent.$("#iframecontent").offset() ? window.parent.$("#iframecontent").offset().top : ""; var fullHeight = iframeTop != "" ? 'full-' + parseInt(iframeTop + bodyPadding + tableTop) : "full-300"; layui.use(['table', 'element'], function () { var table = layui.table; var element = layui.element; //展示已知数据 table.render({ elem: '#dataList' , id: 'tableRenderId' , cols: layuiTableCol , data: _data , skin: 'line' //表格风格 //,even: true , limit: pageSize //每页默认显示的数量 , size: "sm" , height: fullHeight //,height: 'full-295' , done: function (res, curr, count) { setCell(res.data); } }); //获取选中行 window.getCheckStatus = function () { var checkStatus = table.checkStatus('tableRenderId'); console.log("输出选中行--------"); console.log(checkStatus); console.log("--------"); return checkStatus; } var objtr; //选中行的DOM元素 //监听单元格事件 table.on('tool(listEvent)', function (obj) { var data = obj.data; myDatatable = obj.data; //除了复选框单元格,点击其他单元格跳详情页 if (obj.event == 'eventCheckbox') { objtr = obj.tr; } else { if (data.MEETINGPROJECTSTATE != null && data.MEETINGPROJECTSTATE != "" && parent.listName != "项目查询" && parent.listName != "已办项目") { parent.layer ? parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }) : opener.parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }); return; } else { // create by zys 2020/3/16 版本号控制 start data.FLOWVERSION = version; // end openApproveDetail(data); } } }); //监听复选框事件 table.on('checkbox(listEvent)', function (obj) { //续办,日志,删除按钮状态 buttonStyle(getCheckStatus().data.length, obj.type == "all"); //选中行样式(全选) if (obj.type == "all" && obj.checked) { // checkedAllStyle(obj.checked); checkedProjectList = getCheckStatus().data; } else if (obj.type == "all" && !obj.checked) { checkedProjectList = []; } if (obj.checked && obj.type == "one") { checkedProjectList.push(obj.data); } else if (!obj.checked && obj.type == "one") { checkedProjectList.splice(checkedProjectList.indexOf(obj.data), 1); } /*//选中行样式(单选) if(objtr && obj.checked) { $(objtr[0]).addClass("layui-table-checked"); objtr = ""; }else if(objtr){ $(objtr[0]).removeClass("layui-table-checked"); objtr = ""; }*/ }); }); } function setSreachLayuiData(_data, type) { //高度最大化 var tableTop = $("#nvaTab").offset().top - 10; var bodyPadding = parseInt($("body").css("padding")); var iframeTop = window.parent.$("#iframecontent").offset() ? window.parent.$("#iframecontent").offset().top : ""; var fullHeight = iframeTop != "" ? 'full-' + parseInt(iframeTop + bodyPadding + tableTop) : "full-300"; layui.use(['table', 'element'], function () { var table = layui.table; var element = layui.element; //展示已知数据 table.render({ elem: '#dataList' , id: 'tableRenderId' , cols: [[ //标题栏 { field: 'CHECKBOX', type: 'checkbox', title: '复选框', event: "eventCheckbox", width: 40 } , { field: 'name', event: "event2", width: 30 } , { field: 'LAY_TABLE_INDEX', title: '状态', width: "4%", event: "eventProjectstatus" } , { field: 'FLOWNAME', title: '工程类型', width: "8%", event: "eventflowname" } , { field: 'PROJECTCODE', title: '项目编号', width: "9%", event: "eventProjectcode" } , { field: 'CASECODE', title: '报建编号', width: "8%", event: "eventcasecode" } , { field: 'PROJECTNAME', title: '项目名称', width: "20%", event: "eventProjectname" } , { field: 'BUILDADDRESS', title: '建设位置', event: "eventBuildadddress" } , { field: 'BUILDUNIT', title: '建设单位', width: "8%", event: "eventBuildunit" } , { field: 'CERTIFICATENUMBER', title: '证号', width: "8%", event: "eventCretificatenumber" } , { field: 'FD11', title: '选址意见书证号', width: "8%", event: "eventFd11" } , { field: 'REGISTERTIME', title: '登记时间', width: "9%", event: "eventRegistertime" } , { field: 'AGENT', title: '提交人', width: "5%", event: "eventagent" } , { field: 'AGENTOFFICE', title: '主办科室', width: "6%", event: "eventBindingunit" } ]] , data: _data , skin: 'line' //表格风格 //,even: true , limit: pageSize //每页默认显示的数量 , size: "sm" , height: fullHeight //,height: 'full-295' , done: function (res, curr, count) { setCell(res.data); console.log(table); } }); //获取选中行 window.getCheckStatus = function () { var checkStatus = table.checkStatus('tableRenderId'); return checkStatus; } var objtr; //选中行的DOM元素 //监听单元格事件 table.on('tool(listEvent)', function (obj) { var data = obj.data; //除了复选框单元格,点击其他单元格跳详情页 if (obj.event == 'eventCheckbox') { objtr = obj.tr; } else { if (data.MEETINGPROJECTSTATE != null && data.MEETINGPROJECTSTATE != "" && parent.listName != "项目查询" && parent.listName != "已办项目") { parent.layer ? parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }) : opener.parent.layer.msg("项目正在" + data.MEETINGPROJECTSTATE, { icon: 7 }); return; } else { openApproveDetail(data); } } }); //监听复选框事件 table.on('checkbox(listEvent)', function (obj) { //续办,日志,删除按钮状态 buttonStyle(getCheckStatus().data.length, obj.type == "all"); // buttonStyle(obj.data.length, obj.type == "all"); //选中行样式(全选) if (obj.type == "all") { checkedAllStyle(obj.checked); } //选中行样式(单选) if (objtr && obj.checked) { $(objtr[0]).addClass("layui-table-checked"); objtr = ""; } else if (objtr) { $(objtr[0]).removeClass("layui-table-checked"); objtr = ""; } }); }); } //layui分页控件 function layuiPage(total) { layui.use('laypage', function () { var laypage = layui.laypage; console.log("当前第几页") laypage.render({ elem: 'page' , count: total , limit: pageSize , curr: currentPage //,limits: [10, 12, 16, 20] , theme: "#337ab7" , layout: ['prev', 'page', 'next', 'skip'] // ,layout: total <= pageSize ? ['count'] : ['count', 'prev', 'page', 'next', 'skip'] , jump: function (obj, first) { console.log("++++++++Obj") console.log(obj) console.log("+++++++++first") console.log(first) currentPage = obj.curr; pageSize = obj.limit; //首次不执行 if (!first) { console.log(obj, first); // var ss = htmlTableBodyTr.concat().splice((obj.curr || 1)*10 , 10); // $('#dataList').html(ss); getApproveList(obj.curr); } } }); }); } //表头全选行样式 function checkedAllStyle(checked) { $(".layui-table-body tr").each(function () { if (checked) { $(this).addClass("layui-table-checked"); } else { $(this).removeClass("layui-table-checked"); } }) } /** * 鼠标悬停显示title * 待办项目未读加粗 */ function setCell(data) {//方法已经不用了,李lhy20181228 $(".layui-table-body tr td").each(function () { var text = $(this).first()[0].innerText.trim(); if (text == "") text = ""; $(this).attr("title", text); }) //注释lhy,已经修改到dealingproject.js文件里加粗 if (window.parent.listName == "待办项目") { $(".layui-table-body tr").each(function (index) { if (data[index].DESCRIPTION != "read") { $(this).css("font-weight", "600"); } }) } $(".layui-table-header th").each(function (index) { var field = $(this).attr("data-field"); fields.push(field); }) /* $(".laytable-cell-1-BJQX").each(function() { $(this).removeClass("laytable-cell-1-BJQX"); })*/ } /** * 根据二级菜单打开对应详情页 * @param data 列表数据 * @returns */ function openApproveDetail(data) { var type = window.parent.listName ? window.parent.listName : sreachparent(opener, "listName"); var detailType = null; if(type == "待办项目"){ detailType = 1; }else if (type == "已办项目"){ detailType = 2; } data.detailType = detailType; if (type == "项目管理") data.stats = "Manage"; else if (type == "项目查询") data.stats = "search"; else if (type == "待办项目") data.stats = "projecting"; else if (type == "已办项目") data.stats = "dealedproject"; else if (type == "补正项目") data.stats = "correctionproject"; //去掉搜索高亮标签 data.PROJECTNAME = data.PROJECTNAME.replace('<span style="color:red">', '').replace('</span>', ''); data.PROJECTNAME = data.PROJECTNAME.replace('<img src="../../image/home-content/fj.png" title="附件" style="width:18px;height:18px;margin-right: 5px;">', ''); jumpdetailPage(data); } /** * 审批列表按钮样式 * @param length * @param bol * @returns */ function buttonStyle(length, bol) { if (length == 1) { // 结束 续办 删除 日志 项目树 取回 $("#endButton, #continueProject, #deleteProject, #journal, #projectTreebtn, #recaptionButton").removeClass("disabled").removeClass("buttonStatusStyle").addClass("btn-info"); } else if (length > 1) { //复选框多选且不在全选状态 $("#journal, #continueProject, #projectTreebtn").addClass("disabled").addClass("buttonStatusStyle").removeClass("btn-info"); if (bol) { //复选框多选且全选状态 $("#deleteProject, #endButton, #recaptionButton").removeClass("disabled").removeClass("buttonStatusStyle").addClass("btn-info"); } } else { $("#endButton, #continueProject, #journal, #deleteProject, #projectTreebtn, #recaptionButton").addClass("disabled").addClass("buttonStatusStyle").removeClass("btn-info"); } } /** * 续办 * @returns */ function openlayer_continue() { var checkboxData = []; if (window.parent.listName == "待办项目") { // checkboxData = checkedProjectList; checkboxData = getCheckedProjectData(); } else { checkboxData = getCheckStatus().data; } if (checkboxData.length == 0) { parent.layer.msg("请选择项目!", { icon: 2 }); return; } if (checkboxData.length > 1) { parent.layer.msg("只能选择一个项目!", { icon: 2 }); return; } if (checkboxData.length == 1) { var projectId = checkboxData[0].PROJECTID; $.ajax({ type: "POST", url: curserver + global.modelctls.project.getProjectCasecode, headers: { "token": $.cookie('ftoken') }, data: { projectId: projectId }, dataType: 'json', success: function (data) { if (data.status == 'ok') { parent.layer.open({ type: 2, title: '审批类型', shadeClose: true, shade: 0.6, area: ['80%', '80%'], content: 'view/projecttask/selectHandl.html?createmethod=续办&projectId=' + projectId //iframe的url }); } else layer.msg(data.message, { icon: 2 }); } }); event.stopPropagation(); } } /** * 日志 * @returns */ function openJournal() { var checkboxData; if (window.parent.listName == "待办项目") { // checkboxData = checkedProjectList; checkboxData = getCheckedProjectData(); } else { checkboxData = getCheckStatus().data; } if (checkboxData.length == 0) { parent.layer.msg("请选择项目!", { icon: 2 }); } if (checkboxData.length > 1) { parent.layer.msg("只能选择一个项目!", { icon: 2 }); } if (checkboxData.length == 1) { var flowInstanceId = checkboxData[0].INSTANCEID; var url = global.contextPath + '/view/projecttask/flowlog.jsp?flowInstanceId=' + flowInstanceId; parent.layer.open({ type: 2, // page层 area: ['70%', '90%'], title: '流程日志', shadeClose: true, shade: 0.6, // 遮罩透明度 moveType: 1, // 拖拽风格,0是默认,1是传统拖动 moveOut: true, // shift: 1, //0-6的动画形式,-1不开启 content: url }); } } /** * 刷新 * @returns */ function openRefreshList() { getApproveList(1); } /** * 批量结束 * @returns */ function finishFlow() { if (!taskIds) { layer.msg('请选择需要结束的项目', { icon: 2 }); return; } if (!canFinishFlow) { layer.msg('所选择的项目包含非退件项目,无法结束', { icon: 2 }); return; } layer.open({ content: '确定结束该项目吗?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function () { var url = global.contextPath + global.modelctls.flowEngine.task.finishFlow; $.post(url, { taskIds: taskIds }, function (data) { if (data.status == 'ok') { layer.msg(data.message, { icon: 1 }); getApproveList(1); } else layer.msg(data.message, { icon: 2 }); }); } }); } /** * 结束 * @returns */ function openlayer_endtask() { var taskArray = []; var checkboxData; if (window.parent.listName == "待办项目") { // checkboxData = checkedProjectList; checkboxData = getCheckedProjectData(); } else { checkboxData = getCheckStatus().data; } for (var i = 0; i < checkboxData.length; i++) { if (checkboxData[i].PROJECTSTATUS == "退件") { taskArray.push({ taskId: checkboxData[i].TASKID, projectId: checkboxData[i].PROJECTID }); } else { parent.layer.msg("结束失败!只有状态为'退件'的案件才可以结束!", { icon: 2 }); return; } } if (checkboxData.length == 0) { parent.layer.msg("请选择项目!", { icon: 2 }); } else { parent.layer.open({ content: '确定结束选中流程吗?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function () { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.finishFlow, headers: { "token": $.cookie('ftoken') }, contentType: "application/json", data: JSON.stringify(taskArray), success: function (result) { if (result.status == 'ok') { /*action = "退件办结"; for(var i=0;i<projectids.length;i++){ projectid = projectids[i]; updateActionStatus(); } var taskListArray=[]; var taskList=result.data; for(var i=0;i<taskList.length;i++){ taskListArray.push(taskList[i].instanceId); } if(taskListArray!=null){ $.ajax({ type: "POST", url: curserver + global.modelctls.project.updateProjectTwo, headers:{ "token":$.cookie('ftoken') }, data:{ taskList : taskListArray.join() }, dataType: 'json', success:function(msg){ } }); }*/ parent.layer.msg(result.message, { icon: 1 }); setTimeout(function () { self.close(); window.location.reload(); }, 1500); //openRefreshList(); } else { parent.layer.msg(result.message, { icon: 2 }); setTimeout(function () { self.close(); window.location.reload(); }, 1500); } } }); parent.layer.closeAll(); } }); } } /** * 改变列宽,不允许溢出列表 * @param ruleWidth 原表头的宽度 * @param dragWidth 拖拽后表头的宽度 * @returns 列表宽度, 拖拽后列表行的宽度 * * 在layui的js中引用该方法 * 目前在layui.all.js的6282行中引用 */ function dragMaxWidth(dict, dragdropWidth) { var ruleWidth = dict.ruleWidth; /*var dragWidth = dragdropWidth - ruleWidth; dragWidth = dragWidth/fields.length-2; if(fields && dragWidth>0) { console.log("向右: " + dragWidth); for(var i=0; i<fields.length; i++) { if(fields[i] == dict.field) { $(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) { if($(this).width() != 0){ var width = $(this).width()+(dragdropWidth - ruleWidth); console.log(width); $(this).css("width",width+"px"); $(this).parent().css("width",width+1+"px"); } }) }else { $(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) { if($(this).width() != 0){ var width = $(this).width()-dragWidth; //console.log(width); $(this).css("width",width+"px"); $(this).parent().css("width",width+1+"px"); } }) } } } if(fields && aa>0){ console.log("向左: " + aa); for(var i=0; i<fields.length; i++) { if(fields[i] == dict.field || fields[i] == "CHECKBOX") continue; $(".laytable-cell-"+ dict.index +"-"+ fields[i]).each(function(index) { if($(this).width() != 0){ $(this).css("width",($(this).width()+aa)<60?60:($(this).width()+aa)+"px"); } }) } }*/ // 数据列表的宽度 var tableWidth = $("#nvaTab").width(); // 列表行的宽度 var trOffsetWidth = $(".layui-table-body tr:last")[0].offsetWidth; var maxWidth = trOffsetWidth - ruleWidth + dragdropWidth; return [tableWidth, maxWidth]; }