vueFilter.js 11 KB

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