|
|
|
@ -1,16 +1,14 @@ |
|
|
|
<!-- 质量分装 --> |
|
|
|
<template> |
|
|
|
<StepFormPackage :fieldItemLabel = "fieldItemLabel" |
|
|
|
@onRegentSubmit = "onRegentSubmit" |
|
|
|
ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig" |
|
|
|
@onSubPackageSubmit="onSubPackageSubmit" |
|
|
|
:formData="formData" /> |
|
|
|
<StepFormPackage :fieldItemLabel="fieldItemLabel" @onRegentSubmit="onRegentSubmit" ref="stepFormPackageRef" |
|
|
|
:prefixKey="stepIndex + '_' + 'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig" |
|
|
|
@onSubPackageSubmit="onSubPackageSubmit" :formData="formData" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import StepFormPackage from '@/components/Template/StepFormPackage.vue'; |
|
|
|
import stepMixins from '@/components/Template/mixins/stepMixins.js'; |
|
|
|
|
|
|
|
import { compareVolume } from '@/utils/volumeTools.js'; |
|
|
|
export default { |
|
|
|
mixins: [stepMixins], |
|
|
|
components: { |
|
|
|
@ -40,8 +38,8 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
config:{ |
|
|
|
zlfz:{ |
|
|
|
config: { |
|
|
|
zlfz: { |
|
|
|
type: "zlfz", |
|
|
|
} |
|
|
|
} |
|
|
|
@ -50,31 +48,67 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onRegentSubmit(data){ |
|
|
|
console.log(data,"onRegentSubmit") |
|
|
|
const {key,selectInfo} = data; |
|
|
|
if(key === 'gsp'){//供试品弹窗确定 |
|
|
|
this.$refs.stepFormPackageRef.updateZlfzData("zlfz",{mybh:selectInfo.selectedId}); |
|
|
|
onRegentSubmit(data) { |
|
|
|
console.log(data, "onRegentSubmit") |
|
|
|
const { key, selectInfo } = data; |
|
|
|
|
|
|
|
if (key === 'gsp') {//供试品弹窗确定 |
|
|
|
const { row = {} } = selectInfo; |
|
|
|
const gspInfo = {//供试品信息 |
|
|
|
max: row.kc,//最大库存数量 |
|
|
|
maxUnit: row.kcdw,//最大库存单位 |
|
|
|
} |
|
|
|
|
|
|
|
this.$refs.stepFormPackageRef.updateFormData("gspInfo", gspInfo); |
|
|
|
this.$refs.stepFormPackageRef.updateZlfzData("zlfz", { mybh: selectInfo.selectedId }); |
|
|
|
// this.formData[key] = data; |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
async onSubPackageSubmit(data){ |
|
|
|
const {key} = data; |
|
|
|
if(key === 'zlfz'){ |
|
|
|
const formData = await this.$refs.stepFormPackageRef.getFormData(); |
|
|
|
if(formData){ |
|
|
|
const {zlfz} = formData; |
|
|
|
const fzInfo = { |
|
|
|
...zlfz.formData, |
|
|
|
fzList:zlfz.fzList, |
|
|
|
}; |
|
|
|
this.$refs.stepFormPackageRef.updateFormData("fzInfo",fzInfo); |
|
|
|
this.$message.success("质量分装成功"); |
|
|
|
this.justUpdateFilledFormData(); |
|
|
|
} |
|
|
|
|
|
|
|
async onSubPackageSubmit(data) { |
|
|
|
const { key } = data; |
|
|
|
if (key === 'zlfz') { |
|
|
|
this.$refs.stepFormPackageRef.getFormData().then(res => { |
|
|
|
console.log(res, "res") |
|
|
|
if (res) { |
|
|
|
const { zlfz } = res; |
|
|
|
const gspInfo = res.gspInfo || this.formData.gspInfo || {}; |
|
|
|
const { max, maxUnit } = gspInfo; |
|
|
|
const dw = zlfz.formData.dw; |
|
|
|
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?" |
|
|
|
const totalVolume = zlfz.fzList.reduce((acc, cur) => acc + Number(cur.actnum), 0); |
|
|
|
const compareResult = compareVolume(totalVolume, dw, max, maxUnit); |
|
|
|
const fzInfo = { |
|
|
|
...zlfz.formData, |
|
|
|
fzList: zlfz.fzList, |
|
|
|
}; |
|
|
|
if (compareResult > 0 || !max) {//没有填写实际溶液体积的也需要提示错误信息 |
|
|
|
this.$modal.confirm(errMsg, '提示', { |
|
|
|
confirmButtonText: this.$t('form.saveConfirm'), |
|
|
|
cancelButtonText: this.$t('form.cancel'), |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
this.submitEmit(fzInfo); |
|
|
|
}).catch(() => { |
|
|
|
// 取消操作,不执行任何操作 |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.submitEmit(fzInfo); |
|
|
|
|
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, "err") |
|
|
|
this.$message.error("请填写分装信息"); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
submitEmit(fzInfo) { |
|
|
|
this.$refs.stepFormPackageRef.updateFormData("fzInfo", fzInfo); |
|
|
|
this.$message.success("质量分装成功"); |
|
|
|
this.justUpdateFilledFormData(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|