diff --git a/src/views/erp/mold/components/MoldMaintainView.vue b/src/views/erp/mold/components/MoldMaintainView.vue index 0324ff5f..f21a7f95 100644 --- a/src/views/erp/mold/components/MoldMaintainView.vue +++ b/src/views/erp/mold/components/MoldMaintainView.vue @@ -423,7 +423,19 @@ - + + + @@ -472,6 +484,7 @@ import { MoldRepairApi, type MoldRepairVO } from '@/api/mold/moldrepair' import { PlanMaintenanceApi } from '@/api/mold/planmaintenance' import { getSimpleUserList, type UserVO } from '@/api/system/user' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' +import { isHexColor } from '@/utils/color' import { dateFormatter } from '@/utils/formatTime' defineOptions({ name: 'MoldMaintainView' }) @@ -582,6 +595,36 @@ const isReplaceNet = computed(() => maintainFormData.maintainType === 4) const repairCodeDisabled = computed(() => repairFormData.isCode === true) const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL)) +const getTagDict = (dictType: string, value: any) => { + const v = value === '' || value === null || value === undefined ? undefined : String(value) + if (!v) return undefined + return getStrDictOptions(dictType).find((d) => d.value === v) +} + +const getTagLabel = (dictType: string, value: any) => { + const found = getTagDict(dictType, value) + return found?.label ?? (value ?? '') +} + +const getTagType = (dictType: string, value: any) => { + const found = getTagDict(dictType, value) + const type = found?.colorType + if (type + '' === 'primary' || type + '' === 'default') return '' as any + return (type ?? '') as any +} + +const getTagColor = (dictType: string, value: any) => { + const found = getTagDict(dictType, value) + if (found?.cssClass && isHexColor(found.cssClass)) return found.cssClass + return '' +} + +const getTagStyle = (dictType: string, value: any) => { + const color = getTagColor(dictType, value) + if (!color) return '' + return 'color: #fff' +} + // 维护类型配置 const maintainTypes = computed(() => [ { value: 1, label: t('MoldManagement.MoldBrandPage.maintainTypeInspect'), icon: Search },