formedit.js 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.cookie("GlWorkPlatform-chineseName");
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. self.routeid = sp.getUrlName("routeid");
  12. self.routeinfoid = sp.getUrlName("routeinfoid");
  13. self.copyrightid = sp.getUrlName("copyrightid");
  14. self.directionid = sp.getUrlName("directionid");
  15. self.formeditid = sp.getUrlName("formeditid");
  16. self.mbid = sp.getUrlName("mbid");
  17. self.fjid = sp.getUrlName("fjid");
  18. self.docmode = sp.getUrlName("docmode");
  19. self.dotype = sp.getUrlName("dotype");
  20. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  21. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  22. self.get_type = sp.getUrlName("type");
  23. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  24. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  25. var postCfg = {
  26. headers: {
  27. 'Content-Type': 'application/json',
  28. 'Authorization': "Bearer " + self.get_AccessToken
  29. }
  30. };
  31. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  32. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  33. return item.CNAME
  34. })
  35. //上层附件、业务参考、共享沟通组件
  36. self.uploading = false;
  37. self.upload = function () {
  38. $('#fileupload').fileupload({
  39. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  40. dataType: 'json',
  41. beforeSend: function (xhr, data) {
  42. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  43. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=督办公文延期"));
  44. },
  45. add: function (e, data) {
  46. var num = 0;
  47. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  48. //文件类型判断
  49. $.each(data.originalFiles, function (index, item) {
  50. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  51. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  52. return;
  53. } else {
  54. num++
  55. }
  56. })
  57. if (num == data.originalFiles.length) {
  58. self.uploading = true;
  59. data.submit();
  60. $scope.$apply();
  61. }
  62. },
  63. // 上传完成后的执行逻辑
  64. done: function (e, data) {
  65. self.uploading = false;
  66. self.getOther()
  67. }
  68. })
  69. }
  70. self.downLoad = function (item) {
  71. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  72. }
  73. self.deleteFile = function (file) {
  74. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  75. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  76. 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>";
  77. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  78. sp.openCenter(".sp-dialog");
  79. ///取消按钮
  80. $('.sp-closeDialog').click(function (event) {
  81. sp.closeCenter(".sp-dialog");
  82. event.preventDefault();
  83. event.stopPropagation();
  84. });
  85. //post消息的id
  86. $("#delDataTrue").click(function () {
  87. var data = {
  88. tablename: "FILE_ATTACH",
  89. id: file.ID
  90. };
  91. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  92. .success(function (obj) {
  93. var res = strToJson(s4.decryptData_CBC(obj.data));
  94. sp.dialoghide();
  95. if (res.success) {
  96. self.getOther();
  97. } else {
  98. sp.dialog("删除失败,请联系管理员!");
  99. }
  100. });
  101. });
  102. }
  103. self.goAttach = function (obj) {
  104. if (obj) {
  105. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  106. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  107. return
  108. }
  109. $("#attachlist")[0].contentWindow.openFile(obj)
  110. if ($(".fa-chevron-down").is(":hidden") == true) {
  111. showToggle(document.getElementById("toggleButton"))
  112. }
  113. } else {
  114. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  115. }
  116. }
  117. self.readonly = {
  118. SQSJ: false,
  119. SQSM: false,
  120. HJ: false,
  121. ZB: false
  122. }
  123. //初始化右上角按钮
  124. self.buttonList = []
  125. self.getSwenList = function (n) {
  126. self.SwenList = [];
  127. var data = {
  128. directionid: self.directionid,
  129. userid: self.userId,
  130. routeinfoid: self.routeinfoid,
  131. routeid: self.routeid,
  132. formeditid: ""
  133. }
  134. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  135. .success(function (obj) {
  136. var res = strToJson(s4.decryptData_CBC(obj.data));
  137. $.each(res.data.LINKS, function (index, item) {
  138. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  139. self.Title = item.VNAME;
  140. }
  141. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  142. if (item.TEMPFORM.indexOf("attachlist") > -1) {
  143. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  144. } else {
  145. item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  146. }
  147. } else {
  148. item.TEMPFORM = "#";
  149. }
  150. self.SwenList.push(item)
  151. })
  152. if (n == 0) {
  153. self.getDP()
  154. } else {
  155. self.getData()
  156. }
  157. })
  158. }
  159. self.getSwenList(0)
  160. self.getDP = function () {
  161. var data = {
  162. userid: self.userId
  163. }
  164. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  165. .success(function (obj) {
  166. var res = strToJson(s4.decryptData_CBC(obj.data));
  167. self.userDp = res.data.length == 0 ? "" : res.data[0];
  168. self.getData()
  169. })
  170. }
  171. //获取数据
  172. self.getData = function () {
  173. var data = {
  174. ckey: "SX_BGYP",
  175. id: 0,
  176. directionid: self.directionid,
  177. formeditid: self.formeditid,
  178. routeid: self.routeid,
  179. routeinfoid: self.routeinfoid
  180. }
  181. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  182. .success(function (obj) {
  183. var res = strToJson(s4.decryptData_CBC(obj.data));
  184. self.data = {
  185. ID: res.data.SX_BGYP.ID,
  186. SQR: res.data.SX_BGYP.SQR == "" ? self.userName : res.data.SX_BGYP.SQR,
  187. SQSJ: res.data.SX_BGYP.SQSJ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_BGYP.SQSJ),
  188. SQBM: res.data.SX_BGYP.SQBM == "" ? self.userDp.SECTION : res.data.SX_BGYP.SQBM,
  189. SQSM: res.data.SX_BGYP.SQSM,
  190. HJ: res.data.SX_BGYP.HJ,
  191. LYZT: res.data.SX_BGYP.LYZT == "" ? "待领取" : res.data.SX_BGYP.LYZT,
  192. };
  193. self.readonly = {
  194. SQSJ: res.data.SX_BGYP["SQSJ.EREADONLY"] == "true",
  195. SQSM: res.data.SX_BGYP["SQSM.EREADONLY"] == "true",
  196. HJ: res.data.SX_BGYP["HJ.EREADONLY"] == "true",
  197. ZB: res.data.SX_BGYP["ZB.EREADONLY"] == "true"
  198. }
  199. if (self.data.ID == 0) {
  200. self.filedChange = true;
  201. } else {
  202. self.filedChange = false;
  203. }
  204. self.buttonList = res.data["SX_BGYP.FUNCLIST"];
  205. self.getChildList()
  206. self.getOpinion1()
  207. })
  208. }
  209. self.getChildList = function () {
  210. var data = {
  211. id: self.data.ID,
  212. tablename: "SX_BGYP_01"
  213. }
  214. $http.post(apiurljs.login + "g2app/dataabase/queryChildList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  215. .success(function (obj) {
  216. var res = strToJson(s4.decryptData_CBC(obj.data));
  217. self.list = res.data;
  218. self.AddFlag = false;
  219. self.EditFlag = false;
  220. self.list.forEach(function (item) {
  221. item.FL = item.YPFL;
  222. item.GG = item.YPGG;
  223. item.DJ = item.PJDJ;
  224. item.editFlag = false;
  225. })
  226. self.getAllBGYP()
  227. })
  228. }
  229. //获取意见(不上表)
  230. self.getOpinion1 = function () {
  231. var data = {
  232. cmanid: self.userId,
  233. routeinfoid: self.routeinfoid,
  234. routeid: "",//self.routeid,
  235. tableid: "SX_BGYP",
  236. colid: "",
  237. opiniontype: 99,
  238. orderbycol: "CDATE desc"
  239. }
  240. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  241. .success(function (obj) {
  242. var res = strToJson(s4.decryptData_CBC(obj.data));
  243. if (res.success == true) {
  244. self.YJ.nulla = res.data;
  245. self.YJ.nullaSTATUS = false;
  246. self.YJ.nulla.forEach(function (item) {
  247. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  248. })
  249. } else {
  250. sp.dialog(res.message)
  251. }
  252. })
  253. }
  254. self.bgypListTotal = [];
  255. self.getAllBGYP = function () {
  256. var data = {
  257. code: "YP01",
  258. data_col: "YPBH",
  259. order: "id",
  260. pageno: 0,
  261. pagesize: 0,
  262. sqllikewhere: "",
  263. sqlwhere: "",
  264. tablename_code: "CODE_YPTYPE",
  265. tablename_data: "SX_BGYPMGR"
  266. }
  267. $http.post(apiurljs.login + "g2app/richang/queryFormDataBySqlWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  268. .success(function (obj) {
  269. var res = strToJson(s4.decryptData_CBC(obj.data));
  270. self.bgypListTotal = res.data;
  271. self.bgypListTotal.forEach(function (item) {
  272. item.JLDW = item.JDLW;
  273. })
  274. })
  275. }
  276. //判断页面字段是否只读readonly、是否隐藏show
  277. self.hide = function (type, field) {
  278. if (self.dotype == 0 && type == "readonly") {
  279. return true;
  280. } else {
  281. if (self[type][field] == true) {
  282. return true;
  283. } else {
  284. return false;
  285. }
  286. }
  287. }
  288. //右上角按钮调用方法
  289. self.btnEvent = function (item) {
  290. switch (item.CODE) {
  291. case "SAVEITEM": self.btnSave(0); break;
  292. case "PRINTITEM": self.btnPrint(); break;
  293. case "MEETITEM": self.Meet(); break;
  294. case "SENDLOG": self.RouteList(); break;
  295. default: self.forward(item); break;
  296. }
  297. }
  298. //保存提交
  299. self.btnSave = function (n) {
  300. if (spngvld.submit(".sp-page-center")) {
  301. var dataArray = [];
  302. dataArray.push(self.data);
  303. var data = {
  304. ckey: "SX_BGYP",
  305. id: self.data.ID,
  306. routeid: self.routeid,
  307. routeinfoid: self.routeinfoid,
  308. routeinfotitle: self.data.SQSJ + self.data.SQR + "办公用品申请",//self.data.TITLE,
  309. directionid: self.directionid,
  310. formeditid: self.formeditid,
  311. data: JSON.stringify(dataArray)
  312. }
  313. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  314. .success(function (obj) {
  315. var res = strToJson(s4.decryptData_CBC(obj.data));
  316. if (res.code == 0) {
  317. self.data.ID = res.data.ID;
  318. self.routeid = res.data.ROUTEID;
  319. self.routeinfoid = res.data.ROUTEINFOID;
  320. self.filedChange = false;
  321. if (n == 0) {
  322. sp.dialog("保存成功!");
  323. $timeout(function () {
  324. sp.dialoghide()
  325. }, 1500)
  326. self.getSwenList(1)
  327. } else if (n == 1) {
  328. self.forward(self.btnItem);
  329. } else if (n == 2) {
  330. self.sendAll();
  331. } else if (n == 3) {
  332. self.RYADD()
  333. }
  334. } else {
  335. sp.dialog(res.message)
  336. }
  337. })
  338. }
  339. }
  340. //领取
  341. self.btnLQ = function () {
  342. var data = {
  343. tablename: "SX_BGYP",
  344. id: self.data.ID,
  345. data: {
  346. LYZT:"已领取"
  347. }
  348. }
  349. $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  350. .success(function (obj) {
  351. var res = strToJson(s4.decryptData_CBC(obj.data));
  352. if (res.success) {
  353. self.getData()
  354. self.upDataKC(self.list, 0)
  355. } else {
  356. sp.dialog(res.message)
  357. }
  358. })
  359. }
  360. //扣除库存
  361. self.upDataKC = function (arr, i) {
  362. if (i == arr.length) {
  363. return
  364. } else {
  365. var data = {
  366. tablename: "SX_BGYPMGR",
  367. colums: "*",
  368. order: "ID desc",
  369. sqlwhere: { YPBH: arr[i].YPBH, GG: arr[i].YPGG },
  370. sqlinwhere: "",
  371. sqllikewhere: ""
  372. }
  373. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  374. .success(function (obj) {
  375. var res = strToJson(s4.decryptData_CBC(obj.data));
  376. var data = {
  377. tablename: "SX_BGYPMGR",
  378. id: res.data[0].ID,
  379. data: {
  380. KC: res.data[0].KC - arr[i].SQSL
  381. }
  382. }
  383. $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  384. .success(function (obj) {
  385. var res = strToJson(s4.decryptData_CBC(obj.data));
  386. if (res.success) {
  387. self.upDataKC(arr, i + 1);
  388. } else {
  389. sp.dialog(res.message)
  390. }
  391. })
  392. })
  393. }
  394. }
  395. //新建
  396. self.addList = [];
  397. self.temporary = [];
  398. self.RYADD = function () {
  399. if (self.EditFlag == true) {
  400. sp.dialog("请先保存或取消编辑申请!")
  401. return
  402. }
  403. self.AddFlag = true;
  404. self.getLeftTreeData()
  405. if (self.data.ID == 0) {
  406. self.btnSave(3)
  407. }
  408. }
  409. //编辑
  410. self.RYEDIT = function (item) {
  411. if (self.AddFlag == true) {
  412. sp.dialog("请先保存或取消添加申请!")
  413. return
  414. }
  415. self.EditFlag = true;
  416. item.editFlag = true;
  417. self.edit = {
  418. ID: item.ID,
  419. YPBH1: item.YPBH1,
  420. PP: item.PP,
  421. YPMC: item.YPMC,
  422. YPBH: item.YPBH,
  423. YPFL: item.YPFL,
  424. YPGG: item.YPGG,
  425. PJDJ: item.PJDJ,
  426. KC: item.KC,
  427. SQSL: item.SQSL,
  428. JLDW: item.JLDW,
  429. YPK: item.YPK,
  430. GLY: item.GLY,
  431. YPZJ: item.YPZJ
  432. };
  433. }
  434. self.RYSAVE = function () {
  435. var text = JSON.stringify({
  436. YPBH1: self.edit.YPBH1,
  437. PP: self.edit.PP,
  438. YPMC:self.edit.YPMC,
  439. YPBH:self.edit.YPBH,
  440. YPFL:self.edit.YPFL,
  441. YPGG:self.edit.YPGG,
  442. PJDJ:self.edit.PJDJ,
  443. KC:self.edit.KC,
  444. SQSL:self.edit.SQSL,
  445. JLDW:self.edit.JLDW,
  446. YPK:self.edit.YPK,
  447. GLY:self.edit.GLY,
  448. YPZJ:self.edit.YPZJ
  449. })
  450. var data = {
  451. tablename: "SX_BGYP_01",
  452. id: self.edit.ID,
  453. data: text
  454. }
  455. $http.post(apiurljs.login + "g2app/dataabase/saveChildData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  456. .success(function (obj) {
  457. var res = strToJson(s4.decryptData_CBC(obj.data));
  458. if (res.success) {
  459. self.getChildList();
  460. sp.dialog("编辑成功!")
  461. $timeout(function () {
  462. sp.dialoghide()
  463. }, 2000)
  464. } else {
  465. sp.dialog(res.message)
  466. }
  467. })
  468. }
  469. self.btnDel = function (item) {
  470. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  471. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  472. 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>";
  473. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  474. sp.openCenter(".sp-dialog");
  475. ///取消按钮
  476. $('.sp-closeDialog').click(function (event) {
  477. sp.closeCenter(".sp-dialog");
  478. event.preventDefault();
  479. event.stopPropagation();
  480. });
  481. //post消息的id
  482. $("#delDataTrue").click(function () {
  483. var data = {
  484. tablename: "SX_BGYP_01",
  485. id: item.ID
  486. };
  487. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  488. .success(function (obj) {
  489. var res = strToJson(s4.decryptData_CBC(obj.data));
  490. sp.dialoghide();
  491. if (res.success) {
  492. self.getChildList();
  493. } else {
  494. sp.dialog("删除失败,请联系管理员!");
  495. }
  496. });
  497. });
  498. }
  499. //获取树形结构
  500. self.treeData = [];
  501. self.getLeftTreeData = function () {
  502. var postData = {
  503. "tablename": "CODE_YPTYPE",
  504. "sql_data": "YPBH",
  505. "tablename_data": "SX_BGYPMGR"
  506. }
  507. $http.post(apiurljs.login + "g2app/richang/getTreeList", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  508. .success(function (obj) {
  509. var res = strToJson(s4.decryptData_CBC(obj.data));
  510. self.getMenuBtnList(res.data);
  511. self.treeData = res.data;
  512. setTimeout(function () {
  513. self.nowNodeCode = self.treeData[0].CODE;
  514. self.nowNodeName = self.treeData[0].CNAME;
  515. self.nowNodeID = self.treeData[0].ID;
  516. self.treeData[0].checked = true;
  517. self.openList(1,0);
  518. })
  519. })
  520. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  521. self.treeData = [];
  522. })
  523. }
  524. self.getMenuBtnList = function (data) {
  525. data.forEach(function (item) {
  526. item.checked = false;
  527. if (sp.isval(item.C_H_I_L_D_DATA) && item.C_H_I_L_D_DATA.length > 0) {
  528. self.getMenuBtnList(item.C_H_I_L_D_DATA);
  529. } else {
  530. item.C_H_I_L_D_DATA = [];
  531. }
  532. })
  533. }
  534. self.itemCheck = function ($item) {
  535. self.treeData.forEach(function (item) {
  536. if (item.ID == $item.ID) {
  537. $item.checked = !$item.checked;
  538. } else {
  539. item.checked = false;
  540. }
  541. if (item.C_H_I_L_D_DATA != "" && item.C_H_I_L_D_DATA != null && item.C_H_I_L_D_DATA != null) {
  542. item.C_H_I_L_D_DATA.forEach(function (item2) {
  543. if (item2.ID == $item.ID) {
  544. $item.checked = !$item.checked;
  545. } else {
  546. item2.checked = false;
  547. }
  548. if (item2.C_H_I_L_D_DATA != "" && item2.C_H_I_L_D_DATA != null && item2.C_H_I_L_D_DATA != null) {
  549. item2.C_H_I_L_D_DATA.forEach(function (item3) {
  550. if (item3.ID == $item.ID) {
  551. $item.checked = !$item.checked;
  552. } else {
  553. item3.checked = false;
  554. }
  555. if (item3.C_H_I_L_D_DATA != "" && item3.C_H_I_L_D_DATA != null && item3.C_H_I_L_D_DATA != null) {
  556. item3.C_H_I_L_D_DATA.forEach(function (item4) {
  557. if (item4.ID == $item.ID) {
  558. $item.checked = !$item.checked;
  559. } else {
  560. item4.checked = false;
  561. }
  562. if (item4.C_H_I_L_D_DATA != "" && item4.C_H_I_L_D_DATA != null && item4.C_H_I_L_D_DATA != null) {
  563. item4.C_H_I_L_D_DATA.forEach(function (item5) {
  564. if (item5.ID == $item.ID) {
  565. $item.checked = !$item.checked;
  566. } else {
  567. item5.checked = false;
  568. }
  569. if (item5.C_H_I_L_D_DATA != "" && item5.C_H_I_L_D_DATA != null && item5.C_H_I_L_D_DATA != null) {
  570. item5.C_H_I_L_D_DATA.forEach(function (item6) {
  571. if (item6.ID == $item.ID) {
  572. $item.checked = !$item.checked;
  573. } else {
  574. item6.checked = false;
  575. }
  576. if (item6.C_H_I_L_D_DATA != "" && item6.C_H_I_L_D_DATA != null && item6.C_H_I_L_D_DATA != null) {
  577. item6.C_H_I_L_D_DATA.forEach(function (item7) {
  578. if (item7.ID == $item.ID) {
  579. $item.checked = !$item.checked;
  580. } else {
  581. item7.checked = false;
  582. }
  583. })
  584. }
  585. })
  586. }
  587. })
  588. }
  589. })
  590. }
  591. })
  592. }
  593. })
  594. }
  595. })
  596. if ($item.checked) {
  597. self.nowNodeCode = $item.CODE;
  598. self.openList(1);
  599. } else {
  600. self.nowNodeCode = self.treeData[0].CODE;
  601. self.treeData[0].checked = true;
  602. }
  603. }
  604. self.pageno = 1;
  605. self.nameBGYP = "";
  606. self.openList = function (pageno, n) {
  607. self.pageno = pageno;
  608. $scope.__default__currentPage = self.pageno;
  609. var data = {
  610. code: self.nowNodeCode,
  611. data_col: "YPBH",
  612. order: "id",
  613. pageno: self.pageno,
  614. pagesize: 6,
  615. sqllikewhere: { YPMC: self.nameBGYP },
  616. sqlwhere: "",
  617. tablename_code: "CODE_YPTYPE",
  618. tablename_data: "SX_BGYPMGR"
  619. }
  620. $http.post(apiurljs.login + "g2app/richang/queryFormDataBySqlWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  621. .success(function (obj) {
  622. var res = strToJson(s4.decryptData_CBC(obj.data));
  623. self.bgypList = res.data;
  624. self.total_count = res.totalCount;
  625. if (n == 0) {
  626. self.temporary = JSON.parse(JSON.stringify(self.addList.concat(self.list)));
  627. sp.layer("#bgypList", 1)
  628. }
  629. self.bgypList.forEach(function (item) {
  630. item.checked = false;
  631. if (self.EditFlag == true) {
  632. if (item.YPMC == self.edit.YPMC) {
  633. item.checked = true;
  634. }
  635. } else {
  636. self.bgypListTotal.forEach(function (item1) {
  637. item1.checked = false;
  638. self.temporary.forEach(function (item2) {
  639. if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
  640. item1.checked = true;
  641. }
  642. })
  643. if (item.ID == item1.ID) {
  644. item.checked = item1.checked;
  645. }
  646. })
  647. }
  648. })
  649. })
  650. }
  651. self.changeSQSL = function (item) {
  652. item.YPZJ = item.SQSL * item.DJ
  653. if (item.SQSL > item.KC) {
  654. item.SQSL = item.KC;
  655. }
  656. }
  657. self.AddList = function () {
  658. var data = {
  659. tablename: "SX_BGYP_01",
  660. sqlwhere: "PID=" + self.data.ID
  661. };
  662. $http.post(apiurljs.login + "g2app/dataabase/deletBywhere", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  663. .success(function (obj) {
  664. var res = strToJson(s4.decryptData_CBC(obj.data));
  665. self.addList = self.temporary.map(function (item) {
  666. return {
  667. PID: self.data.ID,
  668. YPBH1: item.YPBH1,
  669. PP: item.PP,
  670. YPMC: item.YPMC,
  671. YPBH: item.YPBH,
  672. YPFL: item.FL,
  673. YPGG: item.GG,
  674. PJDJ: item.DJ,
  675. KC: item.KC,
  676. SQSL: item.SQSL,
  677. JLDW: item.JDLW,
  678. YPK: item.YPK,
  679. GLY: item.GLY,
  680. YPZJ: item.YPZJ
  681. }
  682. })
  683. var data = {
  684. tablename: "SX_BGYP_01",
  685. data: self.addList
  686. }
  687. $http.post(apiurljs.login + "g2app/Data/insertChildDataList2", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  688. .success(function (obj) {
  689. var res = strToJson(s4.decryptData_CBC(obj.data));
  690. if (res.success) {
  691. self.closeAdd()
  692. self.getChildList();
  693. sp.dialog("添加成功!")
  694. $timeout(function () {
  695. sp.dialoghide()
  696. }, 2000)
  697. } else {
  698. sp.dialog(res.message)
  699. }
  700. })
  701. sp.closeCenter("#bgypList")
  702. })
  703. }
  704. self.closeAdd = function () {
  705. self.AddFlag = false;
  706. self.addList = [];
  707. self.temporary = [];
  708. sp.closeCenter("#bgypList")
  709. }
  710. //n等于1时为新增,n等于2时为编辑
  711. self.checkItem = function (item, n) {
  712. if (n == 1) {
  713. self.bgypListTotal.forEach(function (item1) {
  714. self.temporary.forEach(function (item2) {
  715. if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
  716. item2.checked = item1.checked;
  717. }
  718. })
  719. if (item1.YPBH == item.YPBH && item1.GG == item.GG && item1.YPBH1 == item.YPBH1) {
  720. item1.checked = item.checked;
  721. if (item1.checked == true) {
  722. self.temporary.push(item1)
  723. } else {
  724. self.temporary = self.temporary.filter(function (item2) {
  725. return item2.checked == true
  726. })
  727. }
  728. }
  729. })
  730. } else {
  731. self.edit.YPBH1 = item.YPBH1
  732. self.edit.YPMC = item.YPMC
  733. self.edit.YPBH = item.YPBH
  734. self.edit.PP = item.PP,
  735. self.edit.YPFL = item.FL
  736. self.edit.YPGG = item.GG
  737. self.edit.PJDJ = item.DJ
  738. self.edit.KC = item.KC
  739. self.edit.SQSL = ""
  740. self.edit.JLDW = item.JDLW
  741. self.edit.YPK = ""
  742. self.edit.GLY = ""
  743. self.edit.YPZJ = ""
  744. }
  745. }
  746. self.deleteItem = function (item) {
  747. item.checked = false;
  748. self.bgypListTotal.forEach(function (item1) {
  749. if (item1.YPBH == item.YPBH && item1.GG == item.GG) {
  750. item1.checked = item.checked;
  751. }
  752. self.bgypList.forEach(function (item2) {
  753. if (item1.YPBH == item2.YPBH && item1.GG == item2.GG && item1.YPBH1 == item2.YPBH1) {
  754. item2.checked = item1.checked;
  755. }
  756. })
  757. })
  758. self.temporary = self.temporary.filter(function (item) {
  759. return item.checked != false
  760. })
  761. }
  762. //签写意见编辑状态
  763. self.opinion = {
  764. nulla: false
  765. }
  766. self.YJ = {
  767. nulla: [],
  768. nullaSTATUS: false
  769. }
  770. //意见(下表)
  771. self.openOptionList = function () {
  772. if (self.routeinfoid == 0 && self.routeid == 0) {
  773. sp.dialog("请先保存!")
  774. return;
  775. }
  776. if (self.opinion.nulla == true) {
  777. return;
  778. }
  779. self.nulla = "";
  780. $(".optionList").css("height", 149)
  781. self.opinion.nulla = true;
  782. }
  783. self.closeOptionList = function () {
  784. $(".optionList").css("height", 389)
  785. self.opinion.nulla = false;
  786. }
  787. self.submitOptionList = function () {
  788. var data = {
  789. cmanid: self.userId,
  790. routeinfoid: self.routeinfoid,
  791. routeid: self.routeid,
  792. tableid: "SX_BGYP",
  793. colid: "",
  794. opiniontype: 99,
  795. cresult: "",
  796. opinion: self.nulla,
  797. opinionimage: ""
  798. }
  799. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  800. .success(function (obj) {
  801. var res = strToJson(s4.decryptData_CBC(obj.data));
  802. if (res.success == true) {
  803. self.getOpinion1();
  804. self.opinion.nulla = false;
  805. $(".optionList").css("height", 389)
  806. } else {
  807. sp.dialog(res.message)
  808. }
  809. })
  810. }
  811. self.changeOptionList = function (item) {
  812. self.nulla = item.OPINION;
  813. self.opinion.nulla = true;
  814. }
  815. //意见附件(下表)
  816. self.uploading1 = false;
  817. self.upload1 = function () {
  818. $('#fileupload1').fileupload({
  819. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  820. dataType: 'json',
  821. beforeSend: function (xhr, data) {
  822. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  823. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  824. + ",routeid=" + self.routeid + ",tableid=SX_BGYP,colid="));
  825. },
  826. // 上传完成后的执行逻辑
  827. done: function (e, data) {
  828. self.uploading1 = false;
  829. self.getOpinion1()
  830. }
  831. })
  832. }
  833. //下载意见表附件
  834. self.downLoadOption = function (item) {
  835. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  836. }
  837. //删除意见表附件
  838. self.deleteOptionFile = function (file, str) {
  839. var data = {
  840. routeid: file.ROUTEID,
  841. tableid: "SX_BGYP",
  842. colid: str,
  843. fileid: file.FILEID
  844. };
  845. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  846. .success(function (obj) {
  847. var res = strToJson(s4.decryptData_CBC(obj.data));
  848. sp.dialoghide();
  849. if (res.success) {
  850. self.getOpinion1();
  851. } else {
  852. sp.dialog("删除失败,请联系管理员!");
  853. }
  854. });
  855. }
  856. //删除意见
  857. self.Dopinion = function (str, item) {
  858. var data = {
  859. cmanid: self.userId,
  860. routeid: self.routeid,
  861. tableid: "SX_BGYP",
  862. colid: str,
  863. }
  864. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { 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.getOpinion1();
  869. } else {
  870. sp.dialog(res.message)
  871. }
  872. })
  873. }
  874. self.phraseText = "";//添加常用语
  875. self.phraseList = []//常用语列表
  876. //获取常用语库
  877. self.phrase = function (colid) {
  878. sp.layer("#phrase");
  879. self.colid = colid;
  880. self.getPhrase();
  881. }
  882. //添加常用语到常用语库
  883. self.Aphrase = function () {
  884. if (self.phraseText == "") {
  885. return;
  886. }
  887. var data = {
  888. cmanid: self.userId,
  889. tableid: "SX_BGYP",
  890. colid: self.colid,
  891. contents: self.phraseText
  892. }
  893. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  894. .success(function (obj) {
  895. var res = strToJson(s4.decryptData_CBC(obj.data));
  896. if (res.success == true) {
  897. self.phraseText = "";
  898. self.getPhrase();
  899. } else {
  900. sp.dialog(res.message)
  901. }
  902. })
  903. }
  904. //获取常用语库
  905. self.getPhrase = function () {
  906. var data = {
  907. cmanid: self.userId,
  908. tableid: "SX_BGYP",
  909. colid: self.colid
  910. }
  911. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  912. .success(function (obj) {
  913. var res = strToJson(s4.decryptData_CBC(obj.data));
  914. self.phraseList = res.data;
  915. self.phraseSelect = self.phraseList[0].CONTENTS;
  916. })
  917. }
  918. //从常用语库删除
  919. self.Dphrase = function () {
  920. var id = null;
  921. $.each(self.phraseList, function (index, item) {
  922. if (item.CONTENTS == self.phraseSelect) {
  923. id = item.ID;
  924. }
  925. })
  926. var data = {
  927. id: id
  928. }
  929. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  930. .success(function (obj) {
  931. var res = strToJson(s4.decryptData_CBC(obj.data));
  932. self.getPhrase();
  933. })
  934. }
  935. //常用语确认为意见
  936. self.btnPhrase = function () {
  937. if (!self.colid) {
  938. self.nulla = self.phraseSelect;
  939. } else {
  940. self.data[self.colid] = self.phraseSelect;
  941. }
  942. sp.layerhide();
  943. }
  944. //发生修改
  945. self.changeFiled = function (str) {
  946. self.filedChange = true;
  947. }
  948. //转发
  949. self.forward = function (obj) {
  950. self.btnItem = obj;
  951. if (self.filedChange == true) {
  952. self.btnSave(1)
  953. } else {
  954. $("#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=bangongbg")
  955. sp.layer("#forward")
  956. }
  957. }
  958. //查看流转记录
  959. self.RouteList = function () {
  960. if (self.deviceType == "pad") {
  961. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  962. } else {
  963. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  964. }
  965. //var data = {
  966. // directionid: self.directionid,
  967. // userid: self.userId,
  968. // routeid: self.routeid,
  969. // routeinfoid: self.routeinfoid,
  970. //}
  971. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  972. //.success(function (obj) {
  973. // var res = strToJson(s4.decryptData_CBC(obj.data));
  974. // self.routeList = res.data;
  975. // $.each(self.routeList, function (index, item) {
  976. // item.mainUser = [];
  977. // item.copyUsers = [];
  978. // $.each(item.USERS, function (index1, item1) {
  979. // if (item1.KIND == 0) {
  980. // item.mainUser.push(item1.USERNAME);
  981. // } else {
  982. // item.copyUsers.push(item1.USERNAME);
  983. // }
  984. // })
  985. // item.mainUser = item.mainUser.join(",");
  986. // item.copyUsers = item.copyUsers.join(",");
  987. // })
  988. // setTimeout(function (item) {
  989. // sp.layer("#RouteList");
  990. // }, 100);
  991. //})
  992. }
  993. self.reSizeRow = function () {
  994. var bodybox = document.getElementById("bodyDiv");
  995. var topbox = document.getElementById("topDiv");
  996. var bottombox = document.getElementById("bottomDiv");
  997. var line = document.getElementById("lineDiv");
  998. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  999. $(".mousemove").show()
  1000. var bodyboxH = bodybox.clientHeight;
  1001. var topboxH = topbox.clientHeight;
  1002. var bottomboxH = bottombox.clientHeight;
  1003. //var y = event.pageY - line.offsetTop;
  1004. var y = event.pageY - line.clientHeight;
  1005. document.addEventListener("mousemove", boxMove)
  1006. function boxMove(event) {
  1007. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1008. //
  1009. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1010. //
  1011. } else {
  1012. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1013. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1014. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  1015. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  1016. }
  1017. }
  1018. document.addEventListener("mouseup", function () {
  1019. $(".mousemove").hide()
  1020. document.removeEventListener("mousemove", boxMove)
  1021. })
  1022. })
  1023. }
  1024. ////头部关键字搜索---20230905
  1025. self.headBtnSearchKeyword = "";
  1026. self.headSearchResult = [];
  1027. self.headSearchResult_view = false;
  1028. self.headBtnSearch = function () {
  1029. if (sp.isval(self.headBtnSearchKeyword)) {
  1030. self.headSearchResult = [];
  1031. var data = {
  1032. "url": "/basic/api/StatSelect/selectCodeList",
  1033. "data": { "keyWord": self.headBtnSearchKeyword }
  1034. }
  1035. //console.log(JSON.stringify(data));
  1036. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1037. .success(function (obj) {
  1038. var res = strToJson(s4.decryptData_CBC(obj.data));
  1039. //console.log(JSON.stringify(res.data));
  1040. self.headSearchResult = res.data.build;
  1041. if (sp.isval(self.headSearchResult)) {
  1042. self.headSearchResult_view = true;
  1043. } else {
  1044. self.headSearchResult_view = false;
  1045. }
  1046. })
  1047. } else {
  1048. self.headSearchResult_view = false;
  1049. }
  1050. };
  1051. self.headKeywordPage = function (itemdata) {
  1052. var get_token = localStorage.getItem("main-token");
  1053. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1054. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1055. self.headSearchResult_view = false;
  1056. };
  1057. self.onePic = function () {
  1058. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1059. }
  1060. //公开
  1061. self.PUBLICITEM = function () {
  1062. var data = {
  1063. userid: self.userId
  1064. }
  1065. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1066. .success(function (obj) {
  1067. var res = strToJson(s4.decryptData_CBC(obj.data));
  1068. var data1 = {
  1069. tablename: "CODE_LM"
  1070. }
  1071. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  1072. .success(function (obj1) {
  1073. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  1074. self.LM = res1.data[0].C_H_I_L_D_DATA;
  1075. self.LM.forEach(function (item) {
  1076. item.show = true;
  1077. if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
  1078. item.show = false;
  1079. }
  1080. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1081. item1.show = true;
  1082. if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
  1083. item1.show = false;
  1084. }
  1085. })
  1086. })
  1087. self.filed = "GKFW";
  1088. self.msgGK = {
  1089. WJLY: "FW",
  1090. FLOWID: "AA88",
  1091. FORMROUTEINFOID: self.routeinfoid,
  1092. FBUSERID: self.userId,
  1093. FBNAME: self.userName,
  1094. GKFW: "",
  1095. LM: "P0103",
  1096. LM1: "委发文件",
  1097. FBRQ: sp.getLocalDate(),
  1098. FBBM: res.data[0].SECTION,
  1099. WJBT: self.data.FWBT
  1100. }
  1101. sp.layer("#PUBLICITEM")
  1102. $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
  1103. })
  1104. })
  1105. }
  1106. self.showCol = function ($event, ele) {
  1107. $('.detail-col').not(ele).hide();
  1108. $(ele).toggle("slow").autoHide();
  1109. $event.stopPropagation();
  1110. }
  1111. self.selectLM = function (item) {
  1112. self.msgGK.LM = item.CODE
  1113. self.msgGK.LM1 = item.CNAME
  1114. console.log(self.msgGK)
  1115. $(".detail-col").toggle("slow");
  1116. }
  1117. self.showSecond = function (obj, n) {
  1118. self.LM1 = obj.C_H_I_L_D_DATA;
  1119. $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
  1120. $(".detail-col").eq(1).show().autoHide()
  1121. }
  1122. self.checkAllUser1 = function () {
  1123. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  1124. $.each(self.UserList[self.filed], function (index, item) {
  1125. item.checked = self.AllChecked[self.filed];
  1126. $.each(item.USER, function (index1, item1) {
  1127. item1.checked = self.AllChecked[self.filed];
  1128. })
  1129. })
  1130. self.submitGK(1)
  1131. }
  1132. self.checkUserItem1 = function (item) {
  1133. item.checked = !item.checked;
  1134. $.each(item.USER, function (index, item1) {
  1135. item1.checked = item.checked;
  1136. })
  1137. var n = 0;
  1138. $.each(self.UserList[self.filed], function (index, item) {
  1139. if (item.checked == true) {
  1140. n++
  1141. }
  1142. })
  1143. if (n == self.UserList[self.filed].length) {
  1144. self.AllChecked[self.filed] = true;
  1145. } else {
  1146. self.AllChecked[self.filed] = false;
  1147. }
  1148. self.submitGK(1)
  1149. }
  1150. self.checkUser1 = function (item) {
  1151. item.checked = !item.checked;
  1152. var n = [], all = 0;
  1153. $.each(self.UserList[self.filed], function (x, y) {
  1154. n.push(0);
  1155. $.each(y.USER, function (x1, y1) {
  1156. if (y1.checked == true) {
  1157. n[x]++
  1158. }
  1159. })
  1160. if (n[x] == y.USER.length && n[x] != 0) {
  1161. y.checked = true;
  1162. all++
  1163. } else {
  1164. y.checked = false;
  1165. }
  1166. })
  1167. if (all == self.UserList[self.filed].length) {
  1168. self.AllChecked[self.filed] = true;
  1169. } else {
  1170. self.AllChecked[self.filed] = false;
  1171. }
  1172. self.submitGK(1)
  1173. }
  1174. self.submitGK = function (n) {
  1175. var AllCheckedLength = 0;
  1176. self.selectList[self.filed] = [];
  1177. $.each(self.UserList[self.filed], function (index, item) {
  1178. $.each(item.USER, function (index1, item1) {
  1179. if (item1.checked == true) {
  1180. AllCheckedLength++;
  1181. self.selectList[self.filed].push(item1)
  1182. }
  1183. })
  1184. })
  1185. self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
  1186. return item.USERID
  1187. }).join(",")
  1188. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  1189. if (n == 0) {
  1190. sp.layerhide();
  1191. var data = {
  1192. tablename: "SX_FBLIST",
  1193. data: {
  1194. WJLY: self.msgGK.WJLY,
  1195. FLOWID: self.msgGK.FLOWID,
  1196. FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
  1197. FBUSERID: self.msgGK.FBUSERID,
  1198. FBNAME: self.msgGK.FBNAME,
  1199. GKFW: self.msgGK.GKFW,
  1200. LM: self.msgGK.LM,
  1201. FBRQ: self.msgGK.FBRQ,
  1202. FBBM: self.msgGK.FBBM,
  1203. WJBT: self.msgGK.WJBT
  1204. }
  1205. }
  1206. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1207. .success(function (obj) {
  1208. var res = strToJson(s4.decryptData_CBC(obj.data));
  1209. sp.layerhide();
  1210. if (res.success) {
  1211. sp.dialog("操作成功!");
  1212. $timeout(function () {
  1213. sp.dialoghide();
  1214. }, 1000)
  1215. } else {
  1216. sp.dialog(res.message);
  1217. }
  1218. })
  1219. }
  1220. }
  1221. //头部下滚冻结
  1222. $(function () {
  1223. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1224. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  1225. //$("body").bind("scroll", function () {
  1226. // var scrollTop = $("body").scrollTop();
  1227. // if (scrollTop == 0) {
  1228. // $(".FixTop").removeClass("FixTop");
  1229. // }
  1230. // if (scrollTop > 35) {
  1231. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1232. // }
  1233. //});
  1234. //页面高度撑满
  1235. setTimeout(function () {
  1236. if ($(".ibox-content").height() < $(window).height() - 31) {
  1237. $(".ibox-content").css("height", $(window).height() - 31)
  1238. }
  1239. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1240. }, 1)
  1241. })
  1242. }])
  1243. app.filter('trustHtml', function ($sce) {
  1244. return function (input) {
  1245. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1246. };
  1247. });
  1248. //canvas画布签字
  1249. function lineCanvas(obj) {
  1250. var self = this;
  1251. self.linewidth = 1;
  1252. self.color = "#000000";
  1253. self.background = "#ffffff";
  1254. self.canvas = document.createElement("canvas");
  1255. document.getElementById(obj).appendChild(self.canvas);
  1256. self.cxt = self.canvas.getContext("2d");
  1257. self.canvas.width = document.getElementById(obj).clientWidth;
  1258. self.canvas.height = document.getElementById(obj).scrollHeight;
  1259. self.cxt.fillStyle = self.background;
  1260. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1261. self.cxt.strokeStyle = self.color;
  1262. self.cxt.lineWidth = self.linewidth;
  1263. self.cxt.lineCap = "round";
  1264. //开始绘制
  1265. self.canvas.addEventListener("mousedown", function (e) {
  1266. self.cxt.beginPath();
  1267. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1268. self.canvas.addEventListener("mousemove", move)
  1269. }.bind(self), false);
  1270. //绘制中
  1271. function move() {
  1272. var e = window.event;
  1273. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1274. self.cxt.stroke();
  1275. }
  1276. //结束绘制
  1277. self.canvas.addEventListener("mouseup", up)
  1278. function up() {
  1279. self.cxt.closePath();
  1280. self.canvas.removeEventListener("mousemove", move)
  1281. }
  1282. };
  1283. var parentData = {}
  1284. function getData() {
  1285. parentData = angular.element(document.getElementById("app")).scope().data
  1286. return parentData
  1287. }
  1288. function showToggle(e) {
  1289. $(e).children().toggle()
  1290. $(e).next().toggle()
  1291. }
  1292. function toggleYJL(e) {
  1293. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1294. $("#topDiv").css("height", 160)
  1295. $(e).parent().css("height", 450)
  1296. $("#attachlist").css("height", 200)
  1297. $("#bottomDiv").css("height", "")
  1298. } else {
  1299. $("#topDiv").css("height", 600)
  1300. $(e).parent().css("height", 10)
  1301. }
  1302. $(e).children().toggle()
  1303. }
  1304. app.directive('treeView', [function () {
  1305. return {
  1306. restrict: 'EA',
  1307. templateUrl: '/treeView.html',
  1308. scope: {
  1309. treeData: '=',///声明数据
  1310. textField: '@',
  1311. itemAdd: '&', ///声明新增变量
  1312. itemEdit: '&',///声明修改变量
  1313. itemCheck: '&',///声明修改变量
  1314. itemDelete: '&',///声明修改变量
  1315. itemUp: '&',
  1316. itemDown: '&'
  1317. },
  1318. controller: ['$scope', function ($scope) {
  1319. $scope.itemExpended = function (item, $event) {
  1320. item.$$isExpend = !item.$$isExpend;
  1321. $event.stopPropagation();
  1322. };
  1323. ///展开折叠图标设置
  1324. $scope.getItemIcon = function (item) {
  1325. var isEnd = $scope.isEnd(item);
  1326. if (isEnd) {
  1327. return 'fa fa-paper-plane-o';
  1328. }
  1329. return item.$$isExpend ? 'fa fa-plus-square-o' : 'fa fa-minus-square-o';
  1330. };
  1331. ///判断是否是最后一级菜单
  1332. $scope.isEnd = function (item) {
  1333. return !item.C_H_I_L_D_DATA || !item.C_H_I_L_D_DATA.length;
  1334. };
  1335. ///事件调用返回
  1336. $scope.warpCallback = function (callback, item, $event) {
  1337. ($scope[callback] || angular.noop)({
  1338. $item: item,
  1339. $event: $event
  1340. });
  1341. };
  1342. }]
  1343. };
  1344. }]);
  1345. function formate(n) {
  1346. return n > 9 ? n : "0" + n;
  1347. }
  1348. function isNull(str) {
  1349. if (str == "" || str == null || str == undefined) {
  1350. return false
  1351. } else {
  1352. return true
  1353. }
  1354. }