dict.js 12.1 KB
Newer Older
sunhongwei's avatar
sunhongwei committed
1
/**
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
2
 * Created by 捷道源码
sunhongwei's avatar
sunhongwei committed
3 4 5 6
 *
 * 数据字典工具类
 */
import store from '@/store'
dragondean@qq.com's avatar
dragondean@qq.com committed
7
import i18n from '@/i18n'
sunhongwei's avatar
sunhongwei committed
8 9 10 11

export const DICT_TYPE = {
  USER_TYPE: 'user_type',
  COMMON_STATUS: 'common_status',
12
  AUDIT_STATUS: 'audit_status',
wanglianghe's avatar
wanglianghe committed
13
  ADVANCE_STATUS: 'advance_status',
wanglianghe's avatar
wanglianghe committed
14
  BOX_SHIPMENT_STATUS: 'box_shipment_status',
sunhongwei's avatar
sunhongwei committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28

  // ========== 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',
29
  SYSTEM_MAIL_SEND_STATUS: 'mail_send_status',
sunhongwei's avatar
sunhongwei committed
30
  SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type',
jiuping520's avatar
jiuping520 committed
31 32
  INTERNAL_MESSAGE_TYPE: 'internal_message_type',
  INTERNAL_MESSAGE_READ_STATUS: 'internal_message_read_status',
dragondean@qq.com's avatar
dragondean@qq.com committed
33
  SYSTEM_LOCALE: 'system_locale', // 语言列表
sunhongwei's avatar
sunhongwei committed
34

jiuping520's avatar
jiuping520 committed
35 36
  HELP_DOC_STATUS: 'help_doc_status',

sunhongwei's avatar
sunhongwei committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
  // ========== INFRA 模块 ==========
  INFRA_BOOLEAN_STRING: 'infra_boolean_string',
  INFRA_REDIS_TIMEOUT_TYPE: 'infra_redis_timeout_type',
  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_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_WECHAT_VERSION: 'pay_channel_wechat_version', // 微信渠道版本
  PAY_CHANNEL_ALIPAY_SIGN_TYPE: 'pay_channel_alipay_sign_type', // 支付渠道支付宝算法类型
  PAY_CHANNEL_ALIPAY_MODE: 'pay_channel_alipay_mode', // 支付宝公钥类型
  PAY_CHANNEL_ALIPAY_SERVER_TYPE: 'pay_channel_alipay_server_type', // 支付宝网关地址
  PAY_CHANNEL_CODE_TYPE: 'pay_channel_code_type', // 支付渠道编码类型
  PAY_ORDER_NOTIFY_STATUS: 'pay_order_notify_status', // 商户支付订单回调状态
  PAY_ORDER_STATUS: 'pay_order_status', // 商户支付订单状态
  PAY_ORDER_REFUND_STATUS: 'pay_order_refund_status', // 商户支付订单退款状态
  PAY_REFUND_ORDER_STATUS: 'pay_refund_order_status', // 退款订单状态
  PAY_REFUND_ORDER_TYPE: 'pay_refund_order_type', // 退款订单类别
68
  ECW_BANK_TYPE: 'bank_type', // 银行账号类型
69
  // ECW_DATA_SOURCE: 'data_source', // 数据来源
70
  ECW_REGION_TYPE: 'region_trade_type', // 区域类型
wanglianghe's avatar
wanglianghe committed
71
  ECW_TRANSPORT_TYPE: 'transport_type', //货运方式
wanglianghe's avatar
wanglianghe committed
72
  ECW_CHARGE_TYPE: 'warehouse_charge_type',  //仓储收费方式
wanglianghe's avatar
wanglianghe committed
73
  ECW_SHELF_TYPE: 'shelf_type',     //货架类型
74 75 76
  ECW_PRODUCT_MATERIAL: 'product_material',  //商品材质
  ECW_PACKAGING_TYPE: 'packaging_type',   //包装要求
  ECW_CONTAINER_LOCATION: 'container_location', //默认货柜位置
77
  ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS: 'special_req_for_line_products', // 特殊需求
78 79 80 81 82
  ECW_COUPON_TYPE: 'coupon_type', // 优惠券类型
  ECW_COUPON_STATUS: 'coupon_status', // 优惠券状态
  ECW_COUPON_COST_TYPE: 'coupon_cost_type', // 优惠券费用类型
  ECW_COUPON_OVERDUE_STATUS: 'coupon_overdue_status', // 优惠券状态
  ECW_COUPON_PUTON_STATUS: 'coupon_puton_status',
ylpmty's avatar
ylpmty committed
83
  ECW_SUITABLE_USER_TYPE: 'suitable_user_type', // 适用用户类型
84 85 86 87 88 89 90 91
  ECW_SUITABLE_LINE_TYPE: 'suitable_line_type', // 适用线路类型
  ECW_SUITABLE_PROD_TYPE: 'suitable_prod_type', // 适用产品类型
  ECW_ORDER_ATTR: 'order_attr', // 订单属性
  ECW_YESNO: 'yesno', // 是否 1,0
  ECW_COMPANY_TYPE: 'company_type', // 供应商类别
  ECW_COOPERATION_TYPE: 'cooperation_type', // 合作类型
  ECW_SHIPPING_DECLARATION_TYPE: 'shipping_declaration_type', // 出货报关方式(与订单报关方式相同)
  ECW_CUSTOMS_TYPE: 'customs_type', //  订单报关方式(非出货报关),优惠券中的单证报关
92 93 94
  ECW_PACKAGE_TYPE: 'packageType', // 包装单位
  ECW_DOUBLE_CLEAR: 'double_clear', // 是否双清
  ECW_TRADE_TYPE: 'trade_type', // 交货放肆
ylpmty's avatar
ylpmty committed
95 96
  ECW_OFFER_RESULT: 'offer_result', //  报单结果 赢单 输单
  ECW_WAREHOUSING_TYPE: 'warehousing_type', //  入仓类型
97
  ECW_OFFER_STATUS: 'offer_status', // 销售阶段(报价单)
98
  ECW_IS_BRAND: 'is_brand', // 有无品牌
我在何方's avatar
我在何方 committed
99 100
  ECW_OFFER_TYPE: 'offer_type', // 跟进类型
  ECW_OFFER_METHOD: 'offer_method', //  跟进方式
101
  ECW_RECEIPT_STATE: 'receipt_state',//收款单状态
dragondean@qq.com's avatar
dragondean@qq.com committed
102 103
  ECW_SUING_METHOD: 'suing_method', // 出单方式
  ECW_HARVEST_METHOD: 'harvest_method', // 收货方式
dragondean@qq.com's avatar
dragondean@qq.com committed
104
  ECW_PAY_ADVANCE: 'pay_advance', // 是否预付
105
  ECW_BEGINTIME_TYPE_ENDTIME: 'begintime_type_endtime', // 时间筛选字段(订单)
dragondean@qq.com's avatar
dragondean@qq.com committed
106 107
  ECW_CUSTOM_DRAWEE: 'custom_drawee', // 自定义付款人费用类型
  ECW_IS_DRAFT: 'is_draft', // 草稿发布状态
吴滔's avatar
吴滔 committed
108
  ECW_PAYMENT_STATE: 'payment_state',//付款单状态
109
  ECW_INVOICING_TYPE: 'invoicing_type',
110
  ECW_PRICE_TYPE: 'price_type',
dragondean@qq.com's avatar
dragondean@qq.com committed
111 112
  ECW_RELEASE_STATUS: 'release_status', // 放货状态
  ECW_PICK_RECURRENT_NUCLEAR_TYPE: 'PICK_RECURRENT_NUCLEAR_TYPE', // 放货反复核类型
113
  ECW_COST_FEE_TYPE: 'cost_fee_type', // 清单费用类型
114
  ECW_PRICE_AUDIT_STATUS: 'price_audit_status', // 路线价格审核状态
115 116 117 118 119
  //--------ecw---------
  CUSTOMER_STATUS: 'customer_status',
  CUSTOMER_SOURCE: 'customer_source',
  CUSTOMER_BALANCE: 'customer_balance',
  CUSTOMER_TYPE: 'customer_type',
yanghao's avatar
yanghao committed
120 121
  CUSTOMER_LEVEL: 'customer_level',
  CUSTOMER_COMPLAINT_TYPE: 'customer_complaint_type',
yanghao's avatar
yanghao committed
122 123
  CUSTOMER_COMPLAINT_STATUS: 'customer_complaint_status',
  ECW_MESSAGE_LEAVE_TYPE: 'ecw_message_leave_type',
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
124
  ECW_MESSAGE_LEAVE_STATUS: 'ecw_message_leave_status',
125
  PWD_TYPE: 'pwd_type',
Marcus's avatar
Marcus committed
126 127
  ZHONG_PAO_TYPE: 'zhong_pao_type',
  TRANSPORT_TYPE: 'transport_type',
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
128
  BRAND_REG_TYPE: 'brand_registry_type',
129 130
  BRAND_AUTH_STATUS: 'brand_authorization_status',
  BRAND_CUSTOMER_CHARGING_MODEL: 'customer_charging_model',
黄卓's avatar
黄卓 committed
131 132 133 134
  COUNTRY: 'country', // 国家地区
  AREA_CODE: 'area_code', // 区号
  SOCIAL: 'customer_social_tools', // 社交软件
  IS_DEFAULT: 'is_default', // 默认联系人
Marcus's avatar
Marcus committed
135 136
  CUSTOMER_FOLLOW_TYPE: 'customer_follow_type', // 跟进类型
  CUSTOMER_FOLLOW_METHOD: 'customer_follow_method', //  跟进方式
ylpmty's avatar
ylpmty committed
137 138 139 140 141
  COMMISSION_PRODUCT_APPROVAL: 'commission_product_approval', //佣金备案
  SHIPPING_DECLARATION_TYPE: 'shipping_declaration_type',//出货报关方式(与订单报关方式相同)
  COMMISSION_TYPE: 'commission_type',//佣金类型
  COMMISSION_DARK_TYPE: 'commission_dark_type',//暗涌类型
  COMMISSION_CURRENCY_TYPE: 'commission_currency_type',//佣金货币类型
142
  // COMMISSION_UNIT: 'commission_unit',//佣金货物单位
ylpmty's avatar
ylpmty committed
143 144
  ECW_PORT_TYPE: 'port_type',  //港口类型
  CERTIFICATE_TYPE: 'certificate_type',//证件类型
145 146 147
  //customer
  CUSTOMER_CREDIT_RULE_TYPE: 'customer_credit_rule_type',
  CUSTOMER_LEVEL_RULE_TYPE: 'customer_level_rule_type',
ylpmty's avatar
ylpmty committed
148 149 150 151
  // order
  ORDER_TYPE: 'order_type', // 订单类型
  PRODUCT_RECORD_ATTRIBUTE: 'product_record_attribute', //产品备案属性
  CONTROL_GOODS_STATUS: 'control_goods_status', //控货状态
152
  DISBURSEMENT_TYPE: 'disbursement_type',//垫付类型
ylpmty's avatar
ylpmty committed
153
  DRAWEE: 'drawee', // 付款人
154 155
  ORDER_STATUS: 'order_status',//订单状态
  BEGINTIME_TYPE_ENDTIME: 'begintime_type_endtime',//订单日期筛选类别
我在何方's avatar
我在何方 committed
156 157
  ORDER_ERROR_TYPE:'order_error_type',//订单异常类型
  ORDER_EXCEPTION_STATUS:'order_exception_status',//异常订单状态
我在何方's avatar
我在何方 committed
158
  PAYMENT_TYPE:'payment_type',//收款类型
159
  ORDER_WAREHOUSE_IN_STATUS: 'order_warehouse_in_diff_status', // 入仓状态
我在何方's avatar
我在何方 committed
160 161 162 163 164 165 166 167 168 169 170 171 172 173
  ORDER_NO_QUOTE_EXCEPTION_RESULT:'order_no_quote_exception_result',//未报价异常处理结果
  ORDER_SUPERFLUOUS_BOX_EXCEPTION_RESULT:'order_superfluous_box_exception_result',//多箱异常处理结果
  ORDER_LACI_BOX_EXCEPTION_RESULT:'order_lack_box_exception_result',//少箱异常处理结果
  ORDER_PAY_EXCEPTION_RESULT:'order_pay_exception_result',//预付异常处理结果
  ORDER_MISS_EXCEPTION_RESULT:'order_miss_exception_result',//货物丢失异常处理结果
  ORDER_SUPERFLUOUS_GOODS_EXCEPTION_RESULT:'order_superfluous_goods_exception_result',//货物增多异常处理结果
  ORDER_DAMAGE_EXCEPTION_RESULT:'order_damage_exception_result',//货物破损异常处理结果
  ORDER_IN_WATER_EXCEPTION_RESULT:'order_in_water_exception_result',//货物浸水异常处理结果
  ORDER_HEAVY_CARGO_EXCEPTION_RESULT:'order_heavy_cargo_exception_result',//重货异常处理结果
  ORDER_DOC_EXCEPTION_RESULT:'order_doc_exception_result',//单证异常处理结果
  ORDER_CONSIGNOR_EXCEPTION_RESULT:'order_consignor_exception_result',//发货人异常处理结果
  ORDER_COD_EXCEPTION_RESULT:'order_cod_exception_result',//代收货款异常处理结果
  ORDER_OTHER_EXCEPTION_RESULT:'order_other_exception_result',//其它异常处理结果
  ORDER_BULKY_CARGO_EXCEPTION_RESULT:'order_bulky_cargo_exception_result',//泡货异常处理结果
dcy's avatar
dcy committed
174 175 176
  NEED_KNOW_TYPE:'need_know_type',//需知类型
  NEED_KNOW_STATUS:'need_know_status',//需知状态
  MANUAL_EXCEPTION_TYPE:'manual_exception_type',
177
  APPLY_STATUS:'apply_status',//特价申请审核状态
我在何方's avatar
我在何方 committed
178

huyf's avatar
huyf committed
179
  ECASH_INIT:'ecash_init', //e-cash
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
180
  FEE_TYPE:'receivable_fee_type',
181
  // PAY_TYPE:'payment_type',
182 183
  RECEIVE_FLAG:'receive_flag',
  COMDINED_VALUE_ADDED_FEE:'combined_value_added_fee',
dragondean@qq.com's avatar
dragondean@qq.com committed
184
  ORDER_SPECIAL_NEEDS:'order_special_needs', // 订单特殊需求
huhaiqing's avatar
huhaiqing committed
185
  ORDER_ABNORMAL_STATE:'order_abnormal_state',
huyf's avatar
huyf committed
186
  TARGET_TYPE:'target_type',//部门业绩目标类型
huhaiqing's avatar
huhaiqing committed
187
  // ========== 出货模块 ==========
huhaiqing's avatar
huhaiqing committed
188 189 190 191
  BOX_SHIPPING_TRAILER_STATUS: 'shipping_trailer_status', // 拖车状态
  BOX_SHIPPING_CUSTOMS_TYPE: 'shipping_customs_type', // 报关方式
  BOX_SHIPPING_DCCUSTOMS_STATUS: 'shipping_dcCustoms_status', // 报关放行状态
  BOX_SHIPPING_CHECK_STATUS: 'shipping_check_status', // 查验状态
192
  BOX_SHIPPING_UNLOADING_ERROR: 'shipping_unloading_error', // 卸柜异常类型
193
  BOX_SHIPPING_PRICE_UNIT: 'shipping_price_unit', // 金额单位
194 195
  BOX_SHIPPING_TICKET_EXCEPTION: 'shipping_ticket_exception', // 票异常
  BOX_SHIPPING_PROCESS: 'shipping_process', // 海运出货流程
196
  BOX_SHIPPING_BRAND_TYPE: 'shipping_brand_type', // 出货品牌类型
sunhongwei's avatar
sunhongwei committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
}

/**
 * 获取 dictType 对应的数据字典数组
 *
 * @param dictType 数据类型
 * @returns {*|Array} 数据字典数组
 */
export function getDictDatas(dictType) {
  // if (dictType === 'bpm_task_assign_script') {
  //   console.log(store.getters.dict_datas[dictType]);
  //   debugger
  // }
  // debugger
  return store.getters.dict_datas[dictType] || []
}

/**
 * 获取 dictType 对应的数据字典数组
 *
 * @param dictType 数据类型
 * @param values 数组、单个元素
 * @returns {*|Array} 数据字典数组
 */
export function getDictDatas2(dictType, values) {
  if (values === undefined) {
    return [];
  }
  // 如果是单个元素,则转换成数组
  if (!Array.isArray(values)) {
    values = [this.value];
  }
  // 获得字典数据
  const results = [];
  for (const value of values) {
    const dict = getDictData(dictType, value);
    if (dict) {
      results.push(dict);
    }
  }
  // debugger
  // console.log(results);
  return results;
}

export function getDictData(dictType, value) {
  // 获取 dictType 对应的数据字典数组
  const dictDatas = getDictDatas(dictType)
  if (!dictDatas || dictDatas.length === 0) {
    return ''
  }
  // 获取 value 对应的展示名
  value = value + '' // 强制转换成字符串,因为 DictData 小类数值,是字符串
  for (const dictData of dictDatas) {
    if (dictData.value === value) {
      return dictData;
    }
  }
  return undefined
}

export function getDictDataLabel(dictType, value) {
  const dict = getDictData(dictType, value);
dragondean@qq.com's avatar
dragondean@qq.com committed
260
  return dict ? i18n.l(dict, 'label') : '';
sunhongwei's avatar
sunhongwei committed
261 262 263 264
}

export class getDictDataL {
}