快乐的昕的电脑
2025-11-05 f7123f58082c88056fb7bc1d0b46a76e4519e2ac
components/mold.vue
@@ -2,24 +2,45 @@
    <view class="page">
        <!-- 刀具选择区 -->
        <view class="top-section-grid">
            <view class="form-cell">
                <label class="form-label">刀具编号:</label>
                <input class="input" v-model="selectedToolNo" placeholder="请通过刀具目录选择" disabled />
                <button class="btn-blue" @click="openToolDialog" :disabled="loadingTools">刀具目录</button>
            <!-- 第一行:移除刀具目录按钮 -->
            <view class="form-row">
                <view class="form-cell">
                    <label class="form-label">刀具编号:</label>
                    <input class="input small-font" v-model="selectedToolNo" placeholder="请通过刀具目录选择" disabled />
                </view>
                <view class="form-cell">
                    <label class="form-label">设置使用上限:</label>
                    <input class="input small-font" type="number" v-model="useLimitInput" placeholder="每次换刀后手填" :disabled="!selectedToolNo || loadingForm" />
                </view>
                <view class="form-cell">
                    <label class="form-label">寿命比预警值:</label>
                    <view class="input-with-unit">
                        <input class="input small-font"
                               v-model="lifeWarnInput"
                               placeholder="如0.9或90"
                               :disabled="!selectedToolNo || loadingForm" />
                        <span class="unit-text">%</span>
                    </view>
                </view>
            </view>
            <view class="form-cell">
                <label class="form-label">设置使用上限:</label>
                <input class="input" type="number" v-model="useLimitInput" placeholder="每次换刀后手填" :disabled="!selectedToolNo || loadingForm" />
            </view>
            <view class="form-cell">
                <label class="form-label">刀具名称:</label>
                <input class="input" v-model="toolName" placeholder="刀具带出" disabled />
                <label class="form-label" style="margin-left: 16px;">规格型号:</label>
                <input class="input" v-model="toolModel" placeholder="刀具带出" disabled />
            </view>
        </view>
        <!-- 操作按钮 -->
            <!-- 第二行:在最后添加刀具目录按钮 -->
            <view class="form-row">
                <view class="form-cell">
                    <label class="form-label">刀具名称:</label>
                    <input class="input small-font" v-model="toolName" placeholder="刀具带出" disabled />
                </view>
                <view class="form-cell">
                    <label class="form-label">规格型号:</label>
                    <input class="input small-font" v-model="toolModel" placeholder="刀具带出" disabled />
                </view>
                <!-- 新增的刀具目录按钮 -->
                <view class="form-cell">
                    <button class="btn-blue large-btn" @click="openToolDialog" :disabled="loadingTools">刀具目录</button>
                </view>
            </view>
        </view>  <!-- 这里闭合 top-section-grid -->
        <!-- 操作按钮 - 移出 top-section-grid -->
        <view class="button-row">
            <button class="save-btn" @click="handleUpTool" :disabled="submitting || loadingForm">上刀提交</button>
            <button class="save-btn" @click="handleDownTool" :disabled="submitting || loadingForm">下刀提交</button>
@@ -28,82 +49,81 @@
        <!-- 刀具目录弹窗 -->
        <view v-if="showToolDialog" class="dialog-overlay">
            <view class="dialog">
                <view class="form-group">
                    <input v-model="searchKey" placeholder="输入刀具编码、名称模糊搜索" class="input" @input="onSearchKeyInput" />
                    <button class="btn-blue" @click="searchTool" :disabled="loadingTools">搜索</button>
                <view class="dialog">
                    <view class="form-group">
                        <input v-model="searchKey" placeholder="输入刀具编码、名称模糊搜索" class="input" @input="onSearchKeyInput" />
                        <button class="btn-blue" @click="searchTool" :disabled="loadingTools">搜索</button>
                    </view>
                    <view class="tool-list">
                        <button v-for="tool in filteredTools"
                                :key="tool.no"
                                class="tool-btn"
                                :class="{ active: activeToolNo === tool.no }"
                                @click="selectTool(tool)">
                            {{ tool.no }} | {{ tool.name }}
                        </button>
                    </view>
                    <view class="dialog-actions">
                        <div style="display: flex; align-items: center;">
                            <button class="btn-blue" @click="prevPage" :disabled="pageIndex === 1 || loadingTools">上一页</button>
                            <span style="margin: 0 12px;">第{{ pageIndex }}页 / 共{{ totalPages }}页</span>
                            <button class="btn-blue" @click="nextPage" :disabled="pageIndex === totalPages || loadingTools">下一页</button>
                        </div>
                        <div style="display: flex; gap: 18px; align-items: center;">
                            <button class="btn-blue" @click="confirmTool">确定</button>
                            <button class="btn-disabled" @click="closeToolDialog">取消</button>
                        </div>
                    </view>
                </view>
                <view class="tool-list">
                    <button v-for="tool in filteredTools"
                            :key="tool.no"
                            class="tool-btn"
                            :class="{ active: activeToolNo === tool.no }"
                            @click="selectTool(tool)">
                        {{ tool.no }} | {{ tool.name }}
                    </button>
                </view>
                <view class="dialog-actions">
                    <div style="display: flex; align-items: center;">
                        <button class="btn-blue" @click="prevPage" :disabled="pageIndex === 1 || loadingTools">上一页</button>
                        <span style="margin: 0 12px;">第{{ pageIndex }}页 / 共{{ totalPages }}页</span>
                        <button class="btn-blue" @click="nextPage" :disabled="pageIndex === totalPages || loadingTools">下一页</button>
                    </div>
                    <div style="display: flex; gap: 18px; align-items: center;">
                        <button class="btn-blue" @click="confirmTool">确定</button>
                        <button class="btn-disabled" @click="closeToolDialog">取消</button>
                    </div>
                </view>
            </view>
        </view>
        <!-- 刀具使用记录表格 -->
        <view class="table-section">
            <table class="styled-table">
                <thead>
                    <tr>
                        <th style="width:8%">刀具编号</th>
                        <th style="width:14%">刀具名称</th>
                        <th style="width:12%">上刀时间</th>
                        <th class="num" style="width:8%">上刀计数</th>
                        <th style="width:12%">下刀时间</th>
                        <th class="num" style="width:8%">下刀计数</th>
                        <th class="num" style="width:8%">使用次数</th>
                        <th class="num" style="width:8%">使用上限</th>
                        <th class="num" style="width:8%">寿命比%</th>
                        <th class="num" style="width:8%">寿命比预警值</th>
                        <th style="width:8%">预警状态</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(item, idx) in toolRecords" :key="item.id" :class="{'row-odd': idx % 2 === 0}">
                        <td>{{ item.no }}</td>
                        <td class="left">{{ item.name }}</td>
                        <td>{{ item.upTime }}</td>
                        <td class="num">{{ item.upCount != null ? item.upCount : '' }}</td>
                        <td>{{ item.downTime }}</td>
                        <td class="num">{{ item.downCount != null ? item.downCount : '' }}</td>
                        <td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>
                        <td class="num">{{ item.useLimit != null ? item.useLimit : '' }}</td>
                        <td class="num">{{ item.lifePercent }}</td>
                        <td class="num">{{ item.lifeWarn }}</td>
                        <td :class="item.warnStatus === '预警' ? 'warn-cell' : (item.warnStatus === '正常' ? 'ok-cell' : '')">
                            <span v-if="item.warnStatus === '预警'" class="warn-badge">警告</span>
                            <span v-else>{{ item.warnStatus }}</span>
                        </td>
                    </tr>
                    <tr v-if="!toolRecords.length">
                        <td colspan="11">暂无数据</td>
                    </tr>
                </tbody>
            </table>
                <table class="styled-table">
                    <thead>
                        <tr>
                            <th style="width:8%">刀具编号</th>
                            <th style="width:14%">刀具名称</th>
                            <th style="width:12%">上刀时间</th>
                            <th class="num" style="width:8%">上刀计数</th>
                            <th style="width:12%">下刀时间</th>
                            <th class="num" style="width:8%">下刀计数</th>
                            <th class="num" style="width:8%">使用次数</th>
                            <th class="num" style="width:8%">使用上限</th>
                            <th class="num" style="width:8%">寿命比%</th>
                            <th class="num" style="width:8%">寿命比预警值</th>
                            <th style="width:8%">预警状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item, idx) in toolRecords" :key="item.id" :class="{'row-odd': idx % 2 === 0}">
                            <td>{{ item.no }}</td>
                            <td class="left">{{ item.name }}</td>
                            <td>{{ item.upTime }}</td>
                            <td class="num">{{ item.upCount != null ? item.upCount : '' }}</td>
                            <td>{{ item.downTime }}</td>
                            <td class="num">{{ item.downCount != null ? item.downCount : '' }}</td>
                            <td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>
                            <td class="num">{{ item.useLimit != null ? item.useLimit : '' }}</td>
                            <td class="num">{{ item.lifePercent }}</td>
                            <td class="num">{{ item.lifeWarn }}</td>
                            <td :class="item.warnStatus === '预警' ? 'warn-cell' : (item.warnStatus === '正常' ? 'ok-cell' : '')">
                                <span v-if="item.warnStatus === '预警'" class="warn-badge">警告</span>
                                <span v-else>{{ item.warnStatus }}</span>
                            </td>
                        </tr>
                        <tr v-if="!toolRecords.length">
                            <td colspan="11">暂无数据</td>
                        </tr>
                    </tbody>
                </table>
        </view>
        <!-- 说明 -->
        <view class="tool-desc">
            <p style="color:red;">当前工单中,换了几次刀,就会产生几条数据。上刀时间、下刀时间在表中能看到。</p>
            <p style="color:red;">上刀时间和对应时间用生产计数器匹配,查出当时的生产数(累计计数)。</p>
            <p style="color:red;">寿命比预警值在刀具上,默认统一。</p>
        </view>
            <!-- 说明 -->
            <!--<view class="tool-desc">
        <p style="color:red;">'使用上限'以下刀时的'使用上限'为计算标准</p>
        <p style="color:red;">寿命比预警值默认为90%</p>
    </view>-->
    </view>
</template>
@@ -125,12 +145,20 @@
                searchKey: '',
                filteredTools: [],
                useLimitInput: '',
                lifeWarnInput: '', // 新增:寿命比预警值原始输入
                toolRecords: [],
                loadingTools: false,
                loadingForm: false,
                submitting: false,
                _searchTimer: null,
                workOrderCurrentCjNum: null // 工单当前数采
                workOrderCurrentCjNum: null, // 工单当前数采
                // 自动保存相关
                autoSaveTimer: null,
                isDirty: false, // 表单是否有未保存变更
                autoSaveIntervalMs: 5 * 60 * 1000, // 默认 5 分钟
                autoSaveEnabled: true,
                autoSaveActionName: 'handleUpTool' // 自动触发的方法名,可改为自定义保存方法
            };
        },
        computed: {
@@ -138,7 +166,65 @@
                return Math.max(1, Math.ceil(this.total / this.pageSize) || 1);
            }
        },
        watch: {
            // 标记脏数据:按需监听字段变化
            selectedToolNo() { this.isDirty = true; },
            useLimitInput() { this.isDirty = true; },
            lifeWarnInput() { this.isDirty = true; },
            toolName() { this.isDirty = true; },
            toolModel() { this.isDirty = true; }
        },
        methods: {
            // 自动保存:启动
            startAutoSave() {
                if (!this.autoSaveEnabled) return;
                this.stopAutoSave();
                this.autoSaveTimer = setInterval(() => {
                    this.autoSaveTick();
                }, this.autoSaveIntervalMs);
            },
            // 自动保存:停止
            stopAutoSave() {
                if (this.autoSaveTimer) {
                    clearInterval(this.autoSaveTimer);
                    this.autoSaveTimer = null;
                }
            },
            // 自动保存:每次定时执行时的逻辑
            async autoSaveTick() {
                if (!this.autoSaveEnabled) return;
                if (!this.isDirty) return;
                if (this.submitting || this.loadingForm) return;
                const fn = this.autoSaveActionName && typeof this[this.autoSaveActionName] === 'function'
                    ? this[this.autoSaveActionName]
                    : null;
                if (!fn) {
                    console.warn('自动保存:未找到方法', this.autoSaveActionName);
                    return;
                }
                try {
                    this.submitting = true;
                    await fn.call(this); // 调用保存方法(例如 handleUpTool)
                    // 如果保存成功,清脏标记(保存方法内部若失败没有抛出可保持此方式)
                    this.isDirty = false;
                } catch (e) {
                    console.error('自动保存失败:', e);
                } finally {
                    this.submitting = false;
                }
            },
            // 新增:寿命比预警值归一化 (返回 0~1 或 null)
            normalizeLifeWarn(v) {
                if (v == null) return null;
                const raw = String(v).trim().replace(/[%%]/g, '');
                if (raw === '') return null;
                const num = Number(raw);
                if (!isFinite(num) || num <= 0) return null;
                return num > 1 ? (num / 100) : num;
            },
            openToolDialog() {
                this.showToolDialog = true;
                this.pageIndex = 1;
@@ -171,10 +257,12 @@
                            return null;
                        };
                        // 这里需要把 lifeWarn 字段也带出来
                        const mapped = (payload || []).map(t => ({
                            no: getField(t, 'cutterId', 'CUTTER_ID', 'cutteR_ID', 'daA001', 'no'),
                            name: getField(t, 'cutterName', 'CUTTER_NAME', 'cutteR_NAME', 'name'),
                            model: getField(t, 'cutterModel', 'CUTTER_MODEL', 'cutteR_MODEL', 'model')
                            model: getField(t, 'cutterModel', 'CUTTER_MODEL', 'cutteR_MODEL', 'model'),
                            lifeWarn: getField(t, 'modlLifeWorning', 'lifeWarn', 'LIFE_WARN', 'lifE_WARN')
                        }));
                        this.filteredTools = mapped;
@@ -224,6 +312,14 @@
                this.toolName = tool.name;
                this.toolModel = tool.model;
                this.activeToolNo = tool.no;
                // 新增:带出寿命比预警值
                if (tool.lifeWarn !== undefined && tool.lifeWarn !== null) {
                    // 格式化为百分比字符串
                    const warn = Number(tool.lifeWarn);
                    this.lifeWarnInput = warn <= 1 ? (warn * 100).toFixed(0) : warn.toFixed(0);
                } else {
                    this.lifeWarnInput = '';
                }
            },
            confirmTool() {
                this.showToolDialog = false;
@@ -259,14 +355,15 @@
                // sdjs 使用工单 currentCjNum
                const sdjs = this.workOrderCurrentCjNum != null ? Number(this.workOrderCurrentCjNum) : null;
                const lifeWarnRatio = this.normalizeLifeWarn(this.lifeWarnInput);
                const payload = {
                    workOrderNo: this.workOrderNo,
                    machineNo: this.machineNo,
                    toolNo: this.selectedToolNo,
                    type: '上机',
                    useLimit,
                    sdjs // 上刀计数(工单当前数采)
                    sdjs,// 上刀计数(工单当前数采)
                    modlLifeWorning: lifeWarnRatio // 新增
                };
                try {
                    this.submitting = true;
@@ -294,6 +391,7 @@
                } catch (err) {
                    console.error(err);
                    this.$showMessage('上刀提交失败,请检查网络');
                    throw err; // 抛出以便自动保存逻辑捕获并保留 isDirty
                } finally {
                    this.submitting = false;
                }
@@ -309,14 +407,15 @@
                // 下刀计数同样取工单最新采集数
                const xdjs = this.workOrderCurrentCjNum != null ? Number(this.workOrderCurrentCjNum) : null;
                const lifeWarnRatio = this.normalizeLifeWarn(this.lifeWarnInput);
                const payload = {
                    workOrderNo: this.workOrderNo,
                    machineNo: this.machineNo,
                    toolNo: this.selectedToolNo,
                    type: '下机',
                    useLimit,
                    xdjs // 下刀计数
                    xdjs,// 下刀计数
                    modlLifeWorning: lifeWarnRatio // 新增
                };
                try {
                    this.submitting = true;
@@ -344,6 +443,7 @@
                } catch (err) {
                    console.error(err);
                    this.$showMessage('下刀提交失败,请检查网络');
                    throw err;
                } finally {
                    this.submitting = false;
                }
@@ -353,6 +453,8 @@
                this.toolName = '';
                this.toolModel = '';
                this.useLimitInput = '';
                this.lifeWarnInput = ''; // 新增:清空
                this.isDirty = false;
            },
            async fetchFormData() {
                if (!this.workOrderNo || !this.machineNo) {
@@ -385,19 +487,6 @@
                        return null;
                    };
                    const parseNumber = v => {
                        if (v === null || v === undefined || v === '') return null;
                        const s = String(v).replace(/[,%%]/g, '').trim();
                        const n = parseFloat(s);
                        return Number.isFinite(n) ? n : null;
                    };
                    const formatPercent = n => {
                        if (n === null || n === undefined || isNaN(n)) return '';
                        if (n <= 1) return `${(n * 100).toFixed(0)}%`;
                        return `${Number(n).toFixed(0)}%`;
                    };
                    const mapped = (list || []).map(t => {
                        const upTimeRaw = getField(t, 'uP_TIME', 'UP_TIME', 'uPTime', 'UPTIME', 'UpTime');
                        const downTimeRaw = getField(t, 'dowN_TIME', 'DOWN_TIME', 'downTime', 'DOWNTIME');
@@ -408,11 +497,7 @@
                        const useLimit = getField(t, 'usE_LIMIT', 'USE_LIMIT', 'useLimit');
                        let percent = '';
                        if (
                            useCount != null && useLimit != null &&
                            !isNaN(useCount) && !isNaN(useLimit) &&
                            Number(useLimit) > 0
                        ) {
                        if (useCount != null && useLimit != null && !isNaN(useCount) && !isNaN(useLimit) && Number(useLimit) > 0) {
                            percent = ((Number(useCount) / Number(useLimit)) * 100).toFixed(0) + '%';
                        }
@@ -454,6 +539,18 @@
                        };
                    });
                    // 新增:按上刀时间降序排序(越晚的越上面)
                    mapped.sort((a, b) => {
                        // 时间格式如 "10-24 16:03",转为 Date 对象比较
                        const parse = s => {
                            if (!s) return 0;
                            // 补年份,假设都是今年
                            const year = new Date().getFullYear();
                            return new Date(`${year}-${s.replace(/-/g, '-')}:00`).getTime();
                        };
                        return parse(b.upTime) - parse(a.upTime); // 注意这里顺序反过来
                    });
                    this.toolRecords = mapped;
                    const totalFromRes = Number(
                        res.data?.total ?? res.data?.totalCount ?? res.total ?? res.totalCount ?? mapped.length
@@ -483,6 +580,13 @@
                        this.toolModel = order.cutterModel || order.cutteR_MODEL || '';
                        // 关键:获取工单最新采集数
                        this.workOrderCurrentCjNum = order.CurrentCjNum ?? order.currentCjNum ?? null;
                        // 新增:自动填充寿命比预警值
                        if (order.modlLifeWorning !== undefined && order.modlLifeWorning !== null) {
                            const warn = Number(order.modlLifeWorning);
                            this.lifeWarnInput = warn <= 1 ? (warn * 100).toFixed(0) : warn.toFixed(0);
                        } else {
                            this.lifeWarnInput = '';
                        }
                    } else {
                        this.workOrderCurrentCjNum = null;
                    }
@@ -519,9 +623,8 @@
            this.fetchTools('');
            this.machineNo = uni.getStorageSync('machineNo') || '';
            this.workOrderNo = uni.getStorageSync('daa001') || '';
            console.log('机台号:', this.machineNo);
            console.log('工单号:', this.workOrderNo);
            // 去除默认预警值 (90% -> 0.9)
            //this.lifeWarnInput = '90';
            if (this.machineNo && this.workOrderNo) {
                this.fetchFormData();
@@ -529,77 +632,118 @@
            } else {
                console.warn('机台号或工单号为空,无法获取表单数据');
            }
            // 启动自动保存定时器
            this.startAutoSave();
        },
        beforeDestroy() {
            // 清理定时器,防止内存泄漏
            this.stopAutoSave();
        }
    };
</script>
<style scoped>
    /* 优化顶部表单区域样式 */
    .top-section-grid {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        gap: 32px;
        align-items: center;
        gap: 12px;
        margin-bottom: 2vh;
        width: 95vw; /* 新增,和表格宽度一致 */
        max-width: 1600px; /* 新增,和表格一致 */
        margin-left: auto; /* 新增,居中 */
        margin-right: auto; /* 新增,居中 */
        width: 95vw;
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }
    /* 表单行样式优化 */
    .form-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-bottom: 8px;
    }
        .form-row:last-child {
            margin-bottom: 0;
        }
    .form-cell {
        display: flex;
        align-items: center;
        flex: 1;
        margin: 0 8px;
        min-height: 44px;
    }
    .form-label {
        width: 90px;
        width: 100px;
        font-weight: bold;
        font-size: 18px;
        color: #333;
        white-space: nowrap;
        margin-right: 8px;
        flex-shrink: 0;
    }
    .input {
        padding: 1vh;
        font-size: 1.1vw;
        border: 1px solid #ccc;
        width: 10vw;
        margin-right: 8px;
        border-radius: 6px;
        background: #f8f8f8;
        padding: 8px 12px;
        font-size: 16px;
        border: 1px solid #dcdfe6;
        flex: 1;
        margin-right: 0;
        border-radius: 4px;
        background: #fff;
        min-width: 0;
        height: 36px;
        box-sizing: border-box;
    }
    .form-select {
        width: 12vw;
        padding: 1vh;
        font-size: 1.1vw;
        margin-right: 8px;
        border-radius: 6px;
        background: #f8f8f8;
    }
        .input.small-font {
            font-size: 15px;
        }
        .input:disabled {
            background-color: #f5f7fa;
            color: #c0c4cc;
            cursor: not-allowed;
        }
    .btn-blue {
        background-color: #00A2E9;
        background-color: #1890ff;
        color: white;
        border: none;
        padding: 14px 36px;
        margin-left: 8px;
        border-radius: 10px;
        padding: 8px 16px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 1.1vw;
        font-weight: bold;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        transition: background 0.2s, box-shadow 0.2s;
        font-size: 16px;
        font-weight: 500;
        white-space: nowrap;
        height: 60px;
        box-sizing: border-box;
        transition: all 0.3s;
        flex-shrink: 0;
    }
        .btn-blue:active,
        .btn-blue:focus {
            background-color: #0086c2;
            box-shadow: 0 4px 12px rgba(0,162,233,0.12);
        .btn-blue:hover {
            background-color: #40a9ff;
        }
        .btn-blue:active {
            background-color: #096dd9;
        }
        .btn-blue:disabled {
            background: #b3e0f7;
            color: #eee;
            background: #bae7ff;
            color: #91d5ff;
            cursor: not-allowed;
            box-shadow: none;
        }
    .button-row {
@@ -626,6 +770,20 @@
        color: #333;
    }
    .save-btn:hover {
        background-color: #40a9ff;
    }
    .save-btn:active {
        background-color: #096dd9;
    }
    .save-btn:disabled, .cancel-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
    /* 弹窗样式 */
    .dialog-overlay {
        position: fixed;
        top: 0;
@@ -643,15 +801,27 @@
        background: #fff;
        padding: 3vh 3vw;
        border-radius: 18px;
        width: 100vw;
        max-width: 1200px;
        min-height: 60vh;
        width: 90vw;
        max-width: 1600px;
        min-height: 70vh;
        max-height: 85vh;
        box-sizing: border-box;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12);
        display: flex;
        flex-direction: column;
    }
    .form-group {
        display: flex;
        gap: 12px;
        align-items: center;
        margin-bottom: 2vh;
        flex-shrink: 0;
    }
    .form-group .input {
        width: 24vw;
        flex: 1;
        min-width: 300px;
        border-radius: 6px;
        background: #f8f8f8;
    }
@@ -660,25 +830,29 @@
        display: flex;
        flex-wrap: wrap;
        margin: 1vh 0;
        max-height: 40vh;
        flex: 1;
        overflow-y: auto;
        gap: 10px 0;
        gap: 12px;
        align-content: flex-start;
    }
    .tool-btn {
        flex: 0 0 24%; /* 每行4个按钮 */
        flex: 0 0 calc(20% - 10px);
        box-sizing: border-box;
        margin: 5px 1% 5px 0;
        padding: 12px 18px;
        padding: 10px 12px;
        background: #f5f5f5;
        border: 1px solid #d0d0d0;
        border-radius: 8px;
        cursor: pointer;
        color: #333;
        text-align: left;
        font-size: 1vw;
        font-size: 13px;
        min-height: 50px;
        transition: background 0.15s, color 0.15s;
        word-break: break-all;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.4;
    }
        .tool-btn.active {
@@ -691,10 +865,11 @@
    .dialog-actions {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        align-items: center;
        margin-top: 2vh;
        padding-top: 2vh;
        border-top: 1px solid #eee;
        flex-shrink: 0;
    }
        .dialog-actions > div:first-child {
@@ -710,19 +885,26 @@
            align-items: center;
        }
        .dialog-actions .btn-blue {
            padding: 10px 24px;
            font-size: 16px;
            min-width: 100px;
        }
    .btn-disabled {
        background: #f2f2f2;
        color: #bbb;
        color: #999;
        border: none;
        padding: 14px 36px;
        border-radius: 10px;
        font-size: 1.1vw;
        font-weight: bold;
        padding: 10px 24px;
        border-radius: 4px;
        font-size: 16px;
        font-weight: 500;
        cursor: not-allowed;
        box-shadow: none;
        min-width: 100px;
    }
    /* 表格整体居中,宽度限制,内容居中 */
    /* 表格样式 */
    .table-section {
        display: flex;
        justify-content: center;
@@ -731,8 +913,8 @@
    }
    table.styled-table {
        max-width: 1600px; /* 原为1400px,调宽 */
        width: 95vw; /* 原为90vw,调宽 */
        max-width: 1600px;
        width: 95vw;
        margin: 0 auto;
        border-collapse: separate;
        border-spacing: 0;
@@ -760,13 +942,11 @@
            text-align: center;
        }
    .table-section table th:first-child,
    .table-section table td:first-child {
    .table-section table th:first-child, .table-section table td:first-child {
        border-left: 2px solid #bfbfbf;
    }
    .table-section table th:last-child,
    .table-section table td:last-child {
    .table-section table th:last-child, .table-section table td:last-child {
        border-right: 2px solid #bfbfbf;
    }
@@ -808,30 +988,60 @@
        font-size: 0.9vw;
    }
    .header-badge {
        display: inline-block;
        background: #fff7e6;
        color: #8a6d00;
        border: 1px solid #ffe58f;
        padding: 1px 6px;
        border-radius: 3px;
        margin-left: 6px;
        font-size: 0.8vw;
        vertical-align: middle;
    }
    .warn {
        color: red;
        font-weight: bold;
    }
    .bottom-section {
    /* 带单位的输入框样式 */
    .input-with-unit {
        display: flex;
        justify-content: space-around;
        margin-top: 2vh;
        align-items: center;
        flex: 1;
    }
    .tool-desc {
        margin-top: 2vh;
        .input-with-unit .input {
            flex: 1;
            margin-right: 8px;
        }
    .unit-text {
        color: #666;
        font-size: 14px;
        white-space: nowrap;
        width: 20px;
    }
    /* 响应式调整 */
    @media (max-width: 1200px) {
        .form-cell {
            margin: 0 4px;
        }
        .form-label {
            width: 90px;
            font-size: 16px;
        }
        .input {
            font-size: 14px;
            padding: 6px 10px;
        }
        .btn-blue {
            padding: 6px 12px;
            font-size: 14px;
        }
    }
    /* 新增大按钮样式 */
    .btn-blue.large-btn {
        padding: 8px 24px;
        font-size: 16px;
        height: 60px;
        min-width: 100px;
    }
    /* 调整表单单元格布局以适应按钮 */
    .form-row .form-cell:last-child {
        justify-content: center;
        flex: 0 0 auto;
        min-width: 120px;
    }
</style>