vueFilter.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. import Vue from 'vue'
  2. import dayjs from 'dayjs'
  3. import numeral from 'numeral'
  4. import * as constant from '../constant'
  5. // 合并数组
  6. Vue.filter('joinArray', (value, type) => {
  7. if (!type) {
  8. type = ' '
  9. }
  10. if (typeof value == 'object' && value != null) {
  11. return value.join(type)
  12. } else {
  13. return value
  14. }
  15. })
  16. // 合作单位
  17. Vue.filter('branchType', (value) => {
  18. let template = {
  19. OWN: "自有",
  20. COOPERATION: "合作",
  21. LEASE: "租赁"
  22. }
  23. return template[value]
  24. })
  25. // 商品类型
  26. Vue.filter('shopType', (value) => {
  27. let template = {
  28. "INSTRUMENT": "乐器",
  29. "ACCESSORIES": "辅件",
  30. "TEACHING": "教材",
  31. "STAFF": "教谱",
  32. "OTHER": "其它",
  33. }
  34. return template[value]
  35. })
  36. // 乐团学员状态
  37. Vue.filter('musicGroupStudentType', (value) => {
  38. let template = {
  39. NORMAL: "在读",
  40. LEAVE: "请假",
  41. QUIT: "退团",
  42. APPLY: '报名'
  43. }
  44. return template[value]
  45. })
  46. // 乐团学员状态
  47. Vue.filter('instrumentType', (value) => {
  48. let template = {
  49. GROUP: "团购",
  50. OWNED: "自备",
  51. LEASE: "租赁"
  52. }
  53. return template[value]
  54. })
  55. // 课程类型
  56. Vue.filter('coursesType', (value) => {
  57. let template = {
  58. NORMAL: '声部课',
  59. SINGLE: '声部课',
  60. MIX: "合奏课",
  61. HIGH: "基础技能课",
  62. VIP: "VIP课",
  63. DEMO: "试听课",
  64. COMPREHENSIVE: '综合课',
  65. // PRACTICE: '练习课',
  66. ENLIGHTENMENT: '启蒙课',
  67. TRAINING: '集训课',
  68. TRAINING_SINGLE: '集训声部课',
  69. TRAINING_MIX: '集训合奏课',
  70. CLASSROOM: '课堂课',
  71. PRACTICE: '网管课',
  72. COMM: '对外课',
  73. MUSIC: '乐团课',
  74. HIGH_ONLINE: '线上基础技能课',
  75. MUSIC_NETWORK: '乐团网管课'
  76. }
  77. return template[value]
  78. })
  79. // 课程状态
  80. Vue.filter('coursesStatus', (value) => {
  81. let template = {
  82. NOT_START: "未开始",
  83. UNDERWAY: "进行中",
  84. OVER: "已结束"
  85. }
  86. return template[value]
  87. })
  88. // 考勤类型
  89. Vue.filter('clockingIn', value => {
  90. let templateStatus = {
  91. NORMAL: "正常",
  92. TRUANT: "旷课",
  93. LEAVE: "请假",
  94. QUIT_SCHOOL: "休学",
  95. DROP_OUT: "退学"
  96. }
  97. return templateStatus[value]
  98. })
  99. // 学员状态
  100. Vue.filter('studentTeamStatus', value => {
  101. let templateStatus = {
  102. NORMAL: "在读",
  103. QUIT: "退团",
  104. QUIT_SCHOOL: "休学",
  105. APPLY: '报名'
  106. }
  107. return templateStatus[value]
  108. })
  109. // 时间处理
  110. Vue.filter('dayjsFormat', (value, format = 'YYYY-MM-DD') => {
  111. if (value) {
  112. return dayjs(value).format(format)
  113. } else {
  114. return value
  115. }
  116. })
  117. Vue.filter('dayjsFormatWeek', (value) => {
  118. if (value) {
  119. return dayjs(value).format('YYYY-MM')
  120. } else {
  121. return value
  122. }
  123. })
  124. Vue.filter('dayjsFormatMinute', (value) => {
  125. if (value) {
  126. return dayjs(value).format('HH:mm')
  127. } else {
  128. return value
  129. }
  130. })
  131. Vue.filter('formatTimer', (value) => {
  132. if (value) {
  133. return value.split(' ')[0]
  134. } else {
  135. return value
  136. }
  137. })
  138. Vue.filter('timerForMinFormat', (value) => {
  139. if (value) {
  140. return value.substring(0, 5)
  141. } else {
  142. return value
  143. }
  144. })
  145. Vue.filter('dateForMinFormat', (value) => {
  146. if (value) {
  147. return value.substring(0, 16)
  148. } else {
  149. return value
  150. }
  151. })
  152. // 乐团状态
  153. Vue.filter('musicGroupType', (value) => {
  154. // let template = {
  155. // APPLY: "报名中",
  156. // PAY: "缴费中",
  157. // PREPARE: "筹备中",
  158. // PROGRESS: "进行中",
  159. // CANCELED: '取消',
  160. // PAUSE: '暂停',
  161. // AUDIT: '审核中',
  162. // DRAFT: '编辑中',
  163. // AUDIT_FAILED: '审核失败'
  164. // }
  165. return constant.musicGroupType[value]
  166. })
  167. Vue.filter('paymentPatternTypeFormat', val => constant.paymentPatternType[val])
  168. // 支付用户类型
  169. Vue.filter('payUserTypeFormat', val => constant.payUserType[val])
  170. // 支付缴费方式
  171. Vue.filter('userPaymentTypeFormat', val => constant.userPaymentType[val])
  172. // 课程类型格式化
  173. Vue.filter('courseTypeFormat', val => constant.courseType[val])
  174. // 格式化签到签退记录 updateAttendanceEnum
  175. Vue.filter('updateAttendanceEnum', val => constant.updateAttendanceEnum[val])
  176. Vue.filter('clientTypeFilter',val=>constant.clientType[val])
  177. // 教学伴奏
  178. Vue.filter('clientType',val=>constant.clientStatus[val])
  179. // 时间处理
  180. Vue.filter('timer', (value) => {
  181. if (value) {
  182. let tempDate = new Date(value)
  183. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  184. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  185. return month + ':' + days
  186. } else {
  187. return value
  188. }
  189. })
  190. // 格式化成星期
  191. Vue.filter('formatWeek', date => {
  192. let nd = new Date(date)
  193. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  194. return temp[nd.getDay()]
  195. })
  196. // 职位
  197. Vue.filter('jobType', value => {
  198. let template = {
  199. ADVISER: "指导老师",
  200. ACADEMIC: "乐团主管",
  201. TEACHING: "乐队指导"
  202. }
  203. return template[value]
  204. })
  205. // 工作类型
  206. Vue.filter('jobNature', (value) => {
  207. return constant.jobNature[value]
  208. })
  209. // 考勤状态
  210. Vue.filter('attendanceType', value => {
  211. let template = {
  212. 0: "异常",
  213. 1: "正常",
  214. 3: "未签到"
  215. }
  216. return template[value]
  217. })
  218. // 考情签退
  219. Vue.filter('attendanceOutType', value => {
  220. let template = {
  221. 0: "异常",
  222. 1: "正常",
  223. 3: "未签退"
  224. }
  225. return template[value]
  226. })
  227. // 上课类型
  228. Vue.filter('workType', value => {
  229. return constant.workType[value]
  230. })
  231. // 交易类型
  232. Vue.filter('orderType', value => {
  233. let template = {
  234. APPLY: "报名",
  235. RENEW: "续费",
  236. OTHER: "其他",
  237. SMALL_CLASS_TO_BUY: "VIP购买",
  238. SPORADIC: '零星收费',
  239. LUCK: "福袋活动",
  240. PRACTICE: '网管课',
  241. PRACTICE_GROUP_BUY: '网管课购买',
  242. PRACTICE_GROUP_RENEW: '网管课续费',
  243. REPAIR: '乐器维修',
  244. OUTORDER: '外部收入',
  245. GOODS_SELL: '商品销售',
  246. SUBJECT_CHANGE: '声部更换',
  247. DOUBLE_ELEVEN2020: '双十一活动',
  248. DEGREE: '儿童节活动',
  249. DEGREE_REGISTRATION: '考级报名',
  250. MAINTENANCE: '乐器保养',
  251. REPLACEMENT: '乐器置换'
  252. }
  253. return template[value]
  254. })
  255. //
  256. Vue.filter('paymentChannelType', value => {
  257. let template = {
  258. PER: "个人",
  259. COM: "公司"
  260. }
  261. return template[value]
  262. })
  263. // 交易状态
  264. Vue.filter('dealStatus', value => {
  265. let template = {
  266. ING: "交易中",
  267. SUCCESS: "成功交易",
  268. FAILED: "交易失败",
  269. CLOSE: "交易关闭"
  270. }
  271. return template[value]
  272. })
  273. // 交易状态
  274. Vue.filter('returnStatus', value => {
  275. let template = {
  276. ING: "审核中",
  277. REJECT: "拒绝",
  278. WAIT_PAYMENT: "待支付",
  279. DONE: "完成"
  280. }
  281. return template[value]
  282. })
  283. // 缴费状态
  284. Vue.filter('payTypeStatus', val => {
  285. return constant.payStatus[val]
  286. })
  287. // 性别
  288. Vue.filter('sex', value => {
  289. let template = ['女', '男']
  290. return template[value]
  291. })
  292. // 服从调剂 isAllowAdjust
  293. Vue.filter('isAllowAdjust', value => {
  294. let template = ['否', '是']
  295. return template[value]
  296. })
  297. // 学员缴费状态 paymentStatus
  298. Vue.filter('paymentStatus', value => {
  299. let template = ['未开启缴费', '开启缴费', '已缴费']
  300. return template[value]
  301. })
  302. // 乐团状态
  303. // Vue.filter('teamStatus', value => {
  304. // let template = {
  305. // PRE_APPLY: "预报名中",
  306. // APPLY: "报名中",
  307. // PAY: "缴费中",
  308. // PREPARE: "筹备中",
  309. // PROGRESS: "进行中",
  310. // PRE_BUILD_FEE: '创建缴费中',
  311. // CANCELED: '取消',
  312. // PAUSE: '暂停',
  313. // AUDIT: '乐团审核中',
  314. // DRAFT: '编辑中',
  315. // AUDIT_FAILED: '审核失败',
  316. // FEE_AUDIT: '费用审核中',
  317. // CLOSE: '已关闭',
  318. // }
  319. // return template[value]
  320. // })
  321. // 学生状态
  322. /**studentStatus */
  323. Vue.filter('studentStatus', value => {
  324. let template = ['在读', '已退课', '退课中', '休学']
  325. return template[value]
  326. })
  327. // 学生点名
  328. Vue.filter('studentRecord', value => {
  329. let template = {
  330. NORMAL: "正常",
  331. TRUANT: "旷课",
  332. LEAVE: "请假",
  333. DROP_OUT: "退学",
  334. '': '未签到'
  335. }
  336. return template[value]
  337. })
  338. // 是否
  339. Vue.filter('yesOrNo', value => {
  340. let template = ['否', '是']
  341. return template[value]
  342. })
  343. // 学员缴费状态
  344. Vue.filter('studentPay', value => {
  345. let template = {
  346. PAID_COMPLETED: "完成缴费",
  347. NON_PAYMENT: "未缴费",
  348. PROCESSING: "缴费中",
  349. }
  350. return template[value]
  351. })
  352. // 学员点名详情
  353. Vue.filter('studentSign', value => {
  354. let template = {
  355. NORMAL: "正常",
  356. TRUANT: "旷课",
  357. LEAVE: "请假",
  358. DROP_OUT: '退学'
  359. }
  360. return template[value]
  361. })
  362. // 班级类型
  363. Vue.filter('classType', value => {
  364. let template = {
  365. NORMAL: "声部班",
  366. MIX: '合奏班',
  367. HIGH: '基础技能班',
  368. VIP: 'VIP',
  369. DEMO: '试听',
  370. SNAP: "临时班",
  371. PRACTICE: '网管课',
  372. HIGH_ONLINE: '线上基础技能课',
  373. MUSIC_NETWORK: '乐团网管课'
  374. }
  375. return template[value]
  376. })
  377. Vue.filter('teachMode', value => {
  378. return constant.teachMode[value]
  379. })
  380. // 老师状态
  381. Vue.filter('teacherStatus', value => {
  382. let template = {
  383. "0": '正常',
  384. "1": '冻结',
  385. "9": '锁定'
  386. }
  387. return template[value]
  388. })
  389. // vip课状态
  390. Vue.filter('vipCourseStatus', value => {
  391. let template = {
  392. 0: "未开始",
  393. 1: "报名中",
  394. 5: "报名结束",
  395. 2: "进行中",
  396. 4: "已结束",
  397. 3: "取消",
  398. 6:'暂停'
  399. }
  400. return template[value]
  401. })
  402. // 账号类型
  403. Vue.filter('accountTypeFormat', value => {
  404. let template = {
  405. 0: "对内",
  406. 1: "对外",
  407. }
  408. return template[value]
  409. })
  410. // 扣减库存
  411. Vue.filter('stockTypeFormat', value => {
  412. let template = {
  413. INTERNAL: "内部",
  414. EXTERNAL: "外部",
  415. ALL: "内部,外部",
  416. }
  417. return template[value]
  418. })
  419. // 交易状态
  420. Vue.filter('paymentChannelStatus', value => {
  421. let template = {
  422. YQPAY: "双乾",
  423. BALANCE: "余额",
  424. ADAPAY: "汇付"
  425. }
  426. return template[value]
  427. })
  428. // edition
  429. Vue.filter('editionFilter', value => {
  430. let template = {
  431. 'ios-teacher': '苹果-老师端',
  432. 'ios-student': '苹果-学生端',
  433. 'ios-education': '苹果-管理端',
  434. 'android-teacher': '安卓-老师端',
  435. 'android-student': '安卓-学生端',
  436. 'android-education': '安卓-管理端',
  437. }
  438. return template[value]
  439. })
  440. // payStatus 订单支付状态
  441. Vue.filter('payStatus', value => {
  442. let template = {
  443. WAIT_PAY: "等待支付",
  444. ING: "交易中",
  445. SUCCESS: '成功交易',
  446. FAILED: '交易失败',
  447. CLOSE: '交易关闭'
  448. }
  449. return template[value]
  450. })
  451. // payType 交易类型
  452. Vue.filter('payType', value => {
  453. let template = {
  454. RECHARGE: "充值",
  455. WITHDRAW: "提现",
  456. PAY_FEE: "缴费",
  457. SPORADIC: "零星收费",
  458. FILL_ACCOUNT: "人工补账",
  459. REFUNDS: "退费",
  460. REWARDS: "奖励",
  461. WAGE: "工资"
  462. }
  463. return template[value]
  464. })
  465. // 课程组状态 FINISH
  466. Vue.filter('courseGroup', value => {
  467. let template = {
  468. NORMAL: "正常",
  469. LOCK: "锁定",
  470. FINISH: '结束',
  471. CANCEL: '取消',
  472. }
  473. return template[value]
  474. })
  475. // 网管课程组
  476. Vue.filter('comCourseGroup', value => {
  477. let template = {
  478. NOT_START: "未开始",
  479. LOCK: "锁定",
  480. APPLYING: "报名中",
  481. NORMAL: "进行中",
  482. FINISH: '结束',
  483. CANCEL: '关闭',
  484. }
  485. return template[value]
  486. })
  487. //网管课类型
  488. Vue.filter('comType', value => {
  489. let template = {
  490. FREE: "免费",
  491. CHARGE: '收费',
  492. TRIAL: '试听课',
  493. CARE_PACKAGE: '关心包',
  494. COME_ON_PACKAGE: '加油包'
  495. }
  496. return template[value]
  497. })
  498. // 首充续费
  499. Vue.filter('firstOrRenewFilter', value => {
  500. let template = {
  501. '0': "续费",
  502. '1': "首次",
  503. }
  504. return template[value]
  505. })
  506. // 老师时间
  507. Vue.filter('transTypeFilter', value => {
  508. let template = {
  509. 'RECHARGE': "充值",
  510. 'CONSUME': "建课",
  511. 'RETURN': "退课",
  512. 'MANUAL_ADD': "系统充值",
  513. 'MANUAL_SUB': "系统扣除",
  514. }
  515. return template[value]
  516. })
  517. // paymentType
  518. Vue.filter('paymentType', value => {
  519. let template = {
  520. 'OFFLINE': "线下",
  521. 'ONLINE': "线上",
  522. 'ALL': "全部",
  523. }
  524. return template[value]
  525. })
  526. Vue.filter('paymentListStatus', value => {
  527. let template = {
  528. 0: "未开始",
  529. 1: "已开启",
  530. 2: "已结束",
  531. }
  532. return template[value]
  533. })
  534. // paymentStatus
  535. Vue.filter('paymentStatusDetall', value => {
  536. let template = {
  537. 'PAID_COMPLETED': "已缴费",
  538. 'PROCESSING': "缴费中",
  539. 'NON_PAYMENT': "未缴费",
  540. }
  541. return template[value]
  542. })
  543. Vue.filter('replacementInsFilter', value => {
  544. let template = {
  545. 2: "已缴费",
  546. 1: "缴费中",
  547. 0: "未缴费",
  548. }
  549. return template[value]
  550. })
  551. // 课时申诉
  552. Vue.filter('complaintsStatusEnum', value => {
  553. let template = {
  554. 0: "已拒绝",
  555. 1: "已通过",
  556. 2: "待处理",
  557. 3: "已撤销",
  558. }
  559. return template[value]
  560. })
  561. // 人事状态 isProbationPeriod
  562. Vue.filter('isProbationPeriod', value => {
  563. let template = {
  564. 0: "正式",
  565. 1: "试用",
  566. 2: "离职",
  567. }
  568. return template[value]
  569. })
  570. Vue.filter('visiterType', value => {
  571. let template = {
  572. 'TEACHER': "指导老师",
  573. 'EDU_TEACHER': "乐团主管",
  574. }
  575. return template[value]
  576. })
  577. // 人力资源人员状态
  578. Vue.filter('hrStatus', value => {
  579. let template = {
  580. 'NOT_EMPLOYED': "未录用",
  581. 'INTERVIEWING': "面试中",
  582. 'RESERVE': "储备",
  583. 'PART_TIME': "兼职",
  584. 'FULL_TIME': "全职",
  585. 'DIMISSION': "离职",
  586. }
  587. return template[value]
  588. })
  589. // 费用类型
  590. Vue.filter('feeType', value => {
  591. return constant.feeType[value]
  592. })
  593. // 费用项目
  594. Vue.filter('feeProject', value => {
  595. return constant.feeProject[value]
  596. })
  597. // 销售类型
  598. Vue.filter('saleType', value => {
  599. return constant.saleType[value]
  600. })
  601. // 缴费状态
  602. Vue.filter('teamPayStatus', value => {
  603. const tpl = {
  604. 0: '按月',
  605. 1: '按学期',
  606. 2: '一次性',
  607. }
  608. return tpl[value]
  609. })
  610. // 金额格式化
  611. Vue.filter('moneyFormat', value => {
  612. return numeral(value).format('0,0.00')
  613. })
  614. Vue.filter('stockTypeStatus', value => {
  615. const template = {
  616. INTERNAL: '内部',
  617. EXTERNAL: '外部',
  618. ALL: '全部',
  619. }
  620. return template[value]
  621. })
  622. // 确认收货类型
  623. Vue.filter('receiveFormat', value => {
  624. let template = {
  625. 'NO_RECEIVE': "未确认",
  626. 'MANUAL_RECEIVE': "手动确认",
  627. 'AUTO_RECEIVE': "自动确认",
  628. }
  629. return template[value]
  630. })
  631. // 缴费方式
  632. Vue.filter('payOrderType', value => {
  633. return constant.payOrderType[value]
  634. })
  635. // 审核状态 auditType
  636. Vue.filter('auditType', value => {
  637. return constant.auditType[value]
  638. })
  639. // 审核申请类型 auditPaymentType
  640. Vue.filter('auditPaymentType', value => {
  641. return constant.auditPaymentType[value]
  642. })
  643. // 销售收入和服务收入
  644. Vue.filter('orderServer', value => {
  645. return constant.orderServerType[value]
  646. })
  647. // 订单审核状态 orderAuditType
  648. Vue.filter('orderAuditType', value => {
  649. constant.orderAuditType[''] = '审核通过'
  650. return constant.orderAuditType[value]
  651. })
  652. Vue.filter('songUseTypeFormat', value => {
  653. return constant.songUseType[value]
  654. })
  655. Vue.filter('rewardModeTypeFormat', value => {
  656. return constant.rewardModeType[value]
  657. })
  658. // 系统日志类型
  659. Vue.filter('journalTypeFormat', value => {
  660. return constant.journalType[value]
  661. })
  662. // 日程安排 inspectionItem
  663. Vue.filter('inspectionItemFormat', value => {
  664. return constant.inspectionItem[value]
  665. })
  666. // 学员列表关心包,加油包
  667. Vue.filter('studentPackage', value => {
  668. return constant.packageStatus[value]
  669. })
  670. // 分部 学年制
  671. Vue.filter('gradeTypeFormat', value => {
  672. return constant.gradeType[value]
  673. })
  674. // 老师状态
  675. Vue.filter('ProbationPeriod', value => {
  676. return constant.ProbationPeriodStatus[value]
  677. })
  678. // 下载列表 类型
  679. // downListType
  680. Vue.filter('downListType', value => {
  681. return constant.downListType[value]
  682. })
  683. // 退团状态
  684. Vue.filter('withdrawalStatus', value => {
  685. return constant.withdrawalStatus[value]
  686. })