vueFilter.js 16 KB

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