| | |
| | | <el-select v-if="cableTagList.length > 0" v-model="currentTab" clearable placeholder="请选择" size="small" |
| | | @change="(m) => handleChangeCableTag(currentSample.id, 0, 'cableTag', m) |
| | | " @focus="getCableTag(currentSample.id)"> |
| | | <el-option v-for="item in cableTagList" :key="item.cableTag" :label="item.cableTag" :value="item.cableTag"> |
| | | <el-option v-for="(item, index) in cableTagList" :key="index" :label="item.cableTag" :value="item.cableTag"> |
| | | <span style="float: left">{{ item.cableTag }}</span> |
| | | <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" |
| | | type="danger">未检</el-tag> |
| | |
| | | size="small" @change="(m) => |
| | | handleChangeCableTag(currentSample.id, 0, 'repetitionTag', m) |
| | | " @focus="getRepetitionTag(currentSample.id)"> |
| | | <el-option v-for="item in repetitionTagList" :key="item.repetitionTag" :label="item.radius" |
| | | <el-option v-for="(item, index) in repetitionTagList" :key="index" :label="item.radius" |
| | | :value="item.repetitionTag"> |
| | | <span style="float: left">{{ item.radius }}</span> |
| | | <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" |
| | |
| | | <span v-if="typeSource == '1'"> 待检验数量:</span> |
| | | <el-select v-if="typeSource == '1'" v-model="rawMaterialTag" placeholder="请选择" size="small" @change="(m) => handleChangeCableTag(currentSample.id, 4, 'cableTag', m) |
| | | " @focus="getRawMaterialTag(currentSample.id)"> |
| | | <el-option v-for="item in rawMaterialTagList" :key="item.rawMaterialTag" :label="item.rawMaterialTag" |
| | | <el-option v-for="(item, index) in rawMaterialTagList" :key="index" :label="item.rawMaterialTag" |
| | | :value="item.rawMaterialTag"> |
| | | <span style="float: left">{{ item.rawMaterialTag }}</span> |
| | | <el-tag v-if="item.status == 0" size="small" style="float: right; margin-top: 5px" |
| | |
| | | result: null, |
| | | worker: null, |
| | | worker0: null, |
| | | // 检验值按触发顺序串行保存,避免同一检验项的旧请求覆盖新请求。 |
| | | saveQueue: null, |
| | | wareLength: [], |
| | | dataAcquisitionInfo: {}, |
| | | dataAcquisitionInfoNew: {}, |
| | |
| | | }, |
| | | }, |
| | | created() { |
| | | this.saveQueue = Promise.resolve(); |
| | | let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } = |
| | | this.$route.query; |
| | | this.sonLaboratory = sonLaboratory; |
| | |
| | | this.refreshView() |
| | | }, |
| | | // 监听当前模板变化 |
| | | currentTable(val1, val0) { |
| | | async currentTable(val1, val0) { |
| | | if (val0 != null && val1 != val0) { |
| | | await this.waitForPendingSaves(); |
| | | if (this.changeType && this.changeType > 0) { |
| | | // 如果是光纤、光纤带,则不执行下面操作 |
| | | return; |
| | |
| | | this.checkUser = ""; |
| | | }, |
| | | // 刷新页面 |
| | | refreshView() { |
| | | async refreshView() { |
| | | await this.waitForPendingSaves(); |
| | | this.loading = true; |
| | | doInsOrder({ |
| | | id: this.id, |
| | |
| | | }, |
| | | // 切换样品 |
| | | async handleChangeSample(row, column, event) { |
| | | await this.waitForPendingSaves(); |
| | | // 初始化数据 |
| | | this.param = {}; |
| | | this.sampleVisible = false; |
| | |
| | | currentInsItem: n, |
| | | }) |
| | | ); |
| | | // 先保存主线程中已经输入的原始值。Worker 完成计算后会再次入队保存计算结果。 |
| | | // 这样即使用户输入后立即刷新、切换或返回,最后编辑的单元格也不会丢失。 |
| | | if (currentInsItemId) { |
| | | this.saveInsContext(currentInsItemId); |
| | | } |
| | | } catch (error) { |
| | | console.log(444, error); |
| | | } |
| | | |
| | | // 监听 Worker 返回的结果 |
| | | this.worker.onmessage = (event) => { |
| | | this.result = JSON.parse(event.data); |
| | | switch (this.result.method) { |
| | | const workerResult = JSON.parse(event.data); |
| | | this.result = workerResult; |
| | | switch (workerResult.method) { |
| | | case "saveInsContext": |
| | | this.$nextTick(() => { |
| | | const resultValue = workerResult.value; |
| | | // this.$delete(this.tableList[0],'arr') |
| | | this.$set( |
| | | this.tableList[0], |
| | | "arr", |
| | | this.result.value.tableList[0].arr |
| | | resultValue.tableList[0].arr |
| | | ); |
| | | this.param = this.result.value.param; |
| | | if (this.result.value.currentInsItemId) { |
| | | currentInsItemId = this.result.value.currentInsItemId; |
| | | } |
| | | this.param = resultValue.param; |
| | | // 特殊处理一下结论,会有这种特殊情况 |
| | | for (var i in this.param) { |
| | | if ( |
| | |
| | | } |
| | | } |
| | | } |
| | | this.saveInsContext(currentInsItemId); |
| | | const sourceInsItemId = |
| | | resultValue.sourceInsItemId != null && |
| | | resultValue.sourceInsItemId !== "" |
| | | ? resultValue.sourceInsItemId |
| | | : currentInsItemId; |
| | | this.saveInsContext([ |
| | | sourceInsItemId, |
| | | resultValue.currentInsItemId, |
| | | ]); |
| | | }); |
| | | break; |
| | | case "tableList": |
| | | this.$nextTick(() => { |
| | | // 更新数据 |
| | | this.$delete(this.tableList[0], "arr"); |
| | | this.$set(this.tableList[0], "arr", this.result.value[0].arr); |
| | | this.$set(this.tableList[0], "arr", workerResult.value[0].arr); |
| | | // this.param = this.result.value.param |
| | | if (this.result.value.currentInsItem) { |
| | | currentInsItemId = this.result.value.currentInsItem.i; |
| | | } |
| | | }); |
| | | break; |
| | | case "getCurrentInsProduct": |
| | | // 更新页面数据 |
| | | this.getCurrentInsProduct(this.result.value); |
| | | this.getCurrentInsProduct(workerResult.value); |
| | | break; |
| | | } |
| | | }; |
| | |
| | | this.submitLoading = false; |
| | | }); |
| | | }, |
| | | submit() { |
| | | async submit() { |
| | | if (this.verifyUser === null || this.verifyUser === "") { |
| | | this.$message.error("请指定复核人员"); |
| | | return; |
| | |
| | | this.$message.error("请填写IFS库存物料批次属性"); |
| | | return; |
| | | } |
| | | await this.waitForPendingSaves(); |
| | | this.submitLoading = true; |
| | | checkSubmitPlan({ |
| | | orderId: this.orderId, |
| | |
| | | return; |
| | | }, |
| | | // 统一在这里保存数据 |
| | | saveInsContext(currentInsItemId) { |
| | | saveInsContext(currentInsItemIds) { |
| | | try { |
| | | if (this.param) { |
| | | let param = null; |
| | | if (currentInsItemId) { |
| | | param = { [currentInsItemId]: this.param[currentInsItemId] }; |
| | | } else { |
| | | param = this.param; |
| | | const ids = (Array.isArray(currentInsItemIds) |
| | | ? currentInsItemIds |
| | | : [currentInsItemIds] |
| | | ) |
| | | .filter((id) => id != null && id !== "") |
| | | .map((id) => String(id)); |
| | | let param = this.param; |
| | | if (ids.length > 0) { |
| | | param = {}; |
| | | [...new Set(ids)].forEach((id) => { |
| | | if (this.param[id]) { |
| | | param[id] = this.param[id]; |
| | | } |
| | | }); |
| | | if (Object.keys(param).length === 0) { |
| | | return; |
| | | } |
| | | } |
| | | let isNoTestValue = '' |
| | | for (let key in param) { |
| | |
| | | } |
| | | } |
| | | } |
| | | saveInsContext({ |
| | | const payload = { |
| | | param: JSON.stringify(param), |
| | | currentTable: this.currentTable, |
| | | sampleId: this.currentSample.id, |
| | | orderId: this.orderId, |
| | | sonLaboratory: this.sonLaboratory, |
| | | isNoTestValue: isNoTestValue |
| | | }).then((res) => { |
| | | }; |
| | | const previousSave = this.saveQueue || Promise.resolve(); |
| | | this.saveQueue = previousSave |
| | | .catch(() => undefined) |
| | | .then(() => saveInsContext(payload)) |
| | | .then(() => { |
| | | this.$message.success("已保存"); |
| | | }) |
| | | .catch((error) => { |
| | | console.error("检验数据保存失败", error); |
| | | this.$message.error("检验数据保存失败,请重试"); |
| | | }); |
| | | // 向 Worker 发送消息,开始处理逻辑 |
| | | this.worker.postMessage( |
| | |
| | | } |
| | | } catch (error) { |
| | | console.log(999, error); |
| | | } |
| | | }, |
| | | async waitForPendingSaves() { |
| | | if (this.saveQueue) { |
| | | await this.saveQueue; |
| | | } |
| | | }, |
| | | // 设备改变 |
| | |
| | | return v; |
| | | } |
| | | }, |
| | | goback() { |
| | | async goback() { |
| | | await this.waitForPendingSaves(); |
| | | this.$router.go(-1) |
| | | } |
| | | }, |