diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue b/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue index db5f85a..e7e34f5 100644 --- a/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue +++ b/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue @@ -204,8 +204,8 @@ + + + + + + + + + + + + @@ -763,6 +878,21 @@ export default defineComponent({ that.roleMultiError.list = ''; that.roleMultiError.desc = ''; } + const getRowStyle = ({row}) => { + return { + backgroundColor: row.color, + color: $this.getTextColor(row.color), // 自动适配文字颜色 + }; + } + const getTextColor = (bgColor) => { + if (!bgColor) return "#f00"; + const hex = bgColor.replace("#", ""); + const r = parseInt(hex.substr(0, 2), 16); + const g = parseInt(hex.substr(2, 2), 16); + const b = parseInt(hex.substr(4, 2), 16); + const brightness = (r * 299 + g * 587 + b * 114) / 1000; + return brightness > 128 ? "#000" : "#fff"; + } return { tabs, roleVersionIdError, @@ -793,13 +923,45 @@ export default defineComponent({ checkErrorVerModel, updateErrorVerModel, checkErrorMultiModel, - updateErrorMultiModel + updateErrorMultiModel, + getRowStyle, + getTextColor } } })