|
|
@@ -1,3 +1,5 @@
|
|
|
+import { useDictStoreWithOut, type DictValueType } from '@/store/dict'
|
|
|
+
|
|
|
export enum PressureCheckerMyTaskStatus {
|
|
|
WAIT_CONFIRM = 100,
|
|
|
CANCELLATION = 200,
|
|
|
@@ -97,3 +99,142 @@ export function getCheckTypeFromText(checkTypeName?: string): number | undefined
|
|
|
return undefined
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// ========================== 数据字典工具函数 ==========================
|
|
|
+
|
|
|
+export interface DictDataType {
|
|
|
+ dictType: string
|
|
|
+ label: string
|
|
|
+ value: string | number | boolean
|
|
|
+ colorType: string
|
|
|
+ cssClass: string
|
|
|
+}
|
|
|
+
|
|
|
+export interface NumberDictDataType extends DictDataType {
|
|
|
+ value: number
|
|
|
+}
|
|
|
+
|
|
|
+export interface StringDictDataType extends DictDataType {
|
|
|
+ value: string
|
|
|
+}
|
|
|
+
|
|
|
+export const getDictOptions = (dictType: string): DictDataType[] => {
|
|
|
+ const dictStore = useDictStoreWithOut()
|
|
|
+ const list: DictValueType[] = dictStore.getDictByType(dictType)
|
|
|
+ return list.map((item) => ({
|
|
|
+ dictType,
|
|
|
+ label: item.label,
|
|
|
+ value: item.value,
|
|
|
+ colorType: item.colorType || '',
|
|
|
+ cssClass: item.cssClass || '',
|
|
|
+ }))
|
|
|
+}
|
|
|
+
|
|
|
+export const getIntDictOptions = (dictType: string): NumberDictDataType[] => {
|
|
|
+ const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
|
+ return dictOptions.map((dict) => ({
|
|
|
+ ...dict,
|
|
|
+ value: parseInt(dict.value + ''),
|
|
|
+ }))
|
|
|
+}
|
|
|
+
|
|
|
+export const getStrDictOptions = (dictType: string): StringDictDataType[] => {
|
|
|
+ const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
|
+ return dictOptions.map((dict) => ({
|
|
|
+ ...dict,
|
|
|
+ value: dict.value + '',
|
|
|
+ }))
|
|
|
+}
|
|
|
+
|
|
|
+export const getBoolDictOptions = (dictType: string): DictDataType[] => {
|
|
|
+ const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
|
+ return dictOptions.map((dict) => ({
|
|
|
+ ...dict,
|
|
|
+ value: dict.value + '' === 'true',
|
|
|
+ }))
|
|
|
+}
|
|
|
+
|
|
|
+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
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export const getDictLabel = (dictType: string, value: any): string => {
|
|
|
+ const dictOptions: DictDataType[] = getDictOptions(dictType)
|
|
|
+ for (const dict of dictOptions) {
|
|
|
+ if (dict.value === value + '') {
|
|
|
+ return dict.label
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+}
|
|
|
+
|
|
|
+export enum DICT_TYPE {
|
|
|
+ USER_TYPE = 'user_type',
|
|
|
+ COMMON_STATUS = 'common_status',
|
|
|
+ TERMINAL = 'terminal',
|
|
|
+ DATE_INTERVAL = 'date_interval',
|
|
|
+
|
|
|
+ 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_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_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
|
|
|
+ SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
|
|
|
+ SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
|
|
|
+ SYSTEM_SOCIAL_TYPE = 'system_social_type',
|
|
|
+ SYSTEM_EQUIP_CONTAINER_TYPE = 'system_equip_container_type',
|
|
|
+ SYSTEM_EQUIP_CONTAINER_STATUS = 'system_equip_container_status',
|
|
|
+ SYSTEM_EQUIP_CONTAINER_EQUIP_TYPE = 'system_equip_container_equip_type',
|
|
|
+ SYSTEM_EQUIP_CONTAINER_EQUIP_CATEGORY = 'system_equip_container_equip_category',
|
|
|
+ SYSTEM_EQUIP_CONTAINER_AIRSTORE_CATEGORY = 'system_equip_container_airstore_category',
|
|
|
+
|
|
|
+ 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',
|
|
|
+ INFRA_OPERATE_TYPE = 'infra_operate_type',
|
|
|
+
|
|
|
+ BPM_MODEL_TYPE = 'bpm_model_type',
|
|
|
+ BPM_MODEL_FORM_TYPE = 'bpm_model_form_type',
|
|
|
+ BPM_TASK_CANDIDATE_STRATEGY = 'bpm_task_candidate_strategy',
|
|
|
+ BPM_PROCESS_INSTANCE_STATUS = 'bpm_process_instance_status',
|
|
|
+ BPM_TASK_STATUS = 'bpm_task_status',
|
|
|
+ BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type',
|
|
|
+ BPM_PROCESS_LISTENER_TYPE = 'bpm_process_listener_type',
|
|
|
+ BPM_PROCESS_LISTENER_VALUE_TYPE = 'bpm_process_listener_value_type',
|
|
|
+ BPM_AUDIT_STATUS = 'bpm_audit_status',
|
|
|
+
|
|
|
+ PIPE_TYPE = 'PIPE_TYPE',
|
|
|
+ PIPE_CHILD_TYPE = 'PIPE_CHILD_TYPE',
|
|
|
+ COMPRESSION_PROJECT_TEMPLATEMANAGEMENT = 'COMPRESSION_PROJECT_TEMPLATEMANAGEMENT',
|
|
|
+
|
|
|
+ PRESSURE2_EQUIP_BOILER_TRUE_FALSE = 'pressure2_equip_boiler_true_false',
|
|
|
+ SYSTEM_TEMPLATE_INIT_DATA_CLASSIFICATION = 'system_template_init_data_classification',
|
|
|
+ PRESSURE2_TB_TYPE = 'pressure2_tb_type',
|
|
|
+ PRESSURE2_COL_VAL_TYPE = 'pressure2_col_val_type',
|
|
|
+ PRESSURE2_COL_ROUND = 'pressure2_col_round',
|
|
|
+ PRESSURE2_EQUIP_MAIN_TYPE = 'pressure2_equip_main_type',
|
|
|
+ PRESSURE2_BOILER_PART_TYPE = 'pressure2_boiler_part_type',
|
|
|
+ PRESSURE2_PIPE_LEVEL = 'PIPE_LEVEL',
|
|
|
+ PRESSURE2_DYNAMIC_REPORT_TYPE = 'pressure2_dynamic_report_type',
|
|
|
+ PRESSURE2_DYNAMIC_PROJECT_TYPE = 'pressure2_dynamic_project_type',
|
|
|
+ SYSTEM_EQUIP_BOILER_TYPE = 'system_equip_boiler_type',
|
|
|
+ SYSTEM_EQUIP_BOILER_STATUS = 'system_equip_boiler_status',
|
|
|
+}
|