cloud-web-corejs 1.0.54-dev.413 → 1.0.54-dev.415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -198,9 +198,9 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
|
|
|
198
198
|
let fieldRef = VFR.getWidgetRef(fieldSchema.options.name)
|
|
199
199
|
if (!!fieldRef) {
|
|
200
200
|
//是否要考虑字符串值的替换??
|
|
201
|
-
// resultFormula = resultFormula.replace(mi, fieldRef.
|
|
201
|
+
// resultFormula = resultFormula.replace(mi, fieldRef.currentValue)
|
|
202
202
|
let fieldKeyName = getFieldKeyName(fieldSchema)
|
|
203
|
-
let value = fieldRef.formModel[fieldKeyName];
|
|
203
|
+
let value = fieldRef.formModel[fieldKeyName]??null;
|
|
204
204
|
resultFormula = resultFormula.replace(mi, value)
|
|
205
205
|
} else { //getWidgetRef找不到,则可能是子表单字段
|
|
206
206
|
const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
|
|
@@ -208,13 +208,13 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
|
|
|
208
208
|
/* 如果当前计算字段是子表单字段,要判断公式中的子表单字段是否和当前计算字段是否属于同一子表单!! */
|
|
209
209
|
if(row){
|
|
210
210
|
let fieldKeyName = getFieldKeyName(fieldSchema)
|
|
211
|
-
let value = row[fieldKeyName];
|
|
211
|
+
let value = row[fieldKeyName]??null;
|
|
212
212
|
resultFormula = resultFormula.replaceAll(mi, value)
|
|
213
213
|
/*
|
|
214
214
|
let subFormRowId = row._X_ROW_KEY
|
|
215
215
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
|
|
216
216
|
if (!!fieldRef) {
|
|
217
|
-
let value = fieldRef.
|
|
217
|
+
let value = fieldRef.currentValue;
|
|
218
218
|
resultFormula = resultFormula.replaceAll(mi, value)
|
|
219
219
|
} else {
|
|
220
220
|
de
|
|
@@ -225,7 +225,7 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
|
|
|
225
225
|
let subFormRowId = formulaFieldRef.tableParam.row._X_ROW_KEY
|
|
226
226
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
|
|
227
227
|
if (!!fieldRef) {
|
|
228
|
-
let value = fieldRef.
|
|
228
|
+
let value = fieldRef.currentValue??null;
|
|
229
229
|
resultFormula = resultFormula.replaceAll(mi, value)
|
|
230
230
|
} else {
|
|
231
231
|
quitFlag = true
|
|
@@ -234,22 +234,25 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
|
|
|
234
234
|
} else if (subFormNameOfField === formulaFieldRef.subFormName) {
|
|
235
235
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '@row' + formulaFieldRef.subFormRowId)
|
|
236
236
|
if (!!fieldRef) {
|
|
237
|
-
resultFormula = resultFormula.replaceAll(mi, fieldRef.
|
|
237
|
+
resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
|
|
238
238
|
} else {
|
|
239
239
|
quitFlag = true
|
|
240
240
|
console.error('Field not found: ' + fieldSchema.options.label)
|
|
241
241
|
}
|
|
242
|
-
}
|
|
242
|
+
}else {
|
|
243
243
|
console.error('Invalid formula!')
|
|
244
244
|
}
|
|
245
245
|
} else {
|
|
246
246
|
/* 在主表单字段的计算公式中使用子表单字段,应将子表单所有记录同字段的值代入!! */
|
|
247
|
-
const subFormValue = VFR.formDataModel[subFormNameOfField]
|
|
247
|
+
// const subFormValue = VFR.formDataModel[subFormNameOfField]
|
|
248
|
+
let dataTableRef = VFR.getWidgetRef(subFormNameOfField)
|
|
249
|
+
const subFormValue = VFR.formDataModel[fieldKeyName(dataTableRef.widget)]
|
|
248
250
|
let allSubFieldValues = ''
|
|
249
251
|
// const subFieldName = fieldSchema.options.name
|
|
250
252
|
const subFieldName = fieldKeyName(fieldSchema)
|
|
251
253
|
subFormValue.forEach((vi, idx) => {
|
|
252
|
-
|
|
254
|
+
let val = vi[subFieldName]??null
|
|
255
|
+
allSubFieldValues = (idx === 0) ? val : allSubFieldValues + ', ' + val
|
|
253
256
|
})
|
|
254
257
|
resultFormula = resultFormula.replaceAll(mi, allSubFieldValues)
|
|
255
258
|
}
|
|
@@ -325,6 +328,7 @@ export function fieldIsUsedInFormula(fieldName, formula, VFR, fieldTarget) {
|
|
|
325
328
|
return foundResult
|
|
326
329
|
}
|
|
327
330
|
|
|
331
|
+
|
|
328
332
|
/**
|
|
329
333
|
* 替换计算公式中的字段值
|
|
330
334
|
* @param VFR
|
|
@@ -356,7 +360,7 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
|
356
360
|
let fieldRef = VFR.getWidgetRef(fieldSchema.options.name)
|
|
357
361
|
if (!!fieldRef) {
|
|
358
362
|
//是否要考虑字符串值的替换??
|
|
359
|
-
resultFormula = resultFormula.replace(mi, fieldRef.
|
|
363
|
+
resultFormula = resultFormula.replace(mi, fieldRef.currentValue)
|
|
360
364
|
} else { //getWidgetRef找不到,则可能是子表单字段
|
|
361
365
|
const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
|
|
362
366
|
if (!!formulaFieldRef.subFormItemFlag || formulaFieldRef.tableParam) {
|
|
@@ -367,7 +371,7 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
|
367
371
|
let subFormRowId = formulaFieldRef.tableParam.row._X_ROW_KEY
|
|
368
372
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
|
|
369
373
|
if (!!fieldRef) {
|
|
370
|
-
resultFormula = resultFormula.replaceAll(mi, fieldRef.
|
|
374
|
+
resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
|
|
371
375
|
} else {
|
|
372
376
|
quitFlag = true
|
|
373
377
|
console.error('Field not found: ' + fieldSchema.options.label)
|
|
@@ -375,7 +379,7 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
|
375
379
|
} else if (subFormNameOfField === formulaFieldRef.subFormName) {
|
|
376
380
|
fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '@row' + formulaFieldRef.subFormRowId)
|
|
377
381
|
if (!!fieldRef) {
|
|
378
|
-
resultFormula = resultFormula.replaceAll(mi, fieldRef.
|
|
382
|
+
resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
|
|
379
383
|
} else {
|
|
380
384
|
quitFlag = true
|
|
381
385
|
console.error('Field not found: ' + fieldSchema.options.label)
|
|
@@ -385,7 +389,10 @@ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
|
|
|
385
389
|
}
|
|
386
390
|
} else {
|
|
387
391
|
/* 在主表单字段的计算公式中使用子表单字段,应将子表单所有记录同字段的值代入!! */
|
|
388
|
-
const subFormValue = VFR.formDataModel[subFormNameOfField]
|
|
392
|
+
// const subFormValue = VFR.formDataModel[subFormNameOfField]
|
|
393
|
+
let dataTableRef = VFR.getWidgetRef(subFormNameOfField)
|
|
394
|
+
const subFormValue = VFR.formDataModel[fieldKeyName(dataTableRef.widget)]
|
|
395
|
+
|
|
389
396
|
let allSubFieldValues = ''
|
|
390
397
|
// const subFieldName = fieldSchema.options.name
|
|
391
398
|
const subFieldName = fieldKeyName(fieldSchema)
|