@zscreate/zhxy-app-component 1.0.184 → 1.0.185
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.
|
@@ -19,13 +19,14 @@ export const pubSubMixin = {
|
|
|
19
19
|
var num = Number(num).toFixed(length);
|
|
20
20
|
return type ? Number(num) : num;
|
|
21
21
|
},
|
|
22
|
-
calc_run(isFirstRun) {
|
|
22
|
+
calc_run(isFirstRun, msgData) {
|
|
23
23
|
let invalids = false
|
|
24
24
|
const {type: widgetType, options} = this.widget
|
|
25
25
|
let { formula, relyWidgets =[] } = options.formula
|
|
26
26
|
relyWidgets.forEach(item => {
|
|
27
27
|
formula = formula.replaceAll(`\$${item}\#`, item)
|
|
28
28
|
})
|
|
29
|
+
if (msgData.tableKey && msgData.tableKey === this.widget.tableKey && this.tableIndex != msgData.tableIndex) return
|
|
29
30
|
const tableArr = relyWidgets.filter(item => item.includes(".")).map(item => item.split("."))
|
|
30
31
|
const models = this.models
|
|
31
32
|
const keys = Object.keys(models)
|
|
@@ -36,6 +37,9 @@ export const pubSubMixin = {
|
|
|
36
37
|
if (tableData && Array.isArray(models[curr])) {
|
|
37
38
|
prev[key] = JSON.parse(JSON.stringify(models[curr]))
|
|
38
39
|
prev[key][tableData[1]] = prev[key].map(item => item[tableData[1]])
|
|
40
|
+
if ([msgData.tableKey, curr].every(item => this.widget.tableKey === item)) {
|
|
41
|
+
prev[key][tableData[1]] = prev[key][tableData[1]][msgData.tableIndex]
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
if (relyWidgets.includes(key) && isFirstRun && models[curr] === '') {
|
|
41
45
|
invalids = true
|
|
@@ -76,7 +80,7 @@ export const pubSubMixin = {
|
|
|
76
80
|
if (item.includes('.')) item = item.split('.').slice(-1)[0]
|
|
77
81
|
Pubsub.subscribe('calc_' + item.replace('_widget_', ''),(key, data) =>{
|
|
78
82
|
setTimeout(() => {
|
|
79
|
-
this.calc_run()
|
|
83
|
+
this.calc_run(false, data)
|
|
80
84
|
console.log(this, key, data)
|
|
81
85
|
}, 100)
|
|
82
86
|
} )
|