formeditZW.js 70 KB

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