formeditZW.js 75 KB

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