formeditZW.js 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.routeid = sp.getUrlName("routeid");
  11. self.routeinfoid = sp.getUrlName("routeinfoid");
  12. self.copyrightid = sp.getUrlName("copyrightid");
  13. self.directionid = sp.getUrlName("directionid");
  14. self.formeditid = sp.getUrlName("formeditid");
  15. self.mbid = sp.getUrlName("mbid");
  16. self.fjid = sp.getUrlName("fjid");
  17. self.docmode = sp.getUrlName("docmode");
  18. self.dotype = sp.getUrlName("dotype");
  19. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  20. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  21. self.get_type = sp.getUrlName("type");
  22. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  23. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  24. var postCfg = {
  25. headers: {
  26. 'Content-Type': 'application/json',
  27. 'Authorization': "Bearer " + self.get_AccessToken
  28. }
  29. };
  30. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  31. //初始化右上角按钮
  32. self.buttonList = []
  33. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  34. return item.CNAME
  35. })
  36. self.upload_zw = function () {
  37. $('#fileupload-zw').fileupload({
  38. url: apiurljs.login + 'g2app/fawenfiles/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=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
  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_zw = true;
  58. data.submit();
  59. $scope.$apply();
  60. }
  61. },
  62. // 上传完成后的执行逻辑
  63. done: function (e, data) {
  64. self.uploading_zw = false;
  65. self.getGCG()
  66. }
  67. })
  68. $timeout(function () {
  69. $("#fileupload-zw").trigger("click")
  70. }, 1)
  71. }
  72. //上层附件、业务参考、共享沟通组件
  73. self.uploading = false;
  74. self.upload = function () {
  75. $('#fileupload').fileupload({
  76. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  77. dataType: 'json',
  78. beforeSend: function (xhr, data) {
  79. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  80. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=正式文(平、下行文)"));
  81. },
  82. add: function (e, data) {
  83. var num = 0;
  84. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  85. //文件类型判断
  86. $.each(data.originalFiles, function (index, item) {
  87. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  88. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  89. return;
  90. } else {
  91. num++
  92. }
  93. })
  94. if (num == data.originalFiles.length) {
  95. self.uploading = true;
  96. data.submit();
  97. $scope.$apply();
  98. }
  99. },
  100. // 上传完成后的执行逻辑
  101. done: function (e, data) {
  102. self.uploading = false;
  103. self.getOther()
  104. }
  105. })
  106. }
  107. self.downLoad = function (item) {
  108. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  109. }
  110. self.deleteFile = function (file) {
  111. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  112. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  113. 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>";
  114. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  115. sp.openCenter(".sp-dialog");
  116. ///取消按钮
  117. $('.sp-closeDialog').click(function (event) {
  118. sp.closeCenter(".sp-dialog");
  119. event.preventDefault();
  120. event.stopPropagation();
  121. });
  122. //post消息的id
  123. $("#delDataTrue").click(function () {
  124. var data = {
  125. tablename: "FILE_ATTACH",
  126. id: file.ID
  127. };
  128. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  129. .success(function (obj) {
  130. var res = strToJson(s4.decryptData_CBC(obj.data));
  131. sp.dialoghide();
  132. if (res.success) {
  133. self.getOther();
  134. } else {
  135. sp.dialog("删除失败,请联系管理员!");
  136. }
  137. });
  138. });
  139. }
  140. self.seeFile = function (obj) {
  141. self.seeFileItem = obj;
  142. var set_convertType = 0;
  143. if (obj.FILEEXT == "doc") {
  144. set_convertType = 0;
  145. } else if (obj.FILEEXT == "pdf") {
  146. set_convertType = 20;
  147. } else if (obj.FILEEXT == "ofd") {
  148. set_convertType = 570;
  149. } else {
  150. set_convertType = 0;
  151. }
  152. let postData = {
  153. convertType: set_convertType,
  154. isSignature: 1,
  155. fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
  156. };
  157. var postCfg_transfer = {
  158. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  159. transformRequest: function (data) {
  160. return $.param(data);
  161. }
  162. };
  163. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  164. .success(function (res) {
  165. if (res.errorcode === 0) {
  166. //$("#iframe_book").css("height", $(".ibox-content").height() - 130)
  167. $("#iframe_book").attr("src", res.data.viewUrl)
  168. } else {
  169. sp.dialog(res.message);
  170. }
  171. });
  172. }
  173. self.goAttach = function (obj) {
  174. if (obj) {
  175. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  176. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  177. return
  178. }
  179. $("#attachlist")[0].contentWindow.openFile(obj)
  180. if ($(".fa-chevron-down").is(":hidden") == true) {
  181. showToggle(document.getElementById("toggleButton"))
  182. }
  183. } else {
  184. $("#attachlist").attr("src", "attachlist.html?routeinfoid=" + self.routeinfoid)
  185. }
  186. }
  187. self.readonly = {
  188. JJCD: true,
  189. FWZH: true,
  190. WLDQFL: true,
  191. WLDSSL: true,
  192. XXGKSH: true,
  193. SFXYJD: true,
  194. ZDGKLM: true,
  195. ZDGKZT: true,
  196. FLSH: true,
  197. GPJZSC: true,
  198. BGSFHYJ: true,
  199. SX: true,
  200. BMFZRYJ: true,
  201. HBCSYJ: true,
  202. NGR: true,
  203. RGRQ: true,
  204. CDATE: true,
  205. GWZL: true,
  206. YF: true,
  207. ZT: true,
  208. ZS: true,
  209. CS: true,
  210. USAGE: false
  211. }
  212. self.show = {
  213. JJCD: true,
  214. FWZH: true,
  215. WLDQFL: true,
  216. WLDSSL: true,
  217. XXGKSH: true,
  218. SFXYJD: true,
  219. ZDGKLM: true,
  220. ZDGKZT: true,
  221. FLSH: true,
  222. GPJZSC: true,
  223. BGSFHYJ: true,
  224. SX: true,
  225. BMFZRYJ: true,
  226. HBCSYJ: true,
  227. NGR: true,
  228. RGRQ: true,
  229. CDATE: true,
  230. GWZL: true,
  231. YF: true,
  232. ZT: true,
  233. ZS: true,
  234. CS: true,
  235. USAGE: false
  236. }
  237. self.type = 1;
  238. self.getSwenList = function (n) {
  239. self.SwenList = [];
  240. var data = {
  241. directionid: self.directionid,
  242. userid: self.userId,
  243. routeinfoid: self.routeinfoid,
  244. routeid: self.routeid,
  245. formeditid: ""
  246. }
  247. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  248. .success(function (obj) {
  249. var res = strToJson(s4.decryptData_CBC(obj.data));
  250. if (self.copyrightid == "") {
  251. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  252. }
  253. $.each(res.data.LINKS, function (index, item) {
  254. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  255. if (item.TEMPFORM.indexOf("formeditZW.html") > -1) {
  256. self.Title = item.VNAME;
  257. }
  258. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  259. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  260. } else {
  261. item.TEMPFORM = "#";
  262. }
  263. self.SwenList.push(item)
  264. })
  265. self.SwenList.push({
  266. VNAME: "流程图",
  267. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  268. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  269. })
  270. if (n == 0) {
  271. self.getFLOW()
  272. } else {
  273. self.getData()
  274. }
  275. })
  276. }
  277. self.getSwenList(0)
  278. self.getFLOW = function () {
  279. var data = {
  280. copyrightid: self.copyrightid
  281. }
  282. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  283. .success(function (obj) {
  284. var res = strToJson(s4.decryptData_CBC(obj.data));
  285. self.flowTitle = res.data.CNAME;
  286. self.getJJCD()
  287. })
  288. }
  289. self.getJJCD = function () {
  290. var data = {
  291. ckey: "CODE_JJCD",
  292. routeinfoid: self.routeinfoid
  293. }
  294. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  295. .success(function (obj) {
  296. var res = strToJson(s4.decryptData_CBC(obj.data));
  297. self.JJCD = res.data.CODE_JJCD;
  298. self.getXXGKSH()
  299. })
  300. }
  301. self.getXXGKSH = function () {
  302. var data = {
  303. ckey: "CODE_XXGKSH",
  304. routeinfoid: self.routeinfoid
  305. }
  306. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  307. .success(function (obj) {
  308. var res = strToJson(s4.decryptData_CBC(obj.data));
  309. self.XXGKSH = res.data.CODE_XXGKSH;
  310. self.getGWZL()
  311. })
  312. }
  313. self.getGWZL = function () {
  314. var data = {
  315. tablename: "CODE_GWTYPE",
  316. colums: "ID,CODE,CNAME,FLOWID,DOCFILE,REDFILE",
  317. order: "ID desc",
  318. sqlwhere: {
  319. USEMARK: 1,
  320. FLOWID: sp.getUrlName("flowid")
  321. },
  322. sqlinwhere: "",
  323. sqllikewhere: ""
  324. }
  325. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  326. .success(function (obj) {
  327. var res = strToJson(s4.decryptData_CBC(obj.data));
  328. console.log(res.data)
  329. self.GWZL = res.data;
  330. self.getSFXYJD()
  331. })
  332. }
  333. self.getSFXYJD = function () {
  334. var data = {
  335. ckey: "CODE_SFXYJD",
  336. routeinfoid: self.routeinfoid
  337. }
  338. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  339. .success(function (obj) {
  340. var res = strToJson(s4.decryptData_CBC(obj.data));
  341. self.SFXYJD = res.data.CODE_SFXYJD;
  342. self.getZDGKLM()
  343. })
  344. }
  345. self.getZDGKLM = function () {
  346. var data = {
  347. ckey: "CODE_ZDGKLM",
  348. routeinfoid: self.routeinfoid
  349. }
  350. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  351. .success(function (obj) {
  352. var res = strToJson(s4.decryptData_CBC(obj.data));
  353. self.ZDGKLM = res.data.CODE_ZDGKLM;
  354. self.getZDGKZT()
  355. })
  356. }
  357. self.getZDGKZT = function () {
  358. var data = {
  359. ckey: "CODE_ZDGKZT",
  360. routeinfoid: self.routeinfoid
  361. }
  362. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  363. .success(function (obj) {
  364. var res = strToJson(s4.decryptData_CBC(obj.data));
  365. self.ZDGKZT = res.data.CODE_ZDGKZT;
  366. self.getBGSFHYJ()
  367. })
  368. }
  369. self.getBGSFHYJ = function () {
  370. var data = {
  371. ckey: "CODE_BGSFHYJ",
  372. routeinfoid: self.routeinfoid
  373. }
  374. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  375. .success(function (obj) {
  376. var res = strToJson(s4.decryptData_CBC(obj.data));
  377. self.BGSFHYJ = res.data.CODE_BGSFHYJ;
  378. self.getUSAGE(0)
  379. })
  380. }
  381. //标签
  382. self.getUSAGE = function (n) {
  383. var data = {
  384. ckey: "CODE_SHOUWENLABEL",
  385. routeinfoid: self.routeinfoid
  386. }
  387. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  388. .success(function (obj) {
  389. var res = strToJson(s4.decryptData_CBC(obj.data));
  390. self.USAGE = res.data.CODE_SHOUWENLABEL;
  391. $.each(self.USAGE, function (index, item) {
  392. item.checked = false;
  393. })
  394. if (n == 0) {
  395. self.getDP()
  396. }
  397. if (n == 1) {
  398. $.each(self.USAGE, function (index, item) {
  399. if (self.data.USAGE.indexOf(item.CODE) != -1) {
  400. item.checked = true;
  401. }
  402. })
  403. $timeout(function () {
  404. $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  405. if (self.data.USAGE.indexOf($(this).val()) != -1) {
  406. $(this).attr("checked", true);
  407. $(this).parent("label").addClass("chb-blue-checked");
  408. }
  409. })
  410. }, 1)
  411. }
  412. })
  413. }
  414. //管理标签
  415. self.ManageUSAGE = function (n) {
  416. self.addUSAGENAME = "";
  417. var data = {
  418. tablename: "CODE_SHOUWENLABEL"
  419. }
  420. $http.post(apiurljs.login + "g2app/shouwen/queryLabelCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  421. .success(function (obj) {
  422. var res = strToJson(s4.decryptData_CBC(obj.data));
  423. self.USAGELIST = res.data;
  424. $.each(self.USAGELIST, function (index, item) {
  425. item.change = false;
  426. item.CNAME1 = item.CNAME;
  427. item.USAGE = item.USAGE == 0 ? "隐藏" : "显示";
  428. })
  429. if (n == 0) {
  430. $timeout(function () {
  431. sp.layer("#USAGE");
  432. }, 1)
  433. }
  434. })
  435. }
  436. //新增标签
  437. self.addUSAGE = function () {
  438. if (self.addUSAGENAME == "") {
  439. sp.dialog("标签名称不可为空!");
  440. return;
  441. }
  442. var data = {
  443. tablename: "CODE_SHOUWENLABEL",
  444. data: {
  445. CODE: "C0" + (self.USAGELIST.length + 1),
  446. CNAME: self.addUSAGENAME,
  447. USERID: self.userId,
  448. TABLENAME: "FW_ZSWPXXW",
  449. USAGE: "1"
  450. }
  451. }
  452. $http.post(apiurljs.login + "g2app/shouwen/insertCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  453. .success(function (obj) {
  454. var res = strToJson(s4.decryptData_CBC(obj.data));
  455. if (res.success) {
  456. self.ManageUSAGE(1);
  457. self.getUSAGE(1);
  458. } else {
  459. sp.dialog(res.message);
  460. }
  461. })
  462. }
  463. //标签排序上下移
  464. self.btnSort = function ($index, tip) {
  465. var set_id = "";
  466. var set_sortid = "";
  467. if (tip == "上移") {
  468. var set_index = parseInt($index - 1);
  469. set_id = self.USAGELIST[set_index].ID;
  470. set_sortid = self.USAGELIST[set_index].SORTID;
  471. } else {
  472. var set_index = parseInt($index + 1);
  473. set_id = self.USAGELIST[set_index].ID;
  474. set_sortid = self.USAGELIST[set_index].SORTID;
  475. }
  476. var data = {
  477. tablename: "CODE_SHOUWENLABEL",
  478. id: self.USAGELIST[$index].ID,
  479. sortid: self.USAGELIST[$index].SORTID,
  480. id_other: set_id,
  481. sortid_other: set_sortid
  482. };
  483. $http.post(apiurljs.login + "g2app/shouwen/MoveCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  484. .success(function (obj) {
  485. var res = strToJson(s4.decryptData_CBC(obj.data));
  486. if (res.success) {
  487. self.ManageUSAGE(1);
  488. } else {
  489. sp.dialog(res.message);
  490. }
  491. });
  492. };
  493. //更新标签
  494. self.updataUSAGE = function (item, str) {
  495. if (str == "CNAME") {
  496. var data = {
  497. tablename: "FW_ZSWPXXW",
  498. code: item.CODE,
  499. }
  500. $http.post(apiurljs.login + "g2app/shouwen/querynumCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  501. .success(function (obj) {
  502. var res = strToJson(s4.decryptData_CBC(obj.data));
  503. if (res.success) {
  504. var data = {
  505. tablename: "CODE_SHOUWENLABEL",
  506. id: item.ID,
  507. data: {
  508. "cname": item.CNAME1
  509. }
  510. }
  511. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  512. .success(function (obj) {
  513. var res = strToJson(s4.decryptData_CBC(obj.data));
  514. if (res.success) {
  515. item.change = false;
  516. self.ManageUSAGE(1);
  517. self.getUSAGE(1);
  518. } else {
  519. sp.dialog(res.message);
  520. }
  521. });
  522. } else {
  523. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  524. var dialogBody = "<div class=\"sp-dialog-body\">该标签已被使用,您确认要修改吗?</div>";
  525. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='upDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  526. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  527. sp.openCenter(".sp-dialog");
  528. $('.sp-closeDialog').click(function (event) {
  529. sp.dialoghide();
  530. $timeout(function () {
  531. item.CNAME1 = item.CNAME;
  532. }, 1)
  533. //sp.closeCenter(".sp-dialog");
  534. event.preventDefault(); event.stopPropagation();
  535. });
  536. $("#upDataTrue").click(function () {
  537. var data = {
  538. tablename: "CODE_SHOUWENLABEL",
  539. id: item.ID,
  540. data: {
  541. "cname": item.CNAME1
  542. }
  543. }
  544. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  545. .success(function (obj) {
  546. var res = strToJson(s4.decryptData_CBC(obj.data));
  547. if (res.success) {
  548. sp.dialoghide();
  549. item.change = false;
  550. self.ManageUSAGE(1);
  551. self.getUSAGE(1);
  552. } else {
  553. sp.dialog(res.message);
  554. }
  555. });
  556. });
  557. }
  558. })
  559. } else if (str == "显示") {
  560. var data = {
  561. tablename: "CODE_SHOUWENLABEL",
  562. id: item.ID,
  563. data: {
  564. "USAGE": "1"
  565. }
  566. }
  567. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  568. .success(function (obj) {
  569. var res = strToJson(s4.decryptData_CBC(obj.data));
  570. if (res.success) {
  571. item.change = false;
  572. self.ManageUSAGE(1);
  573. self.getUSAGE(1);
  574. } else {
  575. sp.dialog(res.message);
  576. }
  577. });
  578. } else {
  579. var data = {
  580. tablename: "CODE_SHOUWENLABEL",
  581. id: item.ID,
  582. data: {
  583. "USAGE": "0"
  584. }
  585. }
  586. $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  587. .success(function (obj) {
  588. var res = strToJson(s4.decryptData_CBC(obj.data));
  589. if (res.success) {
  590. item.change = false;
  591. self.ManageUSAGE(1);
  592. self.getUSAGE(1);
  593. } else {
  594. sp.dialog(res.message);
  595. }
  596. });
  597. }
  598. }
  599. //删除标签
  600. self.deleteUSAGE = function (item) {
  601. var data = {
  602. tablename: "CODE_SHOUWENLABEL",
  603. tablename_form: "FW_ZSWPXXW",
  604. id: item.ID,
  605. code: item.CODE
  606. }
  607. $http.post(apiurljs.login + "g2app/shouwen/delCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  608. .success(function (obj) {
  609. var res = strToJson(s4.decryptData_CBC(obj.data));
  610. if (res.success) {
  611. self.ManageUSAGE(1);
  612. self.getUSAGE(1);
  613. } else {
  614. sp.dialog("此标签已被使用");
  615. }
  616. });
  617. }
  618. self.getDP = function () {
  619. var data = {
  620. userid: self.userId
  621. }
  622. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  623. .success(function (obj) {
  624. var res = strToJson(s4.decryptData_CBC(obj.data));
  625. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  626. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  627. self.getData();
  628. })
  629. }
  630. //获取数据
  631. self.getData = function () {
  632. var data = {
  633. ckey: "FW_ZSWPXXW",
  634. id: 0,
  635. directionid: self.directionid,
  636. formeditid: self.formeditid,
  637. routeid: self.routeid,
  638. routeinfoid: self.routeinfoid
  639. }
  640. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  641. .success(function (obj) {
  642. var res = strToJson(s4.decryptData_CBC(obj.data));
  643. self.data = {
  644. ID: res.data.FW_ZSWPXXW.ID,
  645. APPCODE: res.data.FW_ZSWPXXW.APPCODE,
  646. JJCD: res.data.FW_ZSWPXXW.JJCD == "" ? self.JJCD[0].CODE : res.data.FW_ZSWPXXW.JJCD,
  647. FWZH: res.data.FW_ZSWPXXW.FWZH,
  648. FWZH1: res.data.FW_ZSWPXXW.FWZH,
  649. WLDQFL: res.data.FW_ZSWPXXW.WLDQFL,
  650. WLDSSL: res.data.FW_ZSWPXXW.WLDSSL,
  651. XXGKSH: res.data.FW_ZSWPXXW.XXGKSH == "" ? self.XXGKSH[0].CODE : res.data.FW_ZSWPXXW.XXGKSH,
  652. SFXYJD: res.data.FW_ZSWPXXW.SFXYJD == "" ? self.SFXYJD[0].CODE : res.data.FW_ZSWPXXW.SFXYJD,
  653. ZDGKLM: res.data.FW_ZSWPXXW.ZDGKLM == "" ? self.ZDGKLM[0].CODE : res.data.FW_ZSWPXXW.ZDGKLM,
  654. ZDGKZT: res.data.FW_ZSWPXXW.ZDGKZT == "" ? self.ZDGKZT[0].CODE : res.data.FW_ZSWPXXW.ZDGKZT,
  655. FLSH: res.data.FW_ZSWPXXW.FLSH,
  656. GPJZSC: res.data.FW_ZSWPXXW.GPJZSC,
  657. BGSFHYJ: res.data.FW_ZSWPXXW.BGSFHYJ == "" ? self.BGSFHYJ[0].CODE : res.data.FW_ZSWPXXW.BGSFHYJ,
  658. SX: res.data.FW_ZSWPXXW.SX,
  659. BMFZRYJ: res.data.FW_ZSWPXXW.BMFZRYJ,
  660. HBCSYJ: res.data.FW_ZSWPXXW.HBCSYJ,
  661. NGR: res.data.FW_ZSWPXXW.NGR == "" ? self.userName : res.data.FW_ZSWPXXW.NGR,
  662. RGRQ: res.data.FW_ZSWPXXW.RGRQ == "" || res.data.FW_ZSWPXXW.NGRQ ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_ZSWPXXW.RGRQ),
  663. CDATE: res.data.FW_ZSWPXXW.CDATE == "" || res.data.FW_ZSWPXXW.CDATE ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_ZSWPXXW.CDATE),
  664. GWZL: res.data.FW_ZSWPXXW.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_ZSWPXXW.GWZL,
  665. YF: res.data.FW_ZSWPXXW.YF,
  666. ZT: res.data.FW_ZSWPXXW.ZT,
  667. ZS: res.data.FW_ZSWPXXW.ZS,
  668. CS: res.data.FW_ZSWPXXW.CS,
  669. NGRUSERID: res.data.FW_ZSWPXXW.NGRUSERID == "" ? self.userId : res.data.FW_ZSWPXXW.NGRUSERID,
  670. NGRBM: res.data.FW_ZSWPXXW.NGRBM == "" ? self.userDpName : res.data.FW_ZSWPXXW.NGRBM,
  671. NGRBMID: res.data.FW_ZSWPXXW.NGRBMID == "" ? self.userDpCode : res.data.FW_ZSWPXXW.NGRBMID,
  672. USAGE: res.data.FW_ZSWPXXW.USAGE ? res.data.FW_ZSWPXXW.USAGE : ""
  673. }
  674. self.readonly = {
  675. JJCD: res.data.FW_ZSWPXXW["JJCD.EREADONLY"] == "true",
  676. FWZH: res.data.FW_ZSWPXXW["FWZH.EREADONLY"] == "true",
  677. WLDQFL: res.data.FW_ZSWPXXW["WLDQFL.EREADONLY"] == "true",
  678. WLDSSL: res.data.FW_ZSWPXXW["WLDSSL.EREADONLY"] == "true",
  679. XXGKSH: res.data.FW_ZSWPXXW["XXGKSH.EREADONLY"] == "true",
  680. SFXYJD: res.data.FW_ZSWPXXW["SFXYJD.EREADONLY"] == "true",
  681. ZDGKLM: res.data.FW_ZSWPXXW["ZDGKLM.EREADONLY"] == "true",
  682. ZDGKZT: res.data.FW_ZSWPXXW["ZDGKZT.EREADONLY"] == "true",
  683. FLSH: res.data.FW_ZSWPXXW["FLSH.EREADONLY"] == "true",
  684. GPJZSC: res.data.FW_ZSWPXXW["GPJZSC.EREADONLY"] == "true",
  685. BGSFHYJ: res.data.FW_ZSWPXXW["BGSFHYJ.EREADONLY"] == "true",
  686. SX: res.data.FW_ZSWPXXW["SX.EREADONLY"] == "true",
  687. BMFZRYJ: res.data.FW_ZSWPXXW["BMFZRYJ.EREADONLY"] == "true",
  688. HBCSYJ: res.data.FW_ZSWPXXW["HBCSYJ.EREADONLY"] == "true",
  689. NGR: res.data.FW_ZSWPXXW["NGR.EREADONLY"] == "true",
  690. RGRQ: res.data.FW_ZSWPXXW["RGRQ.EREADONLY"] == "true",
  691. CDATE: res.data.FW_ZSWPXXW["CDATE.EREADONLY"] == "true",
  692. GWZL: res.data.FW_ZSWPXXW["GWZL.EREADONLY"] == "true",
  693. YF: res.data.FW_ZSWPXXW["YF.EREADONLY"] == "true",
  694. ZT: res.data.FW_ZSWPXXW["ZT.EREADONLY"] == "true",
  695. ZS: res.data.FW_ZSWPXXW["ZS.EREADONLY"] == "true",
  696. CS: res.data.FW_ZSWPXXW["CS.EREADONLY"] == "true",
  697. USAGE: res.data.FW_ZSWPXXW["USAGE.EREADONLY"] == "true"
  698. }
  699. self.show = {
  700. JJCD: res.data.FW_ZSWPXXW["JJCD.ESHOW"] == "true",
  701. FWZH: res.data.FW_ZSWPXXW["FWZH.ESHOW"] == "true",
  702. WLDQFL: res.data.FW_ZSWPXXW["WLDQFL.ESHOW"] == "true",
  703. WLDSSL: res.data.FW_ZSWPXXW["WLDSSL.ESHOW"] == "true",
  704. XXGKSH: res.data.FW_ZSWPXXW["XXGKSH.ESHOW"] == "true",
  705. SFXYJD: res.data.FW_ZSWPXXW["SFXYJD.ESHOW"] == "true",
  706. ZDGKLM: res.data.FW_ZSWPXXW["ZDGKLM.ESHOW"] == "true",
  707. ZDGKZT: res.data.FW_ZSWPXXW["ZDGKZT.ESHOW"] == "true",
  708. FLSH: res.data.FW_ZSWPXXW["FLSH.ESHOW"] == "true",
  709. GPJZSC: res.data.FW_ZSWPXXW["GPJZSC.ESHOW"] == "true",
  710. BGSFHYJ: res.data.FW_ZSWPXXW["BGSFHYJ.ESHOW"] == "true",
  711. SX: res.data.FW_ZSWPXXW["SX.ESHOW"] == "true",
  712. BMFZRYJ: res.data.FW_ZSWPXXW["BMFZRYJ.ESHOW"] == "true",
  713. HBCSYJ: res.data.FW_ZSWPXXW["HBCSYJ.ESHOW"] == "true",
  714. NGR: res.data.FW_ZSWPXXW["NGR.ESHOW"] == "true",
  715. RGRQ: res.data.FW_ZSWPXXW["RGRQ.ESHOW"] == "true",
  716. CDATE: res.data.FW_ZSWPXXW["CDATE.ESHOW"] == "true",
  717. GWZL: res.data.FW_ZSWPXXW["GWZL.ESHOW"] == "true",
  718. YF: res.data.FW_ZSWPXXW["YF.ESHOW"] == "true",
  719. ZT: res.data.FW_ZSWPXXW["ZT.ESHOW"] == "true",
  720. ZS: res.data.FW_ZSWPXXW["ZS.ESHOW"] == "true",
  721. CS: res.data.FW_ZSWPXXW["CS.ESHOW"] == "true",
  722. USAGE: res.data.FW_ZSWPXXW["USAGE.ESHOW"] == "true"
  723. }
  724. self.selectUSAGEs = self.data.USAGE != "" && self.data.USAGE != null ? self.data.USAGE.split(",") : [];
  725. $.each(self.USAGE, function (index, item) {
  726. if (self.data.USAGE.indexOf(item.CODE) != -1) {
  727. item.checked = true;
  728. }
  729. })
  730. $timeout(function () {
  731. $(".sp-checkbox-blue input[name=USAGE]").each(function () {
  732. if (self.data.USAGE.indexOf($(this).val()) != -1) {
  733. $(this).attr("checked", true);
  734. $(this).parent("label").addClass("chb-blue-checked");
  735. }
  736. })
  737. }, 0)
  738. if (self.data.ID == 0) {
  739. self.filedChange = true;
  740. } else {
  741. self.filedChange = false;
  742. }
  743. self.buttonList = res.data["FW_ZSWPXXW.FUNCLIST"];
  744. self.getOpinion1()
  745. self.getOther()
  746. self.getGCG()
  747. self.getFWZH()
  748. self.opinionList = [{
  749. name: "委领导签发栏",
  750. col: "WLDQFL",
  751. show: !self.hide("show", "WLDQFL") && !self.hide("readonly", "WLDQFL")
  752. }, {
  753. name: "委领导审示栏",
  754. col: "WLDSSL",
  755. show: !self.hide("show", "WLDSSL") && !self.hide("readonly", "WLDSSL")
  756. }, {
  757. name: "法律审核",
  758. col: "FLSH",
  759. show: !self.hide("show", "FLSH") && !self.hide("readonly", "FLSH")
  760. }, {
  761. name: "公平竞争审查",
  762. col: "GPJZSC",
  763. show: !self.hide("show", "GPJZSC") && !self.hide("readonly", "GPJZSC")
  764. }, {
  765. name: "审修",
  766. col: "SX",
  767. show: !self.hide("show", "SX") && !self.hide("readonly", "SX")
  768. }, {
  769. name: "部门负责人意见",
  770. col: "BMFZRYJ",
  771. show: !self.hide("show", "BMFZRYJ") && !self.hide("readonly", "BMFZRYJ")
  772. }, {
  773. name: "会办处室意见",
  774. col: "HBCSYJ",
  775. show: !self.hide("show", "HBCSYJ") && !self.hide("readonly", "HBCSYJ")
  776. }]
  777. self.opinionList1 = [];
  778. self.opinionList.forEach(function (item) {
  779. if (item.show == true) {
  780. self.opinionList1.push(item)
  781. }
  782. })
  783. if (self.opinionList1.length > 0) {
  784. self.opiniontype = self.opinionList1[0].col;
  785. }
  786. })
  787. }
  788. self.getFWZH = function () {
  789. var data = {
  790. flowid: sp.getUrlName("flowid"),
  791. code: "",
  792. cyear: sp.currentYear(),
  793. routeinfoidmark: self.routeinfoid,
  794. zihao: self.data.FWZH
  795. }
  796. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  797. .success(function (obj) {
  798. var res = strToJson(s4.decryptData_CBC(obj.data));
  799. self.FWZH = res.data.map(function (item) {
  800. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  801. });
  802. if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE }
  803. })
  804. }
  805. //转换
  806. self.Loaling = false;
  807. self.pdfContent = [];
  808. self.getContent = function () {
  809. if (self.Loaling == true) {
  810. return;
  811. }
  812. self.Loaling = true;
  813. self.pdfContent = [];
  814. var data = {
  815. fileurl: self.seeFileItem.FILEURL
  816. }
  817. $http.post(apiurljs.login + "g2app/dataabase/queryPDFContent", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  818. .success(function (obj) {
  819. var res = strToJson(s4.decryptData_CBC(obj.data));
  820. self.Loaling = false;
  821. for (var i in res.data) {
  822. self.pdfContent.push({ id: parseInt(i.slice(i.indexOf("_") + 1)), content: res.data[i] })
  823. }
  824. self.pdfContent.sort(function (a, b) {
  825. return a.id - b.id;
  826. })
  827. })
  828. }
  829. //获取意见(不上表)
  830. self.getOpinion1 = function () {
  831. var data = {
  832. cmanid: self.userId,
  833. routeinfoid: self.routeinfoid,
  834. routeid: "",//self.routeid,
  835. tableid: "FW_ZSWPXXW",
  836. colid: "",
  837. opiniontype: "",//self.opiniontype,
  838. orderbycol: "CDATE desc"
  839. }
  840. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  841. .success(function (obj) {
  842. var res = strToJson(s4.decryptData_CBC(obj.data));
  843. if (res.success == true) {
  844. self.YJ.nulla = res.data;
  845. self.YJ.nullaSTATUS = false;
  846. self.YJ.nulla.forEach(function (item) {
  847. item.CDATE = sp.datefmt("yyyy-MM-dd HH:mm", item.CDATE);
  848. if (self.activeOpinion != null) {
  849. self.activeOpinion.FILEDATA = item.FILEDATA
  850. }
  851. })
  852. } else {
  853. sp.dialog(res.message)
  854. }
  855. })
  856. }
  857. //获取附件和插件
  858. self.getOther = function () {
  859. var data = {
  860. tablename: "FILE_ATTACH",
  861. colums: "*",
  862. order: "ID desc",
  863. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  864. sqlinwhere: "",
  865. sqllikewhere: ""
  866. }
  867. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  868. .success(function (obj) {
  869. var res = strToJson(s4.decryptData_CBC(obj.data));
  870. self.arrayFile1 = [];
  871. if (res.data.length > 0) {
  872. res.data.forEach(function (item) {
  873. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  874. self.arrayFile = item;
  875. } else {
  876. self.arrayFile1.push(item)
  877. }
  878. })
  879. self.goAttach()
  880. }
  881. })
  882. }
  883. //发文打开过程稿在线编辑
  884. self.getGCG = function () {
  885. var data = {
  886. dockind: "D01",
  887. routeinfoid: self.routeinfoid
  888. }
  889. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  890. .success(function (obj) {
  891. var res = strToJson(s4.decryptData_CBC(obj.data));
  892. self.gaoTypeArrayFirst = res.data;
  893. if (self.gaoTypeArrayFirst.length > 1) {
  894. var data = {
  895. id: self.gaoTypeArrayFirst[0].ID
  896. }
  897. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  898. .success(function (obj) {
  899. var res = strToJson(s4.decryptData_CBC(obj.data));
  900. if (res.success) {
  901. self.getGCG()
  902. }
  903. });
  904. } else if (self.gaoTypeArrayFirst.length > 0) {
  905. if (self.gaoTypeArrayFirst[0].FILENAMES.split(".").length == 1) {
  906. self.gaoTypeArrayFirst[0].FILENAMES = self.gaoTypeArrayFirst[0].FILENAMES + "." + self.gaoTypeArrayFirst[0].FILEEXT
  907. }
  908. if (self.gaoTypeArrayFirst[0].FILEURL.indexOf("files") > -1) {
  909. var set_filepath = apiurljs.login + "g2work/files/" + self.gaoTypeArrayFirst[0].FILEURL.slice(7);
  910. } else {
  911. var set_filepath = apiurljs.login.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL;
  912. }
  913. self.getFileWo(self.gaoTypeArrayFirst[0].ID, self.gaoTypeArrayFirst[0].FILENAMES, set_filepath);
  914. }
  915. console.log(self.gaoTypeArrayFirst)
  916. })
  917. }
  918. //生成正文三种方式:空白模板,红头模板,上传本地文件
  919. self.newMoBan1 = function () {
  920. if (self.gaoTypeArrayFirst.length > 0) {
  921. var data = {
  922. id: self.gaoTypeArrayFirst[0].ID
  923. }
  924. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  925. .success(function (obj) {
  926. var res = strToJson(s4.decryptData_CBC(obj.data));
  927. if (res.success) {
  928. var data = {
  929. dockind: "D01",
  930. routeinfoid: self.routeinfoid,
  931. gwtype: self.data.GWZL,
  932. filekind: "DOCFILE"
  933. }
  934. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  935. .success(function (obj) {
  936. var res = strToJson(s4.decryptData_CBC(obj.data));
  937. if (res.success) {
  938. self.getGCG()
  939. } else {
  940. sp.dialog("创建失败,请联系管理员!");
  941. }
  942. });
  943. } else {
  944. sp.dialog("创建失败,请联系管理员!");
  945. }
  946. });
  947. } else {
  948. var data = {
  949. dockind: "D01",
  950. routeinfoid: self.routeinfoid,
  951. gwtype: self.data.GWZL,
  952. filekind: "DOCFILE"
  953. }
  954. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  955. .success(function (obj) {
  956. var res = strToJson(s4.decryptData_CBC(obj.data));
  957. if (res.success) {
  958. self.getGCG()
  959. } else {
  960. sp.dialog("创建失败,请联系管理员!");
  961. }
  962. });
  963. }
  964. }
  965. self.newMoBan2 = function () {
  966. if (self.gaoTypeArrayFirst.length > 0) {
  967. var data = {
  968. id: self.gaoTypeArrayFirst[0].ID
  969. }
  970. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  971. .success(function (obj) {
  972. var res = strToJson(s4.decryptData_CBC(obj.data));
  973. if (res.success) {
  974. var data = {
  975. dockind: "D01",
  976. routeinfoid: self.routeinfoid,
  977. gwtype: self.data.GWZL,
  978. filekind: "REDFILE"
  979. }
  980. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  981. .success(function (obj) {
  982. var res = strToJson(s4.decryptData_CBC(obj.data));
  983. if (res.success) {
  984. self.getGCG()
  985. } else {
  986. sp.dialog("创建失败,请联系管理员!");
  987. }
  988. });
  989. } else {
  990. sp.dialog("创建失败,请联系管理员!");
  991. }
  992. });
  993. } else {
  994. var data = {
  995. dockind: "D01",
  996. routeinfoid: self.routeinfoid,
  997. gwtype: self.data.GWZL,
  998. filekind: "REDFILE"
  999. }
  1000. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1001. .success(function (obj) {
  1002. var res = strToJson(s4.decryptData_CBC(obj.data));
  1003. if (res.success) {
  1004. self.getGCG()
  1005. } else {
  1006. sp.dialog("创建失败,请联系管理员!");
  1007. }
  1008. });
  1009. }
  1010. }
  1011. //套红
  1012. self.toRed = function () {
  1013. var redfile = "";
  1014. self.GWZL.forEach(function (item) {
  1015. if (item.CODE == self.data.GWZL) {
  1016. redfile = item.REDFILE
  1017. }
  1018. })
  1019. var data = {
  1020. method: 30000,
  1021. params: {
  1022. userId: self.userName,
  1023. fileId: self.gaoTypeArrayFirst[0].ID,
  1024. bookmarkName: "hongtou",
  1025. templatePath: "/opt/TongWeb7.0/applications/glworkweb/templates/redfile/" + redfile
  1026. }
  1027. }
  1028. $.ajax({
  1029. url: apiurljs.yzFileWo + "api.do",
  1030. data: {
  1031. jsonParams: encodeURIComponent(JSON.stringify(data))
  1032. },
  1033. type: "POST",
  1034. dataType: "json",
  1035. general: false,
  1036. async: false,
  1037. success: function (data) {
  1038. console.log(data);
  1039. },
  1040. });
  1041. }
  1042. self.browse = function () {
  1043. let postData = {
  1044. convertType: 0,
  1045. bookMark: "",//"hongtou,测试33333",//模板插入
  1046. fileUrl: apiurljs.login.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL
  1047. };
  1048. var postCfg_transfer = {
  1049. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  1050. transformRequest: function (data) {
  1051. return $.param(data);
  1052. }
  1053. };
  1054. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  1055. .success(function (res) {
  1056. console.log(res)
  1057. window.open(res.data.viewUrl)
  1058. })
  1059. }
  1060. self.getFileWo = function (fileid, filename, filepath) {
  1061. var data = {
  1062. method: 1,
  1063. params: {
  1064. userId: self.userName,
  1065. fileId: fileid,
  1066. fileName: filename,
  1067. filePath: filepath,
  1068. userRight: self.dotype == 1 ? 0 : 1,// 用户权限 编辑:UserRightEdit = 0; 只读:UserRightReadonly = 1; 临时只读:UserRightTempReadonly = 2;此时页面上编辑—临时只读按钮,打开只能临时只读,不打开可以进行编辑
  1069. //saveFlag: true, /// true:自动保存文档 false:不自动保存文档 (默认为true)
  1070. callbackUrl: apiurljs.login + "g2app/fawenfiles/uploadFile"
  1071. }
  1072. };
  1073. console.log(JSON.stringify(data))
  1074. $.ajax({
  1075. url: apiurljs.yzFileWo + "api.do",
  1076. data: {
  1077. jsonParams: encodeURIComponent(JSON.stringify(data))
  1078. },
  1079. type: "POST",
  1080. dataType: "json",
  1081. general: false,
  1082. async: false,
  1083. success: function (data) {
  1084. console.log(data);
  1085. if (data) {
  1086. if (data.errorCode === "0") {
  1087. let rst = data.result;
  1088. console.log(rst.urls);
  1089. if (rst && rst.urls) {
  1090. var get_urls = rst.urls;
  1091. console.log(get_urls);
  1092. if (typeof (get_urls) === "string") {
  1093. $timeout(function () {
  1094. //$("#iframe_book").css("height", $(".ibox-content").height() - 123)
  1095. $("#iframe_book").attr("src", get_urls)
  1096. })
  1097. } else {
  1098. console.warn("无效的urls:" + get_urls);
  1099. }
  1100. } else {
  1101. console.warn("ajax响应内容data.result有问题:" + rst);
  1102. }
  1103. } else {
  1104. alert(data.errorMessage);
  1105. }
  1106. } else {
  1107. console.warn("ajax响应内容为空!");
  1108. }
  1109. },
  1110. });
  1111. }
  1112. //永中保存
  1113. self.btnSaveYZ = function () {
  1114. ////调用永中保存函数--zyg--**********************************--2023
  1115. var data = {
  1116. method: 2,
  1117. params: {
  1118. fileId: self.gaoTypeArrayFirst[0].ID
  1119. }
  1120. };
  1121. $.ajax({
  1122. url: apiurljs.yzFileWo + "api.do",
  1123. data: {
  1124. jsonParams: encodeURIComponent(JSON.stringify(data))
  1125. },
  1126. type: "POST",
  1127. dataType: "json",
  1128. general: false,
  1129. async: false,
  1130. success: function (data) {
  1131. if (data && data.errorCode === "0") {
  1132. sp.dialog("保存成功");
  1133. }
  1134. },
  1135. });
  1136. }
  1137. //判断页面字段是否只读readonly、是否隐藏show
  1138. self.hide = function (type, field) {
  1139. if (self.dotype == 0 && type == "readonly") {
  1140. return true;
  1141. } else {
  1142. if (self[type][field] == true) {
  1143. return true;
  1144. } else {
  1145. return false;
  1146. }
  1147. }
  1148. }
  1149. //右上角按钮调用方法
  1150. self.btnEvent = function (item) {
  1151. if (item.CODE == "NEWFLOWQB") {
  1152. var data = {
  1153. flowid: "AA65",
  1154. userid: self.userId,
  1155. routeinfoid: self.routeinfoid,
  1156. directionid: self.directionid,
  1157. copyrightid: self.copyrightid
  1158. }
  1159. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1160. .success(function (obj) {
  1161. var res = strToJson(s4.decryptData_CBC(obj.data));
  1162. console.log(res)
  1163. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/qianbaomgr/" + res.data.FILEN + "&dotype=1&flowid=AA65")
  1164. $timeout(function () {
  1165. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  1166. }, 1000)
  1167. })
  1168. return
  1169. } else if (item.CODE == "NEWFLOWDW") {
  1170. var data = {
  1171. flowid: "AA95",
  1172. userid: self.userId,
  1173. routeinfoid: self.routeinfoid,
  1174. directionid: self.directionid,
  1175. copyrightid: self.copyrightid
  1176. }
  1177. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1178. .success(function (obj) {
  1179. var res = strToJson(s4.decryptData_CBC(obj.data));
  1180. console.log(res)
  1181. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/DWHYTCB/" + res.data.FILEN + "&dotype=1&flowid=AA95")
  1182. $timeout(function () {
  1183. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  1184. }, 1000)
  1185. })
  1186. return
  1187. } else if (item.CODE == "NEWFLOWXZ") {
  1188. var data = {
  1189. flowid: "AA10",
  1190. userid: self.userId,
  1191. routeinfoid: self.routeinfoid,
  1192. directionid: self.directionid,
  1193. copyrightid: self.copyrightid
  1194. }
  1195. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1196. .success(function (obj) {
  1197. var res = strToJson(s4.decryptData_CBC(obj.data));
  1198. console.log(res)
  1199. window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/fawenbg/" + res.data.FILEN + "&dotype=1&flowid=AA10")
  1200. $timeout(function () {
  1201. window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
  1202. }, 1000)
  1203. })
  1204. return
  1205. }
  1206. switch (item.CODE) {
  1207. case "SAVEITEM": self.btnSave(0); break;
  1208. case "PRINTITEM": self.btnPrint(); break;
  1209. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  1210. case "MEETITEM": self.Meet(); break;
  1211. case "SENDLOG": self.RouteList(); break;
  1212. default: self.forward(item); break;
  1213. }
  1214. }
  1215. //保存提交
  1216. self.btnSave = function (n) {
  1217. if (spngvld.submit(".formedit")) {
  1218. if (self.data.FWZH1 == "") {
  1219. var data = {
  1220. tablename: "FW_NUMBER",
  1221. data: {
  1222. CYEAR: sp.currentYear(),
  1223. FLOWID: sp.getUrlName("flowid"),
  1224. ZIHAO: self.FWZH
  1225. }
  1226. }
  1227. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1228. .success(function (obj) { })
  1229. }
  1230. var dataArray = [];
  1231. dataArray.push(self.data);
  1232. var data = {
  1233. ckey: "FW_ZSWPXXW",
  1234. id: self.data.ID,
  1235. routeid: self.routeid,
  1236. routeinfoid: self.routeinfoid,
  1237. routeinfotitle: self.data.ZT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.`,
  1238. directionid: self.directionid,
  1239. formeditid: self.formeditid,
  1240. data: JSON.stringify(dataArray)
  1241. }
  1242. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1243. .success(function (obj) {
  1244. var res = strToJson(s4.decryptData_CBC(obj.data));
  1245. if (res.code == 0) {
  1246. self.data.ID = res.data.ID;
  1247. self.routeid = res.data.ROUTEID;
  1248. self.routeinfoid = res.data.ROUTEINFOID;
  1249. self.filedChange = false;
  1250. if (self.gaoTypeArrayFirst.length == 0) {
  1251. var data = {
  1252. dockind: "D01",
  1253. routeinfoid: self.routeinfoid,
  1254. gwtype: self.data.GWZL,
  1255. filekind: "DOCFILE"
  1256. }
  1257. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1258. .success(function (obj) {
  1259. var res = strToJson(s4.decryptData_CBC(obj.data));
  1260. if (res.success) {
  1261. if (n == 0) {
  1262. sp.dialog("保存成功!");
  1263. $timeout(function () {
  1264. sp.dialoghide()
  1265. }, 1500)
  1266. self.getSwenList(1)
  1267. } else if (n == 1) {
  1268. self.forward(self.btnItem);
  1269. } else if (n == 2) {
  1270. self.sendAll();
  1271. } else if (n == 3) {
  1272. self.btnPrint();
  1273. }
  1274. } else {
  1275. sp.dialog("文稿创建失败,请联系管理员!");
  1276. }
  1277. });
  1278. } else {
  1279. var YZdata = {
  1280. method: 2,
  1281. params: {
  1282. fileId: self.gaoTypeArrayFirst[0].ID
  1283. }
  1284. };
  1285. $.ajax({
  1286. url: apiurljs.yzFileWo + "api.do",
  1287. data: {
  1288. jsonParams: encodeURIComponent(JSON.stringify(YZdata))
  1289. },
  1290. type: "POST",
  1291. dataType: "json",
  1292. general: false,
  1293. async: false,
  1294. success: function (resp) {
  1295. if (n == 0) {
  1296. sp.dialog("保存成功!");
  1297. $timeout(function () {
  1298. sp.dialoghide()
  1299. }, 1500)
  1300. self.getSwenList(1)
  1301. } else if (n == 1) {
  1302. self.forward(self.btnItem);
  1303. } else if (n == 2) {
  1304. self.sendAll();
  1305. } else if (n == 3) {
  1306. self.btnPrint();
  1307. }
  1308. }
  1309. });
  1310. }
  1311. } else {
  1312. sp.dialog(res.message)
  1313. }
  1314. })
  1315. }
  1316. }
  1317. /*综合打印*/
  1318. self.printFiled = 1;
  1319. self.btnPrint1 = function () {
  1320. if (self.filedChange == true) {
  1321. self.btnSave(3)
  1322. } else {
  1323. sp.layer("#print")
  1324. }
  1325. }
  1326. self.printSubmit = function () {
  1327. if (self.printFiled == 1) {
  1328. var templatefilename = "moban1"
  1329. } else if (self.printFiled == 2) {
  1330. var templatefilename = "mobanoption"
  1331. } else {
  1332. var templatefilename = "moban1_all"
  1333. }
  1334. var data = {
  1335. templatefilename: templatefilename + ".ftl",
  1336. outfilepath: "/tmp/正式文(平、下行文)" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  1337. routeinfoid: self.routeinfoid,
  1338. tablename: "FW_ZSWPXXW",
  1339. printtype: self.printFiled,
  1340. printdate: "RGRQ"
  1341. }
  1342. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  1343. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1344. .success(function (obj) {
  1345. var res = strToJson(s4.decryptData_CBC(obj.data));
  1346. //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
  1347. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  1348. })
  1349. sp.layerhide()
  1350. }
  1351. //签写意见编辑状态
  1352. self.opinion = {
  1353. WLDQFL: false,
  1354. WLDQFLImg: false,
  1355. WLDSSL: false,
  1356. WLDSSLImg: false,
  1357. FLSH: false,
  1358. FLSHImg: false,
  1359. SX: false,
  1360. SXImg: false,
  1361. GPJZSC: false,
  1362. GPJZSCImg: false,
  1363. BMFZRYJ: false,
  1364. BMFZRYJImg: false,
  1365. HBCSYJ: false,
  1366. HBCSYJImg: false,
  1367. nulla: false
  1368. }
  1369. self.YJ = {
  1370. WLDQFL: [],
  1371. WLDQFLSTATUS: false,
  1372. WLDSSL: [],
  1373. WLDSSLSTATUS: false,
  1374. FLSH: [],
  1375. FLSHSTATUS: false,
  1376. SX: [],
  1377. SXSTATUS: false,
  1378. GPJZSC: [],
  1379. GPJZSCSTATUS: false,
  1380. BMFZRYJ: [],
  1381. BMFZRYJSTATUS: false,
  1382. HBCSYJ: [],
  1383. HBCSYJSTATUS: false,
  1384. nulla: [],
  1385. nullaSTATUS: false
  1386. }
  1387. //意见(下表)
  1388. self.openOptionList = function () {
  1389. if (self.routeinfoid == 0 && self.routeid == 0) {
  1390. sp.dialog("请先保存!")
  1391. return;
  1392. }
  1393. if (self.dotype == 0) {
  1394. return
  1395. }
  1396. if (self.opinion.nulla == true) {
  1397. return;
  1398. }
  1399. self.nulla = "";
  1400. self.opinion.nulla = true;
  1401. }
  1402. self.openOptionList1 = function () {
  1403. self.openOptionList()
  1404. self.activeOpinion = null;
  1405. self.showBottom = "opinion";
  1406. self.YJ.nulla.forEach(function (item) {
  1407. if (item.ROUTEID == self.routeid) {
  1408. self.activeOpinion = item;
  1409. self.nulla = item.OPINION;
  1410. }
  1411. })
  1412. $(".toggle").trigger("click")
  1413. }
  1414. self.closeOptionList = function () {
  1415. self.opinion.nulla = false;
  1416. self.activeOpinion = null;
  1417. $(".toggle").trigger("click")
  1418. }
  1419. self.submitOptionList = function () {
  1420. var data = {
  1421. cmanid: self.userId,
  1422. routeinfoid: self.routeinfoid,
  1423. routeid: self.routeid,
  1424. tableid: "FW_ZSWPXXW",
  1425. colid: self.opiniontype,
  1426. opiniontype: self.opiniontype == "nulla" ? 99 : 0,
  1427. cresult: "",
  1428. opinion: self.nulla,
  1429. opinionimage: ""
  1430. }
  1431. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1432. .success(function (obj) {
  1433. var res = strToJson(s4.decryptData_CBC(obj.data));
  1434. if (res.success == true) {
  1435. self.getOpinion1();
  1436. self.opinion.nulla = false;
  1437. $(".toggle").trigger("click")
  1438. } else {
  1439. sp.dialog(res.message)
  1440. }
  1441. })
  1442. }
  1443. self.changeOptionList = function (item) {
  1444. self.nulla = item.OPINION;
  1445. self.opinion.nulla = true;
  1446. }
  1447. //意见附件(下表)
  1448. self.uploading1 = false;
  1449. self.upload1 = function () {
  1450. $('#fileupload1').fileupload({
  1451. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1452. dataType: 'json',
  1453. beforeSend: function (xhr, data) {
  1454. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1455. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1456. + ",routeid=" + self.routeid + ",tableid=FW_ZSWPXXW,colid=" + self.opiniontype));
  1457. },
  1458. // 上传完成后的执行逻辑
  1459. done: function (e, data) {
  1460. self.uploading1 = false;
  1461. self.getOpinion1()
  1462. }
  1463. })
  1464. }
  1465. //意见附件(下表)
  1466. self.uploading2 = false;
  1467. self.upload2 = function (str) {
  1468. $('#fileupload2').fileupload({
  1469. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1470. dataType: 'json',
  1471. beforeSend: function (xhr, data) {
  1472. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1473. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1474. + ",routeid=" + self.routeid + ",tableid=FW_ZSWPXXW,colid=" + str));
  1475. },
  1476. // 上传完成后的执行逻辑
  1477. done: function (e, data) {
  1478. self.uploading1 = false;
  1479. self.getOpinion1()
  1480. }
  1481. })
  1482. }
  1483. //下载意见表附件
  1484. self.downLoadOption = function (item) {
  1485. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  1486. }
  1487. //删除意见表附件
  1488. self.deleteOptionFile = function (file) {
  1489. var data = {
  1490. routeid: file.ROUTEID,
  1491. tableid: "FW_ZSWPXXW",
  1492. colid: file.COLID,
  1493. fileid: file.FILEID
  1494. };
  1495. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1496. .success(function (obj) {
  1497. var res = strToJson(s4.decryptData_CBC(obj.data));
  1498. sp.dialoghide();
  1499. if (res.success) {
  1500. self.getOpinion1();
  1501. } else {
  1502. sp.dialog("删除失败,请联系管理员!");
  1503. }
  1504. });
  1505. }
  1506. //删除意见
  1507. self.Dopinion = function (item) {
  1508. var data = {
  1509. cmanid: self.userId,
  1510. routeid: self.routeid,
  1511. tableid: "FW_ZSWPXXW",
  1512. colid: item.COLID,
  1513. }
  1514. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1515. .success(function (obj) {
  1516. var res = strToJson(s4.decryptData_CBC(obj.data));
  1517. if (res.success == true) {
  1518. self.getOpinion1();
  1519. self.nulla = "";
  1520. self.activeOpinion = null;
  1521. self.changeFiled(item.COLID)
  1522. } else {
  1523. sp.dialog(res.message)
  1524. }
  1525. })
  1526. }
  1527. self.phraseText = "";//添加常用语
  1528. self.phraseList = []//常用语列表
  1529. //获取常用语库
  1530. self.phrase = function (colid) {
  1531. sp.layer("#phrase");
  1532. self.colid = colid;
  1533. self.getPhrase();
  1534. }
  1535. //添加常用语到常用语库
  1536. self.Aphrase = function () {
  1537. if (self.phraseText == "") {
  1538. return;
  1539. }
  1540. var data = {
  1541. cmanid: self.userId,
  1542. tableid: "FW_ZSWPXXW",
  1543. colid: self.colid,
  1544. contents: self.phraseText
  1545. }
  1546. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1547. .success(function (obj) {
  1548. var res = strToJson(s4.decryptData_CBC(obj.data));
  1549. if (res.success == true) {
  1550. self.phraseText = "";
  1551. self.getPhrase();
  1552. } else {
  1553. sp.dialog(res.message)
  1554. }
  1555. })
  1556. }
  1557. //获取常用语库
  1558. self.getPhrase = function () {
  1559. var data = {
  1560. cmanid: self.userId,
  1561. tableid: "FW_ZSWPXXW",
  1562. colid: self.colid
  1563. }
  1564. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1565. .success(function (obj) {
  1566. var res = strToJson(s4.decryptData_CBC(obj.data));
  1567. self.phraseList = res.data;
  1568. self.phraseSelect = self.phraseList[0].CONTENTS;
  1569. })
  1570. }
  1571. //从常用语库删除
  1572. self.Dphrase = function () {
  1573. var id = null;
  1574. $.each(self.phraseList, function (index, item) {
  1575. if (item.CONTENTS == self.phraseSelect) {
  1576. id = item.ID;
  1577. }
  1578. })
  1579. var data = {
  1580. id: id
  1581. }
  1582. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1583. .success(function (obj) {
  1584. var res = strToJson(s4.decryptData_CBC(obj.data));
  1585. self.getPhrase();
  1586. })
  1587. }
  1588. //常用语确认为意见
  1589. self.btnPhrase = function () {
  1590. self.nulla = self.phraseSelect;
  1591. sp.layerhide();
  1592. }
  1593. self.selectUSAGE = function (item) {
  1594. item.checked = !item.checked;
  1595. self.selectUSAGEs = [];
  1596. $.each(self.USAGE, function (index, item) {
  1597. if (item.checked == true) {
  1598. self.selectUSAGEs.push(item.CODE)
  1599. }
  1600. })
  1601. self.changeFiled('USAGE')
  1602. }
  1603. //发生修改
  1604. self.changeFiled = function (str) {
  1605. self.filedChange = true;
  1606. }
  1607. //转发
  1608. self.forward = function (obj) {
  1609. self.btnItem = obj;
  1610. if (self.filedChange == true) {
  1611. self.btnSave(1)
  1612. } else {
  1613. $("#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")
  1614. sp.layer("#forward")
  1615. }
  1616. }
  1617. //查看流转记录
  1618. self.RouteList = function () {
  1619. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1620. //var data = {
  1621. // directionid: self.directionid,
  1622. // userid: self.userId,
  1623. // routeid: self.routeid,
  1624. // routeinfoid: self.routeinfoid,
  1625. //}
  1626. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1627. //.success(function (obj) {
  1628. // var res = strToJson(s4.decryptData_CBC(obj.data));
  1629. // self.routeList = res.data;
  1630. // $.each(self.routeList, function (index, item) {
  1631. // item.mainUser = [];
  1632. // item.copyUsers = [];
  1633. // $.each(item.USERS, function (index1, item1) {
  1634. // if (item1.KIND == 0) {
  1635. // item.mainUser.push(item1.USERNAME);
  1636. // } else {
  1637. // item.copyUsers.push(item1.USERNAME);
  1638. // }
  1639. // })
  1640. // item.mainUser = item.mainUser.join(",");
  1641. // item.copyUsers = item.copyUsers.join(",");
  1642. // })
  1643. // setTimeout(function (item) {
  1644. // sp.layer("#RouteList");
  1645. // }, 100);
  1646. //})
  1647. }
  1648. ////头部关键字搜索---20230905
  1649. self.headBtnSearchKeyword = "";
  1650. self.headSearchResult = [];
  1651. self.headSearchResult_view = false;
  1652. self.headBtnSearch = function () {
  1653. if (sp.isval(self.headBtnSearchKeyword)) {
  1654. self.headSearchResult = [];
  1655. var data = {
  1656. "url": "/basic/api/StatSelect/selectCodeList",
  1657. "data": { "keyWord": self.headBtnSearchKeyword }
  1658. }
  1659. //console.log(JSON.stringify(data));
  1660. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1661. .success(function (obj) {
  1662. var res = strToJson(s4.decryptData_CBC(obj.data));
  1663. //console.log(JSON.stringify(res.data));
  1664. self.headSearchResult = res.data.build;
  1665. if (sp.isval(self.headSearchResult)) {
  1666. self.headSearchResult_view = true;
  1667. } else {
  1668. self.headSearchResult_view = false;
  1669. }
  1670. })
  1671. } else {
  1672. self.headSearchResult_view = false;
  1673. }
  1674. };
  1675. self.headKeywordPage = function (itemdata) {
  1676. var get_token = localStorage.getItem("main-token");
  1677. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1678. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1679. self.headSearchResult_view = false;
  1680. };
  1681. self.onePic = function () {
  1682. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1683. }
  1684. self.openLC = function (n) {
  1685. }
  1686. self.reSize = function (n) {
  1687. var leftbox = document.getElementsByClassName("page-item")[n - 1];
  1688. var rightbox = document.getElementsByClassName("page-item")[n];
  1689. var line = document.getElementsByClassName("iframe-border-right")[n - 1];
  1690. document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
  1691. $(".mousemove").show()
  1692. var leftboxW = leftbox.clientWidth;//leftbox.style.width.slice(0, leftbox.style.width.length - 2);
  1693. var rightboxW = rightbox.clientWidth;//rightbox.style.width.slice(0, rightbox.style.width.length - 2);
  1694. var x = event.pageX - line.offsetLeft;
  1695. document.addEventListener("mousemove", boxMove)
  1696. function boxMove(event) {
  1697. if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
  1698. //$(".leftBox").children().not(".iframe-border-right").hide()
  1699. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
  1700. //$(".rightBox").children().not(".iframe-border-right").hide()
  1701. } else {
  1702. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  1703. leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
  1704. //$(".leftBox").children().not(".iframe-border-right").show()
  1705. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  1706. //rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
  1707. //$(".rightBox").children().not(".iframe-border-right").show()
  1708. }
  1709. }
  1710. document.addEventListener("mouseup", function () {
  1711. $(".mousemove").hide()
  1712. document.removeEventListener("mousemove", boxMove)
  1713. })
  1714. })
  1715. }
  1716. self.reSizeRow = function () {
  1717. var bodybox = document.getElementById("bodyDiv");
  1718. var topbox = document.getElementById("topDiv");
  1719. var bottombox = document.getElementById("bottomDiv");
  1720. var line = document.getElementById("lineDiv");
  1721. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  1722. $(".mousemove").show()
  1723. var bodyboxH = bodybox.clientHeight;
  1724. var topboxH = topbox.clientHeight;
  1725. var bottomboxH = bottombox.clientHeight;
  1726. //var y = event.pageY - line.offsetTop;
  1727. var y = event.pageY - line.clientHeight;
  1728. document.addEventListener("mousemove", boxMove)
  1729. function boxMove(event) {
  1730. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1731. //
  1732. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1733. //
  1734. } else {
  1735. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1736. topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1737. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 45 + "px";
  1738. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 75 + "px";
  1739. }
  1740. }
  1741. document.addEventListener("mouseup", function () {
  1742. $(".mousemove").hide()
  1743. document.removeEventListener("mousemove", boxMove)
  1744. })
  1745. })
  1746. }
  1747. $scope.closeToggle = function () {
  1748. $timeout(function () {
  1749. self.opinion.nulla = false;
  1750. self.activeOpinion = null;
  1751. })
  1752. }
  1753. //头部下滚冻结
  1754. $(function () {
  1755. //页面高度撑满
  1756. setTimeout(function () {
  1757. $(".formedit").css("height", $(window).height() - 70)
  1758. //$("#iframe_book").css("height", $(window).height() - 135)
  1759. $(".iframe-border-right").css("height", $(window).height() - 34)
  1760. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1761. }, 1)
  1762. })
  1763. }])
  1764. app.directive('treeView', [function () {
  1765. return {
  1766. restrict: 'EA',
  1767. templateUrl: '/treeView.html',
  1768. scope: {
  1769. treeData: '=',///声明数据
  1770. textField: '@',
  1771. itemAdd: '&', ///声明新增变量
  1772. itemEdit: '&',///声明修改变量
  1773. itemCheck: '&',///声明修改变量
  1774. itemDelete: '&',///声明修改变量
  1775. itemUp: '&',
  1776. itemDown: '&'
  1777. },
  1778. controller: ['$scope', function ($scope) {
  1779. $scope.itemExpended = function (item, $event) {
  1780. item.$$isExpend = !item.$$isExpend;
  1781. $event.stopPropagation();
  1782. };
  1783. ///展开折叠图标设置
  1784. $scope.getItemIcon = function (item) {
  1785. var isEnd = $scope.isEnd(item);
  1786. if (isEnd) {
  1787. return 'fa fa-paper-plane-o';
  1788. }
  1789. return item.$$isExpend ? 'fa fa-plus-square-o' : 'fa fa-minus-square-o';
  1790. };
  1791. ///判断是否是最后一级菜单
  1792. $scope.isEnd = function (item) {
  1793. return !item.C_H_I_L_D_DATA || !item.C_H_I_L_D_DATA.length;
  1794. };
  1795. ///事件调用返回
  1796. $scope.warpCallback = function (callback, item, $index, $event) {
  1797. ($scope[callback] || angular.noop)({
  1798. $item: item,
  1799. $index: $index,
  1800. $event: $event
  1801. });
  1802. };
  1803. }]
  1804. };
  1805. }]);
  1806. app.directive("repeatFinish", function () {
  1807. return {
  1808. link: function (scope) {
  1809. if (scope.$last == true) {
  1810. $(".toggle").trigger("click")
  1811. }
  1812. }
  1813. };
  1814. });
  1815. app.directive("spCheckboxBlueItem", function () {
  1816. return {
  1817. restrict: "A",
  1818. link: function (scope, elem, attrs) {
  1819. if (!scope == false) {
  1820. spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
  1821. }
  1822. }
  1823. }
  1824. });
  1825. app.filter('trustHtml', function ($sce) {
  1826. return function (input) {
  1827. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1828. };
  1829. });
  1830. function showRight(e) {
  1831. if ($(e).children(".fa-angle-left").is(":hidden")) {
  1832. $(".leftBox").css("width", "99.5%");
  1833. $("#iframe_book").css("width", "100%")
  1834. $(".rightBox").css("width", "0%");
  1835. $(".rightBox").hide()
  1836. $(e).children(".fa-angle-left").show()
  1837. $(e).children(".fa-angle-right").hide()
  1838. } else {
  1839. $(".leftBox").css("width", "69.5%");
  1840. $("#iframe_book").css("width", "100%")
  1841. $(".rightBox").css("width", "30%");
  1842. $(".rightBox").show()
  1843. $(e).children(".fa-angle-left").hide()
  1844. $(e).children(".fa-angle-right").show()
  1845. }
  1846. }
  1847. function showToggle(e) {
  1848. $(e).children().toggle()
  1849. $(e).next().toggle()
  1850. }
  1851. function toggleYJL(e) {
  1852. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1853. $(e).parent().css("height", 320)
  1854. } else {
  1855. $(e).parent().css("height", 10)
  1856. angular.element(document.getElementById("app")).scope().closeToggle()
  1857. }
  1858. $(e).children().toggle()
  1859. }
  1860. function toggleForm(e) {
  1861. $(e).children().toggle()
  1862. $(".toggleForm").toggle()
  1863. }
  1864. //文字不可被选中
  1865. document.body.onselectstart = function () {
  1866. return false;
  1867. }