vueFilter.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import Vue from 'vue'
  2. // 合并数组
  3. Vue.filter('joinArray', (value, type) => {
  4. if (!type) {
  5. type = ' '
  6. }
  7. if (typeof value == 'object' && value != null) {
  8. return value.join(type)
  9. } else {
  10. return value
  11. }
  12. })
  13. // 合并数组
  14. Vue.filter('jobNature', (value) => {
  15. let template = {
  16. PART_TIME: "兼职",
  17. FULL_TIME: "全职",
  18. TEMPORARY: "零时工"
  19. }
  20. return template[value]
  21. })
  22. // 合作单位
  23. Vue.filter('branchType', (value) => {
  24. let template = {
  25. OWN: "自有",
  26. COOPERATION: "合作",
  27. LEASE: "租赁"
  28. }
  29. return template[value]
  30. })
  31. // 商品类型
  32. Vue.filter('shopType', (value) => {
  33. let template = {
  34. "INSTRUMENT": "乐器",
  35. "ACCESSORIES": "辅件",
  36. "TEACHING": "教材",
  37. "STAFF": "教谱",
  38. "OTHER": "其它",
  39. }
  40. return template[value]
  41. })
  42. // 乐团状态
  43. Vue.filter('musicGroupType', (value) => {
  44. let template = {
  45. APPLY: '报名中',
  46. PAY: '缴费中',
  47. PREPARE: '筹备中',
  48. UNDERWAY: '进行中',
  49. CANCELED: '取消'
  50. }
  51. return template[value]
  52. })
  53. // 乐团学员状态
  54. Vue.filter('musicGroupStudentType', (value) => {
  55. let template = {
  56. NORMAL: "在读",
  57. LEAVE: "请假",
  58. QUIT: "退团"
  59. }
  60. return template[value]
  61. })
  62. // 乐团学员状态
  63. Vue.filter('instrumentType', (value) => {
  64. let template = {
  65. GROUP: "团购",
  66. OWNED: "自备",
  67. LEASE: "租赁"
  68. }
  69. return template[value]
  70. })
  71. // 课程类型
  72. Vue.filter('coursesType', (value) => {
  73. let template = {
  74. NORMAL: "单技课",
  75. MIX: "合奏课",
  76. HIGH: "小班课",
  77. VIP: "VIP课",
  78. DEMO: "试听课"
  79. }
  80. return template[value]
  81. })
  82. // 课程状态
  83. Vue.filter('coursesStatus', (value) => {
  84. let template = {
  85. NOT_START: "未开始",
  86. UNDERWAY: "进行中",
  87. OVER: "已结束"
  88. }
  89. return template[value]
  90. })
  91. // 考勤类型
  92. Vue.filter('clockingIn', value => {
  93. let templateStatus = {
  94. NORMAL: "正常",
  95. TRUANT: "旷课",
  96. LEAVE: "请假",
  97. QUIT_SCHOOL: "休学",
  98. DROP_OUT: "退学"
  99. }
  100. return templateStatus[value]
  101. })
  102. // 时间处理
  103. Vue.filter('formatTimer', (value) => {
  104. if (value) {
  105. return value.split(' ')[0]
  106. } else {
  107. return value
  108. }
  109. })