|
|
@@ -6,6 +6,11 @@ import { ReportDate as useReportDate } from '../public/ReportDate'
|
|
|
import { ICurrent_RPT, IRptTpl, IDataObj, Fields } from '../interface/basic'
|
|
|
import { JV } from './jpc_value_define';
|
|
|
|
|
|
+/* eslint-disable import/prefer-default-export */
|
|
|
+export const replaceAll = (FindText: RegExp | string, RepText: string, str: string): string => {
|
|
|
+ const regExp = new RegExp(FindText, 'g');
|
|
|
+ return str.replace(regExp, RepText);
|
|
|
+ };
|
|
|
|
|
|
export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURRENT_DATA: IDataObj, $CURRENT_RPT: ICurrent_RPT) => {
|
|
|
formulasDataSetter.setupData($CURRENT_RPT, $CURRENT_DATA);
|
|
|
@@ -33,7 +38,6 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
|
|
|
trim,
|
|
|
leftTrim,
|
|
|
rightTrim,
|
|
|
- replaceAll,
|
|
|
comdify,
|
|
|
convertToCaptionNum,
|
|
|
convertStrToBoolean,
|
|
|
@@ -55,7 +59,7 @@ export const formulaExec = (runType: string, $CURRENT_TEMPLATE: IRptTpl, $CURREN
|
|
|
// console.log(expression);
|
|
|
//临时处理
|
|
|
if (expression.indexOf(`new Date(`)) {
|
|
|
- newExpression= replaceAll(`new Date(`, `new ReportDate(`,expression)
|
|
|
+ newExpression= replaceAll(/new Date\(/g, `new ReportDate(`,expression)
|
|
|
}
|
|
|
eval(newExpression);
|
|
|
} catch (ex) {
|