var rootPath = "";// 当前公文附件根目录 var formPanel = '#formPanel'; var formTree = '#formTree'; var taskId = null; var task = null; var formList = null; var flowId = null; var sendCmd = null; var referer = ''; var showFileList = []; var contentpath; var projectid = null; var project = null; var reports = null; var reports = null; var materialList = null; var beforeModifiedData = null; var activityid = null; var create = null;//根据这个属性接收新建传过来的参数,判断是否是新建 var state; var URLStats; var flowObjectId = null;//当前流程环节id var canSelfTurning = null; var flowInstanceId = null; var processBar = new processBar(); var flowObjectName = null; var description = null; var sendBeforeSave = false; var oldAttachpath = null; var projectType = ""; var action = ""; var ismeeting = false; var curserver; var isbtnSave = false; var cookieuser; var username; var userid; var unitsname; var signPictrueUrl; var isFist; var getManageOrSearchStats = ""; var projectReportList = null; var dataList = null; var win_Array = new Array(); // hyh 新增,用于存储子窗口对象 2017/11/6 var win_num = -1; // hyh 新增,用于存储子窗口对象的下标 2017/11/6 var roles = ""; var cardNumber = ""; //许可证号 hzw 新增 2018/1/8 var tagVarValue = ""; var userInfo = undefined; //yxt 20180124 var XuiData = null; //yxt 20180124 var flowInfo = undefined; //yxt 20180124 var XuiRights = null; //yxt 20180124 var _timerIdSetXuiPrivilege = undefined; //yxt 20180124 var _timerIdSetXuiData = undefined; //yxt 20180124 var _timerIdGetXuiData = undefined; //yxt 20180124 var _flagXuiDataSeted = undefined; var _timeMillisec = 10; //yxt 20180124 var _fagCreatedNumber = false; //yxt20180131 var _roleIdByQara = ''; var _flowid = ''; var _projectStaus = null; var isRenew = null; var htyjVal; var _flowname = null; var _finishtime = null; var _title = null; var rejectState; var _flowRevisionId; var unitid; var operationType; var moudleType = 'sp'; var _dockingid; var _projectcode; var fileList = []; // 附件列表 var bureauName; var flowItemTypeId = null; var aloneInputCoord = false; // 是否是单独录入坐标 var isMeetingProject = null; //该环节是否上会 var meetingCondition = null;//上会条件 var uniquePath = null;//新建项目时附件的路径(需要拼接前缀) var allMaterialLists = []; var version = null; // 流程版本 var dtree = null; // layui dtree fj var dtreePointer = null; // dtree当前选中 var DemoTree = null; // dtree返回对象 var layUpload = null; // 上传组件 var layUploadObj = null; // 导入成果包上传对象实例 var fileListBack = null; // 上传文件回调List var _unPass = null; // 一键质检不通过结果 var tableMerge = null; // 单元格自动合并对象 var _nodeName = null; // var isSendComments = false; var v2FileListBack = null; var isTypeInreference = false; var detailType = null; $(function () { // isSendComments =isSendComments(); $.showLoading(); curserver = CONF_BACK_SERVERURL; var _queryParams = initializeData(); sessionStorage.setItem("params", JSON.stringify(_queryParams)) version = _queryParams.FLOWVERSION; /*var _href = window.location.href; var _param = _href.substring(_href.indexOf("?"), _href.length); _queryParams = global.getParameter(_param) || {}; */ detailType = _queryParams.detailType; taskId = _queryParams.taskId || _queryParams.taskid; _projectId = _queryParams.projectid; _dockingid = _queryParams.dockingid; _flowRevisionId = _queryParams.flowRevisionId; _stats = _queryParams.stats; URLStats = _queryParams.stats; _flowInstanceId = _queryParams.flowInstanceId; _roleIdByQara = _queryParams.role; _flowid = _queryParams.flowid; flowItemTypeId = _queryParams.flowItemTypeId ? _queryParams.flowItemTypeId : null; uniquePath = _queryParams.uniquePath ? _queryParams.uniquePath : null; var projectcode = _projectcode = _queryParams.projectcode; _projectStaus = decodeURI(decodeURI(_queryParams.projectStatus)); isRenew = _queryParams.isRenew; _title = decodeURI(decodeURI(_queryParams.titleEncode ? _queryParams.titleEncode : '')) // FIXME:add version // if (_projectId && !version) { // getMaterialLists(_projectId); // } XuiData = null; if (_stats != "create" && _projectId != null && _projectId != "") { //加载项目数据内容 getXuiContentDate(_projectId); } getManageOrSearch(_flowInstanceId) /*dispalyGis(projectcode);*/ var stats = _stats; //获取登录人 cookieuser = JSON.parse($.cookie('cookieuser')); username = cookieuser.user ? cookieuser.user.loginname : ""; unitsname = cookieuser.units[0] ? cookieuser.units[0].name : ""; unitid = cookieuser.units[0] ? cookieuser.units[0].id : ""; userid = cookieuser.user ? cookieuser.user.id : ""; signPictrueUrl = cookieuser.user ? cookieuser.user.sign : ""; initBureau(unitid); //获取列表按钮权 if (stats == "projecting") { getRoleChildrenPrivilege("待办项目详情页"); } else if (stats == "dealedproject") { getRoleChildrenPrivilege("已办项目详情页"); $('#mbSend').attr("disabled", "disabled"); $('#jumpbtn').attr("disabled", "disabled"); } else if (stats == "create") { getRoleChildrenPrivilege("待办项目详情页"); $('#mbSend').attr("disabled", "disabled"); $('#jumpbtn').attr("disabled", "disabled"); $('#backbtn').attr("disabled", "disabled"); $('#loadProject, #backbtn').hide(); } else if (stats == "Manage") { getRoleChildrenPrivilege("项目管理详情页"); } else if (stats == "search") { getRoleChildrenPrivilege("项目查询详情页"); $('#mbSend').attr("disabled", "disabled"); $('#jumpbtn').attr("disabled", "disabled"); } else if (stats == "projectLifeCircle") { getRoleChildrenPrivilege("项目全阶段详情页"); } $("#userId").val(userid); projectType = $("#type").val(); create = $("#create").val(); txtShowListUrl = $('#txtShowList').val(); txtRepory = $("#txtRepory").val(); urlListFr = $('#txtFrList').val(); contentpath = $("#contentpath").val(); if (_stats == "search" || _stats == "dealedproject") { $("#addfiledir").remove(); $("#uploadbtn").remove(); $("#delebtn").remove(); } _flowId = _queryParams.flowid; _openMode = _queryParams.openMode || 'readonly'; //改标题 if (_queryParams.titleEncode != undefined) { document.title = _title; } else { document.title = "新建项目"; } initOneMap(); if (create === 0 || create == '0' || create == '1') { creatingProject(); } else { //$("#report_div").css("display", "block"); if (!taskId && stats != "Manage" || !taskId && stats != "Manage") { lookThroughProject(); } else if (!taskId && stats == "Manage") { lookProjectManage(); } else { if (stats == "dealedproject") { lookThroughProject(); } else if (stats == "correctionproject") { correctionRecordId = _queryParams.correctionRecordId; correctionProject(); var res = getCorrectionRecord(correctionRecordId); if (res.success) { var correctionRecord = res.data; var title = correctionRecord.unitName + "-" + correctionRecord.createUserName + "发来补正材料信息"; var content = correctionRecord.describe; layer.open({ type: 1, maxmin: true, shade: 0, title: title, content: "<div style='padding:10px;font-size:14px'>" + content + "</div>", icon: 3 }); } else { layer.confirm(res.reason, { icon: 3, title: "警告", btn: ['确认'], btn1: function (index) { layer.close(index); } }); } } else { dealingProject(); var result = checkTaskCorrectionRecord(taskId); if (result.flag) { correctionRecordId = result.data.id; $("#mbSend").attr("disabled", "disabled"); $("#returned").attr("disabled", "disabled"); $("#btn_correct").html("<span class='glyphicon glyphicon-arrow-right' style='font-size: 15px'></span>取消补正材料"); } var returnOpinionMsg = validateReturnOpinionThisActivity(taskId, _projectId); if (returnOpinionMsg.show) { var content = returnOpinionMsg.message; var title = returnOpinionMsg.title; layer.confirm(content, { icon: 3, title: title, btn: ['确认'], btn1: function (index) { layer.close(index); } }); } } } } }); function uploadBtnNone() { var orign = localStorage.orign; var obj = localStorage.value; var _flowId1 = localStorage.flowId; if (localStorage.flowId == "undefined" || localStorage.flowId == null) { _flowId1 = flowId; } if (flowId == "undefinded" || flowId == null) { _flowId1 = _flowId; } var flag = false; var roleIds = getRoles(userid); var temp = roleIds.indexOf(","); var roleArr = []; if (temp > -1) { roleArr = roleIds.split(","); } if (_flowId1 != 't1001_4028d83970955d2a01709577b3870018') { return; } $.ajax({ type: "POST", async: false, url: CONF_BACK_SERVERURL + global.modelctls.flow.startRole.list, headers: { "token": $.cookie('ftoken') }, data: {id: _flowId1}, dataType: 'json', success: function (res) { console.log(res) if (roleArr != null) { for (let j = 0; j < roleArr.length; j++) { for (let i = 0; i < res.length; i++) { var id = res[i].id var role = roleArr[j]; if (role == id) { flag = true; break; } else { flag = false; } } } } }, error: function (e) { console.log("请求失败") return; } }); if (!flag) { console.log("上传文件按钮隐藏") $("#uploadFile").css("display", "none"); $("#createFolder").css("display", "none"); } } function attachmentFolderFips() { let materialMap = {}; materialList.forEach(function (material) { materialMap[material.id] = material; }); /** * 获取上级路径 */ let getParentPath = function (parentid) { let material = materialMap[parentid]; if (typeof material === "object") { let name = material["parentid"] ? getParent(material["parentid"]) : ""; return name + material.name; } return ""; }; /** * 获取材料描述。key:文件路径,value:描述 */ window.materialPathRemarkMap = {}; materialList.forEach(function (material) { if (material.parentid) { let path = getParentPath(material.parentid); materialPathRemarkMap[path + material.name] = material.remark ? material.remark.replace(/\n/g, "<br/>") : ""; } else { materialPathRemarkMap[material.name] = material.remark ? material.remark.replace(/\n/g, "<br/>") : ""; } }); /** * 文件夹帮助图标事件 */ let questionEvent = function (elem, remark) { if (!elem instanceof jQuery) { return false; } elem.hover(function (e) { e.stopPropagation(); if (remark) { var domStr = "<p style='font-size:16px;'>" + remark + "</p>"; this.tipIndex = layer.tips(domStr, this, {tips: [1, '#0096EB'], time: 0}); } }, function (e) { if (this.tipIndex || this.tipIndex === 0) { layer.close(this.tipIndex); } }); elem.click(function () { if (this.tipIndex || this.tipIndex === 0) { layer.close(this.tipIndex); } }) }; /** * 材料DOM元素有子节点插入时触发 */ $(".div-attachment").bind('DOMNodeInserted', function (e) { if (typeof window['materialPathRemarkMap'] !== "object") { return false; } let target = e.target; if (target.classList.contains("div-attachment-item") === true) { // 材料文件夹列表 // 上...级文件夹 let parentPath = $(".div-attachment-divpath a[class='link']").text(); // 当前文件夹名称 let folderName = target.title && target.title.trim(); let folderRemark = materialPathRemarkMap[parentPath + folderName]; let folderNameDiv = $(target).find(".div-attachment-name"); // 判断是否有文件夹描述 if (folderName && folderRemark && folderNameDiv.find(".glyphicon-question-sign").length === 0) { // 有文件夹描述,则添加帮助图标,并添加鼠标悬停、点击方法 let question = $("<span class='glyphicon glyphicon-question-sign' style='margin-left: 5px;'></span>"); questionEvent(question, folderRemark); folderNameDiv.append(question); } } else if (target.classList.contains("div-attachment-divpath") === true) { // 材料文件夹列表父文件夹面包屑 let parentPath = ""; $(".div-attachment-divpath a[class='link']").each(function () { let folderName = this.innerText.trim(); let folderRemark = materialPathRemarkMap[parentPath + folderName]; if (folderName && folderRemark && $(this).find(".glyphicon-question-sign").length === 0) { let question = $("<span class='glyphicon glyphicon-question-sign' ></span>"); questionEvent(question, folderRemark); $(this).append(question); parentPath += folderName } }) } }); } /** * 初始化分局或者处室的名称 * @param currentUnitId * @returns */ function initBureau(currentUnitId) { $.ajax({ type: "POST", async: false, url: CONF_BACK_SERVERURL + global.modelctls.unit.getBureauByUId, headers: { "token": $.cookie('ftoken') }, data: {unitId: currentUnitId}, success: function (result) { bureauName = result.name; }, error: function (e) { return; } }); } var flag = true; var invFlag; var invFlag1; function initOneMap() { // 初始化地图 initGis(_projectId); /* 打开一张图参数 */ var getparam = function (aloneIC) { var openparam = "", unitRemark = getUnitRemark(), userRealname = getUserRealname(); roles = getRoles(userid); var activityName = aloneIC && activityid && ((dataList && ((dataList.activity && dataList.activity.flowObjectName) || (dataList.task && dataList.task.name))) || activityid); var title = (newtitle = _title || ('审批任务' + _projectId)) && activityName ? (newtitle + '-' + activityName) : newtitle; roles && (openparam += ("&roleid=" + roles)); // 用户角色 userid && (openparam += ("&userid=" + userid)); // 用户ID _projectId && (openparam += ("&projectid=" + _projectId)); // 项目ID title && (openparam += ("&title=" + encodeURI(encodeURI(title)))); // 项目名称 unitRemark && (openparam += ("&inoffice=" + encodeURI(encodeURI(unitRemark)))); // 用户所在单位 userRealname && (openparam += ("&username=" + encodeURI(encodeURI(userRealname)))); // 用户名称 aloneIC && activityid && (openparam += ("&contextid=" + (activityid + "_" + _projectId))); return openparam; } // 点击录入坐标 $("#AxisMap").attr("disabled", false).click(function () { if (invFlag) { clearTimeout(invFlag) } invFlag = setTimeout(() => { if (_projectId == "") { layer.msg("请先保存!", {icon: 2}); } if (_projectId) { var openparam = getparam(aloneInputCoord); var openurl = CONF_GIS_ONEMAP + "?type=SP&state=edit"; openparam && (openurl += openparam); window.open(openurl); } }, 500) }); // 点击查看大图 $("#MaxMap").attr("disabled", false).click(function () { if (invFlag1) { clearTimeout(invFlag1) } invFlag1 = setTimeout(() => { if (_projectId == "") { layer.msg("请先保存!", {icon: 2}); } if (_projectId) { var openparam = getparam(false); var openurl = CONF_GIS_ONEMAP + "?type=SP&state=disabled"; openparam && (openurl += openparam); window.open(openurl); } }, 500) }); //刷新 $("#RefreshMap").click(function () { initGis(_projectId) }); } $(window).bind('beforeunload', function () { var haveData = false; var curDatas = newData = window.formMgr.getDataJson(); curDatas = JSON.parse(curDatas); //与XuiData进行比较 var retDatas = compareDatas(curDatas, XuiData); if (retDatas.oldDatas && retDatas.newDatas) {//判断是否有改变的数据 for (var odata in retDatas.oldDatas) {//判断改变的数据是否有有效值 if (retDatas.oldDatas[odata] != null) { haveData = true; break; } } } }); /** * 点击补正材料的按钮 * @param dom * @returns */ function correct(dom) { var operation = $(dom).text().trim(); if (operation == "补正材料") { operation_correct(taskId); } else if (operation == "取消补正材料") { operation_cancellCorrect(correctionRecordId); } else { layer.msg("未识别处该操作!", {icon: 2}); } } /** * 补正材料 * @param taskId * @returns */ function operation_correct(taskId) { if (taskId) { operationType = "correct"; var index = layer.open({ type: 2, title: '选择用户', shadeClose: true, shade: 0.3, area: ['640px', '720px'], scrollbar: false, content: '../../view/sp_userlist.jsp?taskId=' + taskId, btn: ['提交', '取消'], yes: function (index, layero) { var res = window["layui-layer-iframe" + index]; var val = res.getTextVal(); if (val) { var splabel = res.splabel(); if (splabel.length > 0) { var item = splabel[0]; var correctionRecord = { sourceTask: task.id, describe: val, targetTaskDefKey: item.sid, targetTaskName: item.name, targetTaskOwner: item.id, targetTaskOwnerName: item.user }; $.ajax({ type: "POST", async: true, url: curserver + global.modelctls.flowEngine.task.history.correct, headers: { "token": $.cookie('ftoken') }, data: JSON.stringify(correctionRecord), contentType: "application/json", dataType: 'json', success: function (result) { if (result.status == 'ok') { layer.msg(result.message, {icon: 1}); if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } if (opener && opener.closeFlowWindow) { opener.closeFlowWindow(); } sendSuccessPage(index); return; } else { if (result.message != null && result.message != "") { layer.msg("操作失败!" + result.message, {icon: 2}); } else { $.messager.alert('错误', '操作失败!'); } console.info(result); } } }); } else { parent.layer.msg('请选择用户', {icon: 2}); } } else { layer.msg("意见不能为空!", {icon: 2}); } }, end: function (index, layero) { } }); } else { layer.msg("任务已结束,无法补正材料!", {icon: 2}); } } /** * 取消补正 * @param correctionRecordId * @returns */ function operation_cancellCorrect(correctionRecordId) { $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.flowEngine.task.history.settleCorrect, headers: { "token": $.cookie('ftoken') }, data: {correctionRecordId: correctionRecordId, reason: "cancelled"}, dataType: 'json', success: function (data) { if (data.status == "ok") { layer.msg("操作成功!", {icon: 1}); $("#btn_correct").html("<span class='glyphicon glyphicon-arrow-left' style='font-size: 15px'></span>补正材料"); } else { layer.msg("操作失败!" + data.message, {icon: 1}); } }, error: function (msg) { layer.msg("操作失败!", {icon: 2}); } }); } /** * 验证该环节是否有未完成的补正记录 * @param taskId * @returns */ function checkTaskCorrectionRecord(taskId) { var result = { flag: false, data: null }; $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.flowEngine.task.history.findEffectiveCorrectionByTaskId, headers: { "token": $.cookie('ftoken') }, data: {taskId: taskId}, dataType: 'json', success: function (data) { if (data.status == "ok" && data.data.length > 0) { result.flag = true; result.data = data.data[0]; } }, error: function (msg) { console.log(msg); //layer.msg("补正材料验证请求出错!", {icon: 2}); result.flag = true; } }); return result; } /** * 加载补正项目 * @returns */ function correctionProject() { state = false; var openMode = 'normal'; if ('searchproject' == referer) openMode = 'readonly'; var param = { taskid: taskId, flowRevisionId: _flowRevisionId, flowItemType: flowItemTypeId, correctionRecordId: correctionRecordId }; $.ajax({ type: "POST", url: curserver + global.modelctls.project.task.resource, headers: { "token": $.cookie('ftoken') }, data: param, dataType: 'json', success: function (data) { _flowname = data.flowduration ? data.flowduration.NAME : ''; if (!data.project) { layer.msg("项目不存在!", {icon: 2}); return; } //计算办结日期 var time = data.project.starttime; time = time ? time + parseInt(data.flowduration ? data.flowduration.DURATION : "") * 24 * 60 * 60 * 100 : ''; _finishtime = time ? new Date(time).format("yyyy年MM月dd日") : ''; dataList = data; task = data.task; project = data.project; projectid = project.id; _flowId = project.flowid; aloneInputCoord = data.activity.aloneInputCoord; if (task.state == "true") { $("#suspension")[0].lastChild.data = "恢复"; } else { $("#suspension")[0].lastChild.data = "挂起"; } if (data.projectFormList && data.projectFormList.length > 0) { formList = data.projectFormList[0]; formId = formList.id; queryXuiPrivilegeList(_flowId, formList.revisionid, dataList.role == null ? '' : dataList.role.id, data.state ? data.state.id : null); } else { layer.msg("表单不存在!", {icon: 2}); return; } if (data.task.isFist == "yes") { isFist = true; } else { isFist = false; } projectReportList = data.projectReportList; activityid = data.activity.id; //查询权限 formMgr = new ListFormMgr(project.id, taskId, formPanel, { flowId: project.flowid, showTab: false, role: data.role, state: data.state, projectFormList: formList, flowInstanceId: project.flowInstanceId, flowObjectId: task.flowObjectId, openMode: openMode, taskResouce: data, onListLoaded: function (row, data, treegrid) { var rowsCount = 0; if ($.isArray(data)) { rowsCount = data.length; } else if (data.rows && $.isArray(data.rows)) { rowsCount = data.rows.length; } var dgHeight = rowsCount * 26 + 26; // $('#formInfo').panel('resize', { height: dgHeight + 28 }); $(accordionDetail).accordion('select', 0); } }); flowId = project.flowid; reports = data.projectReportList; materialList = data.projectMaterialDirList; canSelfTurning = data.activity.canSelfTurning; flowObjectName = data.activity.flowObjectName; flowInstanceId = project.flowInstanceId; flowObjectId = task.flowObjectId; oldAttachpath = project.attachpath; sendHelpMessage = data.activity.sendHelpMessage; isMeetingProject = data.activity.isMeetingProject; if (isMeetingProject && isMeetingProject == "condition") { var str = data.activity.requiredMeetingCondition; if (str) { try { meetingCondition = JSON.parse(str); } catch (e) { layer.msg("上会条件格式转换错误!", {icon: 2}); return; } } } if (project.status == "上会") ismeeting = true; if (oldAttachpath == null) $.cookie("uuid", null); attachmentFolderFips(); loadFromSource(formList);//加载表单 loadReportSource(projectReportList);//加载报表 if (create != "1") { loadAttach(project.attachpath, data.projectMaterialDirList);//加载附件 } else { var pathParam = getCurrentNewAttachmentPath("SP", uniquePath); loadMaterials(data.projectMaterialDirList, pathParam);//自动创建阶段的材料的文件夹 } $("#bodycontent").mCustomScrollbar({ theme: "minimal-dark", axis: "xy", scrollInertia: 200 }); $("#reportDiv").mCustomScrollbar({theme: "minimal-dark", scrollInertia: 200}); eventinit(); } }); } function endCorrect() { saveproject("完成补正"); } /** * 完成补正 * @returns */ function endCorrectProject(projectId, newData, oldData) { let param = { correctionRecordId: correctionRecordId, reason: "completed" }; if (newData) { let saveData = {}; if (oldData) { saveData = { newData: JSON.parse(newData), olddata: JSON.parse(oldData) } } else { saveData = { newData: JSON.parse(newData) } } param.projectId = projectId; param.saveData = JSON.stringify(saveData); } $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.flowEngine.task.history.settleCorrect, headers: { "token": $.cookie('ftoken') }, data: param, dataType: 'json', success: function (data) { if (data.status == "ok") { layer.msg("操作成功!", {icon: 1}); } else { layer.msg("操作失败!" + data.message, {icon: 1}); } }, error: function (msg) { layer.msg("操作失败!", {icon: 2}); } }); } /** * 获取补正记录 * @param correctionRecordId * @returns */ function getCorrectionRecord(correctionRecordId) { var result = { success: false, data: null, reason: "" }; $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.flowEngine.task.history.findCorrectionRecordByKey, headers: { "token": $.cookie('ftoken') }, data: {correctionRecordId: correctionRecordId}, dataType: 'json', success: function (data) { if (data.status == "ok") { result.success = true; result.data = data.data; } else { result.reason = data.message; } }, error: function (msg) { result.reason = "获取补正信息失败"; } }); return result; } //新建项目未保存 function creatingProject() { var openMode = 'normal'; if ('searchproject' == referer) openMode = 'readonly'; var param = { flowId: _flowId, projectId: _projectId, create: create }; if (flowItemTypeId) { param.flowItemTypeId = flowItemTypeId; } $.ajax({ type: "POST", url: curserver + '/mvc/project/stateFlow.do', headers: { "token": $.cookie('ftoken') }, data: param, dataType: 'json', success: function (data) { if (data.formList && data.formList.length > 0) { formList = data.formList[0]; formId = formList.id; //请求XUI权限 queryXuiPrivilegeList(_flowId, formList.revisionid, data.role != null ? data.role.id : null, data.resourceState ? data.resourceState.id : null); } else { layer.msg("表单不存在!", {icon: 2}); return; } dataList = data; task = data.task; flowObjectId = task.flowObjectId; flowInstanceId = task ? data.task.instanceId : null; materialList = data.materialDirList ? data.materialDirList : []; formMgr = new ListFormMgr(null, null, formPanel, { flowId: _flowId, showTab: false, role: data.role, openMode: openMode, projectFormList: formList, onListLoaded: function (row, data, treegrid) { var rowsCount = 0; if ($.isArray(data)) { rowsCount = data.length; } else if (data.rows && $.isArray(data.rows)) { rowsCount = data.rows.length; } var dgHeight = rowsCount * 26 + 26; $(accordionDetail).accordion('select', 0); } }); isMeetingProject = data.activity.isMeetingProject; if (isMeetingProject && isMeetingProject == "condition") { var str = data.activity.requiredMeetingCondition; if (str) { try { meetingCondition = JSON.parse(str); } catch (e) { layer.msg("上会条件格式转换错误!", {icon: 2}); return; } } } /*if(data.map!=null) { document.title =data.map.bz_jbxx?data.map.bz_jbxx.ProjectName:null; SetXuiDatas(data.map); }*/ // ------------------------------------------------- create by zys 2020/3/10 start -------------------------------- if (version === '1.0' && task.name !== '申请') { var pathParam = getCurrentNewAttachmentPath("SP", uniquePath); rootPath = pathParam; loadMaterials(data.materialDirList, pathParam);//新建审批项目的附件路径不再保存到cookie中,而是绑定到请求路径上 } // ------------------------------------------------------------- end ------------------------------------------------------ else { attachmentFolderFips(); // 加载材料文件夹提示 var pathParam = getCurrentNewAttachmentPath("SP", uniquePath); loadMaterials(data.materialDirList, pathParam);//新建审批项目的附件路径不再保存到cookie中,而是绑定到请求路径上 } // attachmentFolderFips(); // 加载材料文件夹提示 loadFromSource(data.formList[0]);//加载表单 // FIXME: loadReportSource(data.reportList);//加载报表 // var pathParam = getCurrentNewAttachmentPath("SP",uniquePath); // loadMaterials(data.materialDirList,pathParam);//新建审批项目的附件路径不再保存到cookie中,而是绑定到请求路径上 $("#bodycontent").mCustomScrollbar({ theme: "minimal-dark", axis: "xy", scrollInertia: 200 }); updateSize(); setTimeout(function () { iFrameHeight(); }, 5000); //search_submit(); $('#mbSend').attr("disabled", "disabled"); $('#returned').attr("disabled", "disabled"); $('#mbFallBack').attr("disabled", "disabled"); $('#returnFile').attr("disabled", "disabled"); $('#graphicView').attr("disabled", "disabled"); $('#deletebtn').attr("disabled", "disabled"); $('#loadProject').attr("disabled", "disabled"); $('#copyProject').attr("disabled", "disabled"); $('#flowLog').attr("disabled", "disabled"); $('#prjectbtnSh').attr("disabled", "disabled"); $('#relatedCases').attr("disabled", "disabled"); $('#alterLog').attr("disabled", "disabled"); $('#meansbtn').attr("disabled", "disabled"); $('#lifeCircleBtn').attr("disabled", "disabled"); $('#projectTreebtn').attr("disabled", "disabled"); // ---------------------------------- 初建成果上报页面 ------------------------------------ displayBlock(task.name, data); if (projectid == null) { projectid = $("#projectId").val(); } if (projectid != null && projectid != 'null') { window.formMgr.loadCasecode(projectid); } if (_dockingid) { loadDockinglSystemData(_flowid, _dockingid); } /*if (create == '1' && _projectId != null) { getSxbmByProjectid(_projectId); }*/ } }); } //查看项目项目管理 function lookProjectManage() { state = true; var openMode = 'normal'; if ('searchproject' == referer) openMode = 'readonly'; var param = { id: _projectId, taskid: taskId }; if (flowItemTypeId) { param.flowItemTypeId = flowItemTypeId; } $.ajax({ type: "POST", url: curserver + global.modelctls.project.ManageDetail, headers: { "token": $.cookie('ftoken') }, data: param, success: function (data) { if (data.projectFormList && data.projectFormList.length > 0) { formList = data.projectFormList[0]; formId = formList.id; } else { layer.msg("表单不存在!", {icon: 2}); return; } dataList = data; task = data; flowInstanceId = data.project.flowInstanceId; flowObjectId = task.flowObjectId; projectReportList = data.projectReportList; project = data.project; projectid = data.project.id; formMgr = new ListFormMgr(projectid, taskId, formPanel, { flowId: data.project.flowid, showTab: false, projectFormList: formList, openMode: openMode, onListLoaded: function (row, data, treegrid) { var rowsCount = 0; if ($.isArray(data)) { rowsCount = data.length; } else if (data.rows && $.isArray(data.rows)) { rowsCount = data.rows.length; } var dgHeight = rowsCount * 26 + 26; $(accordionDetail).accordion('select', 0); } }); if (data.task && data.task.isFist == "yes") { isFist = true; } else { isFist = false; } loadFromSource(formList);//加载表单 loadReportSource(projectReportList);//加载报表 loadAttach(project.attachpath, data.projectMaterialDirList);//加载附件 } }); $(".div-document-content-right").find("button").css("display", "none"); if (projectType != null && projectType == "dealedproject") { $('#mbFallBack').hide(); $('#deleteBtn').hide(); $('#loadProject').hide(); } } //查看已办结的项目 function lookThroughProject() { state = true; var openMode = 'normal'; if ('searchproject' == referer) openMode = 'readonly'; XuiRights = "Readonly"; var param = { id: _projectId }; if (flowItemTypeId) { param.flowItemTypeId = flowItemTypeId; } $.ajax({ type: "POST", url: curserver + global.modelctls.project.detail, headers: { "token": $.cookie('ftoken') }, data: param, success: function (data) { if (data.projectFormList && data.projectFormList.length > 0) { formList = data.projectFormList[0]; formId = formList.id; } else { layer.msg("表单不存在!", {icon: 2}); return; } dataList = data; task = data; flowInstanceId = data.project.flowInstanceId; _flowId = data.project.flowid; flowObjectId = task.flowObjectId; projectReportList = data.projectReportList; project = data.project; projectid = data.project.id; formMgr = new ListFormMgr(projectid, null, formPanel, { flowId: data.project.flowid, showTab: false, projectFormList: formList, openMode: openMode, onListLoaded: function (row, data, treegrid) { var rowsCount = 0; if ($.isArray(data)) { rowsCount = data.length; } else if (data.rows && $.isArray(data.rows)) { rowsCount = data.rows.length; } var dgHeight = rowsCount * 26 + 26; $(accordionDetail).accordion('select', 0); } }); if (data.task && data.task.isFist == "yes") { isFist = true; } else { isFist = false; } loadFromSource(formList);//加载表单 // FIXME: loadReportSource(projectReportList);//加载报表 // -------------------------------------- create by zys 2020/3/11 ------------------------------------- // ---------------------------- FIXME:进度信息 当前环节名称 ---------------------------- // ------------------------------------ 接口获取当前已办环节名称 --------------------------- $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/bz/getYbXmXq?pid=' + projectid + '&userId=' + userid, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { flowObjectName = res.data.ACT_NAME_; flowObjectId = res.data.ACT_ID_; var flowId1 = 't1001_4028d839710f68d101710f8b74ad0006' var hjArr = []; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getFlowObjectIds?flowId=' + flowId1, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 hjArr = res.data; } else { console.log("查询当前流程的所有环节失败"); } }, error: function (e) { console.log("查询当前流程的所有环节失败"); } }); if (_flowId == 't1001_4028d83970955d2a01709577b3870018') {//判断是不是数据申请流程 rootPath = project.attachpath; loadMaterialsNew(res.data); $("#project_saveSuggest").css("display", "none"); $("#pro_csyj").css("display", "none"); $("#project_textarea_cs").css("display", "none"); $(".suggest-container").css("border", "0px solid red"); } else { loadAttach(project.attachpath, data.projectMaterialDirList);//加载附件 $("#delebtn").remove(); $("#onlineEditingId").remove(); $("#uploadFile").remove(); $("#createFolder").remove(); $("#AxisMapOther").remove(); $("#AxisMap").remove(); $("#pro_ywxt_csyj").remove(); $("#project_ywxt_textarea_cs").remove(); $("#project_ywxt_saveSuggest").remove(); } displayBlock(flowObjectName, project, true); } else { //layer.msg("没有上传文件!"); return false; } } }); } }); $(".div-document-content-right").find("button").css("display", "none"); if (projectType != null && projectType == "dealedproject") { $('#mbFallBack').hide(); $('#deleteBtn').hide(); $('#loadProject').hide(); } } //正在运行的项目 function dealingProject() { state = false; var openMode = 'normal'; if ('searchproject' == referer) openMode = 'readonly'; var param = { taskid: taskId, flowRevisionId: _flowRevisionId, flowItemType: flowItemTypeId }; $.ajax({ type: "POST", url: curserver + global.modelctls.project.task.resource, headers: { "token": $.cookie('ftoken') }, data: param, dataType: 'json', success: function (data) { _flowname = data.flowduration ? data.flowduration.NAME : ''; if (!data.project) { layer.msg("项目不存在!", {icon: 2}); return; } //计算办结日期 var time = data.project.starttime; time = time ? time + parseInt(data.flowduration ? data.flowduration.DURATION : "") * 24 * 60 * 60 * 100 : ''; _finishtime = time ? new Date(time).format("yyyy年MM月dd日") : ''; dataList = data; task = data.task; project = data.project; projectid = project.id; _flowId = project.flowid; aloneInputCoord = data.activity.aloneInputCoord; if (task.state == "true") { $("#suspension")[0].lastChild.data = "恢复"; } else { $("#suspension")[0].lastChild.data = "挂起"; } if (data.projectFormList && data.projectFormList.length > 0) { formList = data.projectFormList[0]; formId = formList.id; queryXuiPrivilegeList(_flowId, formList.revisionid, dataList.role == null ? '' : dataList.role.id, data.state ? data.state.id : null); } else { layer.msg("表单不存在!", {icon: 2}); return; } if (data.task.isFist == "yes") { isFist = true; } else { isFist = false; } projectReportList = data.projectReportList; activityid = data.activity.id; //查询权限 formMgr = new ListFormMgr(project.id, taskId, formPanel, { flowId: project.flowid, showTab: false, role: data.role, state: data.state, projectFormList: formList, flowInstanceId: project.flowInstanceId, flowObjectId: task.flowObjectId, openMode: openMode, taskResouce: data, onListLoaded: function (row, data, treegrid) { var rowsCount = 0; if ($.isArray(data)) { rowsCount = data.length; } else if (data.rows && $.isArray(data.rows)) { rowsCount = data.rows.length; } var dgHeight = rowsCount * 26 + 26; // $('#formInfo').panel('resize', { height: dgHeight + 28 }); $(accordionDetail).accordion('select', 0); } }); flowId = project.flowid; reports = data.projectReportList; materialList = data.projectMaterialDirList; canSelfTurning = data.activity.canSelfTurning; flowObjectName = data.activity.flowObjectName; flowInstanceId = project.flowInstanceId; flowObjectId = task.flowObjectId; oldAttachpath = project.attachpath; isMeetingProject = data.activity.isMeetingProject; if (isMeetingProject && isMeetingProject == "condition") { var str = data.activity.requiredMeetingCondition; if (str) { try { meetingCondition = JSON.parse(str); } catch (e) { layer.msg("上会条件格式转换错误!", {icon: 2}); return; } } } if (project.status == "上会") ismeeting = true; if (oldAttachpath == null) $.cookie("uuid", null); // attachmentFolderFips(); loadFromSource(formList);//加载表单 // FIXME: loadReportSource(projectReportList);//加载报表 // ------------------------------------------------- create by zys 2020/3/10 start -------------------------------- var flowId1 = 't1001_4028d839710f68d101710f8b74ad0006'//通过flowId查询数据申请的所有环节id var hjArr = []; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getFlowObjectIds?flowId=' + flowId1, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 hjArr = res.data; } else { console.log("查询当前流程的所有环节失败"); } }, error: function (e) { console.log("查询当前流程的所有环节失败"); } }); if (_flowId == 't1001_4028d83970955d2a01709577b3870018') { rootPath = project.attachpath; loadMaterialsNew(flowObjectName); } else if (_flowId == 't1001_4028d839710f68d101710f8b74ad0006') { rootPath = project.attachpath; loadAttach(project.attachpath, data.projectMaterialDirList);//加载附件 } // ------------------------------------------------------------- end ------------------------------------------------------ else { if (create != "1") { loadAttach(project.attachpath, data.projectMaterialDirList);//加载附件 } else { var pathParam = getCurrentNewAttachmentPath("SP", uniquePath); loadMaterials(data.projectMaterialDirList, pathParam);//自动创建阶段的材料的文件夹 } } $("#bodycontent").mCustomScrollbar({ theme: "minimal-dark", axis: "xy", scrollInertia: 200 }); $("#reportDiv").mCustomScrollbar({theme: "minimal-dark", scrollInertia: 200}); // FIXME: // eventinit(); // ------------------- create by zys 2020/3/5----------------- displayBlock(flowObjectName, project); uploadBtnNone(); } }); //已保存的项目进入详情页加载上传资料数据 loadUploadFileDate(); } function loadUploadFileDate() { if (_projectId != null && _projectId != '' && _projectId != "undefinded") { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/fj/getFjList?id=' + _projectId, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { // 表单项目名称赋值 /*if (rename) { setTimeout(function () { var _iframXmmc = _iframe.contentDocument.getElementById('importResult').getElementsByTagName("input")[0]; if (_iframXmmc.value !== '') { _iframXmmc.value = ''; } _iframXmmc.value = res.data.name; }, 200); }*/ fileListBack = res.data; /*parent.imgArrSrc = []; let _data = fjDataFormat([res.data]); dtree.reload("project_fjTree", { data: _data, done: function (data, obj, first) { if (first) { selectedNodeId && dtree.dataInit("project_fjTree", selectedNodeId); // 选中 } $('.dtree').on('click', '.dtree-optbtn', function (e) { if (e.stopPropagation) { e.stopPropagation(); } else { e.cancelBubble = true; } let resOpt = dtree.getParam('project_fjTree', $(this).data('id')); let _opt = $(this).data('node'); if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); return; } }); setTimeout(() => { layer.closeAll(); }, 1000); } });*/ } else { this.error() } }, error: function (e) { console.log("你还没有导入文件"); } }); } } function createNumber() { formMgr._createNumber(); } function GetDataCompeletedToSet() { return new Promise(function (resolve, reject) { _timerIdSetXuiData = null; if (XuiData) { SetXuiDatas(XuiData).then(resolve); } else { //数据未加载成功 使用定时器 _timerIdSetXuiData = self.setInterval(function () { if (XuiData) { SetXuiDatas(XuiData).then(resolve); } }); } }) } function OnXuiLoadCompeleted() { SetXuiRight(XuiRights, true); //加载数据 加载权限 /*if(_stats == "projecting"){ GetDataCompeletedToSet(); }else if(_stats == "dealedproject") { GetDataCompeletedToSet(); }else if(_stats == "create") { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if(fwin && fwin.formMgr) { console.log("设置XUI数据"); if(dataList.map){ formMgr._initializeData(dataList.map); }else{ formMgr._initializeData(null); } formMgr.updateDataToUI(); } // createNumber(); }else if(_stats == "Manage") { GetDataCompeletedToSet(); }else if(_stats == "search") { GetDataCompeletedToSet(); }else{//_stats == "projectLifeCircle" GetDataCompeletedToSet(); }*/ if (_stats == "create") { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin.formMgr) { console.log("设置XUI数据"); if (dataList.map) { formMgr._initializeData(dataList.map); } else { formMgr._initializeData(null); } formMgr.updateDataToUI(); console.log('xui数据设置完毕'); } } else { GetDataCompeletedToSet().then(function () { console.log('xui数据设置完毕'); _tagvarMethodMaterial(); }) } console.log("XUI界面加载完毕"); } /** * 判断指定材料袋是否含有附件,并自动勾选。 * 有附件:勾选’有‘。无附件:勾选’无‘ * 指定材料袋在后台表单设计-附加对象配置 * 附加对象:{material:材料袋名称} */ function _tagvarMethodMaterial() { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin._tagvarMethod) { // 请求项目根目录文件 ftpfilelist2({target: rootPath ? rootPath : getCurrentNewAttachmentPath("SP", uniquePath)}).then(function (result) { result && fwin._tagvarMethod.material(result.fileInfolist); v2FileListBack = result.fileInfolist; }) } if (successCallBack !== _tagvarMethodMaterial) { successCallBack = _tagvarMethodMaterial; } } successCallBack = _tagvarMethodMaterial; function getXuiContentDate(_projectId) { //TODO 获取数据库表单的数据 $.ajax({ type: "POST", async: true, url: curserver + global.modelctls.project.data.get, headers: { "token": $.cookie('ftoken') }, data: {projectId: _projectId}, dataType: 'json', success: function (data) { XuiData = data; if (create == '1') { if (XuiData.bz_jbxx && XuiData.bz_jbxx.RegisterTime == null) { XuiData.bz_jbxx.RegisterTime = global.datefmt(new Date()); } } if (document.title == "" || document.title == undefined) { document.title = data.bz_jbxx.ProjectName; if (document.title == "" || document.title == "null") { document.title = "无标题"; } } console.log("getXuiContentDate请求完成"); console.log(XuiData); isTheFirstFlow(); }, error: function (e) { console.error('加载项目数据失败!'); console.error(e); } }); } function SetXuiDatas(xuiDatas) { return new Promise(function (resolve, reject) { if (_timerIdSetXuiData) { //数据加载成功 clearInterval(_timerIdSetXuiData); } var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin.formMgr && xuiDatas) { console.log("设置XUI数据"); formMgr._initializeData(xuiDatas); formMgr.updateDataToUI(); // createNumber(); // setIframeSrc(cardNumber); resolve(); } else { console.log("使用定时器设置XUI数据"); _timerIdSetXuiData = self.setInterval(function () { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin.formMgr && xuiDatas) { formMgr._initializeData(xuiDatas); formMgr.updateDataToUI(); /*if(!create) { createNumber(); }*/ clearInterval(_timerIdSetXuiData); resolve(); } }, _timeMillisec ); } }) } function queryXuiPrivilegeList(flowId, revisionid, roleId, statusId) { var group = 'FlowForm;' + flowId + ';' + (revisionid); var role = roleId; var state = statusId; var cacheXuiListPrivilege = null; if (window.globalLocalCache) { cacheXuiListPrivilege = window.globalLocalCache.GetCacheResult( curserver + global.modelctls.privilege.listrun, {group: group, role: role, state: state}, ""); } if (cacheXuiListPrivilege) { XuiRights = cacheXuiListPrivilege; return; } $.ajax({ type: "POST", url: curserver + global.modelctls.privilege.listrun, headers: { "token": $.cookie('ftoken') }, async: true, data: {group: group, role: role, state: state}, dataType: 'json', success: function (data) { XuiRights = data; console.log("queryXuiPrivilegeList请求完成,开始设置XUI权限"); console.log(XuiRights); if (window.globalLocalCache) { cacheXuiListPrivilege = window.globalLocalCache.AddCache( curserver + global.modelctls.privilege.listrun, {group: group, role: role, state: state}, "", data); } }, error: function (e) { } }); }; function SetXuiRight(xuiRights, needToWait) { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin.formMgr && XuiRights) { console.log("设置XUI权限"); fwin.formMgr.setRight(XuiRights); return; } console.log("使用定时器设置XUI权限"); _timerIdSetXuiPrivilege = self.setInterval(function () { var iframe = formMgr._getCurrentFormFrame(0); var fwin = iframe.contentWindow; if (fwin && fwin.formMgr && XuiRights) { if (XuiRights == "Readonly") { fwin.formMgr.setRight(null); } else { fwin.formMgr.setRight(XuiRights); } console.log("XUI权限设置完成"); clearInterval(_timerIdSetXuiPrivilege); return; } else { console.log("设置XUI权限,但是XUI界面未加载完成"); } }, _timeMillisec ); } function boolIsRead(flowInstanceId) { var bool = true; $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.hisacInstance, headers: { "token": $.cookie('ftoken') }, async: true, data: {instanceId: flowInstanceId}, dataType: 'json', success: function (data) { $.ajax({ type: "POST", url: curserver + global.modelctls.user.loginInfo, headers: { "token": $.cookie('ftoken') }, async: true, dataType: 'json', success: function (result) { var loginname = result.data.user.loginname; if (data.length > 0) { var obj_hisActiviti = data[data.length - 1]; if (obj_hisActiviti.operation == "结束") { bool = false; } else { var revicer = obj_hisActiviti.revicer; var revicerArr = revicer.split(","); for (var j = 0; j < revicerArr.length; j++) { if (revicerArr[j] == loginname) { bool = false; } } } if (bool == false && $('#stats').val() == "dealedproject") updateIsRead(flowInstanceId, "read"); if (bool == false && $('#stats').val() == "projecting") updateIsRead(flowInstanceId, "read"); } } }); } }); } //更新为已读 function updateIsRead(flowInstanceId, isread) { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.isread, headers: { "token": $.cookie('ftoken') }, async: true, data: {instanceId: flowInstanceId, read: isread}, success: function (data) { } }); } //获取流程信息 function getFlowInfo(flowInstanceId) { var flag = false; //先获取流程的所有环节 $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.firstFlowImagePosition, headers: { "token": $.cookie('ftoken') }, async: true, data: {instanceId: flowInstanceId}, success: function (data) { flowInfo = data.flowObjectList; console.log("getFlowInfo请求完成"); console.log(flowInfo); } }); } //判断当前环节是否为第一环节 function isTheFirstFlow() { var time = setInterval(function () { if (isFist != undefined && isFist != "undefined") { if (isFist) { if (URLStats != "Manage") { $('#mbFallBack').attr("disabled", "disabled"); $('#returnFile').attr("disabled", "disabled"); $('#returned').attr("disabled", "disabled"); } /*if(XuiData.bz_spyj && XuiData.bz_spyj.TJYJ != null){ $("#mbSend").attr("disabled","disabled"); }*/ clearInterval(time); } else { if (URLStats != "Manage" && URLStats == "dealedproject" || URLStats != "Manage" && URLStats == "search") { $('#mbFallBack').attr("disabled", "disabled"); $('#returnFile').attr("disabled", "disabled"); $('#returned').attr("disabled", "disabled"); } clearInterval(time); } } }, 500); } //加载附件函数 function loadAttach(attachpath, projectMaterialDirList) { if (attachpath != undefined || attachpath != null) { rootPath = attachpath; var docpaths = attachpath.split("/"); $.cookie("uuid", docpaths[1]); loadAttachment2(attachpath, projectMaterialDirList); } else { if (_stats == "dealedproject" || _stats == "search") { node = $(".div-attachment"); node.css("height", "auto"); node.css("overflow", "hidden"); $("#divNoAttachment").css("display", "none"); $("#noAttachment").css("display", "block"); } else { node = $(".div-attachment"); node.css("height", "auto"); node.css("overflow", "hidden"); $("#divNoAttachment").css("display", "block"); $("#noAttachment").css("display", "none"); } } } function checkMaterial() { var flag = false; if (materialList != null && materialList.length != 0) { flag = true; } return flag; } //添加点击事件 function clickEvent() { $("#report_div ul li").click(function () { var report = $(this).find("input").val(); var reportalias = $(this).find("#alias").val(); var url = ""; if (reportalias.substr(reportalias.indexOf(".")) == ".jsp") { url = txtRepory + "/reportjsp/" + reportalias + "?&projectid=" + projectid; } else { report = encodeURI(encodeURI(report)); url = txtShowListUrl + report + "&projectid=" + projectid; } window.open(url); }); /*发送成功后手动关闭当前页*/ $('#close').click(function () { closewindowtab(); }); } //调整iframe高度,谷歌浏览器可用,IE不可用 function iFrameHeight(height) { var ifm = $("#formPanel iframe")[0]; if (ifm != null) { //var ifmHeight = 690; //try { // ifmHeight = ifm.contentDocument.body.scrollHeight; //} catch (e) { //} //if(ifmHeight==0){ var ifmHeight = ifmHeight = height; //} if (ifmHeight == 0) { ifmHeight = 1000 } $(ifm).css("height", ifmHeight + "px"); $("#formPanel").css("height", (ifmHeight + 16) + "px"); } $.hideLoading(); } $(window).resize(function () { updateSize(); }); function updateSize() { $("#bodycontent").css("height", window.innerHeight); } /* * hy 2017-09-7修改 */ $(window).unload(function () { console.log("更新编号"); //新建不保存更新编号 if (create == '0' || create == '1') { if (isbtnSave == false) { var numberArr = []; var data = window.formMgr.getData() if (JSON.stringify(data) != "{}" && JSON.stringify(data) != "null" && data != null) { var ProjectCode = data.bz_jbxx.ProjectCode var CaseCode = data.bz_jbxx.CaseCode if (ProjectCode && ProjectCode != "") { numberArr.push(ProjectCode); } if (CaseCode && CaseCode != "") { numberArr.push(CaseCode); } var numbers = numberArr.join(); if (unitid) { $.ajax({ type: "POST", async: false, url: curserver + '/mvc/number/rule/number/upSpNumber.do', headers: { "token": $.cookie('ftoken') }, data: {numbers: numbers, unitid: unitid}, success: function (result) { console.log(result); }, error: function (err) { console.log(err); } }); } else { layer.msg("更新编号失败,用户所属单位不存在,请联系管理员!", {icon: 7}); return; } } } } if ($('#stats').val() != "create") { //刷新父页面 window.opener.openRefreshList(); } else if ($('#stats').val() == "projecting") { } }); function loadTaskCommand(stats) { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.command, headers: { "token": $.cookie('ftoken') }, data: {taskid: taskId}, success: function (result) { result = result || []; for (var i = 0; i < result.length; i++) { var cmd = result[i]; if (cmd.type == global.enums.sendType.SActivitySUser || cmd.type == global.enums.sendType.SActivityMUser || cmd.type == global.enums.sendType.MActivitySUser || cmd.type == global.enums.sendType.MActivityMUser || cmd.type == global.enums.sendType.SendDefault) { sendCmd = cmd; break; } else if (cmd.type == 'FallBack') { $('#mbFallBack').removeAttr("disabled"); } } if (!sendCmd) { sendCmd = { type: global.enums.sendType.SActivitySUser, alias: '发送' }; } if (create != '0') { $('#mbFallBack').removeAttr("disabled"); if (!ismeeting) $('#mbSend').removeAttr("disabled"); } } }); } /** * 更新生成的文号为在用 */ function updateNumbers() { if (create_numbers == undefined) { return; } $.ajax({ type: "POST", url: curserver + global.modelctls.numberRule.number.update, headers: { "token": $.cookie('ftoken') }, data: {numbers: create_numbers}, success: function (data) { } }); } //yxt 20180326 比较数据 返回有差异的表 找出做出修改的表及其字段 以及对应的旧数据 function compareDatas(newDatas, oldDatas) { var retDatas = {}; if (!newDatas && oldDatas) { retDatas.newDatas = oldDatas; retDatas.oldDatas = oldDatas; return retDatas; } else if (newDatas && !oldDatas) { retDatas.newDatas = newDatas; retDatas.oldDatas = newDatas; return retDatas; } var needUpdateNews = null; var needUpdateOlds = null; for (var tableName in newDatas) { if (!newDatas[tableName] || tableName == "bz_return_opinion") { continue;//新数据 表为空 没有挂该表 认为没有修改 不需要更新 } if (!oldDatas[tableName]) { //旧数据没有值 认为有修改 需要更新 if (!needUpdateNews) { needUpdateNews = {}; } if (!needUpdateOlds) { needUpdateOlds = {}; } console.log("findDifference(NewDatas:" + tableName + "=" + newDatas[tableName] + "OldDatas:" + tableName + "=null)"); if (!needUpdateNews.hasOwnProperty(tableName)) { needUpdateNews[tableName] = {}; } if (!needUpdateOlds.hasOwnProperty(tableName)) { needUpdateOlds[tableName] = {}; } needUpdateNews[tableName] = newDatas[tableName]; needUpdateOlds[tableName] = null; continue;// } if (tableName == 'loginUserUnit' || tableName == 'numbers') { //单独判断 var newValue = newDatas[tableName]; var oldValue = oldDatas[tableName]; if (oldValue != newValue) { //一般类型 if (!needUpdateNews) { needUpdateNews = {}; } if (!needUpdateOlds) { needUpdateOlds = {}; } if (!needUpdateNews.hasOwnProperty(tableName)) { needUpdateNews[tableName] = {}; } if (!needUpdateOlds.hasOwnProperty(tableName)) { needUpdateOlds[tableName] = {}; } needUpdateNews[tableName] = newValue; needUpdateOlds[tableName] = oldValue; console.log("findDifference(NewDatas:" + needUpdateNews[tableName] + "OldDatas:" + needUpdateOlds[tableName] + ")"); } continue; } if (newDatas[tableName].constructor.name == 'Array') { if (oldDatas[tableName].constructor.name == 'Object') { var oldValue = oldDatas[tableName]; oldDatas[tableName] = []; oldDatas[tableName][0] = oldValue; } ////需要特殊处理网格数据 for (var index in newDatas[tableName]) { var newItems = newDatas[tableName][index]; for (var fieldName in newItems) { var newValue = newItems[fieldName]; var oldValue = oldDatas[tableName].hasOwnProperty(index) ? oldDatas[tableName][index].hasOwnProperty(fieldName) ? oldDatas[tableName][index][fieldName] : null : oldDatas[tableName].hasOwnProperty(fieldName) ? oldDatas[tableName][fieldName] : null; if (!oldValue && newValue == "") { delete newItems[fieldName][fieldName]; delete oldDatas[tableName][fieldName]; continue;//旧数据为null 新数据为 "" 认为是相等的 不需要更新 } if (oldValue != newValue) { if (newDatas[tableName]) { if (needUpdateNews != null) { needUpdateNews[tableName] = newDatas[tableName]; } else { needUpdateNews = {}; needUpdateNews[tableName] = newDatas[tableName]; } } else { needUpdateNews = {}; } if (oldDatas[tableName]) { if (needUpdateOlds != null) { needUpdateOlds[tableName] = oldDatas[tableName]; } else { needUpdateOlds = {}; needUpdateOlds[tableName] = oldDatas[tableName]; } } else { needUpdateOlds = {}; } //一般类型 if (!needUpdateNews.hasOwnProperty(tableName)) { needUpdateNews[tableName] = new Array(); } if (!needUpdateOlds.hasOwnProperty(tableName)) { needUpdateOlds[tableName] = new Array(); } if (!(needUpdateNews[tableName][index])) { needUpdateNews[tableName][index] = {}; } if (!(needUpdateOlds[tableName][index])) { needUpdateOlds[tableName][index] = {}; } if (!(needUpdateNews[tableName][index][fieldName])) { needUpdateNews[tableName][index][fieldName] = {}; } if (!(needUpdateOlds[tableName][index][fieldName])) { needUpdateOlds[tableName][index][fieldName] = {}; } needUpdateNews[tableName][index][fieldName] = newValue; needUpdateOlds[tableName][index][fieldName] = oldValue; } } } //如果有差异 在第一个数组元素中添加ID if (needUpdateNews && needUpdateNews.hasOwnProperty(tableName)) { if (newDatas[tableName][0]["id"]) { needUpdateNews[tableName][0]["id"] = newDatas[tableName][0]["id"]; needUpdateOlds[tableName][0]["id"] = newDatas[tableName][0]["id"]; } else if (newDatas[tableName][0]["Id"]) { needUpdateNews[tableName][0]["Id"] = newDatas[tableName][0]["Id"]; needUpdateOlds[tableName][0]["Id"] = newDatas[tableName][0]["Id"]; } } continue; } for (var fieldName in newDatas[tableName]) { var newValue = newDatas[tableName][fieldName]; var oldValue = oldDatas[tableName].hasOwnProperty(fieldName) ? oldDatas[tableName][fieldName] : null; if (!oldValue && newValue == null || oldValue == null && !newValue) { delete newDatas[tableName][fieldName]; delete oldDatas[tableName][fieldName]; continue;//旧数据为null 新数据为 "" 认为是相等的 不需要更新 } if (oldValue != newValue) { //一般类型 if (!needUpdateNews) { needUpdateNews = {}; } if (!needUpdateOlds) { needUpdateOlds = {}; } if (!needUpdateNews.hasOwnProperty(tableName)) { needUpdateNews[tableName] = {}; } if (!needUpdateOlds.hasOwnProperty(tableName)) { needUpdateOlds[tableName] = {}; } needUpdateNews[tableName][fieldName] = {}; needUpdateNews[tableName][fieldName] = newValue; needUpdateOlds[tableName][fieldName] = {}; needUpdateOlds[tableName][fieldName] = oldValue; console.log("findDifference(NewDatas:" + tableName + "." + fieldName + "=" + newDatas[tableName][fieldName] + "OldDatas:" + tableName + "." + fieldName + "=" + oldDatas[tableName][fieldName] + ")"); } } //如果有差异 需要添加ID if (needUpdateNews && needUpdateNews.hasOwnProperty(tableName)) { if (newDatas[tableName]["id"]) { needUpdateNews[tableName]["id"] = newDatas[tableName]["id"]; needUpdateOlds[tableName]["id"] = newDatas[tableName]["id"]; } else if (newDatas[tableName]["Id"]) { needUpdateNews[tableName]["Id"] = newDatas[tableName]["Id"]; needUpdateOlds[tableName]["Id"] = newDatas[tableName]["Id"]; } else if (newDatas[tableName].constructor.name == 'Array' && newDatas[tableName][0]["id"]) { needUpdateNews[tableName][needUpdateNews[tableName].length - 1]["id"] = newDatas[tableName][0]["id"]; needUpdateNews[tableName][needUpdateNews[tableName].length - 1]["id"] = newDatas[tableName][0]["id"]; } else if (newDatas[tableName].constructor.name == 'Array' && newDatas[tableName][0]["Id"]) { needUpdateNews[tableName][needUpdateNews[tableName].length - 1]["Id"] = newDatas[tableName][0]["Id"]; needUpdateNews[tableName][needUpdateNews[tableName].length - 1]["Id"] = newDatas[tableName][0]["Id"]; } } } retDatas.newDatas = needUpdateNews; retDatas.oldDatas = needUpdateOlds; console.log(retDatas); return retDatas; } /** * 保存项目 */ var isRe = null; var saveprojectLoading = null; function saveproject(sendInfos, index, layero) { $(this).ajaxStart(function () { saveprojectLoading = layer.msg('正在处理,请稍后...', {icon: 16}); }); //xui表单权限 10.31 632行url添加role参数 var roleid = null; var role = getQueryVariable("role"); if (role) { roleid = role } ; if (window.formMgr == undefined) return; var beforeModifiedData = window.formMgr.getData(); // var curDatas =window.formMgr.getData(); // XuiData =window.formMgr.getData(); //yxt 20180326 var curDatas = newData = window.formMgr.getDataJson(); curDatas = JSON.parse(curDatas); //与XuiData进行比较 var retDatas = compareDatas(curDatas, XuiData); var array = retDatas.newDatas; var message; var needToSave = true; if (!retDatas.oldDatas && !retDatas.newDatas) { needToSave = false; if (sendInfos) { switch (sendInfos) { case '发送': projectSend(projectid, retDatas.newDatas, retDatas.oldDatas, index, layero); break; case '改派': reassignment(projectid, retDatas.newDatas, retDatas.oldDatas, index, layero); break; case '回退': projectRollback(projectid, retDatas.newDatas, retDatas.oldDatas, index, layero); break; case '退件': decline(projectid, retDatas.newDatas, retDatas.oldDatas, index, layero); break; case '完成补正': endCorrectProject(projectid, retDatas.newDatas, retDatas.oldDatas); break; } return; } else { layer.msg("没有进行修改,不需要进行保存!", {icon: 2}); return; } } var olddata = null; var newData = null; //获取表单上的旧数据字符串 olddata = JSON.stringify(retDatas.oldDatas); //获取最新表单上的数据(修改后的数据) newData = JSON.stringify(retDatas.newDatas); if (create == '0' && !sendInfos || create == "1" && !sendInfos) { return createProject(newData); } else { switch (sendInfos) { case '发送': projectSend(projectid, newData, olddata, index, layero); break; case '改派': reassignment(projectid, newData, olddata, index, layero); break; case '回退': projectRollback(projectid, newData, olddata, index, layero); break; case '退件': decline(projectid, newData, olddata, index, layero); break; case '完成补正': endCorrectProject(projectid, newData, olddata); break; default: return saveProjectData(projectid, newData, olddata); break; } } // updateApproveIndex(projectid); $(window).unbind('beforeunload'); return true; } window.saveUpSpNumber = function () { var numberArr = []; var data = window.formMgr.getData(); if (JSON.stringify(data) != "{}") { var ProjectCode = data.bz_jbxx.ProjectCode var CaseCode = data.bz_jbxx.CaseCode if (ProjectCode != undefined) { numberArr.push(ProjectCode); } if (CaseCode != undefined) { numberArr.push(CaseCode); } var numbers = numberArr.join(); $.ajax({ type: "POST", url: curserver + '/mvc/number/rule/number/saveUpSpNumber.do', headers: { "token": $.cookie('ftoken') }, data: {numbers: numbers, unitid: unitid}, success: function (result) { } }); } } //input事件初始化 function eventinit(input_ctl) { //根据事件判断是否已经填入并修改样式 $(input_ctl).blur(function () { var value = $(input_ctl).val(); var par = $(this).parent().parent().parent().parent().parent(); if (value != "") { // alert(flowObjectName); //par.css("border","solid #FF0000 0px"); $(this).css("border", "solid #FF0000 0px"); } else { $(this).css("border", "solid #FF0000 1px"); // $(this).parent().css("border","solid #FF0000 1px"); } }); } function getcanSelfTurningData() { var data = { canSelfTurning: canSelfTurning, flowObjectName: flowObjectName, flowObjectId: flowObjectId, projectId: projectid }; return data; } /*检查必填字段是否已填*/ function isRequired(newData) { var bool = true; $.ajax({ type: "POST", url: curserver + global.modelctls.forms.isRequired, async: false, headers: { "token": $.cookie('ftoken') }, data: {newData: newData, formId: formId}, success: function (result) { var ifm = $("#formPanel iframe")[0]; if (result != "") { bool = false; var columnName = null; var requiredColumn = result.split(","); var ctl = null; //必填的字段若没有填写 红框提示 for (var i = 0; i < requiredColumn.length; i++) { columnName = requiredColumn[i]; if (columnName == "") continue; ctl = $(ifm).contents().find("." + columnName); //ctl.css("border","solid #FF0000 1px"); var input_ctl = $(ctl).find("input"); input_ctl.css("border", "solid #FF0000 1px"); //初始化移除焦点事件 eventinit(input_ctl); } } } }); return bool; } //获取最新form表单数据的json对象 function getNewData() { var newjson = JSON.parse(window.formMgr.getDataJson()); return newjson; } /** * 根据前后数据的对比进行相应的保存 * @param newData * @param beforeModifiedData */ function savelog(newData, olddata, sendInfos, projectId, index, layero) { var newDataObj = JSON.parse(newData); var olddataObj = JSON.parse(olddata); if (!newDataObj && !olddataObj) { //window.formMgr.saveData(sendInfos,projectId,index,layero); window.formMgr.allOperater(sendInfos, projectId, index, layero); return; } $.ajax({ type: "POST", async: true, url: curserver + global.modelctls.forms.savelog, headers: { "token": $.cookie('ftoken') }, data: {newData: newData, oldData: olddata, pid: projectid}, success: function (result) { if (result != "sucess") { $("#tloading").remove(); layer.msg("本次数据更新出现异常,请重新执行保存操作!"); } else { if (state == true) { window.formMgr.saveData(sendInfos, projectid, index); } else { window.formMgr.saveData(sendInfos, projectId, index, layero); } } beforeModifiedData = JSON.parse(newData); } }); } /** * 回退任务 */ function mbFallBack() { beforeModifiedData = window.formMgr.getData(); if (typeof (beforeModifiedData.bz_return_opinion) == 'undefined') { layer.msg("'bz_return_opinion'回退意见表不存在!", { icon: 2, time: 1500, offset: '300px' }); return; } var btn = ""; if (isFist && URLStats == "projecting") { $('#htyjTextarea').attr("disabled", "disabled"); } else if (URLStats == "dealedproject" || URLStats == "search") { $('#htyjTextarea').attr("disabled", "disabled"); } var returnData = beforeModifiedData.bz_return_opinion; /*if(returnData!=null){ height='550px'; $("#htyjxx").css("height","260px"); if(returnData.length>0){ returnData.sort(function(a,b) { if(a.fd03>b.fd03){ return -1; }else if(a.fd03<b.fd03){ return 1; }else{ return 0; } }); for(i=0;i<returnData.length;i++){ aphtml+='<div style="font-size: 17px;color: black">'+returnData[i].fd02+'</div><div>'+returnData[i].fd05+'--->'+returnData[i].fd06+'</div><div>回退人:'+returnData[i].fd01+' | 所属科室:'+returnData[i].fd04+' | 时间:'+new Date(returnData[i].fd03).format("yyyy-MM-dd hh:mm:ss")+'</div><hr>'; } }else{ aphtml+='<div style="font-size: 17px;color: black">'+returnData.fd02+'</div><div>'+returnData.fd05+'--->'+returnData.fd06+'</div><div>回退人:'+returnData.fd01+' | 所属科室:'+returnData.fd04+' | 时间:'+new Date(returnData.fd03).format("yyyy-MM-dd hh:mm:ss")+'</div><hr>'; } $("#htyjxx").append(aphtml); }*/ layer.open({ type: 1, title: '回退意见框', shadeClose: true, shade: 0.3, area: ['600px', '300px'], scrollbar: false, content: $("#htyj"), btn: ['确认', '取消'], yes: function (index, layero) { htyjVal = $("#htyjTextarea").val(); if (htyjVal == null || htyjVal == "") { layer.msg("意见不能为空!", { icon: 2, time: 1500, offset: '300px' }); return false; } saveproject("回退", index, layero); action = "回退"; }, btn2: function (index, layero) { $("#htyjxx").children().remove(); }, cancel: function (index, layero) { $("#htyjxx").children().remove(); } }); } //根据操作更新当前公文的动作状态 function updateActionStatus() { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.updateActionStatus, async: false,//异步变同步,流程正常办结 yyl 20180108 headers: { "token": $.cookie('ftoken') }, data: {action: action, pid: projectid}, success: function (data) { } }); } /** * 结束当前实例(任务) */ function deleteProcessIns() { layer.open({ content: '确定删除该项目吗?', btn: ['确认', '取消'], shadeClose: true, icon: 3, yes: function () { if (taskId == null || taskId == 'null') { $(window).unbind('beforeunload'); layer.msg('成功删除项目', { icon: 1, time: 2000 //2秒关闭(如果不配置,默认是3秒) }, function () { window.close(); }); return; } $.ajax({ type: "POST", url: curserver + global.modelctls.project.deleteProject, headers: { "token": $.cookie('ftoken') }, data: {taskId: taskId, projectId: projectid}, success: function (result) { if (result.status == 'ok') { console.debug(result); global.main.closeTab('taskId_' + taskId); layer.msg("删除成功", { icon: 1, time: 1500, offset: '300px' }, function () { $(window).unbind('beforeunload'); window.close(); }); } else { console.info(result); layer.msg("删除失败", { icon: 2, time: 1500, offset: '300px' }, function () { }); } }, error: function (e) { layer.msg("HTTP请求失败,请检查网络!", { icon: 2, time: 1500, offset: '300px' }, function () { }); } }); layer.closeAll(); } }); } /** * 任务退件 */ function mbReject() { beforeModifiedData = window.formMgr.getData(); /* if (typeof (beforeModifiedData.bz_spyj) == 'undefined') { layer.msg("请填写审查意见", { icon: 2, time: 1500, offset: '300px' }); return; }*/ var sendTextarea = $("#sendTextarea"); /*if(URLStats=="Manage"){ sendTextarea.val(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJYJ==null?"":beforeModifiedData.bz_spyj.TJYJ:""); $("#tjrs").text("退件人:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJR==null?"":beforeModifiedData.bz_spyj.TJR:"") +" | 所属科室:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.SSKS==null?"":beforeModifiedData.bz_spyj.SSKS:"")+" | 退件时间:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJRQ==null?"":new Date(beforeModifiedData.bz_spyj.TJRQ).format("yyyy-MM-dd hh:mm:ss"):"")); sendTextarea.focus(); }else if(URLStats=="search" || URLStats=="dealedproject"){ sendTextarea.val(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJYJ==null?"":beforeModifiedData.bz_spyj.TJYJ:""); $("#tjrs").text("退件人:"+(beforeModifiedData.bz_spyj.TJR==null?"":beforeModifiedData.bz_spyj.TJR) +" | 所属科室:"+(beforeModifiedData.bz_spyj.SSKS==null?"":beforeModifiedData.bz_spyj.SSKS)+" | 退件时间:"+(beforeModifiedData.bz_spyj.TJRQ==null?"":new Date(beforeModifiedData.bz_spyj.TJRQ).format("yyyy-MM-dd hh:mm:ss"))); sendTextarea.attr("disabled","disabled"); }else{ if(beforeModifiedData.bz_spyj!=null){ if(beforeModifiedData.bz_spyj.TJYJ!=null) { sendTextarea.val(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJYJ==null?"":beforeModifiedData.bz_spyj.TJYJ:""); $("#tjrs").text("退件人:"+(beforeModifiedData.bz_spyj.TJR==null?"":beforeModifiedData.bz_spyj.TJR) +" | 所属科室:"+(beforeModifiedData.bz_spyj.SSKS==null?"":beforeModifiedData.bz_spyj.SSKS)+" | 退件时间:"+(beforeModifiedData.bz_spyj.TJRQ==null?"":new Date(beforeModifiedData.bz_spyj.TJRQ).format("yyyy-MM-dd hh:mm:ss"))); sendTextarea.attr("disabled","disabled"); }else { $("#tjrs").text("退件人:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJR==null?"":beforeModifiedData.bz_spyj.TJR:"") +" | 所属科室:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.SSKS==null?"":beforeModifiedData.bz_spyj.SSKS:"")+" | 退件时间:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJRQ==null?"":new Date(beforeModifiedData.bz_spyj.TJRQ).format("yyyy-MM-dd hh:mm:ss"):"")); } }else { $("#tjrs").text("退件人:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJR==null?"":beforeModifiedData.bz_spyj.TJR:"") +" | 所属科室:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.SSKS==null?"":beforeModifiedData.bz_spyj.SSKS:"")+" | 退件时间:"+(beforeModifiedData.bz_spyj?beforeModifiedData.bz_spyj.TJRQ==null?"":new Date(beforeModifiedData.bz_spyj.TJRQ).format("yyyy-MM-dd hh:mm:ss"):"")); sendTextarea.focus(); } }*/ sendTextarea.focus(); var layerop = { type: 1, title: '退件意见框', shadeClose: true, shade: 0.3, area: ['600px', '350px'], scrollbar: false, content: $("#sendDivs"), btn: ['确认', '取消'], yes: function (index, layero) { // var reportList=projectReportList; // var num=$(layero).find(".layui-layer-btn")[0].childNodes; /*rejectState=num[0].text; if(rejectState!="退件打印"){ var reportURL = cjkEncode(CONF_REPORTURL + CONF_RETURN_NOTICE+"&pid="+projectid); window.open(reportURL); return false; }*/ layer.confirm('退件代表此件作废,请谨慎操作!', { icon: 3, title: '提示', btn: ['确认', '取消'], btn1: function (index) { if (isFist) { layer.msg("第一环节无法退件", { icon: 2, time: 1500, offset: '300px' }, function () { }); return false; } if ($("#sendTextarea").val() == "") { layer.msg("退件意见不能为空!", { icon: 2, time: 1500, offset: '300px' }, function () { }); return false; } if (URLStats == "Manage" || URLStats != "search" && URLStats != "dealedproject") { $.ajax({ type: "POST", dataType: 'json', contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/apply/updateVersion/?pid=' + projectid, success: function (res) { console.log("修改成功") }, }) saveproject("退件", index, layero); //TODO:修改版本号 } else { return false; } }, btn2: function (index) { layer.closeAll(); return false; } }); } /*btn2 : function(index, layero) { if($("#sendTextarea").val()==""){ layer.msg("意见不能为空!", { icon: 2, time: 1500, offset: '300px' },function(){ }); return false; } if(URLStats=="Manage" || URLStats!="search" && URLStats!="dealedproject"){ saveproject("退件",index,layero); }else{ return false; } }*/ }; if (sendTextarea.attr("disabled") == "disabled") { // layerop.btn=['打印']; layerop.title = "退件框"; } layer.open(layerop); } /** * 图形浏览 */ function openlayer_GraphicBrowsing() { var PROJECTNAME = ""; var PROJECTNUM = ""; var PROJECTTYPE = ""; var PROJECTUNIT = ""; var PROJECT_STATUS = ""; var CREATEDATE = ""; var PROJECTADDRESS = ""; if (project) flowInstanceId = project.flowInstanceId; if (!projectid) projectid = _projectId; var url = global.contextPath + global.modelctls.projectGis.getGisProjectData; $.post(url, { projectId: projectid }, function (result) { if (result.status == 'ok') PROJECTNAME = result.data.PROJECTNAME == null ? "" : result.data.PROJECTNAME; PROJECTNUM = result.data.PROJECTNUM == null ? "" : result.data.PROJECTNUM; PROJECTTYPE = result.data.PROJECTTYPE == null ? "" : result.data.PROJECTTYPE; PROJECTUNIT = result.data.PROJECTUNIT == null ? "" : result.data.PROJECTUNIT; PROJECT_STATUS = result.data.TASKID == null ? "结束" : "在办"; CREATEDATE = result.data.CREATEDATE == null ? "" : result.data.CREATEDATE; PROJECTADDRESS = result.data.PROJECTADDRESS == null ? "" : result.data.PROJECTADDRESS; }); url = global.contextPath + '/projecttask/getGraphics/index.html?projectId=' + projectid + '&flowInstanceId=' + flowInstanceId + "&PROJECTNAME=" + PROJECTNAME + "&PROJECTNUM=" + PROJECTNUM + "&PROJECTTYPE=" + PROJECTTYPE + "&PROJECTUNIT=" + PROJECTUNIT + "&PROJECT_STATUS=" + PROJECT_STATUS + "&CREATEDATE=" + CREATEDATE + "&PROJECTADDRESS=" + PROJECTADDRESS + '&server=' + global.contextPath + '/'; // layer.open({ // type : 1, //page层 // area : [ '80%', '80%' ], // title : '图形浏览', // shade : 0.1, //遮罩透明度 // scrollbar : false, // moveType : 1, //拖拽风格,0是默认,1是传统拖动 // moveOut : true, // maxmin: true,//最大化最小化 // //shift: 1, //0-6的动画形式,-1不开启 // content : "<iframe src="+url+" style='height:100%;width:100%' name='getMapGraphics' id='getMapGraphics'></iframe>", //// content : url, // btn: ['保存','取消'], // yes: function(){ // var f = true; // var gisData = getGraphics(); // if(gisData == undefined||gisData == null){ // f = false; // }else{ // $.post(global.contextPath // + global.modelctls.projectGis.saveOrUpdateProjectGis, { // projectId : project.id, // flowInstanceId : project.flowInstanceId, // graphics : gisData // }, function(result) { // // }); // } // if(f){ // layer.confirm('保存成功', { // btn: ['确定'] // ,btn3: function(index, layero){ // } // }) // }else{ // layer.confirm('未选择位置信息', { // btn: ['确定'] // ,btn3: function(index, layero){ // } // }) // } // }, // end : function(index, layero) { // // } // }); } /** * 查看流程日志和图片 */ function openlayer_flowlog() { if (task.flowInstanceId) flowInstanceId = task.flowInstanceId; if (state) var url = global.contextPath + '/view/projecttask/flowlog.jsp?flowInstanceId=' + flowInstanceId; else var url = global.contextPath + '/view/projecttask/flowlog.jsp?flowInstanceId=' + flowInstanceId; layer.open({ type: 2, //page层 area: ['80%', '90%'], title: '流程日志', shadeClose: true, shade: 0.6, //遮罩透明度 moveType: 1, //拖拽风格,0是默认,1是传统拖动 moveOut: true, scrollbar: false, //shift: 1, //0-6的动画形式,-1不开启 content: url }); } //获取相关案件 function openlayer_related() { var title = _title ? encodeURI(_title) : ''; var url = CONF_FRONT_SERVERURL + 'view/projecttask/relatedCase.jsp?text=' + title; layer.open({ type: 2, //page层 area: ['80%', '90%'], // offset : '10px', title: '相关资料', shade: 0.6, //遮罩透明度 shadeClose: true, scrollbar: false, //shift: 1, //0-6的动画形式,-1不开启 content: handleJumpUrl(url) }); } /** * 查看操作日志 */ function openlayer_alterlog() { var url = global.contextPath + '/view/projecttask/alterlog.jsp?projectid=' + projectid; layer.open({ type: 2, //page层 area: ['80%', '600px'], title: '修改日志', shadeClose: true, shade: 0.6, //遮罩透明度 moveType: 1, //拖拽风格,0是默认,1是传统拖动 moveOut: true, scrollbar: false, //shift: 1, //0-6的动画形式,-1不开启 content: url }); } function sendClick() { //验证必须上会环节是否上过会 var mpMsg = ByProjectnoFindProjectForSend(_projectId); if (!mpMsg.canDo) { layer.msg(mpMsg.reason, {icon: 2}); return; } action = "发送"; if (create == '0') sendBeforeSave = true; if (!taskId) { layer.msg("任务已结束,无法发送!", {icon: 2}); return; } var isRe = window.formMgr.haveRequiredCtlEmpty(); if (isRe.flag) { layer.msg(isRe.message, {icon: 2}); return; } // FIXME: // var materialRequired = validateMaterialRequired(); // if (materialRequired.flag) { // layer.msg(materialRequired.message, { icon: 2 }); // return; // } operationType = "send"; var index = layer.open({ type: 2, title: '选择用户', shadeClose: true, shade: 0.3, area: ['640px', '650px'], scrollbar: false, content: '../../view/sp_userlist.jsp?taskId=' + taskId, btn: ['发送', '取消'], yes: function (index, layero) { //发送需要验证必填项是否完成 var isRe = window.formMgr.haveRequiredCtlEmpty(); if (isRe.flag) { layer.msg(isRe.message, {icon: 2}); return false; } //sendDD(touser,checkMessage,content); saveproject("发送", index, layero); }, end: function (index, layero) { } }); } /** * 关闭5秒提示窗口 * * **/ window.timestriggers = function () { var times = $("#timeInterval").html(); times = times - 1; //$("#divPrompt").find("span").html("操作成功!窗口将在<label style=\"color:red; font-size:14px\">"+times+"</label>秒后关闭!"); $("#timeInterval").html(times); if (times == 0) { clearInterval(); self.close(); window.location.reload(); } } /** * 改派(自由发送环节) */ function jumptake() { //验证必须上会环节是否上过会 var mpMsg = ByProjectnoFindProjectForSend(_projectId); if (!mpMsg.canDo) { layer.msg(mpMsg.reason, {icon: 2}); return; } action = "发送"; operationType = "send"; var index = layer.open({ type: 2, title: '选择用户', shadeClose: true, shade: 0.3, area: ['640px', '600px'], content: '../../view/sp_userlist.jsp?taskId=' + taskId + "&stats=Manage", btn: ['发送', '取消'], yes: function (index, layero) { //改派需要验证必填项是否完成 var isRe = window.formMgr.haveRequiredCtlEmpty(); if (isRe.flag) { layer.msg(isRe.message, {icon: 2}); return false; } saveproject("改派", index, layero); }, end: function (index, layero) { } }); } /*加载表单*/ function loadFromSource(userFrom) { var contHtml = ""; var fromDataList = dataList.projectFormList == undefined ? dataList.formList : dataList.projectFormList; if (fromDataList.length > 0) { for (var i = 0; i < fromDataList.length; i++) { var form = fromDataList[i]; var formName = form.name; if (userFrom == fromDataList[i]) { contHtml += "<div class=\"fromcss\" style=\"background-color:#DDF3F5\" onclick=\"openForms(this,'" + form.id + "')\">" + "<input id=\"fromname\" type=\"hidden\" value='" + formName + "'/>" + "<p>" + formName + "</p></div>" } else { contHtml += "<div class=\"fromcss\" onclick=\"openForms(this,'" + form.id + "')\">" + "<input id=\"fromname\" type=\"hidden\" value='" + formName + "'/>" + "<p>" + formName + "</p></div>" } } $('#fromDiv').append(contHtml); } else { $('#from_div ul').css("height", "50px"); } } /*选择表单*/ function openForms(data, formId) { var bool = formMgr.checkOtherness(); if (bool) { layer.confirm('数据有修改但未保存,是否保存?', { icon: 3, title: '提示', btn: ['确认', '取消'], btn1: function (index) { if (saveproject()) { callForm(data, formId); layer.close(index); } }, btn2: function (index) { callForm(data, formId); layer.close(index); } }); } else { callForm(data, formId); } } function callForm(data, formId) { updateNumber(); $(data).css("background-color", "#DDF3F5").siblings().css("background-color", ""); var openMode = 'normal'; if ('searchproject' == referer) { openMode = 'readonly'; } var projectFormList = dataList.projectFormList == undefined ? dataList.formList : dataList.projectFormList; var projectFormListTow = null; for (var i = 0; i < projectFormList.length; i++) { if (projectFormList[i].id == formId) { projectFormListTow = projectFormList[i]; break; } } XuiRights = null; _flagXuiDataSeted = false; _fagCreatedNumber = false; //请求数据 /*if(_stats != "create") { //加载项目数据内容 getXuiContentDate(_projectId); }*/ //请求权限 if (_stats == "projecting") { queryXuiPrivilegeList( dataList.project.flowid, projectFormListTow.revisionid, dataList.role == null ? '' : dataList.role.id, dataList.state ? dataList.state.id : null ); } else if (_stats == "create") { queryXuiPrivilegeList( _flowid, projectFormListTow.revisionid, dataList.role == null ? '' : dataList.role.id, dataList.resourceState ? dataList.resourceState.id : null ); } else { XuiRights = "Readonly"; } formMgr = new ListFormMgr(projectid == undefined ? null : projectid, taskId == undefined ? null : taskId, formPanel, { flowId: projectid == undefined ? _flowId : project.flowid, showTab: false, role: dataList.role, state: dataList.state, projectFormList: projectFormListTow, openMode: openMode, taskResouce: dataList, onListLoaded: function (row, dataList, treegrid) { var rowsCount = 0; if ($.isArray(dataList)) { rowsCount = dataList.length; } else if (dataList.rows && $.isArray(dataList.rows)) { rowsCount = dataList.rows.length; } var dgHeight = rowsCount * 26 + 26; // $('#formInfo').panel('resize', { height: dgHeight + 28 }); $(accordionDetail).accordion('select', 0); } }, openMode); } /*根据当前公文加载获取相关报表*/ function loadReportSource(result) { var contHtml = ""; var stats = $('#stats').val(); if (result.length > 0) { for (var i = 0; i < result.length; i++) { var report = result[i]; var reppryalias = report.alias; var revisionid = report.revisionid; //2018年12月5日发生过修改 由一已办项目和项目查询不可点击报表更改为全部可以点击 yyl contHtml += "<div class=\"reportcss\" onclick=\"openReport(this)\">" + "<input type=\"hidden\" value='" + revisionid + "' />" + "<input id=\"alias\" type=\"hidden\" value='" + reppryalias + "'/>" + "<p style='border-bottom: 0'>" + reppryalias + "</p></div>"; } $('#reportDiv').append(contHtml); $("#report_div").css("display", "block"); } else { $('#report_div ul').css("height", "50px"); $('#report_div').css("display", "none"); } clickEvent(); } function openReport(obj) { var revisionid = $(obj).find("input").val(); $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.reports.revision.content.get, headers: { "token": $.cookie('ftoken') }, data: { id: revisionid }, dataType: 'text', success: function (result) { var obj = result ? JSON.parse(result) : { path: '', args: [] }; finereportPath = obj.path var name = undefined; var value = undefined; if (obj.args != undefined && obj.args != null && obj.args.length > 0) { name = obj.args[0].name; value = obj.args[0].value; } if (name == undefined && value == undefined) { var reportURL = cjkEncode(CONF_REPORTURL + finereportPath); window.open(reportURL); return; } //TODO 这里调用可调整报表相关方法 实现证书可调打印控件------ if (name == "Lodop") { //将获取到的数据出入打印方法中 lodopPrint(XuiData, value); return; } //--------------------------- if (name == "pid") { if (projectid != null) { var reportURL = cjkEncode(CONF_REPORTURL + finereportPath + "&" + name + "=" + projectid); window.open(reportURL); return; } else { var reportURL = cjkEncode(CONF_REPORTURL + finereportPath); window.open(reportURL); return; } } else { var reportURL = cjkEncode(CONF_REPORTURL + finereportPath + "&" + name + "=" + value); window.open(reportURL); return; } } }); } /** * @hyh 修改 新增参数 materialsList,path * @param materialsList 环节的材料 * @param path 附件路径,用于查出项目的附件名,附件类型 * * */ function loadMaterials(materialsList, path) { loadAttachment2(path, materialsList); } /*获取报表服务器上所有的报表文件*/ function buildFileTreeData(parent, children) { if (!children) return; var parentId = parent ? parent.id : ''; if ($.isArray(children)) { for (var i = 0; i < children.length; i++) { var file = children[i]; //根据当前同级目录遍历,因为报表文件保存在该级目录,所以只需获取cpt后缀的报表,其他文件夹或者其他文件不获取 if (file.name.indexOf(".cpt") == -1) { continue; } file.id = parentId + '/' + file.name; file.text = file.name; if (file.type == 'dir') { file.state = 'closed'; } $('#report_div ul').append( "<li>" + "<input type=\"hidden\" value='" + file.name + "' />" + "<span class=\"glyphicon glyphicon-tag\"></span>" + file.name + "</a>" + "</li>"); buildFileTreeData(file, file.children); } clickEvent(); } } function getdoctype() { return operationType; } function closelayer(index) { $("body").html("发送成功!窗口将在<span style='font-size:40px;color:#f4f400;'>" + time + "</span>秒后关闭!<br/><button onclick='self.close()' style='font-size:12px;background-color:#ffffff;color:#2500ffa1;margin-top:30px;background-color:#ffffff;border:1px solid #2500ffa1;width:100px;height:30px'>我自己关闭</button>"); $("body").css({"text-align": "center", "margin-top": "300px", "font-size": "20px", "color": "#2500ffa1"}); if (time == 0) { window.clearInterval(int); setTimeout('self.close()', 0); // hyh 增加 发送后关闭详情页 2017、9、18 } time--; } //与GIS地图交互 function getGraphics() { if (getMapGraphics !== undefined) { getMapGraphics.window.document.getElementById("getGraphicsDiv").click(); return getJson(); function getJson() { if (getMapGraphics.window && getMapGraphics.window.graphicsJson) { return getMapGraphics.window.graphicsJson; } else { setTimeout(getJson, 300); } } } } /** * 续办 */ function loadProjectInfo() { $.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') { layer.open({ type: 2, title: '审批类型', shadeClose: true, shade: 0.6, area: ['80%', '80%'], scrollbar: false, content: 'selectHandl.html?createmethod=续办&projectId=' + projectid //iframe的url }); } else layer.msg(data.message, {icon: 2}); } }); } /** * 项目复制 */ function copyProjectbtn() { var url = global.contextPath + '/projecttask/loadProjectDetail.jsp'; var index = layer.open({ type: 2, title: '请输入项目编号', shadeClose: true, shade: 0.3, area: ['900px', '520px'], scrollbar: false, content: ['loadProjectDetail.jsp', 'no'], btn: ['确定', '取消'], yes: function (index, layero) { //获取弹出层对象 var iframeWin = window[layero.find('iframe')[0]['name']]; //获取选中项目的项目id var pid = iframeWin.pid; //获取选中项目的编号 //var projectcode=iframeWin.casecode; var projectcode = iframeWin.projectcode; if (pid == "" || projectcode == "") { layer.msg("请点击需要查找的项目", {icon: 2}); return; } $.ajax({ type: "POST", url: curserver + global.modelctls.project.data.copyProject, headers: { "token": $.cookie('ftoken') }, data: {tProjectId: projectid, projectCode: projectcode}, // dataType: 'json', success: function (result) { if (result.status == 'ok') { layer.msg(result.message, { icon: 1, time: 1500, offset: '300px' }, function () { $(window).unbind('beforeunload'); layer.close(index); window.location.reload(); }); } else { layer.msg(result.message, {icon: 2}); } } }); }, end: function (index, layero) { } }); } /** * 加载项目一棵树 */ function openlayer_projectTree() { if (_projectId) projectid = _projectId; var url = 'projectTree.jsp' + '?projectId=' + projectid; layer.open({ type: 2, //page层 area: ['50%', '90%'], title: '项目一棵树', shadeClose: true, shade: 0.6, //遮罩透明度 moveType: 1, //拖拽风格,0是默认,1是传统拖动 moveOut: true, maxmin: true,//最大化最小化 scrollbar: false, //shift: 1, //0-6的动画形式,-1不开启 content: url }); } /** * 加载项目全阶段 */ function openlayer_projectLifeCircle() { if (_projectId) projectid = _projectId; var url = 'projectLifeCircle.jsp' + '?projectId=' + projectid; layer.open({ type: 2, //page层 area: ['70%', '90%'], title: '项目全阶段', shadeClose: true, shade: 0.6, //遮罩透明度 moveType: 1, //拖拽风格,0是默认,1是传统拖动 scrollbar: false, //shift: 1, //0-6的动画形式,-1不开启 content: url }); } function takeback() { var instance_arr = []; instance_arr.push(flowInstanceId); instanceIdString = instance_arr.join(); $.ajax({ type: 'POST', dataType: 'json', url: curserver + global.modelctls.flowEngine.task.takeback, headers: { "token": $.cookie('ftoken') }, data: {instanceId: instanceIdString}, success: function (result) { if (result.status == 'ok') { layer.msg("取回成功", {icon: 1}); setTimeout('window.close()', 1000); } else { layer.msg(result.message, {icon: 2}); } } }); } function cjkEncode(text) { if (text == null) { return ""; } var newText = ""; for (var i = 0; i < text.length; i++) { var code = text.charCodeAt(i); if (code >= 128 || code == 91 || code == 93) { //91 is "[", 93 is "]". newText += "[" + code.toString(16) + "]"; } else { newText += text.charAt(i); } } return newText; } /** * 审批上会 * 根据会议项目的变动,重新修改审批项目上会功能 20191210 */ function openBtnSh() { var mpMsg = ByProjectnoFindProject(projectid); if (mpMsg.canDo) { $.ajax({ type: "POST", url: CONF_BACK_SERVERURL + global.modelctls.project.list.start, headers: { "token": $.cookie('ftoken') }, success: function (data) { var result = []; var tFlowType = null; if (data.length != 0 && data[0].length != 0) { var dataitems = data[0]; var datatypes = data[1]; for (var key in datatypes) { if (datatypes[key] == '会议类') { tFlowType = key; dataitems.forEach(function (item) { if (item.flowtype == key) { result.push(item); } }) } } if (result.length > 0) { var matchResult = matchFlow(result, tFlowType); if (matchResult.result == "success") { var url = requiredMeetingUrl(0, projectid, "spCreate", matchResult.flowId, matchResult.flowName); if (url) { saveOpenNew(window.open(handleJumpUrl(url))); } else { layer.msg("获取跳转路径出错", {icon: 2}); } } else { layer.msg(matchResult.reason, {icon: 2}); } } else { layer.msg("您没有上会权限", {icon: 2}); } } else { layer.msg("您没有上会权限", {icon: 2}); } }, error: function (msg) { layer.msg("请求上会权限出错", {icon: 2}); } }); } else { layer.confirm(mpMsg.reason, { btn: ['确定'] }, function (index, layero) { layer.close(index); }); } } /** * 审批项目获取上会时的跳转路径 * @param state * @param spId * @param openModel * @param flowId * @param flowName * @returns */ function requiredMeetingUrl(state, spId, openModel, cFlowId, flowName) { var url = null; $.ajax({ type: "POST", data: {id: cFlowId}, headers: {"token": $.cookie('ftoken')}, url: CONF_BACK_SERVERURL + '/mvc/flow/forms/list.do', async: false, success: function (data) { if (data) { for (var index in data) { var formdata = data[index]; if (formdata.ftype == '会议项目详情') { $.ajax({ type: "POST", dataType: 'json', contentType: "application/json", async: false, data: JSON.stringify({bindingProcess: cFlowId}), url: CONF_MEETING_SERVERURL + '/api/meetingtypes/findList', success: function (result) { var serverPath = CONF_FRONT_SERVERURL; var pageName = formdata.name; var stateStr = "?state=" + state; var typeIdStr = "&typeid=3707358616734BFAAC23CF166EB470CC"; var flowIdStr = "&flowid=" + cFlowId; var listNameStr = "&listname=我的项目"; var entranceStr = "&entrance=添加项目"; var formRevisioniIdStr = ""; var projectTypeStr = "&projectType=" + flowName; var spIdStr = "&spId=" + spId; var openModelStr = "&openModel=" + openModel; var oFlowIdStr = "&oFlowId=" + _flowId; if (Array.isArray(result) && result.length > 0) { formRevisioniIdStr = "&formRevisionid=" + formdata.revisionid; typeIdStr = "&typeid=" + result[0].id; /*var url = CONF_FRONT_SERVERURL + formdata.name + '?state=0' + '&typeid=' + result[0].id + '&flowid=' + flowid + '&listname=' +listname + '&entrance=' + entrance + '&formRevisionid=' + formdata.revisionid + '&projectType=' + projectType;*/ } //var url = CONF_FRONT_SERVERURL + formdata.name + '?flowid=' + noFlow +'&typeid='+typeid+'&listname='+listname+"&entrance="+entrance+"&state=0"+'&projectType='+projectType; url = serverPath + pageName + stateStr + typeIdStr + flowIdStr + listNameStr + entranceStr + formRevisioniIdStr + projectTypeStr + spIdStr + openModelStr + oFlowIdStr; }, error: function (error) { console.log(error); } }) break; } } } }, error: function (error) { console.log(error); } }) return url; } /** * 匹配业务项(审批项目的业务对应会议项目的业务) * @param flowList * @param tFlowType * @returns */ function matchFlow(flowList, tFlowType) { var result = { result: "fail", reason: "未找到配置项", flowId: null, flowName: null }; $.ajax({ type: "POST", url: CONF_MEETING_SERVERURL + "/api/meetingprojects/findTFlowIdByOflowId", async: false, data: {oFlowId: _flowId, tFlowType: tFlowType}, success: function (data) { if (data.length == 0) { console.log(result.reason); } else if (data.length == 1) { var tFlowId = data[0]; for (var i in flowList) { var flow = flowList[i]; if (flow.id == tFlowId) { result.result = "success"; result.reason = ""; result.flowId = flow.id; result.flowName = flow.name; break; } } if (result.result == "fail") { result.reason = "未找到匹配项"; } } else { result.reason = "配置项不合规(超出)"; } }, error: function (msg) { result.reason = "请求失败"; } }); return result; } /** * 根据项目ID检查项目是否正在上会(上会时验证) * @param projectno * @returns */ function ByProjectnoFindProject(projectno) { var result = { canDo: false, reason: "" }; var executeMpStateValidate = function (projectno) { $.ajax({ type: "GET", async: false, url: CONF_MEETING_SERVERURL + "/api/meetingprojects/ByProjectnoFindProject/" + projectno, success: function (data) { if (data) { if (data.projectstate == "登记") { result.reason = "该项目已登记"; } else if (data.projectstate == "预上会") { result.reason = "该项目已处于预上会状态"; } else if (data.projectstate == "会审中") { result.reason = "该项目正在会审当中"; } else if (data.projectstate == "已结束") { result.reason = "该项目已结束会审,请确认会议意见后继续发送"; } else { result.reason = "未知错误"; } } else { result.canDo = true; } }, error: function (msg) { result.reason = "请求失败"; } }) }; if (isMeetingProject) { if (isMeetingProject == "yes") { executeMpStateValidate(projectno); } else if (isMeetingProject == "condition") { if (meetingCondition) { if (meetingCondition.type == "dataClass") { var matchContent = meetingCondition.content; if (matchContent) { var className = matchContent.className; var field = matchContent.field; var fieldName = field.fieldName; var matchMap = field.valueMap; var data = XuiData; if (data.hasOwnProperty(className)) { var dataClass = data[className]; if (dataClass.hasOwnProperty(fieldName)) { var value = dataClass[fieldName]; if (value) { if (matchMap.hasOwnProperty(value) || matchMap.hasOwnProperty(value.toUpperCase())) { var validateValue = matchMap[value] ? matchMap[value] : matchMap[value.toUpperCase()]; if (validateValue) { executeMpStateValidate(projectno); } else { result.reason = "该环节无需上会"; } } else { result.reason = "上会验证时数据类字段值未找到"; } } else { result.reason = "上会验证时数据类字段值为空"; } } else { result.reason = "上会验证时未匹配到数据类字段"; } } else { result.reason = "上会验证时未匹配到数据类"; } } else { result.reason = "上会验证条件内容未找到"; } } else { result.reason = "目前上会验证条件仅支持数据类验证"; } } else { result.reason = "上会验证条件配置未找到"; } } else { result.reason = "该环节无需上会"; } } else { result.reason = "该环节无需上会"; } return result; } /** * 根据项目ID检查项目是否正在上会(发送时验证) * @param projectno * @returns */ function ByProjectnoFindProjectForSend(projectno) { var result = { canDo: false, mpStateValidated: false, reason: "" }; var executeMpStateValidate = function (projectno) { $.ajax({ type: "GET", async: false, url: CONF_MEETING_SERVERURL + "/api/meetingprojects/ByProjectnoFindProject/" + projectno, success: function (data) { if (data) { if (data.projectstate == "已结束") { result.canDo = true; result.mpStateValidated = true; } else { result.reason = "会议未结束"; result.mpStateValidated = true; } } else { result.reason = "该项目在本环节需要上会"; result.mpStateValidated = true; } }, error: function (msg) { result.reason = "请求失败"; } }) }; if (isMeetingProject && isMeetingProject != "no") { if (isMeetingProject == "yes") { executeMpStateValidate(projectno); } else {//isMeetingProject == "condition" if (meetingCondition) { if (meetingCondition.type == "dataClass") { var matchContent = meetingCondition.content; if (matchContent) { var className = matchContent.className; var field = matchContent.field; var fieldName = field.fieldName; var matchMap = field.valueMap; var data = XuiData; if (data.hasOwnProperty(className)) { var dataClass = data[className]; if (dataClass.hasOwnProperty(fieldName)) { var value = dataClass[fieldName]; if (value) { if (matchMap.hasOwnProperty(value) || matchMap.hasOwnProperty(value.toUpperCase())) { var validateValue = matchMap[value] ? matchMap[value] : matchMap[value.toUpperCase()]; if (validateValue) { executeMpStateValidate(projectno); } else { result.canDo = true; } } else { result.reason = "上会验证时数据类字段值未找到"; } } else { result.reason = "上会验证时数据类字段值为空"; } } else { result.reason = "上会验证时未匹配到数据类字段"; } } else { result.reason = "上会验证时未匹配到数据类"; } } else { result.reason = "上会验证条件内容未找到"; } } else { result.reason = "目前上会验证条件仅支持数据类验证"; } } else { result.reason = "上会验证条件配置未找到"; } } } else { result.canDo = true; } return result; } function getQueryVariable(variable)// hyh 增加 直接从url上获取参数的方法 2017、10、13 { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); } function getManageOrSearch() {// hyh 增加 判断url上获取参数的方法是项目管理还是项目查询 2017、10、13 //var search=getQueryVariable("referer"); if (URLStats == "Manage") { getManageOrSearchStats = "&type=manage"; } else if (URLStats == "search") { getManageOrSearchStats = "&type=search"; } else if (URLStats == "dealedproject") { getManageOrSearchStats = "&type=dealedproject"; } } //hyh 新增 2017/11/6 存储子页面对象 function saveOpenNew(param) { win_num = win_num + 1; win_Array[win_num] = param; } //用户注销的时候,执行关闭方法。body添加onUnload = "closeNews();" 当index窗口关闭时候,所有的子窗口关闭 function closeNews() { //关闭权限管理 if (win_Array.length > 0) { for (var i = 0; i <= win_Array.length; i++) { var win_one = win_Array[i]; if (win_one != undefined) { win_one.close(); } } } } /** * 获取该项目流程环节信息 hyh 新增 2017/11/14 */ function loadActivityInfo(name, materialsList, path) { //获取当前流程环节和是否可自流转状态 var activityInfo = null; var isNextUser = true; $.ajax({ type: "POST", async: true, url: CONF_BACK_SERVERURL + global.modelctls.flowEngine.task.next.user, headers: { "token": $.cookie('ftoken') }, data: {taskid: taskId}, dataType: 'json', success: function (result) { var users; var userStr = ""; for (var i = 0; i < result.length; i++) { users = result[i].users; if (users != undefined) { for (var j = 0; j < users.length; j++) { if (users[j].loginname == name) { activityInfo = users[j].loginname; break; } } } } if (activityInfo == null) { isNextUser = false; } else if (activityInfo.length <= 0) { isNextUser = false; } getFileList2(path, materialsList); } }); } /** * 分辨率 * */ var w = document.documentElement.clientWidth; /* * 在1920x1080分辨率全屏不显示滚动条 */ /*function keyupFullScreen() { var keyNum = event.keyCode; if (keyNum == 122) { if (w == 1920) { if (window.outerHeight == screen.height && window.outerWidth == screen.width) { $("#mCSB_1_scrollbar_vertical").removeClass("mCSB_scrollTools"); } else { $("#mCSB_1_scrollbar_vertical").addClass("mCSB_scrollTools"); } } } }*/ function btnShowHide(state) { if (state == "projecting" || state == "create") { $('#saveBtn').css("display", ""); $('#mbSend').css("display", ""); $('#loadProject').css("display", ""); $('#copyProject').css("display", ""); $('#returnFile').css("display", ""); $('#deletebtn').css("display", ""); $('#mbFallBack').css("display", ""); $('#alterLog').css("display", ""); $('#flowLog').css("display", ""); $('#prjectbtnSh').css("display", ""); $('#meansbtn').css("display", ""); $('#alterLog').css("display", ""); $('#projectTreebtn').css("display", ""); } else if (state == "dealedproject") { $('#backbtn').css("display", ""); $('#loadProject').css("display", ""); $('#flowLog').css("display", ""); $("#returnFile").text("退件框"); $('#returnFile').css("display", ""); } else if (state == "Manage") { $('#saveBtn').css("display", ""); $('#loadProject').css("display", ""); $('#flowLog').css("display", ""); $('#alterLog').css("display", ""); $('#jumpbtn').css("display", ""); $('#returnFile').css("display", ""); } else { $('#loadProject').css("display", ""); $('#flowLog').css("display", ""); $('#alterLog').css("display", ""); } } //hzw 修改 全文检索接口 2018、3、5 function addApproveIndex(projectid) { var _url = CONF_SEARCH_SERVERURL + "/es/approve/insert"; $.ajax({ type: "POST", url: _url, data: {"projectid": projectid}, success: function (result) { } }); } function updateApproveIndex(projectid) { var _url = CONF_SEARCH_SERVERURL + "/es/approve/update"; $.ajax({ type: "POST", url: _url, data: {"projectid": projectid}, success: function (result) { } }); } /** * 2018-01-09 ljy 设置iframe路径 * 2018-05-04 hzw 修改 */ function setIframeSrc(no) { if (_projectStaus == "办结" || _projectStaus == "退件办结") { $("#browsingGrp").css("display", "block"); $("#gis").attr("src", "projectgis.html?no=" + no + "&layerid=" + $("#layerid").val() + "&coverage=" + $("#coverage").val()); $("#gis .bigmap").val(no); // 2018/5/4 hzw 新增 } } /** * 2018-01-09 ljy 查看大图路径 */ function lookmap() { var no = $("#gis .bigmap").val(); // 2018/5/4 hzw 新增 // window.open('../../view/projecttask/projectgis.html?no='+no+'&layerid='+$("#layerid").val()+"&coverage="+$("#coverage").val()+'&level=8'); window.open(CONF_GIS_ONEMAP); } function updateNumber() { //新建不保存更新编号 if (create == '0' || create == '1') { if (isbtnSave == false) { var numberArr = []; var data = window.formMgr.getData() if (JSON.stringify(data) != "{}" && JSON.stringify(data) != "null" && data != null) { var ProjectCode = data.bz_jbxx.ProjectCode var CaseCode = data.bz_jbxx.CaseCode if (ProjectCode && ProjectCode != "") { numberArr.push(ProjectCode); } if (CaseCode && CaseCode != "") { numberArr.push(CaseCode); } var numbers = numberArr.join(); if (unitid) { $.ajax({ type: "POST", async: false, url: curserver + '/mvc/number/rule/number/upSpNumber.do', headers: { "token": $.cookie('ftoken') }, data: {numbers: numbers, unitid: unitid}, success: function (result) { } }); } else { layer.msg("更新编号失败,用户所属单位不存在,请联系管理员!", {icon: 7}); return; } } } } } function testSpeed() { getXuiContentDate(_projectId); } function getMaterialLists(projectId) { $.ajax({ type: "POST", url: curserver + '/mvc/project/allListMaterial.do', headers: { "token": $.cookie('ftoken') }, data: {projectId: projectId}, success: function (result) { if (result != null) { materialList = result; attachmentFolderFips(); } } }); }; function createProject(newData) { //表单详情新建的时候 var bool = false; var param = { dockingid: _dockingid, flowid: _flowId, flowInstanceId: flowInstanceId, projectid: projectid, attachpath: rootPath, newData: newData, opts: "接件", unitid: unitid, taskid: task.id }; if (flowItemTypeId) { param.flowItemTypeId = flowItemTypeId; } $.ajax({ type: "POST", async: false, url: curserver + global.modelctls.project.create, headers: { "token": $.cookie('ftoken') }, data: param, success: function (result) { if (result.status == 'ok') { XuiData = result.data.newdata; task = result.data.task; dataList.project = result.data.project; project = result.data.project; _projectId = projectid = project.id; formMgr.setData(JSON.parse(JSON.stringify(XuiData))); canSelfTurning = result.data.activity.canSelfTurning; flowObjectName = result.data.activity.flowObjectName; _flowId = project.flowid; var status = null; taskId = task.id; sendBeforeSave = true; isbtnSave = true; create = null; URLStats = "projecting"; _stats = "projecting"; getRoleChildrenPrivilege("待办项目详情页"); $('#mbFallBack').attr("disabled", "disabled"); $("#returnFile").attr("disabled", "disabled"); layer.closeAll('loading'); //关闭加载层 layer.msg("保存成功!", {icon: 1}); var title = result.data.newdata.bz_jbxx ? encodeURI(encodeURI(result.data.newdata.bz_jbxx.ProjectName)) : ""; var url = CONF_FRONT_SERVERURL + 'view/projecttask/detailproject.jsp?titleEncode=' + title + '&taskId=' + task.id + '&create=null&stats=projecting' + '&role=' + _roleIdByQara + '&projectid=' + projectid + "&flowid=" + _flowid + "&flowItemTypeId=" + flowItemTypeId + "&FLOWVERSION=" + version; spUpdateHandleJumpUrl(url); // ------------------------------------------------------ create by zys 2020/3/17 start ----------------------- uploadFileListBeforeSend(_projectId); // loadMaterialsNew(task.name); // ----------------------------------------------------------------- end ----------------------------------- bool = true; // $.ajax({ // type: "POST", // url: CONF_NEWGHSC_SERVERURL + '/bz/updateCaseCode?pid=' + _projectId, // data: '', // contentType: 'application/json;charset=utf-8', // dataType: 'json', // success: function (res) { // } // }); } else { layer.msg('保存失败!' + result.message, {icon: 2}); } }, error: function (e) { layer.msg('保存请求错误!请联系管理员', {icon: 2}); } }); return bool; } function saveProjectData(projectid, newData, olddata) { var bool = false; $.ajax({ type: "POST", async: false, url: CONF_BACK_SERVERURL + global.modelctls.project.data.save, headers: { "token": $.cookie('ftoken') }, data: {projectId: projectid, newData: newData, olddata: olddata}, success: function (result) { if (result.status == 'ok') { XuiData = result.data; if (document.title == "" || document.title == "null" || document.title == undefined) { _title = ""; document.title = "无标题"; } else { _title = document.title = XuiData.bz_jbxx ? XuiData.bz_jbxx.ProjectName : "无标题"; } window.formMgr.updateDataToUI(true); layer.closeAll('loading'); //关闭加载层 layer.msg("保存成功!", {icon: 1}); // setIframeSrc(cardNumber); bool = true; // $.ajax({ // type: "POST", // url: CONF_NEWGHSC_SERVERURL + '/bz/updateCaseCode?pid=' + _projectId, // data: '', // contentType: 'application/json;charset=utf-8', // dataType: 'json', // success: function (res) { // } // }); } else { console.error(result.message); layer.msg('保存失败!' + result.message, {icon: 2}); } }, error: function (e) { console.error(e); $.messager.progress('close'); layer.msg('保存请求错误!请联系管理员', {icon: 2}); } }); return bool; } function decline(projectid, newData, olddata, index, layero) { $(".layui-layer").append('<div id="tloading" style="font-size:15px;position: absolute;width:100%;height:100%;opacity: 0.7;top: 0px;">' + '<div class="weui-toast weui_loading_toast weui-toast--visible"><div class="weui_loading"><i class="weui-loading weui-icon_toast"></i></div><p class="weui-toast_content">发送中...</p></div></div>'); var RejectVal = $("#sendTextarea").val(); if (newData == null) { newData = {}; newData.bz_spyj = { PID: project.id, TJYJ: RejectVal, TJR: username, SSKS: unitsname, TJRQ: global.datefmt(new Date()) }; } else { newData = JSON.parse(newData); obj1 = {PID: project.id, TJYJ: RejectVal, TJR: username, SSKS: unitsname, TJRQ: global.datefmt(new Date())}; obj2 = $.extend(newData.bz_spyj, obj1); newData.bz_spyj = obj2; } if (newData && olddata) { var declineData = { newData: newData, olddata: JSON.parse(olddata) } } else { var declineData = { newData: newData } } if (taskId != null) { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.reject, headers: { "token": $.cookie('ftoken') }, data: { taskid: taskId, projectId: projectid, declineData: JSON.stringify(declineData) }, success: function (result) { if (result.status == 'ok') { if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } if (rejectState == "退件打印") { var reportURL = cjkEncode(CONF_REPORTURL + CONF_RETURN_NOTICE + "&pid=" + projectid); window.open(reportURL); } console.debug(result); global.main.closeTab('taskId_' + taskId); layer.msg("退件成功", { icon: 1, time: 1500, offset: '300px' }, function () { $(window).unbind('beforeunload'); window.close(); }); } else { console.info(result); layer.msg("" + result.status == "error" ? "退件失败!" : result.message + "", { icon: 2, time: 1500, offset: '300px' }, function () { }); } }, error: function (e) { $("#tloading").remove(); $.messager.alert('错误', 'HTTP请求失败,请检查网络!'); } }); } else { layer.msg("流程已结束!无法退件!", {icon: 2}); return; } } function projectSend(projectid, newData, olddata, index, layero) { var actTypeList = getActtype(); var moreParallelList = getMoreParallelList(); var iframeWin = parent.window[layero.find('iframe')[0]['name']]; var splabel = iframeWin.splabel(); // var checkWeChatAndMessage = iframeWin.checkMessage(); // var content = iframeWin.document.getElementById("dWxWContent").value; //获取被选中的用户ID var useridArray = iframeWin.$("#divDepartmentSelected").find(".id"); var index = 0; if (actTypeList.length > 0 && moreParallelList.length == 0) { for (var i = 0; i < splabel.length; i++) { if (actTypeList.includes(splabel[i].sid)) { index++; } } if (index > 0 && index != actTypeList.length) { parent.layer.msg('请多选并行环节用户', {icon: 2}); return; } } if (splabel.length == 0) { parent.layer.msg('请选择用户', {icon: 2}); return; } var toArray = []; var toUsersDdid = []; for (var i = 0; i < splabel.length; i++) { var item = splabel[i]; toArray.push({ ddid: item.ddid, uid: item.id, id: item.sid, name: item.name, users: item.user }); toUsersDdid.push({ ddid: item.ddid, }) } var sendInfo = { from: { uid: userid, id: task.flowObjectId, name: task.name + "," + action }, to: toArray, }; var saveData; if (newData && olddata) { saveData = { newData: JSON.parse(newData), olddata: JSON.parse(olddata) } } else { saveData = { newData: newData } } $.ajax({ type: "POST", async: true, url: curserver + global.modelctls.flowEngine.task.complete, headers: { "token": $.cookie('ftoken') }, data: { taskid: taskId, projectId: projectid, activityId: activityid, sendObject: JSON.stringify(sendInfo), saveData: JSON.stringify(saveData) }, dataType: 'json', success: function (result) { if (result.status == 'ok') { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/bz/updateCaseCode?pid=' + _projectId, data: '', contentType: 'application/json;charset=utf-8', dataType: 'json', success: function (res) { } }); layer.msg(result.message, {icon: 1}); if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } if (opener && opener.closeFlowWindow) { opener.closeFlowWindow(); } // FIXME: 方法undefind 暂时注释 // sendSpDD(toUsersDdid, iframeWin.sendContent, moudleType); // findUserByUsername(useridArray, content, checkWeChatAndMessage); sendSuccessPage(index); return; } else { if (result.message != null && result.message != "") { layer.msg("发送失败!" + result.message, {icon: 2}); } else { $.messager.alert('错误', '发送失败!'); } console.info(result); } } }); } function sendSuccessPage(index) { var content = ""; var source = ""; $(".button-operation").css("display", "none"); //发送成功后右侧滚动条隐藏 $(".mCSB_dragger_bar").css("display", "none"); //发送成功自动滚到最上面 $("#bodycontent").mCustomScrollbar("scrollTo", "top"); layer.close(index); layer.closeAll(); if (saveprojectLoading) { layer.close(saveprojectLoading); //关闭加载层 } setTimeout(function () { self.close(); parent.window.location.reload(); }, 1500); } /** * hzw 2018/6/37 新增 * 获取用户ID */ function findUserByUsername(userid, content, checkWeChatAndMessage) { var useridArray = []; userid.each(function () { useridArray.push({userid: this.value}); }) getMobileAndWeChat(useridArray, content, checkWeChatAndMessage); } function projectRollback(projectid, newData, olddata, index, layero) { $(".layui-layer").append('<div id="tloading" style="font-size:15px;position: absolute;width:100%;height:100%;opacity: 0.7;top: 0px;">' + '<div class="weui-toast weui_loading_toast weui-toast--visible"><div class="weui_loading"><i class="weui-loading weui-icon_toast"></i></div><p class="weui-toast_content">发送中...</p></div></div>'); //获取表单上的旧数据字符串 if (newData == null) { newData = {}; newData.bz_return_opinion = { pid: project.id, fd01: username, fd02: htyjVal, fd03: global.datefmt(new Date()), fd04: unitsname, fd05: flowObjectName, fd06: "回退", fd07: task.flowObjectId }; } else { newData = JSON.parse(newData); newData.bz_return_opinion = { pid: project.id, fd01: username, fd02: htyjVal, fd03: global.datefmt(new Date()), fd04: unitsname, fd05: flowObjectName, fd06: "回退", fd07: task.flowObjectId }; } if (newData && olddata) { var backData = { newData: newData, olddata: JSON.parse(olddata) } } else { var backData = { newData: newData } } $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.fallback, headers: { "token": $.cookie('ftoken') }, data: { taskid: taskId, projectId: projectid, backData: JSON.stringify(backData) }, success: function (result) { if (result.status == 'ok') { if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } console.debug(result); global.main.closeTab('taskId_' + taskId); layer.msg("回退成功", { icon: 1, time: 1500, offset: '300px' }, function () { $(window).unbind('beforeunload'); window.close(); }); } else { $("#tloading").remove(); console.info(result); if (result.message) { layer.msg(result.message, {icon: 2}); } else { layer.msg("回退失败", { icon: 2, time: 1500, offset: '300px' }, function () { }); } } }, error: function (e) { $.messager.alert('错误', 'HTTP请求失败,请检查网络!'); } }); } function reassignment(projectid, newData, olddata, index, layero) { var iframeWin = parent.window[layero.find('iframe')[0]['name']]; var splabel = iframeWin.splabel(); if (splabel.length == 0) { parent.layer.msg('请选择用户', {icon: 2}); return; } var toArray = []; for (var i = 0; i < splabel.length; i++) { var item = splabel[i]; toArray.push({ uid: item.id, id: item.sid, name: item.name, users: item.user }); } var sendInfo = { from: { uid: userid, id: task.flowObjectId, name: task.name + "," + action }, to: toArray }; var saveData; if (newData && olddata) { saveData = { newData: JSON.parse(newData), olddata: JSON.parse(olddata) } } else { saveData = { newData: newData } } $.ajax({ type: "POST", url: curserver + '/mvc/flowEngine/task/jumpTask.do', headers: { "token": $.cookie('ftoken') }, data: { taskid: taskId, projectId: projectid, activityId: activityid, sendObject: JSON.stringify(sendInfo), saveData: JSON.stringify(saveData) }, dataType: 'json', success: function (result) { if (result.status == 'ok') { if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } $(".button-operation").css("display", "none"); //发送成功后右侧滚动条隐藏 $(".mCSB_dragger_bar").css("display", "none"); //发送成功自动滚到最上面 $("#bodycontent").mCustomScrollbar("scrollTo", "top"); closehadle(index); layer.msg("发送成功!", { icon: 1, }, function () { layer.close(index); }); setTimeout('self.close()', 1000); // hyh 增加 发送后关闭详情页 2017、9、18 } else { alert('发送失败!'); console.info(result); $.messager.alert('错误', '发送失败!'); } } }); } function entering() { layer.open({ title: '请输入项目编号', content: '<div>项目编号: <input id="projectCode" value="" autofocus="autofocus" style="width:100px;width: 180px;border-radius: 5px;border: 1px solid #4898d5;"/></div>', yes: function (index, layero) { var code = $("#projectCode").val(); $.ajax({ type: "POST", url: curserver + '/mvc/project/projectEntering.do', headers: { "token": $.cookie('ftoken') }, data: { projectCode: code }, dataType: 'json', success: function (result) { var data = result.bz_jbxx; if (result.status != "error") { formMgr._initializeData(result); formMgr._getCurrentFormFrame().contentWindow.formMgr.dataLoaded = false; formMgr.updateDataToUI(); if (formMgr._getCurrentFormFrame().contentWindow.formMgr.dataLoaded) { layer.msg("录入成功!", {icon: 1}); console.log(result.bz_jbxx); } } else { layer.msg(result.message, {icon: 2}); } } }); layer.close(index); } }); } function estabish() { layer.open({ title: '请输入报建编号', content: '<div>报建编号: <input id="coseCode" value="" autofocus="autofocus" style="width:100px;width: 180px;border-radius: 5px;border: 1px solid #4898d5;"/></div>', yes: function (index, layero) { var code = $("#coseCode").val(); var datajson = formMgr.getDataJson(); $.ajax({ type: "POST", url: curserver + '/mvc/project/projectEstabish.do', headers: { "token": $.cookie('ftoken') }, data: { coseCode: code, data: datajson, flowId: _flowid }, dataType: 'json', success: function (result) { if (result != null) { formMgr._initializeData(result); formMgr._getCurrentFormFrame().contentWindow.formMgr.dataLoaded = false; formMgr.updateDataToUI(); if (formMgr._getCurrentFormFrame().contentWindow.formMgr.dataLoaded) { if (result.status != "error") { layer.msg("录入成功!", {icon: 1}); } else { layer.msg("录入失败!", {icon: 1}); } console.log(result); } } else { layer.msg(result.message, {icon: 2}); } } }); layer.close(index); } }); } function mappingRelation() { var data = window.formMgr.getData(); if (!data.siproject) { layer.msg('请先保存项目!', {icon: 7}); return; } layer.open({ title: '请输入项目ID', content: '<div>项目ID: <input id="projectId" value="' + (data.siproject.memo == null ? '' : data.siproject.memo) + '" autofocus="autofocus" style="width:100px;width: 180px;border-radius: 5px;border: 1px solid #4898d5;"/></div>', yes: function (index, layero) { var oldProjectId = $("#projectId").val(); $.ajax({ type: "POST", url: curserver + '/mvc/project/mappingRelation.do', headers: { "token": $.cookie('ftoken') }, data: { oldProjectId: oldProjectId, projectId: _projectId }, dataType: 'json', success: function (result) { console.log(result); } }); layer.close(index); } }); } function bouncematter() { var taskArray = []; if (project.status == "退件") { taskArray.push({taskId: taskId, projectId: projectid}); } else { parent.layer.msg("结束失败!只有状态为'退件'的案件才可以结束!", {icon: 2}); return; } 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 = "退件办结"; layer.msg(result.message, {icon: 1}); setTimeout(function () { self.close(); opener.location.reload(); }, 1500); //openRefreshList(); } } }); layer.closeAll(); } }); } function suspension() { $.ajax({ type: "POST", url: curserver + global.modelctls.flowEngine.task.suspension, headers: { "token": $.cookie('ftoken') }, data: {taskId: taskId}, success: function (result) { if (result.status = "ok") { if (result.message == "true") { $("#suspension")[0].lastChild.data = "恢复"; layer.msg("挂起成功!", {icon: 1}); } else { $("#suspension")[0].lastChild.data = "挂起"; layer.msg("恢复成功!", {icon: 1}); } } else { layer.msg("挂起失败!", {icon: 2}); } }, error: function (e) { } }); } function initGis(projectcode) { $("#gis").attr("src", CONF_GIS_ONEMAP + "widgets/ProjectManage/OAProjectMap.html?projectid=" + projectcode); } /** * 退回任务 */ function returned() { beforeModifiedData = window.formMgr.getData(); if (typeof (beforeModifiedData.bz_return_opinion) == 'undefined') { layer.msg("'bz_return_opinion'回退意见表不存在!", { icon: 2, time: 1500, offset: '300px' }); return; } if (!taskId) { layer.msg("任务已结束,无法发送!", {icon: 2}); return; } operationType = "returned"; var index = layer.open({ type: 2, title: '选择用户', shadeClose: true, shade: 0.3, area: ['640px', '720px'], scrollbar: false, content: '../../view/sp_userlist.jsp?taskId=' + taskId, btn: ['退回', '取消'], yes: function (index, layero) { var res = window["layui-layer-iframe" + index]; var val = res.getTextVal(); if (!val || val == "") { layer.msg("意见不能为空!", {icon: 2}); return; } var splabel = res.splabel(); if (splabel.length == 0) { parent.layer.msg('请选择用户', {icon: 2}); return; } var toArray = []; toArray.push({ uid: userid, id: task.flowObjectId, name: task.name, users: username }); var obj = {}; for (var i = 0; i < splabel.length; i++) { var item = splabel[i]; obj = { uid: item.id, id: item.sid, name: item.name + "," + action, }; } var sendInfo = { from: obj, to: toArray, }; var newData = {}; newData.bz_return_opinion = { pid: project.id, fd01: username, fd02: val, fd03: global.datefmt(new Date()), fd04: unitsname, fd05: flowObjectName, fd06: "退回", fd07: task.flowObjectId, fd08: "1" }; var saveData = { newData: newData } $.ajax({ type: "POST", dataType: 'json', contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/apply/updateVersion/?pid=' + projectid, success: function (res) { console.log("修改成功") }, }) $.ajax({ type: "POST", async: true, url: curserver + global.modelctls.flowEngine.task.history.sendBack, headers: { "token": $.cookie('ftoken') }, data: { taskId: taskId, projectId: projectid, activityId: activityid, sendObject: JSON.stringify(sendInfo), saveData: JSON.stringify(saveData) }, dataType: 'json', success: function (result) { if (result.status == 'ok') { layer.msg(result.message, {icon: 1}); if (window.opener && window.opener.getUpcomingApproval != undefined) { window.opener.getUpcomingApproval(); } if (opener && opener.closeFlowWindow) { opener.closeFlowWindow(); } sendSuccessPage(index); return; } else { if (result.message != null && result.message != "") { layer.msg("退回失败!" + result.message, {icon: 2}); } else { $.messager.alert('错误', '退回失败!'); } console.info(result); } } }); }, end: function (index, layero) { } }); } function validateMaterialRequired() { var isRe = {flag: false, message: '效验成功'}; if (dataList === null) { return {flag: true, message: '项目信息为空'} } if (!Array.isArray(dataList.projectMaterialDirList)) { dataList.projectMaterialDirList = dataList.materialDirList } var obj = { target: rootPath, parentId: '-1', userId: userid, username: username }; // 请求项目根目录文件 $.ajax({ type: "post", async: false, url: CONF_DOC_SERVERURL + "ftpfile/list2.do", data: JSON.stringify(obj), contentType: "text/plain", success: function (result) { if (result.fileInfolist && dataList.projectMaterialDirList) { for (var index in dataList.projectMaterialDirList) { var materialdir = dataList.projectMaterialDirList[index]; if (materialdir.required === 'yes' || materialdir.currentRequired === 'yes') { // 获取有文件的文件夹记录 var filterArray = result.fileInfolist.filter(function (fileinfo) { return materialdir.name === fileinfo.name && fileinfo.isDir === 'true' && fileinfo.count > 0; }); // 必上传文件夹时没有文件。直接返回 if (filterArray.length === 0) { isRe = {flag: true, message: materialdir.name + ' 在此环节需上传文件'}; return isRe; } } } } }, error: function (msg) { console.error(msg); isRe = {flag: true, message: "获取材料信息失败"}; } }); return isRe; } // ----------------------------block or none created by zys 2020/3/5 ---------------------- // FIXME: 关于布局问题 待修改 function displayBlock(nodeName, _projerct, _flage) { _nodeName = nodeName; var hjArr = []; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getFlowObjectIds?flowId=' + _flowId, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 hjArr = res.data; } else { console.log("查询当前流程的所有环节失败"); } }, error: function (e) { console.log("查询当前流程的所有环节失败"); } }); var insId = null; if (task.instanceId != null && task.instanceId != undefined && task.instanceId != '') { insId = task.instanceId; } if (task.instanceId == null || task.instanceId == undefined || task.instanceId == '') { if (flowInstanceId != null && flowInstanceId != undefined && flowInstanceId != '') { insId = flowInstanceId; } } var startTaskId = null; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getStartTask?instanceId=' + insId, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 startTaskId = res.data; } else { console.log("查询当前流程的启动环节失败"); } }, error: function (e) { console.log("查询当前流程的启动环节失败"); } }); //flag 已办结 if (version && version.indexOf('1.0') > -1) { //判断是不是规划审查流程 // FIXME: 申请环节为新增流程 申请数据流程 if (hjArr.includes(flowObjectId)) { if (_flowId == 't1001_4028d83970955d2a01709577b3870018') {//判断是不是成果审查流程 $("#browsingGrp,#report_div,#hint,#fj").css('display', 'none'); $("#right_part").css({ "margin-top": "20px" }); $("#suggestHzbg").hide(); //$("#returnFile,#mbFallBack,#returned").attr('disabled', true); if (flowObjectId == startTaskId) { $("#importGhcgBtn,#yjzjBtn").show(); $("#mbFallBack,#returned").attr('disabled', true); var lcyj = []; $.ajax({ type: "POST", async: false, url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projerct.id, data: '', dataType: 'json', success: function (res) { console.log('1---sug') if (res.code == 200) { lcyj = res.data; } else { layer.msg('error'); } } }); if (lcyj.length > 0) { var _width = $("#project_suggest_div").width(); $("#project_suggest_div").css({ "display": "flex", "width": _width + 'px' }); suggestFun(_projerct.id); } } else { var _width = $("#project_suggest_div").width(); $("#project_suggest_div").css({ "display": "flex", "width": _width + 'px' }); $("#form").css({ 'min-width': '800px' }); $('#formPanel').css({ 'width': '800px' }); $("#createFolder,#uploadFile,#project_suggest_div").show(); suggestFun(_projerct.id); } if (_flage) { $("#importGhcgBtn,#yjzjBtn,#createFolder,#uploadFile").hide(); $(".dtree-container").addClass("view-only"); } $('#project_saveSuggest').off('click').on('click', function () { saveSuggest($('#project_textarea_cs').val()); }); }else { $("#browsingGrp").css('display', 'inline-block'); } if (_flowId == 't1001_4028d839710f68d101710f8b74ad0006') {//判断是不是数据申请流程 if (flowObjectId == startTaskId) { $('#project_div_attachment,#createFolder,#uploadFile').show(); if (flowObjectId == "sid-4241EEC7-57CA-4D69-B6C0-060E6E6C45DA") { $("#downloadBM").css("display", "flex") } } $('#report_div').show(); } } } /** * 业务协同模块项目储备页面的启动 gewan 20200319 */ else if (version && version.indexOf('2.0') > -1) {//判断是不是业务协同模块 initOneMap(); var arr1 = ['sid-862DE529-CECB-4360-ABDB-CFA518A0907F', 'sid-1CC0CEE0-D6C2-461A-807B-2361D0E8BC54', 'sid-2D676B0B-FBF0-42E3-9A8C-7860614DAF7A']; $("#form_div").children('div:first-child').css('margin-top', '0'); //FIXME:wei //如果环节id 等于流程环节启动id var lcyj = []; $.ajax({ type: "POST", async: false, url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projectId, data: '', dataType: 'json', success: function (res) { lcyj = res.data; } }); if (detailType != undefined) { if (detailType == "1") { if (flowObjectId == startTaskId) { $('#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div').css('display', 'inline-block'); } else { $('#ywxt_right,#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div').css('display', 'inline-block'); } } if (detailType == "2") { if (lcyj.length > 0) { $('#ywxt_right,#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div').css('display', 'inline-block'); } else { $('#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div').css('display', 'inline-block'); } } } else { $('#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div').css('display', 'inline-block'); } $("#createFolder,#uploadFile").show(); isTypeInreference = true; //$('#ywxt_right,#project_cl,#formPanel,#project_div_attachment,#form_div,#browsingGrp,#hint,#pro_btn_group_div button').css('display', 'inline-block'); if (_flowId == "t1001_4028d8397114eb4501713455a38d3544") { if (arr1.includes(flowObjectId)) { $("#pro_ywxt_csyj").remove(); $("#project_ywxt_textarea_cs").remove(); $("#project_ywxt_saveSuggest").remove(); } } $('#fj,#importGhcgBtn,#yjzjBtn').css('display', 'none'); $('#form').css({ "float": "left" }); $('#right_part').css({ "float": "right", "width": "495px", "margin-left": "20px" }); $('#project_cl').css({ 'margin-top': '33px', 'width': '100%' }); //$("#returnFile,#mbFallBack,#returned").attr('disabled', true); $("#mbFallBack,#returned").attr('disabled', true); $("#project_ywxt_suggest").css({ 'min-height': '400px', 'max-height': '510px' }); $("body").css("overflow", "auto"); $("#bodyContent").parent().css("overflow", "auto"); if (_flage) { $(".dtree-container").addClass("view-only"); $("#project_ywxt_saveSuggest, #project_ywxt_textarea_cs").attr('disabled', true); } suggestFun1(nodeName); } else { $("#browsingGrp").css('display', 'inline-block'); } } /** * 上传按钮点击事件 */ function uploadBtnClick() { var orign = localStorage.orign; if (orign == "ghsc") { if (_projectId === "" || _projectId === undefined || _projectId === null) { layer.msg('请先保存项目'); return; } } if (!layUpload || !layUploadObj) { layui.use(['upload'], function () { layUpload = layui.upload; layUploadObj = layUpload.render({ elem: "#importCgPackage", url: _projectId ? CONF_NEWGHSC_SERVERURL + '/ghsc/addWj' + `?userId=${cookieuser.user.id}&userName=${cookieuser.user.realname}&dirPath=${rootPath}&pid=${_projectId}&folderRootId=${fileListBack ? '' : ''}` : CONF_NEWGHSC_SERVERURL + `/ghsc/addWj?userId=${cookieuser.user.id}&userName=${cookieuser.user.realname}&dirPath=${rootPath}&folderRootId=${fileListBack ? '' : ''}`, //必填项 method: 'post', //可选项。HTTP类型,默认post accept: 'file', //允许上传的文件类型 acceptMime: 'aplication/zip,*.rar,*.7z,*.pdf,*.word,*.jpg,*.txt,*.ldb,*.mdb,*.xlsx', exts: 'zip|rar|7z|pdf|word|jpg|txt|ldb|mdb|xlsx', size: 1024000, headers: { "Accept": "application/json", "ContentType": "multipart/form-data" }, before: function (res) { layer.load(); //上传loading }, done: function (res, index, upload) { //上传完毕回调 console.log(res) if (res.code === 200) { fileListBack = res.data; layer.closeAll('loading'); //关闭loading /* var inputId ='xui.UI.Input-INPUT:j:' document.getElementById(inputId).value=66666; $('[id='+inputId+']').val("9999")*/ // var inputDom = document.getElementById(inputId); // $(inputDom).val("9999") // $("#xui\\.UI\\.Input-INPUT\\:j\\:").val("9999") layer.msg('上传成功'); if (dtree) { refreshMaterialsNew('', true) } else { loadMaterialsNew(flowObjectName || task.name, true); } } }, error: function (err) { //请求异常回调 layer.closeAll('loading'); //关闭loading layer.msg('上传失败'); } }); $("#importCgPackage").click(); }); } else { //重载该实例,支持重载全部基础参数 var arr = []; for (index in fileListBack) { arr.push(fileListBack[index]); } layUploadObj.reload({ url: _projectId ? CONF_NEWGHSC_SERVERURL + '/ghsc/addWj' + `?userId=${cookieuser.user.id}&userName=${cookieuser.user.realname}&dirPath=${rootPath}&pid=${_projectId}&folderRootId=${fileListBack ? arr.slice(-2, -1) : ''}` : CONF_NEWGHSC_SERVERURL + `/ghsc/addWj?userId=${cookieuser.user.id}&userName=${cookieuser.user.realname}&dirPath=${rootPath}&folderRootId=${fileListBack ? arr.slice(-2, -1) : ''}`, //必填项 }); $("#importCgPackage").click(); } } /** * 保存后提交文件 * @param {*保存完成获取的project} projectId */ function uploadFileListBeforeSend(projectId) { if (Array.isArray(fileListBack) && fileListBack.length > 0) { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/ghsc/updateWj', data: JSON.stringify({ list: fileListBack, userId: cookieuser.user.id, userName: cookieuser.user.realname, pid: projectId }), dataType: 'json', contentType: 'application/json', success: function (res) { if (res.code === 200) { refreshMaterialsNew(); } }, error: function (res) { console.log(res.message); } }); } } /** * * 成果上报表单按钮监听 FIXME: deleted */ // function cgsbFun() { // var _iframe = $("#formPanel>iframe")[0]; // _iframe.onload = function () { // setTimeout(function () { // // 导入规划成果按钮 // _iframe.contentDocument.getElementById('importResult').onclick = function () { // window.parent.uploadBtnClick(); // } // // 一键质检按钮 // _iframe.contentDocument.getElementById('qualityInspection').onclick = function () { // window.parent.qualityInspection(); // } // }, 500); // }; // } /** * * 一键质检 */ function qualityInspection() { if (!_projectId) { layer.msg('请先保存项目!'); return; } if (fileListBack == null) { layer.msg('请先导入成果包!'); return; } var data = window.formMgr.getDataJson(); var formData = JSON.parse(data); var xmlx = formData.XM.XMLX; if (xmlx == null || xmlx == "" || xmlx == undefined || xmlx == "请选择") { layer.msg("基本信息-规划类型不能为空"); return; } var ghjb = formData.XM.GHJB; if (ghjb == null || ghjb == "" || ghjb == undefined || ghjb == "请选择") { layer.msg("基本信息-规划级别不能为空"); return; } var xmmc = formData.XM.XMMC; if (xmmc == null || xmmc == "" || xmmc == undefined) { layer.msg("基本信息-规划名称不能为空"); return; } var ghqx = formData.XM.GHQX; if (ghqx == null || ghqx == "" || ghqx == undefined) { layer.msg("基本信息-规划期限不能为空"); return; } var bsrq = formData.CG_LS.BSRQ; if (bsrq == null || bsrq == "" || bsrq == undefined) { layer.msg("版本信息-报送日期不能为空"); return; } if (tableMerge == null) { layui.extend({ tableMerge: '/frontweb/libs/layui_ext/module/tableMerge' }).use(['tableMerge'], function () { tableMerge = layui.tableMerge; }); } setTimeout(function () { layui.use(['table', 'laytpl', 'form'], function () { let table = layui.table, form = layui.form, laytpl = layui.laytpl; $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/jcyj/getXzqyList', data: JSON.stringify({}), dataType: 'json', contentType: 'application/json', success: function (res) { if (res.code == 200 && res.data) { layer.open({ type: 1, title: '一键质检', id: '_uniqueYjzj', btn: [], area: ['auto', $(window).height() - 100 + "px"], maxmin: true, content: laytpl($("#yjzjTableTpl").html()).render(res.data), success: function (layero, index) { const tblCol = [ [ { field: 'name', merge: true, title: '检查分类', align: 'center', width: 160 }, { field: 'item', title: '检查项', width: 200, }, { field: 'description', title: '描述', width: 300 }, { field: 'result', title: '检查结果', align: 'center', width: 100, templet: function (d) { if (d.result === '通过') { return `<span style="color: #558337;">${d.result}</span>`; } else { return `<span style="color: #FF2A1B;">${d.result}</span>`; } } } ] ]; let configArr = []; // 一键质检列表 form.render(); $.ajax({ type: "POST", url: './config.json', async: false, dataType: 'json', contentType: 'application/json', success: function (res) { if (res.code == 0 && res.data) { configArr = res.data; form.on('submit(formDemo)', function (data) { _unPass = null; let _layerIndex = layer.load(); //加载中 $.ajax({ type: "POST", url: _projectId ? CONF_NEWGHSC_SERVERURL + '/fj/getYjzj?pid=' + _projectId + '&code=' + data.field.ghfw + '&cName=' + $(data.form).find('.layui-form-select dd.layui-this').eq(1).text() : CONF_NEWGHSC_SERVERURL + '/fj/getYjzj?parentId=' + fileListBack.slice(-2, -1) + '&code=' + data.field.ghfw + '&cName=' + $(data.form).find('.layui-form-select dd.layui-this').eq(1).text(), dataType: 'json', contentType: 'application/json', success: function (res) { layer.close(_layerIndex); if (res.code == 200 && res.data) { _unPass = res.data; let _newArr = JSON.parse(JSON.stringify(configArr)); if (typeof _unPass === 'object') { for (let item in _unPass) { _newArr[item].result = '不通过'; _newArr[item].description = _unPass[item]; } } /** * 自动合并表格 */ table.render({ elem: '#yjzjTable', limit: 1000, data: _newArr, page: false, cols: tblCol, done: function (r) { $("#yjzjFooter").show(); if (typeof _unPass === 'object') { $("#yjzjFooter p").html('检查结论: <span style="color: #FF2A1B;font-weight: 800;">不通过</span>'); } else { $("#yjzjFooter p").html('检查结论: <span style="color: #558337;font-weight: 800;">通过</span>'); } tableMerge.render(this); $(window).resize(); return false; } }); } }, error: function (e) { layer.close(_layerIndex); layer.msg('error'); return false; } }); return false; }); /** * 自动合并表格 */ table.render({ elem: '#yjzjTable', limit: 1000, data: [], height: $(window).height() - 280, page: false, cols: tblCol, done: function (r) { $("#yjzjFooter").hide(); tableMerge.render(this); $(window).resize(); return false; } }); } } }); $(layero).on('click', '.show-detail', function () { yjzjDetail(() => { layer.restore(index); layero.siblings(".layui-layer-shade").show(); }); layer.min(index); layero.siblings(".layui-layer-shade").hide(); }); }, min: function (layero) { layero.siblings(".layui-layer-shade").hide(); }, restore: function (layero) { layero.siblings(".layui-layer-shade").show(); } }); } }, error: function (e) { layer.msg('error'); } }); }); }, 100); } /** * create by zys 2020/3/10 * layui dtree fj */ function dTreeInit(_id, _initData, _fn, _optFn) { if (dtree == null) { layui.extend({ dtree: '/frontweb/libs/layui_ext/dtree/dtree' }) // .use(['dtree'], function () { // dtree = layui.dtree; // }); dtree = layui.dtree; } setTimeout(() => { // 若dtree资源没有加载 重载页面 if (dtree == null) { location.reload(); } DemoTree = dtree.render({ elem: `#${_id}`, iconfontStyle: [{ fnode: { //一级节点 node: { //非叶子节点 open: "dtree-icon-xiangxia1", //节点展开 close: "dtree-icon-xiangyou" //节点关闭 }, leaf: "dtree-icon-null" //叶子节点 }, snode: { //二级节点 node: { //非叶子节点 open: "dtree-icon-null top-icon", //节点展开 close: "dtree-icon-weibiaoti5" //节点关闭 }, leaf: "dtree-icon-null top-icon-bottom" //叶子节点 }, }], toolbar: true, toolbarWay: "follow", // "contextmenu":右键菜单(默认),"fixed":"固定在节点后","follow":"跟随节点动态呈现" skin: "zdy", toolbarShow: [], toolbarFun: { loadToolbarBefore: function (buttons, param, $div) { buttons.addToolbar = "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'><i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>"; // 取消新增功能 if (param.leaf) { // 叶节点 // TODO:具体限制文件格式需修改 if (param.context.indexOf('.pdf') > 0 || param.context.indexOf('.png') > 0 || param.context.indexOf('.jpg') > 0) { buttons.addToolbar = "" + "<a title='预览文件' data-id=" + param.nodeId + " data-node='view' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'>" + "<img src='/frontweb/image/projecttask/view.png'></img></a>" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } else { buttons.addToolbar = "" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } } else if (param.name !== '根目录' && param.level != '1') { buttons.addToolbar = "" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } return buttons; // 将按钮对象返回 }, }, data: _initData, none: "暂无数据", done: function (res, $ul, first) { if (first) { dtreePointer = res[0]; } } }); // 绑定节点点击 dtree.on(`node('${_id}')`, (obj, e) => { if (typeof _fn === 'function') { // _fn.call(this, obj.param, _id)'' _fn(obj.param) } }); if (typeof _optFn === 'function') { $(`#${_id}`).on('click', '.dtree-optbtn', function (e) { if (e.stopPropagation) { e.stopPropagation() } else { e.cancelBubble = true; } _optFn.call(this, dtree.getParam(`${_id}`, $(this).data('id')), $(this).data('node')); }) } }, 500); } /** * create by zys 2020/3/10 * layui dtree fj */ function dTreeInit1(_id, _initData, _fn, _optFn) { if (dtree == null) { layui.extend({ dtree: '/frontweb/libs/layui_ext/dtree/dtree' }) // .use(['dtree'], function () { // dtree = layui.dtree; // }); dtree = layui.dtree; } setTimeout(() => { // 若dtree资源没有加载 重载页面 if (dtree == null) { location.reload(); } DemoTree = dtree.render({ elem: `#${_id}`, iconfontStyle: [{ fnode: { //一级节点 node: { //非叶子节点 open: "dtree-icon-xiangxia1", //节点展开 close: "dtree-icon-xiangyou" //节点关闭 }, leaf: "dtree-icon-null" //叶子节点 }, snode: { //二级节点 node: { //非叶子节点 open: "dtree-icon-null top-icon", //节点展开 close: "dtree-icon-weibiaoti5" //节点关闭 }, leaf: "dtree-icon-null top-icon-bottom" //叶子节点 }, }], toolbar: true, toolbarWay: "follow", // "contextmenu":右键菜单(默认),"fixed":"固定在节点后","follow":"跟随节点动态呈现" skin: "zdy", toolbarShow: [], toolbarFun: { loadToolbarBefore: function (buttons, param, $div) { buttons.addToolbar = "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'><i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>"; // 取消新增功能 if (param.leaf) { // 叶节点 // TODO:具体限制文件格式需修改 if (param.context.indexOf('.pdf') > 0 || param.context.indexOf('.png') > 0 || param.context.indexOf('.jpg') > 0) { buttons.addToolbar = "" + "<a title='预览文件' data-id=" + param.nodeId + " data-node='view' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'>" + "<img src='/frontweb/image/projecttask/view.png'></img></a>" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } else { buttons.addToolbar = "" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } } else if (param.name !== '根目录' && param.level != '1') { buttons.addToolbar = "" + "<a title='下载文件' data-id=" + param.nodeId + " data-node='download' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/download.png'></img></a>" + "<a title='删除文件' data-id=" + param.nodeId + " data-node='delete' class='dtree-optbtn' style='padding-left: 5px;'>" + "<i class='dtreefont'><img src='/frontweb/image/projecttask/delete.png'></img></a>"; } return buttons; // 将按钮对象返回 }, }, data: _initData, none: "暂无数据", done: function (res, $ul, first) { if (first) { dtreePointer = res[0]; } } }); // 绑定节点点击 dtree.on(`node('${_id}')`, (obj, e) => { if (typeof _fn === 'function') { _fn(obj.param); } }); if (typeof _optFn === 'function') { $(`#${_id}`).on('click', '.dtree-optbtn', function (e) { if (e.stopPropagation) { e.stopPropagation() e.stopPropagation() e.stopPropagation() e.stopPropagation() } else { e.cancelBubble = true; } _optFn.call(this, dtree.getParam(`${_id}`, $(this).data('id')), $(this).data('node')); }) } }, 500); } /* * create by zys 2020/3/10 */ // 处理数据 function fjDataFormat(_data) { if (_data && Array.isArray(_data) && _data.length > 0) { let _arr = []; _data.forEach(item => { let _obj = {}; _obj.title = item.name; _obj.id = item.id; _obj.parentId = item.parentid; _obj.spread = true; let {fjList, ..._basicData} = item; _obj.basicData = _basicData; if (fjList && fjList.length === 0 && item.isDir === 'true') { _obj.iconClass = "dtree-icon-null top-icon"; _obj.children = [{ "id": "hidedata_develop_" + Math.floor(Math.random() * 1000000), "title": "隐藏", "last": true, "parentId": item.id, "hide": true, }]; } else if (fjList && fjList.length > 0) { _obj.children = fjDataFormat(fjList); } // 存储预览数组 strs = _basicData.name.split("."); if (strs[strs.length - 1] == 'jpg' || strs[strs.length - 1] == 'JPG' || strs[strs.length - 1] == 'png' || strs[strs.length - 1] == 'PNG' || strs[strs.length - 1] == 'gif' || strs[strs.length - 1] == 'GIF' || strs[strs.length - 1] == 'bmp' || strs[strs.length - 1] == 'BMP' ) { parent.imgArrSrc.push(_obj.basicData); } _arr.push(_obj); }); return _arr; } } // loadMaterials function loadMaterialsNew(nodeName, rename) { var _iframe = $("#formPanel>iframe")[0]; // FIXME: 暂时注释 // var _includeArr = ['成果上报', '初审', '审批', '技术审查', '初审确认', '局内协同', '局内协同确认', '局外协同', '局外协同确认', '批复', '局内协同-市政']; // TODO: 附件 // FIXME: 申请环节为新增流程 申请数据流程 // if (_includeArr.includes(nodeName)) { if (!_projectId && Array.isArray(fileListBack)) { console.log(fileListBack.slice(-2, -1)) var foldId = fileListBack.slice(-2, -1).length < 1 ? fileListBack : fileListBack.slice(-2, -1); $.ajax({ type: "POST", //url: CONF_NEWGHSC_SERVERURL + '/fj/getLsFjList?id=' + fileListBack.slice(-2, -1), url: CONF_NEWGHSC_SERVERURL + '/fj/getLsFjList?id=' + foldId, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { $("#noAttachment").hide(); // 表单项目名称赋值 if (rename) { setTimeout(function () { var _iframXmmc = _iframe.contentDocument.getElementById('importResult').getElementsByTagName("input")[0]; if (_iframXmmc.value !== '') { _iframXmmc.value = ''; } _iframXmmc.value = res.data.name; }, 200); } fileListBack = res.data; parent.imgArrSrc = []; let _data = fjDataFormat([res.data]); dTreeInit('project_fjTree', _data, '', (resOpt, _opt) => { if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); } }); } else { $("#noAttachment").show(); } }, error: function (e) { $("#noAttachment").show(); layer.msg('error'); } }); return; } else if (!_projectId && !Array.isArray(fileListBack)) { $("#noAttachment").show(); return; } else { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/fj/getFjList?id=' + _projectId, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { $("#noAttachment").hide(); // 表单项目名称赋值 if (rename) { setTimeout(function () { var _iframXmmc = _iframe.contentDocument.getElementById('importResult').getElementsByTagName("input")[0]; if (_iframXmmc.value !== '') { _iframXmmc.value = ''; } _iframXmmc.value = res.data[0].name; }, 200); } parent.imgArrSrc = []; let _data = fjDataFormat([res.data[0]]); //_data = fjDataFormat([res.data[0]]); dTreeInit('project_fjTree', _data, res => { // 点击附件查看附件预览 // if (version && version.indexOf('1.0') > -1) { // if (nodeName.indexOf('初审') > -1) { // layer.open({ // id: res.nodeId, // type: 2, // area: ['1000px', '750px'], // fixed: false, //不固定 // maxmin: true, // content: '/frontweb/view/reviewmanage/resultreview/widgets/Review/Review/images/XXXXXX县国土空间规划成果初审报告.pdf' // }); // } // } }, (resOpt, _opt) => { if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); } }); /*let data1 = fjDataFormat([res.data[1]]); dTreeInit1('project_bgTree', data1, res => { }, (resOpt, _opt) => { if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); } });*/ if (res.data.length > 1) { let data1 = fjDataFormat([res.data[1]]); $("#noAttachment1").hide(); dTreeInit1('project_bgTree', data1, res => { }, (resOpt, _opt) => { if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); } }); } } else { $("#noAttachment").show(); } }, error: function (e) { $("#noAttachment").show(); layer.msg('error'); } }); } // } } // refresh dtree function refreshMaterialsNew(selectedNodeId, rename) { var _iframe = $("#formPanel>iframe")[0]; console.log(fileListBack); if (!_projectId && Array.isArray(fileListBack)) { var foldId = fileListBack.slice(-2, -1).length < 1 ? fileListBack : fileListBack.slice(-2, -1); $.ajax({ type: "POST", //url: CONF_NEWGHSC_SERVERURL + '/fj/getLsFjList?id=' + fileListBack.slice(-2, -1), url: CONF_NEWGHSC_SERVERURL + '/fj/getLsFjList?id=' + foldId, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { // 表单项目名称赋值 if (rename) { setTimeout(function () { var _iframXmmc = _iframe.contentDocument.getElementById('importResult').getElementsByTagName("input")[0]; if (_iframXmmc.value !== '') { _iframXmmc.value = ''; } _iframXmmc.value = res.data.name; }, 200); } parent.imgArrSrc = []; let _data = fjDataFormat([res.data]); dtree.reload("project_fjTree", { data: _data, done: function (data, obj, first) { if (first) { selectedNodeId && dtree.dataInit("project_fjTree", selectedNodeId); // 选中 } $('.dtree').on('click', '.dtree-optbtn', function (e) { if (e.stopPropagation) { e.stopPropagation() } else { e.cancelBubble = true; } let resOpt = dtree.getParam('project_fjTree', $(this).data('id')); let _opt = $(this).data('node'); if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); } }) layer.msg("创建成功!", { icon: 1, time: 1500, end: () => { layer.closeAll(); } }); } }); } else { this.error() } }, error: function (e) { layer.msg('error'); } }); return; } else if (!_projectId && !Array.isArray(fileListBack)) { $("#noAttachment").show(); return; } else { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/fj/getFjList?id=' + _projectId, data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { // 表单项目名称赋值 if (rename) { setTimeout(function () { var _iframXmmc = _iframe.contentDocument.getElementById('importResult').getElementsByTagName("input")[0]; if (_iframXmmc.value !== '') { _iframXmmc.value = ''; } _iframXmmc.value = res.data[0].name; }, 200); } parent.imgArrSrc = []; let _data = fjDataFormat([res.data]); dtree.reload("project_fjTree", { data: _data, done: function (data, obj, first) { if (first) { selectedNodeId && dtree.dataInit("project_fjTree", selectedNodeId); // 选中 } $('.dtree').on('click', '.dtree-optbtn', function (e) { if (e.stopPropagation) { e.stopPropagation(); } else { e.cancelBubble = true; } let resOpt = dtree.getParam('project_fjTree', $(this).data('id')); let _opt = $(this).data('node'); if (_opt === 'view') { preview2({filename: resOpt.basicData.path}); } else if (_opt === 'download') { downloadfile2({filename: resOpt.basicData.path}, window.event || arguments.callee.caller.arguments[0]); } else if (_opt === 'delete') { deletefile2(resOpt.context, resOpt.basicData.isDir, 'origin', window.event || arguments.callee.caller.arguments[0], resOpt.nodeId); return; } }); setTimeout(() => { layer.closeAll(); }, 1000); } }); } else { this.error() } }, error: function (e) { layer.msg('error'); } }); } } /** * 意见框 * create by wj */ function suggestFun(_id) { layui.use(['laytpl', 'element'], function () { var element = layui.element, laytpl = layui.laytpl; var $suggest = $("#project_suggest"); $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _id, data: '', dataType: 'json', success: function (res) { console.log('1---sug') if (res.code == 200) { for (var item in res.data) { var date = new Date(res.data[item].createtime); res.data[item].createtime = date.format('yyyy-MM-dd hh:mm:ss'); if (res.data[item].userid === userid) { res.data[item].sf = '2'; } else { res.data[item].sf = '1'; } } //直接解析字符 laytpl($("#projectFsTpl").html()).render(res.data, function (_html) { $suggest.html(_html); $suggest.scrollTop($suggest[0].scrollHeight) }); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); element.on('tab(filter)', function (data) { if (data.index == 0) { $("#right_part").show(); } else { $("#right_part").hide(); } if (data.index == 1) { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _id, data: '', dataType: 'json', success: function (res) { console.log('2---sug') if (res.code == 200) { for (var item in res.data) { var date = new Date(res.data[item].createtime); res.data[item].createtime = date.format('yyyy-MM-dd hh:mm:ss'); if (res.data[item].userid === userid) { res.data[item].sf = '2'; } else { res.data[item].sf = '1'; } } //直接解析字符 laytpl($("#projectFsTpl").html()).render(res.data, function (_html) { $suggest.html(_html); $suggest.scrollTop($suggest[0].scrollHeight) }); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); } if (data.index == 2) { $('.ghcg_right_footer_right_middle').css('display', 'block'); } }); }); } function suggestFun1(_nodename) { layui.use(['laytpl', 'element'], function () { var element = layui.element, laytpl = layui.laytpl; var $suggest = $("#project_suggest"); element.on('tab(filterYwxt)', function (data) { if (data.index == 0) { $('#form_div,#browsingGrp,#hint,#fj,#divNoAttachment,#project_cl,#project_div_attachment').css('display', 'inline-block'); } else if (data.index == 1) { $('#form_div,#browsingGrp,#hint,#fj,#divNoAttachment,#project_cl,#project_div_attachment').css('display', 'none'); if (!_projectId) { return; } $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projectId, data: '', dataType: 'json', success: function (res) { console.log('3---sug') console.log('nodename--', _nodename) if (res.code == 200) { for (var item in res.data) { var date = new Date(res.data[item].createtime); res.data[item].createtime = date.format('yyyy-MM-dd hh:mm:ss'); if (res.data[item].userid === userid) { res.data[item].sf = '2'; } else { res.data[item].sf = '1'; } } //直接解析字符 laytpl($("#projectFsTpl").html()).render(res.data, function (_html) { $("#project_ywxt_suggest").html(_html); }); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); } }); $('#project_ywxt_saveSuggest').off('click').on('click', function () { var yjnr = $('#project_ywxt_textarea_cs').val(); var $suggest = $("#project_ywxt_suggest"); if (!_projectId) { return; } var ifpass = false; $.ajax({ type: "POST", dataType: 'json', contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/Yj/isPossessAuthority', data: JSON.stringify({ hjmc: flowObjectName, pid: projectid, sid: flowObjectId, }), success: function (res) { if (res.data === "ok") { ifpass = true; if (yjnr) { Sendcomments(yjnr) } else { layer.msg('意见不能为空,请填写意见'); } } else { layer.msg("当前环节无法发送意见") return false; } } }); }); }); }; /** * 发送意见 */ function Sendcomments(yjnr) { layui.use(['laytpl', 'element'], function () { var element = layui.element, laytpl = layui.laytpl; var $suggest = $("#project_suggest"); $.ajax({ type: "POST", dataType: 'json', contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/Yj/editLcyj', data: JSON.stringify({ lchj: flowObjectName, pid: projectid, userid: userid, username: username, yjnr: yjnr, hjId: flowObjectId }), success: function (res) { if (res.code == 200) { layer.msg('保存成功'); // suggestFun1('人防工程竣工验收'); // 直接解析字符 $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projectId, data: '', dataType: 'json', success: function (res) { console.log('4---sug') if (res.code == 200) { // isSendComments = true for (var item in res.data) { var date = new Date(res.data[item].createtime); res.data[item].createtime = date.format('yyyy-MM-dd hh:mm:ss'); if (res.data[item].userid === userid) { res.data[item].sf = '2'; } else { res.data[item].sf = '1'; } } // 直接解析字符 laytpl($("#projectFsTpl").html()).render(res.data, function (_html) { $("#project_ywxt_suggest").html(_html); }); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); $('#project_ywxt_textarea_cs').val("") } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); }); } /** * zys * @param {*} yjnr 意见内容 */ function saveSuggest(yjnr) { //layer.msg(flowObjectId) if (yjnr) { layui.use('laytpl', function () { var laytpl = layui.laytpl; var $suggest = $("#project_suggest"); $.ajax({ type: "POST", dataType: 'json', contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/Yj/editLcyj', data: JSON.stringify({ lchj: flowObjectName, pid: projectid, userid: userid, username: username, yjnr: yjnr, hjId: flowObjectId }), success: function (res) { if (res.code == 200) { // $('#project_textarea_cs').val(""); layer.msg('保存成功'); //直接解析字符 $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projectId, data: '', dataType: 'json', success: function (res) { console.log('5---sug') if (res.code == 200) { for (var item in res.data) { var date = new Date(res.data[item].createtime); res.data[item].createtime = date.format('yyyy-MM-dd hh:mm:ss'); if (res.data[item].userid === userid) { res.data[item].sf = '2'; } else { res.data[item].sf = '1'; } } //直接解析字符 laytpl($("#projectFsTpl").html()).render(res.data, function (_html) { $suggest.html(_html); $suggest.scrollTop($suggest[0].scrollHeight) }); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); $('#project_textarea_cs').val("") //生成流程意见报告; $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/ghsc/createScYjReport', data: JSON.stringify({ flowObjectId: flowObjectId, userId: userid, userName: username, pid: _projectId }), dataType: 'json', contentType: "application/json;charset=UTF-8", async: false, success: function (res) { if (res.code == 200) { layer.msg(res.msg); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); loadMaterialsNew(flowObjectName); } else { layer.msg('error'); } }, error: function (e) { layer.msg('error'); } }); }); } else { layer.msg('意见不能为空,请填写意见') } } /** * zys * 审查要点 */ function scydFun() { $('#project_suggest_div .ghcg_right_footer_right_middle .ghcg_right_footer_right_middle_ziti').on('click', function () { var $this = $(this); var _index = $this.index(); if (_index == 0) { $('#bodyContent').parent().hide(); $('#project_nav_button').hide(); $('.layui-breadcrumb').css({ 'display': 'inline-block', 'font-weight': 'bold', }); $('#project_zb').html('指标符合性'); $('#project_ghzb').html('指标符合性'); $('.pro_content').css('display', 'flex'); $('#nav').css('position', 'static'); $('#project_zbfhx_back').css('display', 'inline-block'); $('#project_zbfhx_back').off('click').on('click', function () { $('#bodyContent').parent().show(); $('#project_nav_button').show(); $('#nav').css('position', 'fixed'); $('.layui-breadcrumb,.pro_content,#project_zbfhx_back').hide(); }); } else if (_index == 1) { $('#bodyContent').parent().hide(); $('#project_nav_button,.pro_content_left table').hide(); $('.layui-breadcrumb').css({ 'display': 'inline-block', 'font-weight': 'bold' }); $('#project_zb').html('空间一致性'); $('#project_ghzb').html('规划分区是否符合控制线要求'); $('.pro_content,.pro_content img').css('display', 'flex'); $('#nav').css('position', 'static'); $('#project_zbfhx_back').css('display', 'inline-block'); $('#project_zbfhx_back').off('click').on('click', function () { $('#bodyContent').parent().show(); $('#project_nav_button').show(); $('#nav').css('position', 'fixed'); $('.layui-breadcrumb,.pro_content,#project_zbfhx_back').hide(); }) } }); if (!taskId && stats != "Manage") { $('.pro_content').find("textarea,button").attr('disabled', true); } } /** * 一键质检详情 * create by wj */ function yjzjDetail(_callback) { layui.use(['element', 'laytpl', 'table'], function () { let element = layui.element, laytpl = layui.laytpl, table = layui.table; const cols = [[ //表头 { field: 'xh', title: '序号', type: 'numbers', align: 'center', width: 80 }, { field: 'errorType', title: '错误类型', align: 'center' }, { field: 'errorXq', title: '错误描述', align: 'center' }, { field: 'errorJb', title: '错误级别', align: 'center', templet: function (d) { if (d.errorJb == 0) { return '<span style="color:#FA8C16;">较严重</span>' } if (d.errorJb == 1) { return '<span style="color:#F5151E;">严重</span>' } if (d.errorJb == 2) { return '<span style="color:#999999;">极严重</span>' } } } ]]; const cols_1 = [[ //表头 { field: 'xh', title: '序号', type: 'numbers', align: 'center', width: 80 }, { field: 'errorType', title: '错误类型', align: 'center' }, { field: 'indexName', title: '指标名称', align: 'center' }, { field: 'attribute', title: '属性', align: 'center' }, { field: 'wbszb', title: '文本上指标', align: 'center' }, { field: 'sjxdzb', title: '上级下达指标', align: 'center' }, { field: 'cz', title: '差值', align: 'center' }, { field: 'errorLevel', title: '错误级别', align: 'center' } ]]; const isNeedLoad = [false, true, true, true, true, true, true]; $("#nav>.data-operation").hide(); $("#bodyContent").parent().hide(); $("#project_yjzj_detail").show(); $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/fj/getFjZjXqList?parentId=' + fileListBack.slice(-2, -1), data: '', dataType: 'json', success: function (res) { if (res.code == 200 && res.data) { $('.sjwzx').html('数据完整性(' + res.data.length + ')'); table.render({ elem: '#projectYjzyTableSjwzx', // url: CONF_NEWGHSC_SERVERURL + '/fj/getFjZjXqList?parentId=' + fileListBack.slice(-2, -1), //数据接口 data: res.data, // method: "POST", // contentType: 'application/json', // parseData: function (res) { //res 即为原始返回的数据 // $('.sjwzx').html('数据完整性(' + res.data.length + ')') // return { // "code": res.code == 200 ? 0 : -1, //解析接口状态 // "data": res.data, //解析数据列表 // "msg": res.msg, //解析提示文本 // }; // }, page: true, //开启分页 limit: 10, limits: [10, 20, 30, 40, 100], // height: $(window).height() - 200, cols: cols, toolbar: '<h4>错误列表</h4>', defaultToolbar: ['exports'], text: { none: '暂无相关数据' //默认:无数据。注:该属性为 layui 2.2.5 开始新增 } }); } } }); element.on('tab(docDemoTabBriefYjzj)', function (data) { switch (data.index) { case 0: if (isNeedLoad[data.index]) { table.render({ elem: '#projectYjzyTableSjwzx', url: CONF_NEWGHSC_SERVERURL + '/fj/getFjZjXqList?parentId=' + fileListBack.slice(-2, -1), //数据接口 method: "POST", contentType: 'application/json', parseData: function (res) { //res 即为原始返回的数据 $('.sjwzx').html('数据完整性(' + res.data.length + ')') return { "code": res.code == 200 ? 0 : -1, //解析接口状态 "data": res.data, //解析数据列表 "msg": res.msg, //解析提示文本 }; }, page: false, //开启分页 limit: 100000, cols: cols, toolbar: '<h4>错误列表</h4>', defaultToolbar: ['exports'], text: { none: '暂无相关数据' //默认:无数据。注:该属性为 layui 2.2.5 开始新增 } }); isNeedLoad[data.index] = false; } break; case 5: if (isNeedLoad[data.index]) { table.render({ elem: '#projectYjzyTableBgsjjc', // url: '/demo/table/user/', //数据接口 data: [ { errorType: 'faf', errorDscription: '阿达', errorLevel: '严重', } ], // 测试 page: false, //开启分页 limit: 100000, cols: cols, toolbar: '<h4>错误列表</h4>', defaultToolbar: ['exports'], text: { none: '暂无相关数据' //默认:无数据。注:该属性为 layui 2.2.5 开始新增 } }); isNeedLoad[data.index] = false; } break; case 6: if (isNeedLoad[data.index]) { table.render({ elem: '#projectYjzyTableZbfhxjc', // url: '/demo/table/user/', //数据接口 data: [ { errorType: 'faf', errorDscription: '阿达', errorLevel: '严重', } ], // 测试 page: false, //开启分页 limit: 100000, cols: cols_1, toolbar: '<h4>错误列表</h4>', defaultToolbar: ['exports'], text: { none: '暂无相关数据' //默认:无数据。注:该属性为 layui 2.2.5 开始新增 } }); isNeedLoad[data.index] = false; } break; default: break; } }); // 返回按钮 $("#project_yjzj_detail").on('click', 'button.back', function () { $("#project_yjzj_detail").hide(); $("#nav>.data-operation").show(); $("#bodyContent").parent().show(); _callback(); }); }); } /** * * 是否有权限发送意义 */ function isHavePermission() { return new Promise((resolve, reject) => { $.ajax({ type: "POST", dataType: 'json', async: false, contentType: 'application/json', url: CONF_NEWGHSC_SERVERURL + '/Yj/isPossessAuthority', data: JSON.stringify({ hjmc: flowObjectName, pid: projectid, sid: flowObjectId, }), success: function (res) { console.log("+++++++++++++++++++++++++++++") console.log(res) if (res.data === "ok") { return resolve(true) } else { return reject(false); } } }); }).catch((err) => { return err; }) } /** * 是否发送意见判断 */ function isSendComments() { return new Promise((resolve, reject) => { $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/Yj/getLcYjList?pid=' + _projectId, data: '', dataType: 'json', async: false, success: function (res) { console.log("++++++++++++++++++++++++++++++=") console.log(res) for (let i = 0; i < res.data.length; i++) { console.log() var name = res.data[i].username.split("-"); if (res.data[i].lchj == flowObjectName && name[1] == username && res.data[i].hjId == flowObjectId) { return resolve(true) } } return reject(false); // layer.msg("请填写审查意见") //callback (false); } }); }).catch((err) => { return err; }) } /** * 是否录入坐标 */ function isTypeIn() { return new Promise((resolve, reject) => { var param = { 'projectCode': _projectId, }; $.ajax({ type: "POST", url: CONF_GIS_ONEMAP + "projectMap/getProjectMapAndProjectLayerOne", data: JSON.stringify(param), contentType: 'application/json', async: false, success: function (res) { if (res != null && res != "") { return resolve(true) } return reject(false) } }) }).catch((err) => { return err; }) } /** * 下载保密协议 * @param params * @param e */ function download(params, e) { var tag = params["tag"]; var fileadress = params["filename"]; var filedir = fileadress.substring(fileadress.lastIndexOf("/") + 1, fileadress.length); //真实文件名 params.tag = tag || filedir; var fileType = fileadress.split("/")[1]; //生成带水印的pdf filedir = filedir.toLocaleLowerCase(); if (watermark != '' && filedir.indexOf(".pdf") != -1) { //只给公文添加水印 if (fileType == 'SW' || fileType == 'FW' || fileType == 'XJ' || fileType == 'JY') { if (createWatermarkPdf) { var wmd = waterMarkData(params["filename"], 'isQRC');//isTEXT var pdfFilePath = createWatermarkPdf(wmd); params.filename = pdfFilePath != '' ? pdfFilePath : params.filename; } } } params.tag = params.tag.toLocaleLowerCase(); params.filename = encodeURI(params.filename).replace(/\#/g, '%23').replace(/\;/g, '%3b'); $(".div-attachment-control").click(function (event) { event.stopPropagation(); }); var verify; $.ajax({ type: "post", url: CONF_DOC_SERVERURL + "/mvc/ftpfile/verifyFile.do", data: {filepath: params.filename}, async: false, success: function (data) { verify = data.message; } }); if (verify == "error") { layer.msg("文件不存在!", {icon: 2}); return; } e = window.event || e; if (e.stopPropagation) { e.stopPropagation(); var iphost = CONF_DOC_SERVERURL; var url = iphost + "ftpfile/downloadfile.do"; var temp = document.createElement("form"); temp.action = url; temp.method = "post"; temp.style.display = "none"; for (var x in params) { var opt = document.createElement("textarea"); opt.name = x; opt.value = params[x]; temp.appendChild(opt); } document.body.appendChild(temp); temp.submit(); return temp; /*var url = CONF_DOC_SERVERURL +"ftpfile/downloadfile.do?"; for (var key in params) { url += (key + '=' + params[key] + '&'); } var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = "blob"; xhr.onload = function () { if (this.status === 200) { var blob = this.response; var aelm = document.createElement('a'); aelm.href = URL.createObjectURL(blob); aelm.download = params.tag; $("body").append(aelm); aelm.click(); $(aelm).remove(); } else { //eCallback(this); } }; xhr.send();*/ } else { e.cancelBubble = true; } } /** * 发送之前校验 */ async function sendClickBefore() { var insId = null; if (task.instanceId != null && task.instanceId != undefined && task.instanceId != '') { insId = task.instanceId; } if (task.instanceId == null || task.instanceId == undefined || task.instanceId == '') { if (flowInstanceId != null && flowInstanceId != undefined && flowInstanceId != '') { insId = flowInstanceId; } } var startTaskId = null; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getStartTask?instanceId=' + insId, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 startTaskId = res.data; } else { console.log("查询当前流程的启动环节失败"); } }, error: function (e) { console.log("查询当前流程的启动环节失败"); } }); if (_flowId == 't1001_4028d83970955d2a01709577b3870018') { if (flowObjectId == startTaskId) { if (!quality) { layer.msg('您还没有进行一键质检'); return false; } } } var arr1 = ['sid-862DE529-CECB-4360-ABDB-CFA518A0907F', 'sid-1CC0CEE0-D6C2-461A-807B-2361D0E8BC54', 'sid-2D676B0B-FBF0-42E3-9A8C-7860614DAF7A']; var flowId1 = 't1001_4028d839710f68d101710f8b74ad0006' var hjArr = []; $.ajax({ type: "GET", url: CONF_NEWGHSC_SERVERURL + '/flow/getFlowObjectIds?flowId=' + flowId1, data: '', async: false, dataType: 'json', success: function (res) { console.log(res) if (res.code == 200) { //直接解析字符 hjArr = res.data; } else { console.log("查询当前流程的所有环节失败"); } }, error: function (e) { console.log("查询当前流程的所有环节失败"); } }); if (!hjArr.includes(flowObjectId) && !arr1.includes(flowObjectId)) { let first = await isHavePermission(); let second = await isSendComments(); if (first && !second) { layer.msg('请填写审查意见') return false; } } if (isTypeInreference) { let isType = await isTypeIn(); let first = await isHavePermission(); if (!first && !isType) { layer.msg("请录入坐标") return false; } } var orign = localStorage.orign; var obj = localStorage.value; if (version && version.indexOf('1.0') > -1) { if (obj == null && fileListBack != null) { obj = fileListBack; } if (obj == null && fileListBack == null && v2FileListBack != null) { obj = v2FileListBack; } } if (version && version.indexOf('2.0') > -1) { obj = v2FileListBack; } console.log(obj) if (obj === "" || obj === undefined || obj === null) { layer.msg('请先导入材料!'); } else { sendClick(); } _unPass = true; if (flowObjectName == '成果上报' || task.name == '成果上报') { if (_unPass === null) { layer.msg('质检不通过!'); } } } var quality = false; function createReport() { var data = window.formMgr.getDataJson(); var formData = JSON.parse(data); var xmlx = formData.XM.XMLX; var ghjb = formData.XM.GHJB; var xmmc = formData.XM.XMMC; var ghqx = formData.XM.GHQX; var ghfw = formData.XM.GHFW; var bsrq = formData.CG_LS.BSRQ; var cgbbh = formData.CG_LS.CGBBH; $.ajax({ type: "POST", url: CONF_NEWGHSC_SERVERURL + '/ghsc/createPdfFileAndFold', data: JSON.stringify({ userId: userid, userName: username, pid: _projectId, yjzjData: { xmlx: xmlx, ghjb: ghjb, xmmc: xmmc, ghqx: ghqx, bsrq: bsrq, ghfw: ghfw, cgbbh: cgbbh } }), async: false, dataType: 'json', contentType: "application/json;charset=UTF-8", success: function (res) { console.log(res) if (res.code == 200) { layer.msg('生成一键质检报告成功'); $("#yjzjTableTpl").css("display", "none"); loadMaterialsNew(flowObjectName); } else { console.log("生成一键质检报告失败"); $("#yjzjTableTpl").remove(); } }, error: function (e) { console.log("生成一键质检报告失败"); $("#yjzjTableTpl").remove(); } }); quality = true; }