list.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $interval, $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. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. }
  17. self.loading = false;
  18. self.loading_del = false;
  19. let nowDate = new Date()
  20. let y = nowDate.getFullYear()
  21. let m = nowDate.getMonth() + 1
  22. let d = nowDate.getDate()
  23. self.search = {
  24. startdate: sp.dateCount(0),//y + "-01-01",
  25. enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d),
  26. startdate_: sp.dateCount(0),//y + "-01-01",
  27. enddate_: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  28. }
  29. self.flows = [];
  30. self.test = [];
  31. self.getFlow = function () {
  32. var data = {
  33. userid: self.userId,
  34. ntops: 0//6
  35. }
  36. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  37. .success(function (obj) {
  38. var res = strToJson(s4.decryptData_CBC(obj.data));
  39. res.data.forEach(function (item) {
  40. if (item.FLOWID != "无") {
  41. self.flows.push(item.FLOWID)
  42. self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
  43. }
  44. })
  45. })
  46. }
  47. self.getFlow()
  48. self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
  49. self.noDataTip_del = 1; //没有数据时赋变量为0,先默认为1
  50. self.pageno = 1;
  51. self.total_count = 0;
  52. self.total_count_del = 0;
  53. self.itemsPerPage = 10;
  54. self.itemsPerPage_del = 100;
  55. self.pageOptions = [10, 20, 30, 40];
  56. self.getData = function (pageno) {
  57. self.loading = true;
  58. self.pageno = pageno;
  59. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  60. var data = {
  61. flowid: '',
  62. userid: self.userId,
  63. pageno: self.pageno,
  64. pagesize: self.itemsPerPage,
  65. querycondition: JSON.stringify([{
  66. CKIND: 'VARCHAR',
  67. TABLEID: 'SYS_ROUTE_VIEW',
  68. COLID: 'TITLE',
  69. VALUEA: self.search.title || '',
  70. }, {
  71. CKIND: 'DATETIME',
  72. TABLEID: 'SYS_ROUTE_VIEW',
  73. COLID: 'APPDATE',
  74. VALUEA: self.search.startdate_,
  75. VALUEB: self.search.enddate_,
  76. }])
  77. }
  78. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", {
  79. data: s4.encryptData_CBC(JSON.stringify(data))
  80. }, postCfg)
  81. .success(function (obj) {
  82. var res = strToJson(s4.decryptData_CBC(obj.data));
  83. self.loading = false;
  84. if (res.data == null || res.data == undefined || res.data == "") {
  85. self.noDataTip = 0;
  86. self.list = []
  87. } else {
  88. self.noDataTip = 1;
  89. res.data.forEach(function (item) {
  90. item.checked = false;
  91. if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') {
  92. item.STATUSINFO_CN = '在办'
  93. } else if (item.STATUSINFO == 'STOP') {
  94. item.STATUSINFO_CN = '办结'
  95. } else {
  96. item.STATUSINFO_CN = ''
  97. }
  98. item.userStr = ''
  99. item.TODOLIST.forEach(function (iitem) {
  100. iitem.USERS.forEach(function (iiitem) {
  101. iiitem.STATUS_CN = ''
  102. if (iiitem.STATUS == '0') {
  103. iiitem.STATUS_CN = '草稿'
  104. } else if (iiitem.STATUS == '1') {
  105. iiitem.STATUS_CN = '待办'
  106. } else if (iiitem.STATUS == '2') {
  107. iiitem.STATUS_CN = '在办'
  108. }
  109. if (iiitem.USERNAME && iiitem.STATUS_CN) {
  110. if (item.userStr) {
  111. item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN
  112. } else {
  113. item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_CN
  114. }
  115. }
  116. })
  117. })
  118. })
  119. self.list = res.data;
  120. self.total_count = res.meta.totalCount;
  121. }
  122. })
  123. }
  124. self.getData_del = function (pageno) {
  125. self.loading_del = true;
  126. var data = {
  127. userid: self.userId
  128. }
  129. $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengDeleted", {
  130. data: s4.encryptData_CBC(JSON.stringify(data))
  131. }, postCfg)
  132. // var data = {
  133. // flowid: '',
  134. // userid: self.userId,
  135. // pageno: 1,
  136. // pagesize: 20,
  137. // querycondition: [{
  138. // CKIND: 'VARCHAR',
  139. // TABLEID: 'SYS_ROUTE_VIEW',
  140. // COLID: 'TITLE',
  141. // VALUEA: self.search.title || '',
  142. // }, {
  143. // CKIND: 'DATETIME',
  144. // TABLEID: 'SYS_ROUTE_VIEW',
  145. // COLID: 'APPDATE',
  146. // VALUEA: self.search.startdate_,
  147. // VALUEB: self.search.enddate_,
  148. // }]
  149. // }
  150. // $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", {
  151. // data: s4.encryptData_CBC(JSON.stringify(data))
  152. // }, postCfg)
  153. .success(function (obj) {
  154. var res = strToJson(s4.decryptData_CBC(obj.data));
  155. self.loading_del = false;
  156. if (res.data == null || res.data == undefined || res.data == "") {
  157. self.noDataTip_del = 0;
  158. self.list_del = []
  159. } else {
  160. self.noDataTip_del = 1;
  161. res.data.forEach(function (item) {
  162. item.checked = false;
  163. if (item.STATUS == 'DEAL' || item.STATUS == 'START') {
  164. item.STATUSINFO_CN = '在办'
  165. } else if (item.STATUS == 'STOP') {
  166. item.STATUSINFO_CN = '办结'
  167. } else {
  168. item.STATUSINFO_CN = ''
  169. }
  170. })
  171. self.list_del = res.data;
  172. self.total_count_del = res.meta.totalCount;
  173. }
  174. })
  175. }
  176. self.load = function () {
  177. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  178. self.getData(self.pageno);
  179. } else {
  180. $timeout(function () {
  181. self.getData(self.get_lastReturnPageno);
  182. }, 1)
  183. }
  184. self.getData_del();
  185. }
  186. self.load();
  187. self.openSearch = function () {
  188. sp.layer("#Search")
  189. }
  190. self.doSearch = function () {
  191. self.getData(1);
  192. sp.layerhide()
  193. }
  194. self.cancal = function () {
  195. self.search = {
  196. keyword: "",
  197. startdate: "",
  198. enddate: ""
  199. }
  200. self.getData(1);
  201. sp.layerhide()
  202. }
  203. self.refresh = function () {
  204. self.getData(self.pageno);
  205. }
  206. self.checkAll = false;
  207. self.checkAllItem = function () {
  208. self.checkAll = !self.checkAll;
  209. self.list.forEach(function (item) {
  210. item.checked = self.checkAll;
  211. })
  212. }
  213. self.checkAll_del = false;
  214. self.checkAllItem_del = function () {
  215. self.checkAll_del = !self.checkAll_del;
  216. self.list_del.forEach(function (item) {
  217. item.checked = self.checkAll_del;
  218. })
  219. }
  220. self.btnDel = function () {
  221. var routeinfoids = [];
  222. self.list.forEach(function (item) {
  223. if (item.checked == true) {
  224. routeinfoids.push(item.ROUTEINFOID)
  225. }
  226. })
  227. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  228. var dialogBody = "<div class=\"sp-dialog-body\">您确认要删除吗?删除的数据将暂存回收站中</div>";
  229. 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>";
  230. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  231. sp.openCenter(".sp-dialog");
  232. ///取消按钮
  233. $('.sp-closeDialog').click(function (event) {
  234. sp.closeCenter(".sp-dialog");
  235. event.preventDefault();
  236. event.stopPropagation();
  237. });
  238. //post消息的id
  239. $("#delDataTrue").click(function () {
  240. var data = {
  241. routeinfoid: routeinfoids.join("|"),
  242. userid: self.userId
  243. }
  244. $http.post(apiurljs.login + "g2work/routeinfo/removeDraftToCacheByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  245. .success(function (obj) {
  246. var res = strToJson(s4.decryptData_CBC(obj.data));
  247. sp.dialoghide();
  248. if (res.success == true) {
  249. self.getData(self.pageno)
  250. self.getData_del()
  251. } else {
  252. sp.dialog(res.message)
  253. }
  254. })
  255. });
  256. }
  257. self.btnDel_del = function () {
  258. var routeinfoids = [];
  259. self.list_del.forEach(function (item) {
  260. if (item.checked == true) {
  261. routeinfoids.push(item.ROUTEINFOID)
  262. }
  263. })
  264. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  265. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  266. 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>";
  267. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  268. sp.openCenter(".sp-dialog");
  269. ///取消按钮
  270. $('.sp-closeDialog').click(function (event) {
  271. sp.closeCenter(".sp-dialog");
  272. event.preventDefault();
  273. event.stopPropagation();
  274. });
  275. //post消息的id
  276. $("#delDataTrue").click(function () {
  277. var data = {
  278. routeinfoid: routeinfoids.join("|"),
  279. userid: self.userId
  280. }
  281. $http.post(apiurljs.login + "g2work/routeinfo/deleteDraftByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  282. .success(function (obj) {
  283. var res = strToJson(s4.decryptData_CBC(obj.data));
  284. sp.dialoghide();
  285. if (res.success == true) {
  286. self.getData(self.pageno)
  287. } else {
  288. sp.dialog(res.message)
  289. }
  290. })
  291. });
  292. }
  293. self.refresh_del = function () {
  294. var routeinfoids = [];
  295. self.list_del.forEach(function (item) {
  296. if (item.checked == true) {
  297. routeinfoids.push(item.ROUTEINFOID)
  298. }
  299. })
  300. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  301. var dialogBody = "<div class=\"sp-dialog-body\">确认恢复选中的数据吗?</div>";
  302. 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>";
  303. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  304. sp.openCenter(".sp-dialog");
  305. ///取消按钮
  306. $('.sp-closeDialog').click(function (event) {
  307. sp.closeCenter(".sp-dialog");
  308. event.preventDefault();
  309. event.stopPropagation();
  310. });
  311. //post消息的id
  312. $("#delDataTrue").click(function () {
  313. var data = {
  314. routeinfoid: routeinfoids.join("|"),
  315. userid: self.userId
  316. }
  317. $http.post(apiurljs.login + "g2work/routeinfo/resumeDraftFromCacheByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  318. .success(function (obj) {
  319. var res = strToJson(s4.decryptData_CBC(obj.data));
  320. sp.dialoghide();
  321. if (res.success == true) {
  322. self.getData(self.pageno)
  323. self.getData_del()
  324. } else {
  325. sp.dialog(res.message)
  326. }
  327. })
  328. });
  329. }
  330. self.goUrl = function (obj) {
  331. let href = window.location.href
  332. let hrefArr = href.split('fontOA')
  333. if (hrefArr.length > 0) {
  334. self.test.forEach(function (item) {
  335. if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
  336. let FILENArr = item.FILEN.split('/')
  337. //AA18,AA16收文
  338. //A20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06行政发文
  339. //AA88,AA89,AA46,AA22,AA54党委发文
  340. //AA98,AA0A,AA99,AA0E,AA0P机关党委
  341. //AA65签报
  342. //AA95党委会议题呈报
  343. //AA0F党委会议方案
  344. //AA93委主任办公会议题呈报
  345. //AA97一般会议方案
  346. //AA0O因私出国申请
  347. //AA0S因私出国审批
  348. //AA0V报销凭证
  349. //AA0W公务接待清单
  350. //AA0X差旅费报销凭证
  351. //AA0Y环外出行报销凭证
  352. //AA1B常务会议题呈报
  353. //AA1C常务会会议纪要
  354. //AA1D巡察人才库审批
  355. //AA1E纪检组、纪委审核
  356. if ("AA18,AA16,AA20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06,AA88,AA89,AA46,AA22,AA54,AA98,AA0A,AA99,AA0E,AA0P,AA65,AA95,AA0F,AA93,AA97,AA0O,AA0S,AA1B,AA1C,AA1D,AA1E,AA0V,AA0W,AA0X,AA0Y".indexOf(obj.FLOWID) > -1) {
  357. sp.openNewWindow(hrefArr[0].replace("tpk", "tpl") + FILENArr[1] + '/' + obj.FILEN + "&dotype=1&gkbutton=1")
  358. } else {
  359. sp.openNewWindow(hrefArr[0].replace("tpk", "tpl") + FILENArr[1] + '/' + obj.FILEN)
  360. }
  361. }
  362. })
  363. }
  364. }
  365. //self.goUrl()
  366. //头部下滚冻结
  367. $(function () {
  368. //页面高度撑满
  369. setTimeout(function () {
  370. if ($(".ibox-content").height() < $(window).height() - 31) {
  371. $(".ibox-content").css("height", $(window).height() - 31)
  372. }
  373. }, 1)
  374. })
  375. }])
  376. app.filter('trustHtml', function ($sce) {
  377. return function (input) {
  378. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  379. };
  380. });