vueFilter.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. import Vue from 'vue'
  2. import dayjs from 'dayjs'
  3. import { feeProject, feeType, saleType } from '../constant'
  4. // 合并数组
  5. Vue.filter('joinArray', (value, type) => {
  6. if (!type) {
  7. type = ' '
  8. }
  9. if (typeof value == 'object' && value != null) {
  10. return value.join(type)
  11. } else {
  12. return value
  13. }
  14. })
  15. // 合作单位
  16. Vue.filter('branchType', (value) => {
  17. let template = {
  18. OWN: "自有",
  19. COOPERATION: "合作",
  20. LEASE: "租赁"
  21. }
  22. return template[value]
  23. })
  24. // 商品类型
  25. Vue.filter('shopType', (value) => {
  26. let template = {
  27. "INSTRUMENT": "乐器",
  28. "ACCESSORIES": "辅件",
  29. "TEACHING": "教材",
  30. "STAFF": "教谱",
  31. "OTHER": "其它",
  32. }
  33. return template[value]
  34. })
  35. // 乐团状态
  36. Vue.filter('musicGroupType', (value) => {
  37. let template = {
  38. APPLY: "报名中",
  39. PAY: "缴费中",
  40. PREPARE: "筹备中",
  41. PROGRESS: "进行中",
  42. CANCELED: '取消',
  43. PAUSE: '暂停',
  44. AUDIT: '审核中',
  45. DRAFT: '编辑中',
  46. AUDIT_FAILED: '审核失败'
  47. }
  48. return template[value]
  49. })
  50. // 乐团学员状态
  51. Vue.filter('musicGroupStudentType', (value) => {
  52. let template = {
  53. NORMAL: "在读",
  54. LEAVE: "请假",
  55. QUIT: "退团",
  56. APPLY: '报名'
  57. }
  58. return template[value]
  59. })
  60. // 乐团学员状态
  61. Vue.filter('instrumentType', (value) => {
  62. let template = {
  63. GROUP: "团购",
  64. OWNED: "自备",
  65. LEASE: "租赁"
  66. }
  67. return template[value]
  68. })
  69. // 课程类型
  70. Vue.filter('coursesType', (value) => {
  71. let template = {
  72. NORMAL: '单技课',
  73. SINGLE: '单技课',
  74. MIX: "合奏课",
  75. HIGH: "基础技能课",
  76. VIP: "VIP课",
  77. DEMO: "试听课",
  78. COMPREHENSIVE: '综合课',
  79. // PRACTICE: '练习课',
  80. ENLIGHTENMENT: '启蒙课',
  81. TRAINING: '集训课',
  82. TRAINING_SINGLE: '集训单技课',
  83. TRAINING_MIX: '集训合奏课',
  84. CLASSROOM: '课堂课',
  85. PRACTICE: '网管课',
  86. COMM: '对外课',
  87. MUSIC: '乐团课',
  88. HIGH_ONLINE: '线上基础技能课',
  89. MUSIC_NETWORK: '乐团网管课'
  90. }
  91. return template[value]
  92. })
  93. // 课程状态
  94. Vue.filter('coursesStatus', (value) => {
  95. let template = {
  96. NOT_START: "未开始",
  97. UNDERWAY: "进行中",
  98. OVER: "已结束"
  99. }
  100. return template[value]
  101. })
  102. // 考勤类型
  103. Vue.filter('clockingIn', value => {
  104. let templateStatus = {
  105. NORMAL: "正常",
  106. TRUANT: "旷课",
  107. LEAVE: "请假",
  108. QUIT_SCHOOL: "休学",
  109. DROP_OUT: "退学"
  110. }
  111. return templateStatus[value]
  112. })
  113. // 学员状态
  114. Vue.filter('studentTeamStatus', value => {
  115. let templateStatus = {
  116. NORMAL: "在读",
  117. QUIT: "退团",
  118. QUIT_SCHOOL: "休学",
  119. APPLY: '报名'
  120. }
  121. return templateStatus[value]
  122. })
  123. // 时间处理
  124. Vue.filter('dayjsFormat', (value) => {
  125. if (value) {
  126. return dayjs(value).format('YYYY-MM-DD')
  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('timer', (value) => {
  154. if (value) {
  155. let tempDate = new Date(value)
  156. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  157. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  158. return month + ':' + days
  159. } else {
  160. return value
  161. }
  162. })
  163. // 格式化成星期
  164. Vue.filter('formatWeek', date => {
  165. let nd = new Date(date)
  166. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  167. return temp[nd.getDay()]
  168. })
  169. // 职位
  170. Vue.filter('jobType', value => {
  171. let template = {
  172. ADVISER: "指导老师",
  173. ACADEMIC: "教务老师",
  174. TEACHING: "乐队指导"
  175. }
  176. return template[value]
  177. })
  178. // 工作类型
  179. Vue.filter('jobNature', (value) => {
  180. let template = {
  181. PART_TIME: "兼职",
  182. FULL_TIME: "全职",
  183. TEMPORARY: "临时工"
  184. }
  185. return template[value]
  186. })
  187. // 考勤状态
  188. Vue.filter('attendanceType', value => {
  189. let template = {
  190. 0: "异常签到",
  191. 1: "正常签到",
  192. 3: "未签到"
  193. }
  194. return template[value]
  195. })
  196. // 考情签退
  197. Vue.filter('attendanceOutType', value => {
  198. let template = {
  199. 0: "异常签退",
  200. 1: "正常签退",
  201. 3: "未签退"
  202. }
  203. return template[value]
  204. })
  205. // 上课类型
  206. Vue.filter('workType', value => {
  207. let template = {
  208. TEACHING: "助教",
  209. BISHOP: "主教"
  210. }
  211. return template[value]
  212. })
  213. // 交易类型
  214. Vue.filter('orderType', value => {
  215. let template = {
  216. APPLY: "报名",
  217. RENEW: "续费",
  218. OTHER: "其他",
  219. SMALL_CLASS_TO_BUY: "VIP购买",
  220. SPORADIC: '零星收费',
  221. LUCK: "福袋活动",
  222. PRACTICE: '网管课',
  223. PRACTICE_GROUP_BUY: '网管课购买',
  224. PRACTICE_GROUP_RENEW: '网管课续费',
  225. REPAIR: '乐器维修'
  226. }
  227. return template[value]
  228. })
  229. //
  230. Vue.filter('paymentChannelType', value => {
  231. let template = {
  232. PER: "个人",
  233. COM: "公司"
  234. }
  235. return template[value]
  236. })
  237. // 交易状态
  238. Vue.filter('dealStatus', value => {
  239. let template = {
  240. ING: "交易中",
  241. SUCCESS: "成功交易",
  242. FAILED: "交易失败",
  243. CLOSE: "交易关闭"
  244. }
  245. return template[value]
  246. })
  247. // 交易状态
  248. Vue.filter('returnStatus', value => {
  249. let template = {
  250. ING: "审核中",
  251. REJECT: "拒绝",
  252. WAIT_PAYMENT: "待支付",
  253. DONE: "完成"
  254. }
  255. return template[value]
  256. })
  257. // 性别
  258. Vue.filter('sex', value => {
  259. let template = ['女', '男']
  260. return template[value]
  261. })
  262. // 服从调剂 isAllowAdjust
  263. Vue.filter('isAllowAdjust', value => {
  264. let template = ['否', '是']
  265. return template[value]
  266. })
  267. // 学员缴费状态 paymentStatus
  268. Vue.filter('paymentStatus', value => {
  269. let template = ['未开启缴费', '开启缴费', '已缴费']
  270. return template[value]
  271. })
  272. // 乐团状态
  273. Vue.filter('teamStatus', value => {
  274. let template = {
  275. APPLY: "报名中",
  276. PAY: "缴费中",
  277. PREPARE: "筹备中",
  278. PROGRESS: "进行中",
  279. CANCELED: '取消',
  280. PAUSE: '暂停',
  281. AUDIT: '审核中',
  282. DRAFT: '编辑中',
  283. AUDIT_FAILED: '审核失败'
  284. }
  285. return template[value]
  286. })
  287. // 学生状态
  288. /**studentStatus */
  289. Vue.filter('studentStatus', value => {
  290. let template = ['在读', '已退课', '退课中', '休学']
  291. return template[value]
  292. })
  293. // 学生点名
  294. Vue.filter('studentRecord', value => {
  295. let template = {
  296. NORMAL: "正常",
  297. TRUANT: "旷课",
  298. LEAVE: "请假",
  299. DROP_OUT: "退学",
  300. '': '未签到'
  301. }
  302. return template[value]
  303. })
  304. // 是否
  305. Vue.filter('yesOrNo', value => {
  306. let template = ['否', '是']
  307. return template[value]
  308. })
  309. // 学员缴费状态
  310. Vue.filter('studentPay', value => {
  311. let template = {
  312. PAID_COMPLETED: "完成缴费",
  313. NON_PAYMENT: "未缴费",
  314. PROCESSING: "缴费中",
  315. }
  316. return template[value]
  317. })
  318. // 学员点名详情
  319. Vue.filter('studentSign', value => {
  320. let template = {
  321. NORMAL: "正常",
  322. TRUANT: "旷课",
  323. LEAVE: "请假",
  324. DROP_OUT: '退学'
  325. }
  326. return template[value]
  327. })
  328. // 班级类型
  329. Vue.filter('classType', value => {
  330. let template = {
  331. NORMAL: "单技班",
  332. MIX: '合奏班',
  333. HIGH: '基础技能班',
  334. VIP: 'VIP',
  335. DEMO: '试听',
  336. SNAP: "临时班",
  337. PRACTICE: '网管课',
  338. HIGH_ONLINE: '线上基础技能课',
  339. MUSIC_NETWORK: '乐团网管课'
  340. }
  341. return template[value]
  342. })
  343. Vue.filter('teachMode', value => {
  344. let template = {
  345. ONLINE: "线上课",
  346. OFFLINE: '线下课'
  347. }
  348. return template[value]
  349. })
  350. // 老师状态
  351. Vue.filter('teacherStatus', value => {
  352. let template = {
  353. "0": '正常',
  354. "1": '冻结',
  355. "9": '锁定'
  356. }
  357. return template[value]
  358. })
  359. // vip课状态
  360. Vue.filter('vipCourseStatus', value => {
  361. let template = {
  362. 0: "未开始",
  363. 1: "报名中",
  364. 5: "报名结束",
  365. 2: "进行中",
  366. 4: "已结束",
  367. 3: "取消"
  368. }
  369. return template[value]
  370. })
  371. // 交易状态
  372. Vue.filter('paymentChannelStatus', value => {
  373. let template = {
  374. YQPAY: "双乾",
  375. BALANCE: "余额",
  376. ADAPAY: "汇付"
  377. }
  378. return template[value]
  379. })
  380. // edition
  381. Vue.filter('editionFilter', value => {
  382. let template = {
  383. 'ios-teacher': '苹果-老师端',
  384. 'ios-student': '苹果-学生端',
  385. 'ios-education': '苹果-教务端',
  386. 'android-teacher': '安卓-老师端',
  387. 'android-student': '安卓-学生端',
  388. 'android-education': '安卓-教务端',
  389. }
  390. return template[value]
  391. })
  392. // payStatus 订单支付状态
  393. Vue.filter('payStatus', value => {
  394. let template = {
  395. WAIT_PAY: "等待支付",
  396. ING: "交易中",
  397. SUCCESS: '成功交易',
  398. FAILED: '交易失败',
  399. CLOSE: '交易关闭'
  400. }
  401. return template[value]
  402. })
  403. // payType 交易类型
  404. Vue.filter('payType', value => {
  405. let template = {
  406. RECHARGE: "充值",
  407. WITHDRAW: "提现",
  408. PAY_FEE: "缴费",
  409. SPORADIC: "零星收费",
  410. FILL_ACCOUNT: "人工补账",
  411. REFUNDS: "退费",
  412. REWARDS: "奖励",
  413. WAGE: "工资"
  414. }
  415. return template[value]
  416. })
  417. // 课程组状态 FINISH
  418. Vue.filter('courseGroup', value => {
  419. let template = {
  420. NORMAL: "正常",
  421. LOCK: "锁定",
  422. FINISH: '结束',
  423. CANCEL: '取消',
  424. }
  425. return template[value]
  426. })
  427. // 网管课程组
  428. Vue.filter('comCourseGroup', value => {
  429. let template = {
  430. NORMAL: "进行中",
  431. FINISH: '结束',
  432. CANCEL: '关闭',
  433. }
  434. return template[value]
  435. })
  436. //网管课类型
  437. Vue.filter('comType', value => {
  438. let template = {
  439. FREE: "免费",
  440. CHARGE: '收费',
  441. TRIAL: '试听课',
  442. }
  443. return template[value]
  444. })
  445. // 首充续费
  446. Vue.filter('firstOrRenewFilter', value => {
  447. let template = {
  448. '0': "续费",
  449. '1': "首次",
  450. }
  451. return template[value]
  452. })
  453. // 老师时间
  454. Vue.filter('transTypeFilter', value => {
  455. let template = {
  456. 'RECHARGE': "充值",
  457. 'CONSUME': "建课",
  458. 'RETURN': "退课",
  459. 'MANUAL_ADD': "系统充值",
  460. 'MANUAL_SUB': "系统扣除",
  461. }
  462. return template[value]
  463. })
  464. // paymentType
  465. Vue.filter('paymentType', value => {
  466. let template = {
  467. 'OFFLINE': "线下",
  468. 'ONLINE': "线上",
  469. 'ALL': "全部",
  470. }
  471. return template[value]
  472. })
  473. Vue.filter('paymentListStatus', value => {
  474. let template = {
  475. 0: "未开始",
  476. 1: "已开启",
  477. 2: "已结束",
  478. }
  479. return template[value]
  480. })
  481. // paymentStatus
  482. Vue.filter('paymentStatusDetall', value => {
  483. let template = {
  484. 'PAID_COMPLETED': "已缴费",
  485. 'PROCESSING': "缴费中",
  486. 'NON_PAYMENT': "未缴费",
  487. }
  488. return template[value]
  489. })
  490. // 课时申诉
  491. Vue.filter('complaintsStatusEnum', value => {
  492. let template = {
  493. 0: "已拒绝",
  494. 1: "已通过",
  495. 2: "待处理",
  496. 3: "已撤销",
  497. }
  498. return template[value]
  499. })
  500. // 人事状态 isProbationPeriod
  501. Vue.filter('isProbationPeriod', value => {
  502. let template = {
  503. 0: "正式",
  504. 1: "试用",
  505. 2: "离职",
  506. }
  507. return template[value]
  508. })
  509. Vue.filter('visiterType', value => {
  510. let template = {
  511. 'TEACHER': "指导老师",
  512. 'EDU_TEACHER': "教务老师",
  513. }
  514. return template[value]
  515. })
  516. // 人力资源人员状态
  517. Vue.filter('hrStatus', value => {
  518. let template = {
  519. 'NOT_EMPLOYED': "未录用",
  520. 'INTERVIEWING': "面试中",
  521. 'RESERVE': "储备",
  522. 'PART_TIME': "兼职",
  523. 'FULL_TIME': "全职",
  524. 'DIMISSION': "离职",
  525. }
  526. return template[value]
  527. })
  528. // 费用类型
  529. Vue.filter('feeType', value => {
  530. return feeType[value]
  531. })
  532. // 费用项目
  533. Vue.filter('feeProject', value => {
  534. return feeProject[value]
  535. })
  536. // 销售类型
  537. Vue.filter('saleType', value => {
  538. return saleType[value]
  539. })