| @ -0,0 +1,354 @@ | |||||
| <!-- 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" | |||||
| :formConfig="stepFormConfig" @blur="onHandleBlur" :formData="formData" /> | |||||
| <div v-if="fillType == 'preFill'"> | |||||
| <el-button type="danger" @click="onClickDelete">{{ | |||||
| $t('form.delete') }}</el-button> | |||||
| </div> | |||||
| <CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur" | |||||
| :ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`" | |||||
| :showCheckAll="true" @selectionChange="handleSelectionChange" | |||||
| :showOperation="fillType === 'preFill'" 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> | |||||
| <!-- <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 { 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 { getPCR010Config } from "../../formConfig/PCRTableConfig.js"; | |||||
| import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue" | |||||
| import { addTj, subTj, uniqeResource, uniqeResourceOne, addDecimals } from "@/utils/calUnitTools"; | |||||
| import ImportExcelDialog from '../../dialog/ImportExcelDialog' | |||||
| export default { | |||||
| name: "PCR005", | |||||
| components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog, ImportExcelDialog }, | |||||
| mixins: [templateMixin], | |||||
| props: { | |||||
| fillType: { | |||||
| type: String, | |||||
| default: 'preFill', | |||||
| }, | |||||
| }, | |||||
| computed: { | |||||
| tableStepColumns() { | |||||
| return getPCR010Config(this); | |||||
| }, | |||||
| // 配置条件 | |||||
| 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.pcr008.clsj', | |||||
| config: { | |||||
| startDate: { | |||||
| label: 'template.common.startTime', | |||||
| type: "input", | |||||
| }, | |||||
| endDate: { | |||||
| label: 'template.common.endTime', | |||||
| type: "input", | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| // 操作步骤表单配置 | |||||
| stepFormConfig() { | |||||
| return [ | |||||
| { | |||||
| type: 'step', | |||||
| config: { | |||||
| czb: { | |||||
| label: 'template.pcr.pcr008.czb', | |||||
| type: 'qxbd', | |||||
| fillType: 'preFill', | |||||
| qxbdType: 'PCR007', | |||||
| filledCodes: ['bdmc', 'bdbh'], | |||||
| }, | |||||
| yjry: { | |||||
| label: 'template.pcr.pcr008.yjry', | |||||
| type: 'input', | |||||
| fillType: 'preFill', | |||||
| subType: 'sj', | |||||
| subKey: 'yjrybh', | |||||
| subFillType: 'actFill', | |||||
| maxlength: 20 | |||||
| }, | |||||
| bs: { | |||||
| label: 'template.pcr.pcr010.bs', | |||||
| type: 'inputNumber', | |||||
| fillType: 'actFill', | |||||
| maxlength: 20 | |||||
| }, | |||||
| yjyjry: { | |||||
| label: 'template.pcr.pcr009.yjyjry', | |||||
| type: 'inputNumber', | |||||
| fillType: 'preFill', | |||||
| subType: 'select', | |||||
| subKey: 'yjyjryUnit', | |||||
| subOptions: this.getDictOptions('business_tjdw'), | |||||
| subFillType: 'preFill', | |||||
| maxlength: 20 | |||||
| }, | |||||
| dztpbh: { | |||||
| label: 'template.pcr.pcr010.dztpbh', | |||||
| type: 'yq', | |||||
| fillType: 'actFill', | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| }, | |||||
| data() { | |||||
| return { | |||||
| reagentType: null, // 1-表单 2-表格 | |||||
| formData: {}, | |||||
| currentSubKey: "",//当前点击的子项key | |||||
| currentType: "",//当前点击的类型 | |||||
| currentRowIndex: "",//当前点击的行索引 | |||||
| deleteRows: [], | |||||
| }; | |||||
| }, | |||||
| mounted() { | |||||
| const formData = this.getFormDataByTemplateData(); | |||||
| this.onHandleTableBlur() | |||||
| }, | |||||
| methods: { | |||||
| onClickDelete() { | |||||
| this.$modal.confirm(this.$t('form.confirmDelete')).then(() => { | |||||
| //this.$refs.stepTableRef.deleteRow() | |||||
| this.deleteRow.forEach(item => { | |||||
| this.$refs.stepTableRef.deleteRow(item) | |||||
| }) | |||||
| }).catch(() => { }); | |||||
| }, | |||||
| handleSelectionChange(row) { | |||||
| this.deleteRow = [] | |||||
| row.forEach(item => { | |||||
| this.deleteRow.push(item.rowIndex) | |||||
| }) | |||||
| }, | |||||
| // 失去焦点,计算 | |||||
| onHandleTableBlur() { | |||||
| this.updateTable() | |||||
| }, | |||||
| onHandleBlur(fields) { | |||||
| this.updateTable() | |||||
| }, | |||||
| // 计算表格 预设匀浆溶液补加入量 | |||||
| updateTable() { | |||||
| let content = this.getFilledFormData(); | |||||
| let bs = content.bs | |||||
| content | |||||
| 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] | |||||
| let cqzl = item.cqzl * bs | |||||
| // 组织重量 乘以 倍数 )减去 已加匀浆溶液 | |||||
| let ysyjrybjrl = volumeConverter.convert(cqzl + content.headerSelectFields.cqzlUnit, content.headerSelectFields.ysyjrybjrlUnit) | |||||
| tableList[i].ysyjrybjrl = ysyjrybjrl | |||||
| } | |||||
| } | |||||
| this.$refs.stepTableRef.updateDataSource(tableList); | |||||
| } | |||||
| }, | |||||
| //获取已填写的表单数据 | |||||
| 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(); | |||||
| //生成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: content.subSolution, | |||||
| ph: null, | |||||
| ndz: null, | |||||
| nd: null, | |||||
| nddw: null, | |||||
| ly: 'ELN配制', | |||||
| sxrq: null, | |||||
| kc: null, | |||||
| kcdw: null, | |||||
| syl: item.ysxsyxytj, | |||||
| type: 1, | |||||
| elnType: this.product, | |||||
| syldw: content.headerSelectFields.sjxsyxytjUnit, | |||||
| yxzq: null, | |||||
| yxzqdw: null, | |||||
| }) | |||||
| } | |||||
| } | |||||
| } | |||||
| 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> | |||||