util-fun.wxs 915 B

12345678910111213141516171819202122232425262728293031323334
  1. var filter = {
  2. getPercent: function(item){
  3. if( item.isFinish) return 100;
  4. return parseInt(item.position*10000/item.duration)/100;
  5. },
  6. getCategory: function( item){
  7. var categorys= {
  8. laws: "法律法规",
  9. mechanism: "机制制度类",
  10. result: "基础性成果类",
  11. other: "其他"
  12. }
  13. return categorys[item];
  14. },
  15. getStatus: function(item){
  16. var status= ["创建","经办","审核","发布",'删除'];
  17. return status[item];
  18. },
  19. getDatetime: function( item ){
  20. var strItem = item.toString();
  21. return strItem.substring(0, 10) + " " +strItem.substring(11, 19);;
  22. },
  23. getDate: function( item ){
  24. var strItem = item.toString()
  25. return strItem.substring(0, 10);
  26. },
  27. }
  28. module.exports = {
  29. getPercent: filter.getPercent,
  30. getCategory:filter.getCategory,
  31. getDatetime: filter.getDatetime,
  32. getStatus: filter.getStatus,
  33. getDate: filter.getDate
  34. }