diff --git a/components/apolloTable/component/base/detail/tag/index.tsx b/components/apolloTable/component/base/detail/tag/index.tsx index 7a8ba6e926e51d2b42ef944ce82dc4278921f9ae..8697f64828da1bcbb94e91e7736507e13dc0e9da 100644 --- a/components/apolloTable/component/base/detail/tag/index.tsx +++ b/components/apolloTable/component/base/detail/tag/index.tsx @@ -3,6 +3,20 @@ import { Popover } from 'antd'; import classNames from 'classnames'; import s from './index.less'; +const getColor = (item: any, options: any[]) => { + let color = ''; + if (item.text === item.value) { + return 'transparent'; + } + if (options && Array.isArray(options) && options.length > 0) { + const obj = + options.find((ls) => { + return String(ls.id) === String(item.value); + }) || {}; + color = obj.color || 'e9eef9'; + } + return `#${color}`; +}; export const Tags = (props: any) => { const { value, origin, componentAttr, columnConfig } = props; if (!Array.isArray(value) || value.length === 0) return null; @@ -18,23 +32,12 @@ export const Tags = (props: any) => { innerStyle.flexWrap = 'wrap'; itemStyle.marginBottom = '5px'; } - const getColor = (item: any) => { - let color = ''; - if (options && Array.isArray(options) && options.length > 0) { - const obj = - options.find((ls) => { - return String(ls.id) === String(item.value); - }) || {}; - color = obj.color || 'e9eef9'; - } - return color; - }; if (mode !== 'multiple') { // 单选 return (