快乐的昕的电脑
2025-10-31 387fdc6d364145a1445ca9d5809614f865091d0d
components/mold.vue
@@ -14,10 +14,13 @@
            <!-- 新增:寿命比预警值输入框 -->
            <view class="form-cell">
                <label class="form-label">寿命比预警值:</label>
                <input class="input small-font"
                       v-model="lifeWarnInput"
                       placeholder="如0.9或90或90%"
                       :disabled="!selectedToolNo || loadingForm" />
                <view class="input-with-suffix">
                    <input class="input small-font"
                           v-model="lifeWarnInput"
                           placeholder="如0.9或90"
                           :disabled="!selectedToolNo || loadingForm" />
                    <span class="input-suffix">%</span>
                </view>
            </view>
            <view class="form-cell">
                <label class="form-label">刀具名称:</label>
@@ -303,7 +306,7 @@
                if (tool.lifeWarn !== undefined && tool.lifeWarn !== null) {
                    // 格式化为百分比字符串
                    const warn = Number(tool.lifeWarn);
                    this.lifeWarnInput = warn <= 1 ? `${(warn * 100).toFixed(0)}%` : `${warn.toFixed(0)}%`;
                    this.lifeWarnInput = warn <= 1 ? (warn * 100).toFixed(0) : warn.toFixed(0);
                } else {
                    this.lifeWarnInput = '';
                }
@@ -570,7 +573,7 @@
                        // 新增:自动填充寿命比预警值
                        if (order.modlLifeWorning !== undefined && order.modlLifeWorning !== null) {
                            const warn = Number(order.modlLifeWorning);
                            this.lifeWarnInput = warn <= 1 ? `${(warn * 100).toFixed(0)}%` : `${warn.toFixed(0)}%`;
                            this.lifeWarnInput = warn <= 1 ? (warn * 100).toFixed(0) : warn.toFixed(0);
                        } else {
                            this.lifeWarnInput = '';
                        }
@@ -666,7 +669,7 @@
        /* 新增:小字体样式 */
        .input.small-font {
            font-size: 0.8vw; /* 调小字体 */
            font-size: 1vw; /* 调小字体 */
        }
    .form-select {
@@ -934,4 +937,24 @@
    .tool-desc {
        margin-top: 2vh;
    }
    .input-with-suffix {
        position: relative;
        display: flex;
        align-items: center;
    }
        .input-with-suffix .input {
            width: 10vw;
            margin-right: 8px;
            padding-right: 24px; /* 为后缀留出空间 */
        }
    .input-suffix {
        position: absolute;
        right: 16px; /* 调整到输入框内右侧 */
        color: #666;
        font-size: 0.9vw;
        pointer-events: none; /* 防止干扰输入 */
    }
</style>