diff --git a/src/lang/zh/template/dl.js b/src/lang/zh/template/dl.js index 7a84046..c763d74 100644 --- a/src/lang/zh/template/dl.js +++ b/src/lang/zh/template/dl.js @@ -197,7 +197,9 @@ export default { zxg: '左下格(个)', yxg: '右下格(个)', cdxxTime: '第{index}次', - addCdxx: '新增' + addCdxx: '新增', + yqsyxxEmpty: '仪器使用信息不能为空,请添加后再提交', + cdxxEmpty: '测定信息不能为空,请添加后再提交' }, dl014: { ...common, @@ -224,7 +226,8 @@ export default { sjgspjrl: '实际供试品加入量', gyhzqk: '给药后状态情况', qrButton: '确认', - wcButton: '完成' + wcButton: '完成', + yqsyxxEmpty: '仪器使用信息不能为空,请添加后再提交' }, dl015: { ...common, diff --git a/src/views/business/comps/template/comps/dl/DL009.vue b/src/views/business/comps/template/comps/dl/DL009.vue index 9c700fc..0b4ab87 100644 --- a/src/views/business/comps/template/comps/dl/DL009.vue +++ b/src/views/business/comps/template/comps/dl/DL009.vue @@ -500,7 +500,14 @@ export default { // 获取填写完成的表单数据 async getFormData() { // 先执行自定义校验(包括表格非空校验) - return await this.validFields() + const validResult = await this.validFields() + + // 如果校验通过,返回完整的表单数据(包括 headerSelectFields) + if (validResult) { + return this.getFilledFormData() + } + + return validResult }, // 只做校验 async validFields() { diff --git a/src/views/business/comps/template/comps/dl/DL010.vue b/src/views/business/comps/template/comps/dl/DL010.vue index ea59807..a8414ba 100644 --- a/src/views/business/comps/template/comps/dl/DL010.vue +++ b/src/views/business/comps/template/comps/dl/DL010.vue @@ -19,7 +19,7 @@ { + // 实际0.9%氯化钠注射液加入量 + if (item.sjlhnzsjyjrl) { + sjxxResource.push({ + mc: '0.9%氯化钠注射液', // 名称 + bh: null, // 编号 + ph: null, // 批号 + nd: null, // 浓度 + nddw: null, // 浓度单位 + ndz: null, // 浓度值 + ly: null, // 来源 + sxrq: null, // 失效日期 + kc: null, // 库存 + kcdw: null, // 库存单位 + type: 1, // 类型:1表示使用的资源 + syl: item.sjlhnzsjyjrl, // 使用量 + syldw: headerSelectFields.sjlhnUnit || '', // 使用量单位 + yxzq: null, // 有效期 + yxzqdw: null // 有效期单位 + }) + } + + // 实际加入血清 + if (item.sjjrxq) { + sjxxResource.push({ + mc: '血清', // 名称 + bh: null, // 编号 + ph: null, // 批号 + nd: null, // 浓度 + nddw: null, // 浓度单位 + ndz: null, // 浓度值 + ly: null, // 来源 + sxrq: null, // 失效日期 + kc: null, // 库存 + kcdw: null, // 库存单位 + type: 1, // 类型:1表示使用的资源 + syl: item.sjjrxq, // 使用量 + syldw: headerSelectFields.sjjrxqUnit || '', // 使用量单位 + yxzq: null, // 有效期 + yxzqdw: null // 有效期单位 + }) + } + }) + + // 将采集信息数据添加到资源列表中 + return [...this.resourceTmp, ...sjxxResource] }, onRegentSubmit(e) { // 预留方法,如果需要处理试剂提交事件可以在这里添加 diff --git a/src/views/business/comps/template/comps/dl/DL011.vue b/src/views/business/comps/template/comps/dl/DL011.vue index 963500c..f0c354b 100644 --- a/src/views/business/comps/template/comps/dl/DL011.vue +++ b/src/views/business/comps/template/comps/dl/DL011.vue @@ -19,7 +19,7 @@ @@ -80,6 +81,7 @@ import LineLabel from '@/components/Template/LineLabel' import TableList from '@/components/Template/Table' import Step from '@/components/Template/Step' import templateMixin from '../../mixins/templateMixin' +import moment from 'moment' const refConf = { base: 'baseInfoRef', @@ -270,6 +272,14 @@ export default { } }, methods: { + // 处理培养信息中按钮点击事件 + handlePyxxClickButton(_item, signData) { + this.$refs.pyxxRef.updateFormData( + 'pykssj', + moment().format('YYYY-MM-DD HH:mm:ss'), + { isUpdateRecord: true, signData } + ) + }, // 删除表格行 deleteTableRow(rowIndex, refName) { this.$refs[refName].deleteRow(rowIndex) @@ -288,9 +298,45 @@ export default { }, getResource() { const stepResource = this.$refs.stepRef.getStepResource() - // 使用的试剂、仪器 + // 使用的试剂、仪器(来自复苏步骤) this.resourceTmp = stepResource.sjResource || [] - this.yqResourceTmp = stepResource.yqResource || [] + this.yqResourceTmp = [...(stepResource.yqResource || [])] + + // 获取细胞信息 + const xbxxData = this.$refs.xbxxRef?.getFilledFormData() || {} + + // 如果选择了细胞冻存编号,添加到细胞细菌信息中 + if (xbxxData.xbdcbh) { + const xbInfo = xbxxData.selectInfo_xbdcbh || {} + // 细胞信息格式:不包含 type 字段(参考 StepFormPackage 中 xb 类型的处理) + this.xbxjTmp = [{ + value: xbxxData.xbdcbh, + bh: xbInfo.bh || xbxxData.xbdcbh, + mc: xbInfo.mc || '', + xh: xbInfo.xh || '', + jzrq: xbInfo.jzrq || '' + }] + } else { + this.xbxjTmp = [] + } + + // 获取培养信息 + const pyxxData = this.$refs.pyxxRef?.getFilledFormData() || {} + + // 如果选择了培养箱编号,添加到仪器信息中 + if (pyxxData.pyxbh) { + const pyxInfo = pyxxData.selectInfo_pyxbh || {} + // 仪器信息格式:包含 type 字段(参考 StepFormPackage 中 yq 类型的处理) + this.yqResourceTmp.push({ + type: 'yq', + value: pyxxData.pyxbh, + bh: pyxInfo.bh || pyxxData.pyxbh, + mc: pyxInfo.mc || '', + xh: pyxInfo.xh || '', + jzrq: pyxInfo.jzrq || '' + }) + } + return this.resourceTmp }, onRegentSubmit(e) { diff --git a/src/views/business/comps/template/comps/dl/DL012.vue b/src/views/business/comps/template/comps/dl/DL012.vue index 3208257..ea9538f 100644 --- a/src/views/business/comps/template/comps/dl/DL012.vue +++ b/src/views/business/comps/template/comps/dl/DL012.vue @@ -19,7 +19,7 @@ item.yqbh) + .map((item) => ({ + type: 'yq', + value: item.yqbh, + bh: item.yqbh, + mc: item.yqmc, + xh: item.yqxh, + jzrq: item.xccsjzjdrq + })) + + this.resourceTmp = [] return this.resourceTmp }, onRegentSubmit(e) { diff --git a/src/views/business/comps/template/comps/dl/DL014.vue b/src/views/business/comps/template/comps/dl/DL014.vue index 31e7488..8a0fc44 100644 --- a/src/views/business/comps/template/comps/dl/DL014.vue +++ b/src/views/business/comps/template/comps/dl/DL014.vue @@ -580,6 +580,16 @@ export default { }, // 获取填写完成的表单数据 async getFormData() { + // 1. 校验仪器使用信息表格是否为空 + const yqsyTableRef = this.$refs[refConf.yqsy] + const yqsyTableData = yqsyTableRef?.getDataSource() || [] + + if (yqsyTableData.length === 0) { + this.$message.warning(this.$t('template.dl.dl014.yqsyxxEmpty')) + return Promise.reject(this.$t('template.dl.dl014.yqsyxxEmpty')) + } + + // 2. 执行其他表单字段校验 const refsToValidate = [ refConf.base, refConf.yqsy, @@ -661,27 +671,94 @@ export default { this.yqResourceTmp = yqsyList .filter((item) => item.yqbh) .map((item) => ({ + type: 'yq', bh: item.yqbh, mc: item.yqmc, - xh: item.yqxh + xh: item.yqxh, + jzrq: item.jzrq })) - // 从剂量组表格中提取试剂资源(如果有 S9混合液编号或细胞编号) + // 从剂量组配制信息中提取S9混合液编号(如果有) + const jlzInfoData = this.$refs.jlzInfoRef?.getFilledFormData() + const resourceList = [] + + // 如果添加了S9混合液,提取S9混合液编号 + if (this.isSftjs9Yes && jlzInfoData?.s9hhybh) { + resourceList.push({ + mc: 'S9混合液', + bh: jlzInfoData.s9hhybh, + ph: null, + nd: null, + nddw: null, + ndz: null, + ly: null, + sxrq: null, + kc: null, + kcdw: null, + type: 1, + syl: null, + syldw: null, + yxzq: null, + yxzqdw: null + }) + } + + // 从剂量组表格中提取试剂资源(细胞悬液编号、供试品编号) const jlzData = this.$refs.jlzTableRef?.getFilledFormData() const jlzList = jlzData?.stepTableFormData || [] + const jlzHeaderSelectFields = jlzData?.headerSelectFields || {} + + // 用于去重的Set + const xybhSet = new Set() + const gspbhSet = new Set() - const sjResourceFromJlz = [] jlzList.forEach((item) => { - // 如果有细胞编号,添加到试剂资源 - if (item.xybh) { - sjResourceFromJlz.push({ + // 提取细胞悬液编号 + if (item.xybh && !xybhSet.has(item.xybh)) { + xybhSet.add(item.xybh) + resourceList.push({ + mc: '细胞悬液', bh: item.xybh, - type: 'cell' + ph: null, + nd: null, + nddw: null, + ndz: null, + ly: null, + sxrq: null, + kc: null, + kcdw: null, + type: 1, + syl: item.sjplyjrl || null, + syldw: jlzHeaderSelectFields.ysplyjrlUnit || null, + yxzq: null, + yxzqdw: null + }) + } + + // 提取供试品编号 + if (item.gspbh && !gspbhSet.has(item.gspbh)) { + gspbhSet.add(item.gspbh) + resourceList.push({ + mc: '供试品', + bh: item.gspbh, + ph: null, + nd: null, + nddw: null, + ndz: null, + ly: null, + sxrq: null, + kc: null, + kcdw: null, + type: 1, + syl: item.sjgspjrl || null, + syldw: jlzHeaderSelectFields.ysgspjrlUnit || null, + yxzq: null, + yxzqdw: null }) } }) - this.resourceTmp = sjResourceFromJlz + this.resourceTmp = resourceList return this.resourceTmp }, diff --git a/src/views/business/comps/template/comps/dl/DL015.vue b/src/views/business/comps/template/comps/dl/DL015.vue index 49623f4..46f943e 100644 --- a/src/views/business/comps/template/comps/dl/DL015.vue +++ b/src/views/business/comps/template/comps/dl/DL015.vue @@ -16,7 +16,7 @@ :formData="formData" /> - + @@ -103,8 +103,8 @@ export default { // 换液情况表格数据 hyqkFormData() { return { - stepTableFormData: this.formData.hyqkTableData || [], - headerSelectFields: {} + stepTableFormData: this.formData.stepTableFormData || [], + headerSelectFields: this.formData.headerSelectFields || {} } }, // 备注表单配置 @@ -291,10 +291,11 @@ export default { getFilledFormData() { const baseData = this.getFilledFormDataByRefs(refNames) - // 确保换液情况数据被正确保存 + // 确保换液情况数据被正确保存到 stepTableFormData const hyqkData = this.$refs[refConf.hyqk]?.getFilledFormData() if (hyqkData) { - baseData.hyqkTableData = hyqkData.stepTableFormData || [] + baseData.stepTableFormData = hyqkData.stepTableFormData || [] + baseData.headerSelectFields = hyqkData.headerSelectFields || {} } return baseData @@ -317,12 +318,32 @@ export default { this.yqResourceTmp = stepResource.yqResource || [] // 从换液情况表格中提取悬液编号作为试剂资源 - const sjResourceFromHyqk = hyqkList - .filter(item => item.xybh) - .map(item => ({ - bh: item.xybh, - type: 'cell' - })) + // 用于去重的Set + const xybhSet = new Set() + const sjResourceFromHyqk = [] + + hyqkList.forEach((item) => { + if (item.xybh && !xybhSet.has(item.xybh)) { + xybhSet.add(item.xybh) + sjResourceFromHyqk.push({ + mc: '细胞悬液', + bh: item.xybh, + ph: null, + nd: null, + nddw: null, + ndz: null, + ly: null, + sxrq: null, + kc: null, + kcdw: null, + type: 1, + syl: item.pyybrl || null, + syldw: item.pyybrl ? 'mL' : null, + yxzq: null, + yxzqdw: null + }) + } + }) this.resourceTmp = [...this.resourceTmp, ...sjResourceFromHyqk] @@ -343,7 +364,7 @@ export default { if (jlzTableData.length === 0) { // 清空当前的换液情况列表数据 - this.$set(this.formData, 'hyqkTableData', []) + this.$set(this.formData, 'stepTableFormData', []) this.$message.warning('前序表单中没有剂量组数据') return } @@ -361,13 +382,13 @@ export default { })) // 使用 $set 更新 formData,触发 CustomTable 的响应式更新 - this.$set(this.formData, 'hyqkTableData', hyqkData) + this.$set(this.formData, 'stepTableFormData', hyqkData) this.$message.success(`已从前序表单加载 ${hyqkData.length} 条剂量组数据`) } catch (error) { console.error('解析前序表单数据失败:', error) // 解析失败时也清空当前的换液情况列表数据 - this.$set(this.formData, 'hyqkTableData', []) + this.$set(this.formData, 'stepTableFormData', []) this.$message.error('解析前序表单数据失败') } } diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index 3d17358..d025db7 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -58,6 +58,7 @@ export default { 'business_dwzs', // 动物种属 'business_cjdd', // 采集地点 'business_zpdd', // 制片地点 + 'business_cjbw', // 制片部位 ], props: { templateData: {