Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
569559a473
6 changed files with 127 additions and 14 deletions
  1. +92
    -3
      src/components/Template/Step.vue
  2. +21
    -10
      src/components/Template/StepFormPackage.vue
  3. +3
    -0
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  4. +3
    -0
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  5. +3
    -0
      src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue
  6. +5
    -1
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue

+ 92
- 3
src/components/Template/Step.vue View File

@ -341,15 +341,104 @@ export default {
} }
}) })
}, },
getSjResource(){
getStepResource(){
const sj = [];
let yq = [];
const stepData = this.steps.map((step, index) => { const stepData = this.steps.map((step, index) => {
const stepComponentRef = this.$refs[`stepCompRef_${index}`]; const stepComponentRef = this.$refs[`stepCompRef_${index}`];
if(stepComponentRef && stepComponentRef.length > 0){ if(stepComponentRef && stepComponentRef.length > 0){
const {sjResource,yqResource} = this.$refs[`stepCompRef_${index}`][0]?.getSjResource(); const {sjResource,yqResource} = this.$refs[`stepCompRef_${index}`][0]?.getSjResource();
return { type: step.type, sjResource, yqResource }
if(sjResource && sjResource.length > 0){
sj.push(...sjResource);
}
if(yqResource && yqResource.length > 0){
yq.push(...yqResource);
}
} }
}) })
console.log(stepData,"steps")
// sjtypevalueyl
const uniqueSj = [];
const sjMap = new Map();
// L
const volumeUnits = {
'pL': 1e-12,
'nL': 1e-9,
'uL': 1e-6,
'mL': 1e-3,
'L': 1
};
// g
const massUnits = {
'pg': 1e-12,
'ng': 1e-9,
'ug': 1e-6,
'mg': 1e-3,
'g': 1,
'kg': 1e3
};
for(const item of sj) {
const key = `${item.type}_${item.value}`;
console.log(item,"item")
if(sjMap.has(key)) {
// typevalueyl
const existingItem = sjMap.get(key);
console.log(existingItem,"existingItem")
//
let currentItemYlInBaseUnit, existingItemYlInBaseUnit;
if(item.type === 'sj') {
//
const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl);
const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl);
currentItemYlInBaseUnit = currentItemYl * volumeUnits[item.dw] || 0;
existingItemYlInBaseUnit = existingItemYl * volumeUnits[existingItem.dw] || 0;
} else if(item.type === 'gsp') {
//
const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl);
const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl);
currentItemYlInBaseUnit = currentItemYl * massUnits[item.dw] || 0;
existingItemYlInBaseUnit = existingItemYl * massUnits[existingItem.dw] || 0;
} else {
//
const currentItemYl = isNaN(parseFloat(item.yl)) ? 0 : parseFloat(item.yl);
const existingItemYl = isNaN(parseFloat(existingItem.yl)) ? 0 : parseFloat(existingItem.yl);
currentItemYlInBaseUnit = currentItemYl || 0;
existingItemYlInBaseUnit = existingItemYl || 0;
}
//
const totalYlInBaseUnit = currentItemYlInBaseUnit + existingItemYlInBaseUnit;
// existingItemyl使
if(item.type === 'sj') {
existingItem.yl = (totalYlInBaseUnit / volumeUnits[existingItem.dw]).toString();
} else if(item.type === 'gsp') {
existingItem.yl = (totalYlInBaseUnit / massUnits[existingItem.dw]).toString();
} else {
existingItem.yl = totalYlInBaseUnit.toString();
}
} else {
//
sjMap.set(key, {...item});
}
}
// Map
sj.length = 0; //
for(const value of sjMap.values()) {
sj.push(value);
}
// yqvalue
yq = yq.filter((item, index, self) =>
self.findIndex(obj => obj.value === item.value) === index
);
console.log(sj,yq,"stepsResource")
return { sjResource: sj, yqResource: yq };
}, },
// //

+ 21
- 10
src/components/Template/StepFormPackage.vue View File

@ -121,19 +121,30 @@ export default {
for(const key in allFieldsConfig){ for(const key in allFieldsConfig){
const item = allFieldsConfig[key]; const item = allFieldsConfig[key];
if(item.type === "xb" || item.type === "regent" || item.type === "gsp" || item.type === "mix"){ if(item.type === "xb" || item.type === "regent" || item.type === "gsp" || item.type === "mix"){
sjResource.push({
type:item.selectType,
value:formFields[key],
yl:formFields[item.ylCode],//
dw:formFields[item.dwCode],//
});
if(formFields[key]){
this.formFields[`selectType_${key}`] = item.sjSelectType;
let o = {
type:item.sjSelectType || formFields[`selectType_${key}`] ,
value:formFields[key],
}
if(item.ylCode){
o.yl = formFields[item.ylCode];//
}
if(item.dwCode){
o.dw = formFields[item.dwCode];//
}
sjResource.push(o);
}
}else if(item.type === "instrument"){ }else if(item.type === "instrument"){
yqResource.push({
type:item.type,
value:formFields[key],
});
if(formFields[key]){
yqResource.push({
type:item.type,
value:formFields[key],
});
}
} }
} }
console.log(sjResource,"sjResource")
return { return {
sjResource, sjResource,
yqResource, yqResource,

+ 3
- 0
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -498,6 +498,9 @@ export default {
EventBus.$emit('onModifyRecord', params,) EventBus.$emit('onModifyRecord', params,)
}) })
}, },
getStepResource(){
return this.$refs.stepRef.getStepResource()
},
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"]) return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"])

+ 3
- 0
src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue View File

@ -269,6 +269,9 @@ export default {
EventBus.$emit('showTagPrintDialog', { printConfig }) EventBus.$emit('showTagPrintDialog', { printConfig })
}, },
getStepResource(){
return this.$refs.stepRef.getStepResource()
},
// //
async getCode() { async getCode() {
const result = await getLatestSn({ const result = await getLatestSn({

+ 3
- 0
src/views/business/comps/template/comps/sp/SWYPFXFFXZKPZB.vue View File

@ -311,6 +311,9 @@ export default {
} }
} }
}, },
getStepResource(){
return this.$refs.stepRef.getStepResource()
},
// //
getFilledFormData(){ getFilledFormData(){
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "tableRef","stepRef", "remarkRef"]) return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "tableRef","stepRef", "remarkRef"])

+ 5
- 1
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -277,6 +277,9 @@ export default {
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn", result.data[0]) this.$refs.stepFormPackageRef.updateFormData("targetCodeSn", result.data[0])
} }
}, },
getStepResource(){
return this.$refs.stepRef.getStepResource()
},
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]) return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"])
@ -310,7 +313,8 @@ export default {
return content; return content;
}, },
onSave(){ onSave(){
this.$refs.stepRef.getSjResource()
const result = this.getStepResource()
console.log(result)
} }
} }
}; };

Loading…
Cancel
Save