formeditZW.js 83 KB

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