vueFilter.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. import Vue from 'vue'
  2. // 合并数组
  3. Vue.filter('joinArray', (value, type) => {
  4. if (!type) {
  5. type = ' '
  6. }
  7. if (typeof value == 'object' && value != null) {
  8. return value.join(type)
  9. } else {
  10. return value
  11. }
  12. })
  13. // 合作单位
  14. Vue.filter('branchType', (value) => {
  15. let template = {
  16. OWN: "自有",
  17. COOPERATION: "合作",
  18. LEASE: "租赁"
  19. }
  20. return template[value]
  21. })
  22. // 商品类型
  23. Vue.filter('shopType', (value) => {
  24. let template = {
  25. "INSTRUMENT": "乐器",
  26. "ACCESSORIES": "辅件",
  27. "TEACHING": "教材",
  28. "STAFF": "教谱",
  29. "OTHER": "其它",
  30. }
  31. return template[value]
  32. })
  33. // 乐团状态
  34. Vue.filter('musicGroupType', (value) => {
  35. let template = {
  36. APPLY: "报名中",
  37. PAY: "缴费中",
  38. PREPARE: "筹备中",
  39. PROGRESS: "进行中",
  40. CANCELED: '取消',
  41. PAUSE: '暂停',
  42. AUDIT: '审核中',
  43. DRAFT: '编辑中',
  44. AUDIT_FAILED: '审核失败'
  45. }
  46. return template[value]
  47. })
  48. // 乐团学员状态
  49. Vue.filter('musicGroupStudentType', (value) => {
  50. let template = {
  51. NORMAL: "在读",
  52. LEAVE: "请假",
  53. QUIT: "退团"
  54. }
  55. return template[value]
  56. })
  57. // 乐团学员状态
  58. Vue.filter('instrumentType', (value) => {
  59. let template = {
  60. GROUP: "团购",
  61. OWNED: "自备",
  62. LEASE: "租赁"
  63. }
  64. return template[value]
  65. })
  66. // 课程类型
  67. Vue.filter('coursesType', (value) => {
  68. let template = {
  69. NORMAL: '单技课',
  70. SINGLE: '单技课',
  71. MIX: "合奏课",
  72. HIGH: "基础技能课",
  73. VIP: "VIP课",
  74. DEMO: "试听课",
  75. COMPREHENSIVE: '综合课',
  76. PRACTICE: '练习课',
  77. ENLIGHTENMENT: '启蒙课',
  78. TRAINING: '集训课',
  79. TRAINING_SINGLE: '集训单技课',
  80. TRAINING_MIX: '集训合奏课',
  81. CLASSROOM: '课堂课',
  82. PRACTICE:'陪练课'
  83. }
  84. return template[value]
  85. })
  86. // 课程状态
  87. Vue.filter('coursesStatus', (value) => {
  88. let template = {
  89. NOT_START: "未开始",
  90. UNDERWAY: "进行中",
  91. OVER: "已结束"
  92. }
  93. return template[value]
  94. })
  95. // 考勤类型
  96. Vue.filter('clockingIn', value => {
  97. let templateStatus = {
  98. NORMAL: "正常",
  99. TRUANT: "旷课",
  100. LEAVE: "请假",
  101. QUIT_SCHOOL: "休学",
  102. DROP_OUT: "退学"
  103. }
  104. return templateStatus[value]
  105. })
  106. // 时间处理
  107. Vue.filter('formatTimer', (value) => {
  108. if (value) {
  109. return value.split(' ')[0]
  110. } else {
  111. return value
  112. }
  113. })
  114. // 时间处理
  115. Vue.filter('timer', (value) => {
  116. if (value) {
  117. let tempDate = new Date(value)
  118. let month = tempDate.getHours() >= 10 ? tempDate.getHours() : '0' + tempDate.getHours()
  119. let days = tempDate.getMinutes() >= 10 ? tempDate.getMinutes() : '0' + tempDate.getMinutes()
  120. return month + ':' + days
  121. } else {
  122. return value
  123. }
  124. })
  125. // 格式化成星期
  126. Vue.filter('formatWeek', date => {
  127. let nd = new Date(date)
  128. let temp = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  129. return temp[nd.getDay()]
  130. })
  131. // 职位
  132. Vue.filter('jobType', value => {
  133. let template = {
  134. ADVISER: "指导老师",
  135. ACADEMIC: "教务老师",
  136. TEACHING: "乐队指导"
  137. }
  138. return template[value]
  139. })
  140. // 工作类型
  141. Vue.filter('jobNature', (value) => {
  142. let template = {
  143. PART_TIME: "兼职",
  144. FULL_TIME: "全职",
  145. TEMPORARY: "临时工"
  146. }
  147. return template[value]
  148. })
  149. // 考勤状态
  150. Vue.filter('attendanceType', value => {
  151. let template = {
  152. 0: "异常签到",
  153. 1: "正常签到",
  154. 3: "未签到"
  155. }
  156. return template[value]
  157. })
  158. // 考情签退
  159. Vue.filter('attendanceOutType', value => {
  160. let template = {
  161. 0: "异常签退",
  162. 1: "正常签退",
  163. 3: "未签退"
  164. }
  165. return template[value]
  166. })
  167. // 上课类型
  168. Vue.filter('workType', value => {
  169. let template = {
  170. TEACHING: "助教",
  171. BISHOP: "主教"
  172. }
  173. return template[value]
  174. })
  175. // 交易类型
  176. Vue.filter('orderType', value => {
  177. let template = {
  178. APPLY: "报名",
  179. RENEW: "续费",
  180. OTHER: "其他",
  181. SMALL_CLASS_TO_BUY: "VIP购买",
  182. SPORADIC: '零星收费',
  183. LUCK: "福袋活动"
  184. }
  185. return template[value]
  186. })
  187. //
  188. Vue.filter('paymentChannelType', value => {
  189. let template = {
  190. PER: "个人",
  191. COM: "公司"
  192. }
  193. return template[value]
  194. })
  195. // 交易状态
  196. Vue.filter('dealStatus', value => {
  197. let template = {
  198. ING: "交易中",
  199. SUCCESS: "成功交易",
  200. FAILED: "交易失败",
  201. CLOSE: "交易关闭"
  202. }
  203. return template[value]
  204. })
  205. // 交易状态
  206. Vue.filter('returnStatus', value => {
  207. let template = {
  208. ING: "审核中",
  209. REJECT: "拒绝",
  210. WAIT_PAYMENT: "待支付",
  211. DONE: "完成"
  212. }
  213. return template[value]
  214. })
  215. // 性别
  216. Vue.filter('sex', value => {
  217. let template = ['女', '男']
  218. return template[value]
  219. })
  220. // 服从调剂 isAllowAdjust
  221. Vue.filter('isAllowAdjust', value => {
  222. let template = ['否', '是']
  223. return template[value]
  224. })
  225. // 学员缴费状态 paymentStatus
  226. Vue.filter('paymentStatus', value => {
  227. let template = ['未开启缴费', '开启缴费', '已缴费']
  228. return template[value]
  229. })
  230. // 乐团状态
  231. Vue.filter('teamStatus', value => {
  232. let template = {
  233. APPLY: "报名中",
  234. PAY: "缴费中",
  235. PREPARE: "筹备中",
  236. PROGRESS: "进行中",
  237. CANCELED: '取消',
  238. PAUSE: '暂停',
  239. AUDIT: '审核中',
  240. DRAFT: '编辑中',
  241. AUDIT_FAILED: '审核失败'
  242. }
  243. return template[value]
  244. })
  245. // 学生状态
  246. /**studentStatus */
  247. Vue.filter('studentStatus', value => {
  248. let template = ['在读', '已退课', '退课中', '休学']
  249. return template[value]
  250. })
  251. // 学生点名
  252. Vue.filter('studentRecord', value => {
  253. let template = {
  254. NORMAL: "正常",
  255. TRUANT: "旷课",
  256. LEAVE: "请假",
  257. DROP_OUT: "退学",
  258. '': '未签到'
  259. }
  260. return template[value]
  261. })
  262. // 是否
  263. Vue.filter('yesOrNo', value => {
  264. let template = ['否', '是']
  265. return template[value]
  266. })
  267. // 学员缴费状态
  268. Vue.filter('studentPay', value => {
  269. let template = {
  270. PAID_COMPLETED: "完成缴费",
  271. NON_PAYMENT: "未缴费",
  272. PROCESSING: "缴费中",
  273. }
  274. return template[value]
  275. })
  276. // 学员点名详情
  277. Vue.filter('studentSign', value => {
  278. let template = {
  279. NORMAL: "正常",
  280. TRUANT: "旷课",
  281. LEAVE: "请假",
  282. DROP_OUT: '退学'
  283. }
  284. return template[value]
  285. })
  286. // 班级类型
  287. Vue.filter('classType', value => {
  288. let template = {
  289. NORMAL: "单技班",
  290. MIX: '合奏班',
  291. HIGH: '基础技能班',
  292. VIP: 'VIP',
  293. DEMO: '试听',
  294. SNAP: "临时班"
  295. }
  296. return template[value]
  297. })
  298. Vue.filter('teachMode', value => {
  299. let template = {
  300. ONLINE: "线上课",
  301. OFFLINE: '线下课'
  302. }
  303. return template[value]
  304. })
  305. // 老师状态
  306. Vue.filter('teacherStatus', value => {
  307. let template = {
  308. "0": '正常',
  309. "1": '冻结',
  310. "9": '锁定'
  311. }
  312. return template[value]
  313. })
  314. // vip课状态
  315. Vue.filter('vipCourseStatus', value => {
  316. let template = {
  317. 0: "未开始",
  318. 1: "报名中",
  319. 5: "报名结束",
  320. 2: "进行中",
  321. 4: "已结束",
  322. 3: "取消"
  323. }
  324. return template[value]
  325. })
  326. // 交易状态
  327. Vue.filter('paymentChannelStatus', value => {
  328. let template = {
  329. YQPAY: "双乾",
  330. BALANCE: "余额"
  331. }
  332. return template[value]
  333. })