| | |
| | | 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() !== ''; |
| | | }); |
| | | }, |
| | | |
| | | cancel() { |
| | | if (!this.machineNo) return; |
| | | if (!this.machineNo) { |
| | | return; |
| | | } |
| | | |
| | | if (this.hasBindedCutter()) { |
| | | // 直接用 flag 判断 |
| | | if (this.hasBindedCutterFlag) { |
| | | uni.showToast({ |
| | | title: '当前工单已绑定刀具,不能清空重选', |
| | | icon: 'error', |
| | |
| | | |
| | | let editDate = this.formatDate(new Date()); |
| | | this.selectedIndexs = []; |
| | | |
| | | this.$post({ |
| | | url: "/MesOrderSelect/Remove", |
| | | 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 |
| | | ); |
| | | 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() !== ''); |
| | | } |
| | | if (this.isShowTableData.length === 1) { |
| | | // 存储到 data 变量 |
| | | this.hasBindedCutterFlag = hasBindedCutter; |
| | | |
| | | if (this.isShowTableData.length == 1) { |
| | | uni.setStorageSync('daa001', this.isShowTableData[0].daa001); |
| | | uni.setStorageSync('id', this.isShowTableData[0].id); |
| | | } |
| | |
| | | |
| | | this.isShow = true; |
| | | // 默认选中“待开工” |
| | | this.engineeringNo = '待开工'; |
| | | this.engineeringNo = '待开工、未开工、暂停'; |
| | | this.tableData = []; |
| | | // 下拉框只显示工单状态 |
| | | this.engineeringNoMapList = ['待开工', '未开工', '开工', '暂停', '完工']; |
| | | // 下拉框只显示合并后的状态和其它状态 |
| | | this.engineeringNoMapList = [ |
| | | '待开工、未开工、暂停', |
| | | '开工', |
| | | '完工' |
| | | ]; |
| | | // 默认显示“待开工”工单 |
| | | this.getWomdaaByStatus(); |
| | | }, |
| | |
| | | // 按工单状态筛选工单 |
| | | getWomdaaByStatus() { |
| | | let editDate = this.formatDate(new Date()); |
| | | let statusArr = []; |
| | | if (this.engineeringNo === '待开工、未开工、暂停') { |
| | | statusArr = ['待开工', '未开工', '暂停']; |
| | | } else { |
| | | statusArr = [this.engineeringNo]; |
| | | } |
| | | this.$post({ |
| | | url: "/Womdaa/GetWomdaasByEngineeringNo", |
| | | data: { |
| | | machineNo: this.machineNo, |
| | | orderStatus: [this.engineeringNo], // 只传选中的状态 |
| | | orderStatus: statusArr, |
| | | editDate: editDate |
| | | } |
| | | }).then(res => { |
| | |
| | | } |
| | | } |
| | | |
| | | /* 放大 uni-table 的多选框(checkbox) */ |
| | | :deep(.uni-table .uni-checkbox-wrapper), |
| | | :deep(.uni-table .uni-checkbox-input) { |
| | | width: 48px !important; |
| | | height: 48px !important; |
| | | min-width: 48px !important; |
| | | min-height: 48px !important; |
| | | display: flex !important; |
| | | align-items: center !important; |
| | | justify-content: center !important; |
| | | box-sizing: border-box !important; |
| | | } |
| | | |
| | | /* 只对 input[type=checkbox] 放大,不要加 :deep() */ |
| | | .uni-table .uni-checkbox-input input[type="checkbox"] { |
| | | transform: scale(2.2) !important; |
| | | accent-color: #007aff !important; |
| | | cursor: pointer !important; |
| | | } |
| | | |
| | | /* 放大 uni-table 的多选框列宽 */ |
| | | :deep(.uni-table .uni-table-selection), |
| | | :deep(.uni-table th.is-selection), |
| | | :deep(.uni-table td.is-selection) { |
| | | width: 100px !important; |
| | | min-width: 100px !important; |
| | | max-width: 120px !important; |
| | | } |
| | | |
| | | /* 针对1280x800的平板使用媒体查询进行适配 */ |
| | | @media screen and (min-width: 1280px) and (max-width: 1920px) { |
| | | .right-side { |