mooho-base-admin-plus 2.0.10 → 2.0.12
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.
|
@@ -22034,6 +22034,11 @@ var mixinPage = {
|
|
|
22034
22034
|
return triggers;
|
|
22035
22035
|
},
|
|
22036
22036
|
calculate(text, model) {
|
|
22037
|
+
if (text == null) {
|
|
22038
|
+
return null;
|
|
22039
|
+
} else {
|
|
22040
|
+
text = text.toString();
|
|
22041
|
+
}
|
|
22037
22042
|
let result = "";
|
|
22038
22043
|
let expression = "";
|
|
22039
22044
|
for (let i3 = 0; i3 < text.length; i3++) {
|
|
@@ -35861,7 +35866,6 @@ const _sfc_main$w = {
|
|
|
35861
35866
|
}
|
|
35862
35867
|
},
|
|
35863
35868
|
onSelectDataChange(sender, selected) {
|
|
35864
|
-
console.log("onSelectDataChange", sender, selected);
|
|
35865
35869
|
let code2;
|
|
35866
35870
|
if (sender.code.endsWith("ID")) {
|
|
35867
35871
|
code2 = sender.code.substr(0, sender.code.length - 2);
|
|
@@ -35952,9 +35956,14 @@ const _sfc_main$w = {
|
|
|
35952
35956
|
this.dataBefore = this.copy(this.data);
|
|
35953
35957
|
for (let column of this.columns) {
|
|
35954
35958
|
if (!!(column.calculate || "").trim()) {
|
|
35955
|
-
let
|
|
35956
|
-
|
|
35957
|
-
|
|
35959
|
+
let calculate = column.calculate;
|
|
35960
|
+
calculate = this.calcStat("sum", calculate);
|
|
35961
|
+
calculate = this.calcStat("min", calculate);
|
|
35962
|
+
calculate = this.calcStat("max", calculate);
|
|
35963
|
+
calculate = this.calcStat("avg", calculate);
|
|
35964
|
+
let triggers = this.getTriggers(calculate);
|
|
35965
|
+
if (!sender || triggers.some((item) => item == sender.code) || column.calculate != calculate) {
|
|
35966
|
+
let result2 = this.calculate(calculate, this.data);
|
|
35958
35967
|
if (column.digit != null) {
|
|
35959
35968
|
result2 = this.keepDecimal(result2, column.digit, column.fixedDigit);
|
|
35960
35969
|
}
|
|
@@ -36079,6 +36088,42 @@ const _sfc_main$w = {
|
|
|
36079
36088
|
return value;
|
|
36080
36089
|
}
|
|
36081
36090
|
},
|
|
36091
|
+
calcStat(op, calculate) {
|
|
36092
|
+
let start2 = calculate.indexOf(op + "(");
|
|
36093
|
+
let end2 = calculate.indexOf(")", start2);
|
|
36094
|
+
if (start2 == -1 || end2 == -1) {
|
|
36095
|
+
return calculate;
|
|
36096
|
+
}
|
|
36097
|
+
let property = calculate.substring(start2 + 4, end2);
|
|
36098
|
+
if (property.indexOf(".") == -1) {
|
|
36099
|
+
return calculate;
|
|
36100
|
+
}
|
|
36101
|
+
let table = this.$refs["table_" + property.split(".")[0]];
|
|
36102
|
+
if (table == null || table.length == 0) {
|
|
36103
|
+
return calculate;
|
|
36104
|
+
}
|
|
36105
|
+
let tableData = table[0].getData();
|
|
36106
|
+
let result2 = null;
|
|
36107
|
+
let sum2 = null;
|
|
36108
|
+
let count2 = null;
|
|
36109
|
+
for (let item of tableData) {
|
|
36110
|
+
let value = this.parseData(item, property.substr(property.indexOf(".") + 1));
|
|
36111
|
+
if (value) {
|
|
36112
|
+
if (op == "sum") {
|
|
36113
|
+
result2 = result2 == null ? value : result2 + value;
|
|
36114
|
+
} else if (op == "min") {
|
|
36115
|
+
result2 = result2 == null ? value : value < result2 ? value : result2;
|
|
36116
|
+
} else if (op == "max") {
|
|
36117
|
+
result2 = result2 == null ? value : value > result2 ? value : result2;
|
|
36118
|
+
} else if (op == "avg") {
|
|
36119
|
+
sum2 = sum2 == null ? value : sum2 + value;
|
|
36120
|
+
count2 = count2 == null ? 1 : count2 + 1;
|
|
36121
|
+
result2 = count2 > 0 ? sum2 / count2 : null;
|
|
36122
|
+
}
|
|
36123
|
+
}
|
|
36124
|
+
}
|
|
36125
|
+
return calculate.substring(0, start2) + (result2 == null ? "null" : result2.toString()) + calculate.substring(end2 + 1);
|
|
36126
|
+
},
|
|
36082
36127
|
getNameI18n(column) {
|
|
36083
36128
|
if (this.layout.showI18n) {
|
|
36084
36129
|
if (column.code) {
|
|
@@ -41438,8 +41483,8 @@ const _sfc_main$q = {
|
|
|
41438
41483
|
},
|
|
41439
41484
|
onDataChange(data2, sender, selected) {
|
|
41440
41485
|
this.setShowStatus(data2);
|
|
41441
|
-
this.$emit("on-change", data2, sender, selected);
|
|
41442
41486
|
this.calc(data2, sender);
|
|
41487
|
+
this.$emit("on-change", data2, sender, selected);
|
|
41443
41488
|
if (sender == null || sender.triggers !== []) {
|
|
41444
41489
|
this.columns.forEach(function(column) {
|
|
41445
41490
|
if (!column.isStaticItem && !!(column.source || "").trim() && (sender == null || sender.triggers.some((item) => {
|