cloud-web-corejs 1.0.54-dev.416 → 1.0.54-dev.418

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.
@@ -478,7 +478,13 @@ export default {
478
478
  const val = opt.substring(0, opt.length - 1);
479
479
  this.updateCodeMirror(val, val, "func");
480
480
  },
481
-
481
+ getFunStr(funcName) {
482
+ let map = {
483
+ SUMIF: `([],"",[])`,
484
+ SUMIFS: `([],[],"")`,
485
+ };
486
+ return map[funcName] || "()";
487
+ },
482
488
  updateCodeMirror(field, text, type = null) {
483
489
  if (type) {
484
490
  let obj = {
@@ -489,8 +495,12 @@ export default {
489
495
  let selectionLet = obj.field.length + obj.text.length + obj.type.length; //光标位置;
490
496
  let code = `{{${obj.field}.${obj.text}.${obj.type}}}`;
491
497
  if (type === "func") {
492
- code += "()";
493
- selectionLet = selectionLet + 7;
498
+ // code += "()";
499
+ // selectionLet = selectionLet + 7;
500
+ let funStr = this.getFunStr(text);
501
+ code += funStr;
502
+ let num = "()" === funStr ? 7 : 7 - 1 + funStr.length;
503
+ selectionLet = selectionLet + num;
494
504
  } else {
495
505
  selectionLet = selectionLet + 6;
496
506
  }
@@ -150,6 +150,10 @@ export default {
150
150
  "将数值去掉小数,举例:INT(-8.9)=-9",
151
151
  formulaSUM:
152
152
  "返回一组数据的和,举例:SUM(1,2,3,...)=6",
153
+ formulaSUMIF:
154
+ `根据单个条件对指定区域内的数值求和,举例:SUMIF([10, 20, 30], ">10", [80, 120, 90])=210`,
155
+ formulaSUMIFS:
156
+ `根据多个条件对指定区域内的数值求和(条件需同时满足),举例:SUMIFS([1000, 2000, 1500, 3000], [400, 600, 700, 800], '>500', [2022, 2023, 2023, 2024], 2023)=3500`,
153
157
  formulaAVERAGE:
154
158
  "返回一组数据的平均数,举例:AVERAGE(1,2,3,...)=2",
155
159
  formulaMAX:
@@ -167,6 +167,10 @@ function getFieldKeyName(widget) {
167
167
  let o = widget.options.name;
168
168
  return (widget.options.keyNameEnabled && widget.options.keyName) || o;
169
169
  }
170
+
171
+ function funOtherHanlde(){
172
+
173
+ }
170
174
  /**
171
175
  * 替换计算公式中的字段值
172
176
  * @param VFR
@@ -188,6 +192,10 @@ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, for
188
192
  if (nodeType === 'func') {
189
193
  const funcName = mi.split('.')[1]
190
194
  resultFormula = resultFormula.replace(mi, funcName)
195
+
196
+ /* if(funcName === "SUMIF" || funcName === "SUMIFS"){
197
+ debugger
198
+ } */
191
199
  return
192
200
  }
193
201
 
@@ -657,6 +665,16 @@ export const formulas = [
657
665
  fType: "designer.hint.formulaNumber",
658
666
  fIntro: "designer.hint.formulaSUM",
659
667
  },
668
+ {
669
+ fName: "SUMIF",
670
+ fType: "designer.hint.formulaNumber",
671
+ fIntro: "designer.hint.formulaSUMIF",
672
+ },
673
+ {
674
+ fName: "SUMIFS",
675
+ fType: "designer.hint.formulaNumber",
676
+ fIntro: "designer.hint.formulaSUMIFS",
677
+ },
660
678
  {
661
679
  fName: "AVERAGE",
662
680
  fType: "designer.hint.formulaNumber",