feat:样品分析计算
This commit is contained in:
9
App.vue
9
App.vue
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onLaunch, onShow, onError } from '@dcloudio/uni-app'
|
import { onLaunch, onShow, onError,onHide } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
import { NxInit } from './nx'
|
import { NxInit } from './nx'
|
||||||
import $store from '@/nx/store'
|
import $store from '@/nx/store'
|
||||||
@@ -29,7 +29,12 @@ onError(err => {
|
|||||||
console.log('AppOnError:', err)
|
console.log('AppOnError:', err)
|
||||||
})
|
})
|
||||||
|
|
||||||
onShow(() => {})
|
onShow(() => {
|
||||||
|
console.log('显示')
|
||||||
|
})
|
||||||
|
onHide(()=>{
|
||||||
|
console.log('隐藏了')
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -264,7 +264,16 @@ const rollbackAssayTask = data => {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 手动配料 post 参数与自动下发配料一致
|
||||||
|
const manualIngredients = data => {
|
||||||
|
return request({
|
||||||
|
url: '/qms/bus/sample/analysis/manualIngredients',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* 查询回收率配置*/
|
* 查询回收率配置*/
|
||||||
const queryConRecoveryRateList = param => {
|
const queryConRecoveryRateList = param => {
|
||||||
@@ -311,5 +320,6 @@ export default {
|
|||||||
rollbackAssayTask,
|
rollbackAssayTask,
|
||||||
submitTask,
|
submitTask,
|
||||||
taskIngredients,
|
taskIngredients,
|
||||||
queryQmsDicSampleProcessCodeList
|
queryQmsDicSampleProcessCodeList,
|
||||||
|
manualIngredients
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ math.config({
|
|||||||
export { math }
|
export { math }
|
||||||
/*
|
/*
|
||||||
* 计算当前样品分析值*/
|
* 计算当前样品分析值*/
|
||||||
export function calcAnalysisValue(group) {
|
|
||||||
|
export function calcAnalysisValue(group, externalFormData, taskIngredientsWay) {
|
||||||
const MAX_ITERATIONS = 5 // 防止无限循环
|
const MAX_ITERATIONS = 5 // 防止无限循环
|
||||||
let iterations = 0
|
let iterations = 0
|
||||||
let changed = true
|
let changed = true
|
||||||
@@ -21,7 +22,6 @@ export function calcAnalysisValue(group) {
|
|||||||
let formula = ele.formula
|
let formula = ele.formula
|
||||||
let formulas = formula.split('|')
|
let formulas = formula.split('|')
|
||||||
let formulaVal = ''
|
let formulaVal = ''
|
||||||
console.log(formulas)
|
|
||||||
formulas.forEach(f => {
|
formulas.forEach(f => {
|
||||||
let value = ''
|
let value = ''
|
||||||
if (f.charAt(0) === 'p') {
|
if (f.charAt(0) === 'p') {
|
||||||
@@ -38,18 +38,18 @@ export function calcAnalysisValue(group) {
|
|||||||
|
|
||||||
formulaVal += value
|
formulaVal += value
|
||||||
})
|
})
|
||||||
console.log(formulaVal)
|
|
||||||
|
|
||||||
let v
|
let v = ''
|
||||||
if (formulaVal.startsWith('Get')) {
|
if (formulaVal.startsWith('Get_')) {
|
||||||
//计算公式为Get开头的,都是执行方法
|
//计算公式为Get开头的,都是执行方法,只有人工配料才执行
|
||||||
|
if (taskIngredientsWay !== 'manual') continue
|
||||||
v = eval(formulaVal)
|
v = eval(formulaVal)
|
||||||
|
} else if (formulaVal.startsWith('GetFrom')) {
|
||||||
|
v = evaluateGetFromFormula(formulaVal, false, externalFormData)
|
||||||
} else {
|
} else {
|
||||||
v = math.evaluate(formulaVal).toString()
|
v = math.evaluate(formulaVal).toString()
|
||||||
v = isFinite(v) ? v.toString() : 0
|
v = isFinite(v) ? v.toString() : 0
|
||||||
}
|
}
|
||||||
console.log(v)
|
|
||||||
|
|
||||||
ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
|
ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
@@ -60,22 +60,41 @@ export function calcAnalysisValue(group) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据样品和配置列计算分析值
|
// parse: 是否解析公式
|
||||||
export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
|
export function evaluateGetFromFormula(formula, parse, externalFormData, currentColumn, row, dynamicsColumns) {
|
||||||
if (!columnObj.paramNo || !row[columnObj.fieldIndex]) return
|
let formulaVal = formula
|
||||||
for (let i = 0; i < dynamicsColumns.length; i++) {
|
if (parse) {
|
||||||
let curItem = dynamicsColumns[i]
|
formulaVal = parseFormula(formulaVal, row, dynamicsColumns)
|
||||||
if (curItem.fieldIndex === columnObj.fieldIndex) continue
|
}
|
||||||
|
let relFormulaVal = formulaVal.split(':')[1]
|
||||||
|
for (const [key, value] of Object.entries(externalFormData)) {
|
||||||
|
if (relFormulaVal.includes(key)) {
|
||||||
|
relFormulaVal = relFormulaVal.replace(key, value || 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(relFormulaVal)
|
||||||
|
|
||||||
let param = columnObj.fieldIndex.charAt(0) === 'p' ? 'p' + columnObj.paramNo : 'e' + columnObj.paramNo
|
try {
|
||||||
if (curItem.formula && curItem.formula.includes(param)) {
|
let v = math.evaluate(relFormulaVal)
|
||||||
let formula = curItem.formula
|
v = isFinite(v) ? v : 0
|
||||||
|
if (parse) {
|
||||||
|
return handleRoundFiveNumber(v, currentColumn.decimalPosition)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('GetFrom formula evaluate error:', relFormulaVal, e)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 解析公式
|
||||||
|
function parseFormula(formula, row, dynamicsColumns) {
|
||||||
let formulas = formula.split('|')
|
let formulas = formula.split('|')
|
||||||
let formulaVal = ''
|
let formulaVal = ''
|
||||||
formulas.forEach(f => {
|
formulas.forEach(f => {
|
||||||
if (f.charAt(0) === 'p') {
|
if (f.charAt(0) === 'p') {
|
||||||
let o = dynamicsColumns.find(i => 'p' + i.paramNo === f && i.type !== 'project')
|
let o = dynamicsColumns.find(i => 'p' + i.paramNo === f && i.type !== 'project')
|
||||||
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
|
const currentColumnData = row[o.fieldIndex]
|
||||||
|
formulaVal += currentColumnData.value ? currentColumnData.value : 0
|
||||||
} else if (f.charAt(0) === 'e') {
|
} else if (f.charAt(0) === 'e') {
|
||||||
let o = dynamicsColumns.find(i => 'e' + i.paramNo === f)
|
let o = dynamicsColumns.find(i => 'e' + i.paramNo === f)
|
||||||
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
|
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
|
||||||
@@ -83,17 +102,32 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
|
|||||||
formulaVal += f
|
formulaVal += f
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
return formulaVal
|
||||||
|
}
|
||||||
|
// 根据样品和配置列计算分析值
|
||||||
|
export function calcRowAnalysisValue(row, columnObj, dynamicsColumns, externalFormData, taskIngredientsWay) {
|
||||||
|
if (!columnObj.paramNo || !row[columnObj.fieldIndex]) return
|
||||||
|
|
||||||
|
for (let i = 0; i < dynamicsColumns.length; i++) {
|
||||||
|
let curItem = dynamicsColumns[i]
|
||||||
|
if (curItem.fieldIndex === columnObj.fieldIndex) continue
|
||||||
|
|
||||||
|
let param = columnObj.fieldIndex.charAt(0) === 'p' ? 'p' + columnObj.paramNo : 'e' + columnObj.paramNo
|
||||||
|
if (curItem.formula && curItem.formula.includes(param)) {
|
||||||
|
let formula = curItem.formula
|
||||||
|
let formulaVal = parseFormula(formula, row, dynamicsColumns)
|
||||||
let v
|
let v
|
||||||
if (formulaVal.startsWith('Get')) {
|
if (formulaVal.startsWith('Get_')) {
|
||||||
formulaVal = formulaVal.replace(')', ",'" + row.conBaseSampleId + "')")
|
if (taskIngredientsWay !== 'manual') continue
|
||||||
v = eval(formulaVal)
|
v = eval(formulaVal)
|
||||||
|
} else if (formulaVal.startsWith('GetFrom')) {
|
||||||
|
v = evaluateGetFromFormula(formulaVal, false, externalFormData)
|
||||||
} else {
|
} else {
|
||||||
v = math.evaluate(formulaVal).toString()
|
v = math.evaluate(formulaVal).toString()
|
||||||
v = isFinite(v) ? v : 0
|
v = isFinite(v) ? v : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
row[curItem.fieldIndex].value = handleRoundFiveNumber(Number(v), row[curItem.fieldIndex].decimalPosition)
|
row[curItem.fieldIndex].value = handleRoundFiveNumber(Number(v), row[curItem.fieldIndex].decimalPosition)
|
||||||
calcRowAnalysisValue(row, curItem, dynamicsColumns)
|
calcRowAnalysisValue(row, curItem, dynamicsColumns, externalFormData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,6 +196,27 @@ const Get_C_KNO3_bySValue = function (sValue, weight, operator) {
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
function Get_C_KNO3(sValue, weight, operator) {
|
||||||
|
//判断sValue是数字
|
||||||
|
|
||||||
|
if (sValue === 0 || weight === 0) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
let S = number(sValue)
|
||||||
|
const W = number(weight)
|
||||||
|
if (W === 0) return ''
|
||||||
|
const V = ((W * S) / 100) * 22 - 75
|
||||||
|
if (operator === '<' && V < 0) {
|
||||||
|
console.log(math.abs(V / 12))
|
||||||
|
|
||||||
|
return math.abs(V / 12)
|
||||||
|
}
|
||||||
|
if (operator === '>=' && V >= 0) {
|
||||||
|
console.log(V / 4)
|
||||||
|
return V / 4
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
/** 处理数值数据:四舍六入奇进偶不进
|
/** 处理数值数据:四舍六入奇进偶不进
|
||||||
* 1,如果取小数的最后一位为5,5前为奇数进位,为偶不进,五后非零就进一,五后皆零看奇偶,五前为偶应舍去,五前为奇要进一
|
* 1,如果取小数的最后一位为5,5前为奇数进位,为偶不进,五后非零就进一,五后皆零看奇偶,五前为偶应舍去,五前为奇要进一
|
||||||
|
|||||||
@@ -66,21 +66,25 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<view v-if="taskIsIngredients == 1" class="x-f">
|
||||||
|
<template v-if="taskIngredientsWay === 'initial'">
|
||||||
|
<u-button class="btn-operation mr10" type="primary" @click="handleIngredients()">自动配料</u-button>
|
||||||
|
<u-button class="btn-operation ml10" type="primary" @click="handleManualIngredients()">人工配料</u-button>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="taskIngredientsWay == 'automatic'">
|
||||||
<u-button
|
<u-button
|
||||||
v-if="taskIngredientsStatus === 'allow_submit' || taskIsIngredients == '0'"
|
v-if="taskIngredientsStatus === 'allow_submit'"
|
||||||
class="btn-operation"
|
class="btn-operation"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="submitTask()"
|
@click="submitTask()"
|
||||||
>数据上报</u-button
|
>数据上报</u-button
|
||||||
>
|
>
|
||||||
<u-button
|
<u-button v-else class="btn-operation" type="primary" :disabled="taskIngredientsStatus === 'in_progress'"
|
||||||
v-else
|
>等待配料</u-button
|
||||||
class="btn-operation"
|
|
||||||
type="primary"
|
|
||||||
:disabled="taskIngredientsStatus === 'in_progress'"
|
|
||||||
@click="handleIngredients()"
|
|
||||||
>{{ taskIngredientsStatus === 'initial' ? '下发配料' : '等待配料' }}</u-button
|
|
||||||
>
|
>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<u-button v-else class="btn-operation" type="primary" @click="submitTask()">数据上报</u-button>
|
||||||
</u-col>
|
</u-col>
|
||||||
<u-col span="6">
|
<u-col span="6">
|
||||||
<view class="x-bc">
|
<view class="x-bc">
|
||||||
@@ -269,6 +273,7 @@ import {
|
|||||||
calcAnalysisValue,
|
calcAnalysisValue,
|
||||||
handleRoundFiveNumber,
|
handleRoundFiveNumber,
|
||||||
calcRowAnalysisValue,
|
calcRowAnalysisValue,
|
||||||
|
evaluateGetFromFormula,
|
||||||
math,
|
math,
|
||||||
groupByField,
|
groupByField,
|
||||||
validateElementRange
|
validateElementRange
|
||||||
@@ -287,6 +292,7 @@ const { proxy } = getCurrentInstance()
|
|||||||
const taskId = ref('')
|
const taskId = ref('')
|
||||||
const taskIngredientsStatus = ref('') //配料状态
|
const taskIngredientsStatus = ref('') //配料状态
|
||||||
const taskIsIngredients = ref('')
|
const taskIsIngredients = ref('')
|
||||||
|
const taskIngredientsWay = ref('')
|
||||||
const configReportTemplateKey = ref('')
|
const configReportTemplateKey = ref('')
|
||||||
const elId = nx.$helper.uuid()
|
const elId = nx.$helper.uuid()
|
||||||
const scrollTop = ref(0) //tab标题的滚动条位置
|
const scrollTop = ref(0) //tab标题的滚动条位置
|
||||||
@@ -685,7 +691,7 @@ const saveAuncelData = () => {
|
|||||||
syncFieldValueByEqualParamNo()
|
syncFieldValueByEqualParamNo()
|
||||||
//计算
|
//计算
|
||||||
try {
|
try {
|
||||||
calcAnalysisValue(fieldGroup.value)
|
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
@@ -767,7 +773,7 @@ function updateTableDataByConfigFields() {
|
|||||||
const columnObj = tab.columns.find(c => {
|
const columnObj = tab.columns.find(c => {
|
||||||
if (c.formula) {
|
if (c.formula) {
|
||||||
let FromKey = c.formula.split(':')
|
let FromKey = c.formula.split(':')
|
||||||
return FromKey[1] === key
|
return FromKey[1] === key || FromKey[0] === 'GetFrom'
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -775,9 +781,21 @@ function updateTableDataByConfigFields() {
|
|||||||
tab.tableData.forEach(row => {
|
tab.tableData.forEach(row => {
|
||||||
// 赋值配置列参与计算
|
// 赋值配置列参与计算
|
||||||
if (row[columnObj.fieldIndex]) {
|
if (row[columnObj.fieldIndex]) {
|
||||||
|
if (columnObj.formula.startsWith('From')) {
|
||||||
row[columnObj.fieldIndex].value = dynamicFormData[key]
|
row[columnObj.fieldIndex].value = dynamicFormData[key]
|
||||||
calcRowAnalysisValue(row, columnObj, tab.columns)
|
|
||||||
}
|
}
|
||||||
|
if (columnObj.formula.startsWith('GetFrom')) {
|
||||||
|
row[columnObj.fieldIndex].value = evaluateGetFromFormula(
|
||||||
|
columnObj.formula,
|
||||||
|
true,
|
||||||
|
dynamicFormData,
|
||||||
|
columnObj,
|
||||||
|
row,
|
||||||
|
tab.columns
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
calcRowAnalysisValue(row, columnObj, tab.columns, dynamicFormData, taskIngredientsWay.value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -935,11 +953,13 @@ async function getSampleAnalysisByTaskId() {
|
|||||||
businessAssayTasNo,
|
businessAssayTasNo,
|
||||||
formValue,
|
formValue,
|
||||||
ingredientsStatus,
|
ingredientsStatus,
|
||||||
isIngredients
|
isIngredients,
|
||||||
|
ingredientsWay
|
||||||
} = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
|
} = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value)
|
||||||
title.value = '样品分析-任务单编号:' + businessAssayTasNo
|
title.value = '样品分析-任务单编号:' + businessAssayTasNo
|
||||||
taskIngredientsStatus.value = ingredientsStatus
|
taskIngredientsStatus.value = ingredientsStatus
|
||||||
taskIsIngredients.value = isIngredients
|
taskIsIngredients.value = isIngredients
|
||||||
|
taskIngredientsWay.value = ingredientsWay
|
||||||
// 处理分析数据
|
// 处理分析数据
|
||||||
assayGroups.value = assayTaskAnalysisDataList.map(group => {
|
assayGroups.value = assayTaskAnalysisDataList.map(group => {
|
||||||
// 必须深拷贝 datas!防止多个表格共享引用
|
// 必须深拷贝 datas!防止多个表格共享引用
|
||||||
@@ -1142,7 +1162,7 @@ const listenNumKeyboard = () => {
|
|||||||
selectedField.value.symbol = symbol
|
selectedField.value.symbol = symbol
|
||||||
}
|
}
|
||||||
syncFieldValueByEqualParamNo()
|
syncFieldValueByEqualParamNo()
|
||||||
calcAnalysisValue(fieldGroup.value)
|
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||||
//自动跳转下一个字段
|
//自动跳转下一个字段
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
autoNextField()
|
autoNextField()
|
||||||
@@ -1171,7 +1191,7 @@ const clearFieldVal = () => {
|
|||||||
}
|
}
|
||||||
selectedField.value.value = ''
|
selectedField.value.value = ''
|
||||||
//重新计算
|
//重新计算
|
||||||
calcAnalysisValue(fieldGroup.value)
|
calcAnalysisValue(fieldGroup.value, dynamicFormData, taskIngredientsWay.value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1242,7 @@ const submitTask = () => {
|
|||||||
const url = `/pages/analysis/sample/pdf-preview?businessAssayTaskId=${taskId.value}&reportKey=${configReportTemplateKey.value}&showConfirmBtn=true`
|
const url = `/pages/analysis/sample/pdf-preview?businessAssayTaskId=${taskId.value}&reportKey=${configReportTemplateKey.value}&showConfirmBtn=true`
|
||||||
uni.navigateTo({ url })
|
uni.navigateTo({ url })
|
||||||
}
|
}
|
||||||
// 配料下发
|
// 自动配料
|
||||||
function handleIngredients() {
|
function handleIngredients() {
|
||||||
if (checkSampleReturning()) return
|
if (checkSampleReturning()) return
|
||||||
const params = {
|
const params = {
|
||||||
@@ -1232,6 +1252,16 @@ function handleIngredients() {
|
|||||||
getSampleAnalysisByTaskId()
|
getSampleAnalysisByTaskId()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 人工配料
|
||||||
|
function handleManualIngredients() {
|
||||||
|
const params = {
|
||||||
|
businessAssayTaskId: taskId.value
|
||||||
|
}
|
||||||
|
nx.$api.assayTask.manualIngredients(params).then(res => {
|
||||||
|
getSampleAnalysisByTaskId()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//
|
||||||
function checkSampleReturning() {
|
function checkSampleReturning() {
|
||||||
const analysisSampleData = assayGroups.value.find(t => t.value == 'analysis').tableData
|
const analysisSampleData = assayGroups.value.find(t => t.value == 'analysis').tableData
|
||||||
const hasReturning = analysisSampleData.some(item => item.rollbackStatus === 'in_progress')
|
const hasReturning = analysisSampleData.some(item => item.rollbackStatus === 'in_progress')
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import nx from '@/nx'
|
import nx from '@/nx'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
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'
|
import tools from '@/nx/utils/tools'
|
||||||
|
|
||||||
const pageLoading = ref(false)
|
const pageLoading = ref(false)
|
||||||
@@ -162,7 +162,6 @@ async function loadTaskDetail() {
|
|||||||
type: item.fieldType,
|
type: item.fieldType,
|
||||||
placeholder: '请输入',
|
placeholder: '请输入',
|
||||||
hidden: false
|
hidden: false
|
||||||
|
|
||||||
}
|
}
|
||||||
if (customConfig?.componentProps?.options) {
|
if (customConfig?.componentProps?.options) {
|
||||||
field.options = customConfig.componentProps.options
|
field.options = customConfig.componentProps.options
|
||||||
@@ -208,7 +207,7 @@ async function updateTableDataByConfigFields() {
|
|||||||
const columnObj = tab.columns.find(c => {
|
const columnObj = tab.columns.find(c => {
|
||||||
if (c.formula) {
|
if (c.formula) {
|
||||||
let FromKey = c.formula.split(':')
|
let FromKey = c.formula.split(':')
|
||||||
return FromKey[1] === key
|
return FromKey[1] === key || FromKey[0] === 'GetFrom'
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -216,9 +215,21 @@ async function updateTableDataByConfigFields() {
|
|||||||
tab.tableData.forEach(row => {
|
tab.tableData.forEach(row => {
|
||||||
// 赋值配置列参与计算
|
// 赋值配置列参与计算
|
||||||
if (row[columnObj.fieldIndex]) {
|
if (row[columnObj.fieldIndex]) {
|
||||||
row[columnObj.fieldIndex].value = formData[key]
|
if (columnObj.formula.startsWith('From')) {
|
||||||
calcRowAnalysisValue(row, columnObj, tab.columns)
|
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,13 +331,16 @@ function checkPropertyEquality() {
|
|||||||
for (const column of allColumns) {
|
for (const column of allColumns) {
|
||||||
const formula = column.formula
|
const formula = column.formula
|
||||||
if (!formula) continue
|
if (!formula) continue
|
||||||
const target = formula.split(':')[1]
|
for (const [key, value] of Object.entries(dynamicFormData.value)) {
|
||||||
const originalValue = dynamicFormData.value[target]
|
if (formula.includes(key)) {
|
||||||
const currentValue = realFormData.value[target]
|
const originalValue = value
|
||||||
|
const currentValue = realFormData.value[key]
|
||||||
if (!looseEqual(originalValue, currentValue)) {
|
if (!looseEqual(originalValue, currentValue)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user