123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- /**
- * 理赔管理相关常量定义
- * @fileoverview 理赔状态、审核状态、来源类型等枚举值和工具函数
- */
- /**
- * 系统状态枚举
- * @readonly
- * @enum {number}
- */
- export const SYSTEM_STATUS = {
- /** 正常状态 */
- NORMAL: 1
- }
- /**
- * 审核状态枚举
- * @readonly
- * @enum {number}
- */
- export const AUDIT_STATUS = {
- /** 待审核 */
- PENDING: 0,
- /** 审核中 */
- IN_PROGRESS: 1,
- /** 已通过 */
- APPROVED: 2,
- /** 已拒绝 */
- REJECTED: 3
- }
- /**
- * 理赔来源类型枚举
- * @readonly
- * @enum {number}
- */
- export const CLAIM_SOURCE_TYPE = {
- /** 经销商 */
- DEALER: 1,
- /** 门店 */
- STORE: 2,
- /** 终端消费者 */
- CONSUMER: 3
- }
- /**
- * 审核状态配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const AUDIT_STATUS_CONFIG = {
- [AUDIT_STATUS.PENDING]: {
- label: '待审核',
- type: 'warning',
- color: '#E6A23C'
- },
- [AUDIT_STATUS.IN_PROGRESS]: {
- label: '审核中',
- type: 'primary',
- color: '#409EFF'
- },
- [AUDIT_STATUS.APPROVED]: {
- label: '已通过',
- type: 'success',
- color: '#67C23A'
- },
- [AUDIT_STATUS.REJECTED]: {
- label: '已拒绝',
- type: 'danger',
- color: '#F56C6C'
- }
- }
- /**
- * 理赔来源类型配置映射
- * @readonly
- * @type {Record<number, {label: string, type: string, color: string}>}
- */
- export const CLAIM_SOURCE_TYPE_CONFIG = {
- [CLAIM_SOURCE_TYPE.DEALER]: {
- label: '经销商',
- type: 'primary',
- color: '#409EFF'
- },
- [CLAIM_SOURCE_TYPE.STORE]: {
- label: '门店',
- type: 'success',
- color: '#67C23A'
- },
- [CLAIM_SOURCE_TYPE.CONSUMER]: {
- label: '终端消费者',
- type: 'info',
- color: '#909399'
- }
- }
- /**
- * 审核状态选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const AUDIT_STATUS_OPTIONS = [
- { label: '待审核', value: AUDIT_STATUS.PENDING },
- { label: '审核中', value: AUDIT_STATUS.IN_PROGRESS },
- { label: '已通过', value: AUDIT_STATUS.APPROVED },
- { label: '已拒绝', value: AUDIT_STATUS.REJECTED }
- ]
- /**
- * 理赔来源类型选项数据
- * @readonly
- * @type {Array<{label: string, value: number}>}
- */
- export const CLAIM_SOURCE_TYPE_OPTIONS = [
- { label: '经销商', value: CLAIM_SOURCE_TYPE.DEALER },
- { label: '门店', value: CLAIM_SOURCE_TYPE.STORE },
- { label: '终端消费者', value: CLAIM_SOURCE_TYPE.CONSUMER }
- ]
- /**
- * 获取审核状态标签
- * @param {number} status - 审核状态值
- * @returns {string} 状态标签
- */
- export function getAuditStatusLabel(status) {
- const config = AUDIT_STATUS_CONFIG[status]
- return config ? config.label : '未知状态'
- }
- /**
- * 获取审核状态类型
- * @param {number} status - 审核状态值
- * @returns {string} Element UI标签类型
- */
- export function getAuditStatusType(status) {
- const config = AUDIT_STATUS_CONFIG[status]
- return config ? config.type : 'info'
- }
- /**
- * 获取审核状态颜色
- * @param {number} status - 审核状态值
- * @returns {string} 十六进制颜色值
- */
- export function getAuditStatusColor(status) {
- const config = AUDIT_STATUS_CONFIG[status]
- return config ? config.color : '#909399'
- }
- /**
- * 获取理赔来源类型标签
- * @param {number} sourceType - 来源类型值
- * @returns {string} 来源类型标签
- */
- export function getClaimSourceTypeLabel(sourceType) {
- const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
- return config ? config.label : '未知来源'
- }
- /**
- * 获取理赔来源类型Element UI标签类型
- * @param {number} sourceType - 来源类型值
- * @returns {string} Element UI标签类型
- */
- export function getClaimSourceTypeType(sourceType) {
- const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
- return config ? config.type : 'info'
- }
- /**
- * 获取理赔来源类型颜色
- * @param {number} sourceType - 来源类型值
- * @returns {string} 十六进制颜色值
- */
- export function getClaimSourceTypeColor(sourceType) {
- const config = CLAIM_SOURCE_TYPE_CONFIG[sourceType]
- return config ? config.color : '#909399'
- }
- /**
- * 验证审核状态是否有效
- * @param {number} status - 审核状态值
- * @returns {boolean} 是否为有效状态
- */
- export function isValidAuditStatus(status) {
- return Object.values(AUDIT_STATUS).includes(status)
- }
- /**
- * 验证理赔来源类型是否有效
- * @param {number} sourceType - 来源类型值
- * @returns {boolean} 是否为有效来源类型
- */
- export function isValidClaimSourceType(sourceType) {
- return Object.values(CLAIM_SOURCE_TYPE).includes(sourceType)
- }
- /**
- * 获取所有审核状态值
- * @returns {Array<number>} 审核状态值数组
- */
- export function getAllAuditStatusValues() {
- return Object.values(AUDIT_STATUS)
- }
- /**
- * 获取所有理赔来源类型值
- * @returns {Array<number>} 来源类型值数组
- */
- export function getAllClaimSourceTypeValues() {
- return Object.values(CLAIM_SOURCE_TYPE)
- }
- /**
- * 附件文件类型枚举
- * @readonly
- * @enum {string}
- */
- export const ATTACHMENT_FILE_TYPE = {
- /** JPEG图片 */
- JPEG: 'jpeg',
- /** JPG图片 */
- JPG: 'jpg',
- /** PNG图片 */
- PNG: 'png',
- /** MP4视频 */
- MP4: 'mp4',
- /** PDF文档 */
- PDF: 'pdf'
- }
- /**
- * 附件文件类型配置映射
- * @readonly
- * @type {Record<string, {label: string, icon: string, accept: string}>}
- */
- export const ATTACHMENT_FILE_TYPE_CONFIG = {
- [ATTACHMENT_FILE_TYPE.JPEG]: {
- label: 'JPEG图片',
- icon: 'el-icon-picture',
- accept: 'image/jpeg'
- },
- [ATTACHMENT_FILE_TYPE.JPG]: {
- label: 'JPG图片',
- icon: 'el-icon-picture',
- accept: 'image/jpeg'
- },
- [ATTACHMENT_FILE_TYPE.PNG]: {
- label: 'PNG图片',
- icon: 'el-icon-picture',
- accept: 'image/png'
- },
- [ATTACHMENT_FILE_TYPE.MP4]: {
- label: 'MP4视频',
- icon: 'el-icon-video-camera',
- accept: 'video/mp4'
- },
- [ATTACHMENT_FILE_TYPE.PDF]: {
- label: 'PDF文档',
- icon: 'el-icon-document',
- accept: 'application/pdf'
- }
- }
- /**
- * 附件文件类型选项列表
- * @readonly
- * @type {Array<{label: string, value: string}>}
- */
- export const ATTACHMENT_FILE_TYPE_OPTIONS = [
- { label: 'JPEG图片', value: ATTACHMENT_FILE_TYPE.JPEG },
- { label: 'JPG图片', value: ATTACHMENT_FILE_TYPE.JPG },
- { label: 'PNG图片', value: ATTACHMENT_FILE_TYPE.PNG },
- { label: 'MP4视频', value: ATTACHMENT_FILE_TYPE.MP4 },
- { label: 'PDF文档', value: ATTACHMENT_FILE_TYPE.PDF }
- ]
- /**
- * 获取附件文件类型标签
- * @param {string} fileType - 文件类型
- * @returns {string} 文件类型标签
- */
- export function getAttachmentFileTypeLabel(fileType) {
- return (ATTACHMENT_FILE_TYPE_CONFIG[fileType] && ATTACHMENT_FILE_TYPE_CONFIG[fileType].label) || '未知类型'
- }
- /**
- * 获取附件文件类型图标
- * @param {string} fileType - 文件类型
- * @returns {string} 文件类型图标
- */
- export function getAttachmentFileTypeIcon(fileType) {
- return (ATTACHMENT_FILE_TYPE_CONFIG[fileType] && ATTACHMENT_FILE_TYPE_CONFIG[fileType].icon) || 'el-icon-document'
- }
- /**
- * 验证文件类型是否有效
- * @param {string} fileType - 文件类型
- * @returns {boolean} 是否有效
- */
- export function isValidAttachmentFileType(fileType) {
- return Object.values(ATTACHMENT_FILE_TYPE).includes(fileType)
- }
- /**
- * 获取所有支持的文件类型
- * @returns {string[]} 文件类型数组
- */
- export function getAllAttachmentFileTypes() {
- return Object.values(ATTACHMENT_FILE_TYPE)
- }
|