var FlowConfigObject = { FlowType: "", scdin_cnf: "", node_list: "", CurrNode: null, StationID: "", Init: function(contentEle, flowType) { this.FlowType = flowType; this.CurrNode = null; this.scdin_cnf = contentEle; this.node_list = this.scdin_cnf.find("#node_list"); this.scdin_cnf.find("#tree_area").height($(".main-body").height() - 80); this.node_list.height($(".main-body").height() - this.scdin_cnf.find("#opt_caption").height() - 80); Global.Ztree.Init(this.scdin_cnf.find("#tree"), { url: Global.AccessUrl + "/api/area/children/list", idKey: "id", pidKey: "pid", nameKey: "title", callback: { onClick: function(event, treeId, treeNode) { if (treeNode.id != "0") { FlowConfigObject.StationID = ParentPage.StationID = treeNode.id; FlowConfigObject.scdin_cnf.find("#opt_caption>span").html(treeNode.title); FlowConfigObject.LoadNodeInfo(treeNode.id); } else { layer.msg("请先选择变电站!") } } } }); }, LoadNodeInfo: function(stationid) { ParentPage.CurrentUserIds = {}; var nodeListEle = this.node_list; nodeListEle.html(Tools.LoadingText("正在加载签入节点信息...", "#cccccc")); $.getJSON(Global.AccessUrl + "/api/flow/cnf/getinfo", { "station_id": stationid, "flow_type": this.FlowType }, function(r) { if (r.code != 0) { nodeListEle.html(Tools.LoadingText("审核节点加载失败:" + r.msg, "red")); return; } if (r.data == null || r.data.length == 0) { nodeListEle.html(Tools.LoadingText("未定义SCD签入审核的节点!", "red")); return; } var nodes = []; for (var i = 0; i < r.data.length; i++) { var item = r.data[i]; if (item.staffs == null) item.staffs = []; nodes.push(item); } nodeListEle.html(""); var nodeLen = nodes.length; for (var i = 0; i < nodeLen; i++) { var eleId = nodes[i].flow_type + nodes[i].node_id; nodeListEle.append('
' + nodes[i].node_name + '
'); } for (var i = 0; i < nodeLen; i++) { var nodeid = nodes[i].node_id; var ele = $("#" + nodes[i].flow_type + nodes[i].node_id), next = ele.next(); var w = 0, l = 0, t = 0; var eleXY = ele.position(); if (i < (nodeLen - 1)) { w = next.position().left - eleXY.left - ele.width(); t = eleXY.top + (ele.height() / 2); l = eleXY.left + ele.width(); nodeListEle.append('
'); nodeListEle.append('
'); } //人员指示连线 l = eleXY.left + (ele.width() / 2) + 1; t = eleXY.top + ele.height() + 2; var isBindStaffCssName = ""; if ($.trim(nodes[i].staff_name)) isBindStaffCssName = "bind"; nodeListEle.append('
'); //生成人员关联按钮 nodeListEle.append('
+
'); //生成已关联的人员列表 var startttop = 70 * hRate; if (nodes[i].staffs.length > 0) { for (var s = 0; s < nodes[i].staffs.length; s++) { var staffinfo = nodes[i].staffs[s]; nodeListEle.append('
' + (staffinfo.staff_name || '') + '
'); } } } nodeListEle.find(".flow_node_person").off().on('click', function() { //打开用户选择窗口 ParentPage.CurrentUserIds = {}; if ($.trim($(this).attr("node_inst_id")) != "") return; FlowConfigObject.node_list.find(".flow_node_person[node_id='" + $(this).attr("node_id") + "'][node_inst_id]").each(function() { ParentPage.CurrentUserIds[$(this).attr("staff_id")] = 1; }); FlowConfigObject.NodeBindPerson($(this)); }); //删除指定的人员 nodeListEle.find(".fa-times").off().on('click', function(e) { var t = $(this).parent(); e.stopPropagation(); var cNodeId = t.attr("node_id"); var nodeName = FlowConfigObject.node_list.find("#" + FlowConfigObject.FlowType + cNodeId); var hint = ""; if ($("#node_list .flow_node_person[node_id='" + cNodeId + "'][staff_id]").length == 1) { //判断是否是第一个节点 if (nodeName.prev().length == 0) { if ($("#node_list .flow_node_person[staff_id]").length == 1) hint = "删除人员后,该流程将无法使用。"; else { layer.msg("流程第一个节点的人员不允许为空!", { icon: Global.ICON_ERROR }) return } } else { //当前节点下最的一个人员 hint = "删除人员后,流程流转时将忽略该节点环节。"; } } layer.confirm(hint + '确认要删除' + t.find(".name").text() + '的' + nodeName.text() + '权限吗?', { icon: Global.ICON_ASK, btn: ['确定', '取消'] //按钮 }, function(index) { layer.close(index); $.post(Global.AccessUrl + "/api/flow/cnf/deleteuser", { node_inst_id: t.attr("node_inst_id"), user_id: t.attr("staff_id") }, function(r) { if (r.code != 0) { layer.msg("人员节点权限删除失败:" + r.msg); return; } layer.msg("人员节点权限删除成功"); FlowConfigObject.LoadNodeInfo(FlowConfigObject.StationID); }); }); }); }); }, NodeBindPerson: function(eleObj) { this.CurrNode = eleObj; layui.layer.open({ type: 2, resize: false, scrollbar: false, title: "人员选择", area: ['600px', '530px'], content: "/static/module/childmodule/select_user.html" }); }, SaveSelectedUser: function(selectUserList) { var uids = [], unames = []; for (var i = 0; i < selectUserList.length; i++) { uids.push(selectUserList[i].userid); unames.push(selectUserList[i].username); } if (uids.length > 0) { layer.msg("正在保存节点人员信息..."); $.post(Global.AccessUrl + "/api/flow/node/refuser", { "station_id": FlowConfigObject.StationID, "node_inst_id": $.trim(FlowConfigObject.CurrNode.attr("node_inst_id")), "node_id": $.trim(this.CurrNode.attr("node_id")), "user_ids": uids.join(",") }, function(r) { if (r.code != 0) { layer.msg("节点人员信息保存失败:" + r.msg); return; } layer.msg("节点人员信息保存成功"); FlowConfigObject.LoadNodeInfo(FlowConfigObject.StationID); }); } } }; var FlowObject = { paginationLoaded: false, //是否有文件正在上传.0表示没有,大于0则表示有文件上传中 fileUploading: 0, StationID: "", FlowType: "", CurrNodeCode: "", //当前正在处理的节点编码 NodeListEle: null, Win: null, FlowRunID: "", //当前流程实例ID CheckTypeCodes: [], //签入签出类型代码表 CheckChildTypeCodes: [], //签入签出子类型代码表 Init: function(win) { this.Win = win; }, //获取锁定的任务 GetLockScd: function(callback) { $.getJSON(Global.AccessUrl + "/api/flow/lock/list", { "station_id": this.StationID }, function(r) { if (callback != null) return callback(r); }) }, //获取正在处理中的最近一条任务 GetLastDealIng: function(callback) { $.getJSON(Global.AccessUrl + "/api/flow/run/list", { "station_id": this.StationID, "flowstate": "", "pageno": 1, "pagesize": 1 }, function(r) { if (r.code != 0) { return; } if (r.data == null || r.data.length == 0) { //没有正在流转中的scd.可进行签入签出操作 $("#scdin_btn").removeClass("stop_action").attr("title", ""); $("#scdout_btn").addClass("stop_action").attr("title", "禁止操作"); return; } var hasCheckOut = r.data[0].flow_type == "scdout"; var hasCheckIn = r.data[0].flow_type == "scdin"; var ischeckout_lock = r.data[0].checkout_lock; if (r.data[0].deal_state == "1" && ischeckout_lock == "1") { //有锁定等待签入的scd时,不能进行签出 $("#scdin_btn").removeClass("stop_action").attr("title", ""); $("#scdout_btn").addClass("stop_action").attr("title", "禁止操作"); return; } if (ischeckout_lock == "0") { //强制终止的签出时,只能进行签出 $("#scdin_btn").addClass("stop_action").attr("title", "禁止操作"); $("#scdout_btn").removeClass("stop_action").attr("title", ""); } if (r.data[0].deal_state != "1") { $("#scdin_btn").addClass("stop_action").attr("title", "禁止操作"); $("#scdout_btn").addClass("stop_action").attr("title", "禁止操作"); } }) }, //获取当前站的scd签入签出记录 GetScdInoutRecord: function(pageno, pagesize, callback) { layer.msg("正在加载数据中..."); var dt1 = $("#cond_dt1").val(); var dt2 = $("#cond_dt2").val(); $.getJSON(Global.AccessUrl + "/api/flow/run/list", { "station_id": this.StationID, "dt1": dt1, "dt2": dt2, "name": $("#cond_name").val(), "flowtype": $("#cond_flowtype").val(), "flowstate": $("#cond_flowstate").val(), "pageno": pageno, "pagesize": pagesize }, function(r) { layer.closeAll(); if (callback != null) return callback(r); }) this.GetLastDealIng(); }, LoadNodeInfo: function(nodeListEle, islook) { this.NodeListEle = nodeListEle; nodeListEle.html(Tools.HintText("正在加载节点信息...", "#cccccc").replace("15%", "4%")); $.getJSON(Global.AccessUrl + "/api/flow/cnf/getinfo", { "station_id": this.StationID, "flow_type": this.FlowType, "userfilter": "1" //根据当前登录人进行节点过滤 }, function(r) { if (r.code != 0) { nodeListEle.html(Tools.HintText("审核节点加载失败:" + r.msg, "red").replace("15%", "4%")); return; } if (r.data == null || r.data.length == 0) { nodeListEle.html(Tools.HintText("未定义SCD签入审核的节点!", "red").replace("15%", "4%")); return; } var nodes = []; for (var i = 0; i < r.data.length; i++) { var item = r.data[i]; //未设置处理人员的节点,直接跳过 if (item.staffs == null || item.staffs.length == 0) continue; nodes.push(item); } if (nodes.length == 0) { nodeListEle.html(Tools.HintText("您还未分配任何SCD签入节点的操作权限!", "red").replace("15%", "4%")); return; } nodeListEle.html(""); var nodeLen = nodes.length; //计算节点left位置 var initleft = (nodeListEle.width() - (nodeLen * 170 - 100)) / 2; var nhtmls = []; for (var i = 0; i < nodeLen; i++) { nhtmls.push('
' + (i + 1) + '' + nodes[i].node_name + ''); if (i < nodeLen - 1) { nhtmls.push(''); } nhtmls.push('
'); } nodeListEle.html(nhtmls.join("")); nodeListEle.find(".flow_node").off().on('click', function() { var t = $(this); if (t.hasClass("disable")) return; //显示当前点击节点的表单 FlowObject.ShowWorkBook(t.attr("id")); }).each(function(ind) { if (ind == 0) { return; } var t = $(this), t0 = t.prev(); t.css("left", t0.width() + t0.position().left); }); if (FlowObject.CurrNodeCode != "") { FlowObject.SetDealNode(FlowObject.CurrNodeCode, islook); if (islook == "islook" && FlowObject.CurrNodeCode != "all") { //查看流程时,只能查看当前节点之前的节点信息 var prevEle = nodeListEle.find("#" + FlowObject.CurrNodeCode).prev(); if (prevEle.length > 0) FlowObject.ShowWorkBook(prevEle.attr("id"), islook); else { prevEle = nodeListEle.find(".flow_node:first"); if (prevEle.length > 0) { FlowObject.ShowWorkBook(prevEle.attr("id"), islook); } } } else if (islook == "islook" && FlowObject.CurrNodeCode == "all") { //查看流程时,如果流程已结束,默认查看第一个节点信息 FlowObject.ShowWorkBook(nodeListEle.children(".flow_node:first").attr("id"), islook); } else { FlowObject.ShowWorkBook(FlowObject.CurrNodeCode, islook); } return; } FlowObject.SetDealNode(nodes[0].node_code, islook); //默认显示编制节点的表单 FlowObject.ShowWorkBook(nodes[0].node_code, islook); }); }, FlowUnlock: function(evt, scdid, flowRunID, reason) { var $evt = $(evt); if ($.trim($evt.attr("isbusy")) == "1") { layer.msg("不能重复操作!"); return; } layer.confirm("
", { "title": "终止原因" }, function(index) { var v = $.trim($("#flow_reason").val()); $evt.attr("isbusy", "1").html(Tools.LoadingText("...")); $.post(Global.AccessUrl + "/api/screen/scd/unlock", { "scd_id": scdid, "flow_run_id": flowRunID, "reason": v }, function(r) { $evt.attr("isbusy", "0").html("终止"); if (r.code != 0) { layer.msg("操作失败:" + r.msg); return; } layer.msg("终止操作成功!"); $("#scdout_btn").removeClass("stop_action").attr("title", ""); FlowObject.GetScdInoutRecord(1, 10, MakeScdInoutRecord); layer.closeAll(); }); }); }, //设置当前正在处理的节点 SetDealNode: function(nodecode, islook) { this.CurrNodeCode = nodecode; if (nodecode == null || nodecode == 0) { this.NodeListEle.find(".flow_node:first").attr("class", "flow_node active"); return; } if (nodecode == "all") { this.NodeListEle.find(".flow_node").attr("class", "flow_node deal"); return; } var ind = this.NodeListEle.find("#" + nodecode).attr("class", islook == "islook" ? "flow_node disable" : "flow_node active"); this.NodeListEle.find(".flow_node:lt(" + ind.index() + ")").attr("class", "flow_node deal"); }, //查看指定节点数据信息 ShowWorkBook: function(nodecode, islook) { var ele = this.Win.find(".dataitemlist").attr("node_code", nodecode); ele.height(this.Win.height() - this.Win.find(".caption").height() - this.Win.find(".node_area").height() - 10) var tplID = "form_" + nodecode + "_tpl"; var h = template(tplID, {}); ele.html(h); //加载签入类型 //如果已经签入过scd,则不能再选择“新建” var newInTypeList = []; if (PoliceObject.ScdList != null && PoliceObject.ScdList.length > 0) { for (var i = 0; i < FlowObject.CheckTypeCodes.length; i++) { if (FlowObject.CheckTypeCodes[i].name == "新建") continue; newInTypeList.push(FlowObject.CheckTypeCodes[i]); } } else { //第一次签入,只有新建 for (var i = 0; i < FlowObject.CheckTypeCodes.length; i++) { if (FlowObject.CheckTypeCodes[i].name != "新建") continue; newInTypeList.push(FlowObject.CheckTypeCodes[i]); } } ele.find("#checkintype").html(template('system_code_item_tpl', { data: newInTypeList })); //签出时,不需要”新建“类型 var newOutTypelist = []; for (var i = 0; i < FlowObject.CheckTypeCodes.length; i++) { if (FlowObject.CheckTypeCodes[i].name == "新建") continue; newOutTypelist.push(FlowObject.CheckTypeCodes[i]); } ele.find("#checkouttype").html(template('system_code_item_tpl', { data: newOutTypelist })); if (FlowObject.FlowType == "scdout") { //加载scd列表 if (PoliceObject.ScdList == null || PoliceObject.ScdList.length == 0) { layer.msg("请先确定当前的在运版SCD!", { icon: Global.ICON_HINT }) return } ele.find("#scd_list").val(PoliceObject.ScdList[0].id); ele.find("#scd_name").val(PoliceObject.ScdList[0].scd_name); } //如果非第一次签入时,需要显示上一次签出工作内容 if (nodecode == "checkinstart" && PoliceObject.ScdList != null && PoliceObject.ScdList.length > 0) { var divEle = $("#checkout_workbook").removeClass("hidden"); $("#checkout_workarea").removeClass("hidden"); $.getJSON(Global.AccessUrl + "/api/flow/getlastoutworkbook", { "station_id": FlowObject.StationID }, function(r) { if (r.code != 0) { return; } var content = r.data; if (content == null || content == "") { return; } content = JSON.parse(content); var work_area_name = $.trim(content.work_area_name); $("#checkout_workarea #work_area_name").val(work_area_name); var workbookno = content.workbookno; var workbookno_file = content.workbookno_file; var workbookno_name = content.workbookno_name; divEle.find("#checkout_workboono").val(workbookno).attr("title", workbookno); if (workbookno_file != "") { divEle.find(".file-name").html('' + workbookno_name + ''); } }); } layui.use(['form', 'layer', 'upload', "laydate"], function() { layui.form.render("select"); layui.laydate.render({ elem: "#overdate" }); //文件上传绑定 var uploadInst = layui.upload.render({ elem: '.file_upload_btn', url: Global.AccessUrl + '/api/uploadfile', accept: "file", size: 1024 * 1024, //文件大小限制为不超过1G auto: false, choose: function(obj) { obj.preview(function(index, file) { var fix = file.name.split("."); if (fix.length == 1) { layer.msg("该类型文件不允许上传!", { icon: Global.ICON_ERROR }) return false; } fix = fix[fix.length - 1].toLocaleLowerCase(); if (fix == "bat" || fix == "sh" || fix == "sql" || fix == "exe") { layer.msg("该类型文件不允许上传!", { icon: Global.ICON_ERROR }) return false; } if (fix == "rar") { layer.msg("不支持rar压缩包,请上传zip格式的压缩包!", { icon: Global.ICON_ERROR }) return false; } obj.upload(index, file) //上传文件操作 }); }, before: function(obj) { this.data = { data_type: $.trim(this.item.attr("datatype")), station_id: PoliceObject.AreaID, is_checkin: 1 }; var targetEle = this.item.parent().parent(); targetEle.find(".file-path").val(''); var filename = targetEle.find(".file-name"); filename.each(function() { var fele = $(this); if (fele[0].tagName == 'INPUT') fele.val('正在上传文件中...'); else fele.html('正在上传文件中...'); }) FlowObject.fileUploading++; FlowObject.Win.find(".file_upload_btn").attr("disabled", true).attr("title", "请等待正在上传的文件完成"); //预读本地文件示例,不支持ie8 //obj.preview(function(index, file, result) { // $('#demo1').attr('src', result); //图片链接(base64) //}); }, done: function(res) { FlowObject.Win.find(".file_upload_btn").attr("disabled", false).attr("title", ""); var targetEle = this.item.parent().parent(); FlowObject.fileUploading--; //如果上传失败 if (res.code != 0) { targetEle.find(".file-name").val(''); return layer.msg('上传失败:' + res.msg, { icon: Global.ICON_ERROR }); } //var demoText = $('#demoText'); // demoText.html('上传成功!!!'); //$("#imagepath").val(res.image) layer.msg("上传成功", { icon: Global.ICON_OK }) targetEle.find(".file-path").val(res.data.path); if (this.item.attr("datatype") == "scd") { //进行scd解析过程进行mqtt发布消息提示时需要使用到该变量值 PoliceObject.CurentParseScdName = res.data.filename; } var filename = targetEle.find(".file-name"); filename.each(function() { var fele = $(this); if (fele[0].tagName == 'INPUT') fele.val(res.data.filename); else fele.html(res.data.filename); }); }, error: function() { //演示失败状态,并实现重传 return layer.msg('上传失败', { icon: Global.ICON_ERROR }); } }); var getChildType = function(pcode, cldele) { //加载子类型 $.getJSON(Global.AccessUrl + "/api/getGlobalCode", { "pcode": pcode + "_cld" }, function(r) { cldele.html(template('system_code_item_tpl', { data: r.data || [] })); layui.form.render("select"); }); } //类型选择框事件绑定 layui.form.on("select(checkintype)", function(data) { var checkTxt = $.trim($("#checkintype option:checked").text()); if (checkTxt != "" && "新建".indexOf(checkTxt.substring(0, 2)) > -1) { ele.find("#checkinchildtype").parent().addClass("hidden").parent().parent().addClass("hidden"); } else { ele.find("#checkinchildtype").parent().removeClass("hidden").parent().parent().removeClass("hidden"); } ele.find("#checkintype_text").val(checkTxt); $("#checkinchildtype_memo").html("").val("").parent().addClass("hidden"); getChildType($(data.elem).find("option:checked").attr("code"), ele.find("#checkinchildtype")); }); layui.form.on("select(checkouttype)", function(data) { var checkTxt = $.trim($("#checkouttype option:checked").text()); if (checkTxt != "" && "新建".indexOf(checkTxt.substring(0, 2)) > -1) { ele.find("#checkoutchildtype").parent().parent().parent().addClass("hidden"); } else { ele.find("#checkoutchildtype").parent().parent().parent().removeClass("hidden"); } ele.find("#checkouttype_text").val(checkTxt); $("#checkoutchildtype_memo").html("").val("").parent().addClass("hidden"); getChildType($(data.elem).find("option:checked").attr("code"), ele.find("#checkoutchildtype")); }); //子类型选择框事件绑定 layui.form.on("select(checkinchildtype)", function(data) { var checkTxt = $.trim($("#checkinchildtype option:checked").text()); if (checkTxt != "" && "其他,其它".indexOf(checkTxt.substring(0, 2)) > -1) { ele.find("#checkinchildtype_memo").removeClass("hidden").focus().parent().removeClass("hidden"); } else { ele.find("#checkinchildtype_memo").addClass("hidden").html("").val("").parent().addClass("hidden"); } ele.find("#checkinchildtype_text").val(checkTxt); }); layui.form.on("select(checkoutchildtype)", function(data) { var checkTxt = $.trim($("#checkoutchildtype option:checked").text()); if (checkTxt != "" && "其他,其它".indexOf(checkTxt.substring(0, 2)) > -1) { ele.find("#checkoutchildtype_memo").removeClass("hidden").focus().parent().removeClass("hidden"); } else { ele.find("#checkoutchildtype_memo").addClass("hidden").html("").val("").parent().addClass("hidden"); } ele.find("#checkoutchildtype_text").val(checkTxt); }); //scd选择框事件绑定 layui.form.on("select(scd_list)", function(data) { if (data.value == "") { $("#scd_name,#scd_file").val(''); return; } var checkTxt = $.trim($("#scd_list option:checked").text()); for (var i = 0; i < PoliceObject.ScdList.length; i++) { if (PoliceObject.ScdList[i].id == data.value) { $("#scd_name").val(PoliceObject.ScdList[i].name); $("#scd_file").val(PoliceObject.ScdList[i].path); break; } } }); }); var ReadonlyForm = function(ele) { ele.find("input,select,textarea").removeClass("layui-input").addClass("input2span").attr({ "disabled": true, "placeholder": "" }); ele.find("select").each(function() { var selEle = $(this); var selId = selEle.attr("id"); selEle.next().remove(); selEle.remove(); $("#" + selId + "_text").attr("type", "text"); }); } //如果点击的节点是已经处理过的,则不显示tools栏 if (this.Win.find("#" + nodecode).hasClass("deal") || islook == "islook") { ele.find(".layui-tools,button").remove(); ReadonlyForm(ele); } ele.find(".layui-form:eq(0)").slimScroll({ height: ele.height() - ele.children(".layui-tools").height() - ele.children(".layui-tops").height() - ele.children(".pagebar").height() - ((ele.children(".pagebar").css("margin-top") || "").replace("px", "") * 1) + "px", width: "100%", alwaysVisible: false, wheelStep: 10, size: "6px", color: "#03aee7" }).css({ "width": "98%" }); if (FlowObject.FlowRunID != "") { //加载当前节点的表单信息 //如果当前节点为checkinaudit审核时,加载编制节点的基本信息以及校验结果 //如果当前节点不是签出编制节点时,加载签出编制节点的基本信息 var queryNode = nodecode; if (nodecode == "checkinaudit" || nodecode == "checkinend") queryNode = "checkinstart"; if (nodecode == "checkoutcheck" || nodecode == "checkoutend") queryNode = "checkoutstart"; $.getJSON(Global.AccessUrl + "/api/flow/node/getdata", { "flow_run_id": FlowObject.FlowRunID, "station_id": FlowObject.StationID, "flow_type": FlowObject.FlowType, "node_code": queryNode }, function(r) { if (r.code != 0) { layer.msg(r.msg); return; } var scd_name = r.data.scd_name; var scd_path = r.data.scd_path; ///api/scd/check/resultlist if (nodecode == "checkincheck" || nodecode == "checkinaudit" || nodecode == "checkinend") { //只有校验节点才查询校验结果信息 function getCheckResultList(pageno, level) { $.getJSON(Global.AccessUrl + "/api/scd/check/resultlist", { "scd_name": scd_name, "scd_path": scd_path, "level": level, "pageno": pageno, "pagesize": 20 }, function(r) { var h = template('form_checkincheck_result_tpl', r); FlowObject.Win.find(".layui-form[lay-filter='checkincheck']").html(h); //生成分页 if (!FlowObject.paginationLoaded) { FlowObject.Win.find(".pagebar").pagination(r.count, { num_edge_entries: 2, num_display_entries: 6, prev_show_always: false, next_show_always: false, prev_text: "<", next_text: ">", callback: function(page_index, jq) { getCheckResultList(page_index + 1, level); }, items_per_page: 20 }); FlowObject.paginationLoaded = true; //查询告警统计.只查询一次告警统计数量 $.getJSON(Global.AccessUrl + "/api/scd/check/stat/level", { "scd_name": scd_name, "scd_path": scd_path }, function(r1) { if (r1.data == null) return; for (var i = 0; i < r1.data.length; i++) { var item = r1.data[i]; var alertlevel = item["alert_level"]; FlowObject.Win.find(".layui-tops span[alert_level='" + alertlevel + "']>b").html(item.cnt); } FlowObject.Win.find(".layui-tops span[alert_level]").off().on("click", function() { FlowObject.paginationLoaded = false; getCheckResultList(1, $(this).attr("alert_level")); }); }); } }); } getCheckResultList(1, ""); } var job_content = r.data.job_content || ""; if (job_content == "") return; job_content = JSON.parse(job_content); for (var attr in job_content) { var inputele = FlowObject.Win.find("#" + attr); if (inputele.length == 0) continue; var v = job_content[attr] || ""; if (inputele[0].tagName == "INPUT" || inputele[0].tagName == "SELECT" || inputele[0].tagName == "TEXTAREA") inputele.val(v); else inputele.html(v); if (attr == "checkintype" && v == "新建") { //不显示子类型 $("#checkinchildtype").parent().parent().parent().addClass("hidden"); } } layui.form.render("select"); //if (nodecode == "checkinaudit" || nodecode == "checkinend" || nodecode == "checkoutcheck" || nodecode == "checkoutend") { //审核和发布节点时,表单内容都只是查看,不进行编辑 ReadonlyForm(ele); ele.find("input.file-name").each(function() { var t = $(this), fname = t.val(), fpath = t.next().val(); t.attr("type", "text"); if (t.attr("id") == "scd_name" || fname == "") return; t.parent().next().html("下载"); }); //} }); } }, //查看流转过程 LookFlow: function(e) { var t = $(e); var flow_run_id = t.attr("flow_run_id"); var flow_type = t.attr("flow_type"); var node_code = t.attr("node_code"); FlowObject.CurrNodeCode = t.attr("isend") == "1" ? "all" : node_code; FlowObject.FlowType = flow_type; FlowObject.FlowRunID = flow_run_id; DialogObject.Open($("#dialog_public"), { size: ["100rem", "70rem"], para: { "flow_type": flow_type, "flow_run_id": flow_run_id }, callback: function(win, para) { win.find(".caption>b").html(para.flow_type == "scdin" ? "SCD文件签入" : "SCD文件签出"); FlowObject.Init(win); FlowObject.LoadNodeInfo(win.find(".node_area"), "islook"); } }); }, DealNode: function(e) { if (FlowObject.fileUploading > 0) { layer.msg("还有文件正在上传中,请在上传完成后重试!") return; } var t = $(e); var flow_run_id = t.attr("flow_run_id"); var node_code = t.attr("node_code"); FlowObject.FlowType = t.attr("flow_type"); FlowObject.FlowRunID = flow_run_id; FlowObject.CurrNodeCode = node_code; FlowObject.isCommit = false; DialogObject.Open($("#dialog_public"), { size: ["100rem", "70rem"], para: {}, callback: function(win, para) { win.find(".caption>b").html(FlowObject.FlowType == "scdin" ? "SCD文件签入" : "SCD文件签出"); FlowObject.Init(win); FlowObject.paginationLoaded = false; FlowObject.LoadNodeInfo(win.find(".node_area")); }, onSave: function(win, para, clickbtn) { if (FlowObject.isCommit) { layer.msg("不允许重复提交数据!") return; } if ("0" == $(clickbtn).attr("notcheck")) { layer.msg("需要先进行SCD校核才能提交!") return; } var formItems = Global.GetFormData("", win.find(".layui-form")); if (formItems == null) return; var optvalue = ""; if (clickbtn != null) optvalue = $.trim($(clickbtn).attr("opt")); if (optvalue == "0") { //驳回 } layer.msg("正在提交数据中...", { time: 0 }); FlowObject.isCommit = true; $.post(Global.AccessUrl + "/api/flow/run/nodedeal/save", { "flow_run_id": FlowObject.FlowRunID, "station_id": FlowObject.StationID, "flow_type": FlowObject.FlowType, "node_code": FlowObject.CurrNodeCode, "opt": optvalue, //1:通过 0 驳回 "content": JSON.stringify(formItems) }, function(r) { FlowObject.isCommit = false; layer.closeAll(); if (r.code != 0) { layer.msg("数据提交失败:" + r.msg); return; } layer.msg("操作数据提交成功!", { time: 5000, icon: Global.ICON_OK }); $("#scdin_btn").addClass("stop_action"); setTimeout(function() { FlowObject.GetScdInoutRecord(1, 10, MakeScdInoutRecord); win.find(".fa-times").trigger("click"); }, 5000); }); } }); }, //查看流程详情 Detail: function(e) { var t = $(e); DialogObject.Open($("#dialog_public"), { size: ["100rem", "50rem"], para: { detail_id: t.attr("detail_id") }, callback: function(win, para) { win.find(".caption>b").html("审批流程详情"); } }); } }