| | |
| | | return `${Number(n).toFixed(0)}%`; |
| | | }; |
| | | |
| | | // 获取工单 currentCjNum |
| | | this.workOrderCurrentCjNum = res.data?.currentCjNum ?? null; |
| | | |
| | | const mapped = (list || []).map(t => { |
| | | const upTimeRaw = getField(t, 'uP_TIME', 'UP_TIME', 'uPTime', 'UPTIME', 'UpTime'); |
| | | const downTimeRaw = getField(t, 'dowN_TIME', 'DOWN_TIME', 'downTime', 'DOWNTIME'); |
| | | const lifeWarnRaw = getField(t, 'lifE_WARN', 'LIFE_WARN', 'lifeWarn', 'LIFEWARN'); |
| | | const currentCjNum = getField(t, 'currentCjNum', 'CURRENTCJNUM', 'currentcjnum'); |
| | | const currentCjNum = getField(t, 'currentCjNum', 'CURRENTCJNUM', 'CurrentCjNum'); |
| | | |
| | | const useCount = getField(t, 'usE_COUNT', 'USE_COUNT', 'useCount'); |
| | | const useLimit = getField(t, 'usE_LIMIT', 'USE_LIMIT', 'useLimit'); |
| | |
| | | this.loadingForm = false; |
| | | } |
| | | }, |
| | | async fetchDefaultToolFromWorkOrder() { |
| | | if (!this.machineNo) return; |
| | | try { |
| | | const res = await this.$post({ |
| | | url: '/Womdaa/GetWomdaasByShow', |
| | | data: JSON.stringify({ machineNo: this.machineNo }), |
| | | headers: { 'Content-Type': 'application/json' } |
| | | }); |
| | | if (res.status === 0 && Array.isArray(res.data?.tbBillList) && res.data.tbBillList.length > 0) { |
| | | const order = res.data.tbBillList[0]; |
| | | this.selectedToolNo = order.cutterId || order.cutteR_ID || ''; |
| | | this.toolName = order.cutterName || order.cutteR_NAME || ''; |
| | | this.toolModel = order.cutterModel || order.cutteR_MODEL || ''; |
| | | // 关键:获取工单最新采集数 |
| | | this.workOrderCurrentCjNum = order.CurrentCjNum ?? order.currentCjNum ?? null; |
| | | } else { |
| | | this.workOrderCurrentCjNum = null; |
| | | } |
| | | } catch (e) { |
| | | console.warn('自动带出工单刀具失败', e); |
| | | this.workOrderCurrentCjNum = null; |
| | | } |
| | | }, |
| | | // 自动带出工单刀具信息,并获取工单最新采集数 |
| | | async fetchDefaultToolFromWorkOrder() { |
| | | if (!this.machineNo) return; |
| | | try { |
| | | const res = await this.$post({ |
| | | url: '/Womdaa/GetWomdaasByShow', |
| | | data: JSON.stringify({ machineNo: this.machineNo }), |
| | | headers: { 'Content-Type': 'application/json' } |
| | | }); |
| | | if (res.status === 0 && Array.isArray(res.data?.tbBillList) && res.data.tbBillList.length > 0) { |
| | | const order = res.data.tbBillList[0]; |
| | | this.selectedToolNo = order.cutterId || order.cutteR_ID || ''; |
| | | this.toolName = order.cutterName || order.cutteR_NAME || ''; |
| | | this.toolModel = order.cutterModel || order.cutteR_MODEL || ''; |
| | | // 关键:获取工单最新采集数 |
| | | this.workOrderCurrentCjNum = order.CurrentCjNum ?? order.currentCjNum ?? null; |
| | | } else { |
| | | this.workOrderCurrentCjNum = null; |
| | | } |
| | | } catch (e) { |
| | | console.warn('自动带出工单刀具失败', e); |
| | | this.workOrderCurrentCjNum = null; |
| | | } |
| | | }, |
| | | formatDateTime(dateTimeStr) { |
| | | if (!dateTimeStr) return ''; |
| | | try { |