12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322 |
- '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.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");
- //初始化右上角按钮
- self.buttonList = []
- var uploadformat = window.top.uploadformat.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 = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.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.searchCj = function () {
- var data1 = {
- ckey: "CODE_PLUGINKINDS",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- self.KINDS = res1.data.CODE_PLUGINKINDS;
- var data2 = {
- ckey: "CODE_PLUGINDTYPE",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data2)) }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- self.DTYPE = res2.data.CODE_PLUGINDTYPE;
- var data3 = {
- ckey: "CODE_PLUGINAUTHMAN",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data3)) }, postCfg)
- .success(function (obj3) {
- var res3 = strToJson(s4.decryptData_CBC(obj3.data));
- self.AUTHMAN = res3.data.CODE_PLUGINAUTHMAN;
- self.search = {
- KINDS: "",
- DTYPE: ""
- }
- self.addSC = {};
- self.getCJlist(0)
- })
- })
- })
- }
- self.getCJlist = function (n) {
- var data = {
- kinds: self.search.KINDS,
- dtype: self.search.DTYPE,
- ctype: "C02"
- }
- $http.post(apiurljs.login + "g2app/plugin/queryDataList", data, postCfg)
- .success(function (res) {
- self.CJlist = res.data;
- self.CJlist.forEach(function (item) {
- self.AUTHMAN.forEach(function (item1) {
- if (item.AUTHMAN == item1.CODE) {
- item.AUTHMAN1 = item1.CNAME;
- }
- })
- })
- if (n == 0) {
- sp.layer("#addCJ")
- }
- })
- }
- self.deleteCJ = function (CJ) {
- var data = {
- id: CJ.ID
- }
- $http.post(apiurljs.login + "g2app/plugin/deletePluginRouteByID", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getOther()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.Meeting = function () {
- $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dpList = res.data;
- self.dpList1 = [];
- self.dpList.forEach(function (item) {
- self.dpList1.push(item)
- item.USER.forEach(function (item1) {
- item1.show = true;
- })
- })
- self.activeDep = 0;
- self.userList = self.dpList1[0].USER;
- self.meetUser = [];
- sp.layer("#meet")
- })
- }
- self.searchName = "";
- self.searchPerson = function () {
- self.dpList1 = [];
- self.dpList.forEach(function (item) {
- if (item.DEP.indexOf(self.searchName) > -1) {
- self.dpList1.push(item)
- }
- })
- self.activeDep = 0;
- self.userList = self.dpList1[0].USER;
- }
- self.addmeet = function () {
- self.dpList.forEach(function (item) {
- item.USER.forEach(function (item1) {
- if (item1.checked == true && item1.show == true) {
- self.meetUser.push(item1);
- item1.checked = false;
- item1.show = false;
- }
- })
- })
- }
- self.delmeet = function () {
- self.meetUser.forEach(function (item) {
- if (item.checked == true) {
- item.checked = false;
- item.show = true;
- }
- })
- self.meetUser = self.meetUser.filter(function (item) {
- return item.show == false;
- })
- }
- self.joinMeet = function () {
- var data1 = {
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- cman: self.userId,
- cname: self.data.BT + "—共享沟通",
- userids: self.meetUser.map(function (item) {
- return item.USERID
- }).join(",")
- }
- $http.post(apiurljs.login + "g2work/meetcoop/createMeetcoop", data1, postCfg)
- .success(function (res1) {
- sp.layerhide()
- if (res1.success == true) {
- self.getOther()
- } else {
- sp.dialog(res1.message)
- }
- })
- }
- self.deleteMeet = function (meet) {
- var data = {
- meetid: meet.MEETID
- }
- $http.post(apiurljs.login + "g2work/meetcoop/deleteDataByID", data, postCfg)
- .success(function (res) {
- if (res.success == true) {
- self.getOther()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.goAttach = function (index, n) {
- self.SwenList.forEach(function (item) {
- if (item.TEMPFORM.indexOf("attachlist.html") > -1) {
- if (n == 1) {
- window.location.href = item.TEMPFORM + "&FileNum=" + index
- } else if (n == 2) {
- window.location.href = item.TEMPFORM + "&CjNum=" + index
- } else if (n == 3) {
- window.location.href = item.TEMPFORM + "&addSC=" + index
- } else if (n == 4) {
- window.location.href = item.TEMPFORM + "&meet=" + index
- }
- }
- })
- }
- 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));
- $.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) {
- if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
- item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
- } else {
- 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.getJJLB()
- })
- }
- self.getJJLB = function () {
- var data = {
- ckey: "CODE_JJLB",
- 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.JJLB = res.data.CODE_JJLB;
- 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.getDpList()
- })
- }
- self.getDpList = function () {
- var data = {
- unitid: "AA"
- }
- $http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dpList = [];
- res.data.forEach(function (item) {
- if (item.CHILD_DATA.length == 0) {
- self.dpList.push(item)
- } else {
- item.CHILD_DATA.forEach(function (item1) {
- if (item1.CHILD_DATA.length == 0) {
- self.dpList.push(item1)
- } else {
- item1.CHILD_DATA.forEach(function (item2) {
- if (item2.CHILD_DATA.length == 0) {
- self.dpList.push(item2)
- }
- })
- }
- })
- }
- })
- self.dpList.forEach(function (item) {
- item.checked = false;
- })
- self.DpList = {
- F: JSON.parse(JSON.stringify(self.dpList)),
- B: JSON.parse(JSON.stringify(self.dpList))
- }
- self.AllCheckedDp = {};
- self.DpLength = {};
- self.selectDpList = {};
- 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.readonly = {
- JJLB: true,
- JGDWSJSQ: true,
- ZBBMQCR: true,
- NGRQ: true,
- GWZL: true,
- ZBBMFZRSH:true,
- JGDWWYSQ:true,
- HQBMFZRSH:true,
- FWBT:true,
- FWWH:true,
- YF:true,
- ZTC:true,
- F:true,
- B:true,
- BZ:true
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "FW_JGDWFZSW",
- 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_JGDWFZSW.ID,
- APPCODE: res.data.FW_JGDWFZSW.APPCODE,
- JJLB: res.data.FW_JGDWFZSW.JJLB == "" ? self.JJLB[0].CODE : res.data.FW_JGDWFZSW.JJLB,
- JGDWSJSQ: res.data.FW_JGDWFZSW.JGDWSJSQ,
- ZBBMQCR: res.data.FW_JGDWFZSW.ZBBMQCR == "" ? self.userName : res.data.FW_JGDWFZSW.ZBBMQCR,
- GWZL: res.data.FW_JGDWFZSW.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_JGDWFZSW.GWZL,
- NGRQ: res.data.FW_JGDWFZSW.NGRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_JGDWFZSW.NGRQ),
- ZBBMFZRSH: res.data.FW_JGDWFZSW.ZBBMFZRSH,
- JGDWWYSQ: res.data.FW_JGDWFZSW.JGDWWYSQ,
- HQBMFZRSH: res.data.FW_JGDWFZSW.HQBMFZRSH,
- FWBT: res.data.FW_JGDWFZSW.FWBT,
- FWWH: res.data.FW_JGDWFZSW.FWWH,
- YF: res.data.FW_JGDWFZSW.YF,
- ZTC: res.data.FW_JGDWFZSW.ZTC,
- F: res.data.FW_JGDWFZSW.F,
- B: res.data.FW_JGDWFZSW.B,
- BZ: res.data.FW_JGDWFZSW.BZ,
- NGRUSERID: res.data.FW_JGDWFZSW.NGRUSERID == "" ? self.userId : res.data.FW_JGDWFZSW.NGRUSERID,
- NGRBM: res.data.FW_JGDWFZSW.NGRBM == "" ? self.userDpName : res.data.FW_JGDWFZSW.NGRBM,
- NGRBMID: res.data.FW_JGDWFZSW.NGRBMID == "" ? self.userDpCode : res.data.FW_JGDWFZSW.NGRBMID
- }
- self.readonly = {
- JJLB: res.data.FW_JGDWFZSW["JJLB.EREADONLY"] == "true",
- JGDWSJSQ: res.data.FW_JGDWFZSW["JGDWSJSQ.EREADONLY"] == "true",
- ZBBMQCR: res.data.FW_JGDWFZSW["ZBBMQCR.EREADONLY"] == "true",
- GWZL: res.data.FW_JGDWFZSW["GWZL.EREADONLY"] == "true",
- NGRQ: res.data.FW_JGDWFZSW["NGRQ.EREADONLY"] == "true",
- ZBBMFZRSH: res.data.FW_JGDWFZSW["ZBBMFZRSH.EREADONLY"] == "true",
- JGDWWYSQ: res.data.FW_JGDWFZSW["JGDWWYSQ.EREADONLY"] == "true",
- HQBMFZRSH: res.data.FW_JGDWFZSW["HQBMFZRSH.EREADONLY"] == "true",
- FWBT: res.data.FW_JGDWFZSW["FWBT.EREADONLY"] == "true",
- FWWH: res.data.FW_JGDWFZSW["FWWH.EREADONLY"] == "true",
- YF: res.data.FW_JGDWFZSW["YF.EREADONLY"] == "true",
- ZTC: res.data.FW_JGDWFZSW["ZTC.EREADONLY"] == "true",
- F: res.data.FW_JGDWFZSW["F.EREADONLY"] == "true",
- B: res.data.FW_JGDWFZSW["B.EREADONLY"] == "true",
- BZ: res.data.FW_JGDWFZSW["BZ.EREADONLY"] == "true",
- }
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- self.buttonList = res.data["FW_JGDWFZSW.FUNCLIST"];
- var n = {}, all = {};
- for (var i in self.DpList) {
- self.AllCheckedDp[i] = false;
- self.DpLength[i] = 0;
- self.selectDpList[i] = []
- all[i] = 0;
- $.each(self.DpList[i], function (index, item) {
- self.DpLength[i]++
- if (self.data.F.indexOf(item.SECTION) != -1 && i == "F") {
- all[i]++;
- item.checked = true;
- self.selectDpList[i].push(item);
- }
- if (self.data.B.indexOf(item.SECTION) != -1 && i == "B") {
- all[i]++;
- item.checked = true;
- self.selectDpList[i].push(item);
- }
- })
- if (all[i] == self.DpList[i].length) {
- self.AllCheckedDp[i] = true;
- } else {
- self.AllCheckedDp[i] = false;
- }
- }
- self.getOpinion('ZBBMFZRSH')
- self.getOpinion('JGDWWYSQ')
- self.getOpinion('HQBMFZRSH')
- self.getOpinion('JGDWSJSQ')
- self.getOpinion1()
- self.getOther()
- //watermark({
- // "watermarl_element": "app",
- // "watermark_txt": "测试水印内容",
- // "watermark_width": 150,
- // "watermark_height": 110,
- // "watermark_angle": 345
- //})
- $timeout(function () {
- var height1 = $(".auto").parent().next("div").height(), height2 = 0;
- $(".auto").siblings().each(function () {
- height2 = height2 + $(this).outerHeight();
- })
- $(".auto").css("height", height1 - height2);
- }, 100)
- })
- }
- //获取附件和插件
- 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.arrayFile = res.data;
- var data1 = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/plugin/queryPluginRouteDataList", data1, postCfg)
- .success(function (res1) {
- self.cjList = res1.data;
- var data2 = {
- routeid: self.routeid,
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2work/meetcoop/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data2)) }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- self.meetList = res2.data;
- })
- })
- })
- }
- //获取意见(上表)
- self.getOpinion = function (str) {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "FW_JGDWFZSW",
- 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_JGDWFZSW",
- 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) {
- console.log()
- 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;
- default: self.forward(item); break;
- }
- }
- self.openDpList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllCheckedDp = false;
- sp.layer("#DpList")
- $("#DpList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllDp = function () {
- self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
- $.each(self.DpList[self.filed], function (index, item) {
- item.checked = self.AllCheckedDp[self.filed];
- })
- self.submitDpList(1)
- }
- self.checkDpItem = function (item) {
- item.checked = !item.checked;
- var n = 0;
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- n++
- }
- })
- if (n == self.DpList[self.filed].length) {
- self.AllCheckedDp[self.filed] = true;
- } else {
- self.AllCheckedDp[self.filed] = false;
- }
- self.submitDpList(1)
- }
- self.submitDpList = function (n) {
- var AllCheckedLength1 = 0;
- self.selectDpList[self.filed] = [];
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- AllCheckedLength1++;
- self.selectDpList[self.filed].push(item)
- }
- })
- self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
- return item.SECTION
- }).join(",")
- self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- self.openUserList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllChecked[self.filed] = false;
- sp.layer("#userList")
- $("#userList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllUser = 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.submitUserList(1)
- }
- self.checkUserItem = 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.submitUserList(1)
- }
- self.checkUser = 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.submitUserList(1)
- }
- self.submitUserList = 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.data[self.filed] = self.selectList[self.filed].map(function (item) {
- return item.USHOWNAME
- }).join(",")
- if (self.data[self.filed + "ID"] != undefined) {
- self.data[self.filed + "ID"] = self.selectList[self.filed].map(function (item) {
- return item.USERID
- }).join(",")
- }
- self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- //保存提交
- self.btnSave = function (n) {
- if (spngvld.submit(".sp-page-center")) {
- var dataArray = [];
- self.data.ZBBMFZRSH = "";
- self.data.JGDWWYSQ = "";
- self.data.HQBMFZRSH = "";
- self.data.JGDWSJSQ = "";
- dataArray.push(self.data);
- var data = {
- ckey: "FW_JGDWFZSW",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.FWBT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.FWBT,
- 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=moban15.ftl&tablename=FW_JGDWFZSW&outfilepath=/tmp/机关党委非正式文.wps&printdate=NGRQ&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_JGDWFZSW&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 = "moban15"
- } else if (self.printFiled == 2) {
- var templatefilename = "mobanoption"
- } else {
- var templatefilename = "moban15_all"
- }
- var data = {
- templatefilename: templatefilename + ".ftl",
- outfilepath: "/tmp/机关党委非正式文" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
- routeinfoid: self.routeinfoid,
- tablename: "FW_JGDWFZSW",
- printtype: self.printFiled,
- printdate: "NGRQ"
- }
- 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)
- window.parent.sp.addTabNav('printPreview', '打印预览', "printPreview.html?url=" + apiurljs.login + "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 = {
- ZBBMFZRSH: false,
- ZBBMFZRSHImg: false,
- JGDWWYSQ: false,
- JGDWWYSQImg: false,
- HQBMFZRSH: false,
- HQBMFZRSHImg: false,
- JGDWSJSQ: false,
- JGDWSJSQImg: false,
- nulla: false
- }
- self.YJ = {
- ZBBMFZRSH: [],
- ZBBMFZRSHSTATUS: false,
- JGDWWYSQ: [],
- JGDWWYSQSTATUS: false,
- HQBMFZRSH: [],
- HQBMFZRSHSTATUS: false,
- JGDWSJSQ: [],
- JGDWSJSQSTATUS: 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_JGDWFZSW",
- 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_JGDWFZSW"));
- },
- // 上传完成后的执行逻辑
- 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_JGDWFZSW",
- 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_JGDWFZSW,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_JGDWFZSW",
- 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_JGDWFZSW",
- 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_JGDWFZSW",
- 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_JGDWFZSW",
- 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;
- }
- //转发
- 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=fawendw")
- 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);
- //})
- }
- //头部下滚冻结
- $(function () {
- $(".sp-page-center").eq(0).css("max-height", $(window).height() - 160).css("height", $(window).height() - 160)
- $(".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)
- }
- }, 1)
- })
- }])
- app.filter('trustHtml', function ($sce) {
- return function (input) {
- return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').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;
- console.log(self.canvas.width)
- 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 - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- self.canvas.addEventListener("mousemove", move)
- }.bind(self), false);
- //绘制中
- function move() {
- var e = window.event;
- self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- 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) {
- $(".sp-page-center").eq(0).css("max-height", $(window).height() - 600).css("height", $(window).height() - 600)
- $(e).parent().css("height", 450)
- } else {
- $(".sp-page-center").eq(0).css("max-height", $(window).height() - 160).css("height", $(window).height() - 160)
- $(e).parent().css("height", 10)
- }
- $(e).children().toggle()
- }
|