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

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

@ -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) {//eventBusid if(data && data.uuid) {//eventBusid
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() {

Loading…
Cancel
Save