t20-common-lib 0.12.17 → 0.12.19
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
CHANGED
|
@@ -91,6 +91,8 @@ export default {
|
|
|
91
91
|
branchBankList: [],
|
|
92
92
|
// 本地标志:用于抑制由本组件触发的 bankCode 变更导致的 reset
|
|
93
93
|
_suppressBankCodeReset: false,
|
|
94
|
+
// 初始化阶段标志:首次拿到有效 bankCode 前,不清空回显值
|
|
95
|
+
_bankCodeInitialized: false,
|
|
94
96
|
page: {
|
|
95
97
|
current: 1,
|
|
96
98
|
size: 20,
|
|
@@ -116,6 +118,15 @@ export default {
|
|
|
116
118
|
// 只有在值实际变化时才重置(避免无意义的重新加载)
|
|
117
119
|
if (newVal === oldVal) return;
|
|
118
120
|
|
|
121
|
+
// 初始化阶段(包括先空后有值的两次触发)只重拉列表,不清空回显值
|
|
122
|
+
if (!this._bankCodeInitialized) {
|
|
123
|
+
this.reloadListOnly();
|
|
124
|
+
if (this.hasValidBankCode(newVal)) {
|
|
125
|
+
this._bankCodeInitialized = true;
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
119
130
|
this.resetAndFetch();
|
|
120
131
|
},
|
|
121
132
|
},
|
|
@@ -123,9 +134,6 @@ export default {
|
|
|
123
134
|
created() {
|
|
124
135
|
this.debouncedFilter = debounce(this.handleFilter, 300);
|
|
125
136
|
},
|
|
126
|
-
mounted() {
|
|
127
|
-
this.fetchBranchData(true);
|
|
128
|
-
},
|
|
129
137
|
computed: {
|
|
130
138
|
displayOption() {
|
|
131
139
|
if (this.multiple) return null;
|
|
@@ -197,14 +205,21 @@ export default {
|
|
|
197
205
|
this.page.hasMore = true;
|
|
198
206
|
this.fetchBranchData(true);
|
|
199
207
|
},
|
|
200
|
-
|
|
208
|
+
hasValidBankCode(val) {
|
|
209
|
+
if (Array.isArray(val)) return val.length > 0;
|
|
210
|
+
return val !== undefined && val !== null && val !== "";
|
|
211
|
+
},
|
|
212
|
+
reloadListOnly() {
|
|
201
213
|
this.branchBankList = [];
|
|
202
214
|
this.page.current = 1;
|
|
203
215
|
this.page.key = "";
|
|
204
216
|
this.page.hasMore = true;
|
|
205
|
-
this.branchBankNo = this.multiple ? [] : "";
|
|
206
217
|
this.fetchBranchData(true);
|
|
207
218
|
},
|
|
219
|
+
resetAndFetch() {
|
|
220
|
+
this.reloadListOnly();
|
|
221
|
+
this.branchBankNo = this.multiple ? [] : "";
|
|
222
|
+
},
|
|
208
223
|
handleBranchChange(val) {
|
|
209
224
|
// 保持 v-model 行为
|
|
210
225
|
// 在 emit 之前设置抑制标志,防止父组件基于此事件同步修改 `bankCode` 导致我们被动地重置
|