cloud-web-corejs 1.0.54-dev.372 → 1.0.54-dev.373
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 +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
- package/src/components/xform/form-render/index.vue +62 -23
- package/src/components/xform/form-render/indexMixin.js +3151 -2
- package/src/components/xform/mixins/defaultHandle.js +336 -1
- package/src/components/xform/utils/formula-util.js +30 -0
- package/src/layout/components/Sidebar/default.vue +1389 -1266
- package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
|
@@ -124,6 +124,36 @@ export function calculateFormula(VFR, DSV, formulaJs, formulaFieldRef, changedFi
|
|
|
124
124
|
formulaFieldRef.setValue(formulaValue)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
export function calculateFormula2(formulaStr, data, that) {
|
|
128
|
+
if(!formulaStr)return
|
|
129
|
+
let formula = formulaStr;
|
|
130
|
+
let VFR = that.getFormRef();
|
|
131
|
+
let DSV = that.getGlobalDsv()
|
|
132
|
+
let formulaJs = formulajs
|
|
133
|
+
|
|
134
|
+
if(data){
|
|
135
|
+
for(let key in data){
|
|
136
|
+
formula = formula.replaceAll(`[${key}]`,(data[key] || 0))
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//替换formula-js函数
|
|
141
|
+
const matchResult = formula.match(/[A-Za-z]*/g)
|
|
142
|
+
let matchedList = []
|
|
143
|
+
if (!!matchResult) {
|
|
144
|
+
matchResult.forEach(mi => {
|
|
145
|
+
if (!!mi && (findCalFunStartIndex(mi) !== -1) && !matchedList.includes(mi)) {
|
|
146
|
+
const funcName = mi.toUpperCase()
|
|
147
|
+
formula = formula.replaceAll(mi, 'formulaJs.' + funcName)
|
|
148
|
+
matchedList.push(mi)
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const formulaValue = evalFn(formula, DSV, VFR, formulaJs)
|
|
154
|
+
return formulaValue
|
|
155
|
+
}
|
|
156
|
+
|
|
127
157
|
/**
|
|
128
158
|
* 判断字段是否用在计算公式中
|
|
129
159
|
* @param fieldName
|