BUG
快乐的昕的电脑
2025-11-13 98715dc8cb012d10dd4a9ff798e7ba8049c26722
components/mold.vue
@@ -10,12 +10,12 @@
                </view>
                <view class="form-cell">
                    <label class="form-label">设置使用上限:</label>
                    <input class="input small-font" type="number" v-model="useLimitInput" placeholder="每次换刀后手填" :disabled="!selectedToolNo || loadingForm" />
                    <input class="input small-font input-use-limit" 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"
                        <input class="input small-font input-life-warn"
                               v-model="lifeWarnInput"
                               placeholder="如0.9或90"
                               :disabled="!selectedToolNo || loadingForm" />
@@ -26,13 +26,15 @@
            <!-- 第二行:在最后添加刀具目录按钮 -->
            <view class="form-row">
                <!-- 刀具名称 -->
                <view class="form-cell">
                    <label class="form-label">刀具名称:</label>
                    <input class="input small-font" v-model="toolName" placeholder="刀具带出" disabled />
                    <input class="input small-font input-tool-name" 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 />
                    <input class="input small-font input-tool-model" v-model="toolModel" placeholder="刀具带出" disabled />
                </view>
                <!-- 新增的刀具目录按钮 -->
                <view class="form-cell">
@@ -49,81 +51,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>
                    <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 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>
        <!-- 刀具使用记录表格 -->
        <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;">寿命比预警值默认为90%</p>
    </view>-->
        <!-- 说明 -->
        <!--<view class="tool-desc">
            <p style="color:red;">'使用上限'以下刀时的'使用上限'为计算标准</p>
            <p style="color:red;">寿命比预警值默认为90%</p>
        </view>-->
    </view>
</template>
@@ -660,6 +662,7 @@
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
        font-size: 22px; /* 整体调大表单区字体 */
    }
    /* 表单行样式优化 */
@@ -686,7 +689,7 @@
    .form-label {
        width: 100px;
        font-weight: bold;
        font-size: 18px;
        font-size: 22px; /* 原18px,调大 */
        color: #333;
        white-space: nowrap;
        margin-right: 8px;
@@ -695,7 +698,7 @@
    .input {
        padding: 8px 12px;
        font-size: 16px;
        font-size: 20px; /* 原16px,调大 */
        border: 1px solid #dcdfe6;
        flex: 1;
        margin-right: 0;
@@ -707,7 +710,7 @@
    }
        .input.small-font {
            font-size: 15px;
            font-size: 19px; /* 原15px,调大 */
        }
        .input:disabled {
@@ -723,10 +726,10 @@
        padding: 8px 16px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 16px;
        font-size: 22px; /* 原16px,调大 */
        font-weight: 500;
        white-space: nowrap;
        height: 36px;
        height: 60px;
        box-sizing: border-box;
        transition: all 0.3s;
        flex-shrink: 0;
@@ -758,7 +761,7 @@
        padding: 1.5vh;
        background-color: #00A2E9;
        color: white;
        font-size: 1.2vw;
        font-size: 1.6vw; /* 原1.2vw,调大 */
        border: none;
        text-align: center;
        border-radius: 6px;
@@ -801,42 +804,58 @@
        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 .input {
        width: 24vw;
        border-radius: 6px;
        background: #f8f8f8;
    .form-group {
        display: flex;
        gap: 12px;
        align-items: center;
        margin-bottom: 2vh;
        flex-shrink: 0;
    }
        .form-group .input {
            flex: 1;
            min-width: 300px;
            border-radius: 6px;
            background: #f8f8f8;
        }
    .tool-list {
        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%;
        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: 18px; /* 原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 {
@@ -849,10 +868,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 {
@@ -868,16 +888,23 @@
            align-items: center;
        }
        .dialog-actions .btn-blue {
            padding: 10px 24px;
            font-size: 22px; /* 原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: 22px; /* 原16px,调大 */
        font-weight: 500;
        cursor: not-allowed;
        box-shadow: none;
        min-width: 100px;
    }
    /* 表格样式 */
@@ -906,14 +933,14 @@
            border-bottom: 2px solid #bfbfbf;
            padding: 16px 10px;
            font-weight: bold;
            font-size: 1.2vw;
            font-size: 1.6vw; /* 原1.2vw,调大 */
            text-align: center;
        }
        table.styled-table tbody td {
            border-bottom: 1px solid #e8e8e8;
            padding: 14px 10px;
            font-size: 1.1vw;
            font-size: 1.4vw; /* 原1.1vw,调大 */
            vertical-align: middle;
            text-align: center;
        }
@@ -961,7 +988,7 @@
        padding: 2px 6px;
        border-radius: 3px;
        font-weight: bold;
        font-size: 0.9vw;
        font-size: 1.2vw; /* 原0.9vw,调大 */
    }
    /* 带单位的输入框样式 */
@@ -978,7 +1005,7 @@
    .unit-text {
        color: #666;
        font-size: 14px;
        font-size: 18px; /* 原14px,调大 */
        white-space: nowrap;
        width: 20px;
    }
@@ -991,25 +1018,25 @@
        .form-label {
            width: 90px;
            font-size: 16px;
            font-size: 18px; /* 原16px,调大 */
        }
        .input {
            font-size: 14px;
            font-size: 17px; /* 原14px,调大 */
            padding: 6px 10px;
        }
        .btn-blue {
            padding: 6px 12px;
            font-size: 14px;
            font-size: 18px; /* 原14px,调大 */
        }
    }
    /* 新增大按钮样式 */
    .btn-blue.large-btn {
        padding: 8px 24px;
        font-size: 16px;
        height: 36px;
        font-size: 22px; /* 原16px,调大 */
        height: 60px;
        min-width: 100px;
    }
@@ -1020,4 +1047,41 @@
        min-width: 120px;
    }
    /* 新增:让“设置使用上限”“寿命比预警值”输入框变窄 */
    .input-use-limit {
        width: 80px !important;
        min-width: 0 !important;
        margin-right: 10px;
    }
    .input-life-warn {
        width: 80px !important;
        min-width: 0 !important;
        margin-right: 4px;
    }
    .input-use-limit {
        width: 60px !important;
        min-width: 0 !important;
        margin-right: 10px;
    }
    .input-tool-model {
        width: 60px !important;
        min-width: 0 !important;
        margin-right: 10px;
    }
    .input-tool-name {
        width: 80px !important;
        min-width: 0 !important;
        margin-right: 10px;
    }
    .input-tool-model {
        width: 80px !important;
        min-width: 0 !important;
        margin-right: 10px;
    }
</style>