|
|
|
@ -30,7 +30,7 @@ |
|
|
|
</div> |
|
|
|
<div class="header-container"> |
|
|
|
<div v-for="(item, index) in fzList" class="list-item" :key="index"> |
|
|
|
<div class="list-label">{{ formData.mybh }}-set01</div> |
|
|
|
<div class="list-label">{{ formData.mybh }}-set{{ item.subCode }}</div> |
|
|
|
<HandleFormItem :isFieldsRecord="false" :item="inputNumberItem" :error="fzListErrors[index]" |
|
|
|
@blur="onBlurFzNum(index)" v-model="item.num" /> |
|
|
|
<el-button type="primary" plain @click="onPrint">打印</el-button> |
|
|
|
@ -48,7 +48,8 @@ |
|
|
|
<script> |
|
|
|
import HandleFormItem from '@/components/Template/HandleFormItem.vue'; |
|
|
|
import { compareVolume } from '@/utils/volumeTools.js'; |
|
|
|
import { EventBus } from '@/utils/eventBus' |
|
|
|
import { EventBus } from '@/utils/eventBus'; |
|
|
|
import { getLatestSn } from '@/api/template'; |
|
|
|
export default { |
|
|
|
dicts: [ |
|
|
|
'business_tjdw', |
|
|
|
@ -102,6 +103,8 @@ export default { |
|
|
|
methods: { |
|
|
|
close() { |
|
|
|
this.visible = false; |
|
|
|
this.fzList = []; |
|
|
|
this.formData = {}; |
|
|
|
this.resetErrors(); |
|
|
|
}, |
|
|
|
show(data) { |
|
|
|
@ -122,10 +125,10 @@ export default { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?" |
|
|
|
const {maxVolume,volumeUnit,dw} = this.formData; |
|
|
|
const {maxVolume,maxVolumeUnit,dw} = this.formData; |
|
|
|
const totalVolume = this.fzList.reduce((acc, cur) => acc + Number(cur.num), 0); |
|
|
|
const compareResult = compareVolume(totalVolume,dw,maxVolume, volumeUnit); |
|
|
|
if(compareResult > 0){ |
|
|
|
const compareResult = compareVolume(totalVolume,dw,maxVolume, maxVolumeUnit); |
|
|
|
if(compareResult > 0||!maxVolume){//没有填写实际溶液体积的也需要提示错误信息 |
|
|
|
this.$modal.confirm(errMsg, '提示', { |
|
|
|
confirmButtonText: this.$t('form.saveConfirm'), |
|
|
|
cancelButtonText: this.$t('form.cancel'), |
|
|
|
@ -144,9 +147,9 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
submitEmit(){ |
|
|
|
console.log({...this.formData, fzList: this.fzList}) |
|
|
|
EventBus.$emit('subPackageSubmit', {...this.formData, fzList: this.fzList}); |
|
|
|
this.fzList = []; |
|
|
|
this.formData = {}; |
|
|
|
|
|
|
|
this.close(); |
|
|
|
}, |
|
|
|
validateFormData() { |
|
|
|
@ -199,7 +202,7 @@ export default { |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 分装数量失去焦点时,根据数量生成分装列表 |
|
|
|
onBlurFzsl(e) { |
|
|
|
async onBlurFzsl(e) { |
|
|
|
// 清除当前字段的错误状态 |
|
|
|
if (e) { |
|
|
|
this.formErrors.fzsl = false; |
|
|
|
@ -207,15 +210,23 @@ export default { |
|
|
|
// 清空现有列表 |
|
|
|
this.fzList = []; |
|
|
|
this.fzListErrors = []; |
|
|
|
|
|
|
|
// 根据输入的数量生成新列表 |
|
|
|
for (let i = 0; i < e; i++) { |
|
|
|
this.fzList.push({ |
|
|
|
num: "", |
|
|
|
}); |
|
|
|
// 同步初始化错误状态数组 |
|
|
|
this.fzListErrors.push(false); |
|
|
|
const result = await getLatestSn({ |
|
|
|
my: this.formData.mybh, |
|
|
|
count: e, |
|
|
|
}) |
|
|
|
if(result.code === 200){ |
|
|
|
const codes = result.data; |
|
|
|
// 根据输入的数量生成新列表 |
|
|
|
for (let i = 0; i < e; i++) { |
|
|
|
this.fzList.push({ |
|
|
|
num: "", |
|
|
|
subCode: codes[i], |
|
|
|
}); |
|
|
|
// 同步初始化错误状态数组 |
|
|
|
this.fzListErrors.push(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
onAverage() { |
|
|
|
const { mfbzl } = this.formData; |
|
|
|
|