filters.ts 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. import * as constant from './constant'
  2. // 公共处理
  3. export const getMapValueByKey = (key: string, map: Map<string, string>) => {
  4. if (key && map) {
  5. let value = map.get(key);
  6. if (value) {
  7. return value;
  8. }
  9. }
  10. return key
  11. }
  12. // 岗位管理
  13. export const filterPosition = (key: 'IM_SERVICE' | 'REPAIR' | 'STAFF' | '') => {
  14. if (key && constant.position && constant.position[key]) {
  15. return constant.position[key]
  16. } else {
  17. return key
  18. }
  19. }
  20. // 员工状态
  21. export const filterEmployee = (key: 'LOCKED' | 'ACTIVATION' | '') => {
  22. if (key && constant.employee && constant.employee[key]) {
  23. return constant.employee[key]
  24. } else {
  25. return key
  26. }
  27. }
  28. // 办学性质
  29. export const filterSchoolNature = (key: 'PRIVATE' | 'PUBLIC' | '') => {
  30. if (key && constant.schoolNature && constant.schoolNature[key]) {
  31. return constant.schoolNature[key]
  32. } else {
  33. return key
  34. }
  35. }
  36. // 学年制
  37. export const filterSchoolSystem = (key: 'fiveYearSystem' | 'sixYearSystem' | '') => {
  38. if (key && constant.schoolSystem && constant.schoolSystem[key]) {
  39. return constant.schoolSystem[key]
  40. } else {
  41. return key
  42. }
  43. }
  44. // 支付服务提供方
  45. export const filterOpenType = (key: 'ORIGINAL' | 'ADAPAY' | 'OTHER' | '') => {
  46. if (key && constant.openType && constant.openType[key]) {
  47. return constant.openType[key]
  48. } else {
  49. return key
  50. }
  51. }
  52. // 客户端类型
  53. export const filterClientType = (
  54. key: 'BACKEND' | 'SCHOOL' | 'TEACHER' | 'STUDENT' | 'REPAIR' | ''
  55. ) => {
  56. if (key && constant.clientType && constant.clientType[key]) {
  57. return constant.clientType[key]
  58. } else {
  59. return key
  60. }
  61. }
  62. // 协议类型
  63. export const filterProtocolType = (key: 'BUY_ORDER' | 'WITHDRAW' | 'REGISTER' | '') => {
  64. if (key && constant.protocolType && constant.protocolType[key]) {
  65. return constant.protocolType[key]
  66. } else {
  67. return key
  68. }
  69. }
  70. // 消息组
  71. export const filterMessageGroup = (key: 'SYSTEM' | 'COURSE' | '') => {
  72. if (key && constant.messageGroup && constant.messageGroup[key]) {
  73. return constant.messageGroup[key]
  74. } else {
  75. return key
  76. }
  77. }
  78. // 平台建议
  79. export const filterSuggestionType = (key: 'APP' | 'SMART_PRACTICE' | '') => {
  80. if (key && constant.suggestionType && constant.suggestionType[key]) {
  81. return constant.suggestionType[key]
  82. } else {
  83. return key
  84. }
  85. }
  86. // 内容分类
  87. export const filterContentCategory = (
  88. key: 'HOT_CONSULTATION' | 'OPEN_SCREEN_AD' | 'FLASH_PAGE' | 'ROTATION_CHART' | 'MUSIC' | ''
  89. ) => {
  90. if (key && constant.contentCategory && constant.contentCategory[key]) {
  91. return constant.contentCategory[key]
  92. } else {
  93. return key
  94. }
  95. }
  96. // 交付团类型 filterGroupType
  97. export const filterGroupType = (
  98. key: 'SINGLE_DELIVERY' | 'MULTIPLE_DELIVERY' | 'MULTIPLE_DELIVERY_SCHOOL'
  99. ) => {
  100. if (key && constant.orchestraTypes && constant.orchestraTypes[key]) {
  101. return constant.orchestraTypes[key]
  102. }
  103. }
  104. // 乐团类型
  105. export const filterOrchestraType = (key: 'DELIVERY' | 'PROMOTION') => {
  106. if (key && constant.orchestraType && constant.orchestraType[key]) {
  107. return constant.orchestraType[key]
  108. }
  109. }
  110. // 乐团状态 SUBJECT_CONFIG
  111. export const filterGroupStatus = (
  112. key: 'INITIATION_SURVEY' | 'PRE_REGISTER' | 'REGISTER' | 'DOING' | 'DONE' | 'CLOSE'
  113. ) => {
  114. if (key && constant.musicStatus && constant.musicStatus[key]) {
  115. return constant.musicStatus[key]
  116. }
  117. }
  118. // 播放类型
  119. export const filterAudioType = (key: 'MP3' | 'MIDI' | '') => {
  120. if (key && constant.audioType && constant.audioType[key]) {
  121. return constant.audioType[key]
  122. } else {
  123. return key
  124. }
  125. }
  126. // 伴奏类型
  127. export const filterAccompanimentType = (key: 'HOMEMODE' | 'COMMON' | '') => {
  128. if (key && constant.accompanimentType && constant.accompanimentType[key]) {
  129. return constant.accompanimentType[key]
  130. } else {
  131. return key
  132. }
  133. }
  134. // 课程类型
  135. export const filterCourseEmnu = (
  136. key:
  137. | 'PERCUSSION_SINGLE'
  138. | 'FLUTE_SINGLE'
  139. | 'SAX_SINGLE'
  140. | 'CLARINET_SINGLE'
  141. | 'TRUMPET_SINGLE'
  142. | 'TROMBONE_SINGLE'
  143. | 'HORN_SINGLE'
  144. | 'BARITONE_TUBA_SINGLE'
  145. | 'EUPHONIUM_SINGLE'
  146. | 'TUBA_SINGLE'
  147. | 'MUSIC_THEORY'
  148. | 'INSTRUMENTAL_ENSEMBLE'
  149. | ''
  150. ) => {
  151. if (key && constant.courseEmnu && constant.courseEmnu[key]) {
  152. return constant.courseEmnu[key]
  153. } else {
  154. return key
  155. }
  156. }
  157. // 课程状态 courseStatus
  158. export const filterCourseStatus = (key: 'NOT_START' | 'ING' | 'COMPLETE') => {
  159. if (key && constant.courseStatus && constant.courseStatus[key]) {
  160. return constant.courseStatus[key]
  161. } else {
  162. return key
  163. }
  164. }
  165. // 学生状态
  166. export const filterStudentStatusEmnu = (key: 'REGISTER' | 'LEARNING' | 'OUTOF_ORCHESTRA') => {
  167. if (key && constant.studentStatusEmnu && constant.studentStatusEmnu[key]) {
  168. return constant.studentStatusEmnu[key]
  169. } else {
  170. return key
  171. }
  172. }
  173. // 订单状态
  174. export const filterOrderStatus = (
  175. key:
  176. | 'WAIT_PAY'
  177. | 'PAYING'
  178. | 'PAID'
  179. | 'TIMEOUT'
  180. | 'FAIL'
  181. | 'CLOSED'
  182. | 'REFUNDING'
  183. | 'REFUNDED'
  184. | ''
  185. ) => {
  186. if (key && constant.orderStatus && constant.orderStatus[key]) {
  187. return constant.orderStatus[key]
  188. } else {
  189. return key
  190. }
  191. }
  192. // 订单类型
  193. export const filterOrderType = (key: 'VIP' | 'ORCHESTRA' | '') => {
  194. if (key && constant.orderType && constant.orderType[key]) {
  195. return constant.orderType[key]
  196. } else {
  197. return key
  198. }
  199. }
  200. // 审核交易状态
  201. export const filterReportStatus = (key: 'SUCCESSED' | 'FAILED' | 'PENDDING' | '') => {
  202. if (key && constant.reportStatus && constant.reportStatus[key]) {
  203. return constant.reportStatus[key]
  204. } else {
  205. return key
  206. }
  207. }
  208. // 交易状态
  209. export const filterTradeStatus = (key: 'SUCCESSED' | 'FAILED' | 'PENDDING' | '') => {
  210. if (key && constant.tradeStatus && constant.tradeStatus[key]) {
  211. return constant.tradeStatus[key]
  212. } else {
  213. return key
  214. }
  215. }
  216. // 交易状态
  217. export const filterRefundStatus = (key: 'PASS' | 'REJECT' | 'ING' | 'CLOSED' | '') => {
  218. if (key && constant.refundStatus && constant.refundStatus[key]) {
  219. return constant.refundStatus[key]
  220. } else {
  221. return key
  222. }
  223. }
  224. // 学生考勤类型 attendanceStatus
  225. export const filterAttendanceStatus = (
  226. key: 'LATE' | 'NORMAL' | 'LEAVE' | 'TRUANCY' | 'UNCALLED' | ''
  227. ) => {
  228. if (key && constant.attendanceStatus && constant.attendanceStatus[key]) {
  229. return constant.attendanceStatus[key]
  230. } else {
  231. return key
  232. }
  233. }
  234. // 老师考勤类型
  235. export const filterTeacherAttendanceStatus = (
  236. key: 'NORMAL' | 'EXCEPTION' | 'LATE' | 'EARLY' | 'TRUANCY' | 'NO_SIGN' | 'LOCATION_EXCEPTION' | ''
  237. ) => {
  238. if (key && constant.teacherAttendanceStatus && constant.teacherAttendanceStatus[key]) {
  239. return constant.teacherAttendanceStatus[key]
  240. } else {
  241. return key
  242. }
  243. }
  244. // 审核状态
  245. export const filterAuthStatus = (key: 'DOING' | 'PASS' | 'UNPASS') => {
  246. if (key && constant.authStatus && constant.authStatus[key]) {
  247. return constant.authStatus[key]
  248. } else {
  249. return key
  250. }
  251. }
  252. // 结算状态
  253. export const filterWithdrawalStatus = (
  254. key: 'WAIT' | 'SETTLED' | 'PART_SETTLED' | 'SETTLE_FAIL'
  255. ) => {
  256. if (key && constant.withdrawalStatus && constant.withdrawalStatus[key]) {
  257. return constant.withdrawalStatus[key]
  258. } else {
  259. return key
  260. }
  261. }
  262. // 补助类型 salaryType
  263. export const filterSalaryType = (key: 'MANAGE' | 'COURSE' | 'TRAINING') => {
  264. if (key && constant.salaryType && constant.salaryType[key]) {
  265. return constant.salaryType[key]
  266. } else {
  267. return key
  268. }
  269. }