list1.js 27 KB

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