bri-components 1.3.7 → 1.3.8

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.3.7",
3
+ "version": "1.3.8",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -250,6 +250,7 @@
250
250
  // 回调- 导入成功
251
251
  importCb (data) {
252
252
  this.value[this.controlKey] = data;
253
+ this.change(data);
253
254
  },
254
255
 
255
256
  // 校验方法 -供外部使用
@@ -290,7 +290,9 @@
290
290
  highSearch () {
291
291
  return this.isOnSearch ? true : this.selfPropsObj._highSearch;
292
292
  },
293
-
293
+ isCompAdmin () {
294
+ return (JSON.parse(sessionStorage.getItem("userData")) || {}).isCompAdmin || this.selfPropsObj._isCompAdmin;
295
+ },
294
296
  curCheckAll () {
295
297
  return this.userList.length && this.userList.every(userItem =>
296
298
  this.newValList.some(newItem => newItem._key === userItem._key)
@@ -340,6 +342,8 @@
340
342
  if (departmentItem._key === "_highSearch") {
341
343
  this.userList = this.hightUsers;
342
344
  this.total = 1;
345
+ } else if (departmentItem._key === "_resign") {
346
+ this.getResignListData();
343
347
  } else {
344
348
  this.getUserListData();
345
349
  }
@@ -412,6 +416,35 @@
412
416
  }
413
417
  });
414
418
  },
419
+ getResignListData () {
420
+ this.userList = [];
421
+
422
+ this.$https({
423
+ url: {
424
+ module: "company",
425
+ name: "userResign"
426
+ },
427
+ params: {
428
+ search: {
429
+ realname: this.searchData.name
430
+ ? {
431
+ $regex: `.*${this.$speciaWord(this.searchData.name)}.*`,
432
+ $options: "i"
433
+ }
434
+ : undefined
435
+ },
436
+ pagination: {
437
+ page: this.pagePropsObj.page,
438
+ pagesize: this.pagePropsObj.pagesize
439
+ }
440
+ },
441
+ loadingName: "loading",
442
+ callback: data => {
443
+ this.userList = data.list;
444
+ this.total = data.total;
445
+ }
446
+ });
447
+ },
415
448
  getDepartmentListData () {
416
449
  this.$https({
417
450
  url: {
@@ -435,6 +468,18 @@
435
468
  ]
436
469
  : []
437
470
  ),
471
+ ...(
472
+ this.highSearch && this.isCompAdmin
473
+ ? [
474
+ {
475
+ is_leaf: true,
476
+ level: 1,
477
+ name: "离职人员",
478
+ _key: "_resign"
479
+ }
480
+ ]
481
+ : []
482
+ ),
438
483
  {
439
484
  is_leaf: true,
440
485
  level: 1,
@@ -13,7 +13,7 @@
13
13
  <!-- 添加行 -->
14
14
  <dsh-buttons
15
15
  class="BriFlatTable-create"
16
- :list="$getOperationList(['create'])"
16
+ :list="$getOperationList(['canCreate'])"
17
17
  @click="$dispatchEvent($event, null, null, listData)"
18
18
  ></dsh-buttons>
19
19
  </div>
@@ -112,16 +112,19 @@
112
112
  return {
113
113
  isShare: false, // 是否是分享页在用
114
114
 
115
- _contentHeight: 500,
115
+ _showRequired: true, // 表头显示校验符号*
116
+ _showDescription: true, // 表头显示提示
117
+ _headHeightAuto: false, // 表头高度自适应
118
+ _heightAuto: false, // 单元格高度自适应
116
119
  _useSelection: false, // 使用选择列
117
120
  _useIndex: true, // 使用序号列
118
121
  _useSummary: false, // 使用汇总行
119
122
  _disabledBtns: false, // 禁用增删按钮
120
123
  _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
121
124
  _disabledOldDataRow: false, // 置灰老数据行包含删除
122
- _heightAuto: false, // 单元格内容高度自适应
125
+ ...this.propsObj,
123
126
 
124
- ...this.propsObj
127
+ _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
125
128
  };
126
129
  },
127
130
  isShare () {
@@ -130,6 +133,18 @@
130
133
  contentHeight () {
131
134
  return this.selfPropsObj._contentHeight;
132
135
  },
136
+ showRequired () {
137
+ return this.selfPropsObj._showRequired;
138
+ },
139
+ showDescription () {
140
+ return this.selfPropsObj._showDescription;
141
+ },
142
+ headHeightAuto () {
143
+ return this.selfPropsObj._headHeightAuto;
144
+ },
145
+ heightAuto () {
146
+ return this.selfPropsObj._heightAuto;
147
+ },
133
148
  useSelection () {
134
149
  return this.selfPropsObj._useSelection;
135
150
  },
@@ -148,15 +163,12 @@
148
163
  disabledOldDataRow () {
149
164
  return this.selfPropsObj._disabledOldDataRow;
150
165
  },
151
- heightAuto () {
152
- return this.selfPropsObj._heightAuto;
153
- },
154
166
 
155
167
  useCampare () {
156
168
  return !!this.oldListData.length;
157
169
  },
158
170
  filterColumns () {
159
- return this.columns.filter(colItem => this.$isAdvRelyShow(colItem, this.outObj));
171
+ return this.columns.filter(colItem => this.$isAdvRelyShow(colItem, this.outObj, true));
160
172
  },
161
173
  showColumns () {
162
174
  const operationList = this.$getOperationList(["delete"]);
@@ -192,95 +204,70 @@
192
204
  : []
193
205
  ),
194
206
 
195
- ...this.$transformToColumns(this.filterColumns.map(item => ({
196
- filter: undefined,
197
- sortBy: undefined,
198
- renderBodyCell: ({ row, column, rowIndex }, h) => {
199
- return [
200
- this.isShowCompare(column, row, this.oldListData[rowIndex])
201
- ? h("Tooltip", {
202
- class: "td-inner-compare",
203
- props: {
204
- content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
205
- ? ""
206
- : this.oldListData[rowIndex][column._key],
207
- transfer: true,
208
- maxWidth: 200,
209
- placement: "top"
210
- },
211
- scopedSlots: {
212
- default: props => h("dsh-list-unit", {
213
- props: {
214
- canEdit: this.getUnitCanEdit(column, row),
215
- formData: row,
216
- formItem: this.resetCol(item),
217
- rowIndex: rowIndex,
218
- parentData: this.listData
219
- },
220
- on: {
221
- blur: () => this.controlBlur(null, column, row, arguments),
222
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
223
- }
224
- })
225
- }
226
- })
227
- : h("dsh-list-unit", {
228
- props: {
229
- canEdit: this.getUnitCanEdit(column, row),
230
- formData: row,
231
- formItem: this.resetCol(item),
232
- rowIndex: rowIndex,
233
- parentData: this.listData
234
- },
235
- on: {
236
- blur: () => this.controlBlur(null, column, row, arguments),
237
- change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
238
- }
239
- }),
240
-
241
- !this.getRuleResult(column, row).bool
242
- ? h("span", {
243
- class: "table-row-td-tip"
244
- }, this.getRuleResult(column, row).message)
245
- : undefined
246
- ];
247
- },
248
- renderHeaderCell: ({ column }, h) => {
249
- return h("span", {
250
- style: {
251
- position: "relative"
252
- }
253
- }, [
254
- column._required && h("i", {
255
- style: {
256
- position: "absolute",
257
- top: "2px",
258
- left: "-10px",
259
- color: "#ed4014"
260
- }
261
- }, "*"),
262
-
263
- h("span", column.title),
264
-
265
- column._description && h("Tooltip", {
266
- style: {
267
- display: "inline-block"
268
- },
269
- props: {
270
- content: column._description,
271
- transfer: true,
272
- maxWidth: 200
273
- },
274
- scopedSlots: {
275
- default: props => h("i", {
276
- class: "table-head-description ivu-icon bico-font bico-explain"
207
+ ...this.$transformToColumns(
208
+ this.filterColumns.map(item => ({
209
+ filter: undefined,
210
+ sortBy: undefined,
211
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
212
+ return [
213
+ this.isShowCompare(column, row, this.oldListData[rowIndex])
214
+ ? h("Tooltip", {
215
+ style: {
216
+ width: "100%"
217
+ },
218
+ props: {
219
+ content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
220
+ ? ""
221
+ : this.oldListData[rowIndex][column._key],
222
+ transfer: true,
223
+ maxWidth: 200,
224
+ placement: "top"
225
+ },
226
+ scopedSlots: {
227
+ default: props => h("dsh-list-unit", {
228
+ props: {
229
+ canEdit: this.getUnitCanEdit(column, row),
230
+ formData: row,
231
+ formItem: this.resetCol(item),
232
+ rowIndex: rowIndex,
233
+ parentData: this.listData
234
+ },
235
+ on: {
236
+ blur: () => this.controlBlur(null, column, row, arguments),
237
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
238
+ }
239
+ })
240
+ }
277
241
  })
278
- }
279
- })
280
- ]);
281
- },
282
- ...item
283
- }))),
242
+ : h("dsh-list-unit", {
243
+ props: {
244
+ canEdit: this.getUnitCanEdit(column, row),
245
+ formData: row,
246
+ formItem: this.resetCol(item),
247
+ rowIndex: rowIndex,
248
+ parentData: this.listData
249
+ },
250
+ on: {
251
+ blur: () => this.controlBlur(null, column, row, arguments),
252
+ change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
253
+ }
254
+ }),
255
+
256
+ !this.getRuleResult(column, row).bool
257
+ ? h("span", {
258
+ class: "bri-table-td-tip"
259
+ }, this.getRuleResult(column, row).message)
260
+ : undefined
261
+ ];
262
+ },
263
+ ...item
264
+ })),
265
+ {
266
+ showRequired: this.showRequired,
267
+ showDescription: this.showDescription,
268
+ headHeightAuto: this.headHeightAuto
269
+ }
270
+ ),
284
271
 
285
272
  ...(
286
273
  this.canEdit && operationList.length
@@ -316,9 +303,9 @@
316
303
  },
317
304
  operationMap () {
318
305
  const allOperationMap = {
319
- create: {
306
+ canCreate: {
320
307
  name: "添加一行",
321
- type: "create",
308
+ type: "canCreate",
322
309
  size: "default",
323
310
  long: true,
324
311
  disabled: !!this.disabledCreateBtn,
@@ -350,7 +337,7 @@
350
337
  ? this.$categoryMapToMap(
351
338
  allOperationMap,
352
339
  null,
353
- this.disabledBtns ? ["create", "delete"] : []
340
+ this.disabledBtns ? ["canCreate", "delete"] : []
354
341
  )
355
342
  : {};
356
343
  }
@@ -448,81 +435,11 @@
448
435
  };
449
436
  </script>
450
437
 
451
- <style lang="less">
438
+ <style lang="less" scoped>
452
439
  .BriFlatTable {
453
440
  &-main {
454
441
  width: 100%;
455
442
  height: auto;
456
-
457
- .table {
458
- width: 100%;
459
- border-spacing: 0;
460
- border-collapse: collapse;
461
- border-color: #E5E5E5;
462
- background-color: #fff;
463
-
464
- &-head {
465
- background-color: #f0f0f0;
466
- color: #666;
467
-
468
- &-description {
469
- color: #828499;
470
- }
471
- }
472
-
473
- &-row {
474
- height: 50px;
475
-
476
- &:hover {
477
- .table-row-td-add {
478
- display: inline-block;
479
- }
480
- }
481
-
482
- &-td {
483
- position: relative;
484
-
485
- .td-inner {
486
- &-compare {
487
- width: 100%;
488
- }
489
- }
490
-
491
- &-tip {
492
- padding: 2px 5px 0px 20px;
493
- font-size: 12px;
494
- line-height: 1;
495
- color: #ed4014;
496
- position: absolute;
497
- top: calc(100% -15px);
498
- left: 0px;
499
- }
500
-
501
- &-add {
502
- line-height: 20px;
503
- position: absolute;
504
- bottom: 0px;
505
- right: 0px;
506
- display: none;
507
- }
508
- }
509
-
510
- &-nodata {
511
- width: 100%;
512
- height: 40px;
513
- text-align: center;
514
- }
515
- }
516
-
517
- tbody {
518
- // display: block;
519
- // overflow-y: scroll;
520
- }
521
-
522
- thead {
523
- // display: block;
524
- }
525
- }
526
443
  }
527
444
 
528
445
  &-create {
@@ -280,3 +280,125 @@
280
280
  }
281
281
  };
282
282
  </script>
283
+
284
+ <style lang="less">
285
+ .DshList {
286
+ @height:44px;
287
+
288
+ .list {
289
+ &-loading {
290
+ margin-top: 120px;
291
+ }
292
+
293
+ &-cols,
294
+ &-rows {
295
+ position: relative;
296
+
297
+ &-left {
298
+ width: 48px;
299
+ text-align: center;
300
+ position: absolute;
301
+ left: 0;
302
+ top: 0;
303
+
304
+ label {
305
+ display: inline-block;
306
+ height: 36px;
307
+ padding: 9px 5px;
308
+ margin: 0px;
309
+ line-height: 18px;
310
+ }
311
+ }
312
+
313
+ .row {
314
+ width: 100%;
315
+ line-height: 20px;
316
+ display: flex;
317
+ justify-content: space-between;
318
+
319
+ &-item {
320
+ min-width: 120px;
321
+ height: 100%;
322
+ padding: 0 16px;
323
+ font-size: 14px;
324
+ align-items: center;
325
+ }
326
+ }
327
+ }
328
+
329
+ &-cols {
330
+ height: @height;
331
+ background: #f0f0f0;
332
+
333
+ &-left {}
334
+ &-right {
335
+
336
+ }
337
+
338
+ .row {
339
+ font-weight: 700;
340
+
341
+ &-item {
342
+ padding: 10px 16px;
343
+ border-top: 1px #e5e5e5 solid;
344
+ border-bottom: 1px #f0f0f0 solid;
345
+ border-left: 1px #e5e5e5 solid;
346
+ background: #f0f0f0;
347
+
348
+ &:last-child{
349
+ border-right: 1px #e5e5e5 solid;
350
+ }
351
+
352
+ &-inner {
353
+ .dsh-ellipsis{
354
+ font-size: 14px;
355
+ color: #666;
356
+ font-weight: 700;
357
+ line-height: 24px;
358
+ }
359
+ }
360
+ }
361
+ }
362
+ }
363
+
364
+ &-rows {
365
+ &-left {
366
+ label {
367
+ height: 44px;
368
+ line-height: 20px;
369
+ }
370
+ }
371
+
372
+ &-right {}
373
+
374
+ .row {
375
+ height: 44px;
376
+ line-height: 20px;
377
+ cursor: pointer;
378
+
379
+ &-item {
380
+ display: flex;
381
+ border: 1px solid #E5E5E5;
382
+ border-width: 0 0 1px 1px;
383
+
384
+ &:last-child {
385
+ border-width: 0 1px 1px 1px;
386
+ }
387
+
388
+ &-inner {
389
+ width: 100%;
390
+ font-size: 14px;
391
+ color: #333;
392
+ font-weight: 400;
393
+ line-height: 24px;
394
+ }
395
+ }
396
+ }
397
+ }
398
+
399
+ &-nodata {
400
+ #dsh-nodata();
401
+ }
402
+ }
403
+ }
404
+ </style>
@@ -128,8 +128,8 @@
128
128
  // 漏在外部按钮的宽度
129
129
  this.selfOperationList
130
130
  .slice(0, this.selfOperationList.length > maxBtnNum ? maxBtnNum - 1 : this.selfOperationList.length)
131
- .reduce((total, operationItem) => total + operationItem.width + 16, 0) +
132
- (this.selfOperationList.length > maxBtnNum ? 69 : 0) + // 出现更多按钮的宽度
131
+ .reduce((total, operationItem) => total + operationItem.width + 9, 0) +
132
+ (this.selfOperationList.length > maxBtnNum ? 70 : 0) + // 出现更多按钮的宽度
133
133
  (this.selfOperationList.length > 0 ? 40 : 0) + // 操作列的padding
134
134
  4 // 留出4px空间,避免麻烦问题
135
135
  , 80
@@ -148,11 +148,11 @@
148
148
 
149
149
  // TODO: 注意此处totalOperationList用的一定是表格行显示最多的操作按钮数组,有改动注意看此备注!!!
150
150
  return h("dsh-buttons", {
151
+ class: "bri-table-td-operation",
151
152
  props: {
152
- class: "table-operation",
153
153
  list: totalOperationList,
154
154
  maxFlatNum: maxBtnNum - 1,
155
- itemClass: "table-operation-btn"
155
+ itemClass: "bri-table-td-operation-btn"
156
156
  },
157
157
  on: {
158
158
  click: (operationItem) => {
@@ -202,3 +202,10 @@
202
202
  }
203
203
  };
204
204
  </script>
205
+
206
+ <style lang="less" scoped>
207
+ .DshTable {
208
+ width: 100%;
209
+ height: 100%;
210
+ }
211
+ </style>