You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
282 lines
12 KiB
282 lines
12 KiB
/**
|
|
* 数据字典工具类
|
|
*/
|
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
|
import { ElementPlusInfoType } from '@/types/elementPlus'
|
|
|
|
const dictStore = useDictStoreWithOut()
|
|
|
|
/**
|
|
* 获取 dictType 对应的数据字典数组
|
|
*
|
|
* @param dictType 数据类型
|
|
* @returns {*|Array} 数据字典数组
|
|
*/
|
|
export interface DictDataType {
|
|
dictType: string
|
|
label: string
|
|
value: string | number | boolean
|
|
colorType: ElementPlusInfoType | ''
|
|
cssClass: string
|
|
}
|
|
|
|
export const getDictOptions = (dictType: string) => {
|
|
return dictStore.getDictByType(dictType) || []
|
|
}
|
|
|
|
export const getIntDictOptions = (dictType: string) => {
|
|
const dictOption: DictDataType[] = []
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
dictOptions.forEach((dict: DictDataType) => {
|
|
dictOption.push({
|
|
...dict,
|
|
value: parseInt(dict.value + '')
|
|
})
|
|
})
|
|
return dictOption
|
|
}
|
|
|
|
export const getStrDictOptions = (dictType: string) => {
|
|
const dictOption: DictDataType[] = []
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
dictOptions.forEach((dict: DictDataType) => {
|
|
dictOption.push({
|
|
...dict,
|
|
value: dict.value + ''
|
|
})
|
|
})
|
|
return dictOption
|
|
}
|
|
|
|
export const getBoolDictOptions = (dictType: string) => {
|
|
const dictOption: DictDataType[] = []
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
dictOptions.forEach((dict: DictDataType) => {
|
|
dictOption.push({
|
|
...dict,
|
|
value: dict.value + '' === 'true'
|
|
})
|
|
})
|
|
return dictOption
|
|
}
|
|
|
|
/**
|
|
* 获取指定字典类型的指定值对应的字典对象
|
|
* @param dictType 字典类型
|
|
* @param value 字典值
|
|
* @return DictDataType 字典对象
|
|
*/
|
|
export const getDictObj = (dictType: string, value: any): DictDataType | undefined => {
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
for (const dict of dictOptions) {
|
|
if (dict.value === value + '') {
|
|
return dict
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获得字典数据的文本展示
|
|
*
|
|
* @param dictType 字典类型
|
|
* @param value 字典数据的值
|
|
* @return 字典名称
|
|
*/
|
|
export const getDictLabel = (dictType: string, value: any): string => {
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
const dictLabel = ref('')
|
|
dictOptions.forEach((dict: DictDataType) => {
|
|
if (dict.value === value + '') {
|
|
dictLabel.value = dict.label
|
|
}
|
|
})
|
|
return dictLabel.value
|
|
}
|
|
|
|
export enum DICT_TYPE {
|
|
USER_TYPE = 'user_type',
|
|
COMMON_STATUS = 'common_status',
|
|
SYSTEM_TENANT_PACKAGE_ID = 'system_tenant_package_id',
|
|
TERMINAL = 'terminal', // 终端
|
|
|
|
// ========== SYSTEM 模块 ==========
|
|
SYSTEM_USER_SEX = 'system_user_sex',
|
|
SYSTEM_MENU_TYPE = 'system_menu_type',
|
|
SYSTEM_ROLE_TYPE = 'system_role_type',
|
|
SYSTEM_DATA_SCOPE = 'system_data_scope',
|
|
SYSTEM_NOTICE_TYPE = 'system_notice_type',
|
|
SYSTEM_OPERATE_TYPE = 'system_operate_type',
|
|
SYSTEM_LOGIN_TYPE = 'system_login_type',
|
|
SYSTEM_LOGIN_RESULT = 'system_login_result',
|
|
SYSTEM_SMS_CHANNEL_CODE = 'system_sms_channel_code',
|
|
SYSTEM_SMS_TEMPLATE_TYPE = 'system_sms_template_type',
|
|
SYSTEM_SMS_SEND_STATUS = 'system_sms_send_status',
|
|
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
|
|
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
|
|
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
|
|
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
|
|
SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
|
|
|
|
// ========== INFRA 模块 ==========
|
|
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
|
|
INFRA_JOB_STATUS = 'infra_job_status',
|
|
INFRA_JOB_LOG_STATUS = 'infra_job_log_status',
|
|
INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status',
|
|
INFRA_CONFIG_TYPE = 'infra_config_type',
|
|
INFRA_CODEGEN_TEMPLATE_TYPE = 'infra_codegen_template_type',
|
|
INFRA_CODEGEN_FRONT_TYPE = 'infra_codegen_front_type',
|
|
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
|
|
INFRA_FILE_STORAGE = 'infra_file_storage',
|
|
|
|
// ========== BPM 模块 ==========
|
|
BPM_MODEL_CATEGORY = 'bpm_model_category',
|
|
BPM_MODEL_FORM_TYPE = 'bpm_model_form_type',
|
|
BPM_TASK_ASSIGN_RULE_TYPE = 'bpm_task_assign_rule_type',
|
|
BPM_PROCESS_INSTANCE_STATUS = 'bpm_process_instance_status',
|
|
BPM_PROCESS_INSTANCE_RESULT = 'bpm_process_instance_result',
|
|
BPM_TASK_ASSIGN_SCRIPT = 'bpm_task_assign_script',
|
|
BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type',
|
|
|
|
// ========== PAY 模块 ==========
|
|
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
|
|
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
|
|
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
|
|
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
|
|
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态
|
|
|
|
// ========== MP 模块 ==========
|
|
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
|
|
MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型
|
|
|
|
// ========== MALL - 会员模块 ==========
|
|
MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型
|
|
MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型
|
|
|
|
// ========== MALL - 商品模块 ==========
|
|
PRODUCT_UNIT = 'product_unit', // 商品单位
|
|
PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态
|
|
|
|
// ========== MALL - 交易模块 ==========
|
|
EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式
|
|
TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态
|
|
TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式
|
|
TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型
|
|
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
|
|
TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态
|
|
TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态
|
|
TRADE_DELIVERY_TYPE = 'trade_delivery_type', // 配送方式
|
|
BROKERAGE_ENABLED_CONDITION = 'brokerage_enabled_condition', // 分佣模式
|
|
BROKERAGE_BIND_MODE = 'brokerage_bind_mode', // 分销关系绑定模式
|
|
BROKERAGE_BANK_NAME = 'brokerage_bank_name', // 佣金提现银行
|
|
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金提现类型
|
|
BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型
|
|
BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态
|
|
BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态
|
|
|
|
// ========== MALL - 营销模块 ==========
|
|
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
|
|
PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围
|
|
PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型
|
|
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
|
|
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
|
|
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
|
|
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
|
|
|
|
// ========== 业务 - WMS ==========
|
|
ITEM_STATUS = 'item_status', // 物料状态
|
|
ITEM_TYPE = 'item_type', // 物料类型
|
|
UOM = 'uom', // 计量单位
|
|
ABC_CLASS = 'abc_class', // ABC类
|
|
TRUE_FALSE = 'true_false', // 是否
|
|
ITEM_GROUP = 'item_group', // 物料分组
|
|
ITEM_CATEGORY = 'Item_category', // 物料种类
|
|
ITEM_COLOR = 'item_color', // 物料颜色
|
|
ITEM_CONFIGURATION = 'item_configuration', // 物料配置
|
|
EQ_LEVEL = 'eq_level', // 质量等级
|
|
CURRENCY = 'currency', // 货币
|
|
BASIC_CURRENCY = 'basic_currency', // 货币
|
|
SUPPLIER_TYPE = 'supplier_type', // 供应商类型
|
|
CUSTOMER_TYPE = 'customer_type', // 客户类型
|
|
OWNER_TYPE = 'owner_type', // 货主类型
|
|
CARRIER_TYPE = 'carrier_type', // 承运商类型
|
|
INSPECT_TYPE = 'inspect_type', // 检验类型
|
|
NEXT_ACTION = 'next_action', // 下一步检验动作
|
|
SAMPLE_METHOD = 'sample_method', // 抽检方式
|
|
WAREHOUSE_TYPE = 'warehouse_type', // 仓库类型
|
|
DOCK_TYPE = 'dock_type', // 月台类型
|
|
AREA_TYPE = 'area_type', // 库区类型
|
|
INVENTORY_STATUS = 'inventory_status', // 库存状态
|
|
ERP_LOCATION = 'erp_location', // ERP库位
|
|
LOCATION_TYPE = 'location_type', // 库位类型
|
|
WORKSHOP_TYPE = 'workshop_type', // 车间类型
|
|
PRODUCTION_LINE_TYPE = 'production_line_type', // 生产线类型
|
|
WORK_STATION_TYPE = 'work_station_type', // 工位类型
|
|
PROCESS_TYPE = 'process_type', // 工序类型
|
|
LOCATION_SCOPE_TYPE = 'location_scope_type', // 库位维度
|
|
STORAGE_TYPE = 'storage_type', // 存储类型
|
|
ITEM_SCOPE_TYPE = 'item_scope_type', // 物料维度
|
|
BATCH_TYPE = 'batch_type', // 批次类型
|
|
BATCH_DIRECTION = 'batch_direction', // 批次方向
|
|
MANAGEMENT_MODE = 'management_mode', // 管理模式
|
|
DOCUMENT_TYPE = 'document_type', // 单据分类
|
|
REQEUST_MODE = 'reqeust_mode', // 申请模式
|
|
TIME_UNIT = 'time_unit', // 时间单位
|
|
COUNT_TYPE = 'count_type', // 盘点类型
|
|
COUNT_SCOPE_TYPE = 'count_scope_type', // 盘点范围类型
|
|
BARCODE_PREFIX = 'barcode_prefix', // 条码前缀
|
|
SETTLEMENT_TYPE = 'settlement_type', // 结算类型
|
|
FROZEN_REASON = 'frozen_reason', // 冻结原因
|
|
INVENTORY_ACTION = 'inventory_action', // 库存动作
|
|
CONTAINER_TYPE = 'container_type', // 器具类型
|
|
CONTAINER_CONTENT_TYPE = 'container_content_type', // 器具内容类型
|
|
RESET_PERIOD = 'reset_period', // 重置周期
|
|
INTERFACE_TYPE = 'interface_type', // 接口类型
|
|
PURCHASE_ORDER_TYPE = 'purchase_order_type', // 采购订单类型
|
|
PURCHASE_ORDER_STATUS = 'purchase_order_status', // 采购订单状态
|
|
PURCHASE_ORDER_DETAIL_STATUS = 'purchase_order_detail_status', // 采购订单明细状态
|
|
SALE_ORDER_TYPE = 'sale_order_type', // 销售订单类型
|
|
SALE_ORDER_STATUS = 'sale_order_status', // 销售订单状态
|
|
SALE_ORDER_DETAIL_STATUS = 'sale_order_detail_status', // 销售订单明细状态
|
|
WORK_ORDER_TYPE = 'work_order_type', // 生产订单类型
|
|
WORK_ORDER_STATUS = 'work_order_status', // 生产订单状态
|
|
WORK_ORDER_DETAIL_STATUS = 'work_order_detail_status', // 生产订单明细状态
|
|
PURCHASE_PLAN_STATUS = 'purchase_plan_status', // 要货计划状态
|
|
PURCHASE_PLAN_DETAIL_STATUS = 'purchase_plan_detail_status', // 要货计划明细状态
|
|
PLAN_STATUS = 'plan_status', // 计划状态
|
|
PRODUCTION_PLAN_DETAIL_STATUS = 'production_plan_detail_status', // 计划明细状态
|
|
// PREPARE_TO_ISSUE_PLAN_STATUS = 'prepare_to_issue_plan_status', // 备料计划状态
|
|
// PREPARE_TO_ISSUE_PLAN_DETAIL_STATUS = 'prepare_to_issue_plan_detail_status', // 备料计划明细状态
|
|
// DELIVER_PLAN_STATUS = 'deliver_plan_status', // 发货计划状态
|
|
// DELIVER_DETAIL_STATUS = 'deliver_detail_status', // 发货计划明细状态
|
|
// PREPARE_TO_DELIVER_PLAN_STATUS = 'prepare_to_deliver_plan_status', // 备货计划状态
|
|
// PREPARE_TO_DELIVER_PLAN_DETAIL_STATUS = 'prepare_to_deliver_plan_detail_status', // 备货计划明细状态
|
|
COUNT_PLAN_STATUS = 'count_plan_status', // 盘点计划状态
|
|
COUNT_DIMENSION = 'count_dimension', // 盘点维度
|
|
REQUEST_STATUS = 'request_status', // 申请状态
|
|
UNPLANNED_RECEIPT_REASON = 'unplanned_receipt_reason', // 计划外入库原因
|
|
UNPLANNED_ISSUE_REASON = 'unplanned_issue_reason', // 计划外出库原因
|
|
SCRAP_REASON = 'scrap_reason', // 报废出库原因
|
|
COUNT_STAGE = 'count_stage', // 盘点阶段
|
|
JOB_STATUS = 'job_status', // 任务状态
|
|
RECORD_STATUS = 'record_status', // 记录状态
|
|
PURCHASE_RETURN_REASON = 'purchase_return_reason', // 采购退货原因
|
|
INSPECT_FAILED_REASON = 'inspect_failed_reason', // 检验不合格原因
|
|
INSPECT_RESULT = 'inspect_result', // 检验结果
|
|
STRATEGY_TYPE = 'strategy_type', // 策略类型
|
|
STRATEGY_PARAM_OPEARTOR = 'strategy_param_opeartor', // 策略参数操作符
|
|
DATA_TYPE = 'data_type', // 数据类型
|
|
PACK_UNIT = 'pack_unit', // 包装单位
|
|
DETAIL_STATUS = 'detail_status', // 明细状态
|
|
TRANSFER_MODE = 'transfer_mode', // 运输方式
|
|
LABEL_TYPE = 'label_type', // 标签类型
|
|
LABEL_STATUS = 'label_status', // 标签状态
|
|
BIND_TYPE = 'bind_type', // 器具绑定类型
|
|
CONTAINER_STATUS = 'container_status', // 容器状态
|
|
PREDICT_TIME_TYPE = 'predict_time_type', // 预测时间类型
|
|
PACK_UNIT_TYPE = 'pack_unit_type', // 包装规格类型
|
|
TRANSFER_REASON = 'transfer_reason', // 调拨出入库原因
|
|
PURCHASERECEIPT_SOURCE_TYPE="purchasereceipt_source_type",//采购收货数据来源
|
|
PLAN_PRODUCTION_TYPE = "plan_production_type", // 生产计划类型
|
|
DELIVER_TYPE="deliver_type",//发货类型
|
|
BILL_TYPE="bill_type", // 发票类型
|
|
}
|
|
|