diff --git a/src/lang/en/template/pcr.js b/src/lang/en/template/pcr.js index 3df6323..92be159 100644 --- a/src/lang/en/template/pcr.js +++ b/src/lang/en/template/pcr.js @@ -45,6 +45,7 @@ export default { ysxsyxytj: '预设稀释液吸样体积', sjxsyxytj: '实际稀释液吸样体积', ypznd: '样品终浓度', + fj: 'Attachment', }, // 生物样品分析方法学样品制备表-准确度与精密度 sp008: { diff --git a/src/lang/zh/template/pcr.js b/src/lang/zh/template/pcr.js index 46bd344..953405b 100644 --- a/src/lang/zh/template/pcr.js +++ b/src/lang/zh/template/pcr.js @@ -44,6 +44,7 @@ export default { ysxsyxytj: '预设稀释液吸样体积', sjxsyxytj: '实际稀释液吸样体积', ypznd: '样品终浓度', + fj: '附件', }, // 生物样品分析方法学样品制备表-Recovery sp009: { diff --git a/src/views/business/comps/template/comps/pcr/PCR005.vue b/src/views/business/comps/template/comps/pcr/PCR005.vue index 6cd8953..8c61b50 100644 --- a/src/views/business/comps/template/comps/pcr/PCR005.vue +++ b/src/views/business/comps/template/comps/pcr/PCR005.vue @@ -15,12 +15,13 @@
- {{ $t('template.common.downloadTemplate') }} - {{ $t('template.common.importTemplate') }} - + {{ + $t('template.common.downloadTemplate') }} + {{ $t('template.common.importTemplate') + }} + @@ -47,16 +53,19 @@ import TableList from "@/components/Template/Table"; import Step from "@/components/Template/Step"; import templateMixin from "../../mixins/templateMixin.js"; import CustomTable from '@/components/Template/CustomTable.vue'; +import { isValueEmpty } from '@/utils/index'; import { getLatestSnArr } from '@/api/template'; import { EventBus } from "@/utils/eventBus"; +import { volumeConverter } from "@/utils/volConverter";//体积单位转换 +import {convertConcentration} from "@/utils/conConverter";//浓度单位转换 import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; import { getPCR005Config } from "../../formConfig/PCRTableConfig.js"; import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue" import { addTj, uniqeResource, uniqeResourceOne, addDecimals } from "@/utils/calUnitTools"; - +import ImportExcelDialog from '../../dialog/ImportExcelDialog' export default { - name: "PCR002", - components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog }, + name: "PCR005", + components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog, ImportExcelDialog }, mixins: [templateMixin], props: { fillType: { @@ -68,6 +77,21 @@ export default { tableStepColumns() { return getPCR005Config(this); }, + // 附件表单配置 + getFjFormConfig() { + return [ + { + type: "attachment", + config: { + attTitle: { + label: 'template.pcr.pcr005.fj', + type: "attachment", + fillType: "actFill", + }, + } + } + ] + }, // 配置条件 storageFormConfig() { return [ @@ -205,8 +229,68 @@ export default { }, mounted() { const formData = this.getFormDataByTemplateData(); + this.onHandleTableBlur() }, methods: { + downloadExcelTemplate() { + this.exportExcel(['样品名称', '样品初始浓度', '稀释倍数', '预设样品吸样体积']) + }, + //选择试剂提交事件 + onSelectReagentSubmit(code, row) { + + }, + showImportExcelDialog() { + this.$refs.ImportExcelDialog.show() + }, + // 失去焦点,计算 + onHandleTableBlur() { + let content = this.getFilledFormData(); + // 预填 + let ysypxytjUnit = content.headerSelectFields.ysypxytjUnit + let ysxsyxytjUnit = content.headerSelectFields.ysxsyxytjUnit + + let ypzndUnit = content.headerSelectFields.ypzndUnit + let ypcsndUnit = content.headerSelectFields.ypcsndUnit + if (this.fillType === "preFill") { + let tableList = content.stepTableFormData + if (tableList && tableList.length > 0) { + for (let i = 0; i < tableList.length; i++) { + let item = tableList[i] + console.log(item) + + if ( + isValueEmpty(ysypxytjUnit) || + isValueEmpty(ysxsyxytjUnit) || + isValueEmpty(item.sxbs) || + isValueEmpty(item.ysypxytj) || + isValueEmpty(item.actSolutionVolumePrecision) || + isValueEmpty(item.ypcsnd) + ) { + continue; + } + // 计算预设稀释液吸样体积 公式:(稀释倍数-1)*样品理论体积 + let ysxsyxytj = (item.sxbs - 1) * item.ysypxytj + ysxsyxytj = volumeConverter.convert(ysxsyxytj + ysypxytjUnit, ysxsyxytjUnit).toFixed( + item.actSolutionVolumePrecision + ) + tableList[i].ysxsyxytj = ysxsyxytj + + + // 计算样品终浓度: 样品初始浓度/稀释倍数 + let ypznd = (item.ypcsnd ) / item.sxbs + ypznd = convertConcentration.convert(ypznd + ypcsndUnit, ypzndUnit).toFixed( + item.targetDiluentVolumePrecision + ) + tableList[i].ypznd = ypznd + } + } + this.$refs.stepTableRef.updateDataSource(tableList); + } + + + + + }, //获取已填写的表单数据 getFilledFormData() { return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]) @@ -217,7 +301,7 @@ export default { }, getResource() { let content = this.getFilledFormData(); - console.log(content) + //生成resource let tmpResource = [] if (this.fillType === "actFill") { diff --git a/src/views/business/comps/template/formConfig/PCRTableConfig.js b/src/views/business/comps/template/formConfig/PCRTableConfig.js index 7e676b7..ab2fcce 100644 --- a/src/views/business/comps/template/formConfig/PCRTableConfig.js +++ b/src/views/business/comps/template/formConfig/PCRTableConfig.js @@ -115,7 +115,6 @@ export const getLadderColumnsConfig = ($this, selectKey) => { bodyFillType: 'actFill', bodySubFillType: 'preFill', showBodySub: $this.fillType === 'preFill', - bodyPrecisionKey: 'actSolutionConcentrationPrecision', bodyMaxlength: 10, bodySubPlaceholder: 'template.common.xswsPlaceholder', @@ -146,7 +145,6 @@ export const getLadderColumnsConfig = ($this, selectKey) => { bodyFillType: 'actFill', bodySubFillType: 'preFill', showBodySub: $this.fillType === 'preFill', - bodyPrecisionKey: 'actSolutionVolumePrecision', bodyMaxlength: 10, // copyFrom: 'targetSolutionVolume', //复制哪个字段 @@ -646,11 +644,13 @@ export const getPCR005Config = ($this) => { fillType: 'preFill', headerSelectKey: 'ysxsyxytjUnit', headerOptions: $this.getDictOptions('business_tjdw'), + bodyDisabled: true, bodyType: 'inputNumber', bodyFillType: 'preFill', bodyMaxlength: 10, bodySubType: 'inputNumber', bodySubKey: 'actSolutionVolumePrecision', + subPrecision: 0, bodyFillType: 'preFill', bodySubFillType: 'preFill', showBodySub: $this.fillType === 'preFill', @@ -678,6 +678,7 @@ export const getPCR005Config = ($this) => { fillType: 'preFill', headerSelectKey: 'ypzndUnit', headerOptions: $this.getDictOptions('business_nddw'), + bodyDisabled: true, bodyType: 'inputNumber', bodyFillType: 'preFill', bodyMaxlength: 10, @@ -685,6 +686,7 @@ export const getPCR005Config = ($this) => { bodySubKey: 'targetDiluentVolumePrecision', bodyPrecisionKey: 'targetDiluentVolumePrecision', bodySubFillType: 'preFill', + subPrecision: 0, showBodySub: $this.fillType === 'preFill', bodyMaxlength: 10, bodySubPlaceholder: 'template.common.xswsPlaceholder',