formeditZW.js 73 KB

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