Browse Source

feat:[模板管理][烦人的提交记录]

lkf
luojie 2 months ago
parent
commit
c256d19950
2 changed files with 38 additions and 18 deletions
  1. +7
    -9
      src/views/business/comps/template/comps/dl/SYWZPZJHB.vue
  2. +31
    -9
      src/views/business/comps/template/dialog/SubPackageDialog.vue

+ 7
- 9
src/views/business/comps/template/comps/dl/SYWZPZJHB.vue View File

@ -147,7 +147,7 @@ export default {
width: 280,
bodyType: "input",
bodyFillType: "actFill",
bodyMaxlength: 10,
bodyMaxlength: 50,
},
{
label: "配制浓度",
@ -155,11 +155,10 @@ export default {
width: 280,
headerSelectKey: "preparationConcentrationUnit",
fillType: "actFill",
headerOptions: this.$store.state.template.volumeOptions,
defaultValue: "mg",
bodyType: "inputNumber",
headerOptions: this.getDictOptions('business_nddw'),
bodyType: "input",
bodyFillType: "actFill",
bodyMaxlength: 10,
bodyMaxlength: 50,
},
{
label: "配制体积",
@ -167,10 +166,10 @@ export default {
width: 280,
headerSelectKey: "preparationVolumeUnit",
fillType: "actFill",
headerOptions: this.$store.state.template.volumeOptions,
bodyType: "inputNumber",
headerOptions: this.getDictOptions('business_tjdw'),
bodyType: "input",
bodyFillType: "actFill",
bodyMaxlength: 10,
bodyMaxlength: 50,
},
]
},
@ -186,7 +185,6 @@ export default {
};
},
mounted() {
console.log("mounted")
},
methods: {

+ 31
- 9
src/views/business/comps/template/dialog/SubPackageDialog.vue View File

@ -24,7 +24,7 @@
</div>
<span class="ml-20">每份包装量</span>
<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>
<el-button type="primary" plain @click="onAverage">平均分配</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 { EventBus } from '@/utils/eventBus';
import { getLatestSn } from '@/api/template';
import {isValueEmpty} from "@/utils/index";
export default {
dicts: [
'business_tjdw',
@ -92,6 +93,7 @@ export default {
},
fzListErrors: [], //
uuid:"",//id
originalData: {},//
}
},
computed: {
@ -112,6 +114,7 @@ export default {
},
show(data) {
const cloneData = JSON.parse(JSON.stringify(data));
console.log(cloneData,"cloneData")
if(data && data.uuid) {//eventBusid
this.uuid = data.uuid
}
@ -121,6 +124,13 @@ export default {
this.fzListErrors = new Array(this.fzList.length).fill(false);
delete cloneData.fzList;
}
this.originalData = {
fzList: cloneData.fzList,
mybh: cloneData.mybh,
fzsl: cloneData.fzsl,
dw: cloneData.dw,
mfbzl: cloneData.mfbzl,
}
this.formData = cloneData;
//
this.resetErrors();
@ -157,36 +167,49 @@ export default {
},
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});
setTimeout(() => {
this.close();
}, 500);
},
updateRecords(){
console.log("更新记录")
},
validateFormData() {
let isValid = true;
const {mybh,fzsl,dw,mfbzl} = this.formData;
//
if (!this.formData.mybh) {
if (isValueEmpty(mybh)) {
this.formErrors.mybh = true;
isValid = false;
}
//
if (!this.formData.fzsl) {
if (isValueEmpty(fzsl)) {
this.formErrors.fzsl = true;
isValid = false;
}
//
if (!this.formData.dw) {
if (isValueEmpty(dw)) {
this.formErrors.dw = true;
isValid = false;
}
//
if (isValueEmpty(mfbzl)) {
this.formErrors.mfbzl = true;
isValid = false;
}
//
if (this.fzList && this.fzList.length > 0) {
for (let i = 0; i < this.fzList.length; i++) {
if (!this.fzList[i].num) {
if (isValueEmpty(this.fzList[i].num)) {
// fzListErrors
if (this.fzListErrors.length <= i) {
this.$set(this.fzListErrors, i, true);
@ -197,7 +220,6 @@ export default {
}
}
}
return isValid;
},
resetErrors() {

Loading…
Cancel
Save