|
@@ -0,0 +1,212 @@
|
|
|
+/**
|
|
|
+ * 理赔管理相关常量定义
|
|
|
+ * @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)
|
|
|
+}
|