vueFilter.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. SPORADIC: '零星收费'
  182. }
  183. return template[value]
  184. })
  185. //
  186. Vue.filter('paymentChannelType', value => {
  187. let template = {
  188. PER: "个人",
  189. COM: "公司"
  190. }
  191. return template[value]
  192. })
  193. // 交易状态
  194. Vue.filter('dealStatus', value => {
  195. let template = {
  196. ING: "交易中",
  197. SUCCESS: "成功交易",
  198. FAILED: "交易失败",
  199. CLOSE: "交易关闭"
  200. }
  201. return template[value]
  202. })
  203. // 交易状态
  204. Vue.filter('returnStatus', value => {
  205. let template = {
  206. ING: "审核中",
  207. REJECT: "拒绝",
  208. WAIT_PAYMENT: "待支付",
  209. DONE: "完成"
  210. }
  211. return template[value]
  212. })
  213. // 性别
  214. Vue.filter('sex', value => {
  215. let template = ['女', '男']
  216. return template[value]
  217. })
  218. // 服从调剂 isAllowAdjust
  219. Vue.filter('isAllowAdjust', value => {
  220. let template = ['否', '是']
  221. return template[value]
  222. })
  223. // 学员缴费状态 paymentStatus
  224. Vue.filter('paymentStatus', value => {
  225. let template = ['未开启缴费', '开启缴费', '已缴费']
  226. return template[value]
  227. })
  228. // 乐团状态
  229. Vue.filter('teamStatus', value => {
  230. let template = {
  231. APPLY: "报名中",
  232. PAY: "缴费中",
  233. PREPARE: "筹备中",
  234. PROGRESS: "进行中",
  235. CANCELED: '取消',
  236. PAUSE: '暂停',
  237. AUDIT: '审核中',
  238. DRAFT: '编辑中',
  239. AUDIT_FAILED: '审核失败'
  240. }
  241. return template[value]
  242. })
  243. // 学生状态
  244. /**studentStatus */
  245. Vue.filter('studentStatus', value => {
  246. let template = ['在读', '已退课', '退课中', '休学']
  247. return template[value]
  248. })
  249. // 学生点名
  250. Vue.filter('studentRecord', value => {
  251. let template = {
  252. NORMAL: "正常",
  253. TRUANT: "旷课",
  254. LEAVE: "请假",
  255. DROP_OUT: "退学"
  256. }
  257. return template[value]
  258. })
  259. // 是否
  260. Vue.filter('yesOrNo', value => {
  261. let template = ['否', '是']
  262. return template[value]
  263. })
  264. // 学员缴费状态
  265. Vue.filter('studentPay', value => {
  266. let template = {
  267. PAID_COMPLETED: "完成缴费",
  268. NON_PAYMENT: "未缴费",
  269. PROCESSING: "缴费中",
  270. }
  271. return template[value]
  272. })
  273. // 学员点名详情
  274. Vue.filter('studentSign', value => {
  275. let template = {
  276. NORMAL: "正常",
  277. TRUANT: "旷课",
  278. LEAVE: "请假",
  279. DROP_OUT: '退学'
  280. }
  281. return template[value]
  282. })
  283. // 班级类型
  284. Vue.filter('classType', value => {
  285. let template = {
  286. NORMAL: "单技班",
  287. MIX: '合奏班',
  288. HIGH: '基础技能班',
  289. VIP: 'VIP',
  290. DEMO: '试听',
  291. SNAP: "临时班"
  292. }
  293. return template[value]
  294. })
  295. Vue.filter('teachMode', value => {
  296. let template = {
  297. ONLINE: "线上课",
  298. OFFLINE: '线下课'
  299. }
  300. return template[value]
  301. })
  302. // 老师状态
  303. Vue.filter('teacherStatus', value => {
  304. let template = {
  305. "0": '正常',
  306. "1": '冻结',
  307. "9": '锁定'
  308. }
  309. return template[value]
  310. })
  311. // vip课状态
  312. Vue.filter('vipCourseStatus', value => {
  313. let template = {
  314. 0: "未开始",
  315. 1: "报名中",
  316. 5: "报名结束",
  317. 2: "进行中",
  318. 4: "已结束",
  319. 3: "取消"
  320. }
  321. return template[value]
  322. })
  323. // 交易状态
  324. Vue.filter('paymentChannelStatus', value => {
  325. let template = {
  326. YQPAY: "双乾",
  327. BALANCE: "余额"
  328. }
  329. return template[value]
  330. })