diff --git a/src/views/collect/relCode/operateRelCode.vue b/src/views/collect/relCode/operateRelCode.vue index 85c84557..e9ad289d 100644 --- a/src/views/collect/relCode/operateRelCode.vue +++ b/src/views/collect/relCode/operateRelCode.vue @@ -16,10 +16,10 @@ style="margin-right: 8px;border-radius: 5%;" >放弃 - 保存 - + + + + 提交 @@ -99,7 +99,7 @@ v-model="relFormData.batchNo" auto-complete="off" style="width: 90%" - :disabled="this.parentCode" + :disabled="this.parentCode && this.detailList.length > 0" clearable > @@ -113,7 +113,7 @@ clearable value-format="yyyy-MM-dd HH:mm:ss" style="width: 90%" - :disabled="this.parentCode" + :disabled="this.parentCode && this.detailList.length > 0" > @@ -127,7 +127,7 @@ clearable value-format="yyyy-MM-dd HH:mm:ss" style="width: 90%" - :disabled="this.parentCode" + :disabled="this.parentCode && this.detailList.length > 0" > @@ -140,7 +140,7 @@ clearable style="width: 90%" placeholder="请输入备注" - :disabled="this.parentCode" + :disabled="this.parentCode && this.detailList.length > 0" > @@ -383,20 +383,21 @@ }, //添加条码 addCode() { - //控制三期 - if (this.relFormData.batchNo == null) { - this.$message.warning("请输入批次号!"); - return; - } - if (this.relFormData.madeDate == null) { - this.$message.warning("请选择生产日期!"); - return; - } - if (this.relFormData.validateDate == null) { - this.$message.warning("请选择失效日期!"); - return; + if (this.parentCode != null) { + //控制三期 + if (this.relFormData.batchNo == null) { + this.$message.warning("请输入批次号!"); + return; + } + if (this.relFormData.madeDate == null) { + this.$message.warning("请选择生产日期!"); + return; + } + if (this.relFormData.validateDate == null) { + this.$message.warning("请选择失效日期!"); + return; + } } - let tQuery = Object.assign(this.codeFormData); tQuery.curCode = this.codeFormData.code; tQuery.parentCode = this.parentCode; @@ -440,7 +441,6 @@ return; } } - //判断是否是下级 if(data.packLayer == this.relFormData.packLayer) { //非当前编码的子层级码 是否进行替换操作 @@ -496,7 +496,6 @@ this.title = "手工关联:" + data.curCode; this.popParentCode = data.curCode; }else { - if( this.bhxjsl === this.syxjsl){ this.$confirm("该层级已录入完成, 是否关闭?", "提示", { confirmButtonText: "确定", @@ -568,25 +567,54 @@ this.$message.warning("请选择失效日期!"); return; } - this.loading = true; + this.$set(this.relFormData, 'detailList', []); this.detailList.forEach( item =>{ this.relFormData.detailList.push(item) }); - addRelCode(this.relFormData).then((response) => { - this.loading = false; - if (response.code === 20000) { - this.$message.success("保存成功!"); + + //增加数量是否完全判断 + if( this.bhxjsl != this.syxjsl){ + this.$confirm("该层级已录入数量与应录入数量不符, 是否继续提交?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.loading = true; + addRelCode(this.relFormData).then((response) => { + this.loading = false; + if (response.code === 20000) { + this.$message.success("保存成功!"); + this.clearRel(); + } else { + this.$message.error(response.message); + } + }) + .catch(() => { + this.loading = false; + this.clearRel(); + }); + }) + .catch(() => { + }); + }else { + this.loading = true; + addRelCode(this.relFormData).then((response) => { + this.loading = false; + if (response.code === 20000) { + this.$message.success("保存成功!"); + this.clearRel(); + } else { + this.$message.error(response.message); + } + }).catch(() => { + this.loading = false; this.clearRel(); - } else { - this.$message.error(response.message); - } - }) - .catch(() => { - this.loading = false; - this.clearRel(); - }); + }); + } + }, // 刷新表单 diff --git a/src/views/collect/relCode/sonRelCode.vue b/src/views/collect/relCode/sonRelCode.vue index 8c3ee72e..84a52b9f 100644 --- a/src/views/collect/relCode/sonRelCode.vue +++ b/src/views/collect/relCode/sonRelCode.vue @@ -16,10 +16,10 @@ style="margin-right: 8px;border-radius: 5%;" >放弃 - 保存 - + + + + 提交 @@ -455,21 +455,68 @@ this.warnVisible = false; this.errVisible = false; }, - + giveUp() { + this.relFormData = { + productCode: null, + subTypeNo: null, + cascadeRatio: null, + packageSpec: null, + comment: null, + batchNo: null, + madeDate: null, + validateDate: null, + workShop: null, + lineName: null, + lineManager: null, + packUnit: null, + bhxjsl: null, + detailList: [] + } + this.detailList = [] + this.parentCode = null + this.bhxjsl = 0 + this.syxjsl = 0 + this.packLayer = null + }, submit() { - addRelCode(this.relFormData).then((response) => { - this.loading = false; - if (response.code === 20000) { - this.$message.success("保存成功!"); - this.clearRel(); - } else { - this.$message.error(response.message); - } - }) - .catch(() => { - this.loading = false; - this.clearRel(); - }); + //增加数量是否完全判断 + if( this.bhxjsl != this.syxjsl){ + this.$confirm("该层级已录入数量与应录入数量不符, 是否继续提交?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + addRelCode(this.relFormData).then((response) => { + this.loading = false; + if (response.code === 20000) { + this.$message.success("保存成功!"); + this.clearRel(); + } else { + this.$message.error(response.message); + } + }) + .catch(() => { + this.loading = false; + this.clearRel(); + }); + }) + .catch(() => { + }); + }else { + addRelCode(this.relFormData).then((response) => { + this.loading = false; + if (response.code === 20000) { + this.$message.success("保存成功!"); + this.clearRel(); + } else { + this.$message.error(response.message); + } + }).catch(() => { + this.loading = false; + this.clearRel(); + }); + } }, // 刷新表单