list.js 18 KB

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