vueFilter.js 16 KB

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