diff --git a/src/views/business/comps/template/comps/lba/LBA004.vue b/src/views/business/comps/template/comps/lba/LBA004.vue index 23ed19a..39b8946 100644 --- a/src/views/business/comps/template/comps/lba/LBA004.vue +++ b/src/views/business/comps/template/comps/lba/LBA004.vue @@ -88,7 +88,8 @@ import TableList from "@/components/Template/Table"; import Step from "@/components/Template/Step"; import templateMixin from "../../mixins/templateMixin"; import { EventBus } from "@/utils/eventBus"; -import { uniqeResource } from "@/utils/calUnitTools"; +import { uniqeResource,uniqeResourceOne } from "@/utils/calUnitTools"; +import { duplicateResource } from "@/utils/index.js"; import { debounce } from 'lodash-es'; import CustomTable from '@/components/Template/CustomTable.vue'; import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue" @@ -375,12 +376,60 @@ export default { }, getResource() { let content = this.getFilledFormData(); + //生成resource + let tmpResource = [] + if (this.fillType === "actFill") { + //平行配置 + if (content.paralleConfigs && content.paralleConfigs.length > 0) { + for (let i = 0; i < content.paralleConfigs.length; i++) { + let paralleConfigs = content.paralleConfigs[i] + let stepTableFormData = paralleConfigs.stepTableFormData + for (let j = 0; j < stepTableFormData.length; j++) { + //稀释液 + tmpResource.push({ + mc: null, + bh: paralleConfigs.jzCode, + ph: null, + nd: null, + nddw: null, + ndz: null, + ly: null, + sxrq: null, + kc: null, + kcdw: null, + type: 1, + syl: stepTableFormData[j].sjjzjrz, + syldw: paralleConfigs.headerSelectFields.sjjzjrzUnit, + yxzq: null, + yxzqdw: null, + }) + } + } + } + } + if (tmpResource.length > 0) { + tmpResource = uniqeResourceOne(tmpResource) + } //使用的试剂、仪器 - const stepResource = this.$refs.stepRef.getStepResource() - this.resourceTmp = stepResource.sjResource || [] + const stepResource = this.getStepResource() + this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || []) this.yqResourceTmp = stepResource.yqResource || [] + this.resourceTmp = tmpResource return this.resourceTmp; }, + getStepResource() { + const sjResource = [], yqResource = []; + if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { + for (let i = 0; i < this.formData.paralleConfigs.length; i++) { + const paralleResource = this.$refs[`paralleStepRef_${i}`][0].getStepResource(); + sjResource.push(...paralleResource.sjResource); + yqResource.push(...paralleResource.yqResource); + } + } + //去重 + const { sj, yq } = duplicateResource(sjResource, yqResource) + return { sjResource: sj, yqResource: yq }; + }, //保存 async onSave() { const formData = this.getStepResource();