diff --git a/src/utils/calUnitTools.js b/src/utils/calUnitTools.js index faa340f..3d82e64 100644 --- a/src/utils/calUnitTools.js +++ b/src/utils/calUnitTools.js @@ -182,3 +182,18 @@ export function uniqeResourceOne(newList) { } return resultList } +//仪器去重 +export function uniqeYqOne(newList) { + let resultList = [] + for (var i = 0; i < newList.length; i++) { + let _index = _.findIndex(resultList, function (item) { + return ( + item.bh == newList[i].bh + ) + }) + if (_index <0) { + resultList.push(newList[i]) + } + } + return resultList +} diff --git a/src/views/business/comps/template/comps/dl/DL003.vue b/src/views/business/comps/template/comps/dl/DL003.vue index a4026fe..ab43b6e 100644 --- a/src/views/business/comps/template/comps/dl/DL003.vue +++ b/src/views/business/comps/template/comps/dl/DL003.vue @@ -8,78 +8,42 @@
- + - +
- - + + :formData="{ stepTableFormData: formData.stepTableFormData_1, headerSelectFields: {} }" + :showHeaderSelect="fillType === 'actFill'" :prefixKey="`jzjzTable`">
- - + +
@@ -94,6 +58,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 { uniqeYqOne, uniqeResourceOne } from "@/utils/calUnitTools"; import moment from 'moment' const refConf = { @@ -135,7 +100,7 @@ export default { fillType: 'actFill', span: 1, placeholder: 'template.common.remarkPlaceholder', - maxlength: 1000, + maxlength: 1000, rows: 5 } } @@ -143,7 +108,7 @@ export default { ] }, mounted() { - + // if (this.fillType === "actFill") { // this.handleUpdateCode(formData); // } @@ -207,7 +172,7 @@ export default { } ] }, - + // 仪器使用信息 yqsyColumns() { return [ @@ -306,7 +271,7 @@ export default { subKey: 'pykssj', buttonName: 'template.dl.dl003.ksButton', }, - + } } ] @@ -319,7 +284,7 @@ export default { prop: "targetSolutionCode", bodyType: 'input', bodySubType: "span", - bodySubKey: "subTargetSolutionCode", + bodySubKey: "subTargetSolutionCode", myCodeFields: ["targetSolutionCode", "subTargetSolutionCode"],//分装的母液编号字段 bodyFillType: 'actFill' }, @@ -339,25 +304,25 @@ export default { label: 'template.dl.dl003.jzjrtj', prop: 'jzjrtj', headerSelectKey: "targetDiluentVolumeUnit", - headerOptions: this.getDictOptions('business_tjdw'), + headerOptions: this.getDictOptions('business_tjdw'), bodyType: 'inputNumber', - bodyMaxlength: 10, + bodyMaxlength: 10, bodyFillType: 'actFill', fillType: 'actFill', } // { - // label: "template.sp.sp003.ysmbrynd", - // prop: "targetSolutionConcentration", - // width: 210, - // showWidth: 120, - // headerSelectKey: "targetSolutionConcentrationUnit", - // fillType: "preFill", - // headerOptions: this.getDictOptions('business_nddw'), - // bodyType: "inputNumber", - // bodyFillType: "preFill", - // bodyMaxlength: 10, - // headerSelectTo:"actSolutionConcentrationUnit", - // }, + // label: "template.sp.sp003.ysmbrynd", + // prop: "targetSolutionConcentration", + // width: 210, + // showWidth: 120, + // headerSelectKey: "targetSolutionConcentrationUnit", + // fillType: "preFill", + // headerOptions: this.getDictOptions('business_nddw'), + // bodyType: "inputNumber", + // bodyFillType: "preFill", + // bodyMaxlength: 10, + // headerSelectTo:"actSolutionConcentrationUnit", + // }, ] }, }, @@ -379,7 +344,7 @@ export default { moment().format('YYYY/MM/DD HH:mm'), { isUpdateRecord: true, signData } ) - + }, // 获取已填写的表单数据 getFilledFormData() { @@ -394,11 +359,88 @@ export default { return await this.validFormFields(refNames) }, getResource() { - // const stepResource = this.$refs.yqsyTableRef.getStepResource() - // 使用的试剂、仪器 - // this.resourceTmp = stepResource.sjResource || [] - // this.yqResourceTmp = stepResource.yqResource || [] - // return this.resourceTmp + let content = this.getFilledFormData(); + //生成resource + let tmpResource = [] + let tmpYq = [] + if (this.fillType === "actFill") { + let header1 = content.headerSelectFields_1 + let table1 = content.stepTableFormData_1 + //细菌 + if (table1 && table1.length > 0) { + for (let i = 0; i < table1.length; i++) { + let item = table1[i] + //生成 + tmpResource.push({ + mc: '', + bh: item.targetSolutionCode + item.subTargetSolutionCode, + ph: '', + ndz: '', + nd: '', + nddw: '', + ly: 'ELN配制', + sxrq: null, + kc: item.jzjrtj + header1.targetDiluentVolumeUnit, + kcdw: header1.targetDiluentVolumeUnit, + syl: null, + type: null, //生成的时候传null + elnType: this.product, //生成的时候传 his.product + syldw: header1.targetDiluentVolumeUnit, + yxzq: null, + yxzqdw: null, + }) + //使用 1:试剂;3:给药制剂;5:麻精药;7:供试品 9:细胞;11:细菌 + tmpResource.push({ + mc: item.jzlymc, + bh: item.jzlybh, + ph: '', + ndz: '', + nd: '', + nddw: '', + ly: '', + sxrq: null, + kc: null, + kcdw: null, + syl: item.jzlytj, + type: 9, //使用的时候传对应的值 + elnType: null, //传null + syldw: header1.targetDiluentVolumeUnit, + yxzq: null, + yxzqdw: null, + }) + } + } + //仪器 + let table = content.stepTableFormData + if (table && table.length > 0) { + for (let i = 0; i < table.length; i++) { + let item = table[i] + tmpYq.push({ + mc: item.yqmc, + xh: item.yqxh, + bh: item.yqbh, + jzrq: item.jzrq, + }) + } + } + tmpYq.push({ + mc: content.pykssjmc, + xh: content.pykssjxh, + bh: content.fssygbh, + jzrq: content.pykssjjzrq, + }) + tmpYq.push({ + mc: content.pyxmc, + xh: content.pyxxh, + bh: content.pyx, + jzrq: content.pyxjzrq, + }) + this.yqResourceTmp = tmpYq + } + //使用的试剂,仪器 + this.yqResourceTmp = uniqeYqOne(tmpYq) + this.resourceTmp = uniqeResourceOne(tmpResource) + return this.resourceTmp; }, onRegentSubmit(e) { const { selectInfo, key, rowIndex } = e @@ -415,13 +457,26 @@ export default { if (key === 'qxbd') { this.$refs.czInfoRef.updateFormData('pykssj', row.startDate) } + if (key == 'fssygbh') { + this.$refs.czInfoRef.updateFormData('pykssjmc', row.mc) + this.$refs.czInfoRef.updateFormData('pykssjxh', row.xh) + this.$refs.czInfoRef.updateFormData('pykssjjzrq', row.jzrq) + } + if (key == 'pyx') { + this.$refs.czInfoRef.updateFormData('pyxmc', row.mc) + this.$refs.czInfoRef.updateFormData('pyxxh', row.xh) + this.$refs.czInfoRef.updateFormData('pyxjzrq', row.jzrq) + } + if (key == 'jzlybh') { + this.$refs['jzjzTableRef'].updateDataSourceByRowIndex(rowIndex, { jzlymc: row.mc, jzlytj: row.tj, jzlytjdw: row.tjdw }) + } }, // 保存 async onSave() { const formData = this.getStepResource() console.log(formData, 'formData') }, - //处理table失焦事件 + //处理table失焦事件 async operateBlur(params) { let isGeneratingSubCode = false; const { dataSource = [], rowIndex } = params; // 重点:接收当前行索引rowIndex @@ -448,9 +503,9 @@ export default { isGeneratingSubCode = true; // 5. 调用接口生成子码(仅传当前行的参数) - const subCode = await this.getLatestSnArr([{ - pre: currentItem.targetSolutionCode, - type: 1 + const subCode = await this.getLatestSnArr([{ + pre: currentItem.targetSolutionCode, + type: 1 }]); // 6. 赋值到当前行(兼容接口返回空的情况) @@ -469,20 +524,20 @@ export default { } } //选择table header下拉框也要更新体积 - // onHeaderSelectChange(data){ - // const {key, headerSelectFields,dataSource=[]} = data; - // const keys = [ - // 'targetDiluentVolumeUnit', - // ] - // if(keys.includes(key)){ - // const {targetStartSolution,subTargetStartSolution} = this.$refs.stepFormPackageRef?.getFilledFormData(); - // const params = { - // subTargetStartSolution, - // headerSelectFields - // } - // this.batchUpdateTargetStartSolutionVolume(dataSource,targetStartSolution,params) - // } - // }, + // onHeaderSelectChange(data){ + // const {key, headerSelectFields,dataSource=[]} = data; + // const keys = [ + // 'targetDiluentVolumeUnit', + // ] + // if(keys.includes(key)){ + // const {targetStartSolution,subTargetStartSolution} = this.$refs.stepFormPackageRef?.getFilledFormData(); + // const params = { + // subTargetStartSolution, + // headerSelectFields + // } + // this.batchUpdateTargetStartSolutionVolume(dataSource,targetStartSolution,params) + // } + // }, } } @@ -494,6 +549,7 @@ export default { .print-btn { margin-bottom: 20px; } + .config-header-end { display: flex; justify-content: flex-end;