list.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$interval", function ($scope, $http, $timeout, $interval) {
  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.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  12. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  13. self.get_type = sp.getUrlName("type");
  14. self.params = sp.getUrlName("params");
  15. var postCfg = {
  16. headers: {
  17. 'Content-Type': 'application/json',
  18. 'Authorization': "Bearer " + self.get_AccessToken
  19. }
  20. }
  21. self.type = self.get_type != "" ? self.get_type : "todo";
  22. self.Url = getUrl(self.type);
  23. self.CrossPage = window.parent.CrossPage;
  24. self.loading = false;
  25. self.search = null//JSON.parse($.cookie("GlWorkPlatform-xinfangbg"));
  26. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  27. self.pageno = 1;
  28. self.total_count = 0;
  29. self.itemsPerPage = 10;
  30. self.pageOptions = [10, 20, 30, 40];
  31. self.getXFFS = function () {
  32. var data = {
  33. ckey: "CODE_XFFS",
  34. routeinfoid: self.routeinfoid
  35. }
  36. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  37. .success(function (obj) {
  38. var res = strToJson(s4.decryptData_CBC(obj.data));
  39. self.XFFS = res.data.CODE_XFFS;
  40. self.getBHZL()
  41. })
  42. }
  43. self.getBHZL = function () {
  44. var data = {
  45. ckey: "CODE_BHZL",
  46. routeinfoid: self.routeinfoid
  47. }
  48. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  49. .success(function (obj) {
  50. var res = strToJson(s4.decryptData_CBC(obj.data));
  51. self.BHZL = res.data.CODE_BHZL;
  52. self.getWTFL()
  53. })
  54. }
  55. self.getWTFL = function () {
  56. var data = {
  57. ckey: "CODE_WTFL",
  58. routeinfoid: self.routeinfoid
  59. }
  60. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  61. .success(function (obj) {
  62. var res = strToJson(s4.decryptData_CBC(obj.data));
  63. self.WTFL = res.data.CODE_WTFL;
  64. self.load()
  65. })
  66. }
  67. self.ordercondition = []
  68. self.getData = function (pageno) {
  69. if (self.search == null) {
  70. self.search = {
  71. XFFS: "",
  72. BHZL: "",
  73. XM: "",
  74. WJH: "",
  75. WTZY: "",
  76. WTFL: "",
  77. CBDWBM: "",
  78. JFLXRQ1: "",
  79. JFLXRQ2: "",
  80. DATE1: "",
  81. DATE2: "",
  82. BJRQ1: "",
  83. BJRQ2: ""
  84. }
  85. }
  86. var querycondition = [];
  87. var columnscondition = [
  88. { COLID: "XFFS", COLUMNS: "SX_XF.XFFS" },
  89. { COLID: "BHZL", COLUMNS: "SX_XF.BHZL" },
  90. { COLID: "XM", COLUMNS: "SX_XF.XM" },
  91. { COLID: "WJH", COLUMNS: "SX_XF.WJH" },
  92. { COLID: "WTZY", COLUMNS: "SX_XF.WTZY" },
  93. { COLID: "WTFL", COLUMNS: "SX_XF.WTFL" },
  94. { COLID: "JFLXRQ", COLUMNS: "TO_CHAR(SX_XF.JFLXRQ)" },
  95. { COLID: "CBDWBM", COLUMNS: "SX_XF.CBDWBM" },
  96. { COLID: "YQBJRQ", COLUMNS: "TO_CHAR(SX_XF.YQBJRQ)" }
  97. ]
  98. if (self.search.XFFS != "") {
  99. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "CODETABLE", "COLID": "XFFS", "VALUEA": self.search.XFFS.join(","), "VALUEB": "" })
  100. }
  101. if (self.search.BHZL != "") {
  102. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "BHZL", "VALUEA": self.search.BHZL, "VALUEB": "" })
  103. }
  104. if (self.search.XM != "") {
  105. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "XM", "VALUEA": self.search.XM, "VALUEB": "" })
  106. }
  107. if (self.search.WJH != "") {
  108. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "WJH", "VALUEA": self.search.WJH, "VALUEB": "" })
  109. }
  110. if (self.search.WTZY != "") {
  111. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "WTZY", "VALUEA": self.search.WTZY, "VALUEB": "" })
  112. }
  113. if (self.search.WTFL != "") {
  114. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "WTFL", "VALUEA": self.search.WTFL, "VALUEB": "" })
  115. }
  116. if (self.search.CBDWBM != "") {
  117. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "CBDWBM", "VALUEA": self.search.CBDWBM, "VALUEB": "" })
  118. }
  119. if (self.params != "") {
  120. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE", "COLID": "ROUTEID", "VALUEA": self.params, "VALUEB": "" })
  121. }
  122. if (self.search.JFLXRQ1 != "" && self.search.JFLXRQ2 != "") {
  123. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": self.search.JFLXRQ1, "VALUEB": self.search.JFLXRQ2 })
  124. } else if (self.search.JFLXRQ1 != "" && self.search.JFLXRQ2 == "") {
  125. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": self.search.JFLXRQ1, "VALUEB": "" })
  126. } else if (self.search.JFLXRQ1 == "" && self.search.JFLXRQ2 != "") {
  127. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": "", "VALUEB": self.search.JFLXRQ2 })
  128. }
  129. if (self.search.DATE1 != "" && self.search.DATE2 != "") {
  130. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": self.search.DATE1, "VALUEB": self.search.DATE2 })
  131. } else if (self.search.DATE1 != "" && self.search.DATE2 == "") {
  132. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": self.search.DATE1, "VALUEB": "" })
  133. } else if (self.search.DATE1 == "" && self.search.DATE2 != "") {
  134. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "CODETABLE", "COLID": "YQBJRQ", "VALUEA": "", "VALUEB": self.search.DATE2 })
  135. }
  136. if (self.search.BJRQ1 != "" && self.search.BJRQ2 != "") {
  137. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "BJRQ", "VALUEA": self.search.BJRQ1, "VALUEB": self.search.BJRQ2 })
  138. } else if (self.search.BJRQ1 != "" && self.search.BJRQ2 == "") {
  139. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "BJRQ", "VALUEA": self.search.BJRQ1, "VALUEB": "" })
  140. } else if (self.search.BJRQ1 == "" && self.search.BJRQ2 != "") {
  141. querycondition.push({ "CKIND": "JFLXRQTIME", "TABLEID": "CODETABLE", "COLID": "BJRQ", "VALUEA": "", "VALUEB": self.search.BJRQ2 })
  142. }
  143. self.list = [];
  144. self.loading = false;
  145. self.pageno = pageno;
  146. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  147. var data = {
  148. flowid: "AA12",
  149. userid: self.userId,
  150. pageno: self.pageno,
  151. pagesize: self.itemsPerPage,
  152. columnscondition: JSON.stringify(columnscondition),
  153. querycondition: JSON.stringify(querycondition),
  154. ordercondition: self.ordercondition.length == 0 ? "" : JSON.stringify(self.ordercondition)
  155. }
  156. //$http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  157. $http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, data, postCfg)
  158. .success(function (obj) {
  159. var res = obj;
  160. //var res = strToJson(s4.decryptData_CBC(obj.data));
  161. self.loading = false;
  162. if (res.data == null || res.data == undefined || res.data == "") {
  163. self.noDataTip = 0;
  164. if (self.params != "") {
  165. self.params = "";
  166. self.getData(1)
  167. }
  168. } else {
  169. self.noDataTip = 1;
  170. self.list = res.data;
  171. self.total_count = res.totalCount;
  172. $.each(self.list, function (index, item) {
  173. self.XFFS.forEach(function (item1) {
  174. if (item.XFFS == item1.CODE)
  175. item.XFFS = item1.CNAME
  176. })
  177. self.BHZL.forEach(function (item1) {
  178. if (item.BHZL == item1.CODE)
  179. item.BHZL = item1.CNAME
  180. })
  181. self.WTFL.forEach(function (item1) {
  182. if (item.WTFL == item1.CODE)
  183. item.WTFL = item1.CNAME
  184. })
  185. if (item.FILEN != "") {
  186. item.FILEN = item.FILEN.indexOf("dotype") > -1 ? item.FILEN.replace("dotype=1", "dotype=" + getDoType(self.type)) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno : item.FILEN + "&dotype=" + getDoType(self.type) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno;
  187. } else {
  188. item.FILEN = "#";
  189. }
  190. if (self.type == "finish") {
  191. item.RECEIVEDATE = item.FINISHEDDATE;
  192. }
  193. })
  194. }
  195. if (self.CrossPage.type == 0) {
  196. self.journalRecord(self.CrossPage.ctime, sp.getLocalDate1(), "", "接入日志", window.location.pathname)
  197. }
  198. })
  199. }
  200. self.load = function () {
  201. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  202. self.getData(self.pageno);
  203. } else {
  204. $timeout(function () {
  205. self.getData(self.get_lastReturnPageno);
  206. }, 1)
  207. }
  208. }
  209. self.sortFiled = function (str) {
  210. var n = 0, obj, x = -1;
  211. self.ordercondition.forEach(function (item, index) {
  212. if (item.COLID == str) {
  213. n++
  214. item.SORTTYPE = item.SORTTYPE == "" || item.SORTTYPE == "asc" ? "desc" : "asc"
  215. obj = item; x = index
  216. }
  217. })
  218. if (n == 0) {
  219. self.ordercondition.unshift({ COLID: str, SORTTYPE: "desc" })
  220. }
  221. if (x != -1) {
  222. self.ordercondition.splice(x, 1)
  223. self.ordercondition.unshift(obj)
  224. }
  225. self.getData(1);
  226. }
  227. self.getXFFS();
  228. self.openLayer = function () {
  229. self.params = "";
  230. if (self.search == null) {
  231. self.search = {
  232. XFFS: "",
  233. BHZL: "",
  234. XM: "",
  235. WJH: "",
  236. WTZY: "",
  237. WTFL: "",
  238. CBDWBM: "",
  239. JFLXRQ1: "",
  240. JFLXRQ2: "",
  241. DATE1: "",
  242. DATE2: "",
  243. BJRQ1: "",
  244. BJRQ2: ""
  245. }
  246. } else {
  247. self.XFFS.forEach(function (item) {
  248. item.checked = false;
  249. if (self.search.XFFS.indexOf(item.CODE) > -1) {
  250. item.checked = true;
  251. }
  252. })
  253. }
  254. sp.layer("#Search")
  255. }
  256. self.doSearch = function () {
  257. self.search.XFFS = [];
  258. self.XFFS.forEach(function (item) {
  259. if (item.checked == true) {
  260. self.search.XFFS.push(item.CODE)
  261. }
  262. })
  263. $.cookie("GlWorkPlatform-xinfangbg", JSON.stringify(self.search), { path: '/', expires: 1 });
  264. self.getData(self.pageno)
  265. sp.layerhide()
  266. }
  267. self.cancal = function () {
  268. self.search = {
  269. XFFS: "",
  270. BHZL: "",
  271. XM: "",
  272. WJH: "",
  273. WTZY: "",
  274. WTFL: "",
  275. CBDWBM: "",
  276. JFLXRQ1: "",
  277. JFLXRQ2: "",
  278. DATE1: "",
  279. DATE2: "",
  280. BJRQ1: "",
  281. BJRQ2: ""
  282. }
  283. $.cookie("GlWorkPlatform-xinfangbg", null, { path: '/', expires: 1 });
  284. self.getData(1)
  285. sp.layerhide()
  286. }
  287. self.refresh = function () {
  288. self.CrossPage.type = null;
  289. self.getData(self.pageno);
  290. }
  291. self.goUrl = function (item) {
  292. if (item.TODOLIST && item.TODOLIST.length > 1) {
  293. self.todoTitle = item.TITLE;
  294. self.todoList = item.TODOLIST;
  295. sp.layer("#todolist")
  296. } else {
  297. if (self.deviceType == "pad") {
  298. window.location.href = item.FILEN + "&dotype=" + getDoType(self.type)
  299. } else {
  300. sp.openNewWindow(item.FILEN + "&dotype=" + getDoType(self.type), item.TITLE)
  301. }
  302. sp.layerhide();
  303. }
  304. }
  305. self.btnDel = function (item) {
  306. var data = {
  307. routeinfoid: item.ROUTEINFOID,
  308. userid: self.userId
  309. }
  310. $http.post(apiurljs.login + "g2work/routeinfo/deleteDraftByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  311. .success(function (obj) {
  312. var res = strToJson(s4.decryptData_CBC(obj.data));
  313. if (res.success == true) {
  314. self.getData(self.pageno)
  315. } else {
  316. sp.dialog(res.message)
  317. }
  318. })
  319. }
  320. self.btnRecall = function (routeid, kind) {
  321. var data = {
  322. routeid: routeid,
  323. kind: kind,
  324. userid: self.userId
  325. }
  326. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRecallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  327. .success(function (obj) {
  328. var res = strToJson(s4.decryptData_CBC(obj.data));
  329. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  330. var dialogBody = "<div class=\"sp-dialog-body\">" + res.data.REMARK + "</div>";
  331. 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>";
  332. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  333. sp.openCenter(".sp-dialog");
  334. ///取消按钮
  335. $('.sp-closeDialog').click(function (event) {
  336. sp.closeCenter(".sp-dialog");
  337. event.preventDefault();
  338. event.stopPropagation();
  339. });
  340. //post消息的id
  341. $("#delDataTrue").click(function () {
  342. $http.post(apiurljs.login + "g2work/routeinfo/recallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  343. .success(function (obj) {
  344. var res = strToJson(s4.decryptData_CBC(obj.data));
  345. sp.dialoghide()
  346. if (res.success == true) {
  347. self.getData(self.pageno)
  348. } else {
  349. sp.dialog(res.message)
  350. }
  351. })
  352. });
  353. })
  354. }
  355. self.changeType = function (str) {
  356. if (self.type == str) {
  357. return;
  358. } else {
  359. var time1 = sp.getLocalDate1();
  360. self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/routeinfo/" + self.Url)
  361. self.type = str;
  362. self.Url = getUrl(self.type);
  363. self.getData(1)
  364. }
  365. }
  366. self.getAddFlag = function () {
  367. var data = {
  368. userid: self.userId,
  369. ntops: 0
  370. }
  371. $http.post(apiurljs.login + "g2work/desktop/queryWorkflowCando", data, postCfg)
  372. .success(function (obj) {
  373. var res = strToJson(s4.decryptData_CBC(obj.data));
  374. self.lcList = [];
  375. self.activeLC = {};
  376. res.data.forEach(function (item) {
  377. if ("AA12".indexOf(item.FLOWID) > -1) {
  378. self.lcList.push(item);
  379. }
  380. })
  381. })
  382. }
  383. self.getAddFlag()
  384. self.addLC = function () {
  385. if (self.lcList.length == 1) {
  386. sp.openNewWindow(self.lcList[0].FILEN + "&dotype=1&flowid=" + self.lcList[0].FLOWID, self.lcList[0].FLOWNAME)
  387. } else {
  388. sp.layer("#addLC");
  389. }
  390. }
  391. self.seeLCT = function (item,event) {
  392. event.preventDefault();
  393. event.stopPropagation();
  394. }
  395. self.goAddUrl = function () {
  396. if (!self.activeLC.FILEN) {
  397. return
  398. }
  399. sp.openNewWindow(self.activeLC.FILEN + "&dotype=1&flowid=" + self.activeLC.FLOWID, self.activeLC.FLOWNAME)
  400. sp.layerhide()
  401. }
  402. //记录日志
  403. self.journalRecord = function (time1, time2, title, func, url) {
  404. if (!self.CrossPage || !self.CrossPage.cname) { return; }
  405. var data = {
  406. tablename: "SYS_CLICKLOG",
  407. data: {
  408. CTIME: time1 == null ? sp.getLocalDate1() : time1,
  409. TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
  410. REQUESTURL: url,
  411. REQUESTHEADERURL: window.location.origin,
  412. LOGTYPE: func,
  413. USERTYPE: $.cookie("GlWorkPlatform-userType"),
  414. ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
  415. CLIENTIP: sp.myIP(),
  416. PCNAME: sp.detectOS(),
  417. BROWSERNAME: sp.browser(),
  418. RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
  419. USERID: self.userId,
  420. USERNAME: self.userName
  421. }
  422. }
  423. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  424. .success(function (res) {
  425. self.CrossPage.type = 1;
  426. })
  427. }
  428. $interval(function () {
  429. if (localStorage.getItem("GlWorkPlatform-xinfangbg-refresh") == 1) {
  430. localStorage.removeItem("GlWorkPlatform-xinfangbg-refresh")
  431. self.refresh()
  432. }
  433. }, 1000)
  434. //头部下滚冻结
  435. $(function () {
  436. //页面高度撑满
  437. setTimeout(function () {
  438. if ($(".ibox-content").height() < $(window).height() - 31) {
  439. $(".ibox-content").css("height", $(window).height() - 31)
  440. }
  441. }, 1)
  442. })
  443. }])
  444. function getUrl(str) {
  445. switch (str) {
  446. case "todo":
  447. return "queryDataTodoWithPage";
  448. break;
  449. case "done":
  450. return "queryDataDoneWithPage";
  451. break;
  452. case "finish":
  453. return "queryDataFinishWithPage";
  454. break;
  455. }
  456. }
  457. function getDoType(str) {
  458. switch (str) {
  459. case "todo":
  460. return 1;
  461. break;
  462. default:
  463. return 0;
  464. break;
  465. }
  466. }