111
Administrator
2025-11-06 67fcba3d227790dfc9e3a50e35be0cde821c58e3
components/mold.vue
@@ -49,81 +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>
                    <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>
@@ -819,12 +819,12 @@
        flex-shrink: 0;
    }
    .form-group .input {
        flex: 1;
        min-width: 300px;
        border-radius: 6px;
        background: #f8f8f8;
    }
        .form-group .input {
            flex: 1;
            min-width: 300px;
            border-radius: 6px;
            background: #f8f8f8;
        }
    .tool-list {
        display: flex;