t20-common-lib 0.11.2 → 0.11.3
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/README.md +10 -0
- package/package.json +1 -1
- package/packages/branch-bank-select/src/main.vue +22 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -158,8 +158,29 @@ export default {
|
|
|
158
158
|
this.fetchBranchData(true);
|
|
159
159
|
},
|
|
160
160
|
handleBranchChange(val) {
|
|
161
|
+
// 保持 v-model 行为
|
|
161
162
|
this.$emit('input', val);
|
|
162
|
-
|
|
163
|
+
|
|
164
|
+
// 尝试从已加载的列表中找到完整的 item 对象
|
|
165
|
+
const findByValueKey = (v) => {
|
|
166
|
+
if (v === undefined || v === null) return null;
|
|
167
|
+
return this.branchBankList.find(item => item[this.valueKey] == v) || null;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
let option = null;
|
|
171
|
+
if (this.multiple) {
|
|
172
|
+
// 多选时 val 应为数组,映射回对应的对象数组,过滤掉未找到的项
|
|
173
|
+
if (Array.isArray(val)) {
|
|
174
|
+
option = val.map(v => findByValueKey(v)).filter(i => i != null);
|
|
175
|
+
} else {
|
|
176
|
+
option = [];
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
// 单选时返回对应对象或 null
|
|
180
|
+
option = findByValueKey(val) || null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.$emit('canGetData', val, option);
|
|
163
184
|
},
|
|
164
185
|
handleFocus() {
|
|
165
186
|
if (!this.page.key && this.branchBankList.length === 0) {
|