feat:样品分析计算
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { calcRowAnalysisValue } from '@/nx/helper/calcAnalysisValue'
|
||||
import { calcRowAnalysisValue, evaluateGetFromFormula } from '@/nx/helper/calcAnalysisValue'
|
||||
import tools from '@/nx/utils/tools'
|
||||
|
||||
const pageLoading = ref(false)
|
||||
@@ -161,15 +161,14 @@ async function loadTaskDetail() {
|
||||
fieldKey: item.fieldKey,
|
||||
type: item.fieldType,
|
||||
placeholder: '请输入',
|
||||
hidden:false
|
||||
|
||||
hidden: false
|
||||
}
|
||||
if (customConfig?.componentProps?.options) {
|
||||
field.options = customConfig.componentProps.options
|
||||
}
|
||||
if(customConfig.hidden){
|
||||
field.hidden = true
|
||||
}
|
||||
if (customConfig.hidden) {
|
||||
field.hidden = true
|
||||
}
|
||||
return field
|
||||
})
|
||||
formFields.value = [...staticFormSchema, ...dynamicFormSchema]
|
||||
@@ -208,7 +207,7 @@ async function updateTableDataByConfigFields() {
|
||||
const columnObj = tab.columns.find(c => {
|
||||
if (c.formula) {
|
||||
let FromKey = c.formula.split(':')
|
||||
return FromKey[1] === key
|
||||
return FromKey[1] === key || FromKey[0] === 'GetFrom'
|
||||
}
|
||||
return false
|
||||
})
|
||||
@@ -216,9 +215,21 @@ async function updateTableDataByConfigFields() {
|
||||
tab.tableData.forEach(row => {
|
||||
// 赋值配置列参与计算
|
||||
if (row[columnObj.fieldIndex]) {
|
||||
row[columnObj.fieldIndex].value = formData[key]
|
||||
calcRowAnalysisValue(row, columnObj, tab.columns)
|
||||
if (columnObj.formula.startsWith('From')) {
|
||||
row[columnObj.fieldIndex].value = dynamicFormData[key]
|
||||
}
|
||||
if (columnObj.formula.startsWith('GetFrom')) {
|
||||
row[columnObj.fieldIndex].value = evaluateGetFromFormula(
|
||||
columnObj.formula,
|
||||
true,
|
||||
realFormData.value,
|
||||
columnObj,
|
||||
row,
|
||||
tab.columns
|
||||
)
|
||||
}
|
||||
}
|
||||
calcRowAnalysisValue(row, columnObj, tab.columns, realFormData.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -320,11 +331,14 @@ function checkPropertyEquality() {
|
||||
for (const column of allColumns) {
|
||||
const formula = column.formula
|
||||
if (!formula) continue
|
||||
const target = formula.split(':')[1]
|
||||
const originalValue = dynamicFormData.value[target]
|
||||
const currentValue = realFormData.value[target]
|
||||
if (!looseEqual(originalValue, currentValue)) {
|
||||
return true
|
||||
for (const [key, value] of Object.entries(dynamicFormData.value)) {
|
||||
if (formula.includes(key)) {
|
||||
const originalValue = value
|
||||
const currentValue = realFormData.value[key]
|
||||
if (!looseEqual(originalValue, currentValue)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user