快乐的昕的电脑
2025-11-18 df96fbfdd4faf7379d6caffa59ca3c24adfcb1a6
调试
已修改1个文件
78 ■■■■■ 文件已修改
pages/index.vue 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index.vue
@@ -552,43 +552,51 @@
                }
                return str;
            },
            cancel() {
                if (!this.machineNo) {
                    return;
                }
            methods: {
                // 刀具绑定判断钩子
                hasBindedCutter() {
                    const currentOrder = this.isShowTableData[0];
                    return (
                        currentOrder &&
                        (
                            (currentOrder.outToolId && currentOrder.outToolId.toString().trim() !== '') ||
                            (currentOrder.outToolCode && currentOrder.outToolCode.trim() !== '') ||
                            (currentOrder.outToolName && currentOrder.outToolName.trim() !== '')
                        )
                    );
                },
                const currentOrder = this.isShowTableData[0];
                if (
                    currentOrder &&
                    (
                        (currentOrder.outToolId && currentOrder.outToolId.toString().trim() !== '') ||
                        (currentOrder.outToolCode && currentOrder.outToolCode.trim() !== '') ||
                        (currentOrder.outToolName && currentOrder.outToolName.trim() !== '')
                    )
                ) {
                    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(); // 获取年份
                let month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份并补零