formeditZW.js 71 KB

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