t20-common-lib 0.12.16 → 0.12.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t20-common-lib",
3
- "version": "0.12.16",
3
+ "version": "0.12.18",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -11,6 +11,12 @@
11
11
  @focus="handleFocus"
12
12
  @clear="() => handleFilter('')"
13
13
  >
14
+ <el-option
15
+ v-if="displayOption"
16
+ :key="`display-${displayOption[valueKey]}`"
17
+ :label="displayOption.branchBankName"
18
+ :value="displayOption[valueKey]"
19
+ />
14
20
  <el-option
15
21
  v-for="item in branchBankList"
16
22
  :key="item.cnapsNo"
@@ -73,6 +79,10 @@ export default {
73
79
  requestFn: {
74
80
  type: Function,
75
81
  required: true
82
+ },
83
+ branchBankName: {
84
+ type: String,
85
+ default: "",
76
86
  }
77
87
  },
78
88
  data() {
@@ -106,6 +116,17 @@ export default {
106
116
  // 只有在值实际变化时才重置(避免无意义的重新加载)
107
117
  if (newVal === oldVal) return;
108
118
 
119
+ // immediate 首次执行时 Vue2 的 oldVal 为 undefined,此时不应清空 v-model,
120
+ // 否则会冲掉父组件传入的回显值;仅按当前 bankCode 重新拉列表即可。
121
+ if (oldVal === undefined) {
122
+ this.branchBankList = [];
123
+ this.page.current = 1;
124
+ this.page.key = "";
125
+ this.page.hasMore = true;
126
+ this.fetchBranchData(true);
127
+ return;
128
+ }
129
+
109
130
  this.resetAndFetch();
110
131
  },
111
132
  },
@@ -113,8 +134,18 @@ export default {
113
134
  created() {
114
135
  this.debouncedFilter = debounce(this.handleFilter, 300);
115
136
  },
116
- mounted() {
117
- this.fetchBranchData(true);
137
+ computed: {
138
+ displayOption() {
139
+ if (this.multiple) return null;
140
+ if (!this.branchBankNo || !this.branchBankName) return null;
141
+ const existed = this.branchBankList.some(item => item[this.valueKey] == this.branchBankNo);
142
+ if (existed) return null;
143
+
144
+ return {
145
+ [this.valueKey]: this.branchBankNo,
146
+ branchBankName: this.branchBankName,
147
+ };
148
+ }
118
149
  },
119
150
  methods: {
120
151
  lazyGet() {