list.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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. self.getflowids = sp.getUrlName("flowids")
  16. var postCfg = {
  17. headers: {
  18. 'Content-Type': 'application/json',
  19. 'Authorization': "Bearer " + self.get_AccessToken
  20. }
  21. }
  22. self.type = self.get_type != "" ? self.get_type : "todo";
  23. self.Url = getUrl(self.type);
  24. self.CrossPage = window.parent.CrossPage;
  25. self.loading = false;
  26. self.search = null//JSON.parse($.cookie("GlWorkPlatform-fawenbg"));
  27. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  28. self.pageno = 1;
  29. self.total_count = 0;
  30. self.itemsPerPage = 20;
  31. self.pageOptions = [20, 30, 40, 50, 100, 300, 500];
  32. self.getGWZL = function () {
  33. var data = {
  34. tablename: "CODE_GWTYPE",
  35. colums: "ID,CODE,CNAME,FLOWID",
  36. order: "ID desc",
  37. sqlwhere: {
  38. USEMARK: 1
  39. },
  40. sqlinwhere: { FLOWID: self.flowids.map(function (item) { return "'" + item.ID + "'" }).join(",") },
  41. sqllikewhere: ""
  42. }
  43. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  44. .success(function (obj) {
  45. var res = strToJson(s4.decryptData_CBC(obj.data));
  46. self.GWZL = res.data;
  47. self.getJJCD()
  48. })
  49. }
  50. self.getJJCD = function () {
  51. var data = {
  52. ckey: "CODE_EMERGENCY",
  53. routeinfoid: self.routeinfoid
  54. }
  55. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  56. .success(function (obj) {
  57. var res = strToJson(s4.decryptData_CBC(obj.data));
  58. self.JJCD = res.data.CODE_EMERGENCY;
  59. self.load()
  60. })
  61. }
  62. self.ordercondition = []
  63. self.flowids = [
  64. { ID: "AA20", NAME: "正式文-上行文", checked: false },
  65. { ID: "AA03", NAME: "正式文-平、下行文", checked: false },
  66. { ID: "AA10", NAME: "专报", checked: false },
  67. { ID: "AA55", NAME: "管委会办公室发文", checked: false },
  68. { ID: "AA56", NAME: "管委会发文稿纸", checked: false },
  69. { ID: "AA57", NAME: "规范性文件", checked: false },
  70. { ID: "AA08", NAME: "委发函", checked: false },
  71. { ID: "AA23", NAME: "审批件", checked: false },
  72. { ID: "AA77", NAME: "主任办公会议纪要", checked: false },
  73. { ID: "AA1C", NAME: "常务会会议纪要", checked: false },
  74. { ID: "AA06", NAME: "会议纪要", checked: false },
  75. ]
  76. if (self.getflowids != "") {
  77. self.flowids = self.flowids.filter(function (item) {
  78. if (self.getflowids.indexOf(item.ID) > -1) {
  79. return true
  80. }
  81. })
  82. }
  83. //self.flowids = [
  84. // { ID: "AA20", NAME: "正式文-上行文", checked: false },
  85. // { ID: "AA03", NAME: "正式文-平、下行文", checked: false },
  86. // { ID: "AA10", NAME: "专报", checked: false },
  87. // { ID: "AA55", NAME: "管委会办公室发文", checked: false },
  88. // { ID: "AA56", NAME: "管委会发文稿纸", checked: false },
  89. // { ID: "AA57", NAME: "规范性文件", checked: false },
  90. // { ID: "AA08", NAME: "委发函", checked: false },
  91. // { ID: "AA23", NAME: "审批件", checked: false },
  92. // { ID: "AA77", NAME: "主任办公会议纪要", checked: false },
  93. // { ID: "AA06", NAME: "会议纪要", checked: false },
  94. // { ID: "AA88", NAME: "党委正式文上行文", checked: false },
  95. // { ID: "AA89", NAME: "党委正式文下行文", checked: false },
  96. // { ID: "AA46", NAME: "党委会议纪要", checked: false },
  97. // { ID: "AA22", NAME: "党委其他文件", checked: false },
  98. // { ID: "AA54", NAME: "党委督查专报", checked: false },
  99. // { ID: "AA65", NAME: "签报单", checked: false }
  100. //]
  101. self.getData = function (pageno) {
  102. if (self.search == null) {
  103. self.search = {
  104. FLOW: [],
  105. JJCD: [],
  106. GWZL: [],
  107. TITLE: "",
  108. FWZH: "",
  109. DATE1: "",
  110. DATE2: "",
  111. NGRBM: '',
  112. NGR: '',
  113. ZS: ''
  114. }
  115. }
  116. var urlflowids = self.flowids.map(function (item) { return item.ID }).join("|");
  117. var flowids = self.search.FLOW.join("|");
  118. var querycondition = [];
  119. var columnscondition = [
  120. { COLID: "JJCD", COLUMNS: "FW_ZSWSXW.JJCD|FW_ZSWPXXW.JJCD|FW_ZB.JJCD|FW_GFXWJXGMRBM.JJCD|FW_WFH.JJCD|FW_SPJ.JJCD|FW_ZRBGHYJY.JJCD|FW_CWHHYJY.JJCD|FW_HYJY.JJCD" },
  121. { COLID: "GWZL", COLUMNS: "FW_ZSWSXW.GWZL|FW_ZSWPXXW.GWZL|FW_ZB.GWZL|FW_GWHBGSFW.FWZL|FW_GWHFWGZ.FWZL|FW_GFXWJXGMRBM.GWZL|FW_WFH.GWZL|FW_SPJ.GWZL|FW_ZRBGHYJY.GWZL|FW_CWHHYJY.GWZL|FW_HYJY.GWZL" },
  122. { COLID: "FWZH", COLUMNS: "FW_ZSWSXW.FWZH|FW_ZSWPXXW.FWZH|FW_ZB.FWZH|FW_GFXWJXGMRBM.FWZH|FW_WFH.FWZH|FW_SPJ.FWZH|FW_ZRBGHYJY.FWZH|FW_CWHHYJY.FWZH|FW_HYJY.FWZH" },
  123. { COLID: "NGRBM", COLUMNS: "FW_ZSWSXW.NGRBM|FW_ZSWPXXW.NGRBM|FW_ZB.NGRBM|FW_GWHBGSFW.NGRBM|FW_GWHFWGZ.NGRBM|FW_GFXWJXGMRBM.NGRBM|FW_WFH.NGRBM|FW_SPJ.NGRBM|FW_ZRBGHYJY.NGRBM|FW_CWHHYJY.NGRBM|FW_HYJY.NGRBM" },
  124. { COLID: "NGR", COLUMNS: "FW_ZSWSXW.NGR|FW_ZSWPXXW.NGR|FW_ZB.NGR|FW_GWHBGSFW.NGR|FW_GWHFWGZ.NGR|FW_GFXWJXGMRBM.NGR|FW_WFH.NGR|FW_SPJ.NGR|FW_ZRBGHYJY.NGR|FW_CWHHYJY.NGR|FW_HYJY.NGR" },
  125. { COLID: "ZS", COLUMNS: "FW_ZSWSXW.ZS|FW_ZSWPXXW.ZS|FW_ZB.ZS|FW_GWHBGSFW.ZS|FW_GWHFWGZ.ZS|FW_GFXWJXGMRBM.ZS|FW_WFH.ZS|FW_SPJ.ZS|FW_ZRBGHYJY.ZS|FW_CWHHYJY.ZS|FW_HYJY.ZS" }
  126. ]
  127. if (self.search.JJCD != "") {
  128. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "CODETABLE", "COLID": "JJCD", "VALUEA": self.search.JJCD.join(","), "VALUEB": "" })
  129. }
  130. if (self.search.GWZL != "") {
  131. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "CODETABLE", "COLID": "GWZL", "VALUEA": self.search.GWZL.join(","), "VALUEB": "" })
  132. }
  133. if (self.search.TITLE != "") {
  134. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "TITLE", "VALUEA": self.search.TITLE, "VALUEB": "" })
  135. }
  136. if (self.search.FWZH != "") {
  137. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "FWZH", "VALUEA": self.search.FWZH, "VALUEB": "" })
  138. }
  139. if (self.search.NGRBM != "") {
  140. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "NGRBM", "VALUEA": self.search.NGRBM, "VALUEB": "" })
  141. }
  142. if (self.search.NGR != "") {
  143. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "NGR", "VALUEA": self.search.NGR, "VALUEB": "" })
  144. }
  145. if (self.search.ZS != "") {
  146. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "ZS", "VALUEA": self.search.ZS, "VALUEB": "" })
  147. }
  148. if (self.params != "") {
  149. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE", "COLID": "ROUTEID", "VALUEA": self.params, "VALUEB": "" })
  150. }
  151. if (self.search.DATE1 != "" && self.search.DATE2 != "") {
  152. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": self.search.DATE1, "VALUEB": self.search.DATE2 })
  153. } else if (self.search.DATE1 != "" && self.search.DATE2 == "") {
  154. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": self.search.DATE1, "VALUEB": "" })
  155. } else if (self.search.DATE1 == "" && self.search.DATE2 != "") {
  156. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": "", "VALUEB": self.search.DATE2 })
  157. }
  158. self.list = [];
  159. self.loading = true;
  160. self.pageno = pageno;
  161. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  162. var data = {
  163. //flowid: "AA03|AA04|AA06|AA07|AA08|AA09|AA10|AA11|AA20|AA21|AA23|AA24|AA40|AA41|AA42|AA43|AA49|AA55|AA56|AA57|AA63|AA75|AA76|AA77|AA78|AA79|AA80",
  164. //flowid: flowids == "" ? "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA63|AA80|AA97" : flowids,
  165. //flowid: flowids == "" ? "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA65" : flowids,
  166. flowid: flowids != "" ? flowids : urlflowids != "" ? urlflowids : "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA1C|AA06",//"AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA06" : flowids,
  167. userid: self.userId,
  168. pageno: self.pageno,
  169. pagesize: self.itemsPerPage,
  170. columnscondition: JSON.stringify(columnscondition),
  171. querycondition: JSON.stringify(querycondition),
  172. ordercondition: self.ordercondition.length == 0 ? "" : JSON.stringify(self.ordercondition)
  173. }
  174. //$http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  175. $http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, data, postCfg)
  176. .success(function (obj) {
  177. var res = obj;
  178. //var res = strToJson(s4.decryptData_CBC(obj.data));
  179. self.loading = false;
  180. if (res.data == null || res.data == undefined || res.data == "") {
  181. self.noDataTip = 0;
  182. if (self.params != "") {
  183. self.params = "";
  184. self.getData(1)
  185. }
  186. } else {
  187. self.noDataTip = 1;
  188. self.list = res.data;
  189. self.total_count = res.totalCount;
  190. $.each(self.list, function (index, item) {
  191. self.JJCD.forEach(function (item1) {
  192. if (item.JJCD == item1.CODE)
  193. item.JJCD = item1.CNAME
  194. })
  195. self.GWZL.forEach(function (item1) {
  196. if (item.GWZL == item1.CODE)
  197. item.GWZL = item1.CNAME
  198. })
  199. if (item.FILEN != "") {
  200. 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;
  201. } else {
  202. item.FILEN = "#";
  203. }
  204. if (item.TODOLIST) {
  205. item.TODOLIST.forEach(function (item1) {
  206. if (item1.FILEN != "") {
  207. item1.FILEN = item1.FILEN.indexOf("dotype") > -1 ? item1.FILEN.replace("dotype=1", "dotype=" + getDoType(self.type)) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno + "&flowid=" + item.FLOWID : item1.FILEN + "&dotype=" + getDoType(self.type) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno + "&flowid=" + item.FLOWID;
  208. } else {
  209. item1.FILEN = "#";
  210. }
  211. })
  212. }
  213. if (self.type == "finish") {
  214. item.RECEIVEDATE = item.FINISHEDDATE;
  215. }
  216. })
  217. }
  218. if (self.CrossPage.type == 0) {
  219. self.journalRecord(self.CrossPage.ctime, sp.getLocalDate1(), "", "接入日志", window.location.pathname)
  220. }
  221. })
  222. }
  223. self.load = function () {
  224. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  225. self.getData(self.pageno);
  226. } else {
  227. $timeout(function () {
  228. self.getData(self.get_lastReturnPageno);
  229. }, 1)
  230. }
  231. }
  232. self.sortFiled = function (str) {
  233. var n = 0, obj, x = -1;
  234. self.ordercondition.forEach(function (item, index) {
  235. if (item.COLID == str) {
  236. n++
  237. item.SORTTYPE = item.SORTTYPE == "" || item.SORTTYPE == "asc" ? "desc" : "asc"
  238. obj = item; x = index
  239. }
  240. })
  241. if (n == 0) {
  242. self.ordercondition.unshift({ COLID: str, SORTTYPE: "desc" })
  243. }
  244. if (x != -1) {
  245. self.ordercondition.splice(x, 1)
  246. self.ordercondition.unshift(obj)
  247. }
  248. self.getData(1);
  249. }
  250. self.getGWZL();
  251. self.openLayer = function () {
  252. self.params = "";
  253. if (self.search == null) {
  254. self.search = {
  255. FLOW: [],
  256. JJCD: [],
  257. GWZL: [],
  258. TITLE: "",
  259. FWZH: "",
  260. DATE1: "",
  261. DATE2: "",
  262. NGRBM: '',
  263. NGR: '',
  264. ZS: ''
  265. }
  266. } else {
  267. self.flowids.forEach(function (item) {
  268. item.checked = false;
  269. if (self.search.FLOW.indexOf(item.ID) > -1) {
  270. item.checked = true;
  271. }
  272. })
  273. self.JJCD.forEach(function (item) {
  274. item.checked = false;
  275. if (self.search.JJCD.indexOf(item.CODE) > -1) {
  276. item.checked = true;
  277. }
  278. })
  279. self.GWZL.forEach(function (item) {
  280. item.checked = false;
  281. if (self.search.GWZL.indexOf(item.CODE) > -1) {
  282. item.checked = true;
  283. }
  284. })
  285. }
  286. sp.layer("#Search")
  287. }
  288. self.doSearch = function () {
  289. self.search.FLOW = [];
  290. self.flowids.forEach(function (item) {
  291. if (item.checked == true) {
  292. self.search.FLOW.push(item.ID)
  293. }
  294. })
  295. self.search.JJCD = [];
  296. self.JJCD.forEach(function (item) {
  297. if (item.checked == true) {
  298. self.search.JJCD.push(item.CODE)
  299. }
  300. })
  301. self.search.GWZL = [];
  302. self.GWZL.forEach(function (item) {
  303. if (item.checked == true) {
  304. self.search.GWZL.push(item.CODE)
  305. }
  306. })
  307. self.getData(self.pageno)
  308. sp.layerhide()
  309. }
  310. self.cancal = function () {
  311. self.search = {
  312. FLOW: [],
  313. JJCD: [],
  314. GWZL: [],
  315. TITLE: "",
  316. FWZH: "",
  317. DATE1: "",
  318. DATE2: "",
  319. NGRBM: '',
  320. NGR: '',
  321. ZS: ''
  322. }
  323. $.cookie("GlWorkPlatform-fawenbg", null, { path: '/', expires: 1 });
  324. self.getData(1)
  325. sp.layerhide()
  326. }
  327. self.refresh = function () {
  328. self.CrossPage.type = null;
  329. self.getData(self.pageno);
  330. }
  331. self.goUrl = function (item) {
  332. if (item.TODOLIST && item.TODOLIST.length > 1) {
  333. self.todoTitle = item.TITLE;
  334. self.todoList = item.TODOLIST;
  335. sp.layer("#todolist")
  336. } else {
  337. if (self.deviceType == "pad") {
  338. window.location.href = item.FILEN + "&dotype=" + getDoType(self.type)
  339. } else {
  340. sp.openNewWindow(item.FILEN + "&dotype=" + getDoType(self.type), item.TITLE)
  341. }
  342. sp.layerhide();
  343. }
  344. }
  345. self.btnDel = function (item) {
  346. var data = {
  347. routeinfoid: item.ROUTEINFOID,
  348. userid: self.userId
  349. }
  350. $http.post(apiurljs.login + "g2work/routeinfo/deleteDraftByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  351. .success(function (obj) {
  352. var res = strToJson(s4.decryptData_CBC(obj.data));
  353. if (res.success == true) {
  354. self.getData(self.pageno)
  355. } else {
  356. sp.dialog(res.message)
  357. }
  358. })
  359. }
  360. self.btnRecall = function (routeid, kind) {
  361. var data = {
  362. routeid: routeid,
  363. kind: kind,
  364. userid: self.userId
  365. }
  366. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRecallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  367. .success(function (obj) {
  368. var res = strToJson(s4.decryptData_CBC(obj.data));
  369. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  370. var dialogBody = "<div class=\"sp-dialog-body\">" + res.data.REMARK + "</div>";
  371. 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>";
  372. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  373. sp.openCenter(".sp-dialog");
  374. ///取消按钮
  375. $('.sp-closeDialog').click(function (event) {
  376. sp.closeCenter(".sp-dialog");
  377. event.preventDefault();
  378. event.stopPropagation();
  379. });
  380. //post消息的id
  381. $("#delDataTrue").click(function () {
  382. $http.post(apiurljs.login + "g2work/routeinfo/recallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  383. .success(function (obj) {
  384. var res = strToJson(s4.decryptData_CBC(obj.data));
  385. sp.dialoghide()
  386. if (res.success == true) {
  387. self.getData(self.pageno)
  388. } else {
  389. sp.dialog(res.message)
  390. }
  391. })
  392. });
  393. })
  394. }
  395. self.changeType = function (str) {
  396. if (self.type == str) {
  397. return;
  398. } else {
  399. var time1 = sp.getLocalDate1();
  400. self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/routeinfo/" + self.Url)
  401. self.type = str;
  402. self.Url = getUrl(self.type);
  403. self.getData(1)
  404. }
  405. }
  406. self.getAddFlag = function () {
  407. var data = {
  408. userid: self.userId,
  409. ntops: 0
  410. }
  411. $http.post(apiurljs.login + "g2work/desktop/queryWorkflowCando", data, postCfg)
  412. .success(function (obj) {
  413. var res = strToJson(s4.decryptData_CBC(obj.data));
  414. self.lcList = [];
  415. self.activeLC = {};
  416. var urlflowids = self.flowids.map(function (item) { return item.ID }).join("|");
  417. var flows = urlflowids != "" ? urlflowids : "AA20|AA03|AA10|AA55|AA56|AA57|AA08|AA23|AA77|AA1C|AA06";
  418. res.data.forEach(function (item) {
  419. //if ("AA03|AA04|AA06|AA07|AA08|AA09|AA10|AA11|AA20|AA21|AA23|AA24|AA40|AA41|AA42|AA43|AA49|AA55|AA56|AA57|AA63|AA75|AA76|AA77|AA78|AA79|AA80".indexOf(item.FLOWID) > -1) {
  420. if (flows.indexOf(item.FLOWID) > -1) {
  421. self.lcList.push(item);
  422. }
  423. })
  424. })
  425. }
  426. self.getAddFlag()
  427. self.addLC = function () {
  428. if (self.lcList.length == 1) {
  429. sp.openNewWindow(self.lcList[0].FILEN + "&dotype=1&GWCODE=" + self.activeLC.CODE + "&flowid=" + self.lcList[0].FLOWID, self.lcList[0].FLOWNAME)
  430. } else {
  431. //self.seeMB()
  432. sp.layer("#addLC");
  433. }
  434. }
  435. self.seeMB = function () {
  436. var postData = {
  437. convertType: 0,
  438. zoom: 0.8,
  439. fileUrl: apiurljs.login.split("glwork/")[0] + "glworkweb/templates/docfile/" + self.activeLC.DOCFILE
  440. };
  441. var postCfg_transfer = {
  442. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  443. transformRequest: function (data) {
  444. return $.param(data);
  445. }
  446. };
  447. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  448. .success(function (res) {
  449. if (res.errorcode === 0) {
  450. $("#iframe_MB").attr("src", res.data.viewUrl);
  451. } else {
  452. sp.dialog(res.message);
  453. }
  454. });
  455. }
  456. self.seeLCT = function (item, event) {
  457. event.preventDefault();
  458. event.stopPropagation();
  459. }
  460. self.goAddUrl = function () {
  461. if (!self.activeLC.FILEN) {
  462. return
  463. }
  464. sp.openNewWindow(self.activeLC.FILEN + "&dotype=1&GWCODE=" + self.activeLC.CODE + "&flowid=" + self.activeLC.FLOWID, self.activeLC.FLOWNAME)
  465. sp.layerhide()
  466. }
  467. self.printEXCEL = function () {
  468. self.columns = [
  469. { header: "紧急程度", key: "JJCD", width: 20 },
  470. { header: "公文种类", key: "GWZL", width: 20 },
  471. { header: "标题", key: "TITLE", width: 100 },
  472. { header: "发文字号", key: "FWZH", width: 20 },
  473. { header: "主办处室", key: "NGRBM", width: 20 },
  474. { header: "拟稿人", key: "NGR", width: 20 },
  475. { header: "上一节点转办时间", key: "RECEIVEDATE", width: 25 }
  476. ]
  477. self.listExcel = self.list.map(function (item) {
  478. return {
  479. JJCD: item.JJCD,
  480. GWZL: item.GWZL,
  481. TITLE: item.TITLE,
  482. FWZH: item.FWZH,
  483. NGRBM: item.NGRBM,
  484. NGR: item.NGR,
  485. RECEIVEDATE: item.RECEIVEDATE
  486. }
  487. })
  488. // 创建工作簿
  489. var workbook = new ExcelJS.Workbook()
  490. // 添加工作表
  491. var worksheet = workbook.addWorksheet('sheet1')
  492. // 设置表头
  493. worksheet.columns = self.columns
  494. // 添加表体数据
  495. self.listExcel.forEach(function (item) {
  496. worksheet.addRow(item)
  497. })
  498. /**
  499. * 设置样式
  500. */
  501. // 1、设置标题行样式
  502. var headerRow = worksheet.getRow(1)
  503. // 连续遍历所有非空单元格
  504. headerRow.eachCell(function (cell) {
  505. // 边框 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E8%BE%B9%E6%A1%86
  506. cell.border = {
  507. top: {
  508. style: 'thin'
  509. },
  510. left: {
  511. style: 'thin'
  512. },
  513. bottom: {
  514. style: 'thin'
  515. },
  516. right: {
  517. style: 'thin'
  518. },
  519. }
  520. // 填充 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%A1%AB%E5%85%85
  521. cell.fill = {
  522. type: 'pattern',
  523. pattern: 'solid',
  524. fgColor: {
  525. argb: '4f81bd'
  526. }
  527. }
  528. // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
  529. cell.font = {
  530. name: '微软雅黑',
  531. size: 11,
  532. bold: true,
  533. color: { argb: '000000' }
  534. }
  535. // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
  536. cell.alignment = {
  537. vertical: 'middle',
  538. horizontal: 'center'
  539. }
  540. })
  541. // 2、设置内容行样式
  542. const bodyRow = worksheet.getRows(2, self.listExcel.length + 1)
  543. bodyRow.forEach(function (row) {
  544. //遍历此列中的所有当前单元格,包括空单元格
  545. row.eachCell({ includeEmpty: true }, function (cell) {
  546. // 边框
  547. cell.border = {
  548. top: {
  549. style: 'thin'
  550. },
  551. left: {
  552. style: 'thin'
  553. },
  554. bottom: {
  555. style: 'thin'
  556. },
  557. right: {
  558. style: 'thin'
  559. },
  560. }
  561. // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
  562. cell.font = {
  563. name: '微软雅黑',
  564. size: 11,
  565. color: { argb: '000000' }
  566. }
  567. // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
  568. cell.alignment = {
  569. vertical: 'middle',
  570. horizontal: 'center'
  571. }
  572. })
  573. })
  574. // 导出表格
  575. workbook.xlsx.writeBuffer().then(function (buffer) {
  576. const blob = new Blob([buffer], {
  577. type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  578. })
  579. const link = document.createElement('a')
  580. link.href = URL.createObjectURL(blob)
  581. link.download = '行政公文' + sp.format(sp.getLocalDate()) + '.xlsx'
  582. link.click()
  583. URL.revokeObjectURL(link.href) // 下载完成释放掉blob对象
  584. })
  585. //})
  586. }
  587. //记录日志
  588. self.journalRecord = function (time1, time2, title, func, url) {
  589. if (!self.CrossPage || !self.CrossPage.cname) { return; }
  590. var data = {
  591. tablename: "SYS_CLICKLOG",
  592. data: {
  593. CTIME: time1 == null ? sp.getLocalDate1() : time1,
  594. TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
  595. REQUESTURL: url,
  596. REQUESTHEADERURL: window.location.origin,
  597. LOGTYPE: func,
  598. USERTYPE: $.cookie("GlWorkPlatform-userType"),
  599. ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
  600. CLIENTIP: sp.myIP(),
  601. PCNAME: sp.detectOS(),
  602. BROWSERNAME: sp.browser(),
  603. RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
  604. USERID: self.userId,
  605. USERNAME: self.userName
  606. }
  607. }
  608. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  609. .success(function (res) {
  610. self.CrossPage.type = 1;
  611. })
  612. }
  613. localStorage.removeItem("GlWorkPlatform-fawenbg-refresh")
  614. $interval(function () {
  615. if (localStorage.getItem("GlWorkPlatform-fawenbg-refresh") == 1) {
  616. localStorage.removeItem("GlWorkPlatform-fawenbg-refresh")
  617. self.refresh()
  618. }
  619. }, 1000)
  620. //头部下滚冻结
  621. $(function () {
  622. //页面高度撑满
  623. setTimeout(function () {
  624. if ($(".ibox-content").height() < $(window).height() - 31) {
  625. $(".ibox-content").css("height", $(window).height() - 31)
  626. }
  627. }, 1)
  628. })
  629. }])
  630. function getUrl(str) {
  631. switch (str) {
  632. case "todo":
  633. return "queryDataTodoWithPage";
  634. break;
  635. case "done":
  636. return "queryDataDoneWithPage";
  637. break;
  638. case "finish":
  639. return "queryDataFinishWithPage";
  640. break;
  641. }
  642. }
  643. function getDoType(str) {
  644. switch (str) {
  645. case "todo":
  646. return 1;
  647. break;
  648. default:
  649. return 0;
  650. break;
  651. }
  652. }