| | |
| | | /> |
| | | <div style="margin-top: 4px; font-size: 12px; word-break: break-all;">{{ item.barcode }}</div> |
| | | </div> |
| | | <span slot="reference" style="cursor: pointer; color: #409EFF;">{{ item.barcode }}</span> |
| | | <span slot="reference" @click.stop="handleBarcodeClick(item)" style="cursor: pointer; color: #409EFF;">{{ item.barcode }}</span> |
| | | </el-popover> |
| | | <span v-else>-</span> |
| | | <span v-else @click.stop="handleBarcodeClick(item)" style="cursor: pointer; color: #409EFF;">-</span> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="重量">{{ item.weight }}</el-descriptions-item> |
| | | <el-descriptions-item label="故障代码">{{ item.error }}</el-descriptions-item> |
| | |
| | | } |
| | | } |
| | | }, |
| | | handleBarcodeClick(item) { |
| | | if (this.readOnly || !item || item.stationId == null) { |
| | | return; |
| | | } |
| | | |
| | | let that = this; |
| | | $.ajax({ |
| | | url: baseUrl + "/openapi/getFakeSystemRunStatus", |
| | | headers: { |
| | | token: localStorage.getItem("token"), |
| | | }, |
| | | method: "get", |
| | | success: (res) => { |
| | | if (res.code !== 200 || !res.data || !res.data.isFake || !res.data.running) { |
| | | that.$message({ |
| | | message: "仅仿真模式运行中可修改条码", |
| | | type: "warning", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | that.$prompt("请输入新的条码值(可留空清空)", "修改条码", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | inputValue: item.barcode || "", |
| | | inputPlaceholder: "请输入条码", |
| | | }).then(({ value }) => { |
| | | that.updateStationBarcode(item.stationId, value == null ? "" : String(value).trim()); |
| | | }).catch(() => {}); |
| | | }, |
| | | }); |
| | | }, |
| | | updateStationBarcode(stationId, barcode) { |
| | | let that = this; |
| | | $.ajax({ |
| | | url: baseUrl + "/station/command/barcode", |
| | | headers: { |
| | | token: localStorage.getItem("token"), |
| | | }, |
| | | contentType: "application/json", |
| | | method: "post", |
| | | data: JSON.stringify({ |
| | | stationId: stationId, |
| | | barcode: barcode, |
| | | }), |
| | | success: (res) => { |
| | | if (res.code == 200) { |
| | | that.syncLocalBarcode(stationId, barcode); |
| | | that.$message({ |
| | | message: "条码修改成功", |
| | | type: "success", |
| | | }); |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg || "条码修改失败", |
| | | type: "warning", |
| | | }); |
| | | } |
| | | }, |
| | | }); |
| | | }, |
| | | syncLocalBarcode(stationId, barcode) { |
| | | let updateFn = (list) => { |
| | | if (!list || list.length === 0) { |
| | | return; |
| | | } |
| | | list.forEach((row) => { |
| | | if (row.stationId == stationId) { |
| | | row.barcode = barcode; |
| | | } |
| | | }); |
| | | }; |
| | | updateFn(this.stationList); |
| | | updateFn(this.fullStationList); |
| | | }, |
| | | openControl() { |
| | | this.showControl = !this.showControl; |
| | | }, |