formeditZW.js 72 KB

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