3 Commits

16 changed files with 129 additions and 80 deletions
Unified View
  1. +1
    -3
      src/components/Template/BaseInfoFormPackage.vue
  2. +7
    -0
      src/components/Template/CustomTable.vue
  3. +1
    -1
      src/components/Template/StepComponents/ry/cs.vue
  4. +1
    -1
      src/components/Template/StepComponents/ry/dc.vue
  5. +1
    -1
      src/components/Template/StepComponents/ry/fs.vue
  6. +1
    -1
      src/components/Template/StepComponents/ry/jb.vue
  7. +2
    -2
      src/components/Template/StepComponents/ry/jrjb.vue
  8. +1
    -1
      src/components/Template/StepComponents/ry/sy.vue
  9. +13
    -7
      src/components/Template/StepComponents/ry/zlfz.vue
  10. +1
    -1
      src/components/Template/StepComponents/ry/zyhy.vue
  11. +1
    -0
      src/components/Template/StepFormPackage.vue
  12. +19
    -4
      src/components/Template/mixins/formPackageMixins.js
  13. +36
    -0
      src/utils/massTool.js
  14. +41
    -55
      src/views/business/comps/template/comps/dj/DJ001.vue
  15. +2
    -2
      src/views/business/comps/template/comps/sp/SP00456.vue
  16. +1
    -1
      src/views/business/comps/template/formConfig/xb/xb001.js

+ 1
- 3
src/components/Template/BaseInfoFormPackage.vue View File

@ -444,9 +444,7 @@ export default {
const arr = ["动物种属", "细胞系"]; const arr = ["动物种属", "细胞系"];
return arr.includes(value) return arr.includes(value)
}, },
onBeforeReagentSubmit(data, callback, key) {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
// //
handleClickButton(e, item, val, data, key) { handleClickButton(e, item, val, data, key) {
if (!item.isClearForm) { if (!item.isClearForm) {

+ 7
- 0
src/components/Template/CustomTable.vue View File

@ -813,6 +813,13 @@ export default {
!(error.rowIndex === -1 && !(error.rowIndex === -1 &&
error.field === col.headerSelectKey) error.field === col.headerSelectKey)
); );
if (col && col.headerSelectTo) {
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === -1 &&
error.field === col.headerSelectTo)
);
}
}, },
// compareTo // compareTo
checkCompareToLogic(rowIndex, colIndex, colKey, value) { checkCompareToLogic(rowIndex, colIndex, colKey, value) {

+ 1
- 1
src/components/Template/StepComponents/ry/cs.vue View File

@ -64,7 +64,7 @@ export default {
fillType: "preFill", fillType: "preFill",
}, },
text5: { text5: {
label: ",实际时长为",
label: ",实际设置时长为",
type: "text", type: "text",
}, },
sjsc: { sjsc: {

+ 1
- 1
src/components/Template/StepComponents/ry/dc.vue View File

@ -39,7 +39,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
fillType:"preFill", fillType:"preFill",
}, },
text3:{ text3:{
label:"°C,实际温度为",
label:"°C,实际温度设置为",
type:"text", type:"text",
}, },
actTemp:{ actTemp:{

+ 1
- 1
src/components/Template/StepComponents/ry/fs.vue View File

@ -34,7 +34,7 @@ export default {
fillType: "preFill", fillType: "preFill",
}, },
text3: { text3: {
label: "°C,实际温度",
label: "°C,实际温度设置为",
type: "text", type: "text",
}, },
sjwd: { sjwd: {

+ 1
- 1
src/components/Template/StepComponents/ry/jb.vue View File

@ -46,7 +46,7 @@ export default {
fillType: "preFill", fillType: "preFill",
}, },
text5: { text5: {
label: "实际转速为",
label: "实际转速设置为",
type: "text", type: "text",
}, },
sjzs: { sjzs: {

+ 2
- 2
src/components/Template/StepComponents/ry/jrjb.vue View File

@ -49,7 +49,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
copyFrom:"yjwd" copyFrom:"yjwd"
}, },
text4:{ text4:{
label:",设置预计转速为",
label:"°C,设置预计转速为",
type:"text", type:"text",
}, },
yjzs2:{ yjzs2:{
@ -63,7 +63,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
fillType:"preFill", fillType:"preFill",
}, },
text5:{ text5:{
label:"实际转速为",
label:"实际转速设置为",
type:"text", type:"text",
}, },
sjzs:{ sjzs:{

+ 1
- 1
src/components/Template/StepComponents/ry/sy.vue View File

@ -39,7 +39,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
fillType:"preFill", fillType:"preFill",
}, },
text3:{ text3:{
label:"°C,实际温度为",
label:"°C,实际温度设置为",
type:"text", type:"text",
}, },
actTemp:{ actTemp:{

+ 13
- 7
src/components/Template/StepComponents/ry/zlfz.vue View File

@ -2,15 +2,15 @@
<template> <template>
<StepFormPackage :fieldItemLabel="fieldItemLabel" @onRegentSubmit="onRegentSubmit" ref="stepFormPackageRef" <StepFormPackage :fieldItemLabel="fieldItemLabel" @onRegentSubmit="onRegentSubmit" ref="stepFormPackageRef"
:prefixKey="stepIndex + '_' + 'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig" :prefixKey="stepIndex + '_' + 'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig"
@onSubPackageSubmit="onSubPackageSubmit" :formData="formData" />
@beforeReagentSubmit="beforeReagentSubmit" @onSubPackageSubmit="onSubPackageSubmit" :formData="formData" />
</template> </template>
<script> <script>
import StepFormPackage from '@/components/Template/StepFormPackage.vue'; import StepFormPackage from '@/components/Template/StepFormPackage.vue';
import stepMixins from '@/components/Template/mixins/stepMixins.js'; import stepMixins from '@/components/Template/mixins/stepMixins.js';
import { compareVolume } from '@/utils/volumeTools.js';
import {isMassUnit,compareMass} from "@/utils/massTool";
import { import {
sj_subpackage,
sj_subpackage,
} from '@/api/business/sj/sj' } from '@/api/business/sj/sj'
export default { export default {
mixins: [stepMixins], mixins: [stepMixins],
@ -51,6 +51,12 @@ export default {
} }
}, },
methods: { methods: {
beforeReagentSubmit(data) {
const { selectData, callback} = data;
if (!isMassUnit(selectData.kcdw)) {
callback.prevent('源药库存量为非质量单位,请重新选择。')
}
},
onRegentSubmit(data) { onRegentSubmit(data) {
console.log(data, "onRegentSubmit") console.log(data, "onRegentSubmit")
const { key, selectInfo } = data; const { key, selectInfo } = data;
@ -71,7 +77,7 @@ export default {
const dw = zlfz.formData.dw; const dw = zlfz.formData.dw;
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?" const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?"
const totalVolume = zlfz.fzList.reduce((acc, cur) => acc + Number(cur.actnum), 0); const totalVolume = zlfz.fzList.reduce((acc, cur) => acc + Number(cur.actnum), 0);
const compareResult = compareVolume(totalVolume, dw, kc, kcdw);
const compareResult = compareMass(totalVolume, dw, Number(kc), kcdw);
const fzInfo = { const fzInfo = {
...zlfz.formData, ...zlfz.formData,
gg, gg,
@ -104,8 +110,8 @@ export default {
}, },
async submitEmit(fzInfo) { async submitEmit(fzInfo) {
this.$refs.stepFormPackageRef.updateFormData("fzInfo", fzInfo); this.$refs.stepFormPackageRef.updateFormData("fzInfo", fzInfo);
const { dw,bh, gg, ggdw, fzList = [] } = fzInfo;
if(!fzList.length){
const { dw, bh, gg, ggdw, fzList = [] } = fzInfo;
if (!fzList.length) {
this.$message.error("请填写分装信息"); this.$message.error("请填写分装信息");
return; return;
} }
@ -134,7 +140,7 @@ export default {
} else { } else {
this.$message.error('分装失败') this.$message.error('分装失败')
} }
} }
} }
} }

+ 1
- 1
src/components/Template/StepComponents/ry/zyhy.vue View File

@ -49,7 +49,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
fillType:"preFill", fillType:"preFill",
}, },
text3:{ text3:{
label:",实际转速为",
label:",实际转速设置为",
type:"text", type:"text",
}, },
sjzs:{ sjzs:{

+ 1
- 0
src/components/Template/StepFormPackage.vue View File

@ -40,6 +40,7 @@
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+ '_' + key" <HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+ '_' + key"
:type="sItem.type" :error="errors[key]" :type="sItem.type" :error="errors[key]"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)" @onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, key)"
@update:error="errors[key] = false" :item="getRegentItem(sItem)" @update:error="errors[key] = false" :item="getRegentItem(sItem)"
:orange-bg="regentIsExpired(key)" :orange-bg="regentIsExpired(key)"
:value="formFields[key]" /> :value="formFields[key]" />

+ 19
- 4
src/components/Template/mixins/formPackageMixins.js View File

@ -52,6 +52,9 @@ export default {
const currentConfig = this.allFieldsConfig[key] const currentConfig = this.allFieldsConfig[key]
if (currentConfig?.selectTo) { if (currentConfig?.selectTo) {
this.formFields[currentConfig?.selectTo] = val this.formFields[currentConfig?.selectTo] = val
if (this.errors[currentConfig?.selectTo]) {
this.$set(this.errors, currentConfig?.selectTo, false)
}
} }
this.onValueChangeCompareTo(key, val) this.onValueChangeCompareTo(key, val)
this.formFields[key] = val this.formFields[key] = val
@ -76,7 +79,6 @@ export default {
onRegentSubmit(data, inputValue, key, item) { onRegentSubmit(data, inputValue, key, item) {
this.updateFormData(key, inputValue) this.updateFormData(key, inputValue)
this.formFields[`selectInfo_${key}`] = data.selectInfo; this.formFields[`selectInfo_${key}`] = data.selectInfo;
console.log(this.formFields,"fff")
this.$emit('onRegentSubmit', { this.$emit('onRegentSubmit', {
selectInfo: data, selectInfo: data,
inputValue, inputValue,
@ -84,6 +86,9 @@ export default {
config: item config: item
}) })
}, },
onBeforeReagentSubmit(data, callback, key) {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
getRegentItem(item, fieldCode = 'type') { getRegentItem(item, fieldCode = 'type') {
const type = item[fieldCode] const type = item[fieldCode]
const fillType = const fillType =
@ -388,9 +393,19 @@ export default {
} }
}) })
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段 // 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
const selectInfoKeys = Object.keys(formData).filter((key) =>
key.startsWith('selectInfo_')
)
// 优先使用this.formFields中以selectInfo_开头的字段
let selectInfoKeys = []
if (this.formFields) {
selectInfoKeys = Object.keys(this.formFields).filter((key) =>
key.startsWith('selectInfo_')
)
}
// 如果this.formFields中没有,则使用formData中的
if (selectInfoKeys.length === 0 && formData) {
selectInfoKeys = Object.keys(formData).filter((key) =>
key.startsWith('selectInfo_')
)
}
selectInfoKeys.forEach((key) => { selectInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || '' result[key] = this.formFields[key] || formData[key] || ''
}) })

+ 36
- 0
src/utils/massTool.js View File

@ -0,0 +1,36 @@
// massUnitUtils.js
const toGramFactor = {
'pg': 1e-12,
'ng': 1e-9,
'ug': 1e-6,
'mg': 0.001,
'g': 1,
'kg': 1000
};
const validUnits = Object.keys(toGramFactor);
export function isMassUnit(unit) {
if (typeof unit !== 'string') return false;
return validUnits.includes(unit.toLowerCase());
}
function toGrams(value, unit) {
if (typeof value !== 'number' || isNaN(value)) {
throw new Error('值必须是有效数字');
}
const lowerUnit = unit.toLowerCase();
if (!isMassUnit(lowerUnit)) {
throw new Error(`无效的质量单位: ${unit}`);
}
return value * toGramFactor[lowerUnit];
}
export function compareMass(value1, unit1, value2, unit2) {
const grams1 = toGrams(value1, unit1);
const grams2 = toGrams(value2, unit2);
if (grams1 > grams2) return 1;
if (Math.abs(grams1 - grams2) < 1e-12) return 0;
return -1;
}

+ 41
- 55
src/views/business/comps/template/comps/dj/DJ001.vue View File

@ -11,49 +11,32 @@
<!-- 操作步骤 --> <!-- 操作步骤 -->
<LineLabel label="template.common.operationSteps" /> <LineLabel label="template.common.operationSteps" />
<div class="template-form-item"> <div class="template-form-item">
<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo"
ref="operateStepRef" :formConfig="operateConfig" :formData="formData" />
<BaseInfoFormPackage v-if="fillType !== 'preFill'" fieldItemLabel="template.dj.dj001.fhfw"
<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" ref="operateStepRef"
:formConfig="operateConfig" :formData="formData" />
<BaseInfoFormPackage v-if="fillType !== 'preFill'" fieldItemLabel="template.dj.dj001.fhfw"
ref="fhfwCheckBoxRef" :formConfig="fhfwCheckBoxConfig" :formData="formData" /> ref="fhfwCheckBoxRef" :formConfig="fhfwCheckBoxConfig" :formData="formData" />
<div class="template-form-item" >
<span>{{ $t('template.dj.dj001.fhfw') }}</span>
<CustomTable
:columns="operateColumns"
ref="operateTableRef"
:showOperation="fillType === 'preFill'"
:showAddRow="fillType === 'preFill'"
:formData="formData"
:isBorder="false"
:prefixKey="`operateTable`"
>
<div class="template-form-item">
<span>{{ $t('template.dj.dj001.fhfw') }}</span>
<CustomTable :columns="operateColumns" ref="operateTableRef"
:showOperation="fillType === 'preFill'" :showAddRow="fillType === 'preFill'"
:formData="formData" :isBorder="false" :prefixKey="`operateTable`">
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete
:row="row"
:rowIndex="rowIndex"
:columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'operateTableRef')"
></TableOpertaionDelete>
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'operateTableRef')">
</TableOpertaionDelete>
</template> </template>
</CustomTable> </CustomTable>
</div> </div>
<div class="template-form-item" >
<div class="template-form-item">
<span>{{ $t('template.dj.dj001.fhlr') }}</span> <span>{{ $t('template.dj.dj001.fhlr') }}</span>
<CustomTable
:columns="fhlrColumns"
ref="fhlrTableRef"
:showOperation="fillType === 'preFill'"
:showAddRow="fillType === 'preFill'"
:formData="{ stepTableFormData: formData.stepTableFormData_1 }"
:isBorder="false"
:prefixKey="`fhlrTable`"
>
<CustomTable :columns="fhlrColumns" ref="fhlrTableRef"
:showOperation="fillType === 'preFill'" :showAddRow="fillType === 'preFill'"
:formData="{ stepTableFormData: formData.stepTableFormData_1 }" :isBorder="false"
:prefixKey="`fhlrTable`">
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete
:row="row"
:rowIndex="rowIndex"
:columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'fhlrTableRef')"
></TableOpertaionDelete>
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'fhlrTableRef')">
</TableOpertaionDelete>
</template> </template>
</CustomTable> </CustomTable>
</div> </div>
@ -130,7 +113,7 @@ export default {
}, },
} }
}, },
] ]
}, },
// //
@ -146,7 +129,7 @@ export default {
}, },
} }
}, },
] ]
}, },
// //
@ -166,11 +149,11 @@ export default {
type: "checkboxTree", type: "checkboxTree",
fillType: 'actFill', fillType: 'actFill',
options: Array.isArray(this.fhlrCheckOptions) ? this.fhlrCheckOptions : [] options: Array.isArray(this.fhlrCheckOptions) ? this.fhlrCheckOptions : []
}, },
} }
}, },
] ]
}, },
// //
@ -204,8 +187,8 @@ export default {
fhfwCheck: { checkedValues: [], otherValues: {} }, fhfwCheck: { checkedValues: [], otherValues: {} },
fhlrCheck: { checkedValues: [], otherValues: {} }, fhlrCheck: { checkedValues: [], otherValues: {} },
}, },
fhfwCheckOptions:[],
fhlrCheckOptions:[],
fhfwCheckOptions: [],
fhlrCheckOptions: [],
isFirstTableDataRecorded: false, isFirstTableDataRecorded: false,
}; };
}, },
@ -213,25 +196,29 @@ export default {
this.getTableData() this.getTableData()
}, },
methods: { methods: {
//
async deleteTableRow(rowIndex, refName) {
this.$refs[refName].deleteRow(rowIndex)
},
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs( return this.getFilledFormDataByRefs(
[ [
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
] ]
) )
}, },
// //
async getFormData() { async getFormData() {
let content = await this.validFormFields([ let content = await this.validFormFields([
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
]); ]);
return content; return content;
}, },
getResource() { getResource() {
//使 //使
// const stepResource = this.$refs.stepRef.getStepResource() // const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = []
this.resourceTmp = []
this.yqResourceTmp = [] this.yqResourceTmp = []
return this.resourceTmp; return this.resourceTmp;
}, },
@ -241,7 +228,7 @@ export default {
console.log(content); console.log(content);
}, },
// //
deleteRow(rowIndex,type) {
deleteRow(rowIndex, type) {
const tableRef1 = this.$refs['operateTableRef']; const tableRef1 = this.$refs['operateTableRef'];
const tableRef2 = this.$refs['tableSecondRef']; const tableRef2 = this.$refs['tableSecondRef'];
if (type == 'firstTable' && tableRef1) { if (type == 'firstTable' && tableRef1) {
@ -258,12 +245,12 @@ export default {
// //
const stepTableFormData = formData.stepTableFormData || this.formData.stepTableFormData || []; const stepTableFormData = formData.stepTableFormData || this.formData.stepTableFormData || [];
const stepTableFormData_1 = formData.stepTableFormData_1 || this.formData.stepTableFormData_1 || []; const stepTableFormData_1 = formData.stepTableFormData_1 || this.formData.stepTableFormData_1 || [];
// checkboxTreechildren // checkboxTreechildren
const firstList = stepTableFormData const firstList = stepTableFormData
.filter(item => item && item.fhfw && item.fhfw.trim()) // .filter(item => item && item.fhfw && item.fhfw.trim()) //
.map(item => ({
label: item.fhfw,
.map(item => ({
label: item.fhfw,
value: item.fhfw, value: item.fhfw,
children: [] // childrencheckboxTree children: [] // childrencheckboxTree
})) }))
@ -274,8 +261,8 @@ export default {
const secondList = stepTableFormData_1 const secondList = stepTableFormData_1
.filter(item => item && item.fhlr && item.fhlr.trim()) // .filter(item => item && item.fhlr && item.fhlr.trim()) //
.map(item => ({
label: item.fhlr,
.map(item => ({
label: item.fhlr,
value: item.fhlr, value: item.fhlr,
children: [] // children children: [] // children
})) }))
@ -284,11 +271,11 @@ export default {
}); });
// //
this.$nextTick(()=>{
this.$nextTick(() => {
this.fhfwCheckOptions = firstList; this.fhfwCheckOptions = firstList;
this.fhlrCheckOptions = secondList; this.fhlrCheckOptions = secondList;
}) })
} catch (error) { } catch (error) {
// //
this.fhfwCheckOptions = []; this.fhfwCheckOptions = [];
@ -298,5 +285,4 @@ export default {
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss">
</style>
<style rel="stylesheet/scss" lang="scss"></style>

+ 2
- 2
src/views/business/comps/template/comps/sp/SP00456.vue View File

@ -83,7 +83,7 @@
:showOperation="fillType === 'actFill' || fillType === 'preFill'" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:tableColumns="ladderStepColumns" :prefixKey="'ladder_1_' + ladderIndex" :tableColumns="ladderStepColumns" :prefixKey="'ladder_1_' + ladderIndex"
:configType="'ladder'" :ref="`ladderRef_1_${ladderIndex}`" :configType="'ladder'" :ref="`ladderRef_1_${ladderIndex}`"
:fieldItemLabel="'template.lba.lba005.zkpz'"
:fieldItemLabel="getTableLabel('ladder')"
@deleteConfig="deleteConfig('ladderConfigs_1', ladderConfig)" :fillType="fillType" /> @deleteConfig="deleteConfig('ladderConfigs_1', ladderConfig)" :fillType="fillType" />
</div> </div>
@ -94,7 +94,7 @@
:showOperation="fillType === 'actFill' || fillType === 'preFill'" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:tableColumns="paralleStepColumns1" :prefixKey="'paralle_1_' + paralleIndex" :tableColumns="paralleStepColumns1" :prefixKey="'paralle_1_' + paralleIndex"
:configType="'paralle'" :ref="`paralleRef_1_${paralleIndex}`" :configType="'paralle'" :ref="`paralleRef_1_${paralleIndex}`"
:fieldItemLabel="'template.lba.lba005.zkpz'"
:fieldItemLabel="getTableLabel('paralle')"
@deleteConfig="deleteConfig('paralleConfigs_1', paralleConfig)" :fillType="fillType" /> @deleteConfig="deleteConfig('paralleConfigs_1', paralleConfig)" :fillType="fillType" />
</div> </div>
</template> </template>

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

@ -296,7 +296,7 @@ export const getStepFivth = ($this) => {
fillType: 'preFill' fillType: 'preFill'
}, },
text4: { text4: {
label: '℃,实际温度',
label: '℃,实际温度设置',
type: 'text' type: 'text'
}, },
sjwd: { sjwd: {

Loading…
Cancel
Save