| | |
| | | return str; |
| | | }, |
| | | |
| | | // 刀具绑定判断钩子 |
| | | 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()) { |
| | | // 直接用 flag 判断 |
| | | if (this.hasBindedCutterFlag) { |
| | | uni.showToast({ |
| | | title: '当前工单已绑定刀具,不能清空重选', |
| | | icon: 'error', |
| | |
| | | }).then(res => { |
| | | this.isShowTableData = res.data.tbBillList; |
| | | |
| | | // 只判断第一条(只允许一条工单) |
| | | const order = this.isShowTableData[0]; |
| | | let hasBindedCutter = false; |
| | | if (order) { |
| | | hasBindedCutter = |
| | | (order.outToolId && order.outToolId.toString().trim() !== '') || |
| | | (order.outToolCode && order.outToolCode.trim() !== '') || |
| | | (order.outToolName && order.outToolName.trim() !== ''); |
| | | } |
| | | // 存储到 data 变量 |
| | | this.hasBindedCutterFlag = hasBindedCutter; |
| | | |
| | | if (this.isShowTableData.length == 1) { |
| | | uni.setStorageSync('daa001', this.isShowTableData[0].daa001); |
| | | uni.setStorageSync('id', this.isShowTableData[0].id); |
| | | //this.toDetail(this.isShowTableData[0]); |
| | | } |
| | | }); |
| | | }, |