| @ -0,0 +1,302 @@ | |||||
| <!-- 配体结合分析处理记录表 --> | |||||
| <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.wzInfo" :columns="sywzColumns" :dataSource="resourceWz" /> | |||||
| <TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" /> | |||||
| <LineLabel label="template.gsp.gsp011.cl" /> | |||||
| <div v-if="fillType === 'preFill'" class="mt-20"> | |||||
| <el-button type="primary" @click="handleAddParalle(false)">{{ $t('template.lba.lba004.xz') | |||||
| }}</el-button> | |||||
| </div> | |||||
| <!-- 平行配制区域 --> | |||||
| <div :label="$t('template.common.pxpz')" | |||||
| v-for="(paralleConfig, paralleIndex) in formData.paralleConfigs" | |||||
| :key="'paralle_' + paralleIndex"> | |||||
| <div class="template-form-item"> | |||||
| <div class="config-header-end" v-if="fillType === 'preFill'"> | |||||
| <el-button type="danger" plain @click="deleteParalleConfig(paralleIndex)">{{ $t('template.lba.lba004.sc')}}</el-button> | |||||
| </div> | |||||
| <BaseInfoFormPackage @clickable="(e) => handleClickable('paralle', paralleIndex, e)" | |||||
| :ref="`paralleStepFormPackageRef_${paralleIndex}`" :formConfig="paralleStepFormConfig" | |||||
| :formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" | |||||
| :fieldItemLabel="$t('template.lba.lba004.xszj')" /> | |||||
| </div> | |||||
| </div> | |||||
| <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"; | |||||
| import { EventBus } from "@/utils/eventBus"; | |||||
| 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" | |||||
| export default { | |||||
| name: "GSP011", | |||||
| components: { BaseInfoFormPackage, LineLabel, TableList, Step,CustomTable,TableOpertaionDelete }, | |||||
| mixins: [templateMixin], | |||||
| props: { | |||||
| fillType: { | |||||
| type: String, | |||||
| default: 'preFill', | |||||
| }, | |||||
| }, | |||||
| computed: { | |||||
| // 备注表单配置 | |||||
| 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.testConfigurationConditions', | |||||
| 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, | |||||
| options: this.getDictOptions('business_pztj') | |||||
| } | |||||
| } | |||||
| }, | |||||
| { | |||||
| type: "cellItem", | |||||
| label: 'template.common.configurationTime', | |||||
| config: { | |||||
| startDate: { | |||||
| label: 'template.common.startTime', | |||||
| type: "input", | |||||
| }, | |||||
| endDate: { | |||||
| label: 'template.common.endTime', | |||||
| type: "input", | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| paralleStepFormConfig(){ | |||||
| return [ | |||||
| { | |||||
| type: 'step', | |||||
| config: { | |||||
| yp: { | |||||
| label: 'template.gsp.gsp009.ypbh', | |||||
| type: "input", | |||||
| fillType: "preFill", | |||||
| subType: "span", | |||||
| subKey: "ypBh", | |||||
| subFillType: "actFill", | |||||
| maxlength: 20, | |||||
| }, | |||||
| xz: { | |||||
| label: 'template.gsp.gsp009.xz', | |||||
| type: "sj", | |||||
| fillType: "actFill", | |||||
| subType:"text", | |||||
| subText:"template.gsp.gsp011.zw" | |||||
| }, | |||||
| } | |||||
| } | |||||
| ] | |||||
| }, | |||||
| }, | |||||
| data() { | |||||
| return { | |||||
| formData: {} | |||||
| }; | |||||
| }, | |||||
| mounted() { | |||||
| this.handleAddParalle(true); | |||||
| }, | |||||
| methods: { | |||||
| //获取已填写的表单数据 | |||||
| getFilledFormData() { | |||||
| const baseData = this.$refs.baseInfoRef.getFilledFormData(); | |||||
| const remarkData = this.$refs.remarkRef.getFilledFormData(); | |||||
| // 获取所有平行配制数据 | |||||
| const paralleConfigsData = []; | |||||
| if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { | |||||
| for (let i = 0; i < this.formData.paralleConfigs.length; i++) { | |||||
| const paralleFormData = this.$refs[`paralleStepFormPackageRef_${i}`][0].getFilledFormData(); | |||||
| paralleConfigsData.push({ | |||||
| ...paralleFormData, | |||||
| showParalleConfig: true | |||||
| }); | |||||
| } | |||||
| } | |||||
| return { | |||||
| ...baseData, | |||||
| ...remarkData, | |||||
| paralleConfigs: paralleConfigsData, | |||||
| } | |||||
| }, | |||||
| //获取填写完成的表单数据 | |||||
| async getFormData() { | |||||
| //先校验再获取值 | |||||
| const validFlag = await this.validFields(); | |||||
| if (!validFlag) { | |||||
| return false; | |||||
| } | |||||
| let content = this.getFilledFormData(); | |||||
| return content | |||||
| }, | |||||
| //只做校验 | |||||
| async validFields() { | |||||
| // 构建需要验证的引用数组 | |||||
| let refsToValidate = ["baseInfoRef", "remarkRef"]; | |||||
| // 添加平行配制相关的引用 | |||||
| if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { | |||||
| for (let i = 0; i < this.formData.paralleConfigs.length; i++) { | |||||
| refsToValidate.push(`paralleStepFormPackageRef_${i}`); | |||||
| } | |||||
| } | |||||
| return await this.validFormFields(refsToValidate); | |||||
| }, | |||||
| getResource() { | |||||
| let content = this.getFilledFormData(); | |||||
| //使用的试剂、仪器 | |||||
| this.resourceTmp = [] | |||||
| this.yqResourceTmp = [] | |||||
| return this.resourceTmp; | |||||
| }, | |||||
| //保存 | |||||
| async onSave() { | |||||
| const formData = this.getStepResource(); | |||||
| console.log(formData, "formData") | |||||
| }, | |||||
| //新增平行配制 | |||||
| handleAddParalle(init) { | |||||
| debugger | |||||
| let isAdd = !init | |||||
| if(init && (!this.formData.paralleConfigs || this.formData.paralleConfigs.length===0)){ | |||||
| isAdd = true | |||||
| } | |||||
| if(isAdd){ | |||||
| // 初始化平行配制配置列表 | |||||
| if (!this.formData.paralleConfigs) { | |||||
| this.$set(this.formData, 'paralleConfigs', []); | |||||
| } | |||||
| // 添加新的平行配制配置 | |||||
| this.formData.paralleConfigs.push({ | |||||
| showParalleConfig: true | |||||
| }); | |||||
| } | |||||
| //todo: 需要回调保存? | |||||
| debugger | |||||
| }, | |||||
| // 删除平行配制配置 | |||||
| deleteParalleConfig(index) { | |||||
| if(this.formData.paralleConfigs.length===1){ | |||||
| // this.$message.error("至少需要1个"); | |||||
| return; | |||||
| } | |||||
| this.formData.paralleConfigs.splice(index, 1); | |||||
| }, | |||||
| // 删除表格行 | |||||
| deleteRow(rowIndex, type, configIndex = 0) { | |||||
| // 根据类型删除对应的表格行 | |||||
| if (type === 'ladder') { | |||||
| const tableRef = this.$refs[`ladderStepTableRef_${configIndex}`]; | |||||
| if (tableRef) { | |||||
| tableRef.deleteRow(rowIndex); | |||||
| } | |||||
| } else if (type === 'paralle') { | |||||
| const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`]; | |||||
| if (tableRef) { | |||||
| tableRef[0].deleteRow(rowIndex); | |||||
| } | |||||
| } | |||||
| }, | |||||
| } | |||||
| }; | |||||
| </script> | |||||
| <style rel="stylesheet/scss" lang="scss"> | |||||
| .mt-20 { | |||||
| margin-top: 20px; | |||||
| } | |||||
| .print-btn { | |||||
| margin-bottom: 20px; | |||||
| } | |||||
| .config-header-end { | |||||
| display: flex; | |||||
| justify-content: flex-end; | |||||
| align-items: center; | |||||
| margin-bottom: 15px; | |||||
| font-weight: bold; | |||||
| font-size: 16px; | |||||
| color: #303133; | |||||
| } | |||||
| </style> | |||||