formedit.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.routeid = sp.getUrlName("routeid");
  11. self.routeinfoid = sp.getUrlName("routeinfoid");
  12. self.copyrightid = sp.getUrlName("copyrightid");
  13. self.directionid = sp.getUrlName("directionid");
  14. self.formeditid = sp.getUrlName("formeditid");
  15. self.mbid = sp.getUrlName("mbid");
  16. self.fjid = sp.getUrlName("fjid");
  17. self.docmode = sp.getUrlName("docmode");
  18. self.dotype = sp.getUrlName("dotype");
  19. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  20. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  21. self.get_type = sp.getUrlName("type");
  22. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  23. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  24. var postCfg = {
  25. headers: {
  26. 'Content-Type': 'application/json',
  27. 'Authorization': "Bearer " + self.get_AccessToken
  28. }
  29. };
  30. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  31. //初始化右上角按钮
  32. self.buttonList = []
  33. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  34. return item.CNAME
  35. })
  36. //上层附件、业务参考、共享沟通组件
  37. self.arrayFile = null;
  38. self.arrayFile1 = [];
  39. self.uploading_zw = false;
  40. self.uploading = false;
  41. self.upload_zw = function () {
  42. $('#fileupload-zw').fileupload({
  43. url: apiurljs.login + (self.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : 'g2app/abase/uploadFileWithForm'),
  44. dataType: 'json',
  45. beforeSend: function (xhr, data) {
  46. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  47. if (self.routeinfoid == 0) {
  48. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("copyrightid=" + self.copyrightid + ",directionid=" + self.directionid + ",formeditid=" + self.formeditid + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tablename=FILE_ATTACH,ATTACHTYPE=领导批示承办单-正文"));
  49. } else {
  50. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=领导批示承办单-正文"));
  51. }
  52. },
  53. add: function (e, data) {
  54. var num = 0;
  55. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  56. //文件类型判断
  57. $.each(data.originalFiles, function (index, item) {
  58. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  59. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  60. return;
  61. } else {
  62. num++
  63. }
  64. })
  65. if (num == data.originalFiles.length) {
  66. self.uploading_zw = true;
  67. data.submit();
  68. $scope.$apply();
  69. }
  70. },
  71. // 上传完成后的执行逻辑
  72. done: function (e, data) {
  73. self.uploading_zw = false;
  74. if (self.routeinfoid == 0) {
  75. var res = strToJson(s4.decryptData_CBC(data.result.data));
  76. self.data.ID = res.data2.ID;
  77. self.routeid = res.data2.ROUTEID;
  78. self.routeinfoid = res.data2.ROUTEINFOID;
  79. self.getSwenList(0)
  80. } else {
  81. self.getOther()
  82. }
  83. }
  84. })
  85. }
  86. self.upload = function () {
  87. $('#fileupload').fileupload({
  88. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  89. dataType: 'json',
  90. beforeSend: function (xhr, data) {
  91. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  92. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=党委会议纪要"));
  93. },
  94. add: function (e, data) {
  95. var num = 0;
  96. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  97. //文件类型判断
  98. $.each(data.originalFiles, function (index, item) {
  99. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  100. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  101. return;
  102. } else {
  103. num++
  104. }
  105. })
  106. if (num == data.originalFiles.length) {
  107. self.uploading = true;
  108. data.submit();
  109. $scope.$apply();
  110. }
  111. },
  112. // 上传完成后的执行逻辑
  113. done: function (e, data) {
  114. self.uploading = false;
  115. self.getOther()
  116. }
  117. })
  118. }
  119. self.downLoad = function (item) {
  120. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  121. }
  122. self.deleteFile = function (file) {
  123. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  124. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  125. 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>";
  126. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  127. sp.openCenter(".sp-dialog");
  128. ///取消按钮
  129. $('.sp-closeDialog').click(function (event) {
  130. sp.closeCenter(".sp-dialog");
  131. event.preventDefault();
  132. event.stopPropagation();
  133. });
  134. //post消息的id
  135. $("#delDataTrue").click(function () {
  136. var data = {
  137. tablename: "FILE_ATTACH",
  138. id: file.ID
  139. };
  140. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  141. .success(function (obj) {
  142. var res = strToJson(s4.decryptData_CBC(obj.data));
  143. sp.dialoghide();
  144. if (res.success) {
  145. self.getOther();
  146. } else {
  147. sp.dialog("删除失败,请联系管理员!");
  148. }
  149. });
  150. });
  151. }
  152. self.goAttach = function (obj) {
  153. if (obj) {
  154. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  155. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  156. return
  157. }
  158. $("#attachlist")[0].contentWindow.openFile(obj)
  159. if ($(".fa-chevron-down").is(":hidden") == true) {
  160. showToggle(document.getElementById("toggleButton"))
  161. }
  162. } else {
  163. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  164. }
  165. }
  166. self.getSwenList = function (n) {
  167. self.SwenList = [];
  168. var data = {
  169. directionid: self.directionid,
  170. userid: self.userId,
  171. routeinfoid: self.routeinfoid,
  172. routeid: self.routeid,
  173. formeditid: ""
  174. }
  175. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  176. .success(function (obj) {
  177. var res = strToJson(s4.decryptData_CBC(obj.data));
  178. if (self.copyrightid == "") {
  179. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  180. }
  181. $.each(res.data.LINKS, function (index, item) {
  182. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  183. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  184. self.Title = item.VNAME;
  185. }
  186. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  187. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  188. } else {
  189. item.TEMPFORM = "#";
  190. }
  191. self.SwenList.push(item)
  192. })
  193. self.SwenList.push({
  194. VNAME: "流程图",
  195. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  196. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  197. })
  198. if (n == 0) {
  199. self.getFLOW()
  200. } else {
  201. self.getData()
  202. }
  203. })
  204. }
  205. self.getSwenList(0)
  206. self.getFLOW = function () {
  207. var data = {
  208. copyrightid: self.copyrightid
  209. }
  210. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  211. .success(function (obj) {
  212. var res = strToJson(s4.decryptData_CBC(obj.data));
  213. self.flowTitle = res.data.CNAME;
  214. self.getJJLB()
  215. })
  216. }
  217. self.getJJLB = function () {
  218. var data = {
  219. ckey: "CODE_JJLB",
  220. routeinfoid: self.routeinfoid
  221. }
  222. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  223. .success(function (obj) {
  224. var res = strToJson(s4.decryptData_CBC(obj.data));
  225. self.JJLB = res.data.CODE_JJLB;
  226. self.getGWZL()
  227. })
  228. }
  229. self.getGWZL = function () {
  230. var data = {
  231. tablename: "CODE_GWTYPE",
  232. colums: "ID,CODE,CNAME,FLOWID",
  233. order: "ID desc",
  234. sqlwhere: {
  235. USEMARK: 1,
  236. FLOWID: sp.getUrlName("flowid")
  237. },
  238. sqlinwhere: "",
  239. sqllikewhere: ""
  240. }
  241. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  242. .success(function (obj) {
  243. var res = strToJson(s4.decryptData_CBC(obj.data));
  244. console.log(res.data)
  245. self.GWZL = res.data;
  246. self.getDP()
  247. })
  248. }
  249. self.getDP = function () {
  250. var data = {
  251. userid: self.userId
  252. }
  253. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  254. .success(function (obj) {
  255. var res = strToJson(s4.decryptData_CBC(obj.data));
  256. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  257. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  258. self.getData();
  259. })
  260. }
  261. self.readonly = {
  262. JJLB: true,
  263. SJSQ: true,
  264. ZBBMQCR: true,
  265. NGSJ: true,
  266. GWZL: true,
  267. ZBBMFZRSH: true,
  268. LDBZSQ: true,
  269. HQBMFZRSH: true,
  270. FWBT: true,
  271. FWWH: true,
  272. YF: true,
  273. FF: true,
  274. ZTC: true,
  275. F: true,
  276. B: true,
  277. BZ: true
  278. }
  279. //获取数据
  280. self.getData = function () {
  281. var data = {
  282. ckey: "FW_DWHYJY",
  283. id: 0,
  284. directionid: self.directionid,
  285. formeditid: self.formeditid,
  286. routeid: self.routeid,
  287. routeinfoid: self.routeinfoid
  288. }
  289. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  290. .success(function (obj) {
  291. var res = strToJson(s4.decryptData_CBC(obj.data));
  292. self.data = {
  293. ID: res.data.FW_DWHYJY.ID,
  294. APPCODE: res.data.FW_DWHYJY.APPCODE,
  295. JJLB: res.data.FW_DWHYJY.JJLB == "" ? self.JJLB[0].CODE : res.data.FW_DWHYJY.JJLB,
  296. SJSQ: res.data.FW_DWHYJY.SJSQ,
  297. ZBBMQCR: res.data.FW_DWHYJY.ZBBMQCR == "" ? self.userName : res.data.FW_DWHYJY.ZBBMQCR,
  298. GWZL: res.data.FW_DWHYJY.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_DWHYJY.GWZL,
  299. NGSJ: res.data.FW_DWHYJY.NGSJ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_DWHYJY.NGSJ),
  300. ZBBMFZRSH: res.data.FW_DWHYJY.ZBBMFZRSH,
  301. LDBZSQ: res.data.FW_DWHYJY.LDBZSQ,
  302. HQBMFZRSH: res.data.FW_DWHYJY.HQBMFZRSH,
  303. FWBT: res.data.FW_DWHYJY.FWBT,
  304. FWWH: res.data.FW_DWHYJY.FWWH,
  305. FWWH1: res.data.FW_DWHYJY.FWWH,
  306. YF: res.data.FW_DWHYJY.YF,
  307. FF: res.data.FW_DWHYJY.FF,
  308. ZTC: res.data.FW_DWHYJY.ZTC,
  309. F: res.data.FW_DWHYJY.F,
  310. B: res.data.FW_DWHYJY.B,
  311. BZ: res.data.FW_DWHYJY.BZ,
  312. NGRUSERID: res.data.FW_DWHYJY.NGRUSERID == "" ? self.userId : res.data.FW_DWHYJY.NGRUSERID,
  313. NGRBM: res.data.FW_DWHYJY.NGRBM == "" ? self.userDpName : res.data.FW_DWHYJY.NGRBM,
  314. NGRBMID: res.data.FW_DWHYJY.NGRBMID == "" ? self.userDpCode : res.data.FW_DWHYJY.NGRBMID
  315. }
  316. self.readonly = {
  317. JJLB: res.data.FW_DWHYJY["JJLB.EREADONLY"] == "true",
  318. SJSQ: res.data.FW_DWHYJY["SJSQ.EREADONLY"] == "true",
  319. ZBBMQCR: res.data.FW_DWHYJY["ZBBMQCR.EREADONLY"] == "true",
  320. GWZL: res.data.FW_DWHYJY["GWZL.EREADONLY"] == "true",
  321. NGSJ: res.data.FW_DWHYJY["NGSJ.EREADONLY"] == "true",
  322. ZBBMFZRSH: res.data.FW_DWHYJY["ZBBMFZRSH.EREADONLY"] == "true",
  323. LDBZSQ: res.data.FW_DWHYJY["LDBZSQ.EREADONLY"] == "true",
  324. HQBMFZRSH: res.data.FW_DWHYJY["HQBMFZRSH.EREADONLY"] == "true",
  325. FWBT: res.data.FW_DWHYJY["FWBT.EREADONLY"] == "true",
  326. FWWH: res.data.FW_DWHYJY["FWWH.EREADONLY"] == "true",
  327. YF: res.data.FW_DWHYJY["YF.EREADONLY"] == "true",
  328. FF: res.data.FW_DWHYJY["FF.EREADONLY"] == "true",
  329. ZTC: res.data.FW_DWHYJY["ZTC.EREADONLY"] == "true",
  330. F: res.data.FW_DWHYJY["F.EREADONLY"] == "true",
  331. B: res.data.FW_DWHYJY["B.EREADONLY"] == "true",
  332. BZ: res.data.FW_DWHYJY["BZ.EREADONLY"] == "true",
  333. }
  334. if (self.data.ID == 0) {
  335. self.filedChange = true;
  336. } else {
  337. self.filedChange = false;
  338. }
  339. self.buttonList = res.data["FW_DWHYJY.FUNCLIST"];
  340. self.getOpinion('ZBBMFZRSH')
  341. self.getOpinion('HQBMFZRSH')
  342. self.getOpinion('SJSQ')
  343. self.getOpinion('LDBZSQ')
  344. self.getOpinion1()
  345. self.getOther()
  346. self.getGCG()
  347. self.getFWWH()
  348. //watermark({
  349. // "watermarl_element": "app",
  350. // "watermark_txt": "测试水印内容",
  351. // "watermark_width": 150,
  352. // "watermark_height": 110,
  353. // "watermark_angle": 345
  354. //})
  355. $timeout(function () {
  356. var height1 = $(".auto").parent().next("div").height(), height2 = 0;
  357. $(".auto").siblings().each(function () {
  358. height2 = height2 + $(this).outerHeight();
  359. })
  360. $(".auto").css("height", height1 - height2);
  361. }, 100)
  362. })
  363. }
  364. self.getFWWH = function () {
  365. var data = {
  366. flowid: sp.getUrlName("flowid"),
  367. code: "",
  368. cyear: sp.currentYear(),
  369. routeinfoidmark: self.routeinfoid,
  370. zihao: self.data.FWWH
  371. }
  372. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  373. .success(function (obj) {
  374. var res = strToJson(s4.decryptData_CBC(obj.data));
  375. self.FWWH = res.data.map(function (item) {
  376. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  377. });
  378. if (self.data.FWWH == "") { self.data.FWWH = self.FWWH[0].CODE }
  379. })
  380. }
  381. //获取附件和插件
  382. self.getOther = function () {
  383. var data = {
  384. tablename: "FILE_ATTACH",
  385. colums: "*",
  386. order: "ID desc",
  387. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  388. sqlinwhere: "",
  389. sqllikewhere: ""
  390. }
  391. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  392. .success(function (obj) {
  393. var res = strToJson(s4.decryptData_CBC(obj.data));
  394. self.arrayFile1 = [];
  395. if (res.data.length > 0) {
  396. res.data.forEach(function (item) {
  397. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  398. self.arrayFile = item;
  399. } else {
  400. self.arrayFile1.push(item)
  401. }
  402. })
  403. self.goAttach()
  404. }
  405. })
  406. }
  407. //发文打开过程稿在线编辑
  408. self.getGCG = function () {
  409. var data = {
  410. dockind: "D01",
  411. routeinfoid: self.routeinfoid
  412. }
  413. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  414. .success(function (obj) {
  415. var res = strToJson(s4.decryptData_CBC(obj.data));
  416. self.gaoTypeArrayFirst = res.data;
  417. console.log(res)
  418. })
  419. }
  420. //获取意见(上表)
  421. self.getOpinion = function (str) {
  422. var data = {
  423. cmanid: self.userId,
  424. routeinfoid: self.routeinfoid,
  425. routeid: "",//self.routeid,
  426. tableid: "FW_DWHYJY",
  427. colid: str,
  428. opiniontype: 0,
  429. orderbycol: "CDATE desc"
  430. }
  431. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  432. .success(function (obj) {
  433. var res = strToJson(s4.decryptData_CBC(obj.data));
  434. if (res.success == true) {
  435. self.YJ[str] = res.data;
  436. self.YJ[str + "STATUS"] = false;
  437. self.YJ[str].forEach(function (item) {
  438. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  439. if (item.ROUTEID == self.routeid) {
  440. self.YJ[str + "STATUS"] = true;
  441. }
  442. })
  443. } else {
  444. sp.dialog(res.message)
  445. }
  446. })
  447. }
  448. //获取意见(不上表)
  449. self.opiniontype = 99;
  450. self.getOpinion1 = function () {
  451. var data = {
  452. cmanid: self.userId,
  453. routeinfoid: self.routeinfoid,
  454. routeid: "",//self.routeid,
  455. tableid: "FW_DWHYJY",
  456. colid: "",
  457. opiniontype: self.opiniontype,
  458. orderbycol: "CDATE desc"
  459. }
  460. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  461. .success(function (obj) {
  462. var res = strToJson(s4.decryptData_CBC(obj.data));
  463. if (res.success == true) {
  464. self.YJ.nulla = res.data;
  465. self.YJ.nullaSTATUS = false;
  466. self.YJ.nulla.forEach(function (item) {
  467. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  468. //if (item.ROUTEID == self.routeid && item.COLID == "") {
  469. // self.YJ.nullaSTATUS = true;
  470. //}
  471. })
  472. } else {
  473. sp.dialog(res.message)
  474. }
  475. })
  476. }
  477. //判断页面字段是否只读readonly、是否隐藏show
  478. self.hide = function (type, field) {
  479. if (self.dotype == 0 && type == "readonly") {
  480. return true;
  481. } else {
  482. if (self[type][field] == true) {
  483. return true;
  484. } else {
  485. return false;
  486. }
  487. }
  488. }
  489. //右上角按钮调用方法
  490. self.btnEvent = function (item) {
  491. switch (item.CODE) {
  492. case "SAVEITEM": self.btnSave(0); break;
  493. case "PRINTITEM": self.btnPrint(); break;
  494. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  495. case "MEETITEM": self.Meet(); break;
  496. case "SENDLOG": self.RouteList(); break;
  497. default: self.forward(item); break;
  498. }
  499. }
  500. //保存提交
  501. self.btnSave = function (n) {
  502. if (spngvld.submit(".sp-page-center")) {
  503. if (self.data.FWWH1 == "") {
  504. var data = {
  505. tablename: "FW_NUMBER",
  506. data: {
  507. CYEAR: sp.currentYear(),
  508. FLOWID: sp.getUrlName("flowid"),
  509. ZIHAO: self.FWWH
  510. }
  511. }
  512. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  513. .success(function (obj) { })
  514. }
  515. var dataArray = [];
  516. self.data.ZBBMFZRSH = "";
  517. self.data.HQBMFZRSH = "";
  518. self.data.SJSQ = "";
  519. self.data.LDBZSQ = "";
  520. dataArray.push(self.data);
  521. var data = {
  522. ckey: "FW_DWHYJY",
  523. id: self.data.ID,
  524. routeid: self.routeid,
  525. routeinfoid: self.routeinfoid,
  526. routeinfotitle: self.data.FWBT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.FWBT,
  527. directionid: self.directionid,
  528. formeditid: self.formeditid,
  529. data: JSON.stringify(dataArray)
  530. }
  531. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  532. .success(function (obj) {
  533. var res = strToJson(s4.decryptData_CBC(obj.data));
  534. if (res.code == 0) {
  535. self.data.ID = res.data.ID;
  536. self.routeid = res.data.ROUTEID;
  537. self.routeinfoid = res.data.ROUTEINFOID;
  538. self.filedChange = false;
  539. if (n == 0) {
  540. sp.dialog("保存成功!");
  541. $timeout(function () {
  542. sp.dialoghide()
  543. }, 1500)
  544. self.getSwenList(1)
  545. } else if (n == 1) {
  546. self.forward(self.btnItem);
  547. } else if (n == 2) {
  548. self.sendAll();
  549. } else if (n == 3) {
  550. self.btnPrint();
  551. }
  552. } else {
  553. sp.dialog(res.message)
  554. }
  555. })
  556. }
  557. }
  558. //打印
  559. self.btnPrint = function () {
  560. if (self.filedChange == true) {
  561. self.btnSave(3)
  562. } else {
  563. // 创建隐藏的可下载链接
  564. var eleLink = document.createElement('a');
  565. eleLink.download = "";
  566. eleLink.style.display = 'none';
  567. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban13.ftl&tablename=FW_DWHYJY&outfilepath=/tmp/党委会议纪要.wps&printdate=NGSJ&routeinfoid=" + self.routeinfoid));
  568. // 触发点击
  569. document.body.appendChild(eleLink);
  570. eleLink.click();
  571. // 然后移除
  572. document.body.removeChild(eleLink);
  573. //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=FW_DWHYJY&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
  574. }
  575. }
  576. /*综合打印*/
  577. self.printFiled = 1;
  578. self.btnPrint1 = function () {
  579. if (self.filedChange == true) {
  580. self.btnSave(3)
  581. } else {
  582. sp.layer("#print")
  583. }
  584. }
  585. self.printSubmit = function () {
  586. if (self.printFiled == 1) {
  587. var templatefilename = "moban13"
  588. } else if (self.printFiled == 2) {
  589. var templatefilename = "mobanoption"
  590. } else {
  591. var templatefilename = "moban13_all"
  592. }
  593. var data = {
  594. templatefilename: templatefilename + ".ftl",
  595. outfilepath: "/tmp/党委会议纪要" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  596. routeinfoid: self.routeinfoid,
  597. tablename: "FW_DWHYJY",
  598. printtype: self.printFiled,
  599. printdate: "NGSJ"
  600. }
  601. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  602. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  603. .success(function (obj) {
  604. var res = strToJson(s4.decryptData_CBC(obj.data));
  605. //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
  606. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  607. })
  608. //// 创建隐藏的可下载链接
  609. //var eleLink = document.createElement('a');
  610. //eleLink.download = "";
  611. //eleLink.style.display = 'none';
  612. //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));
  613. //// 触发点击
  614. //document.body.appendChild(eleLink);
  615. //eleLink.click();
  616. //// 然后移除
  617. //document.body.removeChild(eleLink);
  618. sp.layerhide()
  619. }
  620. //签写意见编辑状态
  621. self.opinion = {
  622. ZBBMFZRSH: false,
  623. ZBBMFZRSHImg: false,
  624. HQBMFZRSH: false,
  625. HQBMFZRSHImg: false,
  626. SJSQ: false,
  627. SJSQImg: false,
  628. LDBZSQ: false,
  629. LDBZSQImg: false,
  630. nulla: false
  631. }
  632. self.YJ = {
  633. ZBBMFZRSH: [],
  634. ZBBMFZRSHSTATUS: false,
  635. HQBMFZRSH: [],
  636. HQBMFZRSHSTATUS: false,
  637. SJSQ: [],
  638. SJSQSTATUS: false,
  639. LDBZSQ: [],
  640. LDBZSQSTATUS: false,
  641. nulla: [],
  642. nullaSTATUS: false
  643. }
  644. //意见(下表)
  645. self.openOptionList = function () {
  646. if (self.routeinfoid == 0 && self.routeid == 0) {
  647. sp.dialog("请先保存!")
  648. return;
  649. }
  650. if (self.opinion.nulla == true) {
  651. return;
  652. }
  653. self.nulla = "";
  654. $(".optionList").css("height", 149)
  655. self.opinion.nulla = true;
  656. }
  657. self.closeOptionList = function () {
  658. $(".optionList").css("height", 389)
  659. self.opinion.nulla = false;
  660. }
  661. self.submitOptionList = function () {
  662. var data = {
  663. cmanid: self.userId,
  664. routeinfoid: self.routeinfoid,
  665. routeid: self.routeid,
  666. tableid: "FW_DWHYJY",
  667. colid: "",
  668. opiniontype: 99,
  669. cresult: "",
  670. opinion: self.nulla,
  671. opinionimage: ""
  672. }
  673. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  674. .success(function (obj) {
  675. var res = strToJson(s4.decryptData_CBC(obj.data));
  676. if (res.success == true) {
  677. self.getOpinion1();
  678. self.opinion.nulla = false;
  679. $(".optionList").css("height", 389)
  680. } else {
  681. sp.dialog(res.message)
  682. }
  683. })
  684. }
  685. self.changeOptionList = function (item) {
  686. self.nulla = item.OPINION;
  687. self.opinion.nulla = true;
  688. }
  689. //意见附件(下表)
  690. self.uploading1 = false;
  691. self.upload1 = function () {
  692. $('#fileupload1').fileupload({
  693. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  694. dataType: 'json',
  695. beforeSend: function (xhr, data) {
  696. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  697. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  698. + ",routeid=" + self.routeid + ",tableid=FW_DWHYJY"));
  699. },
  700. // 上传完成后的执行逻辑
  701. done: function (e, data) {
  702. self.uploading1 = false;
  703. self.getOpinion1()
  704. }
  705. })
  706. }
  707. //下载意见表附件
  708. self.downLoadOption = function (item) {
  709. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  710. }
  711. //删除意见表附件
  712. self.deleteOptionFile = function (file, str) {
  713. var data = {
  714. routeid: file.ROUTEID,
  715. tableid: "FW_DWHYJY",
  716. colid: str,
  717. fileid: file.FILEID
  718. };
  719. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  720. .success(function (obj) {
  721. var res = strToJson(s4.decryptData_CBC(obj.data));
  722. sp.dialoghide();
  723. if (res.success) {
  724. if (str != "") {
  725. self.getOpinion(str);
  726. } else {
  727. self.getOpinion1();
  728. }
  729. } else {
  730. sp.dialog("删除失败,请联系管理员!");
  731. }
  732. });
  733. }
  734. //意见附件(上表)
  735. self.upload2 = function (str) {
  736. $('#fileupload-' + str).fileupload({
  737. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  738. dataType: 'json',
  739. beforeSend: function (xhr, data) {
  740. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  741. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  742. + ",routeid=" + self.routeid + ",tableid=FW_DWHYJY,colid=" + str));
  743. },
  744. // 上传完成后的执行逻辑
  745. done: function (e, data) {
  746. self.uploading1 = false;
  747. self.getOpinion(str)
  748. }
  749. })
  750. }
  751. //签写意见
  752. self.openOpinion = function (str) {
  753. if (self.routeinfoid == 0 && self.routeid == 0) {
  754. sp.dialog("请先保存!")
  755. return;
  756. }
  757. self.opinion[str] = true;
  758. }
  759. //修改意见
  760. self.changeOpinion = function (str) {
  761. self.data[str] = self.YJ[str][0].OPINION;
  762. self.opinion[str] = true;
  763. }
  764. self.changeOpinionItem = function (str, item) {
  765. if (item.OPINIONIMAGE != "") {
  766. self.QianZi(str);
  767. self.opinion[str + "Img"] = true;
  768. }
  769. self.data[str] = item.OPINION;
  770. self.opinion[str] = true;
  771. }
  772. //提交意见
  773. self.Sopinion = function (str) {
  774. if (self.opinion[str + "Img"] == true) {
  775. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  776. } else {
  777. self.data[str] = $("#" + str).val();
  778. }
  779. var data = {
  780. cmanid: self.userId,
  781. routeinfoid: self.routeinfoid,
  782. routeid: self.routeid,
  783. tableid: "FW_DWHYJY",
  784. colid: str,
  785. opiniontype: 0,
  786. cresult: "",
  787. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  788. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  789. }
  790. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  791. .success(function (obj) {
  792. var res = strToJson(s4.decryptData_CBC(obj.data));
  793. if (res.success == true) {
  794. self.getOpinion(str);
  795. self.opinion[str] = false;
  796. self.opinion[str + "Img"] = false;
  797. self.data[str] = "";
  798. self.changeFiled(str)
  799. } else {
  800. sp.dialog(res.message)
  801. }
  802. })
  803. }
  804. //删除意见
  805. self.Dopinion = function (str, item) {
  806. var data = {
  807. cmanid: self.userId,
  808. routeid: self.routeid,
  809. tableid: "FW_DWHYJY",
  810. colid: str,
  811. }
  812. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  813. .success(function (obj) {
  814. var res = strToJson(s4.decryptData_CBC(obj.data));
  815. if (res.success == true) {
  816. if (str != "") {
  817. self.getOpinion(str);
  818. } else {
  819. self.getOpinion1();
  820. }
  821. self.changeFiled(str)
  822. } else {
  823. sp.dialog(res.message)
  824. }
  825. })
  826. }
  827. self.phraseText = "";//添加常用语
  828. self.phraseList = []//常用语列表
  829. //获取常用语库
  830. self.phrase = function (colid) {
  831. sp.layer("#phrase");
  832. self.colid = colid;
  833. self.getPhrase();
  834. }
  835. //添加常用语到常用语库
  836. self.Aphrase = function () {
  837. if (self.phraseText == "") {
  838. return;
  839. }
  840. var data = {
  841. cmanid: self.userId,
  842. tableid: "FW_DWHYJY",
  843. colid: self.colid,
  844. contents: self.phraseText
  845. }
  846. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  847. .success(function (obj) {
  848. var res = strToJson(s4.decryptData_CBC(obj.data));
  849. if (res.success == true) {
  850. self.phraseText = "";
  851. self.getPhrase();
  852. } else {
  853. sp.dialog(res.message)
  854. }
  855. })
  856. }
  857. //获取常用语库
  858. self.getPhrase = function () {
  859. var data = {
  860. cmanid: self.userId,
  861. tableid: "FW_DWHYJY",
  862. colid: self.colid
  863. }
  864. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  865. .success(function (obj) {
  866. var res = strToJson(s4.decryptData_CBC(obj.data));
  867. self.phraseList = res.data;
  868. self.phraseSelect = self.phraseList[0].CONTENTS;
  869. })
  870. }
  871. //从常用语库删除
  872. self.Dphrase = function () {
  873. var id = null;
  874. $.each(self.phraseList, function (index, item) {
  875. if (item.CONTENTS == self.phraseSelect) {
  876. id = item.ID;
  877. }
  878. })
  879. var data = {
  880. id: id
  881. }
  882. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  883. .success(function (obj) {
  884. var res = strToJson(s4.decryptData_CBC(obj.data));
  885. self.getPhrase();
  886. })
  887. }
  888. //常用语确认为意见
  889. self.btnPhrase = function () {
  890. if (!self.colid) {
  891. self.nulla = self.phraseSelect;
  892. } else {
  893. self.data[self.colid] = self.phraseSelect;
  894. }
  895. sp.layerhide();
  896. }
  897. //签字—手写
  898. self.QianZi = function (str) {
  899. self.opinion[str + "Img"] = true;
  900. setTimeout(function () {
  901. new lineCanvas(str + "QZ")
  902. }, 1)
  903. }
  904. //清除手写
  905. self.canvasClear = function (str) {
  906. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  907. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  908. }
  909. //发生修改
  910. self.changeFiled = function (str) {
  911. self.filedChange = true;
  912. }
  913. //转发
  914. self.forward = function (obj) {
  915. self.btnItem = obj;
  916. if (self.filedChange == true) {
  917. self.btnSave(1)
  918. } else {
  919. $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=fawendw")
  920. sp.layer("#forward")
  921. }
  922. }
  923. //查看流转记录
  924. self.RouteList = function () {
  925. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  926. //var data = {
  927. // directionid: self.directionid,
  928. // userid: self.userId,
  929. // routeid: self.routeid,
  930. // routeinfoid: self.routeinfoid,
  931. //}
  932. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  933. //.success(function (obj) {
  934. // var res = strToJson(s4.decryptData_CBC(obj.data));
  935. // self.routeList = res.data;
  936. // $.each(self.routeList, function (index, item) {
  937. // item.mainUser = [];
  938. // item.copyUsers = [];
  939. // $.each(item.USERS, function (index1, item1) {
  940. // if (item1.KIND == 0) {
  941. // item.mainUser.push(item1.USERNAME);
  942. // } else {
  943. // item.copyUsers.push(item1.USERNAME);
  944. // }
  945. // })
  946. // item.mainUser = item.mainUser.join(",");
  947. // item.copyUsers = item.copyUsers.join(",");
  948. // })
  949. // setTimeout(function (item) {
  950. // sp.layer("#RouteList");
  951. // }, 100);
  952. //})
  953. }
  954. self.reSizeRow = function () {
  955. var bodybox = document.getElementById("bodyDiv");
  956. var topbox = document.getElementById("topDiv");
  957. var bottombox = document.getElementById("bottomDiv");
  958. var line = document.getElementById("lineDiv");
  959. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  960. $(".mousemove").show()
  961. var bodyboxH = bodybox.clientHeight;
  962. var topboxH = topbox.clientHeight;
  963. var bottomboxH = bottombox.clientHeight;
  964. //var y = event.pageY - line.offsetTop;
  965. var y = event.pageY - line.clientHeight;
  966. document.addEventListener("mousemove", boxMove)
  967. function boxMove(event) {
  968. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  969. //
  970. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  971. //
  972. } else {
  973. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  974. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  975. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  976. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  977. }
  978. }
  979. document.addEventListener("mouseup", function () {
  980. $(".mousemove").hide()
  981. document.removeEventListener("mousemove", boxMove)
  982. })
  983. })
  984. }
  985. ////头部关键字搜索---20230905
  986. self.headBtnSearchKeyword = "";
  987. self.headSearchResult = [];
  988. self.headSearchResult_view = false;
  989. self.headBtnSearch = function () {
  990. if (sp.isval(self.headBtnSearchKeyword)) {
  991. self.headSearchResult = [];
  992. var data = {
  993. "url": "/basic/api/StatSelect/selectCodeList",
  994. "data": { "keyWord": self.headBtnSearchKeyword }
  995. }
  996. //console.log(JSON.stringify(data));
  997. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  998. .success(function (obj) {
  999. var res = strToJson(s4.decryptData_CBC(obj.data));
  1000. //console.log(JSON.stringify(res.data));
  1001. self.headSearchResult = res.data.build;
  1002. if (sp.isval(self.headSearchResult)) {
  1003. self.headSearchResult_view = true;
  1004. } else {
  1005. self.headSearchResult_view = false;
  1006. }
  1007. })
  1008. } else {
  1009. self.headSearchResult_view = false;
  1010. }
  1011. };
  1012. self.headKeywordPage = function (itemdata) {
  1013. var get_token = localStorage.getItem("main-token");
  1014. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1015. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1016. self.headSearchResult_view = false;
  1017. };
  1018. self.onePic = function () {
  1019. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1020. }
  1021. //头部下滚冻结
  1022. $(function () {
  1023. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1024. //$("body").bind("scroll", function () {
  1025. // var scrollTop = $("body").scrollTop();
  1026. // if (scrollTop == 0) {
  1027. // $(".FixTop").removeClass("FixTop");
  1028. // }
  1029. // if (scrollTop > 35) {
  1030. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1031. // }
  1032. //});
  1033. //页面高度撑满
  1034. setTimeout(function () {
  1035. if ($(".ibox-content").height() < $(window).height() - 31) {
  1036. $(".ibox-content").css("height", $(window).height() - 31)
  1037. }
  1038. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1039. }, 1)
  1040. })
  1041. }])
  1042. app.filter('trustHtml', function ($sce) {
  1043. return function (input) {
  1044. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1045. };
  1046. });
  1047. //canvas画布签字
  1048. function lineCanvas(obj) {
  1049. var self = this;
  1050. self.linewidth = 1;
  1051. self.color = "#000000";
  1052. self.background = "#ffffff";
  1053. self.canvas = document.createElement("canvas");
  1054. document.getElementById(obj).appendChild(self.canvas);
  1055. self.cxt = self.canvas.getContext("2d");
  1056. self.canvas.width = document.getElementById(obj).clientWidth;
  1057. self.canvas.height = document.getElementById(obj).scrollHeight;
  1058. self.cxt.fillStyle = self.background;
  1059. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1060. self.cxt.strokeStyle = self.color;
  1061. self.cxt.lineWidth = self.linewidth;
  1062. self.cxt.lineCap = "round";
  1063. //开始绘制
  1064. self.canvas.addEventListener("mousedown", function (e) {
  1065. self.cxt.beginPath();
  1066. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1067. self.canvas.addEventListener("mousemove", move)
  1068. }.bind(self), false);
  1069. //绘制中
  1070. function move() {
  1071. var e = window.event;
  1072. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1073. self.cxt.stroke();
  1074. }
  1075. //结束绘制
  1076. self.canvas.addEventListener("mouseup", up)
  1077. function up() {
  1078. self.cxt.closePath();
  1079. self.canvas.removeEventListener("mousemove", move)
  1080. }
  1081. };
  1082. function showToggle(e) {
  1083. $(e).children().toggle()
  1084. $(e).next().toggle()
  1085. }
  1086. function toggleYJL(e) {
  1087. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1088. $("#topDiv").css("height", 160)
  1089. $(e).parent().css("height", 450)
  1090. $("#attachlist").css("height", 200)
  1091. $("#bottomDiv").css("height","")
  1092. } else {
  1093. $("#topDiv").css("height", 600)
  1094. $(e).parent().css("height", 10)
  1095. }
  1096. $(e).children().toggle()
  1097. }