vueFilter.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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.getMonth() + 1 >= 10 ? tempDate.getMonth() + 1 : '0' + tempDate.getMonth() + 1
  118. let days = tempDate.getDate() >= 10 ? tempDate.getDate() : '0' + tempDate.getDate()
  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('workType', value => {
  159. let template = {
  160. TEACHING: "助教",
  161. BISHOP: "主教"
  162. }
  163. return template[value]
  164. })
  165. // 交易类型
  166. Vue.filter('orderType', value => {
  167. let template = {
  168. APPLY: "报名",
  169. RENEW: "续费",
  170. OTHER: "其他",
  171. SMALL_CLASS_TO_BUY: "VIP购买"
  172. }
  173. return template[value]
  174. })
  175. //
  176. Vue.filter('paymentChannelType', value => {
  177. let template = {
  178. PER: "个人",
  179. COM: "公司"
  180. }
  181. return template[value]
  182. })
  183. // 交易状态
  184. Vue.filter('dealStatus', value => {
  185. let template = {
  186. ING: "交易中",
  187. SUCCESS: "成功交易",
  188. FAILED: "交易失败",
  189. CLOSE: "交易关闭"
  190. }
  191. return template[value]
  192. })
  193. // 交易状态
  194. Vue.filter('returnStatus', value => {
  195. let template = {
  196. ING: "审核中",
  197. REJECT: "拒绝",
  198. WAIT_PAYMENT: "待支付",
  199. DONE: "完成"
  200. }
  201. return template[value]
  202. })
  203. // 性别
  204. Vue.filter('sex', value => {
  205. let template = ['女', '男']
  206. return template[value]
  207. })
  208. // 服从调剂 isAllowAdjust
  209. Vue.filter('isAllowAdjust', value => {
  210. let template = ['否', '是']
  211. return template[value]
  212. })
  213. // 学员缴费状态 paymentStatus
  214. Vue.filter('paymentStatus', value => {
  215. let template = ['未开启缴费', '开启缴费', '已缴费']
  216. return template[value]
  217. })
  218. // 乐团状态
  219. Vue.filter('teamStatus', value => {
  220. let template = {
  221. APPLY: "报名中",
  222. PAY: "缴费中",
  223. PREPARE: "筹备中",
  224. PROGRESS: "进行中",
  225. CANCELED: '取消',
  226. PAUSE: '暂停',
  227. AUDIT: '审核中',
  228. DRAFT: '编辑中',
  229. AUDIT_FAILED: '审核失败'
  230. }
  231. return template[value]
  232. })
  233. // 学生点名
  234. Vue.filter('studentRecord', value => {
  235. let template = {
  236. NORMAL: "正常",
  237. TRUANT: "旷课",
  238. LEAVE: "请假",
  239. DROP_OUT: "退学"
  240. }
  241. return template[value]
  242. })
  243. // 是否
  244. Vue.filter('yesOrNo', value => {
  245. let template = ['否', '是']
  246. return template[value]
  247. })
  248. // 学员缴费状态
  249. Vue.filter('studentPay', value => {
  250. let template = {
  251. PAID_COMPLETED: "完成缴费",
  252. NON_PAYMENT: "未缴费",
  253. PROCESSING: "缴费中",
  254. }
  255. return template[value]
  256. })
  257. // 学员点名详情
  258. Vue.filter('studentSign', value => {
  259. let template = {
  260. NORMAL: "正常",
  261. TRUANT: "旷课",
  262. LEAVE: "请假",
  263. DROP_OUT: '退学'
  264. }
  265. return template[value]
  266. })
  267. // 班级类型
  268. Vue.filter('classType', value => {
  269. let template = {
  270. NORMAL: "普通班级",
  271. MIX: '合奏班'
  272. }
  273. return template[value]
  274. })
  275. Vue.filter('teachMode', value => {
  276. let template = {
  277. ONLINE: "线上课",
  278. OFFLINE: '线下课'
  279. }
  280. return template[value]
  281. })
  282. // 老师状态
  283. Vue.filter('teacherStatus', value => {
  284. let template = {
  285. "0": '正常',
  286. "1": '冻结',
  287. "9": '锁定'
  288. }
  289. return template[value]
  290. })