formeditZW.js 77 KB

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