From 49f810c3654471db750e318886641da3e5f4233e Mon Sep 17 00:00:00 2001 From: hwj Date: Wed, 10 Jun 2026 16:57:53 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E6=A8=A1=E5=85=B7=E7=BB=84-?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4-=E7=82=B9=E6=A3=80/=E4=BF=9D=E5=85=BB-?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/mold/components/MoldMaintainView.vue | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) 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 },