Browse Source

feat:[模板管理][bug修复]

luojie
luojie 1 week ago
parent
commit
792aa23199
15 changed files with 120 additions and 80 deletions
  1. +1
    -3
      src/components/Template/BaseInfoFormPackage.vue
  2. +1
    -1
      src/components/Template/StepComponents/ry/cs.vue
  3. +1
    -1
      src/components/Template/StepComponents/ry/dc.vue
  4. +1
    -1
      src/components/Template/StepComponents/ry/fs.vue
  5. +1
    -1
      src/components/Template/StepComponents/ry/jb.vue
  6. +2
    -2
      src/components/Template/StepComponents/ry/jrjb.vue
  7. +1
    -1
      src/components/Template/StepComponents/ry/sy.vue
  8. +13
    -7
      src/components/Template/StepComponents/ry/zlfz.vue
  9. +1
    -1
      src/components/Template/StepComponents/ry/zyhy.vue
  10. +1
    -0
      src/components/Template/StepFormPackage.vue
  11. +17
    -4
      src/components/Template/mixins/formPackageMixins.js
  12. +36
    -0
      src/utils/massTool.js
  13. +41
    -55
      src/views/business/comps/template/comps/dj/DJ001.vue
  14. +2
    -2
      src/views/business/comps/template/comps/sp/SP00456.vue
  15. +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 = ["动物种属", "细胞系"];
return arr.includes(value)
},
onBeforeReagentSubmit(data, callback, key) {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
//
handleClickButton(e, item, val, data, key) {
if (!item.isClearForm) {

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

@ -64,7 +64,7 @@ export default {
fillType: "preFill",
},
text5: {
label: ",实际时长为",
label: ",实际设置时长为",
type: "text",
},
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",
},
text3:{
label:"°C,实际温度为",
label:"°C,实际温度设置为",
type:"text",
},
actTemp:{

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

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

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

@ -46,7 +46,7 @@ export default {
fillType: "preFill",
},
text5: {
label: "实际转速为",
label: "实际转速设置为",
type: "text",
},
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"
},
text4:{
label:",设置预计转速为",
label:"°C,设置预计转速为",
type:"text",
},
yjzs2:{
@ -63,7 +63,7 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
fillType:"preFill",
},
text5:{
label:"实际转速为",
label:"实际转速设置为",
type:"text",
},
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",
},
text3:{
label:"°C,实际温度为",
label:"°C,实际温度设置为",
type:"text",
},
actTemp:{

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

@ -2,15 +2,15 @@
<template>
<StepFormPackage :fieldItemLabel="fieldItemLabel" @onRegentSubmit="onRegentSubmit" ref="stepFormPackageRef"
:prefixKey="stepIndex + '_' + 'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig"
@onSubPackageSubmit="onSubPackageSubmit" :formData="formData" />
@beforeReagentSubmit="beforeReagentSubmit" @onSubPackageSubmit="onSubPackageSubmit" :formData="formData" />
</template>
<script>
import StepFormPackage from '@/components/Template/StepFormPackage.vue';
import stepMixins from '@/components/Template/mixins/stepMixins.js';
import { compareVolume } from '@/utils/volumeTools.js';
import {isMassUnit,compareMass} from "@/utils/massTool";
import {
sj_subpackage,
sj_subpackage,
} from '@/api/business/sj/sj'
export default {
mixins: [stepMixins],
@ -51,6 +51,12 @@ export default {
}
},
methods: {
beforeReagentSubmit(data) {
const { selectData, callback} = data;
if (!isMassUnit(selectData.kcdw)) {
callback.prevent('源药库存量为非质量单位,请重新选择。')
}
},
onRegentSubmit(data) {
console.log(data, "onRegentSubmit")
const { key, selectInfo } = data;
@ -71,7 +77,7 @@ export default {
const dw = zlfz.formData.dw;
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?"
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 = {
...zlfz.formData,
gg,
@ -104,8 +110,8 @@ export default {
},
async submitEmit(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("请填写分装信息");
return;
}
@ -134,7 +140,7 @@ export default {
} else {
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",
},
text3:{
label:",实际转速为",
label:",实际转速设置为",
type:"text",
},
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"
:type="sItem.type" :error="errors[key]"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, key)"
@update:error="errors[key] = false" :item="getRegentItem(sItem)"
:orange-bg="regentIsExpired(key)"
:value="formFields[key]" />

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

@ -76,7 +76,6 @@ export default {
onRegentSubmit(data, inputValue, key, item) {
this.updateFormData(key, inputValue)
this.formFields[`selectInfo_${key}`] = data.selectInfo;
console.log(this.formFields,"fff")
this.$emit('onRegentSubmit', {
selectInfo: data,
inputValue,
@ -84,6 +83,9 @@ export default {
config: item
})
},
onBeforeReagentSubmit(data, callback, key) {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
getRegentItem(item, fieldCode = 'type') {
const type = item[fieldCode]
const fillType =
@ -388,9 +390,20 @@ export default {
}
})
// 处理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_')
)
}
console.log(selectInfoKeys,"selectInfoKeys",this.formFields)
selectInfoKeys.forEach((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" />
<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" />
<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 }">
<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>
</CustomTable>
</div>
<div class="template-form-item" >
<div class="template-form-item">
<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 }">
<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>
</CustomTable>
</div>
@ -130,7 +113,7 @@ export default {
},
}
},
]
},
//
@ -146,7 +129,7 @@ export default {
},
}
},
]
},
//
@ -166,11 +149,11 @@ export default {
type: "checkboxTree",
fillType: 'actFill',
options: Array.isArray(this.fhlrCheckOptions) ? this.fhlrCheckOptions : []
},
}
},
]
},
//
@ -204,8 +187,8 @@ export default {
fhfwCheck: { checkedValues: [], otherValues: {} },
fhlrCheck: { checkedValues: [], otherValues: {} },
},
fhfwCheckOptions:[],
fhlrCheckOptions:[],
fhfwCheckOptions: [],
fhlrCheckOptions: [],
isFirstTableDataRecorded: false,
};
},
@ -213,25 +196,29 @@ export default {
this.getTableData()
},
methods: {
//
async deleteTableRow(rowIndex, refName) {
this.$refs[refName].deleteRow(rowIndex)
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs(
[
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
]
)
},
//
async getFormData() {
let content = await this.validFormFields([
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
"baseInfoRef", "operateStepRef", "operateTableRef", "fhlrTableRef", "fhfwCheckBoxRef"
]);
return content;
},
getResource() {
//使
// const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = []
this.resourceTmp = []
this.yqResourceTmp = []
return this.resourceTmp;
},
@ -241,7 +228,7 @@ export default {
console.log(content);
},
//
deleteRow(rowIndex,type) {
deleteRow(rowIndex, type) {
const tableRef1 = this.$refs['operateTableRef'];
const tableRef2 = this.$refs['tableSecondRef'];
if (type == 'firstTable' && tableRef1) {
@ -258,12 +245,12 @@ export default {
//
const stepTableFormData = formData.stepTableFormData || this.formData.stepTableFormData || [];
const stepTableFormData_1 = formData.stepTableFormData_1 || this.formData.stepTableFormData_1 || [];
// checkboxTreechildren
const firstList = stepTableFormData
.filter(item => item && item.fhfw && item.fhfw.trim()) //
.map(item => ({
label: item.fhfw,
.map(item => ({
label: item.fhfw,
value: item.fhfw,
children: [] // childrencheckboxTree
}))
@ -274,8 +261,8 @@ export default {
const secondList = stepTableFormData_1
.filter(item => item && item.fhlr && item.fhlr.trim()) //
.map(item => ({
label: item.fhlr,
.map(item => ({
label: item.fhlr,
value: item.fhlr,
children: [] // children
}))
@ -284,11 +271,11 @@ export default {
});
//
this.$nextTick(()=>{
this.$nextTick(() => {
this.fhfwCheckOptions = firstList;
this.fhlrCheckOptions = secondList;
})
} catch (error) {
//
this.fhfwCheckOptions = [];
@ -298,5 +285,4 @@ export default {
}
};
</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'"
:tableColumns="ladderStepColumns" :prefixKey="'ladder_1_' + ladderIndex"
:configType="'ladder'" :ref="`ladderRef_1_${ladderIndex}`"
:fieldItemLabel="'template.lba.lba005.zkpz'"
:fieldItemLabel="getTableLabel('ladder')"
@deleteConfig="deleteConfig('ladderConfigs_1', ladderConfig)" :fillType="fillType" />
</div>
@ -94,7 +94,7 @@
:showOperation="fillType === 'actFill' || fillType === 'preFill'"
:tableColumns="paralleStepColumns1" :prefixKey="'paralle_1_' + paralleIndex"
:configType="'paralle'" :ref="`paralleRef_1_${paralleIndex}`"
:fieldItemLabel="'template.lba.lba005.zkpz'"
:fieldItemLabel="getTableLabel('paralle')"
@deleteConfig="deleteConfig('paralleConfigs_1', paralleConfig)" :fillType="fillType" />
</div>
</template>

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

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

Loading…
Cancel
Save