claim.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /**
  2. * 理赔管理相关常量定义
  3. * @fileoverview 理赔状态、审核状态、来源类型等枚举值和工具函数
  4. */
  5. /**
  6. * 系统状态枚举
  7. * @readonly
  8. * @enum {number}
  9. */
  10. export const SYSTEM_STATUS = {
  11. /** 正常状态 */
  12. NORMAL: 1
  13. }
  14. /**
  15. * 审核状态枚举
  16. * @readonly
  17. * @enum {number}
  18. */
  19. export const AUDIT_STATUS = {
  20. /** 待审核 */
  21. PENDING: 0,
  22. /** 审核中 */
  23. IN_PROGRESS: 1,
  24. /** 已通过 */
  25. APPROVED: 2,
  26. /** 已拒绝 */
  27. REJECTED: 3
  28. }
  29. /**
  30. * 理赔来源类型枚举
  31. * @readonly
  32. * @enum {number}
  33. */
  34. export const CLAIM_SOURCE_TYPE = {
  35. /** 经销商 */
  36. DEALER: 1,
  37. /** 门店 */
  38. STORE: 2,
  39. /** 终端消费者 */
  40. CONSUMER: 3
  41. }
  42. /**
  43. * 审核状态配置映射
  44. * @readonly
  45. * @type {Record<number, {label: string, type: string, color: string}>}
  46. */
  47. export const AUDIT_STATUS_CONFIG = {
  48. [AUDIT_STATUS.PENDING]: {
  49. label: '待审核',
  50. type: 'warning',
  51. color: '#E6A23C'
  52. },
  53. [AUDIT_STATUS.IN_PROGRESS]: {
  54. label: '审核中',
  55. type: 'primary',
  56. color: '#409EFF'
  57. },
  58. [AUDIT_STATUS.APPROVED]: {
  59. label: '已通过',
  60. type: 'success',
  61. color: '#67C23A'
  62. },
  63. [AUDIT_STATUS.REJECTED]: {
  64. label: '已拒绝',
  65. type: 'danger',
  66. color: '#F56C6C'
  67. }
  68. }
  69. /**
  70. * 理赔来源类型配置映射
  71. * @readonly
  72. * @type {Record<number, {label: string, type: string, color: string}>}
  73. */
  74. export const CLAIM_SOURCE_TYPE_CONFIG = {
  75. [CLAIM_SOURCE_TYPE.DEALER]: {
  76. label: '经销商',
  77. type: 'primary',
  78. color: '#409EFF'
  79. },
  80. [CLAIM_SOURCE_TYPE.STORE]: {
  81. label: '门店',
  82. type: 'success',
  83. color: '#67C23A'
  84. },
  85. [CLAIM_SOURCE_TYPE.CONSUMER]: {
  86. label: '终端消费者',
  87. type: 'info',
  88. color: '#909399'
  89. }
  90. }
  91. /**
  92. * 审核状态选项数据
  93. * @readonly
  94. * @type {Array<{label: string, value: number}>}
  95. */
  96. export const AUDIT_STATUS_OPTIONS = [
  97. { label: '待审核', value: AUDIT_STATUS.PENDING },
  98. { label: '审核中', value: AUDIT_STATUS.IN_PROGRESS },
  99. { label: '已通过', value: AUDIT_STATUS.APPROVED },
  100. { label: '已拒绝', value: AUDIT_STATUS.REJECTED }
  101. ]
  102. /**
  103. * 理赔来源类型选项数据
  104. * @readonly
  105. * @type {Array<{label: string, value: number}>}
  106. */
  107. export const CLAIM_SOURCE_TYPE_OPTIONS = [
  108. { label: '经销商', value: CLAIM_SOURCE_TYPE.DEALER },
  109. { label: '门店', value: CLAIM_SOURCE_TYPE.STORE },
  110. { label: '终端消费者', value: CLAIM_SOURCE_TYPE.CONSUMER }
  111. ]
  112. /**
  113. * 获取审核状态标签
  114. * @param {number} status - 审核状态值
  115. * @returns {string} 状态标签
  116. */
  117. export function getAuditStatusLabel(status) {
  118. const config = AUDIT_STATUS_CONFIG[status]
  119. return config ? config.label : '未知状态'
  120. }
  121. /**
  122. * 获取审核状态类型
  123. * @param {number} status - 审核状态值
  124. * @returns {string} Element UI标签类型
  125. */
  126. export function getAuditStatusType(status) {
  127. const config = AUDIT_STATUS_CONFIG[status]
  128. return config ? config.type : 'info'
  129. }
  130. /**
  131. * 获取审核状态颜色
  132. * @param {number} status - 审核状态值
  133. * @returns {string} 十六进制颜色值
  134. */
  135. export function getAuditStatusColor(status) {
  136. const config = AUDIT_STATUS_CONFIG[status]
  137. return config ? config.color : '#909399'
  138. }
  139. /**
  140. * 获取理赔来源类型标签
  141. * @param {number} sourceType - 来源类型值
  142. * @returns {string} 来源类型标签
  143. */
  144. export function getClaimSourceTypeLabel(sourceType) {
  145. const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
  146. return config ? config.label : '未知来源'
  147. }
  148. /**
  149. * 获取理赔来源类型Element UI标签类型
  150. * @param {number} sourceType - 来源类型值
  151. * @returns {string} Element UI标签类型
  152. */
  153. export function getClaimSourceTypeType(sourceType) {
  154. const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
  155. return config ? config.type : 'info'
  156. }
  157. /**
  158. * 获取理赔来源类型颜色
  159. * @param {number} sourceType - 来源类型值
  160. * @returns {string} 十六进制颜色值
  161. */
  162. export function getClaimSourceTypeColor(sourceType) {
  163. const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
  164. return config ? config.color : '#909399'
  165. }
  166. /**
  167. * 验证审核状态是否有效
  168. * @param {number} status - 审核状态值
  169. * @returns {boolean} 是否为有效状态
  170. */
  171. export function isValidAuditStatus(status) {
  172. return Object.values(AUDIT_STATUS).includes(status)
  173. }
  174. /**
  175. * 验证理赔来源类型是否有效
  176. * @param {number} sourceType - 来源类型值
  177. * @returns {boolean} 是否为有效来源类型
  178. */
  179. export function isValidClaimSourceType(sourceType) {
  180. return Object.values(CLAIM_SOURCE_TYPE).includes(sourceType)
  181. }
  182. /**
  183. * 获取所有审核状态值
  184. * @returns {Array<number>} 审核状态值数组
  185. */
  186. export function getAllAuditStatusValues() {
  187. return Object.values(AUDIT_STATUS)
  188. }
  189. /**
  190. * 获取所有理赔来源类型值
  191. * @returns {Array<number>} 来源类型值数组
  192. */
  193. export function getAllClaimSourceTypeValues() {
  194. return Object.values(CLAIM_SOURCE_TYPE)
  195. }
  196. /**
  197. * 附件文件类型枚举
  198. * @readonly
  199. * @enum {string}
  200. */
  201. export const ATTACHMENT_FILE_TYPE = {
  202. /** JPEG图片 */
  203. JPEG: 'jpeg',
  204. /** JPG图片 */
  205. JPG: 'jpg',
  206. /** PNG图片 */
  207. PNG: 'png',
  208. /** MP4视频 */
  209. MP4: 'mp4',
  210. /** PDF文档 */
  211. PDF: 'pdf'
  212. }
  213. /**
  214. * 附件文件类型配置映射
  215. * @readonly
  216. * @type {Record<string, {label: string, icon: string, accept: string}>}
  217. */
  218. export const ATTACHMENT_FILE_TYPE_CONFIG = {
  219. [ATTACHMENT_FILE_TYPE.JPEG]: {
  220. label: 'JPEG图片',
  221. icon: 'el-icon-picture',
  222. accept: 'image/jpeg'
  223. },
  224. [ATTACHMENT_FILE_TYPE.JPG]: {
  225. label: 'JPG图片',
  226. icon: 'el-icon-picture',
  227. accept: 'image/jpeg'
  228. },
  229. [ATTACHMENT_FILE_TYPE.PNG]: {
  230. label: 'PNG图片',
  231. icon: 'el-icon-picture',
  232. accept: 'image/png'
  233. },
  234. [ATTACHMENT_FILE_TYPE.MP4]: {
  235. label: 'MP4视频',
  236. icon: 'el-icon-video-camera',
  237. accept: 'video/mp4'
  238. },
  239. [ATTACHMENT_FILE_TYPE.PDF]: {
  240. label: 'PDF文档',
  241. icon: 'el-icon-document',
  242. accept: 'application/pdf'
  243. }
  244. }
  245. /**
  246. * 附件文件类型选项列表
  247. * @readonly
  248. * @type {Array<{label: string, value: string}>}
  249. */
  250. export const ATTACHMENT_FILE_TYPE_OPTIONS = [
  251. { label: 'JPEG图片', value: ATTACHMENT_FILE_TYPE.JPEG },
  252. { label: 'JPG图片', value: ATTACHMENT_FILE_TYPE.JPG },
  253. { label: 'PNG图片', value: ATTACHMENT_FILE_TYPE.PNG },
  254. { label: 'MP4视频', value: ATTACHMENT_FILE_TYPE.MP4 },
  255. { label: 'PDF文档', value: ATTACHMENT_FILE_TYPE.PDF }
  256. ]
  257. /**
  258. * 获取附件文件类型标签
  259. * @param {string} fileType - 文件类型
  260. * @returns {string} 文件类型标签
  261. */
  262. export function getAttachmentFileTypeLabel(fileType) {
  263. return (ATTACHMENT_FILE_TYPE_CONFIG[fileType] && ATTACHMENT_FILE_TYPE_CONFIG[fileType].label) || '未知类型'
  264. }
  265. /**
  266. * 获取附件文件类型图标
  267. * @param {string} fileType - 文件类型
  268. * @returns {string} 文件类型图标
  269. */
  270. export function getAttachmentFileTypeIcon(fileType) {
  271. return (ATTACHMENT_FILE_TYPE_CONFIG[fileType] && ATTACHMENT_FILE_TYPE_CONFIG[fileType].icon) || 'el-icon-document'
  272. }
  273. /**
  274. * 验证文件类型是否有效
  275. * @param {string} fileType - 文件类型
  276. * @returns {boolean} 是否有效
  277. */
  278. export function isValidAttachmentFileType(fileType) {
  279. return Object.values(ATTACHMENT_FILE_TYPE).includes(fileType)
  280. }
  281. /**
  282. * 获取所有支持的文件类型
  283. * @returns {string[]} 文件类型数组
  284. */
  285. export function getAllAttachmentFileTypes() {
  286. return Object.values(ATTACHMENT_FILE_TYPE)
  287. }