SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"> <!-- iOS专属,隐藏Safari地址栏 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>计算表格</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <style>
        
        /* 基础样式 */
        @charset "UTF-8";
        * {margin: 0;padding: 0;box-sizing: border-box;font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;}
        body {padding: 15px;background-color: #f8f9fa;color: #333;transition: overflow-y 0.3s;} /* 添加过渡效果 */
        h1 {text-align: center;margin: 15px 0;font-size: 1.2rem;font-weight: 600;color: #333;}
        
        /* 遮罩层样式 */
        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.3);
            z-index: 9;
            display: none;
            animation: fadeIn 0.3s;
        }
        @keyframes fadeIn {
            from {opacity: 0;}
            to {opacity: 1;}
        }
        
        /* 自定义下拉框样式 - 改为固定定位 */
        .custom-select {
            position: fixed;
            width: calc(100% - 30px); /* 考虑body的padding */
            max-width: 200px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            overflow: hidden;
            z-index: 10;
            display: none; /* 默认隐藏,通过JS显示 */
            transform-origin: top center;
            transition: transform 0.2s ease, opacity 0.2s ease, max-height 0.3s ease;
        }
        .custom-select.active {
            transform: scale(1);
            opacity: 1;
        }
        .custom-select-header {
            padding: 12px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            border-bottom: 1px solid #e9ecef;
        }
        .custom-select-value {
            font-size: 0.95rem;
            font-weight: 500;
        }
        .custom-select-arrow {
            width: 16px;
            height: 16px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: center;
            background-size: contain;
            transition: transform 0.3s;
        }
        .custom-select.active .custom-select-arrow {
            transform: rotate(180deg);
        }
        .custom-select-options {
            overflow: hidden;
            transition: max-height 0.3s ease-out;
        }
        .custom-select-option {
            padding: 12px 15px;
            font-size: 0.95rem;
            cursor: pointer;
            border-bottom: 1px solid #f1f3f5;
            transition: background-color 0.2s;
        }
        .custom-select-option:last-child {
            border-bottom: none;
        }
        .custom-select-option:hover {
            background-color: #f8f9fa;
        }
        .custom-select-option.selected {
            background-color: #e9f7ef;
            font-weight: 500;
        }
        
        /* 下拉框占位符 - 保持布局稳定 */
        .custom-select-placeholder {
            width: 100%;
            max-width: 200px;
            height: 48px; /* 与下拉框头部高度一致 */
            margin: 0 auto 15px;
            position: relative;
            cursor: pointer;
        }
        
        /* 下拉框头部样式 - 显示在占位符位置 */
        .custom-select-visible {
            width: 100%;
            height: 100%;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 12px 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border: 1px solid #e9ecef;
            transition: all 0.2s;
        }
        .custom-select-visible:hover {
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            border-color: #d8d8d8;
        }
        .custom-select-visible:active {
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        
        /* 表格容器 - 添加横向滚动支持 */
        .table-container {
            width: 100%;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 12px rgba(0,0,0,0.08);
            overflow-x: auto; /* 允许横向滚动 */
            -webkit-overflow-scrolling: touch; /* 优化移动端滚动体验 */
        }
        table {
            min-width: 700px; /* 设置最小宽度,确保表格可滚动 */
            border-collapse: collapse;
            table-layout: fixed;
        }
        th, td {
            padding: 10px 12px;
            text-align: center; /* 内容居中 */
            border: 1px solid #e9ecef;
            word-break: break-all;
            white-space: normal;
            vertical-align: middle;
        }
        th {
            background-color: #f1f3f5;
            font-weight: 500;
            font-size: 0.9rem;
        }
        th:nth-child(1), td:nth-child(1) {width: 80px;} /* 产品列宽度 */
        th:nth-child(2), td:nth-child(2) {width: 60px;}  /* +15列宽度 */
        th:nth-child(3), td:nth-child(3) {width: 120px;}  /* *1.1列宽度 */
        th:nth-child(4), td:nth-child(4) {width: 80px;} /* 输出值列宽度 */
        th:nth-child(5), th:nth-child(6), th:nth-child(7), th:nth-child(8), th:nth-child(9) {
            width: 70px; /* 权重列宽度 */
        }
        
        /* 单元格样式 */
        .editable-cell {padding: 0;position: relative;}
        .editable-cell input {
            width: 100%;
            padding: 8px 10px;
            border: none;
            border-bottom: 1px solid #dee2e6;
            background-color: transparent;
            font-size: 0.9rem;
            outline: none;
            transition: border-color 0.2s;
            text-align: center; /* 输入框内容居中 */
        }
        .editable-cell input:focus {border-bottom-color: #4CAF50;}
        .non-editable-cell {
            background-color: #f9f9f9;
            font-style: italic;
            font-size: 0.9rem;
            color: #6c757d;
            text-align: center; /* 不可编辑单元格内容居中 */
        }
        
        /* 权重汇总单元格样式优化 */
        .weight-summary {
            background-color: #f1f8e9; /* 浅绿色背景 */
            color: #388e3c; /* 绿色文字 */
            font-style: normal;
            text-align: left; /* 内容左对齐 */
            padding: 10px;
            border-radius: 4px;
        }
        .weight-item {
            display: flex;
            justify-content: space-between;
            padding: 2px 0;
            font-size: 0.9rem;
        }
        .weight-label {
            font-weight: 500;
        }
        .weight-value {
            font-weight: normal;
        }
        
        /* radio和checkbox容器样式 */
        .radio-container, .checkbox-container {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            min-height: 40px; /* 确保有足够的高度 */
        }
        
        /* iOS设备上的特殊样式 */
        @media only screen and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
            .radio-container input[type="radio"],
            .checkbox-container input[type="checkbox"] {
                -webkit-appearance: none;
                appearance: none;
                margin: 0;
                position: relative;
                width: 18px;
                height: 18px;
                vertical-align: middle;
            }
            
            .radio-container input[type="radio"] {
                border-radius: 50%;
                border: 1px solid #ccc;
            }
            
            .radio-container input[type="radio"]:checked {
                border-color: #4CAF50;
            }
            
            .radio-container input[type="radio"]:checked::after {
                content: '';
                position: absolute;
                top: 3px;
                left: 3px;
                width: 10px;
                height: 10px;
                border-radius: 50%;
                background-color: #4CAF50;
            }
            
            .checkbox-container input[type="checkbox"] {
                border: 1px solid #ccc;
                border-radius: 2px;
            }
            
            .checkbox-container input[type="checkbox"]:checked {
                border-color: #4CAF50;
                background-color: #4CAF50;
            }
            
            .checkbox-container input[type="checkbox"]:checked::after {
                content: '';
                position: absolute;
                top: 1px;
                left: 5px;
                width: 4px;
                height: 9px;
                border: solid white;
                border-width: 0 2px 2px 0;
                transform: rotate(45deg);
            }
        }
        
        /* 按钮样式 */
        .action-buttons {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin: 20px 0;
        }
        .button {
            padding: 10px 18px;
            border: none;
            border-radius: 6px;
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            min-width: 100px;
            transition: all 0.2s;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .save-button {
            background-color: #4CAF50;
            color: white;
        }
        .save-button:hover {
            background-color: #45a049;
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(76, 175, 80, 0.2);
        }
        
        .reset-button {
            background-color: #f44336;
            color: white;
        }
        .reset-button:hover {
            background-color: #d32f2f;
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(244, 67, 54, 0.2);
        }
        
        /* 状态提示 */
        .status-message {
            text-align: center;
            margin: 15px 0;
            font-weight: 500;
            color: #4CAF50;
            display: none;
            padding: 10px;
            background-color: rgba(76, 175, 80, 0.1);
            border-radius: 4px;
            font-size: 0.9rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        }
        
        /* 响应式优化 */
        @media (max-width: 480px) {
            th, td {
                padding: 8px 8px;
                font-size: 0.85rem;
            }
            .editable-cell input {
                padding: 6px 8px;
                font-size: 0.85rem;
            }
            .button {
                padding: 8px 16px;
                font-size: 0.85rem;
                min-width: 90px;
            }
            .weight-summary {
                font-size: 0.8rem;
            }
        }
    </style>
</head>
<body>
    
    
    <!-- 下拉框占位符 - 保持布局稳定 -->
    <div class="custom-select-placeholder" id="selectPlaceholder">
        <div class="custom-select-visible">
            <div class="custom-select-value-visible" id="weightColValueVisible">选择权重列</div>
            <div class="custom-select-arrow-visible">
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M6 9L12 15L18 9" stroke="#666" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
            </div>
        </div>
    </div>
    
    <!-- 遮罩层 -->
    <div class="overlay" id="overlay"></div>
    
    <!-- 自定义下拉框 - 替代原生select -->
    <div class="custom-select" id="weightColSelect">
        <div class="custom-select-header">
            <div class="custom-select-value" id="weightColValue">选择权重列</div>
            <div class="custom-select-arrow"></div>
        </div>
        <div class="custom-select-options" id="weightColOptions">
            <div class="custom-select-option" data-value="1">权重1</div>
            <div class="custom-select-option" data-value="2">权重2</div>
            <div class="custom-select-option" data-value="3">权重3</div>
            <div class="custom-select-option" data-value="4">权重4</div>
            <div class="custom-select-option" data-value="5">权重5</div>
        </div>
    </div>
    
    <div class="table-container">
        <table id="editableTable">
            <thead>
                <tr>
                    <th>产品</th>
                    <th>+15</th>
                    <th>系数</th>
                    <th>输出值</th>
                    <th>权重1</th>
                    <th>权重2</th>
                    <th>权重3</th>
                    <th>权重4</th>
                    <th>权重5</th>
                </tr>
            </thead>
            <tbody>
                <!-- 5行数据行 - 内容居中 -->
                <tr>
                    <td class="editable-cell"><input type="text" placeholder="输入产品值"></td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            <input type="radio" name="coefficient" value="15">
                        </div>
                    </td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            1<input type="radio" name="coeffValue1" value="1">
                            1.1<input type="radio" checked name="coeffValue1" value="1.1">
                            1.2<input type="radio" name="coeffValue1" value="1.2">
                        </div>
                    </td>
                    <td class="non-editable-cell"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.28"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.39"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.19"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.14"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.0"></td>
                </tr>
                <tr>
                    <td class="editable-cell"><input type="text" placeholder="输入产品值"></td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            <input type="radio" name="coefficient" value="15">
                        </div>
                    </td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            1<input type="radio" name="coeffValue2" value="1">
                            1.1<input type="radio" checked name="coeffValue2" value="1.1">
                            1.2<input type="radio" name="coeffValue2" value="1.2">
                        </div>
                    </td>
                    <td class="non-editable-cell"></td>
                    <td class="editable-cell"><input type="text" readonly value="0"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.05"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.23"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.31"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.41"></td>
                </tr>
                <tr>
                    <td class="editable-cell"><input type="text" placeholder="输入产品值"></td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            <input type="radio" name="coefficient" value="15">
                        </div>
                    </td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            1<input type="radio" name="coeffValue3" value="1">
                            1.1<input type="radio" checked name="coeffValue3" value="1.1">
                            1.2<input type="radio" name="coeffValue3" value="1.2">
                        </div>
                    </td>
                    <td class="non-editable-cell"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.18"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.47"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.26"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.09"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.0"></td>
                </tr>
                <tr>
                    <td class="editable-cell"><input type="text" placeholder="输入产品值"></td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            <input type="radio" name="coefficient" value="15">
                        </div>
                    </td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            1<input type="radio" name="coeffValue4" value="1">
                            1.1<input type="radio" checked name="coeffValue4" value="1.1">
                            1.2<input type="radio" name="coeffValue4" value="1.2">
                        </div>
                    </td>
                    <td class="non-editable-cell"></td>
                    <td class="editable-cell"><input type="text" readonly value="0"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.03"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.21"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.35"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.41"></td>
                </tr>
                <tr>
                    <td class="editable-cell"><input type="text" placeholder="输入产品值"></td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            <input type="radio" name="coefficient" value="15">
                        </div>
                    </td>
                    <td class="editable-cell">
                        <div class="radio-container">
                            1<input type="radio" name="coeffValue5" value="1">
                            1.1<input type="radio" checked name="coeffValue5" value="1.1">
                            1.2<input type="radio" name="coeffValue5" value="1.2">
                        </div>
                    </td>
                    <td class="non-editable-cell"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.06"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.06"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.19"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.32"></td>
                    <td class="editable-cell"><input type="text" readonly value="0.35"></td>
                </tr>
                <!-- 总计行 -->
                <tr>
                    <td colspan="4" class="weight-summary">
                        <div class="weight-item"><span class="weight-label">总计:</span><span class="weight-value"></span></div>
                        <div class="weight-item"><span class="weight-label">权重1:</span><span class="weight-value1"></span></div>
                        <div class="weight-item"><span class="weight-label">权重2:</span><span class="weight-value2"></span></div>
                        <div class="weight-item"><span class="weight-label">权重3:</span><span class="weight-value3"></span></div>
                        <div class="weight-item"><span class="weight-label">权重4:</span><span class="weight-value4"></span></div>
                        <div class="weight-item"><span class="weight-label">权重5:</span><span class="weight-value5"></span></div>
                    </td>
                    <td colspan="5" class="editable-cell"></td>
                </tr>
            </tbody>
        </table>
    </div>
    
    <div class="action-buttons">
        <button id="calculateButton" class="button save-button">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M19 3H5C3.89 3 3 3.89 3 5V19C3 20.11 3.89 21 5 21H19C20.11 21 21 20.11 21 19V5C21 3.89 20.11 3 19 3ZM19 19H5V5H19V19Z" fill="currentColor"/>
                <path d="M14 7H10V13H14V7ZM7 7H3V17H7V7Z" fill="currentColor"/>
            </svg>
            计算
        </button>
        
        <button id="resetButton" class="button reset-button">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M20 11H7.83L10.91 8.91C11.3 8.52 11.3 7.89 10.91 7.5C10.52 7.11 9.89 7.11 9.5 7.5L4.5 12.5C4.11 12.89 4.11 13.52 4.5 13.91L9.5 18.91C9.89 19.3 10.52 19.3 10.91 18.91C11.3 18.52 11.3 17.89 10.91 17.5L7.83 14.41H20C20.55 14.41 21 13.96 21 13.41V12.41C21 11.86 20.55 11.41 20 11.41V11Z" stroke="white" stroke-width="1.5"/>
            </svg>
            <span>重置</span>
        </button>
    </div>
    
    <div id="statusMessage" class="status-message">
        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M12 16L16 12L12 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
        计算完成
    </div>

    <script>
        
        // 获取DOM元素
        const calculateButton = document.getElementById('calculateButton');
        const statusMessage = document.getElementById('statusMessage');
        const customSelect = document.getElementById('weightColSelect');
        const selectHeader = customSelect.querySelector('.custom-select-header');
        const selectOptions = customSelect.querySelector('.custom-select-options');
        const selectValue = customSelect.querySelector('.custom-select-value');
        const optionElements = customSelect.querySelectorAll('.custom-select-option');
        const overlay = document.getElementById('overlay');
        const selectPlaceholder = document.getElementById('selectPlaceholder');
        const selectValueVisible = document.getElementById('weightColValueVisible');
        
        // 存储选中的权重列值
        let selectedWeightCol = 1;
        selectValue.textContent = `权重${selectedWeightCol}`;
        selectValueVisible.textContent = `权重${selectedWeightCol}`;
        optionElements[0].classList.add('selected');
        
        // 记录下拉框位置
        let selectPosition = { top: 0, left: 0 };
        
        // 初始化下拉框位置
        function updateSelectPosition() {
            const rect = selectPlaceholder.getBoundingClientRect();
            selectPosition = {
                top: rect.top + window.scrollY,
                left: rect.left + window.scrollX
            };
            
            // 设置下拉框位置
            customSelect.style.top = `${selectPosition.top}px`;
            customSelect.style.left = `${selectPosition.left}px`;
        }
        
        // 页面加载和调整大小时更新位置
        window.addEventListener('load', updateSelectPosition);
        window.addEventListener('resize', updateSelectPosition);
        window.addEventListener('scroll', updateSelectPosition);
        
        // 显示下拉框
        function showSelect() {
            updateSelectPosition();
            customSelect.style.display = 'block';
            // 触发重排后添加动画效果
            setTimeout(() => {
                customSelect.classList.add('active');
            }, 10);
        }
        
        // 隐藏下拉框
        function hideSelect() {
            customSelect.classList.remove('active');
            setTimeout(() => {
                customSelect.style.display = 'none';
            }, 300); // 与过渡时间匹配
        }
        
        // 自定义下拉框交互 - 点击占位符显示下拉框
        selectPlaceholder.addEventListener('click', function() {
            if (customSelect.classList.contains('active')) {
                hideSelect();
                overlay.style.display = 'none';
                document.body.style.overflow = ''; // 解锁页面滚动
            } else {
                showSelect();
                overlay.style.display = 'block';
                document.body.style.overflow = 'hidden'; // 锁定页面滚动
            }
        });
        
        // 点击选项
        optionElements.forEach(option => {
            option.addEventListener('click', function() {
                // 移除所有选中状态
                optionElements.forEach(o => o.classList.remove('selected'));
                // 设置当前选项为选中
                this.classList.add('selected');
                // 更新显示值和存储值
                selectedWeightCol = parseInt(this.dataset.value);
                selectValue.textContent = `权重${selectedWeightCol}`;
                selectValueVisible.textContent = `权重${selectedWeightCol}`;
                // 关闭下拉框
                hideSelect();
                overlay.style.display = 'none';
                document.body.style.overflow = ''; // 解锁页面滚动
            });
        });
        
        // 点击遮罩层关闭下拉框
        overlay.addEventListener('click', function() {
            hideSelect();
            overlay.style.display = 'none';
            document.body.style.overflow = ''; // 解锁页面滚动
        });
        
        // 点击页面其他地方关闭下拉框
        document.addEventListener('click', function(event) {
            if (!customSelect.contains(event.target) && !selectPlaceholder.contains(event.target)) {
                hideSelect();
                overlay.style.display = 'none';
                document.body.style.overflow = ''; // 解锁页面滚动
            }
        });
        
        // 获取选中的系数行索引
        function getSelectedCoefficientRow() {
            const radios = document.getElementsByName('coefficient');
            for (let i = 0; i < radios.length; i++) {
                if (radios[i].checked) {
                    return i + 1; // 返回选中行的索引(1-5)
                }
            }
            return 0; // 默认返回第一行
        }

        // 获取选中的系数行索引
        function getSelectedCoeffValueRow(row) {
            const radios = document.getElementsByName('coeffValue' + row);
            for (let i = 0; i < radios.length; i++) {
                if (radios[i].checked) {
                    return radios[i].value; // 返回选中行的索引(1-5)
                }
            }
            return 1; // 默认返回第一行
        }
        
        // 获取所有选中的checkbox值
        function getCheckedCoeffValues() {
            const checkboxes = document.querySelectorAll('input[name="coeffValue"]:checked');
            return Array.from(checkboxes).map(checkbox => parseInt(checkbox.value));
        }
        
        // 计算并填充输出值
        function calculateOutput() {
            // 使用自定义下拉框的选中值
            if (selectedWeightCol < 1 || selectedWeightCol > 5) {
                showStatusMessage('请选择有效的权重列(1-5)');
                return;
            }
            
            let totalOutput = 0;
            var coefficientIndex = getSelectedCoefficientRow();
            let maxTotal1 = 0;
            let maxTotal2 = 0;
            let maxTotal3 = 0;
            let maxTotal4 = 0;
            let maxTotal5 = 0;
            // 遍历5行数据
            for (let row = 1; row <= 5; row++) {
                // 获取产品值、基础值、系数
                const productValue = parseFloat($(`tbody tr:nth-child(${row}) td:nth-child(1) input`).val() || 0);
                let baseValue = 0;
                // const coeffValue = parseFloat($(`tbody tr:nth-child(${row}) td:nth-child(3) input`).val() || 1);
                if(coefficientIndex == row){
                    baseValue = 15;
                }
                var coeffValue = getSelectedCoeffValueRow(row);
                console.log(coeffValue);
                // 计算总基础值 = 产品值 + 基础值
                const totalBase = productValue + baseValue;
                
                // 获取对应权重列的值 (权重列索引: 5-9列对应weightCol=1-5)
                const weightColIndex = 4 + selectedWeightCol; // 转换为nth-child索引,如weightCol=3对应第7列
                const weightValue = parseFloat($(`tbody tr:nth-child(${row}) td:nth-child(${weightColIndex}) input`).val() || 0);
                
                // 计算输出值 = 总基础值 * 系数 * 权重值
                const outputValue = totalBase * coeffValue * weightValue;
                const formattedOutput = outputValue.toFixed(2);
                
                // 填充输出列
                $(`tbody tr:nth-child(${row}) td:nth-child(4)`).text(formattedOutput);
                
                // 累加总计
                totalOutput += outputValue;

                for(let weight = 1; weight <= 5; weight++){
                    // 获取对应权重列的值 (权重列索引: 5-9列对应weightCol=1-5)
                    var weightColIndex2 = 4 + weight; // 转换为nth-child索引,如weightCol=3对应第7列
                    var weightValue2 = parseFloat($(`tbody tr:nth-child(${row}) td:nth-child(${weightColIndex2}) input`).val() || 0);
                    // 计算输出值 = 总基础值 * 系数 * 权重值
                    var outputValue2 = totalBase * coeffValue * weightValue2;
                    // 累加总计
                    if(weight == 1){
                        maxTotal1 += outputValue2;
                    }else if(weight == 2){
                        maxTotal2 += outputValue2;
                    }else if(weight == 3){
                        maxTotal3 += outputValue2;
                    }else if(weight == 4){
                        maxTotal4 += outputValue2;
                    }else if(weight == 5){
                        maxTotal5 += outputValue2;
                    }
                }
            }
            // 填充总计行
            $(".weight-value").text(totalOutput.toFixed(2));
            $(".weight-value1").text(maxTotal1.toFixed(2));
            $(".weight-value2").text(maxTotal2.toFixed(2));
            $(".weight-value3").text(maxTotal3.toFixed(2));
            $(".weight-value4").text(maxTotal4.toFixed(2));
            $(".weight-value5").text(maxTotal5.toFixed(2));
            // $(`tbody tr:nth-child(6) td:nth-child(4)`).text(totalOutput.toFixed(2));
            // // 填充总计行
            // $(`tbody tr:nth-child(7) td:nth-child(4)`).text(maxTotal1.toFixed(2));
            // $(`tbody tr:nth-child(8) td:nth-child(4)`).text(maxTotal2.toFixed(2));
            // $(`tbody tr:nth-child(9) td:nth-child(4)`).text(maxTotal3.toFixed(2));
            // $(`tbody tr:nth-child(10) td:nth-child(4)`).text(maxTotal4.toFixed(2));
            // $(`tbody tr:nth-child(11) td:nth-child(4)`).text(maxTotal5.toFixed(2));
            // $(`tbody tr:nth-child(7) td:nth-child(1)`).text("权重1:" + maxTotal1.toFixed(2)
            //  + ";权重2:" + maxTotal2.toFixed(2) + ";权重3:" + maxTotal3.toFixed(2) + ";权重4:" + maxTotal4.toFixed(2)
            //   + ";权重5:" + maxTotal5.toFixed(2));
            console.log(`权重列计算结果 - 权重列:${selectedWeightCol},  总计:${totalOutput}`);
        }
        
        // 绑定计算按钮事件
        calculateButton.addEventListener('click', calculateOutput);
        
            
        // 重置按钮点击事件
        $('#resetButton').click(resetForm);
        
        // 初始化时限制输入为数字
        $('input').on('input', function() {
            this.value = this.value.replace(/[^0-9.-]/g, ''); // 只允许数字和小数点
        });
        
        // 确保页面加载完成后正确显示选中的权重列
        document.addEventListener('DOMContentLoaded', function() {
            selectValueVisible.textContent = `权重${selectedWeightCol}`;
        });

        
        
        // 重置表单
        function resetForm() {
            // 清除输入框
            $('input[type="text"]').each(function() {
                if (!$(this).attr('readonly')) {
                    $(this).val('');
                }
            });
            
            // 取消所有复选框和单选框
            $('input[type="checkbox"], input[type="radio"]').prop('checked', false);
            $('input[value="1.1"][name="coeffValue1"]').prop('checked', true);
            $('input[value="1.1"][name="coeffValue2"]').prop('checked', true);
            $('input[value="1.1"][name="coeffValue3"]').prop('checked', true);
            $('input[value="1.1"][name="coeffValue4"]').prop('checked', true);
            $('input[value="1.1"][name="coeffValue5"]').prop('checked', true);
            
            // 清除输出值和总计
            $('.output-cell').text('');
            $('.total-cell').text('');
            $('.recommendation-cell').text('推荐:');
            
            // 移除高亮
            $('.recommendation-cell, .output-cell, .total-cell').removeClass('result-highlight recommendation-highlight');
            
            // 填充总计行
            $(".weight-value").text('');
            $(".weight-value1").text('');
            $(".weight-value2").text('');
            $(".weight-value3").text('');
            $(".weight-value4").text('');
            $(".weight-value5").text('');
            // $(`tbody tr:nth-child(6) td:nth-child(4)`).text('');
            // // 填充总计行
            // $(`tbody tr:nth-child(6) td:nth-child(1)`).text('');
            // $(`tbody tr:nth-child(6) td:nth-child(2)`).text('');
            for (let row = 1; row <= 5; row++) {
                $(`tbody tr:nth-child(${row}) td:nth-child(4)`).text('');
            }
            // 显示状态消息
            showStatusMessage('已重置');
        }
            
        // 选择下拉框选项
        $('.custom-select-option').click(function() {
            const value = $(this).data('value');
            const text = $(this).text();
            
            // 更新选中状态
            $('.custom-select-option').removeClass('selected');
            $(this).addClass('selected');
            
            // 更新显示值
            $('#weightColValue').text(text);
            $('#weightColValueVisible').text(text);
            
            // 保存选中的权重列
            selectedWeightCol = parseInt(value);
            
            // 隐藏下拉框
            hideSelect();
            
            calculateOutput();
            // 显示状态消息
            //showStatusMessage(`已选择权重${selectedWeightCol}`);
        });
        
        // 显示状态消息
        function showStatusMessage(message) {
            const statusMessage = $('#statusMessage');
            statusMessage.text(message);
            statusMessage.fadeIn(300);
            
            setTimeout(() => {
                statusMessage.fadeOut(500);
            }, 2000);
        }

        // 检测iOS设备并应用特殊样式
        function isIOS() {
            return [
                'iPad Simulator',
                'iPhone Simulator',
                'iPod Simulator',
                'iPad',
                'iPhone',
                'iPod'
            ].includes(navigator.platform)
            || (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
        }
        
        if (isIOS()) {
            document.body.classList.add('ios-device');
        }
    </script>
</body>
</html>