'use strict'; var app = angular.module('app', [ ]); app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) { var self = this; var s4 = new SM4Util(); self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-chineseName"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); self.routeid = sp.getUrlName("routeid"); self.routeinfoid = sp.getUrlName("routeinfoid"); self.copyrightid = sp.getUrlName("copyrightid"); self.directionid = sp.getUrlName("directionid"); self.formeditid = sp.getUrlName("formeditid"); self.mbid = sp.getUrlName("mbid"); self.fjid = sp.getUrlName("fjid"); self.docmode = sp.getUrlName("docmode"); self.dotype = sp.getUrlName("dotype"); self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno"); self.get_lastReturnPage = sp.getUrlName("lastReturnPage"); self.get_type = sp.getUrlName("type"); self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME"); var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) { return item.CNAME }) //上层附件、业务参考、共享沟通组件 self.uploading = false; self.upload = function () { $('#fileupload').fileupload({ url: apiurljs.login + 'g2app/abase/uploadFileWithForm', dataType: 'json', beforeSend: function (xhr, data) { xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken); xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=规范性文件修改默认部门")); }, add: function (e, data) { var num = 0; var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i') //文件类型判断 $.each(data.originalFiles, function (index, item) { if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) { sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!"); return; } else { num++ } }) if (num == data.originalFiles.length) { self.uploading = true; data.submit(); $scope.$apply(); } }, // 上传完成后的执行逻辑 done: function (e, data) { self.uploading = false; self.getOther() } }) } self.downLoad = function (item) { window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7)) } self.deleteFile = function (file) { var dialogHead = "温馨提示×"; var dialogBody = "
删除后不可恢复,您确认要删除吗?
"; var dialogFoot = "
"; $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot); sp.openCenter(".sp-dialog"); ///取消按钮 $('.sp-closeDialog').click(function (event) { sp.closeCenter(".sp-dialog"); event.preventDefault(); event.stopPropagation(); }); //post消息的id $("#delDataTrue").click(function () { var data = { tablename: "FILE_ATTACH", id: file.ID }; $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.dialoghide(); if (res.success) { self.getOther(); } else { sp.dialog("删除失败,请联系管理员!"); } }); }); } self.goAttach = function (obj) { if (obj) { if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) { sp.dialog("文件暂不支持在线预览,请点击下载查看!") return } $("#attachlist")[0].contentWindow.openFile(obj) if ($(".fa-chevron-down").is(":hidden") == true) { showToggle(document.getElementById("toggleButton")) } } else { $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid) } } self.readonly = { JJCD: false, FWZH: false, WLDQFL:false, WLDSSL:false, XXGKSH:false, SFXYJD:false, FLSH:false, GPJZSC:false, SX:false, BMFZRYJ:false, NGR:false, NGRQ:false, HBCSYJ:false, GWZL:false, YF:false, BT:false, ZS:false, CS:false, FF:false, SMWJSHYJ:false, YFRQ:false, SXRQ:false, FZRQ:false, ZRCS:false, NBBM:false } self.show = { FWZH: false } //初始化右上角按钮 self.buttonList = [] self.getSwenList = function (n) { self.SwenList = []; var data = { directionid: self.directionid, userid: self.userId, routeinfoid: self.routeinfoid, routeid: self.routeid, formeditid: "" } $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (self.copyrightid == "") { self.copyrightid = res.data.LINKS[0].COPYRIGHTID } $.each(res.data.LINKS, function (index, item) { item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid") if (item.TEMPFORM.indexOf("formedit.html") > -1) { self.Title = item.VNAME; } if (item.TEMPFORM.indexOf("?docmode") > 0) { item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage; } else { item.TEMPFORM = "#"; } self.SwenList.push(item) }) self.SwenList.push({ VNAME: "流程图", DIRECTIONID: self.SwenList[0].DIRECTIONID, TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1] }) if (n == 0) { self.getFLOW() } else { self.getData() } }) } self.getSwenList(0) self.getFLOW = function () { var data = { copyrightid: self.copyrightid } $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.flowTitle = res.data.CNAME; self.getJJCD() }) } self.getJJCD = function () { var data = { ckey: "CODE_JJCD", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.JJCD = res.data.CODE_JJCD; self.getXXGKSH() }) } self.getXXGKSH = function () { var data = { ckey: "CODE_XXGKSH", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.XXGKSH = res.data.CODE_XXGKSH; self.getFLSH() }) } self.getFLSH = function () { var data = { ckey: "CODE_FLSH", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); console.log('hhhhhh', res.data.CODE_FLSH) self.FLSH = res.data.CODE_FLSH; self.getGPJZSC() }) } self.getGPJZSC = function () { var data = { ckey: "CODE_GPJZSC", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.GPJZSC = res.data.CODE_GPJZSC; self.getGWZL() }) } self.getGWZL = function () { var data = { tablename: "CODE_GWTYPE", colums: "ID,CODE,CNAME,FLOWID", order: "ID desc", sqlwhere: { USEMARK: 1, FLOWID: sp.getUrlName("flowid") }, sqlinwhere: "", sqllikewhere: "" } $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); console.log(res.data) self.GWZL = res.data; self.getSFXYJD() }) } self.getSFXYJD = function () { var data = { ckey: "CODE_SFXYJD", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.SFXYJD = res.data.CODE_SFXYJD; self.getDP() }) } self.getDP = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION; self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE; self.getData(); }) } //获取数据 self.getData = function () { var data = { ckey: "FW_GFXWJXGMRBM", id: 0, directionid: self.directionid, formeditid: self.formeditid, routeid: self.routeid, routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.data = { ID: res.data.FW_GFXWJXGMRBM.ID, APPCODE: res.data.FW_GFXWJXGMRBM.APPCODE, JJCD: res.data.FW_GFXWJXGMRBM.JJCD == "" ? self.JJCD[0].CODE : res.data.FW_GFXWJXGMRBM.JJCD, FWZH: res.data.FW_GFXWJXGMRBM.FWZH, FWZH1: res.data.FW_GFXWJXGMRBM.FWZH, WLDQFL: res.data.FW_GFXWJXGMRBM.WLDQFL, WLDSSL: res.data.FW_GFXWJXGMRBM.WLDSSL, XXGKSH: res.data.FW_GFXWJXGMRBM.XXGKSH == "" ? self.XXGKSH[0].CODE : res.data.FW_GFXWJXGMRBM.XXGKSH, SFXYJD: res.data.FW_GFXWJXGMRBM.SFXYJD == "" ? self.SFXYJD[0].CODE : res.data.FW_GFXWJXGMRBM.SFXYJD, FLSH: res.data.FW_GFXWJXGMRBM.FLSH == "" ? self.FLSH[0].CODE : res.data.FW_GFXWJXGMRBM.FLSH, GPJZSC: res.data.FW_GFXWJXGMRBM.GPJZSC == "" ? self.GPJZSC[0].CODE : res.data.FW_GFXWJXGMRBM.GPJZSC, SX: res.data.FW_GFXWJXGMRBM.SX, BMFZRYJ: res.data.FW_GFXWJXGMRBM.BMFZRYJ, NGR: res.data.FW_GFXWJXGMRBM.NGR == "" ? self.userName : res.data.FW_GFXWJXGMRBM.NGR, NGRQ: res.data.FW_GFXWJXGMRBM.NGRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_GFXWJXGMRBM.NGRQ), HBCSYJ: res.data.FW_GFXWJXGMRBM.HBCSYJ, GWZL: res.data.FW_GFXWJXGMRBM.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_GFXWJXGMRBM.GWZL, YF: res.data.FW_GFXWJXGMRBM.YF, BT: res.data.FW_GFXWJXGMRBM.BT, FF: res.data.FW_GFXWJXGMRBM.FF == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_GFXWJXGMRBM.FF), SMWJSHYJ: res.data.FW_GFXWJXGMRBM.SMWJSHYJ == "" ? "否" : res.data.FW_GFXWJXGMRBM.SMWJSHYJ, YFRQ: res.data.FW_GFXWJXGMRBM.YFRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_GFXWJXGMRBM.YFRQ), SXRQ: res.data.FW_GFXWJXGMRBM.SXRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_GFXWJXGMRBM.SXRQ), FZRQ: res.data.FW_GFXWJXGMRBM.FZRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_GFXWJXGMRBM.FZRQ), ZRCS:res.data.FW_GFXWJXGMRBM.ZRCS, NBBM: res.data.FW_GFXWJXGMRBM.NBBM, ZS: res.data.FW_GFXWJXGMRBM.ZS, CS: res.data.FW_GFXWJXGMRBM.CS, NGRUSERID: res.data.FW_GFXWJXGMRBM.NGRUSERID == "" ? self.userId : res.data.FW_GFXWJXGMRBM.NGRUSERID, NGRBM: res.data.FW_GFXWJXGMRBM.NGRBM == "" ? self.userDpName : res.data.FW_GFXWJXGMRBM.NGRBM, NGRBMID: res.data.FW_GFXWJXGMRBM.NGRBMID == "" ? self.userDpCode : res.data.FW_GFXWJXGMRBM.NGRBMID } self.readonly = { JJCD: res.data.FW_GFXWJXGMRBM["JJCD.EREADONLY"] == "true", WLDQFL:res.data.FW_GFXWJXGMRBM["WLDQFL.EREADONLY"] == "true", WLDSSL:res.data.FW_GFXWJXGMRBM["WLDSSL.EREADONLY"] == "true", XXGKSH:res.data.FW_GFXWJXGMRBM["XXGKSH.EREADONLY"] == "true", SFXYJD:res.data.FW_GFXWJXGMRBM["SFXYJD.EREADONLY"] == "true", FLSH:res.data.FW_GFXWJXGMRBM["FLSH.EREADONLY"] == "true", GPJZSC:res.data.FW_GFXWJXGMRBM["GPJZSC.EREADONLY"] == "true", SX:res.data.FW_GFXWJXGMRBM["SX.EREADONLY"] == "true", BMFZRYJ:res.data.FW_GFXWJXGMRBM["BMFZRYJ.EREADONLY"] == "true", NGR:res.data.FW_GFXWJXGMRBM["NGR.EREADONLY"] == "true", NGRQ:res.data.FW_GFXWJXGMRBM["NGRQ.EREADONLY"] == "true", HBCSYJ:res.data.FW_GFXWJXGMRBM["HBCSYJ.EREADONLY"] == "true", GWZL:res.data.FW_GFXWJXGMRBM["GWZL.EREADONLY"] == "true", YF:res.data.FW_GFXWJXGMRBM["YF.EREADONLY"] == "true", BT:res.data.FW_GFXWJXGMRBM["BT.EREADONLY"] == "true", ZS:res.data.FW_GFXWJXGMRBM["ZS.EREADONLY"] == "true", CS:res.data.FW_GFXWJXGMRBM["CS.EREADONLY"] == "true", FF:res.data.FW_GFXWJXGMRBM["FF.EREADONLY"] == "true", SMWJSHYJ:res.data.FW_GFXWJXGMRBM["SMWJSHYJ.EREADONLY"] == "true", YFRQ:res.data.FW_GFXWJXGMRBM["YFRQ.EREADONLY"] == "true", SXRQ:res.data.FW_GFXWJXGMRBM["SXRQ.EREADONLY"] == "true", FZRQ:res.data.FW_GFXWJXGMRBM["FZRQ.EREADONLY"] == "true", ZRCS:res.data.FW_GFXWJXGMRBM["ZRCS.EREADONLY"] == "true", NBBM: res.data.FW_GFXWJXGMRBM["NBBM.EREADONLY"] == "true", FWZH: res.data.FW_GFXWJXGMRBM["FWZH.EREADONLY"] == "true" } self.show = { FWZH: res.data.FW_GFXWJXGMRBM["FWZH.ESHOW"] == "true" } if (self.data.ID == 0) { self.filedChange = true; } else { self.filedChange = false; } self.buttonList = res.data["FW_GFXWJXGMRBM.FUNCLIST"]; self.getOpinion('WLDQFL') self.getOpinion('WLDSSL') self.getOpinion('SX') self.getOpinion('BMFZRYJ') self.getOpinion('HBCSYJ') self.getOpinion1() self.getOther() self.getGCG() self.getFWZH() //watermark({ // "watermarl_element": "app", // "watermark_txt": "测试水印内容", // "watermark_width": 150, // "watermark_height": 110, // "watermark_angle": 345 //}) $timeout(function () { $(".formedit center").css("height", $(".formedit center").parent().next("div").height() - $(".formedit center").parent().next("div").children().eq(0).height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px") var height1 = $(".formedit center").css("height"), height2 = 0; $(".auto").siblings().each(function () { height2 = height2 + $(this).outerHeight(); }) $(".auto").css("height", height1.slice(0, height1.length - 2) - height2); }, 100) }) } self.getFWZH = function () { var data = { flowid: sp.getUrlName("flowid"), code: "", cyear: sp.currentYear(), routeinfoidmark: self.routeinfoid, zihao: self.data.FWZH } $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.FWZH = res.data.map(function (item) { return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] } }); if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE } }) } //获取附件和插件 self.getOther = function () { var data = { tablename: "FILE_ATTACH", colums: "*", order: "ID desc", sqlwhere: { ROUTEINFOID: self.routeinfoid }, sqlinwhere: "", sqllikewhere: "" } $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.arrayFile1 = []; if (res.data.length > 0) { res.data.forEach(function (item) { if (item.ATTACHTYPE.indexOf("-正文") > -1) { self.arrayFile = item; } else { self.arrayFile1.push(item) } }) self.goAttach() } }) } //发文打开过程稿在线编辑 self.getGCG = function () { var data = { dockind: "D01", routeinfoid: self.routeinfoid } $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.gaoTypeArrayFirst = res.data; }) } //获取意见(上表) self.getOpinion = function (str) { var data = { cmanid: self.userId, routeinfoid: self.routeinfoid, routeid: "",//self.routeid, tableid: "FW_GFXWJXGMRBM", colid: str, opiniontype: 0, orderbycol: "CDATE desc" } $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.YJ[str] = res.data; self.YJ[str + "STATUS"] = false; self.YJ[str].forEach(function (item) { item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE); if (item.ROUTEID == self.routeid) { self.YJ[str + "STATUS"] = true; } }) } else { sp.dialog(res.message) } }) } //获取意见(不上表) self.opiniontype = 99; self.getOpinion1 = function () { var data = { cmanid: self.userId, routeinfoid: self.routeinfoid, routeid: "",//self.routeid, tableid: "FW_GFXWJXGMRBM", colid: "", opiniontype: self.opiniontype, orderbycol: "CDATE desc" } $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.YJ.nulla = res.data; self.YJ.nullaSTATUS = false; self.YJ.nulla.forEach(function (item) { item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE); //if (item.ROUTEID == self.routeid && item.COLID == "") { // self.YJ.nullaSTATUS = true; //} }) } else { sp.dialog(res.message) } }) } //判断页面字段是否只读readonly、是否隐藏show self.hide = function (type, field) { if (self.dotype == 0 && type == "readonly") { return true; } else { if (self[type][field] == true) { return true; } else { return false; } } } //右上角按钮调用方法 self.btnEvent = function (item) { switch (item.CODE) { case "SAVEITEM": self.btnSave(0); break; case "PRINTITEM": self.btnPrint(); break; case "PRINTITEMEXTEND": self.btnPrint1(); break; case "MEETITEM": self.Meet(); break; case "SENDLOG": self.RouteList(); break; case "PUBLICITEM": self.PUBLICITEM(); break; case "FWZIHAO": return; break; default: self.forward(item); break; } } self.tiaohao = function () { var data = { data: { CYEAR: sp.currentYear(), FLOWID: sp.getUrlName("flowid"), ZIHAO: "", CNAMEMARK: "", ROUTEINFOIDMARK: self.routeinfoid, THMARK: 1 } } self.FWZH.forEach(function (item) { if (item.CODE == self.data.FWZH) { data.data.ZIHAO = item.CODE; data.data.CNAMEMARK = item.CNAMEMARK } }) $http.post(apiurljs.login + "g2app/fawen/saveZhanHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { var data1 = { flowid: sp.getUrlName("flowid"), code: self.userDpCode, cyear: sp.currentYear(), routeinfoidmark: self.routeinfoid, zihao: self.data.FWZH } $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg) .success(function (obj1) { var res1 = strToJson(s4.decryptData_CBC(obj1.data)); self.FWZH = res1.data.map(function (item) { return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] } }); self.data.FWZH = self.FWZH[0].CODE self.btnSave(0) }) } else { sp.dialog(res.message) } }) } self.tiaohaoR = function () { var data = { flowid: sp.getUrlName("flowid"), cnamemark: "", routeinfoidmark: self.routeinfoid, cyear: sp.currentYear(), zihao: self.data.FWZH } self.FWZH.forEach(function (item) { if (item.CODE == self.data.FWZH) { data.cnamemark = item.CNAMEMARK } }) $http.post(apiurljs.login + "g2app/fawen/initZiHaoByRouteinfoidmark", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { if (res.data == 0) { sp.dialog("此件当前暂无占号记录!") $timeout(function () { sp.dialoghide() }, 1500) return } var data1 = { flowid: sp.getUrlName("flowid"), code: self.userDpCode, cyear: sp.currentYear(), routeinfoidmark: self.routeinfoid, zihao: "" } $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg) .success(function (obj1) { var res1 = strToJson(s4.decryptData_CBC(obj1.data)); self.FWZH = res1.data.map(function (item) { return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] } }); self.data.FWZH = self.FWZH[0].CODE self.btnSave(0) console.log(self.FWZH) }) } else { sp.dialog(res.message) } }) } //保存提交 self.btnSave = function (n) { if (spngvld.submit(".sp-page-center")) { var data = { data: { CYEAR: sp.currentYear(), FLOWID: sp.getUrlName("flowid"), ZIHAO: "", CNAMEMARK: "", ROUTEINFOIDMARK: self.routeinfoid } } self.FWZH.forEach(function (item) { if (item.CODE == self.data.FWZH) { data.data.ZIHAO = item.CODE; data.data.CNAMEMARK = item.CNAMEMARK } }) $http.post(apiurljs.login + "g2app/fawen/saveWenHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { }) var dataArray = []; self.data.WLDQFL = ""; self.data.WLDSSL = ""; self.data.SX = ""; self.data.BMFZRYJ = ""; self.data.HBCSYJ = ""; dataArray.push(self.data); var data = { ckey: "FW_GFXWJXGMRBM", id: self.data.ID, routeid: self.routeid, routeinfoid: self.routeinfoid, routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT, directionid: self.directionid, formeditid: self.formeditid, data: JSON.stringify(dataArray) } $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.code == 0) { self.data.ID = res.data.ID; self.routeid = res.data.ROUTEID; self.routeinfoid = res.data.ROUTEINFOID; self.filedChange = false; if (n == 0) { sp.dialog("保存成功!"); $timeout(function () { sp.dialoghide() }, 1500) self.getSwenList(1) } else if (n == 1) { self.forward(self.btnItem); } else if (n == 2) { self.sendAll(); } else if (n == 3) { self.btnPrint(); } } else { sp.dialog(res.message) } }) } } //打印 self.btnPrint = function () { if (self.filedChange == true) { self.btnSave(3) } else { // 创建隐藏的可下载链接 var eleLink = document.createElement('a'); eleLink.download = ""; eleLink.style.display = 'none'; eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban12.ftl&tablename=FW_GFXWJXGMRBM&outfilepath=/tmp/规范性文件修改默认部门.wps&printdate=NGRQ,FF,YFRQ,SXRQ,FZRQ&routeinfoid=" + self.routeinfoid)); // 触发点击 document.body.appendChild(eleLink); eleLink.click(); // 然后移除 document.body.removeChild(eleLink); //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=FW_GFXWJXGMRBM&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid) } } /*综合打印*/ self.printFiled = 1; self.btnPrint1 = function () { if (self.filedChange == true) { self.btnSave(3) } else { sp.layer("#print") } } self.printSubmit = function () { if (self.printFiled == 1) { var templatefilename = "moban12" } else if (self.printFiled == 2) { var templatefilename = "mobanoption" } else { var templatefilename = "moban12_all" } var data = { templatefilename: templatefilename + ".ftl", outfilepath: "/tmp/规范性文件修改默认部门" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps", routeinfoid: self.routeinfoid, tablename: "FW_GFXWJXGMRBM", printtype: self.printFiled, printdate: "NGRQ,FF,YFRQ,SXRQ,FZRQ" } console.log(s4.encryptData_CBC(JSON.stringify(data))) $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url) sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览') }) //// 创建隐藏的可下载链接 //var eleLink = document.createElement('a'); //eleLink.download = ""; //eleLink.style.display = 'none'; //eleLink.href = apiurljs.login + "g2app/dataabase/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=" + templatefilename + ".ftl&tablename=SW_DWGWCBD&outfilepath=/tmp/党委公文承办单.wps&printdate=LWRQ,DBSX&routeinfoid=" + self.routeinfoid + "&printtype=" + self.printFiled)); //// 触发点击 //document.body.appendChild(eleLink); //eleLink.click(); //// 然后移除 //document.body.removeChild(eleLink); sp.layerhide() } //签写意见编辑状态 self.opinion = { WLDQFL: false, WLDQFLImg: false, WLDSSL: false, WLDSSLImg: false, SX: false, SXImg: false, BMFZRYJ: false, BMFZRYJImg: false, HBCSYJ: false, HBCSYJImg: false, nulla: false } self.YJ = { WLDQFL: [], WLDQFLSTATUS: false, WLDSSL: [], WLDSSLSTATUS: false, SX: [], SXSTATUS: false, BMFZRYJ: [], BMFZRYJSTATUS: false, HBCSYJ: [], HBCSYJSTATUS: false, nulla: [], nullaSTATUS: false } //意见(下表) self.openOptionList = function () { if (self.routeinfoid == 0 && self.routeid == 0) { sp.dialog("请先保存!") return; } if (self.opinion.nulla == true) { return; } self.nulla = ""; $(".optionList").css("height", 149) self.opinion.nulla = true; } self.closeOptionList = function () { $(".optionList").css("height", 389) self.opinion.nulla = false; } self.submitOptionList = function () { var data = { cmanid: self.userId, routeinfoid: self.routeinfoid, routeid: self.routeid, tableid: "FW_GFXWJXGMRBM", colid: "", opiniontype: 99, cresult: "", opinion: self.nulla, opinionimage: "" } $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.getOpinion1(); self.opinion.nulla = false; $(".optionList").css("height", 389) } else { sp.dialog(res.message) } }) } self.changeOptionList = function (item) { self.nulla = item.OPINION; self.opinion.nulla = true; } //意见附件(下表) self.uploading1 = false; self.upload1 = function () { $('#fileupload1').fileupload({ url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach', dataType: 'json', beforeSend: function (xhr, data) { xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken); xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tableid=FW_GFXWJXGMRBM")); }, // 上传完成后的执行逻辑 done: function (e, data) { self.uploading1 = false; self.getOpinion1() } }) } //下载意见表附件 self.downLoadOption = function (item) { window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7)) } //删除意见表附件 self.deleteOptionFile = function (file, str) { var data = { routeid: file.ROUTEID, tableid: "FW_GFXWJXGMRBM", colid: str, fileid: file.FILEID }; $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.dialoghide(); if (res.success) { if (str != "") { self.getOpinion(str); } else { self.getOpinion1(); } } else { sp.dialog("删除失败,请联系管理员!"); } }); } //意见附件(上表) self.upload2 = function (str) { $('#fileupload-' + str).fileupload({ url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach', dataType: 'json', beforeSend: function (xhr, data) { xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken); xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tableid=FW_GFXWJXGMRBM,colid=" + str)); }, // 上传完成后的执行逻辑 done: function (e, data) { self.uploading1 = false; self.getOpinion(str) } }) } //签写意见 self.openOpinion = function (str) { if (self.routeinfoid == 0 && self.routeid == 0) { sp.dialog("请先保存!") return; } self.opinion[str] = true; } //修改意见 self.changeOpinion = function (str) { self.data[str] = self.YJ[str][0].OPINION; self.opinion[str] = true; } self.changeOpinionItem = function (str, item) { if (item.OPINIONIMAGE != "") { self.QianZi(str); self.opinion[str + "Img"] = true; } self.data[str] = item.OPINION; self.opinion[str] = true; } //提交意见 self.Sopinion = function (str) { if (self.opinion[str + "Img"] == true) { self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL(); } else { self.data[str] = $("#" + str).val(); } var data = { cmanid: self.userId, routeinfoid: self.routeinfoid, routeid: self.routeid, tableid: "FW_GFXWJXGMRBM", colid: str, opiniontype: 0, cresult: "", opinion: self.opinion[str + "Img"] == false ? self.data[str] : "", opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : "" } $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.getOpinion(str); self.opinion[str] = false; self.opinion[str + "Img"] = false; self.data[str] = ""; self.changeFiled(str) } else { sp.dialog(res.message) } }) } //删除意见 self.Dopinion = function (str, item) { var data = { cmanid: self.userId, routeid: self.routeid, tableid: "FW_GFXWJXGMRBM", colid: str, } $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { if (str != "") { self.getOpinion(str); } else { self.getOpinion1(); } self.changeFiled(str) } else { sp.dialog(res.message) } }) } self.phraseText = "";//添加常用语 self.phraseList = []//常用语列表 //获取常用语库 self.phrase = function (colid) { sp.layer("#phrase"); self.colid = colid; self.getPhrase(); } //添加常用语到常用语库 self.Aphrase = function () { if (self.phraseText == "") { return; } var data = { cmanid: self.userId, tableid: "FW_GFXWJXGMRBM", colid: self.colid, contents: self.phraseText } $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.phraseText = ""; self.getPhrase(); } else { sp.dialog(res.message) } }) } //获取常用语库 self.getPhrase = function () { var data = { cmanid: self.userId, tableid: "FW_GFXWJXGMRBM", colid: self.colid } $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.phraseList = res.data; self.phraseSelect = self.phraseList[0].CONTENTS; }) } //从常用语库删除 self.Dphrase = function () { var id = null; $.each(self.phraseList, function (index, item) { if (item.CONTENTS == self.phraseSelect) { id = item.ID; } }) var data = { id: id } $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.getPhrase(); }) } //常用语确认为意见 self.btnPhrase = function () { if (!self.colid) { self.nulla = self.phraseSelect; } else { self.data[self.colid] = self.phraseSelect; } sp.layerhide(); } //签字—手写 self.QianZi = function (str) { self.opinion[str + "Img"] = true; setTimeout(function () { new lineCanvas(str + "QZ") }, 1) } //清除手写 self.canvasClear = function (str) { var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d"); cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height) } //发生修改 self.changeFiled = function (str) { self.filedChange = true; if (str = "XXGKSH") { self.XXGKSH.forEach(function (item) { if (item.CODE == self.data.XXGKSH) { self.data.XXGKSH1 = item.CNAME } }) } } //转发 self.forward = function (obj) { self.btnItem = obj; if (self.filedChange == true) { self.btnSave(1) } else { $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "©rightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=fawenbg") sp.layer("#forward") } } //查看流转记录 self.RouteList = function () { sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图") //var data = { // directionid: self.directionid, // userid: self.userId, // routeid: self.routeid, // routeinfoid: self.routeinfoid, //} //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) //.success(function (obj) { // var res = strToJson(s4.decryptData_CBC(obj.data)); // self.routeList = res.data; // $.each(self.routeList, function (index, item) { // item.mainUser = []; // item.copyUsers = []; // $.each(item.USERS, function (index1, item1) { // if (item1.KIND == 0) { // item.mainUser.push(item1.USERNAME); // } else { // item.copyUsers.push(item1.USERNAME); // } // }) // item.mainUser = item.mainUser.join(","); // item.copyUsers = item.copyUsers.join(","); // }) // setTimeout(function (item) { // sp.layer("#RouteList"); // }, 100); //}) } self.reSizeRow = function () { var bodybox = document.getElementById("bodyDiv"); var topbox = document.getElementById("topDiv"); var bottombox = document.getElementById("bottomDiv"); var line = document.getElementById("lineDiv"); document.getElementById("lineDiv").addEventListener("mousedown", function (event) { $(".mousemove").show() var bodyboxH = bodybox.clientHeight; var topboxH = topbox.clientHeight; var bottomboxH = bottombox.clientHeight; //var y = event.pageY - line.offsetTop; var y = event.pageY - line.clientHeight; document.addEventListener("mousemove", boxMove) function boxMove(event) { if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) { // } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) { // } else { topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px"; //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px"; bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px"; bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px"; } } document.addEventListener("mouseup", function () { $(".mousemove").hide() document.removeEventListener("mousemove", boxMove) }) }) } ////头部关键字搜索---20230905 self.headBtnSearchKeyword = ""; self.headSearchResult = []; self.headSearchResult_view = false; self.headBtnSearch = function () { if (sp.isval(self.headBtnSearchKeyword)) { self.headSearchResult = []; var data = { "url": "/basic/api/StatSelect/selectCodeList", "data": { "keyWord": self.headBtnSearchKeyword } } //console.log(JSON.stringify(data)); $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); //console.log(JSON.stringify(res.data)); self.headSearchResult = res.data.build; if (sp.isval(self.headSearchResult)) { self.headSearchResult_view = true; } else { self.headSearchResult_view = false; } }) } else { self.headSearchResult_view = false; } }; self.headKeywordPage = function (itemdata) { var get_token = localStorage.getItem("main-token"); var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id; $('#attachlist')[0].contentWindow.openTool(set_url, '一张图'); self.headSearchResult_view = false; }; self.onePic = function () { $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索") } //公开 self.PUBLICITEM = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); var data1 = { tablename: "CODE_LM" } $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg) .success(function (obj1) { var res1 = strToJson(s4.decryptData_CBC(obj1.data)); self.LM = res1.data[0].C_H_I_L_D_DATA; self.LM.forEach(function (item) { item.show = true; if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) { item.show = false; } item.C_H_I_L_D_DATA.forEach(function (item1) { item1.show = true; if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) { item1.show = false; } }) }) self.filed = "GKFW"; self.msgGK = { WJLY: "FW", FLOWID: "AA57", FORMROUTEINFOID: self.routeinfoid, FBUSERID: self.userId, FBNAME: self.userName, GKFW: "", LM: "P0103", LM1: "委发文件", FBRQ: sp.getLocalDate(), FBBM: res.data[0].SECTION, WJBT: self.data.BT } sp.layer("#PUBLICITEM") $("#PUBLICITEM .sp-page").eq(0).scrollTop(0); }) }) } self.showCol = function ($event, ele) { $('.detail-col').not(ele).hide(); $(ele).toggle("slow").autoHide(); $event.stopPropagation(); } self.selectLM = function (item) { self.msgGK.LM = item.CODE self.msgGK.LM1 = item.CNAME console.log(self.msgGK) $(".detail-col").toggle("slow"); } self.showSecond = function (obj, n) { self.LM1 = obj.C_H_I_L_D_DATA; $(".detail-col").eq(1).css("top", (n + 1) * 30 + n); $(".detail-col").eq(1).show().autoHide() } self.checkAllUser1 = function () { self.AllChecked[self.filed] = !self.AllChecked[self.filed]; $.each(self.UserList[self.filed], function (index, item) { item.checked = self.AllChecked[self.filed]; $.each(item.USER, function (index1, item1) { item1.checked = self.AllChecked[self.filed]; }) }) self.submitGK(1) } self.checkUserItem1 = function (item) { item.checked = !item.checked; $.each(item.USER, function (index, item1) { item1.checked = item.checked; }) var n = 0; $.each(self.UserList[self.filed], function (index, item) { if (item.checked == true) { n++ } }) if (n == self.UserList[self.filed].length) { self.AllChecked[self.filed] = true; } else { self.AllChecked[self.filed] = false; } self.submitGK(1) } self.checkUser1 = function (item) { item.checked = !item.checked; var n = [], all = 0; $.each(self.UserList[self.filed], function (x, y) { n.push(0); $.each(y.USER, function (x1, y1) { if (y1.checked == true) { n[x]++ } }) if (n[x] == y.USER.length && n[x] != 0) { y.checked = true; all++ } else { y.checked = false; } }) if (all == self.UserList[self.filed].length) { self.AllChecked[self.filed] = true; } else { self.AllChecked[self.filed] = false; } self.submitGK(1) } self.submitGK = function (n) { var AllCheckedLength = 0; self.selectList[self.filed] = []; $.each(self.UserList[self.filed], function (index, item) { $.each(item.USER, function (index1, item1) { if (item1.checked == true) { AllCheckedLength++; self.selectList[self.filed].push(item1) } }) }) self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) { return item.USERID }).join(",") self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed]; if (n == 0) { sp.layerhide(); var data = { tablename: "SX_FBLIST", data: { WJLY: self.msgGK.WJLY, FLOWID: self.msgGK.FLOWID, FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID, FBUSERID: self.msgGK.FBUSERID, FBNAME: self.msgGK.FBNAME, GKFW: self.msgGK.GKFW, LM: self.msgGK.LM, FBRQ: self.msgGK.FBRQ, FBBM: self.msgGK.FBBM, WJBT: self.msgGK.WJBT } } $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.layerhide(); if (res.success) { sp.dialog("操作成功!"); $timeout(function () { sp.dialoghide(); }, 1000) } else { sp.dialog(res.message); } }) } } //头部下滚冻结 $(function () { $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height()) $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px") //$("body").bind("scroll", function () { // var scrollTop = $("body").scrollTop(); // if (scrollTop == 0) { // $(".FixTop").removeClass("FixTop"); // } // if (scrollTop > 35) { // $(".sp-page-title").parents(".sp-box").addClass("FixTop"); // } //}); //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10) }, 1) }) }]) app.filter('trustHtml', function ($sce) { return function (input) { return $sce.trustAsHtml(input.replace(/\n/g, '
').replace(/\s/g, ' ')); }; }); //canvas画布签字 function lineCanvas(obj) { var self = this; self.linewidth = 1; self.color = "#000000"; self.background = "#ffffff"; self.canvas = document.createElement("canvas"); document.getElementById(obj).appendChild(self.canvas); self.cxt = self.canvas.getContext("2d"); self.canvas.width = document.getElementById(obj).clientWidth; self.canvas.height = document.getElementById(obj).scrollHeight; self.cxt.fillStyle = self.background; self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width); self.cxt.strokeStyle = self.color; self.cxt.lineWidth = self.linewidth; self.cxt.lineCap = "round"; //开始绘制 self.canvas.addEventListener("mousedown", function (e) { self.cxt.beginPath(); self.cxt.lineTo(e.pageX - (window.innerWidth - 1000) / 2 - 240, e.pageY - document.getElementById(obj).offsetTop - 27 + document.body.scrollTop); self.canvas.addEventListener("mousemove", move) }.bind(self), false); //绘制中 function move() { var e = window.event; self.cxt.lineTo(e.pageX - (window.innerWidth - 1000) / 2 - 240, e.pageY - document.getElementById(obj).offsetTop - 27 + document.body.scrollTop); self.cxt.stroke(); } //结束绘制 self.canvas.addEventListener("mouseup", up) function up() { self.cxt.closePath(); self.canvas.removeEventListener("mousemove", move) } }; function showToggle(e) { $(e).children().toggle() $(e).next().toggle() } function toggleYJL(e) { if ($(e).children(".fa-angle-double-down").is(":hidden") == true) { $("#topDiv").css("height", 160) $(e).parent().css("height", 450) $("#attachlist").css("height", 200) $("#bottomDiv").css("height", "") } else { $("#topDiv").css("height", 600) $(e).parent().css("height", 10) } $(e).children().toggle() }