快乐的昕的电脑
18 小时以前 c8e4ab6026d3c131734727acd633d1347dfdf860
components/mold.vue
@@ -48,7 +48,7 @@
        <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>
            <button class="cancel-btn" @click="cancel" :disabled="submitting || loadingForm">清空刀具选择</button>
        </view>
        <!-- 刀具目录弹窗 -->
@@ -86,18 +86,18 @@
            <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>
                        <th style="width:8%">刀具在机状态</th>
                        <th style="width:7%">刀具编号</th>
                        <th style="width:12%">刀具名称</th>
                        <th style="width:10%">上刀时间</th>
                        <th class="num" style="width:7%">上刀计数</th>
                        <th style="width:10%">下刀时间</th>
                        <th class="num" style="width:7%">下刀计数</th>
                        <th class="num" style="width:7%">使用次数</th>
                        <th class="num" style="width:7%">使用上限</th>
                        <th class="num" style="width:7%">寿命比%</th>
                        <th class="num" style="width:7%">寿命比预警值</th>
                        <th style="width:7%">预警状态</th>
                        <th style="width:7%">刀具在机状态</th>
                    </tr>
                </thead>
                <tbody>
@@ -110,28 +110,44 @@
                        <!-- 只有第一行显示 currentCjNum,其它行显示 downCount -->
                        <td class="num">
                            <template v-if="idx === 0">
                                {{ item.currentCjNum != null ? item.currentCjNum : '' }}
                                <!-- 第一行:下机时不实时显示 currentCjNum,显示 downCount -->
                                <template v-if="!item.downTime">
                                    {{ item.currentCjNum != null ? item.currentCjNum : '' }}
                                </template>
                                <template v-else>
                                    {{ item.downCount != null ? item.downCount : '' }}
                                </template>
                            </template>
                            <template v-else>
                                {{ item.downCount != null ? item.downCount : '' }}
                            </template>
                        </td>
                        <!--<td class="num">{{ item.useCount != null ? item.useCount : '' }}</td>--><!--使用次数-->
                        <!--使用次数-->
                        <td class="num">
                            <template v-if="idx === 0">
                                <!-- 第一行实时计算使用次数 -->
                                {{item.currentCjNum != null && item.upCount != null ? (Number(item.currentCjNum) - Number(item.upCount)) : (item.useCount != null ? item.useCount : '') }}
                                <!-- 第一行实时计算使用次数,若为下机则不实时显示 -->
                                <template v-if="!item.downTime">
                                    {{item.currentCjNum != null && item.upCount != null ? (Number(item.currentCjNum) - Number(item.upCount)) : (item.useCount != null ? item.useCount : '') }}
                                </template>
                                <template v-else>
                                    {{ item.useCount != null ? item.useCount : '' }}
                                </template>
                            </template>
                            <template v-else>
                                {{ item.useCount != null ? item.useCount : '' }}
                            </template>
                        </td>
                        <td class="num">{{ item.useLimit != null ? item.useLimit : '' }}</td>
                        <!--<td class="num">{{ item.lifePercent }}</td>-->
                        <!--寿命比%-->
                        <td class="num">
                            <template v-if="idx === 0">
                                <!-- 第一行实时计算寿命比% -->
                                {{item.currentCjNum != null && item.upCount != null && item.useLimit != null && Number(item.useLimit) > 0 ? Math.round((Number(item.currentCjNum) - Number(item.upCount)) / Number(item.useLimit) * 100) + '%' : (item.lifePercent != null ? item.lifePercent : '') }}
                                <!-- 第一行实时计算寿命比%,若为下机则不实时显示 -->
                                <template v-if="!item.downTime">
                                    {{item.currentCjNum != null && item.upCount != null && item.useLimit != null && Number(item.useLimit) > 0 ? Math.round((Number(item.currentCjNum) - Number(item.upCount)) / Number(item.useLimit) * 100) + '%' : (item.lifePercent != null ? item.lifePercent : '') }}
                                </template>
                                <template v-else>
                                    {{ item.lifePercent != null ? item.lifePercent : '' }}
                                </template>
                            </template>
                            <template v-else>
                                {{ item.lifePercent }}
@@ -147,7 +163,7 @@
                        </td>
                    </tr>
                    <tr v-if="!toolRecords.length">
                        <td colspan="11">暂无数据</td>
                        <td colspan="12">暂无数据</td>
                    </tr>
                </tbody>
            </table>
@@ -209,7 +225,7 @@
            toolModel() { this.isDirty = true; }
        },
        methods: {
    //查询当前数采数,作为下刀计数实时显示
            //查询当前数采数,作为下刀计数实时显示
            async fetchCurrentCjNum(toolNo) {
                if (!this.machineNo) return null;
                try {
@@ -773,11 +789,12 @@
    .form-label {
        width: auto;
        font-weight: bold;
        font-weight: 500;
        color: #333;
        white-space: nowrap;
        margin-right: 4px;
        flex-shrink: 0;
        font-size: 22px;
    }
    .input {
@@ -790,6 +807,7 @@
        min-width: 0;
        height: 56px !important;
        box-sizing: border-box;
        font-size: 22px;
    }
        .input.small-font {
@@ -887,12 +905,15 @@
        color: white;
        border: none;
        text-align: center;
        border-radius: 6px;
        transition: background 0.2s;
        border-radius: 4px;
        transition: all 0.3s;
        font-size: 22px;
        font-weight: 500;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    .cancel-btn {
        background-color: #eee;
        background-color: #f5f5f5;
        color: #333;
    }
@@ -1013,6 +1034,7 @@
        .dialog-actions .btn-blue {
            padding: 10px 24px;
            min-width: 120px;
            font-size: 22px;
        }
    .btn-disabled {
@@ -1054,6 +1076,7 @@
            padding: 16px 10px;
            font-weight: bold;
            text-align: center;
            font-size: 22px;
        }
        table.styled-table tbody td {
@@ -1061,6 +1084,7 @@
            padding: 14px 10px;
            vertical-align: middle;
            text-align: center;
            font-size: 22px;
        }
    .table-section table th:first-child, .table-section table td:first-child {
@@ -1193,5 +1217,4 @@
        margin-right: 16px;
        flex: none !important; /* 关键:彻底禁止flex拉伸 */
    }
</style>