首次提交
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>一般机构组件</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Main Component Display -->
|
||||
<div id="machine-component" class="machine-component">
|
||||
<div class="header">
|
||||
<span id="machine-name-display">一般机构</span>
|
||||
<div class="status-indicator"></div>
|
||||
</div>
|
||||
<div class="info-grid">
|
||||
<div class="info-label">当前步骤</div>
|
||||
<div id="current-step" class="info-value">第一步</div>
|
||||
<div class="info-label">理论产能</div>
|
||||
<div id="theoretical-ppm" class="info-value">60.00PPM</div>
|
||||
<div class="info-label">当前产能</div>
|
||||
<div id="current-ppm" class="info-value">59.05PPM</div>
|
||||
</div>
|
||||
<div id="machine-status" class="status-text">等待下料</div>
|
||||
</div>
|
||||
|
||||
<!-- Settings Modal -->
|
||||
<div id="settings-modal" class="modal-overlay" style="display: none;">
|
||||
<div class="modal-content">
|
||||
<!-- Fixed Header -->
|
||||
<div class="modal-fixed-header">
|
||||
<div class="modal-header">
|
||||
<span id="modal-title">编辑-一般机构</span>
|
||||
<button id="close-modal-btn" class="close-btn">×</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="machine-name-input">机构名称:</label>
|
||||
<input type="text" id="machine-name-input" value="一般机构" required>
|
||||
<span class="error-message" id="machine-name-error"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="batch-quantity-input">批量处理数量:</label>
|
||||
<input type="number" id="batch-quantity-input" value="1" min="0" step="1" placeholder="0代表禁用">
|
||||
<span class="error-message" id="batch-quantity-error"></span>
|
||||
</div>
|
||||
<legend class="steps-legend">步骤设置:</legend>
|
||||
</div>
|
||||
|
||||
<!-- Scrollable Steps Area -->
|
||||
<div class="modal-scrollable-steps">
|
||||
<div id="steps-container">
|
||||
<!-- Steps will be added here by JS -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Fixed Footer -->
|
||||
<div class="modal-fixed-footer">
|
||||
<button id="add-step-btn" class="add-btn">添加步骤</button>
|
||||
<div class="form-group cache-group">
|
||||
<input type="checkbox" id="has-cache-checkbox">
|
||||
<label for="has-cache-checkbox">是否有缓存</label>
|
||||
<input type="number" id="cache-quantity-input" min="1" step="1" placeholder="必须>0的整数" disabled>
|
||||
<span class="error-message" id="cache-quantity-error"></span>
|
||||
</div>
|
||||
<div class="summary-section">
|
||||
<span>总耗时: <span id="total-time-display">0.00</span>秒</span>
|
||||
<span>理论产能: <span id="calculated-ppm-display">0.00</span>PPM</span>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="save-settings-btn" class="save-btn">保存</button>
|
||||
<button id="cancel-settings-btn" class="cancel-btn">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,452 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// --- DOM Elements ---
|
||||
const machineComponent = document.getElementById('machine-component');
|
||||
const settingsModal = document.getElementById('settings-modal');
|
||||
const closeModalBtn = document.getElementById('close-modal-btn');
|
||||
const cancelSettingsBtn = document.getElementById('cancel-settings-btn');
|
||||
const saveSettingsBtn = document.getElementById('save-settings-btn');
|
||||
const addStepBtn = document.getElementById('add-step-btn');
|
||||
const stepsContainer = document.getElementById('steps-container');
|
||||
const machineNameInput = document.getElementById('machine-name-input');
|
||||
const batchQuantityInput = document.getElementById('batch-quantity-input');
|
||||
const hasCacheCheckbox = document.getElementById('has-cache-checkbox');
|
||||
const cacheQuantityInput = document.getElementById('cache-quantity-input');
|
||||
const totalTimeDisplay = document.getElementById('total-time-display');
|
||||
const calculatedPpmDisplay = document.getElementById('calculated-ppm-display');
|
||||
const machineNameDisplay = document.getElementById('machine-name-display');
|
||||
const theoreticalPpmDisplay = document.getElementById('theoretical-ppm');
|
||||
const modalTitle = document.getElementById('modal-title');
|
||||
const statusIndicator = machineComponent.querySelector('.status-indicator'); // Get status indicator
|
||||
const machineStatus = document.getElementById('machine-status'); // Get status text element
|
||||
|
||||
// --- State ---
|
||||
let steps = []; // Array to hold step data
|
||||
let initialSettings = {}; // To store settings when modal opens
|
||||
let isActive = false; // Track if the machine is considered active
|
||||
let isDisabled = false; // Track if machine is disabled (batch=0)
|
||||
|
||||
// --- Functions ---
|
||||
|
||||
// Helper function to update status text AND indicator light
|
||||
const updateMachineStatus = (newStatusText) => {
|
||||
machineStatus.textContent = newStatusText;
|
||||
statusIndicator.classList.remove('active', 'disabled'); // Clear previous state classes
|
||||
isDisabled = false;
|
||||
isActive = false;
|
||||
|
||||
if (newStatusText === '运行中') {
|
||||
statusIndicator.classList.add('active');
|
||||
isActive = true;
|
||||
} else if (newStatusText === '禁用中') {
|
||||
statusIndicator.classList.add('disabled');
|
||||
isDisabled = true;
|
||||
} else {
|
||||
// Default: Waiting (yellow pulse) - no specific class needed
|
||||
}
|
||||
|
||||
// Store the current text and state in case modal is opened later
|
||||
if (initialSettings) { // Prevent error during initial load
|
||||
initialSettings.statusText = newStatusText;
|
||||
initialSettings.isActive = isActive;
|
||||
initialSettings.isDisabled = isDisabled;
|
||||
}
|
||||
};
|
||||
|
||||
// --- Validation Helpers ---
|
||||
const clearValidationErrors = () => {
|
||||
const errorMessages = settingsModal.querySelectorAll('.error-message');
|
||||
errorMessages.forEach(msg => {
|
||||
msg.textContent = '';
|
||||
msg.style.display = 'none';
|
||||
});
|
||||
const invalidInputs = settingsModal.querySelectorAll('.invalid');
|
||||
invalidInputs.forEach(input => input.classList.remove('invalid'));
|
||||
};
|
||||
|
||||
const showValidationError = (inputElement, message) => {
|
||||
inputElement.classList.add('invalid');
|
||||
const errorSpanId = inputElement.id + '-error'; // Assumes error span ID convention
|
||||
const errorSpan = document.getElementById(errorSpanId);
|
||||
if (errorSpan) {
|
||||
errorSpan.textContent = message;
|
||||
errorSpan.style.display = 'block';
|
||||
}
|
||||
// Focus the first invalid element found
|
||||
if (!settingsModal.querySelector('.invalid:focus')) {
|
||||
inputElement.focus();
|
||||
}
|
||||
};
|
||||
|
||||
// Function to remove error state when user types
|
||||
const clearErrorOnInput = (event) => {
|
||||
const inputElement = event.target;
|
||||
inputElement.classList.remove('invalid');
|
||||
const errorSpanId = inputElement.id + '-error';
|
||||
const errorSpan = document.getElementById(errorSpanId);
|
||||
if (errorSpan) {
|
||||
errorSpan.textContent = '';
|
||||
errorSpan.style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
// --- Main Validation Logic ---
|
||||
const validateSettings = () => {
|
||||
clearValidationErrors();
|
||||
let isValid = true;
|
||||
const errors = [];
|
||||
|
||||
// 1. Check Machine Name
|
||||
if (!machineNameInput.value.trim()) {
|
||||
showValidationError(machineNameInput, '机构名称不能为空');
|
||||
isValid = false;
|
||||
errors.push('机构名称不能为空');
|
||||
}
|
||||
|
||||
// 2. Check Batch Quantity
|
||||
const batchQuantityValue = batchQuantityInput.value;
|
||||
if (batchQuantityValue === '' || !Number.isInteger(Number(batchQuantityValue)) || Number(batchQuantityValue) < 0) {
|
||||
showValidationError(batchQuantityInput, '批量处理数量必须是非负整数');
|
||||
isValid = false;
|
||||
errors.push('批量处理数量必须是非负整数');
|
||||
}
|
||||
|
||||
// 3. Check Steps
|
||||
steps.forEach((step, index) => {
|
||||
const stepIndexDisplay = index + 1;
|
||||
// Check Step Name
|
||||
if (!step.nameInput.value.trim()) {
|
||||
showValidationError(step.nameInput, `步骤 ${stepIndexDisplay} 名称不能为空`);
|
||||
isValid = false;
|
||||
errors.push(`步骤 ${stepIndexDisplay} 名称不能为空`);
|
||||
}
|
||||
// Add listeners to step inputs dynamically if not already added
|
||||
if (!step.nameInput.dataset.listenerAdded) {
|
||||
step.nameInput.addEventListener('input', clearErrorOnInput);
|
||||
step.nameInput.dataset.listenerAdded = 'true';
|
||||
}
|
||||
// Note: We are not validating start/work time based on requirements, only name
|
||||
});
|
||||
|
||||
// 4. Check Cache Quantity (if applicable)
|
||||
if (hasCacheCheckbox.checked) {
|
||||
const cacheQuantityValue = cacheQuantityInput.value;
|
||||
if (cacheQuantityValue === '' || !Number.isInteger(Number(cacheQuantityValue)) || Number(cacheQuantityValue) <= 0) {
|
||||
showValidationError(cacheQuantityInput, '缓存数量必须是大于0的整数');
|
||||
isValid = false;
|
||||
errors.push('缓存数量必须是大于0的整数');
|
||||
}
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
// Optionally display a summary alert, though inline errors are better UX
|
||||
// alert('请修正以下错误:\n- ' + errors.join('\n- '));
|
||||
}
|
||||
|
||||
return isValid;
|
||||
};
|
||||
|
||||
// Calculate Total Time and Theoretical PPM
|
||||
const calculateMetrics = () => {
|
||||
let totalDuration = 0;
|
||||
let maxEndTime = 0;
|
||||
|
||||
steps.forEach(step => {
|
||||
const startTime = parseFloat(step.startTimeInput.value) || 0;
|
||||
const workTime = parseFloat(step.workTimeInput.value) || 0;
|
||||
const endTime = startTime + workTime;
|
||||
if (endTime > maxEndTime) {
|
||||
maxEndTime = endTime;
|
||||
}
|
||||
});
|
||||
|
||||
totalDuration = maxEndTime;
|
||||
totalTimeDisplay.textContent = totalDuration.toFixed(2);
|
||||
|
||||
const batchQuantityRaw = batchQuantityInput.value;
|
||||
let batchQuantity = 1; // Default if invalid for calculation display
|
||||
|
||||
// Use valid integer for calculation, default to 1 if invalid or 0
|
||||
if (batchQuantityRaw !== '' && Number.isInteger(Number(batchQuantityRaw)) && Number(batchQuantityRaw) > 0) {
|
||||
batchQuantity = parseInt(batchQuantityRaw);
|
||||
}
|
||||
|
||||
let calculatedPpm = 0;
|
||||
if (totalDuration > 0) {
|
||||
calculatedPpm = (60 / totalDuration) * batchQuantity;
|
||||
}
|
||||
calculatedPpmDisplay.textContent = calculatedPpm.toFixed(2);
|
||||
};
|
||||
|
||||
// Update Step Titles (e.g., "步骤 1", "步骤 2")
|
||||
const updateStepTitles = () => {
|
||||
steps.forEach((step, index) => {
|
||||
step.element.querySelector('.step-title').textContent = `步骤 ${index + 1}`;
|
||||
step.element.dataset.index = index; // Update data-index for reordering
|
||||
});
|
||||
calculateMetrics(); // Recalculate when steps change order/number
|
||||
};
|
||||
|
||||
// Create HTML for a single step
|
||||
const createStepElement = (stepData = {}, index) => {
|
||||
const stepId = `step-${Date.now()}-${Math.random()}`;
|
||||
const stepDiv = document.createElement('div');
|
||||
stepDiv.classList.add('step-item');
|
||||
stepDiv.id = stepId;
|
||||
stepDiv.dataset.index = index;
|
||||
|
||||
stepDiv.innerHTML = `
|
||||
<div class="step-header">
|
||||
<span class="step-title">步骤 ${index + 1}</span>
|
||||
<div class="step-controls">
|
||||
<button class="step-btn move-up-btn" title="上移">↑</button>
|
||||
<button class="step-btn move-down-btn" title="下移">↓</button>
|
||||
<button class="step-btn delete-step-btn" title="删除">✖</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step-inputs">
|
||||
<div class="form-group">
|
||||
<label for="step-name-${stepId}">名称:</label>
|
||||
<input type="text" id="step-name-${stepId}" class="step-name-input" value="${stepData.name || `步骤${index + 1}`}" maxlength="12" required>
|
||||
<span class="error-message step-error" id="step-name-error-${stepId}"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="step-start-${stepId}">开始时间(秒):</label>
|
||||
<input type="number" id="step-start-${stepId}" class="step-start-input" value="${stepData.startTime || 0}" min="0" step="0.1">
|
||||
<span class="error-message step-error" id="step-start-error-${stepId}"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="step-work-${stepId}">工作时间(秒):</label>
|
||||
<input type="number" id="step-work-${stepId}" class="step-work-input" value="${stepData.workTime || 0}" min="0" step="0.1">
|
||||
<span class="error-message step-error" id="step-work-error-${stepId}"></span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Add event listeners for controls within this step
|
||||
stepDiv.querySelector('.delete-step-btn').addEventListener('click', () => deleteStep(stepId));
|
||||
stepDiv.querySelector('.move-up-btn').addEventListener('click', () => moveStep(stepId, -1));
|
||||
stepDiv.querySelector('.move-down-btn').addEventListener('click', () => moveStep(stepId, 1));
|
||||
|
||||
// Add listeners to inputs for real-time calculation and error clearing
|
||||
const nameInput = stepDiv.querySelector('.step-name-input');
|
||||
const startTimeInput = stepDiv.querySelector('.step-start-input');
|
||||
const workTimeInput = stepDiv.querySelector('.step-work-input');
|
||||
|
||||
[startTimeInput, workTimeInput, batchQuantityInput].forEach(input => {
|
||||
input.addEventListener('input', calculateMetrics);
|
||||
});
|
||||
// Add input listener for validation clearing (only needed once per element)
|
||||
if (!nameInput.dataset.listenerAdded) {
|
||||
nameInput.addEventListener('input', clearErrorOnInput);
|
||||
nameInput.dataset.listenerAdded = 'true';
|
||||
}
|
||||
|
||||
return { element: stepDiv, id: stepId, nameInput, startTimeInput, workTimeInput };
|
||||
};
|
||||
|
||||
// Add a new step
|
||||
const addStep = (stepData = {}) => {
|
||||
const newIndex = steps.length;
|
||||
const newStep = createStepElement(stepData, newIndex);
|
||||
stepsContainer.appendChild(newStep.element);
|
||||
steps.push(newStep);
|
||||
updateStepTitles();
|
||||
};
|
||||
|
||||
// Delete a step
|
||||
const deleteStep = (stepId) => {
|
||||
const stepIndex = steps.findIndex(s => s.id === stepId);
|
||||
if (stepIndex > -1) {
|
||||
steps[stepIndex].element.remove();
|
||||
steps.splice(stepIndex, 1);
|
||||
updateStepTitles();
|
||||
}
|
||||
};
|
||||
|
||||
// Move a step up or down
|
||||
const moveStep = (stepId, direction) => {
|
||||
const index = steps.findIndex(s => s.id === stepId);
|
||||
const newIndex = index + direction;
|
||||
|
||||
if (newIndex >= 0 && newIndex < steps.length) {
|
||||
// Visual feedback
|
||||
const currentElement = steps[index].element;
|
||||
currentElement.classList.add('moving');
|
||||
setTimeout(() => {
|
||||
currentElement.classList.remove('moving');
|
||||
// Also remove from the swapped element if it had the class briefly
|
||||
if (steps[newIndex] && steps[newIndex].element) {
|
||||
steps[newIndex].element.classList.remove('moving');
|
||||
}
|
||||
}, 300); // Match CSS transition duration
|
||||
|
||||
// Swap in the steps array
|
||||
[steps[index], steps[newIndex]] = [steps[newIndex], steps[index]];
|
||||
|
||||
// Re-insert elements in the DOM based on the new order
|
||||
stepsContainer.innerHTML = ''; // Clear container
|
||||
steps.forEach(step => stepsContainer.appendChild(step.element)); // Re-append in new order
|
||||
|
||||
updateStepTitles();
|
||||
}
|
||||
};
|
||||
|
||||
// Toggle Cache Quantity Input
|
||||
const toggleCacheInput = () => {
|
||||
const isChecked = hasCacheCheckbox.checked;
|
||||
cacheQuantityInput.disabled = !isChecked;
|
||||
if (isChecked) {
|
||||
cacheQuantityInput.required = true; // Make required when checked
|
||||
} else {
|
||||
cacheQuantityInput.required = false; // Not required when unchecked
|
||||
cacheQuantityInput.value = ''; // Clear value when disabled
|
||||
// Clear potential validation error when disabling
|
||||
cacheQuantityInput.classList.remove('invalid');
|
||||
const errorSpan = document.getElementById('cache-quantity-input-error');
|
||||
if (errorSpan) {
|
||||
errorSpan.textContent = '';
|
||||
errorSpan.style.display = 'none';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Open Settings Modal
|
||||
const openModal = () => {
|
||||
clearValidationErrors(); // Clear errors when opening
|
||||
// Store current settings to revert on cancel
|
||||
initialSettings = {
|
||||
name: machineNameInput.value,
|
||||
batchQuantity: batchQuantityInput.value,
|
||||
hasCache: hasCacheCheckbox.checked,
|
||||
cacheQuantity: cacheQuantityInput.value,
|
||||
stepsData: steps.map(s => ({ // Only store values, not elements
|
||||
name: s.nameInput.value,
|
||||
startTime: s.startTimeInput.value,
|
||||
workTime: s.workTimeInput.value
|
||||
})),
|
||||
// Store current display state
|
||||
isActive: statusIndicator.classList.contains('active'),
|
||||
isDisabled: statusIndicator.classList.contains('disabled'), // Store disabled state
|
||||
statusText: machineStatus.textContent,
|
||||
theoreticalPPM: theoreticalPpmDisplay.textContent, // Store the actual text content
|
||||
currentStep: document.getElementById('current-step').textContent,
|
||||
currentPPM: document.getElementById('current-ppm').textContent
|
||||
};
|
||||
|
||||
// Update modal title
|
||||
modalTitle.textContent = `编辑-${initialSettings.name || '一般机构'}`;
|
||||
|
||||
settingsModal.style.display = 'flex';
|
||||
calculateMetrics(); // Ensure calculations are up-to-date when opening
|
||||
};
|
||||
|
||||
// Close Settings Modal
|
||||
const closeModal = () => {
|
||||
settingsModal.style.display = 'none';
|
||||
};
|
||||
|
||||
// Revert settings to initial state (on cancel or 'X' click)
|
||||
const revertSettings = () => {
|
||||
clearValidationErrors(); // Clear validation errors on revert/cancel
|
||||
machineNameInput.value = initialSettings.name;
|
||||
batchQuantityInput.value = initialSettings.batchQuantity;
|
||||
hasCacheCheckbox.checked = initialSettings.hasCache;
|
||||
cacheQuantityInput.value = initialSettings.cacheQuantity;
|
||||
toggleCacheInput(); // This also handles required attribute
|
||||
|
||||
// Rebuild steps from initial data
|
||||
stepsContainer.innerHTML = '';
|
||||
steps = [];
|
||||
initialSettings.stepsData.forEach(stepData => addStep(stepData));
|
||||
|
||||
// Revert main display state using the helper function for status
|
||||
machineNameDisplay.textContent = initialSettings.name;
|
||||
theoreticalPpmDisplay.textContent = initialSettings.theoreticalPPM; // Use stored text
|
||||
updateMachineStatus(initialSettings.statusText); // This updates text AND indicator class
|
||||
document.getElementById('current-step').textContent = initialSettings.currentStep;
|
||||
document.getElementById('current-ppm').textContent = initialSettings.currentPPM;
|
||||
|
||||
closeModal();
|
||||
};
|
||||
|
||||
// Save Settings
|
||||
const saveSettings = () => {
|
||||
if (!validateSettings()) {
|
||||
console.log("Validation failed."); // Debug log
|
||||
// Optionally show a general error message at the top/bottom?
|
||||
// alert("请检查表单中的错误并修正。");
|
||||
return; // Stop saving if validation fails
|
||||
}
|
||||
|
||||
console.log("Validation passed."); // Debug log
|
||||
|
||||
// Validation passed, proceed with saving
|
||||
const newName = machineNameInput.value.trim();
|
||||
const batchQty = parseInt(batchQuantityInput.value); // Already validated as integer
|
||||
|
||||
machineNameDisplay.textContent = newName;
|
||||
calculateMetrics(); // Recalculate with potentially changed batch qty
|
||||
theoreticalPpmDisplay.textContent = calculatedPpmDisplay.textContent + 'PPM';
|
||||
|
||||
// Update status based on batch quantity
|
||||
if (batchQty === 0) {
|
||||
updateMachineStatus('禁用中');
|
||||
} else {
|
||||
// Set to '运行中' or potentially another state based on future logic
|
||||
// For now, assume it goes to '运行中' if not disabled
|
||||
updateMachineStatus('运行中');
|
||||
}
|
||||
|
||||
// Update current step/ppm (example) - might need real logic later
|
||||
document.getElementById('current-step').textContent = steps.length > 0 ? steps[0].nameInput.value : '无步骤';
|
||||
document.getElementById('current-ppm').textContent = '0.00PPM'; // Reset or calculate actual current
|
||||
|
||||
closeModal();
|
||||
};
|
||||
|
||||
// --- Event Listeners ---
|
||||
machineComponent.addEventListener('dblclick', openModal);
|
||||
closeModalBtn.addEventListener('click', revertSettings);
|
||||
cancelSettingsBtn.addEventListener('click', revertSettings);
|
||||
saveSettingsBtn.addEventListener('click', saveSettings);
|
||||
addStepBtn.addEventListener('click', () => addStep());
|
||||
hasCacheCheckbox.addEventListener('change', toggleCacheInput);
|
||||
|
||||
// Add listeners to clear errors on input for main fields
|
||||
machineNameInput.addEventListener('input', clearErrorOnInput);
|
||||
batchQuantityInput.addEventListener('input', clearErrorOnInput);
|
||||
cacheQuantityInput.addEventListener('input', clearErrorOnInput);
|
||||
|
||||
// --- Initialization ---
|
||||
const initialize = () => {
|
||||
// Add default steps as per the image
|
||||
addStep({ name: '步骤1', startTime: 0, workTime: 3 });
|
||||
addStep({ name: '步骤2', startTime: 2, workTime: 3 });
|
||||
|
||||
// Set initial values based on the image (or defaults)
|
||||
machineNameInput.value = '一般机构';
|
||||
batchQuantityInput.value = 1;
|
||||
hasCacheCheckbox.checked = true; // From image
|
||||
cacheQuantityInput.value = 3; // From image
|
||||
toggleCacheInput(); // Enable/disable and set required
|
||||
|
||||
// Initial calculation and display update
|
||||
machineNameDisplay.textContent = machineNameInput.value;
|
||||
calculateMetrics();
|
||||
theoreticalPpmDisplay.textContent = calculatedPpmDisplay.textContent + 'PPM';
|
||||
|
||||
// Set default component state (can be customized)
|
||||
document.getElementById('current-step').textContent = '步骤1'; // Example
|
||||
document.getElementById('current-ppm').textContent = '0.00PPM'; // Example
|
||||
updateMachineStatus('等待中'); // Use helper to set initial status
|
||||
|
||||
// Store initial theoretical PPM text correctly for revert
|
||||
if (!initialSettings.theoreticalPPM) { // Ensure it's set only once initially
|
||||
initialSettings.theoreticalPPM = theoreticalPpmDisplay.textContent;
|
||||
}
|
||||
// Clear any potential initial validation states on load
|
||||
clearValidationErrors();
|
||||
};
|
||||
|
||||
initialize();
|
||||
});
|
||||
@@ -0,0 +1,679 @@
|
||||
/* 全局和页面基础样式 */
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background-color: #f4f7f6; /* 页面背景色 */
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- 主组件显示区域样式 --- */
|
||||
.machine-component {
|
||||
background-color: #ffffff; /* 组件背景色 */
|
||||
border-radius: 12px; /* 圆角 */
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* 阴影 */
|
||||
padding: 15px; /* Adjusted padding */
|
||||
max-width: 350px; /* Max width on larger screens */
|
||||
width: 90%; /* Relative width on smaller screens */
|
||||
margin: 10px; /* Add some margin */
|
||||
cursor: pointer; /* 鼠标样式 */
|
||||
transition: box-shadow 0.3s ease; /* 阴影过渡效果 */
|
||||
border: 1px solid #e0e0e0; /* 边框 */
|
||||
}
|
||||
|
||||
.machine-component:hover {
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); /* 鼠标悬浮时阴影加强 */
|
||||
}
|
||||
|
||||
/* 主组件头部 */
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between; /* 两端对齐 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee; /* 底部边框分割线 */
|
||||
}
|
||||
|
||||
/* 主组件 - 机构名称 */
|
||||
#machine-name-display {
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 主组件 - 状态指示灯 */
|
||||
.status-indicator {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%; /* 圆形 */
|
||||
background-color: #ffc107; /* Default Yellow for waiting */
|
||||
transition: background-color 0.3s ease; /* Keep transition for color change */
|
||||
/* Apply default yellow pulse animation */
|
||||
animation: pulse-yellow 1.5s infinite;
|
||||
}
|
||||
|
||||
/* Active state overrides */
|
||||
.status-indicator.active {
|
||||
background-color: #4CAF50; /* Green when active */
|
||||
animation-name: pulse-green; /* Change animation name */
|
||||
}
|
||||
|
||||
/* Disabled state overrides */
|
||||
.status-indicator.disabled {
|
||||
background-color: #dc3545; /* Red when disabled */
|
||||
animation-name: pulse-red; /* Use red pulse */
|
||||
}
|
||||
|
||||
/* Define the GREEN pulse animation */
|
||||
@keyframes pulse-green {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); /* Green shadow */
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px rgba(76, 175, 80, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Define the YELLOW pulse animation */
|
||||
@keyframes pulse-yellow {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.5); /* Yellow shadow */
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px rgba(255, 193, 7, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Define the RED pulse animation */
|
||||
@keyframes pulse-red {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); /* Red shadow */
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 主组件 - 信息网格布局 */
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr; /* 标签自适应,值占满剩余空间 */
|
||||
gap: 8px 15px; /* 行间距 列间距 */
|
||||
margin-bottom: 15px;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
/* 主组件 - 信息标签 */
|
||||
.info-label {
|
||||
color: #555;
|
||||
font-weight: 500;
|
||||
text-align: right; /* 文本右对齐 */
|
||||
}
|
||||
|
||||
/* 主组件 - 信息值 */
|
||||
.info-value {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 主组件 - 底部状态文本 */
|
||||
.status-text {
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
color: #666;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #eee; /* 顶部边框分割线 */
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
/* --- 设置弹窗 (Modal) 样式 --- */
|
||||
|
||||
/* 弹窗遮罩层 */
|
||||
.modal-overlay {
|
||||
position: fixed; /* 固定定位,覆盖全屏 */
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中弹窗内容 */
|
||||
align-items: center; /* 垂直居中弹窗内容 */
|
||||
z-index: 1000; /* 置于顶层 */
|
||||
}
|
||||
|
||||
/* 弹窗内容区域 */
|
||||
.modal-content {
|
||||
background-color: #fff;
|
||||
border-radius: 10px; /* 圆角 */
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
||||
max-width: 600px; /* Max width on larger screens */
|
||||
width: 90vw; /* Relative width */
|
||||
max-height: 90vh; /* 最大高度为视窗的90% */
|
||||
display: flex; /* Use flexbox for layout */
|
||||
flex-direction: column; /* Stack header, scroll, footer vertically */
|
||||
overflow: hidden; /* Re-add overflow hidden to clip children and enforce height */
|
||||
}
|
||||
|
||||
/* Remove scrollbar styles from .modal-content */
|
||||
/*
|
||||
.modal-content::-webkit-scrollbar { ... }
|
||||
.modal-content::-webkit-scrollbar-track { ... }
|
||||
.modal-content::-webkit-scrollbar-thumb { ... }
|
||||
.modal-content::-webkit-scrollbar-thumb:hover { ... }
|
||||
*/
|
||||
|
||||
/* Fixed Header Section */
|
||||
.modal-fixed-header {
|
||||
padding: 20px 25px 0 25px; /* Padding T, R/L, B */
|
||||
border-bottom: 1px solid #eee; /* Separator */
|
||||
}
|
||||
|
||||
.steps-legend {
|
||||
/* Styles for the moved legend */
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
padding: 10px 0 5px 0; /* Adjust padding */
|
||||
margin: 0; /* Remove default legend margin */
|
||||
font-size: 1.1em; /* Match step-title size */
|
||||
}
|
||||
|
||||
|
||||
/* Scrollable Steps Area */
|
||||
.modal-scrollable-steps {
|
||||
flex-grow: 1; /* Allow this section to take available vertical space */
|
||||
overflow-y: auto; /* Enable vertical scrolling ONLY for this section */
|
||||
padding: 15px 25px; /* Padding inside the scrollable area */
|
||||
/* Apply custom scrollbar styles HERE */
|
||||
scrollbar-width: thin; /* Firefox */
|
||||
scrollbar-color: #ccc #f4f4f4; /* Firefox */
|
||||
}
|
||||
|
||||
.modal-scrollable-steps::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.modal-scrollable-steps::-webkit-scrollbar-track {
|
||||
background: #f4f4f4;
|
||||
border-radius: 10px;
|
||||
margin: 5px 0; /* Add slight margin */
|
||||
}
|
||||
|
||||
.modal-scrollable-steps::-webkit-scrollbar-thumb {
|
||||
background-color: #ccc;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #f4f4f4;
|
||||
}
|
||||
|
||||
.modal-scrollable-steps::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #aaa;
|
||||
}
|
||||
|
||||
/* Fixed Footer Section */
|
||||
.modal-fixed-footer {
|
||||
padding: 10px 25px 20px 25px; /* Padding T, R/L, B */
|
||||
border-top: 1px solid #eee; /* Separator */
|
||||
background-color: #fff; /* Ensure solid background */
|
||||
}
|
||||
|
||||
/* Adjustments for items moved to footer */
|
||||
.modal-fixed-footer .add-btn {
|
||||
margin-top: 10px; /* Adjust top margin */
|
||||
margin-bottom: 15px; /* Add bottom margin */
|
||||
}
|
||||
|
||||
.modal-fixed-footer .cache-group {
|
||||
margin-bottom: 15px; /* Add consistent margin */
|
||||
}
|
||||
|
||||
.modal-fixed-footer .summary-section {
|
||||
margin-top: 15px; /* Adjust top margin */
|
||||
padding-top: 0; /* Remove padding as border is above */
|
||||
border-top: none; /* Remove border as it's on footer now */
|
||||
}
|
||||
|
||||
.modal-fixed-footer .modal-footer {
|
||||
margin-top: 15px; /* Adjust top margin */
|
||||
padding-top: 0; /* Remove padding as border is above */
|
||||
border-top: none; /* Remove border as it's on footer now */
|
||||
}
|
||||
|
||||
|
||||
/* Remove original steps-config styling */
|
||||
/*
|
||||
.steps-config { ... }
|
||||
.steps-config legend { ... }
|
||||
*/
|
||||
|
||||
/* 弹窗头部 */
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 弹窗标题 */
|
||||
#modal-title {
|
||||
font-size: 1.4em;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 弹窗关闭按钮 */
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.8em;
|
||||
cursor: pointer;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 弹窗主体内容区域 */
|
||||
.modal-body {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 通用表单组样式 */
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
display: grid;
|
||||
grid-template-columns: 120px 1fr; /* 标签固定宽度,输入框占满剩余 - Default */
|
||||
align-items: center;
|
||||
gap: 5px 10px; /* Reduced gap slightly */
|
||||
}
|
||||
|
||||
/* 表单标签 */
|
||||
.form-group label {
|
||||
font-weight: 500;
|
||||
color: #555;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* 表单输入框 (文本和数字) */
|
||||
.form-group input[type="text"],
|
||||
.form-group input[type="number"] {
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
font-size: 0.95em;
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
/* 输入框获取焦点时样式 */
|
||||
.form-group input[type="text"]:focus,
|
||||
.form-group input[type="number"]:focus {
|
||||
border-color: #007bff; /* 边框变蓝 */
|
||||
outline: none; /* 移除默认轮廓 */
|
||||
}
|
||||
|
||||
/* 禁用的数字输入框 */
|
||||
.form-group input[type="number"][disabled] {
|
||||
background-color: #e9ecef;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* --- 步骤设置区域 --- */
|
||||
.steps-config {
|
||||
border: 1px solid #ddd; /* 边框 */
|
||||
border-radius: 8px; /* 圆角 */
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 步骤设置区域标题 */
|
||||
.steps-config legend {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/* 单个步骤项 */
|
||||
.step-item {
|
||||
border: 1px dashed #ccc; /* 虚线边框 */
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
position: relative;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
/* 步骤项头部 */
|
||||
.step-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 步骤标题 (如: 步骤 1) */
|
||||
.step-title {
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* 步骤控制按钮组 (上移/下移/删除) */
|
||||
.step-controls {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
/* 步骤控制按钮通用样式 */
|
||||
.step-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 1.2em;
|
||||
color: #888;
|
||||
}
|
||||
.step-btn:hover { color: #333; }
|
||||
/* 删除按钮特定颜色 */
|
||||
.delete-step-btn { color: #dc3545; }
|
||||
.delete-step-btn:hover { color: #a71d2a; }
|
||||
|
||||
/* 步骤内部输入框布局 */
|
||||
.step-inputs {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr 1fr; /* 名称自适应,时间占剩余空间 - Default */
|
||||
gap: 10px;
|
||||
align-items: start; /* 顶部对齐 */
|
||||
}
|
||||
|
||||
/* 步骤内表单组 */
|
||||
.step-inputs .form-group {
|
||||
grid-template-columns: 1fr; /* 内部标签和输入框垂直排列 */
|
||||
margin-bottom: 0;
|
||||
gap: 3px;
|
||||
}
|
||||
/* 步骤内标签样式 */
|
||||
.step-inputs label {
|
||||
text-align: left;
|
||||
font-size: 0.85em;
|
||||
margin-bottom: 2px;
|
||||
color: #666;
|
||||
display: block; /* 确保独占一行 */
|
||||
white-space: nowrap; /* 防止标签换行 */
|
||||
overflow: hidden; /* 隐藏超出部分 */
|
||||
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
||||
max-width: 100%; /* 防止标签撑开布局 */
|
||||
}
|
||||
|
||||
/* 限制步骤内时间输入框的最大宽度 */
|
||||
.step-inputs .form-group:nth-child(2) input[type="number"],
|
||||
.step-inputs .form-group:nth-child(3) input[type="number"] {
|
||||
max-width: 85px; /* 最大宽度限制 */
|
||||
width: 100%; /* 允许在容器缩小时也缩小 */
|
||||
}
|
||||
|
||||
/* 确保步骤内名称输入框填满其列 */
|
||||
.step-inputs .form-group:nth-child(1) input[type="text"] {
|
||||
width: 85%;
|
||||
}
|
||||
|
||||
/* --- 其他设置和按钮 --- */
|
||||
|
||||
/* 添加步骤按钮 */
|
||||
.add-btn {
|
||||
padding: 8px 15px;
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 0.95em;
|
||||
transition: background-color 0.3s ease;
|
||||
margin-top: 15px;
|
||||
/* 居中显示 */
|
||||
display: block;
|
||||
width: fit-content; /* 宽度自适应内容 */
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.add-btn:hover {
|
||||
background-color: #218838;
|
||||
}
|
||||
|
||||
/* 缓存设置组 */
|
||||
.cache-group {
|
||||
display: grid; /* Use grid for better control with errors */
|
||||
grid-template-columns: auto auto 1fr; /* checkbox, label, input - Default */
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* 缓存复选框 */
|
||||
.cache-group input[type="checkbox"] { grid-row: 1; }
|
||||
.cache-group label[for="has-cache-checkbox"] { grid-row: 1; text-align: left; }
|
||||
.cache-group input[type="number"] { grid-row: 1; }
|
||||
.cache-group .error-message {
|
||||
grid-column: 3; /* Error below the number input */
|
||||
grid-row: 2;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* 汇总信息区域 */
|
||||
.summary-section {
|
||||
margin-top: 20px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #eee;
|
||||
display: flex;
|
||||
justify-content: space-around; /* 两端分散对齐 */
|
||||
font-size: 0.95em;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* 汇总信息中的数值 */
|
||||
.summary-section span span {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 弹窗底部按钮区域 */
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end; /* 按钮靠右对齐 */
|
||||
gap: 10px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #eee;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* 保存和取消按钮通用样式 */
|
||||
.save-btn,
|
||||
.cancel-btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1em;
|
||||
transition: background-color 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
/* 保存按钮 */
|
||||
.save-btn {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.save-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
/* 取消按钮 */
|
||||
.cancel-btn {
|
||||
background-color: #f8f9fa;
|
||||
color: #333;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.cancel-btn:hover {
|
||||
background-color: #e2e6ea;
|
||||
}
|
||||
|
||||
/* --- 工具类样式 --- */
|
||||
|
||||
/* 错误消息 (未使用,可备用) */
|
||||
.error-message {
|
||||
color: #dc3545;
|
||||
font-size: 0.85em; /* Slightly larger */
|
||||
padding-left: 0; /* Remove padding */
|
||||
display: none; /* Hidden by default */
|
||||
margin-top: 2px; /* Add small top margin */
|
||||
}
|
||||
|
||||
/* Ensure error message appears below input in standard form groups */
|
||||
.form-group .error-message {
|
||||
grid-column: 2; /* Align with input */
|
||||
grid-row: 2; /* Place on the row below the input */
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Error messages within steps */
|
||||
.step-inputs .error-message {
|
||||
/* display: block; */ /* Already block by default */
|
||||
width: 100%; /* Take full width */
|
||||
margin-top: 2px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Adjust cache group alignment when error shows */
|
||||
.cache-group {
|
||||
display: grid; /* Use grid for better control with errors */
|
||||
grid-template-columns: auto auto 1fr; /* checkbox, label, input */
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.cache-group input[type="checkbox"] { grid-row: 1; }
|
||||
.cache-group label[for="has-cache-checkbox"] { grid-row: 1; text-align: left; }
|
||||
.cache-group input[type="number"] { grid-row: 1; }
|
||||
.cache-group .error-message {
|
||||
grid-column: 3; /* Error below the number input */
|
||||
grid-row: 2;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* 步骤项移动时的视觉反馈 */
|
||||
.step-item.moving {
|
||||
transition: background-color 0.3s ease-out;
|
||||
background-color: #e6f7ff; /* 淡蓝色高亮 */
|
||||
}
|
||||
|
||||
/* Input Validation Styles */
|
||||
input:invalid,
|
||||
textarea:invalid {
|
||||
border-color: #dc3545; /* Red border for invalid fields */
|
||||
}
|
||||
|
||||
.form-group input.invalid,
|
||||
.step-item input.invalid {
|
||||
border-color: #dc3545 !important; /* Force red border */
|
||||
background-color: #fff3f3; /* Light red background */
|
||||
}
|
||||
|
||||
.error-tooltip {
|
||||
color: #dc3545;
|
||||
font-size: 0.8em;
|
||||
padding-left: 5px;
|
||||
display: none; /* Hidden by default */
|
||||
}
|
||||
|
||||
.form-group .error-tooltip {
|
||||
grid-column: 2; /* Align with input in main form groups */
|
||||
}
|
||||
|
||||
/* --- Responsive Adjustments --- */
|
||||
|
||||
@media (max-width: 600px) {
|
||||
|
||||
/* Reduce padding/font size slightly globally in modal? Optional */
|
||||
.modal-content {
|
||||
width: 95vw; /* Use more width on mobile */
|
||||
max-height: 95vh; /* Allow slightly more height */
|
||||
}
|
||||
|
||||
.modal-fixed-header,
|
||||
.modal-scrollable-steps,
|
||||
.modal-fixed-footer {
|
||||
padding: 15px; /* Consistent padding */
|
||||
}
|
||||
|
||||
/* Stack form groups vertically */
|
||||
.form-group {
|
||||
grid-template-columns: 1fr; /* Single column */
|
||||
gap: 5px; /* Reduce gap */
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
text-align: left; /* Align labels left */
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
/* Ensure error messages span full width below input */
|
||||
.form-group .error-message {
|
||||
grid-column: 1; /* Span full column */
|
||||
grid-row: 3; /* Ensure it's below label and input */
|
||||
}
|
||||
|
||||
/* Stack step inputs vertically */
|
||||
.step-inputs {
|
||||
grid-template-columns: 1fr; /* Single column */
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
/* Allow time inputs to take more width when stacked */
|
||||
.step-inputs .form-group:nth-child(2) input[type="number"],
|
||||
.step-inputs .form-group:nth-child(3) input[type="number"] {
|
||||
max-width: none; /* Remove max-width limit */
|
||||
}
|
||||
|
||||
/* Stack cache group elements */
|
||||
.cache-group {
|
||||
grid-template-columns: auto 1fr; /* Checkbox | Label & Input */
|
||||
gap: 5px 10px;
|
||||
}
|
||||
.cache-group input[type="checkbox"] { grid-row: 1; grid-column: 1; }
|
||||
.cache-group label[for="has-cache-checkbox"] { grid-row: 1; grid-column: 2; }
|
||||
.cache-group input[type="number"] { grid-row: 2; grid-column: 1 / span 2; width: 100%;} /* Input below */
|
||||
.cache-group .error-message {
|
||||
grid-row: 3; /* Error below input */
|
||||
grid-column: 1 / span 2;
|
||||
}
|
||||
|
||||
/* Stack summary section */
|
||||
.summary-section {
|
||||
flex-direction: column; /* Stack items */
|
||||
align-items: center; /* Center align */
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
/* Adjust footer buttons */
|
||||
.modal-footer {
|
||||
justify-content: space-around; /* Space out buttons more */
|
||||
}
|
||||
|
||||
.save-btn,
|
||||
.cancel-btn {
|
||||
padding: 8px 15px; /* Slightly smaller buttons */
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user