Browse Source

feat:[模板管理]PCR002

lkf
HanLong 2 months ago
parent
commit
bf9eff90b9
4 changed files with 214 additions and 34 deletions
  1. +197
    -26
      src/views/business/comps/template/comps/pcr/PCR002.vue
  2. +6
    -3
      src/views/business/comps/template/formConfig/PCRTableConfig.js
  3. +5
    -3
      src/views/business/comps/template/mixins/templateMixin.js
  4. +6
    -2
      src/views/business/resource/sj/comps/Bj.vue

+ 197
- 26
src/views/business/comps/template/comps/pcr/PCR002.vue View File

@ -9,19 +9,25 @@
<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"
v-if="resourceWz.length > 0" />
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<BaseInfoFormPackage fieldItemLabel="template.common.storageCondition"
label="template.common.storageCondition" ref="storageConditionRef"
:formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" />
<div class="template-form-item">
<BaseInfoFormPackage fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef"
@clickable="handleFormClickable"
@onSureModifyRecord="onSureModifyRecord"
@resetRecord="resetRecord"
:formConfig="stepFormConfig" @blur="onHandleBlur" :formData="formData" />
<CustomTable @blur="onHandleTableBlur"
:ref="`tableRef`" :columns="tableStepColumns"
:formData="formData" :prefixKey="`table`" fieldItemLabel="template.common.operationSteps">
<CustomTable
@blur="onHandleTableBlur"
:ref="`stepTableRef`"
:columns="tableStepColumns"
:formData="formData"
:prefixKey = "`table`"
@clickable="handleClickable"
fieldItemLabel = "template.common.operationSteps"
>
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaion
:fillType="fillType"
@ -42,6 +48,8 @@
</div>
</div>
</div>
<SelectReagentDialog @submit="onSelectReagentSubmit" ref="selectReagentDialogRef">
</SelectReagentDialog>
<!-- <button @click="onSave">保存</button> -->
</div>
</template>
@ -53,14 +61,15 @@ 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 { getLatestSnArr } from '@/api/template';
import { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools";
import { debounce } from 'lodash-es'
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue';
import { getLadderColumnsConfig } from "../../formConfig/PCRTableConfig.js";
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"
export default {
name: "PCR001",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable },
name: "PCR002",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog },
mixins: [templateMixin],
props: {
fillType: {
@ -70,7 +79,7 @@ export default {
},
computed: {
tableStepColumns() {
return getLadderColumnsConfig(this);
return getLadderColumnsConfig(this, 'business_pcr_gzy');
},
//
storageFormConfig() {
@ -233,32 +242,118 @@ export default {
},
data() {
return {
formData: {}
reagentType: null, // 1- 2-
formData: {},
currentSubKey: "",//key
currentType: "",//
currentRowIndex: "",//
};
},
mounted() {
const formData = this.getFormDataByTemplateData();
if(this.fillType === "actFill"){
if (this.fillType === "actFill") {
this.getCode(formData);
}
},
methods: {
//
onSureModifyRecord(key) {
if (key === "subStartSolution") {//table
this.$refs.stepTableRef.updateRecords();
}
},
resetRecord() {
this.$refs.stepTableRef.resetRecord();
},
//
handleFormClickable(obj) {
if (this.fillType === "preFill") {
return;
}
console.log(obj)
const subKey = obj.subKey;
if (subKey === "subStartSolution" || subKey === "subSolution") {//
this.$refs.selectReagentDialogRef.show(this.formData.id)
this.currentSubKey = subKey;
this.reagentType = 1;
}
},
//
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(this.formData.id)
}
},
//
onSelectReagentSubmit(code,row){
if(this.reagentType===1){
this.$refs.stepFormPackageRef.updateFormData(this.currentSubKey, code);
//
if(this.currentSubKey == 'subStartSolution') {
this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd + row.nddw);
this.updateStepTableData(row);
}
}else{
this.$refs.stepTableRef.updateDataSourceByRowIndex(this.rowIndex,{
[this.currentSubKey]: code,
})
}
this.$refs.selectReagentDialogRef.onCancel()
},
//table
updateStepTableData(row) {
const { stepTableFormData = [] } = this.$refs.stepTableRef.getFilledFormData();
//
const newStepTableData = JSON.parse(JSON.stringify(stepTableFormData));
//
for (let i = 0; i < newStepTableData.length; i++) {
const item = newStepTableData[i];
if (i === 0) {
// row.code
newStepTableData[i].startSolutionCode = row.bh;
} else {
// targetSolutionCode
// targetSolutionCode
newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode + newStepTableData[i - 1].subTargetSolutionCode;
}
console.log(item, row, 'updateStepTableData')
const volResult = this.updateSjmbrynd(item, row.nd);
console.log(volResult, 'volResult')
if (!volResult) {
continue
}
item.actSolutionVolume = volResult.actVol;
item.actSolutionConcentration = volResult.actNd;
item.actSolutionExpire = row.sxr;
}
this.$refs.stepTableRef.updateDataSource(newStepTableData);
// tableRef
},
//
async getCode(v){
const {stepTableFormData = []} = v;
if(stepTableFormData && stepTableFormData.length>0 && !stepTableFormData[0].bhCode){
async getCode(v) {
const { stepTableFormData = [] } = v;
if (stepTableFormData && stepTableFormData.length > 0 && !stepTableFormData[0].bhCode) {
let postSn = []
for(let i=0;i<stepTableFormData.length;i++){
for (let i = 0; i < stepTableFormData.length; i++) {
postSn.push({
pre:stepTableFormData[i].targetSolutionCode,
type:1
pre: stepTableFormData[i].targetSolutionCode,
type: 1
})
}
const result = await getLatestSnArr(postSn)
if(result.code == 200){
for(let i=0;i<stepTableFormData.length;i++){
this.$refs.tableRef.updateDataSourceByRowIndex(i,{
if (result.code == 200) {
for (let i = 0; i < stepTableFormData.length; i++) {
this.$refs.stepTableRef.updateDataSourceByRowIndex(i, {
subTargetSolutionCode: result.data[i],
})
}
@ -276,11 +371,11 @@ export default {
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"])
return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef","stepTableRef", "stepRef", "remarkRef"])
},
//
async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]);
let content = await this.validFormFields(["baseInfoRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]);
//resource
let tmpResource = []
if (this.fillType === "actFill") {
@ -316,6 +411,82 @@ export default {
console.log(content);
},
//
deleteRow(rowIndex) {
const stepTableRef = this.$refs['stepTableRef'];
if (stepTableRef) {
stepTableRef.deleteRow(rowIndex);
}
},
configComplete(val) {
if (val.rowData.sjjzxql === '' || val.rowData.sjjzxql === undefined || val.rowData.sjryxql === '' || val.rowData.sjryxql === undefined) {
this.$message.error("表格内容未填完")
return
}
console.log("完成配置数据:" + JSON.stringify(val))
const { total, unit } = addTj([val.rowData.sjjzxql, val.rowData.sjryxql], [val.headerSelectFields.sjjzxqlUnit, val.headerSelectFields.sjryxqlUnit])
let postData = {
mc: null,
studyId: this.formData.studyId,
studyFormId: this.formData.id,
studySubjectId: this.formData.studySubjectId,
bh: val.rowData.bh + val.rowData.bhCode,
nd: val.rowData.hhwznd,
nddw: val.headerSelectFields.hhwzndUnit,
kc: total,
kcdw: unit,
}
console.log("完成配置提交数据:" + JSON.stringify(postData))
sj_configurationCompleted(postData).then(() => {
}).catch(() => {
})
.finally(() => {
})
},
startConfig(val) {
console.log("开始配置数据:" + JSON.stringify(val))
let postData = {
bh: val.rowData.bh + val.rowData.bhCode,
studyId: this.formData.studyId,
studyFormId: this.formData.id,
studySubjectId: this.formData.studySubjectId,
}
console.log("开始配置提交数据:" + JSON.stringify(postData))
sj_startConfiguration(postData).then(() => {
}).catch(() => {
})
.finally(() => {
})
},
subPackageSubmit(val) {
console.log("分装数据:" + JSON.stringify(val))
if (val.fzsj.fzList && val.fzsj.fzList.length > 0) {
let list = []
for (let i = 0; i < val.fzsj.fzList.length; i++) {
let item = val.fzsj.fzList[i]
list.push({
bh: val.fzsj.mybh + item.preCode,
kc: item.num,
kcdw: val.fzsj.dw,
})
}
let postData = {
studyId: this.formData.studyId,
studyFormId: this.formData.id,
studySubjectId: this.formData.studySubjectId,
bh: val.fzsj.mybh,
nd: val.rowData.hhwznd,
nddw: val.headerSelectFields.hhwzndUnit,
list: list
}
console.log("分装提交数据:" + JSON.stringify(postData))
sj_subpackage(postData).then(() => {
}).catch(() => {
})
.finally(() => {
})
}
},
}
};
</script>

+ 6
- 3
src/views/business/comps/template/formConfig/PCRTableConfig.js View File

@ -1,15 +1,17 @@
// 阶梯配置表格列配置
export const getLadderColumnsConfig = ($this) => {
export const getLadderColumnsConfig = ($this, selectKey) => {
return [
{
label: 'template.pcr.pcr002.mbrybh',
prop: 'targetSolutionCode',
bodyType: 'input',
bodyType: selectKey === '' ? 'input' : 'select',
bodyOptions: $this.getDictOptions(selectKey),
otherCode: 'bhOther',
bodySubType: 'span',
bodySubKey: 'subTargetSolutionCode',
bodyFillType: 'preFill',
width: 280,
myCodeFields: ["targetSolutionCode", "subTargetSolutionCode"],//分装的母液编号字段
myCodeFields: ["targetSolutionCode", "bhOther", "subTargetSolutionCode"],//分装的母液编号字段
maxVolumeField: "actSolutionVolume",//分装的最大量字段
maxVolumeFieldUnit: "actSolutionVolumeUnit",//分装的最大量单位字段
},
@ -17,6 +19,7 @@ export const getLadderColumnsConfig = ($this) => {
label: 'template.pcr.pcr002.qsrybh',
prop: 'startSolutionCode',
width: 280,
bodyDisabled: true,
bodyType: 'input',
bodyFillType: 'actFill',
bodyMaxlength: 10

+ 5
- 3
src/views/business/comps/template/mixins/templateMixin.js View File

@ -24,7 +24,8 @@ export default {
'business_sp_xzxytyx', //色谱-编号-选择性与特异性
'business_sp_zdybs', //色谱-编号-最大样本数
'business_sp_xskkx', //色谱-编号-稀释可靠性
'business_sp_cbydb' //色谱-编号-储备液对比
'business_sp_cbydb', //色谱-编号-储备液对比
'business_pcr_gzy', // PCR-编号-工作液
],
props: {
templateData: {
@ -53,11 +54,11 @@ export default {
} = v
if (v.resource) {
//type 类型:1:试剂;3:给药制剂;5:麻精药;7:供试品
//试验试剂信息 试剂
//试验试剂信息 试剂
this.resource = _.filter(JSON.parse(v.resource),function(o){
return o.type==1||o.elnType==1
})
//试验物资信息 供试品、给药制剂
//试验物资信息 供试品、给药制剂
this.resourceWz =_.filter(JSON.parse(v.resource),function(o){
return o.type==3||o.type==7||o.elnType==3||o.elnType==7
})
@ -380,6 +381,7 @@ export default {
//计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度
updateSjmbrynd(item, targetAcSolution) {
console.log(item, targetAcSolution, 'updateSjmbrynd')
//实际源溶液浓度÷(实际终体积÷源溶液加入体积);
const precision = item.actSolutionConcentrationPrecision || 0
const volPrecision = item.actSolutionVolumePrecision || 0

+ 6
- 2
src/views/business/resource/sj/comps/Bj.vue View File

@ -95,7 +95,7 @@
</template>
<script>
import { sj_bj } from "@/api/business/sj/sj"
import { sj_bj, sj_info } from "@/api/business/sj/sj"
import { mapGetters } from 'vuex'
import SelectList from "./SelectList";
import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
@ -156,7 +156,11 @@ export default {
this.form.id = row.id
this.form.mc = row.mc
this.form.bh = row.bh
this.open = true
sj_info({id: row.id}).then(response => {
this.form = response.data
this.open = true
})
},
save() {
this.$refs["form"].validate(valid => {

Loading…
Cancel
Save