formeditZW.js 74 KB

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