@@ -21,6 +21,33 @@ const isMobileDevice = () => {
|
||||
return hasTouch && (isIOS || isSmallScreen);
|
||||
};
|
||||
|
||||
// soong_workflow 头部按钮 class 与 Odoo defaultRank 叠用;WebKit 上可能出现「能点但看不见」。
|
||||
// 对底部固定栏内按钮强制前景/背景与 -webkit-text-fill(不依赖 getComputedStyle 误判)。
|
||||
const WORKFLOW_BUTTON_STYLES = [
|
||||
['btn-confirm', '#2563eb', '#ffffff'],
|
||||
['btn-finish', '#1d4ed8', '#ffffff'],
|
||||
['btn-transfer', '#166534', '#ffffff'],
|
||||
['btn-distribute', '#16a34a', '#ffffff'],
|
||||
['btn-recall', '#f59e0b', '#ffffff'],
|
||||
['btn-return', '#ef4444', '#ffffff'],
|
||||
['btn-archive', '#6b7280', '#ffffff'],
|
||||
];
|
||||
|
||||
function applyWorkflowButtonPaint(button) {
|
||||
for (const [cls, bg, fg] of WORKFLOW_BUTTON_STYLES) {
|
||||
if (button.classList.contains(cls)) {
|
||||
button.style.setProperty('background-color', bg, 'important');
|
||||
button.style.setProperty('border-color', bg, 'important');
|
||||
button.style.setProperty('color', fg, 'important');
|
||||
button.style.setProperty('-webkit-text-fill-color', fg, 'important');
|
||||
button.style.setProperty('opacity', '1', 'important');
|
||||
button.style.setProperty('visibility', 'visible', 'important');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 覆盖 StatusBarButtons 组件,添加移动端检测逻辑
|
||||
patch(StatusBarButtons, {
|
||||
template: "k_ry_mobile_form.StatusBarButtons",
|
||||
@@ -81,6 +108,7 @@ patch(StatusBarButtons, {
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
buttons.forEach(button => {
|
||||
try {
|
||||
applyWorkflowButtonPaint(button);
|
||||
// 强制设置按钮可见性
|
||||
button.style.setProperty('visibility', 'visible', 'important');
|
||||
button.style.setProperty('opacity', '1', 'important');
|
||||
@@ -220,6 +248,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
buttons.forEach(button => {
|
||||
try {
|
||||
applyWorkflowButtonPaint(button);
|
||||
// 使用 setProperty 强制设置样式
|
||||
button.style.setProperty('pointer-events', 'auto', 'important');
|
||||
button.style.setProperty('cursor', 'pointer', 'important');
|
||||
|
||||
@@ -29,6 +29,59 @@
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
// soong_workflow 流程按钮与 Odoo 注入的 defaultRank(如 btn-secondary)叠在同一
|
||||
// button 上时,WebKit/iOS 上可能出现「可点击但看不见」(颜色/填充未按预期绘制)。
|
||||
// 在此容器内用更高优先级强制绘制,与 soong_workflow/static/src/css/button_css.scss 对齐。
|
||||
button.btn-confirm {
|
||||
background-color: #2563eb !important;
|
||||
color: #fff !important;
|
||||
border-color: #2563eb !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-finish {
|
||||
background-color: #1d4ed8 !important;
|
||||
color: #fff !important;
|
||||
border-color: #1d4ed8 !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-transfer {
|
||||
background-color: #166534 !important;
|
||||
color: #fff !important;
|
||||
border-color: #166534 !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-distribute {
|
||||
background-color: #16a34a !important;
|
||||
color: #fff !important;
|
||||
border-color: #16a34a !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-recall {
|
||||
background-color: #f59e0b !important;
|
||||
color: #fff !important;
|
||||
border-color: #f59e0b !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-return {
|
||||
background-color: #ef4444 !important;
|
||||
color: #fff !important;
|
||||
border-color: #ef4444 !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
button.btn-archive {
|
||||
background-color: #6b7280 !important;
|
||||
color: #fff !important;
|
||||
border-color: #6b7280 !important;
|
||||
-webkit-text-fill-color: #fff !important;
|
||||
}
|
||||
|
||||
// ViewButton 文案在内部 span 上;防止 WebKit 子节点仍使用透明或系统色
|
||||
button span {
|
||||
color: inherit !important;
|
||||
-webkit-text-fill-color: inherit !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user