bri-components 1.4.17 → 1.4.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": "bri-components",
3
- "version": "1.4.17",
3
+ "version": "1.4.18",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -12,7 +12,7 @@
12
12
  <dsh-control-input
13
13
  v-if="canEdit"
14
14
  :class="commonClass"
15
- :value="curValList"
15
+ :value="selfCurValList"
16
16
  :disabled="selfPropsObj._disabled"
17
17
  :propsObj="selfPropsObj"
18
18
  @deleteItem="clickDeleteItem"
@@ -27,9 +27,9 @@
27
27
  }"
28
28
  >
29
29
  <dsh-tags
30
- v-if="!$isEmptyData(curValList)"
30
+ v-if="!$isEmptyData(selfCurValList)"
31
31
  class="text"
32
- :list="curValList"
32
+ :list="selfCurValList"
33
33
  ></dsh-tags>
34
34
 
35
35
  <template v-else>
@@ -61,7 +61,7 @@
61
61
  class="item"
62
62
  >
63
63
  <span class="item-name">
64
- {{ selectItem.full_name || selectItem.name }}
64
+ {{ getShowName(selectItem) }}
65
65
  </span>
66
66
  <Icon
67
67
  class="item-delete"
@@ -87,7 +87,6 @@
87
87
  class="list-center"
88
88
  >
89
89
  <bri-loading v-if="loading" />
90
-
91
90
  <template v-else>
92
91
  <!-- 树形形式 -->
93
92
  <div class="list-center-tree">
@@ -101,6 +100,7 @@
101
100
  @on-change="changeSelect"
102
101
  ></bri-tree-item>
103
102
  </template>
103
+
104
104
  <div
105
105
  v-else
106
106
  class="tree-nodata"
@@ -111,6 +111,7 @@
111
111
  </template>
112
112
  </div>
113
113
  </div>
114
+
114
115
  <dsh-buttons
115
116
  class="bri-modal-footer"
116
117
  :list="$getOperationList(['canCancel', 'canConfirm'])"
@@ -172,6 +173,9 @@
172
173
  _highSearch: false,
173
174
  _changeOnSelect: true,
174
175
  _searchString: "",
176
+ _useFullName: false, // 使用全名
177
+ _expandLevel: 1, // 列表打开,默认展开到第几级
178
+
175
179
  _reverseFilter: false,
176
180
  _userDepartFilterVals: [],
177
181
 
@@ -179,14 +183,6 @@
179
183
  ...this.commonDealPropsObj
180
184
  };
181
185
  },
182
- // 反向过滤
183
- reverseFilter () {
184
- return this.selfPropsObj._reverseFilter;
185
- },
186
- // 禁止显示的部门以及部门下人员
187
- listFilterVals () {
188
- return this.selfPropsObj._userDepartFilterVals || [];
189
- },
190
186
  highSearch () {
191
187
  return this.isOnSearch ? true : this.selfPropsObj._highSearch;
192
188
  },
@@ -196,6 +192,20 @@
196
192
  searchString () {
197
193
  return this.selfPropsObj._searchString;
198
194
  },
195
+ useFullName () {
196
+ return this.selfPropsObj._useFullName;
197
+ },
198
+ expandLevel () {
199
+ return this.selfPropsObj._expandLevel;
200
+ },
201
+ // 反向过滤
202
+ reverseFilter () {
203
+ return this.selfPropsObj._reverseFilter;
204
+ },
205
+ // 禁止显示的部门以及部门下人员
206
+ listFilterVals () {
207
+ return this.selfPropsObj._userDepartFilterVals || [];
208
+ },
199
209
 
200
210
  modalPropsObj () {
201
211
  return {
@@ -216,10 +226,20 @@
216
226
  ], this.selectKeys);
217
227
  },
218
228
 
229
+ selfCurValList () {
230
+ return this.curValList.map(depart => {
231
+ return {
232
+ ...depart,
233
+ full_name: this.useFullName ? depart.full_name : undefined
234
+ };
235
+ });
236
+ },
219
237
  showVal () {
220
- return this.$isEmptyData(this.curValList)
238
+ return this.$isEmptyData(this.selfCurValList)
221
239
  ? this.emptyShowVal
222
- : this.curValList.map(depart => depart.full_name || depart.name).join("、");
240
+ : this.selfCurValList
241
+ .map(depart => this.getShowName(depart))
242
+ .join("、");
223
243
  }
224
244
  },
225
245
  created () {},
@@ -233,17 +253,17 @@
233
253
  if (this.finalCanEdit) {
234
254
  this.openModal();
235
255
 
236
- this.newValList = this.$deepCopy(this.curValList);
256
+ this.newValList = this.$deepCopy(this.selfCurValList);
237
257
  this.searchName = "";
238
258
  this.getListData();
239
259
  }
240
260
  },
241
261
  clickDeleteItem (deleteItem) {
242
- this.curValList = this.curValList.filter(item => item._key != deleteItem._key);
262
+ this.selfCurValList = this.selfCurValList.filter(item => item._key != deleteItem._key);
243
263
  },
244
264
  // 点击清除选择项
245
265
  clickClear () {
246
- this.curValList = [];
266
+ this.selfCurValList = [];
247
267
  },
248
268
 
249
269
  /* ---------- 弹框里 --------- */
@@ -269,17 +289,23 @@
269
289
  clickConfirm () {
270
290
  this.closeModal();
271
291
 
272
- this.curValList = this.newValList;
292
+ this.selfCurValList = this.newValList;
273
293
  },
274
294
 
275
295
  /* ----------- 接口方法和加工方法 --------- */
296
+ // 获取显示名
297
+ getShowName (depart) {
298
+ return this.useFullName
299
+ ? depart.full_name || depart.name
300
+ : depart.name;
301
+ },
276
302
  // 处理数据
277
303
  transformDepartmentList (data = [], selectKeys = []) {
278
304
  return data.map(item => ({
279
305
  ...item,
280
306
  title: item.name,
281
307
  checked: selectKeys.includes(item._key),
282
- expand: !!(item.children && item.children.length && item.level < 2),
308
+ expand: !!(item.children && item.children.length && item.level < this.expandLevel),
283
309
  children: this.transformDepartmentList(item.children, selectKeys)
284
310
  }));
285
311
  },