list.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", "$interval", function ($scope, $http, $timeout, $interval) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.cookie("GlWorkPlatform-chineseName");
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  12. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  13. self.get_type = sp.getUrlName("type");
  14. self.params = sp.getUrlName("params");
  15. var postCfg = {
  16. headers: {
  17. 'Content-Type': 'application/json',
  18. 'Authorization': "Bearer " + self.get_AccessToken
  19. }
  20. }
  21. self.type = self.get_type != "" ? self.get_type : "todo";
  22. self.Url = getUrl(self.type);
  23. self.CrossPage = window.parent.CrossPage;
  24. self.loading = false;
  25. self.search = null//JSON.parse($.cookie("GlWorkPlatform-shouwenbg"));
  26. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  27. self.pageno = 1;
  28. self.total_count = 0;
  29. self.itemsPerPage = 10;
  30. self.pageOptions = [10, 20, 30, 40, 50, 100, 300, 500];
  31. self.getJJQK = function () {
  32. var data = {
  33. ckey: "CODE_EMERGENCY",
  34. routeinfoid: self.routeinfoid
  35. }
  36. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  37. .success(function (obj) {
  38. var res = strToJson(s4.decryptData_CBC(obj.data));
  39. self.JJQK = res.data.CODE_EMERGENCY;
  40. self.load()
  41. })
  42. }
  43. self.ordercondition = [];
  44. self.flowids = [{ ID: "AA18", NAME: "一般收文", checked: false }, { ID: "AA16", NAME: "领导批示", checked: false }]
  45. self.getData = function (pageno) {
  46. if (self.search == null) {
  47. self.search = {
  48. FLOW: [],
  49. TITLE: "",
  50. JJCD: "",
  51. DATE1: "",
  52. DATE2: "",
  53. SWBH: '',
  54. LWDW: '',
  55. LWWH: '',
  56. LWRQ: ''
  57. }
  58. }
  59. var flowids = self.search.FLOW.join("|");
  60. var querycondition = [];
  61. var columnscondition = [
  62. { COLID: "JJCD", COLUMNS: "SW_LDPSCBD.JJCD|SW_ZJWWJCBD.JJCD" },
  63. { COLID: "SWBH", COLUMNS: "SW_LDPSCBD.SWBH|SW_ZJWWJCBD.SWBH" },
  64. { COLID: "LWDW", COLUMNS: "SW_LDPSCBD.LWDW|SW_ZJWWJCBD.LWDW" },
  65. { COLID: "LWWH", COLUMNS: "SW_LDPSCBD.LWWH|SW_ZJWWJCBD.LWWH" },
  66. { COLID: "LWRQ", COLUMNS: "SW_LDPSCBD.TO_CHAR(LWRQ)|SW_ZJWWJCBD.TO_CHAR(LWRQ)" },
  67. { COLID: "DBSX", COLUMNS: "SW_LDPSCBD.DBSX|SW_ZJWWJCBD.DBSX" },
  68. { COLID: "DBLX", COLUMNS: "SW_LDPSCBD.ZDDB|SW_ZJWWJCBD.DBLX" }
  69. ]
  70. if (self.search.TITLE != "") {
  71. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "TITLE", "VALUEA": self.search.TITLE, "VALUEB": "" })
  72. }
  73. if (self.search.JJCD != "") {
  74. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "CODETABLE", "COLID": "JJCD", "VALUEA": self.search.JJCD.join(","), "VALUEB": "" })
  75. }
  76. if (self.search.SWBH != "") {
  77. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "SWBH", "VALUEA": self.search.SWBH, "VALUEB": "" })
  78. }
  79. if (self.search.LWDW != "") {
  80. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "LWDW", "VALUEA": self.search.LWDW, "VALUEB": "" })
  81. }
  82. if (self.search.LWWH != "") {
  83. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "LWWH", "VALUEA": self.search.LWWH, "VALUEB": "" })
  84. }
  85. if (self.search.LWRQ != "") {
  86. querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "CODETABLE", "COLID": "LWRQ", "VALUEA": self.search.LWRQ, "VALUEB": "" })
  87. }
  88. if (self.params != "") {
  89. querycondition.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE", "COLID": "ROUTEID", "VALUEA": self.params, "VALUEB": "" })
  90. }
  91. if (self.search.DATE1 != "" && self.search.DATE2 != "") {
  92. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": self.search.DATE1, "VALUEB": self.search.DATE2 })
  93. } else if (self.search.DATE1 != "" && self.search.DATE2 == "") {
  94. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": self.search.DATE1, "VALUEB": ""})
  95. } else if (self.search.DATE1 == "" && self.search.DATE2 != "") {
  96. querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_ROUTE_VIEW", "COLID": "RECEIVEDATE", "VALUEA": "", "VALUEB": self.search.DATE2 })
  97. }
  98. self.list = [];
  99. self.loading = true;
  100. self.pageno = pageno;
  101. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  102. var data = {
  103. flowid: flowids == "" ? "AA18|AA16" : flowids,
  104. userid: self.userId,
  105. pageno: self.pageno,
  106. pagesize: self.itemsPerPage,
  107. columnscondition: JSON.stringify(columnscondition),
  108. querycondition: JSON.stringify(querycondition),
  109. ordercondition: self.ordercondition.length == 0 ? "" : JSON.stringify(self.ordercondition)
  110. }
  111. //$http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  112. $http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, data, postCfg)
  113. .success(function (obj) {
  114. var res = obj;
  115. //var res = strToJson(s4.decryptData_CBC(obj.data));
  116. self.loading = false;
  117. if (res.data == null || res.data == undefined || res.data == "") {
  118. self.noDataTip = 0;
  119. if (self.params != "") {
  120. self.params = "";
  121. self.getData(1)
  122. }
  123. } else {
  124. self.noDataTip = 1;
  125. self.list = res.data;
  126. self.total_count = res.totalCount;
  127. $.each(self.list, function (index, item) {
  128. item.LWRQ = sp.format(item.LWRQ);
  129. self.JJQK.forEach(function (item1) {
  130. if (item.JJCD == item1.CODE) {
  131. item.JJCD = item1.CNAME
  132. }
  133. })
  134. if (item.FILEN != "") {
  135. 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;
  136. } else {
  137. item.FILEN = "#";
  138. }
  139. if (self.type == "finish") {
  140. item.RECEIVEDATE = item.FINISHEDDATE;
  141. }
  142. })
  143. }
  144. })
  145. }
  146. self.load = function () {
  147. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  148. self.getData(self.pageno);
  149. } else {
  150. $timeout(function () {
  151. self.getData(self.get_lastReturnPageno);
  152. }, 1)
  153. }
  154. }
  155. self.sortFiled = function (str) {
  156. var n = 0, obj, x = -1;
  157. self.ordercondition.forEach(function (item, index) {
  158. if (item.COLID == str) {
  159. n++
  160. item.SORTTYPE = item.SORTTYPE == "" || item.SORTTYPE == "asc" ? "desc" : "asc"
  161. obj = item; x = index
  162. }
  163. })
  164. if (n == 0) {
  165. self.ordercondition.unshift({ COLID: str, SORTTYPE: "desc" })
  166. }
  167. if (x != -1) {
  168. self.ordercondition.splice(x, 1)
  169. self.ordercondition.unshift(obj)
  170. }
  171. self.getData(1);
  172. }
  173. self.getJJQK();
  174. self.openLayer = function () {
  175. self.params = "";
  176. if (self.search == null) {
  177. self.search = {
  178. FLOW: [],
  179. TITLE: "",
  180. JJCD: "",
  181. DATE1: "",
  182. DATE2: "",
  183. SWBH: '',
  184. LWDW: '',
  185. LWWH: '',
  186. LWRQ: ''
  187. }
  188. } else {
  189. self.flowids.forEach(function (item) {
  190. item.checked = false;
  191. if (self.search.FLOW.indexOf(item.ID) > -1) {
  192. item.checked = true;
  193. }
  194. })
  195. self.JJQK.forEach(function (item) {
  196. item.checked = false;
  197. if (self.search.JJCD.indexOf(item.CODE) > -1) {
  198. item.checked = true;
  199. }
  200. })
  201. }
  202. sp.layer("#Search")
  203. }
  204. self.doSearch = function () {
  205. self.search.FLOW = [];
  206. self.flowids.forEach(function (item) {
  207. if (item.checked == true) {
  208. self.search.FLOW.push(item.ID)
  209. }
  210. })
  211. self.search.JJCD = [];
  212. self.JJQK.forEach(function (item) {
  213. if (item.checked == true) {
  214. self.search.JJCD.push(item.CODE)
  215. }
  216. })
  217. self.getData(self.pageno)
  218. sp.layerhide()
  219. }
  220. self.cancal = function () {
  221. self.search = {
  222. FLOW: [],
  223. TITLE: "",
  224. JJCD: "",
  225. DATE1: "",
  226. DATE2: "",
  227. SWBH: '',
  228. LWDW: '',
  229. LWWH: '',
  230. LWRQ: ''
  231. }
  232. $.cookie("GlWorkPlatform-shouwenbg", null, { path: '/', expires: 1 });
  233. self.getData(1)
  234. sp.layerhide()
  235. }
  236. self.refresh = function () {
  237. self.CrossPage.type = null;
  238. self.getData(self.pageno);
  239. }
  240. self.goUrl = function (item) {
  241. if (item.TODOLIST && item.TODOLIST.length > 1) {
  242. self.todoTitle = item.TITLE;
  243. self.todoList = item.TODOLIST;
  244. sp.layer("#todolist")
  245. } else {
  246. if (self.deviceType == "pad") {
  247. window.location.href = item.FILEN + "&dotype=" + getDoType(self.type)
  248. } else {
  249. sp.openNewWindow(item.FILEN + "&dotype=" + getDoType(self.type), item.TITLE)
  250. }
  251. sp.layerhide();
  252. }
  253. }
  254. self.btnDel = function (item) {
  255. var data = {
  256. routeinfoid: item.ROUTEINFOID,
  257. userid: self.userId
  258. }
  259. $http.post(apiurljs.login + "g2work/routeinfo/deleteDraftByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  260. .success(function (obj) {
  261. var res = strToJson(s4.decryptData_CBC(obj.data));
  262. if (res.success == true) {
  263. self.getData(self.pageno)
  264. } else {
  265. sp.dialog(res.message)
  266. }
  267. })
  268. }
  269. self.btnRecall = function (routeid,kind) {
  270. var data = {
  271. routeid: routeid,
  272. kind:kind,
  273. userid: self.userId
  274. }
  275. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRecallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  276. .success(function (obj) {
  277. var res = strToJson(s4.decryptData_CBC(obj.data));
  278. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  279. var dialogBody = "<div class=\"sp-dialog-body\">" + res.data.REMARK + "</div>";
  280. 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>";
  281. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  282. sp.openCenter(".sp-dialog");
  283. ///取消按钮
  284. $('.sp-closeDialog').click(function (event) {
  285. sp.closeCenter(".sp-dialog");
  286. event.preventDefault();
  287. event.stopPropagation();
  288. });
  289. //post消息的id
  290. $("#delDataTrue").click(function () {
  291. $http.post(apiurljs.login + "g2work/routeinfo/recallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  292. .success(function (obj) {
  293. var res = strToJson(s4.decryptData_CBC(obj.data));
  294. sp.dialoghide()
  295. if (res.success == true) {
  296. self.getData(self.pageno)
  297. } else {
  298. sp.dialog(res.message)
  299. }
  300. })
  301. });
  302. })
  303. }
  304. self.changeType = function (str) {
  305. if (self.type == str) {
  306. return;
  307. } else {
  308. var time1 = sp.getLocalDate1();
  309. self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/routeinfo/" + self.Url)
  310. self.type = str;
  311. self.Url = getUrl(self.type);
  312. self.getData(1)
  313. }
  314. }
  315. self.getAddFlag = function () {
  316. var data = {
  317. userid: self.userId,
  318. ntops: 0
  319. }
  320. $http.post(apiurljs.login + "g2work/desktop/queryWorkflowCando", data, postCfg)
  321. .success(function (obj) {
  322. var res = strToJson(s4.decryptData_CBC(obj.data));
  323. self.lcList = [];
  324. self.activeLC = {};
  325. res.data.forEach(function (item) {
  326. if ("AA18|AA16|AA02|AA17".indexOf(item.FLOWID) > -1) {
  327. self.lcList.push(item);
  328. }
  329. })
  330. })
  331. }
  332. self.getAddFlag()
  333. self.addLC = function () {
  334. if (self.lcList.length == 1) {
  335. sp.openNewWindow(self.lcList[0].FILEN + "&dotype=1&flowid=" + self.lcList[0].FLOWID, self.lcList[0].FLOWNAME)
  336. } else {
  337. sp.layer("#addLC");
  338. }
  339. }
  340. self.seeLCT = function (item,event) {
  341. event.preventDefault();
  342. event.stopPropagation();
  343. }
  344. self.goAddUrl = function (obj) {
  345. sp.openNewWindow(obj.FILEN + "&dotype=1&flowid=" + obj.FLOWID, obj.FLOWNAME)
  346. sp.layerhide()
  347. }
  348. self.printEXCEL = function () {
  349. self.columns = [
  350. { header: "紧急程度", key: "JJCD", width: 20 },
  351. { header: "收文类别", key: "FLOWNAME", width: 20 },
  352. { header: "收文编号", key: "SWBH", width: 20 },
  353. { header: "标题", key: "TITLE", width: 100 },
  354. { header: "来文单位", key: "LWDW", width: 20 },
  355. { header: "来文文号", key: "LWWH", width: 20 },
  356. { header: "来文日期", key: "LWRQ", width: 25 },
  357. { header: "上一节点转办时间", key: "RECEIVEDATE", width: 25 }
  358. ]
  359. self.listExcel = self.list.map(function (item) {
  360. return {
  361. JJCD: item.JJCD,
  362. FLOWNAME: item.FLOWNAME,
  363. SWBH: item.SWBH,
  364. TITLE: item.TITLE,
  365. LWDW: item.LWDW,
  366. LWWH: item.LWWH,
  367. LWRQ: item.LWRQ,
  368. RECEIVEDATE: item.RECEIVEDATE
  369. }
  370. })
  371. // 创建工作簿
  372. var workbook = new ExcelJS.Workbook()
  373. // 添加工作表
  374. var worksheet = workbook.addWorksheet('sheet1')
  375. // 设置表头
  376. worksheet.columns = self.columns
  377. // 添加表体数据
  378. self.listExcel.forEach(function (item) {
  379. worksheet.addRow(item)
  380. })
  381. /**
  382. * 设置样式
  383. */
  384. // 1、设置标题行样式
  385. var headerRow = worksheet.getRow(1)
  386. // 连续遍历所有非空单元格
  387. headerRow.eachCell(function (cell) {
  388. // 边框 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E8%BE%B9%E6%A1%86
  389. cell.border = {
  390. top: {
  391. style: 'thin'
  392. },
  393. left: {
  394. style: 'thin'
  395. },
  396. bottom: {
  397. style: 'thin'
  398. },
  399. right: {
  400. style: 'thin'
  401. },
  402. }
  403. // 填充 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%A1%AB%E5%85%85
  404. cell.fill = {
  405. type: 'pattern',
  406. pattern: 'solid',
  407. fgColor: {
  408. argb: '4f81bd'
  409. }
  410. }
  411. // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
  412. cell.font = {
  413. name: '微软雅黑',
  414. size: 11,
  415. bold: true,
  416. color: { argb: '000000' }
  417. }
  418. // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
  419. cell.alignment = {
  420. vertical: 'middle',
  421. horizontal: 'center'
  422. }
  423. })
  424. // 2、设置内容行样式
  425. const bodyRow = worksheet.getRows(2, self.listExcel.length + 1)
  426. bodyRow.forEach(function (row) {
  427. //遍历此列中的所有当前单元格,包括空单元格
  428. row.eachCell({ includeEmpty: true }, function (cell) {
  429. // 边框
  430. cell.border = {
  431. top: {
  432. style: 'thin'
  433. },
  434. left: {
  435. style: 'thin'
  436. },
  437. bottom: {
  438. style: 'thin'
  439. },
  440. right: {
  441. style: 'thin'
  442. },
  443. }
  444. // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
  445. cell.font = {
  446. name: '微软雅黑',
  447. size: 11,
  448. color: { argb: '000000' }
  449. }
  450. // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
  451. cell.alignment = {
  452. vertical: 'middle',
  453. horizontal: 'center'
  454. }
  455. })
  456. })
  457. // 导出表格
  458. workbook.xlsx.writeBuffer().then(function (buffer) {
  459. const blob = new Blob([buffer], {
  460. type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  461. })
  462. const link = document.createElement('a')
  463. link.href = URL.createObjectURL(blob)
  464. link.download = '收文' + sp.format(sp.getLocalDate()) + '.xlsx'
  465. link.click()
  466. URL.revokeObjectURL(link.href) // 下载完成释放掉blob对象
  467. })
  468. //})
  469. }
  470. //记录日志
  471. self.journalRecord = function (time1, time2, title, func, url) {
  472. if (!self.CrossPage || !self.CrossPage.cname) { return; }
  473. var data = {
  474. tablename: "SYS_CLICKLOG",
  475. data: {
  476. CTIME: time1 == null ? sp.getLocalDate1() : time1,
  477. TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
  478. REQUESTURL: url,
  479. REQUESTHEADERURL: window.location.origin,
  480. LOGTYPE: func,
  481. USERTYPE: $.cookie("GlWorkPlatform-userType"),
  482. ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
  483. CLIENTIP: sp.myIP(),
  484. PCNAME: sp.detectOS(),
  485. BROWSERNAME: sp.browser(),
  486. RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
  487. USERID: self.userId,
  488. USERNAME: self.userName
  489. }
  490. }
  491. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  492. .success(function (res) {
  493. self.CrossPage.type = 1;
  494. })
  495. }
  496. var width = 0, height = 0;
  497. $interval(function () {
  498. if (localStorage.getItem("GlWorkPlatform-shouwenbg-refresh") == 1) {
  499. localStorage.removeItem("GlWorkPlatform-shouwenbg-refresh")
  500. self.refresh()
  501. }
  502. }, 1000)
  503. //头部下滚冻结
  504. $(function () {
  505. width = window.outerWidth;
  506. height = window.outerHeight;
  507. //页面高度撑满
  508. setTimeout(function () {
  509. if ($(".ibox-content").height() < $(window).height() - 31) {
  510. $(".ibox-content").css("height", $(window).height() - 31)
  511. }
  512. }, 1)
  513. })
  514. }])
  515. function getUrl(str) {
  516. switch (str) {
  517. case "todo":
  518. return "queryDataTodoWithPage";
  519. break;
  520. case "done":
  521. return "queryDataDoneWithPage";
  522. break;
  523. case "finish":
  524. return "queryDataFinishWithPage";
  525. break;
  526. }
  527. }
  528. function getDoType(str) {
  529. switch (str) {
  530. case "todo":
  531. return 1;
  532. break;
  533. default:
  534. return 0;
  535. break;
  536. }
  537. }