vueFilter.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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. APPLY: '报名'
  55. }
  56. return template[value]
  57. })
  58. // 乐团学员状态
  59. Vue.filter('instrumentType', (value) => {
  60. let template = {
  61. GROUP: "团购",
  62. OWNED: "自备",
  63. LEASE: "租赁"
  64. }
  65. return template[value]
  66. })
  67. // 课程类型
  68. Vue.filter('coursesType', (value) => {
  69. let template = {
  70. NORMAL: '单技课',
  71. SINGLE: '单技课',
  72. MIX: "合奏课",
  73. HIGH: "基础技能课",
  74. VIP: "VIP课",
  75. DEMO: "试听课",
  76. COMPREHENSIVE: '综合课',
  77. // PRACTICE: '练习课',
  78. ENLIGHTENMENT: '启蒙课',
  79. TRAINING: '集训课',
  80. TRAINING_SINGLE: '集训单技课',
  81. TRAINING_MIX: '集训合奏课',
  82. CLASSROOM: '课堂课',
  83. PRACTICE: '网管课',
  84. COMM: '对外课',
  85. MUSIC: '乐团课',
  86. HIGH_ONLINE: '线上基础技能课',
  87. MUSIC_NETWORK: '乐团网管课'
  88. }
  89. return template[value]
  90. })
  91. // 课程状态
  92. Vue.filter('coursesStatus', (value) => {
  93. let template = {
  94. NOT_START: "未开始",
  95. UNDERWAY: "进行中",
  96. OVER: "已结束"
  97. }
  98. return template[value]
  99. })
  100. // 考勤类型
  101. Vue.filter('clockingIn', value => {
  102. let templateStatus = {
  103. NORMAL: "正常",
  104. TRUANT: "旷课",
  105. LEAVE: "请假",
  106. QUIT_SCHOOL: "休学",
  107. DROP_OUT: "退学"
  108. }
  109. return templateStatus[value]
  110. })
  111. // 学员状态
  112. Vue.filter('studentTeamStatus', value => {
  113. let templateStatus = {
  114. NORMAL: "在读",
  115. QUIT: "退团",
  116. QUIT_SCHOOL: "休学",
  117. }
  118. return templateStatus[value]
  119. })
  120. // 时间处理
  121. Vue.filter('formatTimer', (value) => {
  122. if (value) {
  123. return value.split(' ')[0]
  124. } else {
  125. return value
  126. }
  127. })
  128. Vue.filter('timerForMinFormat', (value) => {
  129. if (value) {
  130. return value.substring(0, 5)
  131. } else {
  132. return value
  133. }
  134. })
  135. Vue.filter('dateForMinFormat', (value) => {
  136. if (value) {
  137. return value.substring(0, 16)
  138. } else {
  139. return value
  140. }
  141. })
  142. // 时间处理
  143. Vue.filter('timer', (value) => {
  144. if (value) {
  145. let tempDate = new Date(value)
  146. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  147. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  148. return month + ':' + days
  149. } else {
  150. return value
  151. }
  152. })
  153. // 格式化成星期
  154. Vue.filter('formatWeek', date => {
  155. let nd = new Date(date)
  156. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  157. return temp[nd.getDay()]
  158. })
  159. // 职位
  160. Vue.filter('jobType', value => {
  161. let template = {
  162. ADVISER: "指导老师",
  163. ACADEMIC: "教务老师",
  164. TEACHING: "乐队指导"
  165. }
  166. return template[value]
  167. })
  168. // 工作类型
  169. Vue.filter('jobNature', (value) => {
  170. let template = {
  171. PART_TIME: "兼职",
  172. FULL_TIME: "全职",
  173. TEMPORARY: "临时工"
  174. }
  175. return template[value]
  176. })
  177. // 考勤状态
  178. Vue.filter('attendanceType', value => {
  179. let template = {
  180. 0: "异常签到",
  181. 1: "正常签到",
  182. 3: "未签到"
  183. }
  184. return template[value]
  185. })
  186. // 考情签退
  187. Vue.filter('attendanceOutType', value => {
  188. let template = {
  189. 0: "异常签退",
  190. 1: "正常签退",
  191. 3: "未签退"
  192. }
  193. return template[value]
  194. })
  195. // 上课类型
  196. Vue.filter('workType', value => {
  197. let template = {
  198. TEACHING: "助教",
  199. BISHOP: "主教"
  200. }
  201. return template[value]
  202. })
  203. // 交易类型
  204. Vue.filter('orderType', value => {
  205. let template = {
  206. APPLY: "报名",
  207. RENEW: "续费",
  208. OTHER: "其他",
  209. SMALL_CLASS_TO_BUY: "VIP购买",
  210. SPORADIC: '零星收费',
  211. LUCK: "福袋活动",
  212. PRACTICE: '网管课',
  213. PRACTICE_GROUP_BUY: '网管课购买',
  214. PRACTICE_GROUP_RENEW: '网管课续费',
  215. REPAIR: '乐器维修'
  216. }
  217. return template[value]
  218. })
  219. //
  220. Vue.filter('paymentChannelType', value => {
  221. let template = {
  222. PER: "个人",
  223. COM: "公司"
  224. }
  225. return template[value]
  226. })
  227. // 交易状态
  228. Vue.filter('dealStatus', value => {
  229. let template = {
  230. ING: "交易中",
  231. SUCCESS: "成功交易",
  232. FAILED: "交易失败",
  233. CLOSE: "交易关闭"
  234. }
  235. return template[value]
  236. })
  237. // 交易状态
  238. Vue.filter('returnStatus', value => {
  239. let template = {
  240. ING: "审核中",
  241. REJECT: "拒绝",
  242. WAIT_PAYMENT: "待支付",
  243. DONE: "完成"
  244. }
  245. return template[value]
  246. })
  247. // 性别
  248. Vue.filter('sex', value => {
  249. let template = ['女', '男']
  250. return template[value]
  251. })
  252. // 服从调剂 isAllowAdjust
  253. Vue.filter('isAllowAdjust', value => {
  254. let template = ['否', '是']
  255. return template[value]
  256. })
  257. // 学员缴费状态 paymentStatus
  258. Vue.filter('paymentStatus', value => {
  259. let template = ['未开启缴费', '开启缴费', '已缴费']
  260. return template[value]
  261. })
  262. // 乐团状态
  263. Vue.filter('teamStatus', value => {
  264. let template = {
  265. APPLY: "报名中",
  266. PAY: "缴费中",
  267. PREPARE: "筹备中",
  268. PROGRESS: "进行中",
  269. CANCELED: '取消',
  270. PAUSE: '暂停',
  271. AUDIT: '审核中',
  272. DRAFT: '编辑中',
  273. AUDIT_FAILED: '审核失败'
  274. }
  275. return template[value]
  276. })
  277. // 学生状态
  278. /**studentStatus */
  279. Vue.filter('studentStatus', value => {
  280. let template = ['在读', '已退课', '退课中', '休学']
  281. return template[value]
  282. })
  283. // 学生点名
  284. Vue.filter('studentRecord', value => {
  285. let template = {
  286. NORMAL: "正常",
  287. TRUANT: "旷课",
  288. LEAVE: "请假",
  289. DROP_OUT: "退学",
  290. '': '未签到'
  291. }
  292. return template[value]
  293. })
  294. // 是否
  295. Vue.filter('yesOrNo', value => {
  296. let template = ['否', '是']
  297. return template[value]
  298. })
  299. // 学员缴费状态
  300. Vue.filter('studentPay', value => {
  301. let template = {
  302. PAID_COMPLETED: "完成缴费",
  303. NON_PAYMENT: "未缴费",
  304. PROCESSING: "缴费中",
  305. }
  306. return template[value]
  307. })
  308. // 学员点名详情
  309. Vue.filter('studentSign', value => {
  310. let template = {
  311. NORMAL: "正常",
  312. TRUANT: "旷课",
  313. LEAVE: "请假",
  314. DROP_OUT: '退学'
  315. }
  316. return template[value]
  317. })
  318. // 班级类型
  319. Vue.filter('classType', value => {
  320. let template = {
  321. NORMAL: "单技班",
  322. MIX: '合奏班',
  323. HIGH: '基础技能班',
  324. VIP: 'VIP',
  325. DEMO: '试听',
  326. SNAP: "临时班",
  327. PRACTICE: '网管课',
  328. HIGH_ONLINE: '线上基础技能课',
  329. MUSIC_NETWORK: '乐团网管课'
  330. }
  331. return template[value]
  332. })
  333. Vue.filter('teachMode', value => {
  334. let template = {
  335. ONLINE: "线上课",
  336. OFFLINE: '线下课'
  337. }
  338. return template[value]
  339. })
  340. // 老师状态
  341. Vue.filter('teacherStatus', value => {
  342. let template = {
  343. "0": '正常',
  344. "1": '冻结',
  345. "9": '锁定'
  346. }
  347. return template[value]
  348. })
  349. // vip课状态
  350. Vue.filter('vipCourseStatus', value => {
  351. let template = {
  352. 0: "未开始",
  353. 1: "报名中",
  354. 5: "报名结束",
  355. 2: "进行中",
  356. 4: "已结束",
  357. 3: "取消"
  358. }
  359. return template[value]
  360. })
  361. // 交易状态
  362. Vue.filter('paymentChannelStatus', value => {
  363. let template = {
  364. YQPAY: "双乾",
  365. BALANCE: "余额"
  366. }
  367. return template[value]
  368. })
  369. // edition
  370. Vue.filter('editionFilter', value => {
  371. let template = {
  372. 'ios-teacher': '苹果-老师端',
  373. 'ios-student': '苹果-学生端',
  374. 'ios-education': '苹果-教务端',
  375. 'android-teacher': '安卓-老师端',
  376. 'android-student': '安卓-学生端',
  377. 'android-education': '安卓-教务端',
  378. }
  379. return template[value]
  380. })
  381. // payStatus 订单支付状态
  382. Vue.filter('payStatus', value => {
  383. let template = {
  384. WAIT_PAY: "等待支付",
  385. ING: "交易中",
  386. SUCCESS: '成功交易',
  387. FAILED: '交易失败',
  388. CLOSE: '交易关闭'
  389. }
  390. return template[value]
  391. })
  392. // payType 交易类型
  393. Vue.filter('payType', value => {
  394. let template = {
  395. RECHARGE: "充值",
  396. WITHDRAW: "提现",
  397. PAY_FEE: "缴费",
  398. SPORADIC: "零星收费",
  399. FILL_ACCOUNT: "人工补账",
  400. REFUNDS: "退费",
  401. REWARDS: "奖励",
  402. WAGE: "工资"
  403. }
  404. return template[value]
  405. })
  406. // 课程组状态 FINISH
  407. Vue.filter('courseGroup', value => {
  408. let template = {
  409. NORMAL: "正常",
  410. LOCK: "锁定",
  411. FINISH: '结束',
  412. CANCEL: '取消',
  413. }
  414. return template[value]
  415. })
  416. // 网管课程组
  417. Vue.filter('comCourseGroup', value => {
  418. let template = {
  419. NORMAL: "进行中",
  420. FINISH: '结束',
  421. CANCEL: '关闭',
  422. }
  423. return template[value]
  424. })
  425. //网管课类型
  426. Vue.filter('comType', value => {
  427. let template = {
  428. FREE: "免费",
  429. CHARGE: '收费',
  430. TRIAL: '试听课',
  431. }
  432. return template[value]
  433. })
  434. // 首充续费
  435. Vue.filter('firstOrRenewFilter', value => {
  436. let template = {
  437. '0': "续费",
  438. '1': "首次",
  439. }
  440. return template[value]
  441. })
  442. // 老师时间
  443. Vue.filter('transTypeFilter', value => {
  444. let template = {
  445. 'RECHARGE': "充值",
  446. 'CONSUME': "建课",
  447. 'RETURN': "退课",
  448. 'MANUAL_ADD': "系统充值",
  449. 'MANUAL_SUB': "系统扣除",
  450. }
  451. return template[value]
  452. })
  453. // paymentType
  454. Vue.filter('paymentType', value => {
  455. let template = {
  456. 'OFFLINE': "线下",
  457. 'ONLINE': "线上",
  458. 'ALL': "全部",
  459. }
  460. return template[value]
  461. })
  462. Vue.filter('paymentListStatus', value => {
  463. let template = {
  464. 0: "未开始",
  465. 1: "已开启",
  466. 2: "已结束",
  467. }
  468. return template[value]
  469. })
  470. // paymentStatus
  471. Vue.filter('paymentStatusDetall', value => {
  472. let template = {
  473. 'PAID_COMPLETED': "已缴费",
  474. 'PROCESSING': "缴费中",
  475. 'NON_PAYMENT': "未缴费",
  476. }
  477. return template[value]
  478. })
  479. // 课时申诉
  480. Vue.filter('complaintsStatusEnum', value => {
  481. let template = {
  482. 0: "已拒绝",
  483. 1: "已通过",
  484. 2: "待处理",
  485. 3: "已撤销",
  486. }
  487. return template[value]
  488. })
  489. // 人事状态 isProbationPeriod
  490. Vue.filter('isProbationPeriod', value => {
  491. let template = {
  492. 0: "正式",
  493. 1: "试用",
  494. 2: "离职",
  495. }
  496. return template[value]
  497. })