From 011fe08914af51ead8b8f21111406509de2f5564 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Fri, 13 Mar 2026 21:15:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][sp0?= =?UTF-8?q?21]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/BaseInfoFormPackage.vue | 4 + src/components/Template/CustomTable.vue | 23 ++++-- src/components/Template/HandleFormItem.vue | 6 ++ .../business/comps/template/comps/dl/DL022.vue | 1 + .../business/comps/template/comps/sp/SP0019.vue | 38 +++++++-- .../business/comps/template/comps/sp/SP0021.vue | 91 ++++++++++++---------- .../comps/template/formConfig/sp/SP0019.js | 29 +++---- 7 files changed, 124 insertions(+), 68 deletions(-) diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue index 0d5586d..5f863dc 100644 --- a/src/components/Template/BaseInfoFormPackage.vue +++ b/src/components/Template/BaseInfoFormPackage.vue @@ -184,6 +184,7 @@
@@ -410,6 +411,9 @@ export default { }; }, methods: { + remoteMethod(query, sItem, key){ + this.$emit('remoteMethod', { query, sItem, key, formFields: this.formFields }) + }, //是否显示radio后的select isShowRadioSelect(value){ const arr = ["动物种属","细胞系"]; diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 7ddf799..9b75591 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -93,7 +93,7 @@ ({ + label: item.bh, + value: item.bh, + })); + } + } + }, onRegentSubmit(e){ const {selectInfo, key, col, rowIndex, colIndex, rowData} = e; const {row} = selectInfo; @@ -130,8 +149,17 @@ export default { this.$refs.ryTableRef.updateDataSourceByRowIndex(rowIndex, params); } }, - onYqSubmit(data, col, rowIndex, colIndex, row){ - console.log(data, col, rowIndex, colIndex, row,"onRegentSubmit") + onYqSubmit(data){ + const {selectInfo,rowIndex,key} = data; + const {row} = selectInfo; + if(key === "bh"){//一起编号 + const params = { + mc: row.mc, + xh: row.xh, + jzrq: row.jzrq, + } + this.$refs.yqInfoTableRef.updateDataSourceByRowIndex(rowIndex, params); + } }, //获取已填写的表单数据 getFilledFormData() { diff --git a/src/views/business/comps/template/comps/sp/SP0021.vue b/src/views/business/comps/template/comps/sp/SP0021.vue index e1f475b..03b33ef 100644 --- a/src/views/business/comps/template/comps/sp/SP0021.vue +++ b/src/views/business/comps/template/comps/sp/SP0021.vue @@ -19,30 +19,26 @@
- {{ - $t('template.common.deleteBtn') - }} + {{ + $t('template.common.deleteBtn') + }}
- - 导入动物 - + + 导入动物 + - +
@@ -50,7 +46,8 @@ - + @@ -65,8 +62,8 @@ import Step from "@/components/Template/Step"; import templateMixin from "../../mixins/templateMixin"; import CustomTable from '@/components/Template/CustomTable.vue'; import { uniqeResource } from "@/utils/calUnitTools"; -import {getuuid,justUpdateFilledFormData} from "@/utils/index"; -import { getBaseInfoFormConfig, getStorageFormConfig, getRemarkFormConfig, getYbsmFormConfig,getTableColumns } from "../../formConfig/sp/SP0021"; +import { getuuid, justUpdateFilledFormData } from "@/utils/index"; +import { getBaseInfoFormConfig, getStorageFormConfig, getRemarkFormConfig, getYbsmFormConfig, getTableColumns } from "../../formConfig/sp/SP0021"; const refConfig = { baseInfoRef: "baseInfoRef", remarkRef: "remarkRef", @@ -78,7 +75,7 @@ const refConfig = { const compRefs = Object.values(refConfig); export default { name: "SP0021", - components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete,ImportExcelDialog }, + components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaionDelete, ImportExcelDialog }, mixins: [templateMixin], props: { fillType: { @@ -113,23 +110,24 @@ export default { }, }, data() { - return { - refConfig, - }; - }, + return { + refConfig, + currentIndex: -1, + }; + }, mounted() { - if(this.fillType === 'preFill' &&!this.formData.ybsmDataList){//预填的时候默认新增一个。 + if (this.fillType === 'preFill' && !this.formData.ybsmDataList) {//预填的时候默认新增一个。 this.onAdd() } }, methods: { //删除样本说明 - deleteConfig(item){ + deleteConfig(item) { // 确保 ybsmDataList 存在 if (this.formData.ybsmDataList.length > 1) { const configIndex = this.formData.ybsmDataList.findIndex(config => config.id === item.id); - console.log(configIndex,"configIndex") - if(configIndex>-1){ + console.log(configIndex, "configIndex") + if (configIndex > -1) { const newList = [...this.formData.ybsmDataList] newList.splice(configIndex, 1); this.$set(this.formData, 'ybsmDataList', newList); @@ -141,19 +139,19 @@ export default { } else { this.$message.warning('至少保留一个样本说明项'); } - + }, //新增样本说明 - onAdd(){ + onAdd() { if (!this.formData.ybsmDataList) { this.$set(this.formData, 'ybsmDataList', []); } - let defaultInfo = { + let defaultInfo = { id: getuuid(), stepData: [], } - if(this.fillType === "actFill"){ - const {ybsmDataList} = this.formData + if (this.fillType === "actFill") { + const { ybsmDataList } = this.formData defaultInfo.stepData = ybsmDataList[0]?.stepData || [] } // 添加新的平行配制配置 @@ -161,21 +159,29 @@ export default { }, onLoadExcelData(excelData) { const data = excelData.splice(1); + const transData = data.map((item)=>{ + return{ + dwbh: item[0], + id: getuuid(), + } + }) + this.$refs[`ybsmTableRef${this.currentIndex}`][0].pushDataSource(transData) this.$refs.ImportExcelDialog.cancel() setTimeout(() => { justUpdateFilledFormData(); }, 100); }, - downloadExcelTemplate(arr){ + downloadExcelTemplate(arr) { this.exportExcel(arr) }, // 导入动物 - onImportAnimal(){ + onImportAnimal(item, index) { + this.currentIndex = index; this.$refs.ImportExcelDialog.show() }, // 删除表格行 deleteTableRow(rowIndex, refName) { - this.$refs[refName].deleteRow(rowIndex) + this.$refs[refName][0].deleteRow(rowIndex) }, //获取已填写的表单数据 getFilledFormData() { @@ -202,18 +208,18 @@ export default { // 基础表单验证 let content = await this.validFormFields(compRefs); if (!content) return null; - + // 验证多个样本说明项 for (let index = 0; index < this.formData.ybsmDataList.length; index++) { // 验证样本说明表单 const ybsmFormValid = await this.$refs[`ybsmFormPackageRef${index}`][0]?.getFormData() || true; if (!ybsmFormValid) return null; - + // 验证步骤数据 const stepValid = await this.$refs[`stepRef${index}`][0]?.getFormData() || true; if (!stepValid) return null; } - + // 获取所有数据 return this.getFilledFormData(); }, @@ -272,6 +278,7 @@ export default { .print-btn { margin-bottom: 20px; } + .config-header { display: flex; justify-content: space-between; diff --git a/src/views/business/comps/template/formConfig/sp/SP0019.js b/src/views/business/comps/template/formConfig/sp/SP0019.js index a3d20f2..cf42240 100644 --- a/src/views/business/comps/template/formConfig/sp/SP0019.js +++ b/src/views/business/comps/template/formConfig/sp/SP0019.js @@ -43,19 +43,22 @@ export const getBaseInfoFormConfig = (formType) => { ] } -export const storageFormConfig = [ - { - type: 'step', - config: { - yqmxh: { - label: '色谱柱型号', - type: 'yq', - fillType: 'actFill', - filledCodes:['mc','bh'], - }, - } - }, -] +export const getStorageFormConfig = ($this)=>{ + return[ + { + type: 'step', + config: { + spzxh: { + label: '色谱柱型号', + type: 'select', + fillType: 'actFill', + options: $this.spzxhOptions, + filledCodes:['mc','bh'], + }, + } + }, + ] +} //仪器信息 export const getYqColumns = ($this) => {