| @ -0,0 +1,355 @@ | |||||
| <!-- PCR分析样品处理表 --> | |||||
| <template> | |||||
| <div> | |||||
| <div class="detail-container"> | |||||
| <div class="detail-title"><img src="@/assets/images/detail-title.png">{{ formData.bdmc }}<img | |||||
| src="@/assets/images/detail-title.png" /></div> | |||||
| <div class="detail-content"> | |||||
| <div class="content"> | |||||
| <BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" label="template.common.baseInfo" | |||||
| ref="baseInfoRef" :formConfig="baseInfoFormConfig" :formData="formData" /> | |||||
| <TableList label="template.common.reagentInfo" :columns="sysjColumns" :dataSource="resource" /> | |||||
| <TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" /> | |||||
| <LineLabel label="template.common.operationSteps" /> | |||||
| <div class="template-form-item"> | |||||
| <BaseInfoFormPackage fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef" | |||||
| @clickable="handleFormClickable" @resetRecord="resetRecord" :formConfig="stepFormConfig" | |||||
| @blur="onHandleBlur" :formData="formData" /> | |||||
| <el-button type="primary" @click="exportExcel(['a', 'b', 'c', 'd'])">{{ $t('template.common.downloadTemplate') }}</el-button> | |||||
| <el-button type="primary" @click="showImportExcelDialog">{{ $t('template.common.importTemplate') }}</el-button> | |||||
| <CustomTable @blur="onHandleTableBlur" :ref="`stepTableRef`" :columns="tableStepColumns" | |||||
| :formData="formData" :prefixKey="`table`" @clickable="handleClickable" | |||||
| fieldItemLabel="template.common.operationSteps"> | |||||
| <template slot="operation" slot-scope="{ row, rowIndex, columns }"> | |||||
| <TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" | |||||
| @deleteRow="(rowIndex) => deleteRow(rowIndex)"></TableOpertaion> | |||||
| </template> | |||||
| </CustomTable> | |||||
| </div> | |||||
| <Step ref="stepRef" :formData="formData.stepData"></Step> | |||||
| <BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark" | |||||
| ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> | |||||
| </div> | |||||
| </div> | |||||
| </div> | |||||
| <SelectReagentDialog @submit="onSelectReagentSubmit" ref="selectReagentDialogRef"> | |||||
| </SelectReagentDialog> | |||||
| <!-- <button @click="onSave">保存</button> --> | |||||
| </div> | |||||
| </template> | |||||
| <script> | |||||
| import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage"; | |||||
| import LineLabel from "@/components/Template/LineLabel"; | |||||
| 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 { getLatestSnArr } from '@/api/template'; | |||||
| import { EventBus } from "@/utils/eventBus"; | |||||
| import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; | |||||
| import { getLadderColumnsConfig } from "../../formConfig/PCRTableConfig.js"; | |||||
| import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue" | |||||
| import { addTj, uniqeResource, uniqeResourceOne, addDecimals } from "@/utils/calUnitTools"; | |||||
| export default { | |||||
| name: "PCR002", | |||||
| components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog }, | |||||
| mixins: [templateMixin], | |||||
| props: { | |||||
| fillType: { | |||||
| type: String, | |||||
| default: 'preFill', | |||||
| }, | |||||
| }, | |||||
| computed: { | |||||
| tableStepColumns() { | |||||
| return getLadderColumnsConfig(this, 'business_pcr_fxzkypzbb'); | |||||
| }, | |||||
| // 配置条件 | |||||
| storageFormConfig() { | |||||
| return [ | |||||
| { | |||||
| type: "conditionItem", | |||||
| config: { | |||||
| storageCondition: { | |||||
| label: 'template.common.storageConditionLabel', | |||||
| type: "select", | |||||
| fillType: "preFill", | |||||
| options: this.getDictOptions("business_cctj"), | |||||
| otherCode: "storageConditionOther", | |||||
| }, | |||||
| } | |||||
| } | |||||
| ]; | |||||
| }, | |||||
| // 备注表单配置 | |||||
| remarkConig() { | |||||
| return [ | |||||
| { | |||||
| type: "cellItem", | |||||
| config: { | |||||
| remark: { | |||||
| label: "", | |||||
| type: "textarea", | |||||
| fillType: "actFill", | |||||
| span: 1, | |||||
| placeholder: 'template.common.remarkPlaceholder', | |||||
| maxlength: 1000, | |||||
| rows: 5 | |||||
| } | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| // 试验基本信息表单配置 | |||||
| baseInfoFormConfig() { | |||||
| return [ | |||||
| { | |||||
| type: "cardItem", | |||||
| config: { | |||||
| studyMc: { | |||||
| label: 'template.common.testName', | |||||
| type: "input", | |||||
| disabled: true, | |||||
| }, | |||||
| studySn: { | |||||
| label: 'template.common.testNumber', | |||||
| type: "input", | |||||
| disabled: true, | |||||
| }, | |||||
| } | |||||
| }, | |||||
| { | |||||
| type: "conditionItem", | |||||
| label: 'template.common.processCondition', | |||||
| config: { | |||||
| pre: { | |||||
| label: 'template.common.preFill', | |||||
| type: "select", | |||||
| multiple: true, | |||||
| fillType: "preFill", | |||||
| options: this.getDictOptions('business_pztj'), | |||||
| otherCode: "preOther", | |||||
| }, | |||||
| act: { | |||||
| label: 'template.common.actualFill', | |||||
| type: "select", | |||||
| fillType: "actFill", | |||||
| otherCode: "actOther", | |||||
| multiple: true, | |||||
| compareTo: "pre", | |||||
| options: this.getDictOptions('business_pztj') | |||||
| } | |||||
| } | |||||
| }, | |||||
| { | |||||
| type: "cellItem", | |||||
| label: 'template.pcr.pcr005.clpbh', | |||||
| config: { | |||||
| act: { | |||||
| label: '', | |||||
| type: "input", | |||||
| fillType: "actFill", | |||||
| otherCode: "preOther", | |||||
| } | |||||
| } | |||||
| }, | |||||
| { | |||||
| type: "cellItem", | |||||
| label: 'template.common.configurationTime', | |||||
| config: { | |||||
| startDate: { | |||||
| label: 'template.common.startTime', | |||||
| type: "input", | |||||
| }, | |||||
| endDate: { | |||||
| label: 'template.common.endTime', | |||||
| type: "input", | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| // 操作步骤表单配置 | |||||
| stepFormConfig() { | |||||
| return [ | |||||
| { | |||||
| type: 'step', | |||||
| config: { | |||||
| solution: { | |||||
| labelWidth: 80, | |||||
| label: 'template.pcr.pcr002.xsy', | |||||
| type: 'input', | |||||
| fillType: 'preFill', | |||||
| subType: 'sj', | |||||
| subKey: 'subSolution', | |||||
| subFillType: 'actFill', | |||||
| maxlength: 20 | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| }, | |||||
| data() { | |||||
| return { | |||||
| reagentType: null, // 1-表单 2-表格 | |||||
| formData: {}, | |||||
| currentSubKey: "",//当前点击的子项key | |||||
| currentType: "",//当前点击的类型 | |||||
| currentRowIndex: "",//当前点击的行索引 | |||||
| }; | |||||
| }, | |||||
| mounted() { | |||||
| const formData = this.getFormDataByTemplateData(); | |||||
| }, | |||||
| methods: { | |||||
| //获取已填写的表单数据 | |||||
| getFilledFormData() { | |||||
| return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]) | |||||
| }, | |||||
| async getFormData() { | |||||
| let content = await this.validFormFields(["baseInfoRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]); | |||||
| return content; | |||||
| }, | |||||
| getResource() { | |||||
| let content = this.getFilledFormData(); | |||||
| console.log(content) | |||||
| //生成resource | |||||
| let tmpResource = [] | |||||
| if (this.fillType === "actFill") { | |||||
| let tableList = content.stepTableFormData | |||||
| if (tableList && tableList.length > 0) { | |||||
| for (let i = 0; i < tableList.length; i++) { | |||||
| //配置的试剂 | |||||
| let item = tableList[i] | |||||
| console.log('表格item:' + JSON.stringify(item)) | |||||
| //使用的 | |||||
| // 起始溶液 | |||||
| tmpResource.push({ | |||||
| mc: null, | |||||
| bh: item.startSolutionCode, | |||||
| ph: null, | |||||
| ndz: null, | |||||
| nd: null, | |||||
| nddw: null, | |||||
| ly: 'ELN配制', | |||||
| sxrq: null, | |||||
| kc: null, | |||||
| kcdw: null, | |||||
| syl: item.actStartSolutionVolume, | |||||
| type: 1, | |||||
| elnType: this.product, | |||||
| syldw: content.headerSelectFields.actStartSolutionVolumeUnit, | |||||
| yxzq: null, | |||||
| yxzqdw: null, | |||||
| }) | |||||
| // 稀释液 | |||||
| tmpResource.push({ | |||||
| mc: null, | |||||
| bh: content.subSolution, | |||||
| ph: null, | |||||
| ndz: null, | |||||
| nd: null, | |||||
| nddw: null, | |||||
| ly: 'ELN配制', | |||||
| sxrq: null, | |||||
| kc: null, | |||||
| kcdw: null, | |||||
| syl: item.actDiluentVolume, | |||||
| type: 1, | |||||
| elnType: this.product, | |||||
| syldw: content.headerSelectFields.actDiluentVolumeUnit, | |||||
| yxzq: null, | |||||
| yxzqdw: null, | |||||
| }) | |||||
| //分装的 | |||||
| let fzTotal = 0//分装总量 | |||||
| if (item.fzsj && item.fzsj.fzList && item.fzsj.fzList.length > 0) { | |||||
| for (let j = 0; j < item.fzsj.fzList.length; j++) { | |||||
| let fzItem = item.fzsj.fzList[j] | |||||
| tmpResource.push({ | |||||
| mc: null, | |||||
| bh: item.fzsj.mybh + fzItem.preCode + fzItem.subCode, | |||||
| ph: null, | |||||
| ndz: item.hhwznd + content.headerSelectFields.hhwzndUnit, | |||||
| nd: item.hhwznd, | |||||
| nddw: content.headerSelectFields.hhwzndUnit, | |||||
| ly: 'ELN配制', | |||||
| sxrq: null, | |||||
| kc: fzItem.num, | |||||
| kcdw: item.fzsj.dw, | |||||
| syl: null, | |||||
| type: null, | |||||
| elnType: this.product, | |||||
| syldw: item.fzsj.dw, | |||||
| yxzq: null, | |||||
| yxzqdw: null, | |||||
| }) | |||||
| fzTotal = addDecimals(fzTotal, fzItem.num) | |||||
| } | |||||
| } | |||||
| //生成的 | |||||
| // const { total, unit } = addTj([item.sjjzxql, item.sjryxql], [content.headerSelectFields.sjjzxqlUnit, content.headerSelectFields.sjryxqlUnit]) | |||||
| const { total, unit } = addTj([item.actStartSolutionVolume, item.actDiluentVolume], [content.headerSelectFields.actStartSolutionVolumeUnit, content.headerSelectFields.actDiluentVolumeUnit]) | |||||
| tmpResource.push({ | |||||
| mc: null, | |||||
| bh: item.targetSolutionCode + item.subTargetSolutionCode, | |||||
| ph: null, | |||||
| ndz: item.actSolutionConcentration + content.headerSelectFields.actSolutionConcentrationUnit, | |||||
| nd: item.actSolutionConcentration, | |||||
| nddw: content.headerSelectFields.actSolutionConcentrationUnit, | |||||
| ly: 'ELN配制', | |||||
| sxrq: null, | |||||
| kc: total, | |||||
| kcdw: unit, | |||||
| type: null, | |||||
| elnType: this.product, | |||||
| syl: fzTotal > 0 ? fzTotal : null, | |||||
| syldw: fzTotal > 0 ? item.fzsj.dw : unit, | |||||
| yxzq: content.effectivePeriod, | |||||
| yxzqdw: content.effectivePeriodUnit, | |||||
| }) | |||||
| } | |||||
| } | |||||
| } | |||||
| if (tmpResource.length > 0) { | |||||
| tmpResource = uniqeResourceOne(tmpResource) | |||||
| } | |||||
| //使用的试剂、仪器 | |||||
| const stepResource = this.$refs.stepRef.getStepResource() | |||||
| this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || []) | |||||
| this.yqResourceTmp = stepResource.yqResource || [] | |||||
| return this.resourceTmp; | |||||
| }, | |||||
| //保存 | |||||
| async onSave() { | |||||
| let content = this.$refs.stepRef.getStepResource(); | |||||
| console.log(content); | |||||
| }, | |||||
| // 删除表格行 | |||||
| deleteRow(rowIndex) { | |||||
| const stepTableRef = this.$refs['stepTableRef']; | |||||
| if (stepTableRef) { | |||||
| stepTableRef.deleteRow(rowIndex); | |||||
| } | |||||
| }, | |||||
| } | |||||
| }; | |||||
| </script> | |||||
| <style rel="stylesheet/scss" lang="scss"> | |||||
| .mt-20 { | |||||
| margin-top: 20px; | |||||
| } | |||||
| .print-btn { | |||||
| margin-bottom: 20px; | |||||
| } | |||||
| </style> | |||||