formeditZW.js 75 KB

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