luojie 3 months ago
parent
commit
1ffba74daf
9 changed files with 1077 additions and 630 deletions
  1. +22
    -22
      src/lang/en/template/commonTemplate.js
  2. +5
    -0
      src/lang/en/template/sp.js
  3. +4
    -0
      src/lang/zh/template/sp.js
  4. +4
    -1
      src/views/business/comps/template/TemplateTable.vue
  5. +373
    -0
      src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/QXWDX.vue
  6. +1
    -1
      src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/ZQDYJMD.vue
  7. +1
    -1
      src/views/business/comps/template/formConfig/SWYPFXFFXYPZBBTableConfig.js
  8. +511
    -513
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
  9. +156
    -92
      src/views/business/comps/template/mixins/templateMixin.js

+ 22
- 22
src/lang/en/template/commonTemplate.js View File

@ -3,33 +3,33 @@ export default {
pageTitle: 'Biological Sample Analysis Solution Preparation Table', pageTitle: 'Biological Sample Analysis Solution Preparation Table',
// 标签 // 标签
baseInfo: 'Test Basic Information',
baseInfo: 'Study Basic Information',
reagentInfo: 'Test Reagent Information', reagentInfo: 'Test Reagent Information',
instrumentInfo: 'Instrument Usage Information',
instrumentInfo: 'Instrument Usage',
storageCondition: 'Storage Conditions', storageCondition: 'Storage Conditions',
operationSteps: 'Operation Steps',
remark: 'Remarks',
operationSteps: 'Operation Workflow',
remark: 'Comments',
// 字段标签 // 字段标签
storageConditionLabel: 'Storage Conditions',
testName: 'Test Name',
testNumber: 'Test Number',
methodCode: 'Method Code',
versionNumber: 'Version Number',
testConfigurationConditions: 'Test Configuration Conditions',
preFill: 'Pre-Fill',
storageConditionLabel: 'Storage Condition',
testName: 'Study Name',
testNumber: 'Study Number',
methodCode: 'Method Number',
versionNumber: 'Version',
testConfigurationConditions: 'Work Condition',
preFill: 'Preset',
actualFill: 'Actual', actualFill: 'Actual',
configurationTime: 'Configuration Time',
configurationTime: 'Work Time',
startTime: 'Start Time', startTime: 'Start Time',
endTime: 'End Time', endTime: 'End Time',
targetSolutionName: 'Target Solution Name', targetSolutionName: 'Target Solution Name',
targetSolutionCode: 'Target Solution Code',
targetPreConcentration: 'Target Solution Expected Concentration',
targetActConcentration: 'Target Solution Actual Concentration',
targetPreVolume: 'Target Solution Expected Volume',
targetActVolume: 'Target Solution Actual Volume',
effectivePeriod: 'Effective Period',
expireDate: 'Expiry Date',
targetSolutionCode: 'Target Solution ID',
targetPreConcentration: 'Expected Concentration of Target Solution',
targetActConcentration: 'Actual Concentration of Target Solution',
targetPreVolume: 'Expected Volume of Target Solution',
targetActVolume: 'Actual Volume of Target Solution',
effectivePeriod: 'Validity Period',
expireDate: 'Expiration Date',
// 占位符 // 占位符
remarkPlaceholder: 'Please enter remarks', remarkPlaceholder: 'Please enter remarks',
@ -42,16 +42,16 @@ export default {
// 试剂信息列 // 试剂信息列
reagentName: 'Reagent Name', reagentName: 'Reagent Name',
reagentCode: 'Code',
reagentCode: 'Item Number',
reagentNo: 'Batch Number', reagentNo: 'Batch Number',
concentration: 'Concentration/Content/Purity', concentration: 'Concentration/Content/Purity',
source: 'Source', source: 'Source',
reagentExpireDate: 'Expiry Date',
reagentExpireDate: 'Expiration Date',
// 仪器使用信息列 // 仪器使用信息列
instrumentName: 'Instrument Name', instrumentName: 'Instrument Name',
instrumentModel: 'Instrument Model', instrumentModel: 'Instrument Model',
instrumentCode: 'Instrument Number',
instrumentCode: 'Instrument ID',
nextTestDate: 'Next Test/Calibration/Verification Date', nextTestDate: 'Next Test/Calibration/Verification Date',
// 试验物质配制计划列 // 试验物质配制计划列

+ 5
- 0
src/lang/en/template/sp.js View File

@ -16,5 +16,10 @@ export default {
yjjzxql: 'Expected Blank Substrate Extraction Volume', yjjzxql: 'Expected Blank Substrate Extraction Volume',
sjjzxql: 'Actual Blank Substrate Extraction Volume', sjjzxql: 'Actual Blank Substrate Extraction Volume',
hhwznd: 'Target Solution Concentration' hhwznd: 'Target Solution Concentration'
},
//生物样品分析方法学样品制备表(全血稳定)
sp010: {
title:
'Bioanalytical Methods Sample Preparation Record (Whole Blood Stability)'
} }
} }

+ 4
- 0
src/lang/zh/template/sp.js View File

@ -15,5 +15,9 @@ export default {
yjjzxql: '预计基质吸取量', yjjzxql: '预计基质吸取量',
sjjzxql: '实际基质吸取量', sjjzxql: '实际基质吸取量',
hhwznd: '化合物终浓度' hhwznd: '化合物终浓度'
},
//生物样品分析方法学样品制备表(全血稳定)
sp010: {
title: '生物样品分析方法学样品制备表(全血稳定)'
} }
} }

+ 4
- 1
src/views/business/comps/template/TemplateTable.vue View File

@ -15,7 +15,9 @@ import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue"; import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue";
import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue"; import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue";
import SWYPNBGZYZBB from "./comps/sp/SWYPNBGZYZBB.vue"; import SWYPNBGZYZBB from "./comps/sp/SWYPNBGZYZBB.vue";
//-10
import ZQDYJMD from "./comps/sp/SWYPFXFFXYPZBB/ZQDYJMD.vue"; import ZQDYJMD from "./comps/sp/SWYPFXFFXYPZBB/ZQDYJMD.vue";
import QXWDX from "./comps/sp/SWYPFXFFXYPZBB/QXWDX.vue";
import Demo from "./comps/sp/Demo.vue"; import Demo from "./comps/sp/Demo.vue";
// //
import SYWZPZJHB from "./comps/gy/SYWZPZJHB.vue"; import SYWZPZJHB from "./comps/gy/SYWZPZJHB.vue";
@ -25,7 +27,7 @@ export default {
name: "TemplateTable", name: "TemplateTable",
components: { components: {
MJYLQSQD, SYWZPZJHB, MJYLQSQD, SYWZPZJHB,
SP001, SWYPFXRYPZB, Demo, SWYPFXCBYPZB, SWYPBQGZYZBB, SWYPNBGZYZBB,ZQDYJMD
SP001, SWYPFXRYPZB, Demo, SWYPFXCBYPZB, SWYPBQGZYZBB, SWYPNBGZYZBB,ZQDYJMD,QXWDX
}, },
props: { props: {
sn: { sn: {
@ -55,6 +57,7 @@ export default {
'SP003': 'SWYPBQGZYZBB', 'SP003': 'SWYPBQGZYZBB',
'SP004': 'SWYPNBGZYZBB', 'SP004': 'SWYPNBGZYZBB',
'SP008': 'ZQDYJMD', 'SP008': 'ZQDYJMD',
'SP010': 'QXWDX',
'SYWZPZJHB': 'SYWZPZJHB', 'SYWZPZJHB': 'SYWZPZJHB',
'MJYLQSQD': 'MJYLQSQD', 'MJYLQSQD': 'MJYLQSQD',
} }

+ 373
- 0
src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/QXWDX.vue View File

@ -0,0 +1,373 @@
<!-- 生物样品分析方法学样品制备表-全血稳定性 -->
<template>
<div>
<div class="detail-container">
<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ formData.templateMc ||
$t('template.sp.sp010.title') }}<img src="@/assets/images/detail-title.png" /></div>
<div class="detail-content">
<div class="content">
<BaseInfoFormPcakge 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="yqsColumns"
:dataSource="resource" />
<BaseInfoFormPcakge fieldItemLabel="template.common.storageCondition" label="template.common.storageCondition" ref="storageConditionRef"
:formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" />
<div class="template-form-item">
<BaseInfoFormPcakge fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef" :formConfig="stepFormConfig"
:formData="formData" @clickable="handleJzClickable" />
<CustomTable
@blur="onHandleTableBlur"
:ref="`tableRef`"
:columns="tableStepColumns"
:formData="formData"
:prefixKey = "`table`"
@clickable="handleClickable"
fieldItemLabel = "template.common.operationSteps"
>
<template slot="operation" slot-scope="{ row, rowIndex}">
<TableOpertaion
:fillType="fillType"
:row="row"
:rowIndex="rowIndex"
@deleteRow="(rowIndex) => deleteRow(rowIndex)"
></TableOpertaion>
</template>
</CustomTable>
</div>
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPcakge fieldItemLabel="template.common.remark" label="template.common.remark" ref="remarkRef" :formConfig="remarkConig"
:formData="formData" />
</div>
</div>
</div>
<!-- <button @click = "onSave">保存</button> -->
<SelectReagentDialog
@submit="onSelectReagentSubmit"
ref="selectReagentDialogRef" >
</SelectReagentDialog>
</div>
</template>
<script>
import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge";
import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step";
import templateMixin from "../../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue';
import { getLatestSn } from '@/api/template';
import {getSWYPFXFFXYPZBBTableConfig} from "../../../formConfig/SWYPFXFFXYPZBBTableConfig.js";
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"
import SelectReagentDialog from '../../../dialog/SelectReagentDialog.vue';
export default {
name: "QXWDX",
components: { BaseInfoFormPcakge, LineLabel, TableList, Step, CustomTable,TableOpertaion,SelectReagentDialog },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
},
computed: {
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,
},
methodCode: {
label: 'template.common.methodCode',
type: "input",
fillType: "preFill",
maxlength: 50
},
versionNum: {
label: 'template.common.versionNumber',
type: "input",
fillType: "actFill",
maxlength: 50
},
//
clpbg: {
label: 'template.sp.sp008.clpbh',
type: "input",
fillType: "actFill",
maxlength: 50
},
}
},
{
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.sp.sp008.rqcz',
config: {
rqcz: {
type: "select",
multiple: true,
fillType: "actFill",
options: this.getDictOptions('business_rqcz'),
otherCode: "rqczOther",
},
}
},
{
type: "cellItem",
label: 'template.sp.sp008.clsj',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
},
stepFormConfig() {
return [
{
type: "step",
config: {
jz: {
label: 'template.sp.sp008.xzjz',
type: "input",
fillType: "preFill",
subType: "clickable",
subKey: "subJz",
subFillType: "actFill",
maxlength: 20,
},
}
}
]
},
tableStepColumns() {
return getSWYPFXFFXYPZBBTableConfig(this);
},
},
data() {
return {
reagentType: "",//12
currentSubKey: "",//key
rowIndex:0,//
resource: [],
sysjColumns: [
{ label: 'template.common.reagentName', prop: "mc" },//
{ label: 'template.common.reagentCode', prop: "bh" },//
{ label: 'template.common.reagentNo', prop: "ph" },//
{ label: 'template.common.concentration', prop: "nd" },//
{ label: 'template.common.source', prop: "source" },//
{ label: 'template.common.reagentExpireDate', prop: "sxrq" },//
],
yqsColumns: [
{ label: 'template.common.instrumentName', prop: "instrumentName" },
{ label: 'template.common.instrumentModel', prop: "instrumentModel" },
{ label: 'template.common.instrumentCode', prop: "instrumentCode" },
{ label: 'template.common.nextTestDate', prop: "nextTestDate" },
],
formData: {}
};
},
mounted() {
},
watch: {
formData: {
immediate: true,
handler(v) {
if(this.fillType === "actFill"){
this.getCode(v);
}
}
}
},
methods: {
//
handleJzClickable(obj){
this.reagentType = 1//
this.currentSubKey = obj.subKey;
this.$refs.selectReagentDialogRef.show()
},
//
onSelectReagentSubmit(code,row){
if(this.reagentType===1){
this.$refs.stepFormPackageRef.updateFormData(this.currentSubKey, code);
}else{
this.$refs.tableRef.updateDataSourceByRowIndex(this.rowIndex,{
[this.currentSubKey]: code,
})
}
this.$refs.selectReagentDialogRef.onCancel()
},
//
handleClickable(col, rowIndex) {
//
this.reagentType = 2
this.rowIndex = rowIndex
this.currentSubKey = col.prop;
console.log("clickable",rowIndex, col)
if(col.prop === "sjry"){
//-
this.$refs.selectReagentDialogRef.show()
}
},
//
async getCode(v){
const {stepTableFormData = []} = v;
if(stepTableFormData && stepTableFormData.length>0 && !stepTableFormData[0].bhCode){
const result = await getLatestSn({
count: stepTableFormData.length,
})
if(result.code == 200){
if(stepTableFormData.length===0){
this.$refs.tableRef.updateDataSourceByRowIndex(0,{
[bhCode]: result.data,
})
}else{
for(let i=0;i<stepTableFormData.length;i++){
this.$refs.tableRef.updateDataSourceByRowIndex(i,{
bhCode: result.data[i],
})
}
}
}
}
},
//
getFilledFormData(){
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "tableRef","stepRef", "remarkRef"])
},
async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef","tableRef" ,"stepRef", "remarkRef"]);
//resource
let tmpResource = []
let tableList = content.stepTableFormData
for(let i=0;i<tableList.length;i++){
//
let item = tableList[i]
tmpResource.push({
mc: null,
bh: item.bh+item.bhCode,
ph: null,
nd: item.hhwznd + content.headerSelectFields.hhwzndUnit,
source: 'ELN配制',
sxrq: null,
ndz: item.hhwznd,
nddw: content.headerSelectFields.hhwzndUnit,
kc: item.sjjzxql+item.sjryxql,//todo -
kcdw: content.headerSelectFields.sjryxqlUnit || content.headerSelectFields.sjjzxqlUnit,//todo --
syl: null,
syldw:content.headerSelectFields.sjryxqlUnit || content.headerSelectFields.sjjzxqlUnit,//todo --,
yxzq:null,
yxzqdw:null,
})
}
//使
this.resource=tmpResource
return content;
},
async onSave() {
const formData = await this.getFilledFormData();
console.log(formData, "formData")
},
//
deleteRow(rowIndex) {
const tableRef = this.$refs['tableRef'];
if (tableRef) {
tableRef.deleteRow(rowIndex);
}
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
margin-top: 20px;
}
</style>

+ 1
- 1
src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/ZQDYJMD.vue View File

@ -16,7 +16,7 @@
:formConfig="storageFormConfig" :formData="formData" /> :formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" /> <LineLabel label="template.common.operationSteps" />
<div class="template-form-item"> <div class="template-form-item">
<BaseInfoFormPcakge fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef" :formConfig="stepFormConfig" @blur="onHandleBlur"
<BaseInfoFormPcakge fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef" :formConfig="stepFormConfig"
:formData="formData" @clickable="handleJzClickable" /> :formData="formData" @clickable="handleJzClickable" />
<CustomTable <CustomTable

+ 1
- 1
src/views/business/comps/template/formConfig/SWYPFXFFXYPZBBTableConfig.js View File

@ -5,7 +5,7 @@ export const getSWYPFXFFXYPZBBTableConfig = ($this) => {
label: 'template.sp.sp008.bh', label: 'template.sp.sp008.bh',
prop: 'bh', prop: 'bh',
bodyType: 'select', bodyType: 'select',
bodyOptions: $this.getDictOptions('business_jmdyzqdyp'),
bodyOptions: $this.getDictOptions('business_sp_jmdyzqdyp'),
bodySubType: 'span', bodySubType: 'span',
bodySubKey: 'bhCode', bodySubKey: 'bhCode',
bodyFillType: 'preFill', bodyFillType: 'preFill',

+ 511
- 513
src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
File diff suppressed because it is too large
View File


+ 156
- 92
src/views/business/comps/template/mixins/templateMixin.js View File

@ -1,11 +1,19 @@
import moment from "moment";
import moment from 'moment'
export default { export default {
dicts: ['business_pztj', 'business_cctj', 'business_nddw', 'business_tjdw', 'business_yxqdw', 'business_rqcz', 'business_jmdyzqdyp'],
dicts: [
'business_pztj',
'business_cctj',
'business_nddw',
'business_tjdw',
'business_yxqdw',
'business_rqcz',
'business_sp_jmdyzqdyp'
],
props: { props: {
templateData: { templateData: {
type: Object, type: Object,
default: () => { },
},
default: () => {}
}
}, },
watch: { watch: {
templateData: { templateData: {
@ -14,23 +22,48 @@ export default {
handler(v) { handler(v) {
if (v) { if (v) {
const { const {
studyMc,studySn,templateMc,templateMcEn,templateSn,startDate,endDate,
} = v;
if (v.resource) {//试验试剂信息
this.resource = JSON.parse(v.resource);
studyMc,
studySn,
templateMc,
templateMcEn,
templateSn,
startDate,
endDate
} = v
if (v.resource) {
//试验试剂信息
this.resource = JSON.parse(v.resource)
} }
if (v.bdnr) { if (v.bdnr) {
this.formData = { ...JSON.parse(v.bdnr), studyMc,studySn,templateMc,templateMcEn,templateSn,startDate,endDate, };
this.formData = {
...JSON.parse(v.bdnr),
studyMc,
studySn,
templateMc,
templateMcEn,
templateSn,
startDate,
endDate
}
} }
const { effectivePeriod, effectivePeriodUnit, expireDate } = this.formData;
const { effectivePeriod, effectivePeriodUnit, expireDate } =
this.formData
//实际填报的时候,如果有了开始时间,并且有有效周期,但是没有失效日,就计算失效日为开始时间+有效周期 //实际填报的时候,如果有了开始时间,并且有有效周期,但是没有失效日,就计算失效日为开始时间+有效周期
if (startDate && this.fillType === "actFill" && effectivePeriod && effectivePeriodUnit && !expireDate) {
const start = moment(startDate);
const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss");
this.formData = { ...this.formData, expireDate: end };
if (
startDate &&
this.fillType === 'actFill' &&
effectivePeriod &&
effectivePeriodUnit &&
!expireDate
) {
const start = moment(startDate)
const end = start
.add(Number(effectivePeriod), effectivePeriodUnit)
.format('YYYY-MM-DD HH:mm:ss')
this.formData = { ...this.formData, expireDate: end }
} }
console.log(this.formData, "formData from templateData")
this.setTemplateData(v);
console.log(this.formData, 'formData from templateData')
this.setTemplateData(v)
} }
} }
} }
@ -39,72 +72,71 @@ export default {
return { return {
formData: {}, formData: {},
templateDetail: {}, templateDetail: {},
resource: [],//试验试剂信息
resource: [], //试验试剂信息
sysjColumns: [ sysjColumns: [
{ label: "试剂名称", prop: "reagentName" },
{ label: "编号", prop: "reagentCode" },
{ label: "批号", prop: "reagentNo" },
{ label: "浓度/含量/纯度", prop: "concentration" },
{ label: "来源", prop: "source" },
{ label: "失效日", prop: "expireDate" },
{ label: '试剂名称', prop: 'reagentName' },
{ label: '编号', prop: 'reagentCode' },
{ label: '批号', prop: 'reagentNo' },
{ label: '浓度/含量/纯度', prop: 'concentration' },
{ label: '来源', prop: 'source' },
{ label: '失效日', prop: 'expireDate' }
], ],
yqsColumns: [ yqsColumns: [
{ label: "仪器名称", prop: "instrumentName" },
{ label: "仪器型号", prop: "instrumentModel" },
{ label: "仪器编号", prop: "instrumentCode" },
{ label: "下次测试/校准/检定日期", prop: "nextTestDate" },
{ label: '仪器名称', prop: 'instrumentName' },
{ label: '仪器型号', prop: 'instrumentModel' },
{ label: '仪器编号', prop: 'instrumentCode' },
{ label: '下次测试/校准/检定日期', prop: 'nextTestDate' }
] ]
} }
}, },
mounted() {
},
mounted() {},
unmounted() { unmounted() {
this.setTemplateData({});
this.setTemplateData({})
}, },
methods: { methods: {
getResource() { getResource() {
return this.resource;
return this.resource
}, },
//根据ref数组获取直接formData //根据ref数组获取直接formData
getFilledFormDataByRefs(refArr = []) { getFilledFormDataByRefs(refArr = []) {
let result = {};
refArr.map(ref => {
const refData = this.$refs[ref]?.getFilledFormData() || {};
result = { ...result, ...refData };
});
return result;
let result = {}
refArr.map((ref) => {
const refData = this.$refs[ref]?.getFilledFormData() || {}
result = { ...result, ...refData }
})
return result
}, },
//统一校验form表单是否填写 //统一校验form表单是否填写
async validFormFields(refArr = []) { async validFormFields(refArr = []) {
let result = {};
const refs = refArr.map(ref => {
let refData = {};
let result = {}
const refs = refArr.map((ref) => {
let refData = {}
if (this.$refs[ref][0]) { if (this.$refs[ref][0]) {
refData = this.$refs[ref][0]?.getFormData() || {};
refData = this.$refs[ref][0]?.getFormData() || {}
} else { } else {
refData = this.$refs[ref]?.getFormData() || {};
refData = this.$refs[ref]?.getFormData() || {}
} }
return refData;
});
const validFormData = await Promise.all(refs).catch(err => {
return refData
})
const validFormData = await Promise.all(refs).catch((err) => {
// this.$message.error(err); // this.$message.error(err);
if (err.errorType && err.errorType === "step") {
this.$message.error("请添加步骤");
if (err.errorType && err.errorType === 'step') {
this.$message.error('请添加步骤')
return return
} }
this.$message.error("表单内容未填完,请填写后再提交");
});
this.$message.error('表单内容未填完,请填写后再提交')
})
if (validFormData) { if (validFormData) {
validFormData.forEach(item => {
validFormData.forEach((item) => {
result = { ...result, ...item } result = { ...result, ...item }
}) })
return result;
return result
} }
return false;
return false
}, },
//试验配制条件options //试验配制条件options
getDictOptions(dictType) { getDictOptions(dictType) {
return this.dict.type[dictType] || [];
return this.dict.type[dictType] || []
}, },
setTemplateData(data) { setTemplateData(data) {
@ -112,41 +144,67 @@ export default {
}, },
//统一处理删除行 //统一处理删除行
deleteRow(index) { deleteRow(index) {
this.$refs.stepTableRef.deleteRow(index);
this.$refs.stepTableRef.deleteRow(index)
}, },
//统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期 //统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期
onHandleBlur(fields) { onHandleBlur(fields) {
const { key, effectivePeriodUnit, effectivePeriod, codeSTD, targetStartSolution } = fields;
const { startDate } = this.formData;
if (key === "codeSTD") {//起始编号STD失焦时,更新stepDataSource
const {
key,
effectivePeriodUnit,
effectivePeriod,
codeSTD,
targetStartSolution
} = fields
const { startDate } = this.formData
if (key === 'codeSTD') {
//起始编号STD失焦时,更新stepDataSource
const arr = Array.from({ length: codeSTD }, (item, index) => ({ const arr = Array.from({ length: codeSTD }, (item, index) => ({
actSolutionVolumePrecision: 3,//小数点精度默认为3
actSolutionConcentrationPrecision: 3,//小数点精度默认为3
targetDiluentVolumePrecision: 3,//小数点精度默认为3
targetStartSolutionVolumePrecision: 3,//小数点精度默认为3
actSolutionVolumePrecision: 3, //小数点精度默认为3
actSolutionConcentrationPrecision: 3, //小数点精度默认为3
targetDiluentVolumePrecision: 3, //小数点精度默认为3
targetStartSolutionVolumePrecision: 3, //小数点精度默认为3
targetSolutionCode: `STD${Number(codeSTD) - index}` targetSolutionCode: `STD${Number(codeSTD) - index}`
}));
this.$refs.stepTableRef.updateDataSource(arr);
} else if (key === "targetStartSolution") {//起始溶液体积失焦时,更新目标溶液预计浓度
const arr = this.$refs.stepTableRef?.getDataSource();
}))
this.$refs.stepTableRef.updateDataSource(arr)
} else if (key === 'targetStartSolution') {
//起始溶液体积失焦时,更新目标溶液预计浓度
const arr = this.$refs.stepTableRef?.getDataSource()
arr.forEach((item, rowIndex) => { arr.forEach((item, rowIndex) => {
this.updateTargetStartSolutionVolume(rowIndex, item, targetStartSolution);
this.updateTargetStartSolutionVolume(
rowIndex,
item,
targetStartSolution
)
}) })
} }
}, },
//统一处理table失焦事件 //统一处理table失焦事件
onHandleTableBlur(params) { onHandleTableBlur(params) {
const { rowIndex, colKey, value, item } = params;
if (colKey === "targetSolutionVolume" || colKey === "targetSolutionConcentration" || colKey === "targetStartSolutionVolumePrecision" || colKey === "targetDiluentVolumePrecision") {
const volume = this.$refs.stepFormPackageRef?.getFormDataByKey("targetStartSolution") || 0;
const { rowIndex, colKey, value, item } = params
if (
colKey === 'targetSolutionVolume' ||
colKey === 'targetSolutionConcentration' ||
colKey === 'targetStartSolutionVolumePrecision' ||
colKey === 'targetDiluentVolumePrecision'
) {
const volume =
this.$refs.stepFormPackageRef?.getFormDataByKey(
'targetStartSolution'
) || 0
if (volume) { if (volume) {
this.updateTargetStartSolutionVolume(item, volume);
this.updateTargetStartSolutionVolume(item, volume)
} }
} else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {//实际起始溶液体积和实际目标溶液体积
const targetAcSolution = this.$refs.stepFormPackageRef?.getFormDataByKey("targetAcSolution") || 0;//获取实际起始溶液浓度
} else if (
colKey === 'actStartSolutionVolume' ||
colKey === 'actDiluentVolume'
) {
//实际起始溶液体积和实际目标溶液体积
const targetAcSolution =
this.$refs.stepFormPackageRef?.getFormDataByKey('targetAcSolution') ||
0 //获取实际起始溶液浓度
if (targetAcSolution) { if (targetAcSolution) {
this.updateSjmbrynd(item, targetAcSolution);
this.updateSjmbrynd(item, targetAcSolution)
} }
} }
}, },
@ -154,37 +212,43 @@ export default {
//计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度 //计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度
updateSjmbrynd(item, targetAcSolution) { updateSjmbrynd(item, targetAcSolution) {
//实际源溶液浓度÷(实际终体积÷源溶液加入体积); //实际源溶液浓度÷(实际终体积÷源溶液加入体积);
const precision = item.actSolutionConcentrationPrecision || 0;
const volPrecision = item.actSolutionVolumePrecision || 0;
const precision = item.actSolutionConcentrationPrecision || 0
const volPrecision = item.actSolutionVolumePrecision || 0
//实际稀释液体积 //实际稀释液体积
const actDiluentVolume = item.actDiluentVolume || 0;
const actStartSolutionVolume = item.actStartSolutionVolume || 0;
const actDiluentVolume = item.actDiluentVolume || 0
const actStartSolutionVolume = item.actStartSolutionVolume || 0
//实际高源溶液加入体积+实际稀释液加入体积 //实际高源溶液加入体积+实际稀释液加入体积
const actVol = (Number(actStartSolutionVolume) + Number(actDiluentVolume)).toFixed(volPrecision);
const actVol = (
Number(actStartSolutionVolume) + Number(actDiluentVolume)
).toFixed(volPrecision)
//实际目标溶液体积 //实际目标溶液体积
item.actSolutionVolume = actVol;
item.actSolutionVolume = actVol
//实际目标溶液浓度 //实际目标溶液浓度
const actNd = (targetAcSolution / actStartSolutionVolume / actVol).toFixed(precision);
item.actSolutionConcentration = actNd;
const actNd = (
targetAcSolution /
actStartSolutionVolume /
actVol
).toFixed(precision)
item.actSolutionConcentration = actNd
}, },
//更新起始溶液体积时,计算目标溶液预计浓度 //更新起始溶液体积时,计算目标溶液预计浓度
updateTargetStartSolutionVolume(item, volume) { updateTargetStartSolutionVolume(item, volume) {
const precision = item.targetStartSolutionVolumePrecision || 0;
const concentration = item.targetSolutionConcentration || 0;
const targetVolume = item.targetSolutionVolume || 0;
const precision = item.targetStartSolutionVolumePrecision || 0
const concentration = item.targetSolutionConcentration || 0
const targetVolume = item.targetSolutionVolume || 0
//目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积 //目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积
const result = ((concentration * targetVolume) / volume).toFixed(precision);
item.targetStartSolutionVolume = result;
const result = ((concentration * targetVolume) / volume).toFixed(
precision
)
item.targetStartSolutionVolume = result
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result });
if (targetVolume) { if (targetVolume) {
//预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积; //预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积;
const precision1 = item.targetDiluentVolumePrecision || 0;
const result1 = (targetVolume - result).toFixed(precision1);
item.targetDiluentVolume = result1;
const precision1 = item.targetDiluentVolumePrecision || 0
const result1 = (targetVolume - result).toFixed(precision1)
item.targetDiluentVolume = result1
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 });
} }
} }
},
}
} }

Loading…
Cancel
Save