vueFilter.js 16 KB

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