| | |
| | | <view class="page"> |
| | | <!-- 刀具选择区 --> |
| | | <view class="top-section-grid"> |
| | | <!-- 第一行 --> |
| | | <!-- 第一行:移除刀具目录按钮 --> |
| | | <view class="form-row"> |
| | | <view class="form-cell"> |
| | | <label class="form-label">刀具编号:</label> |
| | | <input class="input small-font" v-model="selectedToolNo" placeholder="请通过刀具目录选择" disabled /> |
| | | <button class="btn-blue" @click="openToolDialog" :disabled="loadingTools">刀具目录</button> |
| | | <!-- 移除的按钮位置 --> |
| | | </view> |
| | | <view class="form-cell"> |
| | | <label class="form-label">设置使用上限:</label> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 第二行 --> |
| | | <!-- 第二行:在最后添加刀具目录按钮 --> |
| | | <view class="form-row"> |
| | | <view class="form-cell"> |
| | | <label class="form-label">刀具名称:</label> |
| | |
| | | <label class="form-label">规格型号:</label> |
| | | <input class="input small-font" v-model="toolModel" placeholder="刀具带出" disabled /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 操作按钮 --> |
| | | <view class="button-row"> |
| | | <button class="save-btn" @click="handleUpTool" :disabled="submitting || loadingForm">上刀提交</button> |
| | | <button class="save-btn" @click="handleDownTool" :disabled="submitting || loadingForm">下刀提交</button> |
| | | <button class="cancel-btn" @click="cancel" :disabled="submitting || loadingForm">取消</button> |
| | | </view> |
| | | |
| | | <!-- 刀具目录弹窗 --> |
| | | <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 class="form-cell"> |
| | | <button class="btn-blue large-btn" @click="openToolDialog" :disabled="loadingTools">刀具目录</button> |
| | | </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> |
| | | </view> |
| | | <!-- 操作按钮 --> |
| | | <view class="button-row"> |
| | | <button class="save-btn" @click="handleUpTool" :disabled="submitting || loadingForm">上刀提交</button> |
| | | <button class="save-btn" @click="handleDownTool" :disabled="submitting || loadingForm">下刀提交</button> |
| | | <button class="cancel-btn" @click="cancel" :disabled="submitting || loadingForm">取消</button> |
| | | </view> |
| | | |
| | | <!-- 说明 --> |
| | | <!--<view class="tool-desc"> |
| | | <!-- 刀具目录弹窗 --> |
| | | <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> |
| | | </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> |
| | | </view> |
| | | |
| | | <!-- 说明 --> |
| | | <!--<view class="tool-desc"> |
| | | <p style="color:red;">'使用上限'以下刀时的'使用上限'为计算标准</p> |
| | | <p style="color:red;">寿命比预警值默认为90%</p> |
| | | </view>--> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | |
| | | /* 新增大按钮样式 */ |
| | | .btn-blue.large-btn { |
| | | padding: 12px 24px; |
| | | font-size: 18px; |
| | | height: 44px; |
| | | min-width: 120px; |
| | | } |
| | | |
| | | /* 调整表单单元格布局以适应大按钮 */ |
| | | .form-cell:last-child { |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | </style> |