formedit.js 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343
  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.uploading = false;
  33. self.upload = function () {
  34. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  35. return item.CNAME
  36. })
  37. $('#fileupload').fileupload({
  38. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  39. dataType: 'json',
  40. beforeSend: function (xhr, data) {
  41. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  42. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=机关纪委便签"));
  43. },
  44. add: function (e, data) {
  45. var num = 0;
  46. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  47. //文件类型判断
  48. $.each(data.originalFiles, function (index, item) {
  49. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  50. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  51. return;
  52. } else {
  53. num++
  54. }
  55. })
  56. if (num == data.originalFiles.length) {
  57. self.uploading = true;
  58. data.submit();
  59. $scope.$apply();
  60. }
  61. },
  62. // 上传完成后的执行逻辑
  63. done: function (e, data) {
  64. self.uploading = false;
  65. self.getOther()
  66. }
  67. })
  68. }
  69. self.downLoad = function (item) {
  70. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  71. }
  72. self.deleteFile = function (file) {
  73. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  74. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  75. 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>";
  76. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  77. sp.openCenter(".sp-dialog");
  78. ///取消按钮
  79. $('.sp-closeDialog').click(function (event) {
  80. sp.closeCenter(".sp-dialog");
  81. event.preventDefault();
  82. event.stopPropagation();
  83. });
  84. //post消息的id
  85. $("#delDataTrue").click(function () {
  86. var data = {
  87. tablename: "FILE_ATTACH",
  88. id: file.ID
  89. };
  90. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  91. .success(function (obj) {
  92. var res = strToJson(s4.decryptData_CBC(obj.data));
  93. sp.dialoghide();
  94. if (res.success) {
  95. self.getOther();
  96. } else {
  97. sp.dialog("删除失败,请联系管理员!");
  98. }
  99. });
  100. });
  101. }
  102. self.goAttach = function (obj) {
  103. if (obj) {
  104. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  105. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  106. return
  107. }
  108. $("#attachlist")[0].contentWindow.openFile(obj)
  109. if ($(".fa-chevron-down").is(":hidden") == true) {
  110. showToggle(document.getElementById("toggleButton"))
  111. }
  112. } else {
  113. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  114. }
  115. }
  116. self.readonly = {
  117. RQ:false,
  118. CSDW:false,
  119. FWBT:false,
  120. NRZY:false,
  121. FGLDYJ:false,
  122. GWZL: false,
  123. ZYLDPS:false,
  124. CSCBR:false,
  125. LXDH:false,
  126. }
  127. self.show = {
  128. //FWZH: false
  129. }
  130. //初始化右上角按钮
  131. self.buttonList = []
  132. self.getSwenList = function (n) {
  133. self.SwenList = [];
  134. var data = {
  135. directionid: self.directionid,
  136. userid: self.userId,
  137. routeinfoid: self.routeinfoid,
  138. routeid: self.routeid,
  139. formeditid: ""
  140. }
  141. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  142. .success(function (obj) {
  143. var res = strToJson(s4.decryptData_CBC(obj.data));
  144. console.log(res.data)
  145. if (self.copyrightid == "") {
  146. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  147. }
  148. $.each(res.data.LINKS, function (index, item) {
  149. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  150. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  151. self.Title = item.VNAME;
  152. }
  153. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  154. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  155. } else {
  156. item.TEMPFORM = "#";
  157. }
  158. self.SwenList.push(item)
  159. })
  160. self.SwenList.push({
  161. VNAME: "流程图",
  162. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  163. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  164. })
  165. if (n == 0) {
  166. self.getFLOW()
  167. } else {
  168. self.getData()
  169. }
  170. })
  171. }
  172. self.getSwenList(0)
  173. self.getFLOW = function () {
  174. var data = {
  175. copyrightid: self.copyrightid
  176. }
  177. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  178. .success(function (obj) {
  179. var res = strToJson(s4.decryptData_CBC(obj.data));
  180. self.flowTitle = res.data.CNAME;
  181. self.getJJCD()
  182. })
  183. }
  184. self.getJJCD = function () {
  185. var data = {
  186. ckey: "CODE_JJCD",
  187. routeinfoid: self.routeinfoid
  188. }
  189. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  190. .success(function (obj) {
  191. var res = strToJson(s4.decryptData_CBC(obj.data));
  192. self.JJCD = res.data.CODE_JJCD;
  193. self.getXXGKSH()
  194. })
  195. }
  196. self.getXXGKSH = function () {
  197. var data = {
  198. ckey: "CODE_XXGKSH",
  199. routeinfoid: self.routeinfoid
  200. }
  201. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  202. .success(function (obj) {
  203. var res = strToJson(s4.decryptData_CBC(obj.data));
  204. self.XXGKSH = res.data.CODE_XXGKSH;
  205. self.getGWZL()
  206. })
  207. }
  208. self.getGWZL = function () {
  209. var data = {
  210. tablename: "CODE_GWTYPE",
  211. colums: "ID,CODE,CNAME,FLOWID",
  212. order: "ID desc",
  213. sqlwhere: {
  214. USEMARK: 1,
  215. FLOWID: sp.getUrlName("flowid")
  216. },
  217. sqlinwhere: "",
  218. sqllikewhere: ""
  219. }
  220. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  221. .success(function (obj) {
  222. var res = strToJson(s4.decryptData_CBC(obj.data));
  223. console.log(res.data)
  224. self.GWZL = res.data;
  225. self.getSFXYJD()
  226. })
  227. }
  228. self.getSFXYJD = function () {
  229. var data = {
  230. ckey: "CODE_SFXYJD",
  231. routeinfoid: self.routeinfoid
  232. }
  233. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  234. .success(function (obj) {
  235. var res = strToJson(s4.decryptData_CBC(obj.data));
  236. self.SFXYJD = res.data.CODE_SFXYJD;
  237. self.getZDGKLM()
  238. })
  239. }
  240. self.getZDGKLM = function () {
  241. var data = {
  242. ckey: "CODE_ZDGKLM",
  243. routeinfoid: self.routeinfoid
  244. }
  245. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  246. .success(function (obj) {
  247. var res = strToJson(s4.decryptData_CBC(obj.data));
  248. self.ZDGKLM = res.data.CODE_ZDGKLM;
  249. self.getZDGKZT()
  250. })
  251. }
  252. self.getZDGKZT = function () {
  253. var data = {
  254. ckey: "CODE_ZDGKZT",
  255. routeinfoid: self.routeinfoid
  256. }
  257. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  258. .success(function (obj) {
  259. var res = strToJson(s4.decryptData_CBC(obj.data));
  260. self.ZDGKZT = res.data.CODE_ZDGKZT;
  261. self.getDP()
  262. })
  263. }
  264. self.getDP = function () {
  265. var data = {
  266. userid: self.userId
  267. }
  268. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  269. .success(function (obj) {
  270. var res = strToJson(s4.decryptData_CBC(obj.data));
  271. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  272. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  273. self.getData();
  274. })
  275. }
  276. //获取数据
  277. self.getData = function () {
  278. var data = {
  279. ckey: "FW_JGJWBQ",
  280. id: 0,
  281. directionid: self.directionid,
  282. formeditid: self.formeditid,
  283. routeid: self.routeid,
  284. routeinfoid: self.routeinfoid
  285. }
  286. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  287. .success(function (obj) {
  288. var res = strToJson(s4.decryptData_CBC(obj.data));
  289. self.data = {
  290. ID: res.data.FW_JGJWBQ.ID,
  291. APPCODE: res.data.FW_JGJWBQ.APPCODE,
  292. GWZL: res.data.FW_JGJWBQ.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_JGJWBQ.GWZL,
  293. RQ:res.data.FW_JGJWBQ.RQ,
  294. CSDW:res.data.FW_JGJWBQ.CSDW,
  295. FWBT:res.data.FW_JGJWBQ.FWBT,
  296. NRZY:res.data.FW_JGJWBQ.NRZY,
  297. FGLDYJ:res.data.FW_JGJWBQ.FGLDYJ,
  298. ZYLDPS:res.data.FW_JGJWBQ.ZYLDPS,
  299. CSCBR:res.data.FW_JGJWBQ.CSCBR,
  300. LXDH:res.data.FW_JGJWBQ.LXDH,
  301. }
  302. self.readonly = {
  303. GWZL:res.data.FW_JGJWBQ["GWZL.EREADONLY"] == "true",
  304. RQ:res.data.FW_JGJWBQ["RQ.EREADONLY"] == "true",
  305. CSDW:res.data.FW_JGJWBQ["CSDW.EREADONLY"] == "true",
  306. FWBT:res.data.FW_JGJWBQ["FWBT.EREADONLY"] == "true",
  307. NRZY:res.data.FW_JGJWBQ["NRZY.EREADONLY"] == "true",
  308. FGLDYJ:res.data.FW_JGJWBQ["FGLDYJ.EREADONLY"] == "true",
  309. ZYLDPS:res.data.FW_JGJWBQ["ZYLDPS.EREADONLY"] == "true",
  310. CSCBR:res.data.FW_JGJWBQ["CSCBR.EREADONLY"] == "true",
  311. LXDH:res.data.FW_JGJWBQ["LXDH.EREADONLY"] == "true",
  312. }
  313. self.show = {
  314. //FWZH: res.data.FW_JGJWBQ["FWZH.ESHOW"] == "true"
  315. }
  316. if (self.data.ID == 0) {
  317. self.filedChange = true;
  318. } else {
  319. self.filedChange = false;
  320. }
  321. self.buttonList = res.data["FW_JGJWBQ.FUNCLIST"];
  322. self.getOpinion('FGLDYJ')
  323. self.getOpinion('ZYLDPS')
  324. self.getOpinion1()
  325. self.getOther()
  326. self.getGCG()
  327. self.getFWZH()
  328. //watermark({
  329. // "watermarl_element": "app",
  330. // "watermark_txt": "测试水印内容",
  331. // "watermark_width": 150,
  332. // "watermark_height": 110,
  333. // "watermark_angle": 345
  334. //})
  335. $timeout(function () {
  336. $(".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")
  337. var height1 = $(".formedit center").css("height"), height2 = 0, height3 = 0;
  338. $(".auto").siblings().each(function () {
  339. height2 = height2 + $(this).outerHeight();
  340. })
  341. $(".auto").children().each(function () {
  342. height3 = height3 + $(this).outerHeight(true);
  343. })
  344. if (height1.slice(0, height1.length - 2) - height2 > height3 + 2) {
  345. $(".auto").css("height", height1.slice(0, height1.length - 2) - height2);
  346. } else {
  347. $(".auto").css("height", height3 + 2);
  348. $(".formedit center").css("height", height2 + height3 + 2).css("line-height", (height2 + height3 + 2) / 6 + "px")
  349. }
  350. }, 100)
  351. })
  352. }
  353. self.getFWZH = function () {
  354. var data = {
  355. flowid: sp.getUrlName("flowid"),
  356. code: "",
  357. cyear: sp.currentYear(),
  358. routeinfoidmark: self.routeinfoid,
  359. zihao: self.data.FWZH
  360. }
  361. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  362. .success(function (obj) {
  363. var res = strToJson(s4.decryptData_CBC(obj.data));
  364. self.FWZH = res.data.map(function (item) {
  365. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  366. });
  367. if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE }
  368. })
  369. }
  370. //获取附件和插件
  371. self.getOther = function () {
  372. var data = {
  373. tablename: "FILE_ATTACH",
  374. colums: "*",
  375. order: "ID desc",
  376. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  377. sqlinwhere: "",
  378. sqllikewhere: ""
  379. }
  380. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  381. .success(function (obj) {
  382. var res = strToJson(s4.decryptData_CBC(obj.data));
  383. self.arrayFile1 = [];
  384. if (res.data.length > 0) {
  385. res.data.forEach(function (item) {
  386. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  387. self.arrayFile = item;
  388. } else {
  389. self.arrayFile1.push(item)
  390. }
  391. })
  392. self.goAttach()
  393. }
  394. })
  395. }
  396. //发文打开过程稿在线编辑
  397. self.getGCG = function () {
  398. var data = {
  399. dockind: "D01",
  400. routeinfoid: self.routeinfoid
  401. }
  402. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  403. .success(function (obj) {
  404. var res = strToJson(s4.decryptData_CBC(obj.data));
  405. self.gaoTypeArrayFirst = res.data;
  406. })
  407. }
  408. //获取意见(上表)
  409. self.getOpinion = function (str) {
  410. var data = {
  411. cmanid: self.userId,
  412. routeinfoid: self.routeinfoid,
  413. routeid: "",//self.routeid,
  414. tableid: "FW_JGJWBQ",
  415. colid: str,
  416. opiniontype: 0,
  417. orderbycol: "CDATE desc"
  418. }
  419. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  420. .success(function (obj) {
  421. var res = strToJson(s4.decryptData_CBC(obj.data));
  422. if (res.success == true) {
  423. self.YJ[str] = res.data;
  424. self.YJ[str + "STATUS"] = false;
  425. self.YJ[str].forEach(function (item) {
  426. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  427. if (item.ROUTEID == self.routeid) {
  428. self.YJ[str + "STATUS"] = true;
  429. }
  430. })
  431. } else {
  432. sp.dialog(res.message)
  433. }
  434. })
  435. }
  436. //获取意见(不上表)
  437. self.opiniontype = 99;
  438. self.getOpinion1 = function () {
  439. var data = {
  440. cmanid: self.userId,
  441. routeinfoid: self.routeinfoid,
  442. routeid: "",//self.routeid,
  443. tableid: "FW_JGJWBQ",
  444. colid: "",
  445. opiniontype: self.opiniontype,
  446. orderbycol: "CDATE desc"
  447. }
  448. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  449. .success(function (obj) {
  450. var res = strToJson(s4.decryptData_CBC(obj.data));
  451. if (res.success == true) {
  452. self.YJ.nulla = res.data;
  453. self.YJ.nullaSTATUS = false;
  454. self.YJ.nulla.forEach(function (item) {
  455. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  456. //if (item.ROUTEID == self.routeid && item.COLID == "") {
  457. // self.YJ.nullaSTATUS = true;
  458. //}
  459. })
  460. } else {
  461. sp.dialog(res.message)
  462. }
  463. })
  464. }
  465. //判断页面字段是否只读readonly、是否隐藏show
  466. self.hide = function (type, field) {
  467. if (self.dotype == 0 && type == "readonly") {
  468. return true;
  469. } else {
  470. if (self[type][field] == true) {
  471. return true;
  472. } else {
  473. return false;
  474. }
  475. }
  476. }
  477. //右上角按钮调用方法
  478. self.btnEvent = function (item) {
  479. switch (item.CODE) {
  480. case "SAVEITEM": self.btnSave(0); break;
  481. case "PRINTITEM": self.btnPrint(); break;
  482. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  483. case "MEETITEM": self.Meet(); break;
  484. case "SENDLOG": self.RouteList(); break;
  485. case "PUBLICITEM": self.PUBLICITEM(); break;
  486. case "FWZIHAO": return; break;
  487. default: self.forward(item); break;
  488. }
  489. }
  490. self.tiaohao = function () {
  491. var data = {
  492. data: {
  493. CYEAR: sp.currentYear(),
  494. FLOWID: sp.getUrlName("flowid"),
  495. ZIHAO: "",
  496. CNAMEMARK: "",
  497. ROUTEINFOIDMARK: self.routeinfoid,
  498. THMARK: 1
  499. }
  500. }
  501. self.FWZH.forEach(function (item) {
  502. if (item.CODE == self.data.FWZH) {
  503. data.data.ZIHAO = item.CODE;
  504. data.data.CNAMEMARK = item.CNAMEMARK
  505. }
  506. })
  507. $http.post(apiurljs.login + "g2app/fawen/saveZhanHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  508. .success(function (obj) {
  509. var res = strToJson(s4.decryptData_CBC(obj.data));
  510. if (res.success == true) {
  511. var data1 = {
  512. flowid: sp.getUrlName("flowid"),
  513. code: self.userDpCode,
  514. cyear: sp.currentYear(),
  515. routeinfoidmark: self.routeinfoid,
  516. zihao: self.data.FWZH
  517. }
  518. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  519. .success(function (obj1) {
  520. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  521. self.FWZH = res1.data.map(function (item) {
  522. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  523. });
  524. self.data.FWZH = self.FWZH[0].CODE
  525. self.btnSave(0)
  526. })
  527. } else {
  528. sp.dialog(res.message)
  529. }
  530. })
  531. }
  532. self.tiaohaoR = function () {
  533. var data = {
  534. flowid: sp.getUrlName("flowid"),
  535. cnamemark: "",
  536. routeinfoidmark: self.routeinfoid,
  537. cyear: sp.currentYear(),
  538. zihao: self.data.FWZH
  539. }
  540. self.FWZH.forEach(function (item) {
  541. if (item.CODE == self.data.FWZH) {
  542. data.cnamemark = item.CNAMEMARK
  543. }
  544. })
  545. $http.post(apiurljs.login + "g2app/fawen/initZiHaoByRouteinfoidmark", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  546. .success(function (obj) {
  547. var res = strToJson(s4.decryptData_CBC(obj.data));
  548. if (res.success == true) {
  549. if (res.data == 0) {
  550. sp.dialog("此件当前暂无占号记录!")
  551. $timeout(function () {
  552. sp.dialoghide()
  553. }, 1500)
  554. return
  555. }
  556. var data1 = {
  557. flowid: sp.getUrlName("flowid"),
  558. code: self.userDpCode,
  559. cyear: sp.currentYear(),
  560. routeinfoidmark: self.routeinfoid,
  561. zihao: ""
  562. }
  563. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  564. .success(function (obj1) {
  565. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  566. self.FWZH = res1.data.map(function (item) {
  567. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  568. });
  569. self.data.FWZH = self.FWZH[0].CODE
  570. self.btnSave(0)
  571. console.log(self.FWZH)
  572. })
  573. } else {
  574. sp.dialog(res.message)
  575. }
  576. })
  577. }
  578. //保存提交
  579. self.btnSave = function (n) {
  580. if (spngvld.submit(".sp-page-center")) {
  581. var data = {
  582. data: {
  583. CYEAR: sp.currentYear(),
  584. FLOWID: sp.getUrlName("flowid"),
  585. ZIHAO: "",
  586. CNAMEMARK: "",
  587. ROUTEINFOIDMARK: self.routeinfoid
  588. }
  589. }
  590. self.FWZH.forEach(function (item) {
  591. if (item.CODE == self.data.FWZH) {
  592. data.data.ZIHAO = item.CODE;
  593. data.data.CNAMEMARK = item.CNAMEMARK
  594. }
  595. })
  596. $http.post(apiurljs.login + "g2app/fawen/saveWenHaoByData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  597. .success(function (obj) { })
  598. var dataArray = [];
  599. self.data.FGLDYJ = "";
  600. self.data.ZYLDPS = "";
  601. dataArray.push(self.data);
  602. var data = {
  603. ckey: "FW_JGJWBQ",
  604. id: self.data.ID,
  605. routeid: self.routeid,
  606. routeinfoid: self.routeinfoid,
  607. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
  608. directionid: self.directionid,
  609. formeditid: self.formeditid,
  610. data: JSON.stringify(dataArray)
  611. }
  612. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  613. .success(function (obj) {
  614. var res = strToJson(s4.decryptData_CBC(obj.data));
  615. if (res.code == 0) {
  616. self.data.ID = res.data.ID;
  617. self.routeid = res.data.ROUTEID;
  618. self.routeinfoid = res.data.ROUTEINFOID;
  619. self.filedChange = false;
  620. if (n == 0) {
  621. sp.dialog("保存成功!");
  622. $timeout(function () {
  623. sp.dialoghide()
  624. }, 1500)
  625. self.getSwenList(1)
  626. } else if (n == 1) {
  627. self.forward(self.btnItem);
  628. } else if (n == 2) {
  629. self.sendAll();
  630. } else if (n == 3) {
  631. self.btnPrint();
  632. }
  633. } else {
  634. sp.dialog(res.message)
  635. }
  636. })
  637. }
  638. }
  639. //打印
  640. self.btnPrint = function () {
  641. if (self.filedChange == true) {
  642. self.btnSave(3)
  643. } else {
  644. // 创建隐藏的可下载链接
  645. var eleLink = document.createElement('a');
  646. eleLink.download = "";
  647. eleLink.style.display = 'none';
  648. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban21.ftl&tablename=FW_JGJWBQ&outfilepath=/tmp/机关纪委便签.wps&printdate=NGSJ&routeinfoid=" + self.routeinfoid));
  649. // 触发点击
  650. document.body.appendChild(eleLink);
  651. eleLink.click();
  652. // 然后移除
  653. document.body.removeChild(eleLink);
  654. //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=FW_JGJWBQ&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
  655. }
  656. }
  657. /*综合打印*/
  658. self.printFiled = 1;
  659. self.btnPrint1 = function () {
  660. if (self.filedChange == true) {
  661. self.btnSave(3)
  662. } else {
  663. sp.layer("#print")
  664. }
  665. }
  666. self.printSubmit = function () {
  667. if (self.printFiled == 1) {
  668. var templatefilename = "moban21"
  669. } else if (self.printFiled == 2) {
  670. var templatefilename = "mobanoption"
  671. } else {
  672. var templatefilename = "moban21_all"
  673. }
  674. var data = {
  675. templatefilename: templatefilename + ".ftl",
  676. outfilepath: "/tmp/机关纪委便签" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  677. routeinfoid: self.routeinfoid,
  678. tablename: "FW_JGJWBQ",
  679. printtype: self.printFiled,
  680. printdate: "NGSJ"
  681. }
  682. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  683. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  684. .success(function (obj) {
  685. var res = strToJson(s4.decryptData_CBC(obj.data));
  686. //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
  687. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  688. })
  689. //// 创建隐藏的可下载链接
  690. //var eleLink = document.createElement('a');
  691. //eleLink.download = "";
  692. //eleLink.style.display = 'none';
  693. //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));
  694. //// 触发点击
  695. //document.body.appendChild(eleLink);
  696. //eleLink.click();
  697. //// 然后移除
  698. //document.body.removeChild(eleLink);
  699. sp.layerhide()
  700. }
  701. //签写意见编辑状态
  702. self.opinion = {
  703. ZYLDPS: false,
  704. ZYLDPSImg: false,
  705. FGLDYJ: false,
  706. FGLDYJImg: false,
  707. nulla: false
  708. }
  709. self.YJ = {
  710. ZYLDPS: [],
  711. ZYLDPSSTATUS: false,
  712. FGLDYJ: [],
  713. FGLDYJSTATUS: false,
  714. nulla: [],
  715. nullaSTATUS: false
  716. }
  717. //意见(下表)
  718. self.openOptionList = function () {
  719. if (self.routeinfoid == 0 && self.routeid == 0) {
  720. sp.dialog("请先保存!")
  721. return;
  722. }
  723. if (self.opinion.nulla == true) {
  724. return;
  725. }
  726. self.nulla = "";
  727. $(".optionList").css("height", 149)
  728. self.opinion.nulla = true;
  729. }
  730. self.closeOptionList = function () {
  731. $(".optionList").css("height", 389)
  732. self.opinion.nulla = false;
  733. }
  734. self.submitOptionList = function () {
  735. var data = {
  736. cmanid: self.userId,
  737. routeinfoid: self.routeinfoid,
  738. routeid: self.routeid,
  739. tableid: "FW_JGJWBQ",
  740. colid: "",
  741. opiniontype: 99,
  742. cresult: "",
  743. opinion: self.nulla,
  744. opinionimage: ""
  745. }
  746. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  747. .success(function (obj) {
  748. var res = strToJson(s4.decryptData_CBC(obj.data));
  749. if (res.success == true) {
  750. self.getOpinion1();
  751. self.opinion.nulla = false;
  752. $(".optionList").css("height", 389)
  753. } else {
  754. sp.dialog(res.message)
  755. }
  756. })
  757. }
  758. self.changeOptionList = function (item) {
  759. self.nulla = item.OPINION;
  760. self.opinion.nulla = true;
  761. }
  762. //意见附件(下表)
  763. self.uploading1 = false;
  764. self.upload1 = function () {
  765. $('#fileupload1').fileupload({
  766. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  767. dataType: 'json',
  768. beforeSend: function (xhr, data) {
  769. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  770. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  771. + ",routeid=" + self.routeid + ",tableid=FW_JGJWBQ"));
  772. },
  773. // 上传完成后的执行逻辑
  774. done: function (e, data) {
  775. self.uploading1 = false;
  776. self.getOpinion1()
  777. }
  778. })
  779. }
  780. //下载意见表附件
  781. self.downLoadOption = function (item) {
  782. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  783. }
  784. //删除意见表附件
  785. self.deleteOptionFile = function (file, str) {
  786. var data = {
  787. routeid: file.ROUTEID,
  788. tableid: "FW_JGJWBQ",
  789. colid: str,
  790. fileid: file.FILEID
  791. };
  792. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  793. .success(function (obj) {
  794. var res = strToJson(s4.decryptData_CBC(obj.data));
  795. sp.dialoghide();
  796. if (res.success) {
  797. if (str != "") {
  798. self.getOpinion(str);
  799. } else {
  800. self.getOpinion1();
  801. }
  802. } else {
  803. sp.dialog("删除失败,请联系管理员!");
  804. }
  805. });
  806. }
  807. //意见附件(上表)
  808. self.upload2 = function (str) {
  809. $('#fileupload-' + str).fileupload({
  810. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  811. dataType: 'json',
  812. beforeSend: function (xhr, data) {
  813. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  814. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  815. + ",routeid=" + self.routeid + ",tableid=FW_JGJWBQ,colid=" + str));
  816. },
  817. // 上传完成后的执行逻辑
  818. done: function (e, data) {
  819. self.uploading1 = false;
  820. self.getOpinion(str)
  821. }
  822. })
  823. }
  824. //签写意见
  825. self.openOpinion = function (str) {
  826. if (self.routeinfoid == 0 && self.routeid == 0) {
  827. sp.dialog("请先保存!")
  828. return;
  829. }
  830. self.opinion[str] = true;
  831. }
  832. //修改意见
  833. self.changeOpinion = function (str) {
  834. self.data[str] = self.YJ[str][0].OPINION;
  835. self.opinion[str] = true;
  836. }
  837. self.changeOpinionItem = function (str, item) {
  838. if (item.OPINIONIMAGE != "") {
  839. self.QianZi(str);
  840. self.opinion[str + "Img"] = true;
  841. }
  842. self.data[str] = item.OPINION;
  843. self.opinion[str] = true;
  844. }
  845. //提交意见
  846. self.Sopinion = function (str) {
  847. if (self.opinion[str + "Img"] == true) {
  848. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  849. } else {
  850. self.data[str] = $("#" + str).val();
  851. }
  852. var data = {
  853. cmanid: self.userId,
  854. routeinfoid: self.routeinfoid,
  855. routeid: self.routeid,
  856. tableid: "FW_JGJWBQ",
  857. colid: str,
  858. opiniontype: 0,
  859. cresult: "",
  860. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  861. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  862. }
  863. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  864. .success(function (obj) {
  865. var res = strToJson(s4.decryptData_CBC(obj.data));
  866. if (res.success == true) {
  867. self.getOpinion(str);
  868. self.opinion[str] = false;
  869. self.opinion[str + "Img"] = false;
  870. self.data[str] = "";
  871. self.changeFiled(str)
  872. } else {
  873. sp.dialog(res.message)
  874. }
  875. })
  876. }
  877. //删除意见
  878. self.Dopinion = function (str, item) {
  879. var data = {
  880. cmanid: self.userId,
  881. routeid: self.routeid,
  882. tableid: "FW_JGJWBQ",
  883. colid: str,
  884. }
  885. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  886. .success(function (obj) {
  887. var res = strToJson(s4.decryptData_CBC(obj.data));
  888. if (res.success == true) {
  889. if (str != "") {
  890. self.getOpinion(str);
  891. } else {
  892. self.getOpinion1();
  893. }
  894. self.changeFiled(str)
  895. } else {
  896. sp.dialog(res.message)
  897. }
  898. })
  899. }
  900. self.phraseText = "";//添加常用语
  901. self.phraseList = []//常用语列表
  902. //获取常用语库
  903. self.phrase = function (colid) {
  904. sp.layer("#phrase");
  905. self.colid = colid;
  906. self.getPhrase();
  907. }
  908. //添加常用语到常用语库
  909. self.Aphrase = function () {
  910. if (self.phraseText == "") {
  911. return;
  912. }
  913. var data = {
  914. cmanid: self.userId,
  915. tableid: "FW_JGJWBQ",
  916. colid: self.colid,
  917. contents: self.phraseText
  918. }
  919. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  920. .success(function (obj) {
  921. var res = strToJson(s4.decryptData_CBC(obj.data));
  922. if (res.success == true) {
  923. self.phraseText = "";
  924. self.getPhrase();
  925. } else {
  926. sp.dialog(res.message)
  927. }
  928. })
  929. }
  930. //获取常用语库
  931. self.getPhrase = function () {
  932. var data = {
  933. cmanid: self.userId,
  934. tableid: "FW_JGJWBQ",
  935. colid: self.colid
  936. }
  937. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  938. .success(function (obj) {
  939. var res = strToJson(s4.decryptData_CBC(obj.data));
  940. self.phraseList = res.data;
  941. self.phraseSelect = self.phraseList[0].CONTENTS;
  942. })
  943. }
  944. //从常用语库删除
  945. self.Dphrase = function () {
  946. var id = null;
  947. $.each(self.phraseList, function (index, item) {
  948. if (item.CONTENTS == self.phraseSelect) {
  949. id = item.ID;
  950. }
  951. })
  952. var data = {
  953. id: id
  954. }
  955. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  956. .success(function (obj) {
  957. var res = strToJson(s4.decryptData_CBC(obj.data));
  958. self.getPhrase();
  959. })
  960. }
  961. //常用语确认为意见
  962. self.btnPhrase = function () {
  963. if (!self.colid) {
  964. self.nulla = self.phraseSelect;
  965. } else {
  966. self.data[self.colid] = self.phraseSelect;
  967. }
  968. sp.layerhide();
  969. }
  970. //签字—手写
  971. self.QianZi = function (str) {
  972. self.opinion[str + "Img"] = true;
  973. setTimeout(function () {
  974. new lineCanvas(str + "QZ")
  975. }, 1)
  976. }
  977. //清除手写
  978. self.canvasClear = function (str) {
  979. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  980. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  981. }
  982. //发生修改
  983. self.changeFiled = function (str) {
  984. self.filedChange = true;
  985. if (str = "XXGKSH") {
  986. self.XXGKSH.forEach(function (item) {
  987. if (self.data.XXGKSH == item.CODE) {
  988. self.data.XXGKSH1 = item.CNAME
  989. }
  990. })
  991. }
  992. }
  993. //转发
  994. self.forward = function (obj) {
  995. self.btnItem = obj;
  996. if (self.filedChange == true) {
  997. self.btnSave(1)
  998. } else {
  999. $("#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=fawenbg")
  1000. sp.layer("#forward")
  1001. }
  1002. }
  1003. //查看流转记录
  1004. self.RouteList = function () {
  1005. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1006. }
  1007. self.reSizeRow = function () {
  1008. var bodybox = document.getElementById("bodyDiv");
  1009. var topbox = document.getElementById("topDiv");
  1010. var bottombox = document.getElementById("bottomDiv");
  1011. var line = document.getElementById("lineDiv");
  1012. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  1013. $(".mousemove").show()
  1014. var bodyboxH = bodybox.clientHeight;
  1015. var topboxH = topbox.clientHeight;
  1016. var bottomboxH = bottombox.clientHeight;
  1017. //var y = event.pageY - line.offsetTop;
  1018. var y = event.pageY - line.clientHeight;
  1019. document.addEventListener("mousemove", boxMove)
  1020. function boxMove(event) {
  1021. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1022. //
  1023. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1024. //
  1025. } else {
  1026. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1027. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1028. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  1029. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  1030. }
  1031. }
  1032. document.addEventListener("mouseup", function () {
  1033. $(".mousemove").hide()
  1034. document.removeEventListener("mousemove", boxMove)
  1035. })
  1036. })
  1037. }
  1038. ////头部关键字搜索---20230905
  1039. self.headBtnSearchKeyword = "";
  1040. self.headSearchResult = [];
  1041. self.headSearchResult_view = false;
  1042. self.headBtnSearch = function () {
  1043. if (sp.isval(self.headBtnSearchKeyword)) {
  1044. self.headSearchResult = [];
  1045. var data = {
  1046. "url": "/basic/api/StatSelect/selectCodeList",
  1047. "data": { "keyWord": self.headBtnSearchKeyword }
  1048. }
  1049. //console.log(JSON.stringify(data));
  1050. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1051. .success(function (obj) {
  1052. var res = strToJson(s4.decryptData_CBC(obj.data));
  1053. //console.log(JSON.stringify(res.data));
  1054. self.headSearchResult = res.data.build;
  1055. if (sp.isval(self.headSearchResult)) {
  1056. self.headSearchResult_view = true;
  1057. } else {
  1058. self.headSearchResult_view = false;
  1059. }
  1060. })
  1061. } else {
  1062. self.headSearchResult_view = false;
  1063. }
  1064. };
  1065. self.headKeywordPage = function (itemdata) {
  1066. var get_token = localStorage.getItem("main-token");
  1067. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1068. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1069. self.headSearchResult_view = false;
  1070. };
  1071. self.onePic = function () {
  1072. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1073. }
  1074. //公开
  1075. self.PUBLICITEM = function () {
  1076. var data = {
  1077. userid: self.userId
  1078. }
  1079. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1080. .success(function (obj) {
  1081. var res = strToJson(s4.decryptData_CBC(obj.data));
  1082. var data1 = {
  1083. tablename: "CODE_LM"
  1084. }
  1085. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  1086. .success(function (obj1) {
  1087. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  1088. self.LM = res1.data[0].C_H_I_L_D_DATA;
  1089. self.LM.forEach(function (item) {
  1090. item.show = true;
  1091. if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
  1092. item.show = false;
  1093. }
  1094. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1095. item1.show = true;
  1096. if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
  1097. item1.show = false;
  1098. }
  1099. })
  1100. })
  1101. self.filed = "GKFW";
  1102. self.msgGK = {
  1103. WJLY: "FW",
  1104. FLOWID: "AA08",
  1105. FORMROUTEINFOID: self.routeinfoid,
  1106. FBUSERID: self.userId,
  1107. FBNAME: self.userName,
  1108. GKFW: "",
  1109. LM: "P0103",
  1110. LM1: "委发文件",
  1111. FBRQ: sp.getLocalDate(),
  1112. FBBM: res.data[0].SECTION,
  1113. WJBT: self.data.BT
  1114. }
  1115. sp.layer("#PUBLICITEM")
  1116. $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
  1117. })
  1118. })
  1119. }
  1120. self.showCol = function ($event, ele) {
  1121. $('.detail-col').not(ele).hide();
  1122. $(ele).toggle("slow").autoHide();
  1123. $event.stopPropagation();
  1124. }
  1125. self.selectLM = function (item) {
  1126. self.msgGK.LM = item.CODE
  1127. self.msgGK.LM1 = item.CNAME
  1128. console.log(self.msgGK)
  1129. $(".detail-col").toggle("slow");
  1130. }
  1131. self.showSecond = function (obj, n) {
  1132. self.LM1 = obj.C_H_I_L_D_DATA;
  1133. $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
  1134. $(".detail-col").eq(1).show().autoHide()
  1135. }
  1136. self.checkAllUser1 = function () {
  1137. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  1138. $.each(self.UserList[self.filed], function (index, item) {
  1139. item.checked = self.AllChecked[self.filed];
  1140. $.each(item.USER, function (index1, item1) {
  1141. item1.checked = self.AllChecked[self.filed];
  1142. })
  1143. })
  1144. self.submitGK(1)
  1145. }
  1146. self.checkUserItem1 = function (item) {
  1147. item.checked = !item.checked;
  1148. $.each(item.USER, function (index, item1) {
  1149. item1.checked = item.checked;
  1150. })
  1151. var n = 0;
  1152. $.each(self.UserList[self.filed], function (index, item) {
  1153. if (item.checked == true) {
  1154. n++
  1155. }
  1156. })
  1157. if (n == self.UserList[self.filed].length) {
  1158. self.AllChecked[self.filed] = true;
  1159. } else {
  1160. self.AllChecked[self.filed] = false;
  1161. }
  1162. self.submitGK(1)
  1163. }
  1164. self.checkUser1 = function (item) {
  1165. item.checked = !item.checked;
  1166. var n = [], all = 0;
  1167. $.each(self.UserList[self.filed], function (x, y) {
  1168. n.push(0);
  1169. $.each(y.USER, function (x1, y1) {
  1170. if (y1.checked == true) {
  1171. n[x]++
  1172. }
  1173. })
  1174. if (n[x] == y.USER.length && n[x] != 0) {
  1175. y.checked = true;
  1176. all++
  1177. } else {
  1178. y.checked = false;
  1179. }
  1180. })
  1181. if (all == self.UserList[self.filed].length) {
  1182. self.AllChecked[self.filed] = true;
  1183. } else {
  1184. self.AllChecked[self.filed] = false;
  1185. }
  1186. self.submitGK(1)
  1187. }
  1188. self.submitGK = function (n) {
  1189. var AllCheckedLength = 0;
  1190. self.selectList[self.filed] = [];
  1191. $.each(self.UserList[self.filed], function (index, item) {
  1192. $.each(item.USER, function (index1, item1) {
  1193. if (item1.checked == true) {
  1194. AllCheckedLength++;
  1195. self.selectList[self.filed].push(item1)
  1196. }
  1197. })
  1198. })
  1199. self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
  1200. return item.USERID
  1201. }).join(",")
  1202. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  1203. if (n == 0) {
  1204. sp.layerhide();
  1205. var data = {
  1206. tablename: "SX_FBLIST",
  1207. data: {
  1208. WJLY: self.msgGK.WJLY,
  1209. FLOWID: self.msgGK.FLOWID,
  1210. FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
  1211. FBUSERID: self.msgGK.FBUSERID,
  1212. FBNAME: self.msgGK.FBNAME,
  1213. GKFW: self.msgGK.GKFW,
  1214. LM: self.msgGK.LM,
  1215. FBRQ: self.msgGK.FBRQ,
  1216. FBBM: self.msgGK.FBBM,
  1217. WJBT: self.msgGK.WJBT
  1218. }
  1219. }
  1220. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1221. .success(function (obj) {
  1222. var res = strToJson(s4.decryptData_CBC(obj.data));
  1223. sp.layerhide();
  1224. if (res.success) {
  1225. sp.dialog("操作成功!");
  1226. $timeout(function () {
  1227. sp.dialoghide();
  1228. }, 1000)
  1229. } else {
  1230. sp.dialog(res.message);
  1231. }
  1232. })
  1233. }
  1234. }
  1235. //头部下滚冻结
  1236. $(function () {
  1237. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1238. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  1239. //$("body").bind("scroll", function () {
  1240. // var scrollTop = $("body").scrollTop();
  1241. // if (scrollTop == 0) {
  1242. // $(".FixTop").removeClass("FixTop");
  1243. // }
  1244. // if (scrollTop > 35) {
  1245. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1246. // }
  1247. //});
  1248. //页面高度撑满
  1249. setTimeout(function () {
  1250. if ($(".ibox-content").height() < $(window).height() - 31) {
  1251. $(".ibox-content").css("height", $(window).height() - 31)
  1252. }
  1253. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1254. }, 1)
  1255. })
  1256. }])
  1257. app.filter('trustHtml', function ($sce) {
  1258. return function (input) {
  1259. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1260. };
  1261. });
  1262. //canvas画布签字
  1263. function lineCanvas(obj) {
  1264. var self = this;
  1265. self.linewidth = 1;
  1266. self.color = "#000000";
  1267. self.background = "#ffffff";
  1268. self.canvas = document.createElement("canvas");
  1269. document.getElementById(obj).appendChild(self.canvas);
  1270. self.cxt = self.canvas.getContext("2d");
  1271. self.canvas.width = document.getElementById(obj).clientWidth;
  1272. self.canvas.height = document.getElementById(obj).scrollHeight;
  1273. self.cxt.fillStyle = self.background;
  1274. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1275. self.cxt.strokeStyle = self.color;
  1276. self.cxt.lineWidth = self.linewidth;
  1277. self.cxt.lineCap = "round";
  1278. //开始绘制
  1279. self.canvas.addEventListener("mousedown", function (e) {
  1280. self.cxt.beginPath();
  1281. self.cxt.lineTo(e.pageX - (window.innerWidth - 1000) / 2 - 240, e.pageY - document.getElementById(obj).offsetTop - 27 + document.body.scrollTop);
  1282. self.canvas.addEventListener("mousemove", move)
  1283. }.bind(self), false);
  1284. //绘制中
  1285. function move() {
  1286. var e = window.event;
  1287. self.cxt.lineTo(e.pageX - (window.innerWidth - 1000) / 2 - 240, e.pageY - document.getElementById(obj).offsetTop - 27 + document.body.scrollTop);
  1288. self.cxt.stroke();
  1289. }
  1290. //结束绘制
  1291. self.canvas.addEventListener("mouseup", up)
  1292. function up() {
  1293. self.cxt.closePath();
  1294. self.canvas.removeEventListener("mousemove", move)
  1295. }
  1296. };
  1297. function showToggle(e) {
  1298. $(e).children().toggle()
  1299. $(e).next().toggle()
  1300. }
  1301. function toggleYJL(e) {
  1302. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1303. $("#topDiv").css("height", 160)
  1304. $(e).parent().css("height", 450)
  1305. $("#attachlist").css("height", 200)
  1306. $("#bottomDiv").css("height", "")
  1307. } else {
  1308. $("#topDiv").css("height", 600)
  1309. $(e).parent().css("height", 10)
  1310. }
  1311. $(e).children().toggle()
  1312. }