vueFilter.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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('branchType', (value) => {
  15. let template = {
  16. OWN: "自有",
  17. COOPERATION: "合作",
  18. LEASE: "租赁"
  19. }
  20. return template[value]
  21. })
  22. // 商品类型
  23. Vue.filter('shopType', (value) => {
  24. let template = {
  25. "INSTRUMENT": "乐器",
  26. "ACCESSORIES": "辅件",
  27. "TEACHING": "教材",
  28. "STAFF": "教谱",
  29. "OTHER": "其它",
  30. }
  31. return template[value]
  32. })
  33. // 乐团状态
  34. Vue.filter('musicGroupType', (value) => {
  35. let template = {
  36. APPLY: "报名中",
  37. PAY: "缴费中",
  38. PREPARE: "筹备中",
  39. PROGRESS: "进行中",
  40. CANCELED: '取消',
  41. PAUSE: '暂停',
  42. AUDIT: '审核中',
  43. DRAFT: '编辑中',
  44. AUDIT_FAILED: '审核失败'
  45. }
  46. return template[value]
  47. })
  48. // 乐团学员状态
  49. Vue.filter('musicGroupStudentType', (value) => {
  50. let template = {
  51. NORMAL: "在读",
  52. LEAVE: "请假",
  53. QUIT: "退团"
  54. }
  55. return template[value]
  56. })
  57. // 乐团学员状态
  58. Vue.filter('instrumentType', (value) => {
  59. let template = {
  60. GROUP: "团购",
  61. OWNED: "自备",
  62. LEASE: "租赁"
  63. }
  64. return template[value]
  65. })
  66. // 课程类型
  67. Vue.filter('coursesType', (value) => {
  68. let template = {
  69. NORMAL: '单技课',
  70. SINGLE: '单技课',
  71. MIX: "合奏课",
  72. HIGH: "基础技能课",
  73. VIP: "VIP课",
  74. DEMO: "试听课",
  75. COMPREHENSIVE: '综合课',
  76. PRACTICE: '练习课',
  77. ENLIGHTENMENT: '启蒙课',
  78. TRAINING: '集训课',
  79. TRAINING_SINGLE: '集训单技课',
  80. TRAINING_MIX: '集训合奏课',
  81. CLASSROOM: '课堂课'
  82. }
  83. return template[value]
  84. })
  85. // 课程状态
  86. Vue.filter('coursesStatus', (value) => {
  87. let template = {
  88. NOT_START: "未开始",
  89. UNDERWAY: "进行中",
  90. OVER: "已结束"
  91. }
  92. return template[value]
  93. })
  94. // 考勤类型
  95. Vue.filter('clockingIn', value => {
  96. let templateStatus = {
  97. NORMAL: "正常",
  98. TRUANT: "旷课",
  99. LEAVE: "请假",
  100. QUIT_SCHOOL: "休学",
  101. DROP_OUT: "退学"
  102. }
  103. return templateStatus[value]
  104. })
  105. // 时间处理
  106. Vue.filter('formatTimer', (value) => {
  107. if (value) {
  108. return value.split(' ')[0]
  109. } else {
  110. return value
  111. }
  112. })
  113. // 时间处理
  114. Vue.filter('timer', (value) => {
  115. if (value) {
  116. let tempDate = new Date(value)
  117. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  118. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  119. return month + ':' + days
  120. } else {
  121. return value
  122. }
  123. })
  124. // 格式化成星期
  125. Vue.filter('formatWeek', date => {
  126. let nd = new Date(date)
  127. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  128. return temp[nd.getDay()]
  129. })
  130. // 职位
  131. Vue.filter('jobType', value => {
  132. let template = {
  133. ADVISER: "指导老师",
  134. ACADEMIC: "教务老师",
  135. TEACHING: "乐队指导"
  136. }
  137. return template[value]
  138. })
  139. // 工作类型
  140. Vue.filter('jobNature', (value) => {
  141. let template = {
  142. PART_TIME: "兼职",
  143. FULL_TIME: "全职",
  144. TEMPORARY: "临时工"
  145. }
  146. return template[value]
  147. })
  148. // 考勤状态
  149. Vue.filter('attendanceType', value => {
  150. let template = {
  151. 0: "异常签到",
  152. 1: "正常签到",
  153. 3: "未签到"
  154. }
  155. return template[value]
  156. })
  157. // 考情签退
  158. Vue.filter('attendanceOutType', value => {
  159. let template = {
  160. 0: "异常签退",
  161. 1: "正常签退",
  162. 3: "未签退"
  163. }
  164. return template[value]
  165. })
  166. // 上课类型
  167. Vue.filter('workType', value => {
  168. let template = {
  169. TEACHING: "助教",
  170. BISHOP: "主教"
  171. }
  172. return template[value]
  173. })
  174. // 交易类型
  175. Vue.filter('orderType', value => {
  176. let template = {
  177. APPLY: "报名",
  178. RENEW: "续费",
  179. OTHER: "其他",
  180. SMALL_CLASS_TO_BUY: "VIP购买"
  181. }
  182. return template[value]
  183. })
  184. //
  185. Vue.filter('paymentChannelType', value => {
  186. let template = {
  187. PER: "个人",
  188. COM: "公司"
  189. }
  190. return template[value]
  191. })
  192. // 交易状态
  193. Vue.filter('dealStatus', value => {
  194. let template = {
  195. ING: "交易中",
  196. SUCCESS: "成功交易",
  197. FAILED: "交易失败",
  198. CLOSE: "交易关闭"
  199. }
  200. return template[value]
  201. })
  202. // 交易状态
  203. Vue.filter('returnStatus', value => {
  204. let template = {
  205. ING: "审核中",
  206. REJECT: "拒绝",
  207. WAIT_PAYMENT: "待支付",
  208. DONE: "完成"
  209. }
  210. return template[value]
  211. })
  212. // 性别
  213. Vue.filter('sex', value => {
  214. let template = ['女', '男']
  215. return template[value]
  216. })
  217. // 服从调剂 isAllowAdjust
  218. Vue.filter('isAllowAdjust', value => {
  219. let template = ['否', '是']
  220. return template[value]
  221. })
  222. // 学员缴费状态 paymentStatus
  223. Vue.filter('paymentStatus', value => {
  224. let template = ['未开启缴费', '开启缴费', '已缴费']
  225. return template[value]
  226. })
  227. // 乐团状态
  228. Vue.filter('teamStatus', value => {
  229. let template = {
  230. APPLY: "报名中",
  231. PAY: "缴费中",
  232. PREPARE: "筹备中",
  233. PROGRESS: "进行中",
  234. CANCELED: '取消',
  235. PAUSE: '暂停',
  236. AUDIT: '审核中',
  237. DRAFT: '编辑中',
  238. AUDIT_FAILED: '审核失败'
  239. }
  240. return template[value]
  241. })
  242. // 学生点名
  243. Vue.filter('studentRecord', value => {
  244. let template = {
  245. NORMAL: "正常",
  246. TRUANT: "旷课",
  247. LEAVE: "请假",
  248. DROP_OUT: "退学"
  249. }
  250. return template[value]
  251. })
  252. // 是否
  253. Vue.filter('yesOrNo', value => {
  254. let template = ['否', '是']
  255. return template[value]
  256. })
  257. // 学员缴费状态
  258. Vue.filter('studentPay', value => {
  259. let template = {
  260. PAID_COMPLETED: "完成缴费",
  261. NON_PAYMENT: "未缴费",
  262. PROCESSING: "缴费中",
  263. }
  264. return template[value]
  265. })
  266. // 学员点名详情
  267. Vue.filter('studentSign', value => {
  268. let template = {
  269. NORMAL: "正常",
  270. TRUANT: "旷课",
  271. LEAVE: "请假",
  272. DROP_OUT: '退学'
  273. }
  274. return template[value]
  275. })
  276. // 班级类型
  277. Vue.filter('classType', value => {
  278. let template = {
  279. NORMAL: "普通班级",
  280. MIX: '合奏班',
  281. HIGH: '基础技能班',
  282. VIP: 'VIP',
  283. DEMO: '试听',
  284. SNAP: "临时班"
  285. }
  286. return template[value]
  287. })
  288. Vue.filter('teachMode', value => {
  289. let template = {
  290. ONLINE: "线上课",
  291. OFFLINE: '线下课'
  292. }
  293. return template[value]
  294. })
  295. // 老师状态
  296. Vue.filter('teacherStatus', value => {
  297. let template = {
  298. "0": '正常',
  299. "1": '冻结',
  300. "9": '锁定'
  301. }
  302. return template[value]
  303. })