|
|
@ -24,7 +24,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<span class="ml-20">每份包装量:</span> |
|
|
<span class="ml-20">每份包装量:</span> |
|
|
<div class="unit-select"> |
|
|
<div class="unit-select"> |
|
|
<HandleFormItem type="inputNumber" :isFieldsRecord="false" :item="inputNumberItem" v-model="formData.mfbzl" /> |
|
|
|
|
|
|
|
|
<HandleFormItem type="inputNumber" :error = "formErrors.mfbzl" :isFieldsRecord="false" :item="inputNumberItem" v-model="formData.mfbzl" /> |
|
|
</div> |
|
|
</div> |
|
|
<el-button type="primary" plain @click="onAverage">平均分配</el-button> |
|
|
<el-button type="primary" plain @click="onAverage">平均分配</el-button> |
|
|
<el-button type="primary" plain @click="onReset">重置</el-button> |
|
|
<el-button type="primary" plain @click="onReset">重置</el-button> |
|
|
@ -51,6 +51,7 @@ import HandleFormItem from '@/components/Template/HandleFormItem.vue'; |
|
|
import { compareVolume } from '@/utils/volumeTools.js'; |
|
|
import { compareVolume } from '@/utils/volumeTools.js'; |
|
|
import { EventBus } from '@/utils/eventBus'; |
|
|
import { EventBus } from '@/utils/eventBus'; |
|
|
import { getLatestSn } from '@/api/template'; |
|
|
import { getLatestSn } from '@/api/template'; |
|
|
|
|
|
import {isValueEmpty} from "@/utils/index"; |
|
|
export default { |
|
|
export default { |
|
|
dicts: [ |
|
|
dicts: [ |
|
|
'business_tjdw', |
|
|
'business_tjdw', |
|
|
@ -92,6 +93,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
fzListErrors: [], // 分装列表错误状态 |
|
|
fzListErrors: [], // 分装列表错误状态 |
|
|
uuid:"",//事件id |
|
|
uuid:"",//事件id |
|
|
|
|
|
originalData: {},//原始数据 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -112,6 +114,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
show(data) { |
|
|
show(data) { |
|
|
const cloneData = JSON.parse(JSON.stringify(data)); |
|
|
const cloneData = JSON.parse(JSON.stringify(data)); |
|
|
|
|
|
console.log(cloneData,"cloneData") |
|
|
if(data && data.uuid) {//为了标识eventBus的事件id |
|
|
if(data && data.uuid) {//为了标识eventBus的事件id |
|
|
this.uuid = data.uuid |
|
|
this.uuid = data.uuid |
|
|
} |
|
|
} |
|
|
@ -121,6 +124,13 @@ export default { |
|
|
this.fzListErrors = new Array(this.fzList.length).fill(false); |
|
|
this.fzListErrors = new Array(this.fzList.length).fill(false); |
|
|
delete cloneData.fzList; |
|
|
delete cloneData.fzList; |
|
|
} |
|
|
} |
|
|
|
|
|
this.originalData = { |
|
|
|
|
|
fzList: cloneData.fzList, |
|
|
|
|
|
mybh: cloneData.mybh, |
|
|
|
|
|
fzsl: cloneData.fzsl, |
|
|
|
|
|
dw: cloneData.dw, |
|
|
|
|
|
mfbzl: cloneData.mfbzl, |
|
|
|
|
|
} |
|
|
this.formData = cloneData; |
|
|
this.formData = cloneData; |
|
|
// 重置错误状态 |
|
|
// 重置错误状态 |
|
|
this.resetErrors(); |
|
|
this.resetErrors(); |
|
|
@ -157,36 +167,49 @@ export default { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
submitEmit(){ |
|
|
submitEmit(){ |
|
|
|
|
|
const {originalData} = this; |
|
|
|
|
|
const nowData = {...this.formData, fzList: this.fzList}; |
|
|
|
|
|
if(!originalData.fzList){ |
|
|
|
|
|
this.updateRecords(nowData); |
|
|
|
|
|
}else if(JSON.stringify(nowData) !== JSON.stringify(originalData)){ |
|
|
|
|
|
console.log("有修改") |
|
|
|
|
|
} |
|
|
EventBus.$emit('dialogSubPackageSubmit', {...this.formData, fzList: this.fzList,uuid:this.uuid}); |
|
|
EventBus.$emit('dialogSubPackageSubmit', {...this.formData, fzList: this.fzList,uuid:this.uuid}); |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
this.close(); |
|
|
this.close(); |
|
|
}, 500); |
|
|
}, 500); |
|
|
}, |
|
|
}, |
|
|
|
|
|
updateRecords(){ |
|
|
|
|
|
console.log("更新记录") |
|
|
|
|
|
}, |
|
|
validateFormData() { |
|
|
validateFormData() { |
|
|
let isValid = true; |
|
|
let isValid = true; |
|
|
|
|
|
|
|
|
|
|
|
const {mybh,fzsl,dw,mfbzl} = this.formData; |
|
|
// 验证母液编号 |
|
|
// 验证母液编号 |
|
|
if (!this.formData.mybh) { |
|
|
|
|
|
|
|
|
if (isValueEmpty(mybh)) { |
|
|
this.formErrors.mybh = true; |
|
|
this.formErrors.mybh = true; |
|
|
isValid = false; |
|
|
isValid = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证分装数量 |
|
|
// 验证分装数量 |
|
|
if (!this.formData.fzsl) { |
|
|
|
|
|
|
|
|
if (isValueEmpty(fzsl)) { |
|
|
this.formErrors.fzsl = true; |
|
|
this.formErrors.fzsl = true; |
|
|
isValid = false; |
|
|
isValid = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证单位 |
|
|
// 验证单位 |
|
|
if (!this.formData.dw) { |
|
|
|
|
|
|
|
|
if (isValueEmpty(dw)) { |
|
|
this.formErrors.dw = true; |
|
|
this.formErrors.dw = true; |
|
|
isValid = false; |
|
|
isValid = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 验证单位 |
|
|
|
|
|
if (isValueEmpty(mfbzl)) { |
|
|
|
|
|
this.formErrors.mfbzl = true; |
|
|
|
|
|
isValid = false; |
|
|
|
|
|
} |
|
|
// 验证分装列表中的数值 |
|
|
// 验证分装列表中的数值 |
|
|
if (this.fzList && this.fzList.length > 0) { |
|
|
if (this.fzList && this.fzList.length > 0) { |
|
|
for (let i = 0; i < this.fzList.length; i++) { |
|
|
for (let i = 0; i < this.fzList.length; i++) { |
|
|
if (!this.fzList[i].num) { |
|
|
|
|
|
|
|
|
if (isValueEmpty(this.fzList[i].num)) { |
|
|
// 确保fzListErrors数组有足够的元素 |
|
|
// 确保fzListErrors数组有足够的元素 |
|
|
if (this.fzListErrors.length <= i) { |
|
|
if (this.fzListErrors.length <= i) { |
|
|
this.$set(this.fzListErrors, i, true); |
|
|
this.$set(this.fzListErrors, i, true); |
|
|
@ -197,7 +220,6 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return isValid; |
|
|
return isValid; |
|
|
}, |
|
|
}, |
|
|
resetErrors() { |
|
|
resetErrors() { |
|
|
|