Browse Source

feat:[模板管理][烦人的浓度计算和单位换算]

lkf
luojie 2 months ago
parent
commit
540e97a435
4 changed files with 25 additions and 3 deletions
  1. +7
    -1
      src/components/Template/BaseInfoFormPackage.vue
  2. +3
    -0
      src/components/Template/HandleFormItem.vue
  3. +12
    -1
      src/components/Template/mixins/formPackageMixins.js
  4. +3
    -1
      src/views/business/comps/template/comps/sp/SP003.vue

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

@ -86,7 +86,7 @@
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" /> :orange-bg="orangeBgFields[key]" />
</div> </div>
<div v-else-if="sItem.type === 'input'" :class="sItem.subType === 'text'?'item-center':''">
<div v-else-if="sItem.type === 'input'">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" @blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" @blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false" @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" /> :orange-bg="orangeBgFields[key]" />
@ -153,6 +153,12 @@
@change="(e,type)=>onSelectChange(sItem.subKey, e,type)" :error="errors[sItem.subKey]" @change="(e,type)=>onSelectChange(sItem.subKey, e,type)" :error="errors[sItem.subKey]"
@update:error="errors[sItem.subKey] = false" @update:error="errors[sItem.subKey] = false"
:orange-bg="orangeBgFields[sItem.subKey]" /> :orange-bg="orangeBgFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-if="sItem.subType === 'input'" type="input"
:item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" @copy="onCopy(sItem, key)"
:error="errors[sItem.subKey]"
@blur="onBlur(sItem.subKey, $event)"
@update:error="errors[sItem.subKey] = false"
:orange-bg="orangeBgFields[sItem.subKey]" />
<div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<span v-else-if="sItem.subType === 'text'" class="sub-text">{{ $t( sItem.subText) }}</span> <span v-else-if="sItem.subType === 'text'" class="sub-text">{{ $t( sItem.subText) }}</span>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'" type="clickable" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.subKey" class="ml-10" v-else-if="sItem.subType === 'clickable'" type="clickable"

+ 3
- 0
src/components/Template/HandleFormItem.vue View File

@ -422,6 +422,9 @@ export default {
params = { params = {
...params, ...params,
type: sjType[type] type: sjType[type]
};
if(type === "mix"){
params.mixType = true;
} }
} }
EventBus.$emit(eventName, params) EventBus.$emit(eventName, params)

+ 12
- 1
src/components/Template/mixins/formPackageMixins.js View File

@ -155,12 +155,16 @@ export default {
} }
}, },
getSubItem(sItem) { getSubItem(sItem) {
return {
const config = {
label: "", label: "",
options: sItem.subOptions || [], options: sItem.subOptions || [],
fillType: sItem.subFillType || sItem.fillType, fillType: sItem.subFillType || sItem.fillType,
parentLabel: sItem.label, parentLabel: sItem.label,
} }
if(sItem.subDisabled){
config.disabled = sItem.subDisabled;
}
return config;
}, },
// 根据formConfig回填form表单数据 // 根据formConfig回填form表单数据
handleFormField(update = false) { handleFormField(update = false) {
@ -221,6 +225,13 @@ export default {
this.compareFieldsIsEqual(currentValue, compareToValue, key) this.compareFieldsIsEqual(currentValue, compareToValue, key)
} }
// 检查compareTo字段
if (currentConfig.subCompareTo && formData[currentConfig.subCompareTo] && result[currentConfig.subKey]) {
const compareToValue = formData[currentConfig.subCompareTo];
const currentValue = result[currentConfig.subKey];
this.compareFieldsIsEqual(currentValue, compareToValue, currentConfig.subKey)
}
}); });
// 处理可能存在的直接otherCode字段 // 处理可能存在的直接otherCode字段

+ 3
- 1
src/views/business/comps/template/comps/sp/SP003.vue View File

@ -222,7 +222,9 @@ export default {
maxlength: 10, maxlength: 10,
compareTo: "targetStartSolution", compareTo: "targetStartSolution",
subKey: "subTargetAcSolutionUnit", subKey: "subTargetAcSolutionUnit",
subType:"span"
subType:"input",
subDisabled:true,
subCompareTo:"subTargetStartSolution",
}, },
solution: { solution: {
label: "template.sp.sp003.xsy", label: "template.sp.sp003.xsy",

Loading…
Cancel
Save