vueFilter.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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. MEMBER: "会员购买",
  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. OTHER: "其他",
  260. }
  261. return template[value]
  262. })
  263. //
  264. Vue.filter('paymentChannelType', value => {
  265. let template = {
  266. PER: "个人",
  267. COM: "公司"
  268. }
  269. return template[value]
  270. })
  271. // 交易状态
  272. Vue.filter('dealStatus', value => {
  273. let template = {
  274. ING: "交易中",
  275. SUCCESS: "成功交易",
  276. FAILED: "交易失败",
  277. CLOSE: "交易关闭"
  278. }
  279. return template[value]
  280. })
  281. // 交易状态
  282. Vue.filter('returnStatus', value => {
  283. let template = {
  284. ING: "审核中",
  285. REJECT: "拒绝",
  286. WAIT_PAYMENT: "待支付",
  287. DONE: "完成"
  288. }
  289. return template[value]
  290. })
  291. // 缴费状态
  292. Vue.filter('payTypeStatus', val => {
  293. return constant.payStatus[val]
  294. })
  295. // 性别
  296. Vue.filter('sex', value => {
  297. let template = ['女', '男']
  298. return template[value]
  299. })
  300. // 服从调剂 isAllowAdjust
  301. Vue.filter('isAllowAdjust', value => {
  302. let template = ['否', '是']
  303. return template[value]
  304. })
  305. // 学员缴费状态 paymentStatus
  306. Vue.filter('paymentStatus', value => {
  307. let template = ['未开启缴费', '开启缴费', '已缴费']
  308. return template[value]
  309. })
  310. // 乐团状态
  311. // Vue.filter('teamStatus', value => {
  312. // let template = {
  313. // PRE_APPLY: "预报名中",
  314. // APPLY: "报名中",
  315. // PAY: "缴费中",
  316. // PREPARE: "筹备中",
  317. // PROGRESS: "进行中",
  318. // PRE_BUILD_FEE: '创建缴费中',
  319. // CANCELED: '取消',
  320. // PAUSE: '暂停',
  321. // AUDIT: '乐团审核中',
  322. // DRAFT: '编辑中',
  323. // AUDIT_FAILED: '审核失败',
  324. // FEE_AUDIT: '费用审核中',
  325. // CLOSE: '已关闭',
  326. // }
  327. // return template[value]
  328. // })
  329. // 学生状态
  330. /**studentStatus */
  331. Vue.filter('studentStatus', value => {
  332. let template = ['在读', '已退课', '退课中', '休学']
  333. return template[value]
  334. })
  335. // 学生点名
  336. Vue.filter('studentRecord', value => {
  337. let template = {
  338. NORMAL: "正常",
  339. TRUANT: "旷课",
  340. LEAVE: "请假",
  341. DROP_OUT: "退学",
  342. '': '未签到'
  343. }
  344. return template[value]
  345. })
  346. // 是否
  347. Vue.filter('yesOrNo', value => {
  348. let template = ['否', '是']
  349. return template[value]
  350. })
  351. // 学员缴费状态
  352. Vue.filter('studentPay', value => {
  353. let template = {
  354. PAID_COMPLETED: "完成缴费",
  355. NON_PAYMENT: "未缴费",
  356. PROCESSING: "缴费中",
  357. }
  358. return template[value]
  359. })
  360. // 学员点名详情
  361. Vue.filter('studentSign', value => {
  362. let template = {
  363. NORMAL: "正常",
  364. TRUANT: "旷课",
  365. LEAVE: "请假",
  366. DROP_OUT: '退学'
  367. }
  368. return template[value]
  369. })
  370. // 班级类型
  371. Vue.filter('classType', value => {
  372. let template = {
  373. NORMAL: "声部班",
  374. MIX: '合奏班',
  375. HIGH: '基础技能班',
  376. VIP: 'VIP',
  377. DEMO: '试听',
  378. SNAP: "临时班",
  379. PRACTICE: '网管课',
  380. HIGH_ONLINE: '线上基础技能课',
  381. MUSIC_NETWORK: '乐团网管课'
  382. }
  383. return template[value]
  384. })
  385. Vue.filter('teachMode', value => {
  386. return constant.teachMode[value]
  387. })
  388. // 老师状态
  389. Vue.filter('teacherStatus', value => {
  390. let template = {
  391. "0": '正常',
  392. "1": '冻结',
  393. "9": '锁定'
  394. }
  395. return template[value]
  396. })
  397. // vip课状态
  398. Vue.filter('vipCourseStatus', value => {
  399. let template = {
  400. 0: "未开始",
  401. 1: "报名中",
  402. 5: "报名结束",
  403. 2: "进行中",
  404. 4: "已结束",
  405. 3: "取消",
  406. 6:'暂停'
  407. }
  408. return template[value]
  409. })
  410. // 账号类型
  411. Vue.filter('accountTypeFormat', value => {
  412. let template = {
  413. 0: "对内",
  414. 1: "对外",
  415. }
  416. return template[value]
  417. })
  418. // 扣减库存
  419. Vue.filter('stockTypeFormat', value => {
  420. let template = {
  421. INTERNAL: "内部",
  422. EXTERNAL: "外部",
  423. ALL: "内部,外部",
  424. }
  425. return template[value]
  426. })
  427. // 交易状态
  428. Vue.filter('paymentChannelStatus', value => {
  429. let template = {
  430. YQPAY: "双乾",
  431. BALANCE: "余额",
  432. ADAPAY: "汇付"
  433. }
  434. return template[value]
  435. })
  436. // edition
  437. Vue.filter('editionFilter', value => {
  438. let template = {
  439. 'ios-teacher': '苹果-老师端',
  440. 'ios-student': '苹果-学生端',
  441. 'ios-education': '苹果-管理端',
  442. 'android-teacher': '安卓-老师端',
  443. 'android-student': '安卓-学生端',
  444. 'android-education': '安卓-管理端',
  445. }
  446. return template[value]
  447. })
  448. // payStatus 订单支付状态
  449. Vue.filter('payStatus', value => {
  450. let template = {
  451. WAIT_PAY: "等待支付",
  452. ING: "交易中",
  453. SUCCESS: '成功交易',
  454. FAILED: '交易失败',
  455. CLOSE: '交易关闭'
  456. }
  457. return template[value]
  458. })
  459. // payType 交易类型
  460. Vue.filter('payType', value => {
  461. let template = {
  462. RECHARGE: "充值",
  463. WITHDRAW: "提现",
  464. PAY_FEE: "缴费",
  465. SPORADIC: "零星收费",
  466. FILL_ACCOUNT: "人工补账",
  467. REFUNDS: "退费",
  468. REWARDS: "奖励",
  469. WAGE: "工资"
  470. }
  471. return template[value]
  472. })
  473. // 课程组状态 FINISH
  474. Vue.filter('courseGroup', value => {
  475. let template = {
  476. NORMAL: "正常",
  477. LOCK: "锁定",
  478. FINISH: '结束',
  479. CANCEL: '取消',
  480. }
  481. return template[value]
  482. })
  483. // 网管课程组
  484. Vue.filter('comCourseGroup', value => {
  485. let template = {
  486. NOT_START: "未开始",
  487. LOCK: "锁定",
  488. APPLYING: "报名中",
  489. NORMAL: "进行中",
  490. FINISH: '结束',
  491. CANCEL: '关闭',
  492. }
  493. return template[value]
  494. })
  495. //网管课类型
  496. Vue.filter('comType', value => {
  497. let template = {
  498. FREE: "免费",
  499. CHARGE: '收费',
  500. TRIAL: '试听课',
  501. CARE_PACKAGE: '关心包',
  502. COME_ON_PACKAGE: '加油包'
  503. }
  504. return template[value]
  505. })
  506. // 首充续费
  507. Vue.filter('firstOrRenewFilter', value => {
  508. let template = {
  509. '0': "续费",
  510. '1': "首次",
  511. }
  512. return template[value]
  513. })
  514. // 老师时间
  515. Vue.filter('transTypeFilter', value => {
  516. let template = {
  517. 'RECHARGE': "充值",
  518. 'CONSUME': "建课",
  519. 'RETURN': "退课",
  520. 'MANUAL_ADD': "系统充值",
  521. 'MANUAL_SUB': "系统扣除",
  522. }
  523. return template[value]
  524. })
  525. // paymentType
  526. Vue.filter('paymentType', value => {
  527. let template = {
  528. 'OFFLINE': "线下",
  529. 'ONLINE': "线上",
  530. 'ALL': "全部",
  531. }
  532. return template[value]
  533. })
  534. Vue.filter('paymentListStatus', value => {
  535. let template = {
  536. 0: "未开始",
  537. 1: "已开启",
  538. 2: "已结束",
  539. }
  540. return template[value]
  541. })
  542. // paymentStatus
  543. Vue.filter('paymentStatusDetall', value => {
  544. let template = {
  545. 'PAID_COMPLETED': "已缴费",
  546. 'PROCESSING': "缴费中",
  547. 'NON_PAYMENT': "未缴费",
  548. }
  549. return template[value]
  550. })
  551. Vue.filter('replacementInsFilter', value => {
  552. let template = {
  553. 2: "已缴费",
  554. 1: "缴费中",
  555. 0: "未缴费",
  556. }
  557. return template[value]
  558. })
  559. // 课时申诉
  560. Vue.filter('complaintsStatusEnum', value => {
  561. let template = {
  562. 0: "已拒绝",
  563. 1: "已通过",
  564. 2: "待处理",
  565. 3: "已撤销",
  566. }
  567. return template[value]
  568. })
  569. // 人事状态 isProbationPeriod
  570. Vue.filter('isProbationPeriod', value => {
  571. let template = {
  572. 0: "正式",
  573. 1: "试用",
  574. 2: "离职",
  575. }
  576. return template[value]
  577. })
  578. Vue.filter('visiterType', value => {
  579. let template = {
  580. 'TEACHER': "指导老师",
  581. 'EDU_TEACHER': "乐团主管",
  582. }
  583. return template[value]
  584. })
  585. // 人力资源人员状态
  586. Vue.filter('hrStatus', value => {
  587. let template = {
  588. 'NOT_EMPLOYED': "未录用",
  589. 'INTERVIEWING': "面试中",
  590. 'RESERVE': "储备",
  591. 'PART_TIME': "兼职",
  592. 'FULL_TIME': "全职",
  593. 'DIMISSION': "离职",
  594. }
  595. return template[value]
  596. })
  597. // 费用类型
  598. Vue.filter('feeType', value => {
  599. return constant.feeType[value]
  600. })
  601. // 费用项目
  602. Vue.filter('feeProject', value => {
  603. return constant.feeProject[value]
  604. })
  605. // 销售类型
  606. Vue.filter('saleType', value => {
  607. return constant.saleType[value]
  608. })
  609. // 缴费状态
  610. Vue.filter('teamPayStatus', value => {
  611. const tpl = {
  612. 0: '按月',
  613. 1: '按学期',
  614. 2: '一次性',
  615. }
  616. return tpl[value]
  617. })
  618. // 金额格式化
  619. Vue.filter('moneyFormat', value => {
  620. return numeral(value).format('0,0.00')
  621. })
  622. Vue.filter('stockTypeStatus', value => {
  623. const template = {
  624. INTERNAL: '内部',
  625. EXTERNAL: '外部',
  626. ALL: '全部',
  627. }
  628. return template[value]
  629. })
  630. // 确认收货类型
  631. Vue.filter('receiveFormat', value => {
  632. let template = {
  633. 'NO_RECEIVE': "未确认",
  634. 'MANUAL_RECEIVE': "手动确认",
  635. 'AUTO_RECEIVE': "自动确认",
  636. }
  637. return template[value]
  638. })
  639. // 缴费方式
  640. Vue.filter('payOrderType', value => {
  641. return constant.payOrderType[value]
  642. })
  643. // 审核状态 auditType
  644. Vue.filter('auditType', value => {
  645. return constant.auditType[value]
  646. })
  647. // 审核申请类型 auditPaymentType
  648. Vue.filter('auditPaymentType', value => {
  649. return constant.auditPaymentType[value]
  650. })
  651. // 销售收入和服务收入
  652. Vue.filter('orderServer', value => {
  653. return constant.orderServerType[value]
  654. })
  655. // 订单审核状态 orderAuditType
  656. Vue.filter('orderAuditType', value => {
  657. constant.orderAuditType[''] = '审核通过'
  658. return constant.orderAuditType[value]
  659. })
  660. Vue.filter('songUseTypeFormat', value => {
  661. return constant.songUseType[value]
  662. })
  663. Vue.filter('rewardModeTypeFormat', value => {
  664. return constant.rewardModeType[value]
  665. })
  666. // 系统日志类型
  667. Vue.filter('journalTypeFormat', value => {
  668. return constant.journalType[value]
  669. })
  670. // 日程安排 inspectionItem
  671. Vue.filter('inspectionItemFormat', value => {
  672. return constant.inspectionItem[value]
  673. })
  674. // 学员列表关心包,加油包
  675. Vue.filter('studentPackage', value => {
  676. return constant.packageStatus[value]
  677. })
  678. // 分部 学年制
  679. Vue.filter('gradeTypeFormat', value => {
  680. return constant.gradeType[value]
  681. })
  682. // 老师状态
  683. Vue.filter('ProbationPeriod', value => {
  684. return constant.ProbationPeriodStatus[value]
  685. })
  686. // 下载列表 类型
  687. // downListType
  688. Vue.filter('downListType', value => {
  689. return constant.downListType[value]
  690. })
  691. // 退团状态
  692. Vue.filter('withdrawalStatus', value => {
  693. return constant.withdrawalStatus[value]
  694. })
  695. //
  696. Vue.filter('conclusionStatus', value => {
  697. return constant.conclusion[value]
  698. })