formedit.js 57 KB

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