list.js 26 KB

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