快乐的昕的电脑
2025-11-18 085bd85263b3bed9fb97fbabd0af54fdfd5aec11
Revert "调试"

This reverts commit dc6741de2d3247e4d4870e42ebd8393c7c507494.
已修改1个文件
122 ■■■■ 文件已修改
pages/index.vue 122 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index.vue
@@ -553,42 +553,49 @@
                return str;
            },
            // 刀具绑定判断钩子 (优化版)
            hasBindedCutter() {
                const o = this.isShowTableData[0];
                if (!o) return false;
                return ['outToolId', 'outToolCode', 'outToolName'].some(k => {
                    const v = o[k];
                    return v !== undefined && v !== null && v.toString().trim() !== '';
                });
            },
                // 刀具绑定判断钩子
                hasBindedCutter() {
                    const currentOrder = this.isShowTableData[0];
                    return (
                        currentOrder &&
                        (
                            (currentOrder.outToolId && currentOrder.outToolId.toString().trim() !== '') ||
                            (currentOrder.outToolCode && currentOrder.outToolCode.trim() !== '') ||
                            (currentOrder.outToolName && currentOrder.outToolName.trim() !== '')
                        )
                    );
                },
            cancel() {
                if (!this.machineNo) return;
                if (this.hasBindedCutter()) {
                    uni.showToast({
                        title: '当前工单已绑定刀具,不能清空重选',
                        icon: 'error',
                        duration: 2000
                    });
                    return;
                }
                let editDate = this.formatDate(new Date());
                this.selectedIndexs = [];
                this.$post({
                    url: "/MesOrderSelect/Remove",
                    data: {
                        machineNo: this.machineNo,
                        editDate: editDate
                    },
                }).then(res => {
                    if (res.data.tbBillList > 0) {
                        this.isShowTableData = [];
                cancel() {
                    if (!this.machineNo) {
                        return;
                    }
                });
            },
                    // 使用钩子判断
                    if (this.hasBindedCutter()) {
                        uni.showToast({
                            title: '当前工单已绑定刀具,不能清空重选',
                            icon: 'error',
                            duration: 2000
                        });
                        return;
                    }
                    let editDate = this.formatDate(new Date());
                    this.selectedIndexs = [];
                    this.$post({
                        url: "/MesOrderSelect/Remove",
                        data: {
                            machineNo: this.machineNo,
                            editDate: editDate
                        },
                    }).then(res => {
                        if (res.data.tbBillList > 0) {
                            this.isShowTableData = [];
                        }
                    });
                },
            formatDate(date) {
                let year = date.getFullYear(); // 获取年份
@@ -645,37 +652,22 @@
                })
            },
            //获取表格的数据源
            getWomdaaIsShow() {
                this.$post({
                    url: "/Womdaa/GetWomdaasByShow",
                    data: {
                        machineNo: this.machineNo,
                    }
                }).then(res => {
                    let list = res.data.tbBillList || [];
                    // 归一化刀具字段
                    this.isShowTableData = list.map(row => {
                        return {
                            ...row,
                            outToolId: row.outToolId ?? row.out_tool_id ?? row.outToolID ?? row.toolId ?? row.ToolId,
                            outToolCode: row.outToolCode ?? row.out_tool_code ?? row.toolCode ?? row.ToolCode,
                            outToolName: row.outToolName ?? row.out_tool_name ?? row.toolName ?? row.ToolName,
                        };
                    });
                    if (this.isShowTableData.length > 0) {
                        console.log("工单首条完整数据:", JSON.stringify(this.isShowTableData[0]));
                        console.log("刀具字段:",
                            this.isShowTableData[0].outToolId,
                            this.isShowTableData[0].outToolCode,
                            this.isShowTableData[0].outToolName
                        );
                    }
                    if (this.isShowTableData.length === 1) {
                        uni.setStorageSync('daa001', this.isShowTableData[0].daa001);
                        uni.setStorageSync('id', this.isShowTableData[0].id);
                    }
                });
            },
            getWomdaaIsShow() {
                this.$post({
                    url: "/Womdaa/GetWomdaasByShow",
                    data: {
                        machineNo: this.machineNo,
                    }
                }).then(res => {
                    this.isShowTableData = res.data.tbBillList;
                    if (this.isShowTableData.length == 1) {
                        uni.setStorageSync('daa001', this.isShowTableData[0].daa001);
                        uni.setStorageSync('id', this.isShowTableData[0].id);
                        //this.toDetail(this.isShowTableData[0]);
                    }
                });
            },
            isShowTab() {
                if (this.isShowTableData.length > 0) {