bri-components 1.3.14 → 1.3.15

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.14",
3
+ "version": "1.3.15",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -287,6 +287,10 @@
287
287
  ...this.commonDealPropsObj
288
288
  };
289
289
  },
290
+ // 反向过滤
291
+ reverseFilter () {
292
+ return this.selfPropsObj._reverseFilter;
293
+ },
290
294
  // 禁止显示的部门以及部门下人员
291
295
  userDepartFilterVals () {
292
296
  return this.selfPropsObj._userDepartFilterVals || [];
@@ -415,7 +419,11 @@
415
419
  },
416
420
  loadingName: "loading",
417
421
  callback: data => {
418
- this.userList = data.list.filter(item => !this.userDepartFilterVals.includes(item.departmentKey));
422
+ this.userList = data.list.filter(item =>
423
+ this.reverseFilter
424
+ ? !this.userDepartFilterVals.includes(item.departmentKey)
425
+ : this.userDepartFilterVals.includes(item.departmentKey)
426
+ );
419
427
  this.total = data.total;
420
428
  }
421
429
  });
@@ -490,7 +498,11 @@
490
498
  name: "全部",
491
499
  _key: ""
492
500
  },
493
- ...data.list.filter(item => !this.userDepartFilterVals.includes(item._key))
501
+ ...data.list.filter(item =>
502
+ this.reverseFilter
503
+ ? !this.userDepartFilterVals.includes(item._key)
504
+ : this.userDepartFilterVals.includes(item._key)
505
+ )
494
506
  ];
495
507
  }
496
508
  });
@@ -8,8 +8,8 @@
8
8
  @on-validate="validateCb"
9
9
  >
10
10
  <Row>
11
- <template v-if="displayFormList.length">
12
- <template v-for="formItem in displayFormList">
11
+ <template v-if="showFormList.length">
12
+ <template v-for="formItem in showFormList">
13
13
  <i-col
14
14
  :key="formItem._key"
15
15
  :id="formItem._key"
@@ -179,12 +179,16 @@
179
179
  };
180
180
  },
181
181
  computed: {
182
- displayFormList () {
183
- const formList = this.formList.filter(formItem => this.isShow(formItem, this.formData));
184
- return formList;
182
+ showFormList () {
183
+ return this.formList.filter(formItem => this.isShow(formItem, this.formData));
185
184
  // return this.$getNotEmptyFieldList(formList, this.formData, this.canEdit, this.notShowEmpty);
186
185
  }
187
186
  },
187
+ watch: {
188
+ formList () {
189
+ this.init();
190
+ }
191
+ },
188
192
  created () {
189
193
  this.init();
190
194
  },
@@ -203,7 +207,7 @@
203
207
  // 初始化校验
204
208
  initRules () {
205
209
  // 此处代码可以改,但写法不能改!不然会引起表单页面渲染完就自动校验
206
- (this.monitorFormList || this.formList).reduce((rulesObj, formItem) => {
210
+ this.formList.reduce((rulesObj, formItem) => {
207
211
  rulesObj[formItem._key] = this.getRules(formItem);
208
212
  return rulesObj;
209
213
  }, this.rules);
@@ -390,11 +394,6 @@
390
394
  this.$refs.form.validateField(curFormItem._key);
391
395
  }
392
396
  }
393
- },
394
- watch: {
395
- formList () {
396
- this.init();
397
- }
398
397
  }
399
398
  };
400
399
  </script>
@@ -88,13 +88,21 @@
88
88
  return this.data;
89
89
  },
90
90
  footerData () {
91
- let row = { _id: this.$ObjectID().str, custome: "汇总" };
92
- this.filterColumns.map(col => {
93
- if (col._type === "number") {
94
- row[col._key] = this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 });
95
- }
96
- });
97
- return this.useSummary && this.listData.length ? [row] : [];
91
+ if (this.useSummary && this.listData.length) {
92
+ const row = this.filterColumns.reduce((row, col) => {
93
+ if (col._type === "number") {
94
+ row[col._key] = this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 });
95
+ }
96
+ return row;
97
+ }, {
98
+ _id: this.$ObjectID().str,
99
+ custome: "汇总"
100
+ });
101
+
102
+ return [row];
103
+ } else {
104
+ return [];
105
+ }
98
106
  },
99
107
  oldListData () {
100
108
  this.oldData.forEach(item => {
@@ -108,7 +116,7 @@
108
116
  maxHeight: this.contentHeight,
109
117
  cellStyleOption: {
110
118
  bodyCellClass: ({rowIndex}) => {
111
- return "bri-table-td bri-table-td-edit";
119
+ return `bri-table-td ${this.canEdit ? "bri-table-td-edit" : "bri-table-td-show"}`;
112
120
  }
113
121
  }
114
122
  };
@@ -1,21 +1,19 @@
1
1
  <template>
2
2
  <div
3
- class="DshCascaderTable"
3
+ class="DshCasTable"
4
4
  ref="DshCascaderTable"
5
5
  >
6
- <div :class="{
7
- 'DshCascaderTable-wrap': true,
8
- 'DshCascaderTable-readonly': !canEdit
9
- }">
6
+ <div class="DshCasTable-wrap">
10
7
  <div
11
- class="DshCascaderTable-wrap-center"
8
+ class="DshCasTable-wrap-center"
12
9
  :style="{
13
- maxHeight: `${contentHeight}px`
10
+ maxHeight: `${contentHeight}px`,
11
+ height: `${contentHeight}px`
14
12
  }"
15
13
  >
16
14
  <!-- 表头 -->
17
- <div class="DshCascaderTable-wrap-center-top">
18
- <div class="DshCascaderTable-wrap-center-top-inner">
15
+ <div class="DshCasTable-wrap-center-top">
16
+ <div class="DshCasTable-wrap-center-top-inner">
19
17
  <table
20
18
  class="table"
21
19
  border="1"
@@ -23,11 +21,11 @@
23
21
  bordercolor="#E7EDF8"
24
22
  >
25
23
  <tbody>
26
- <tr class="table-col">
24
+ <tr>
27
25
  <th
28
26
  v-for="(col, colIndex) in columns"
29
27
  :key="col._id"
30
- class="table-col-th bri-table-th"
28
+ class="table-th bri-table-th"
31
29
  :style="getThStyle(col, 'th')"
32
30
  @click="$dispatchEvent(operationMap.clickTh, col)"
33
31
  >
@@ -41,8 +39,8 @@
41
39
  col.level === treeColumns.length &&
42
40
  $getOperationList(getColOperationNames(col)).length
43
41
  "
44
- class="table-col-th-dropdown"
45
- menuClass="table-col-th-dropdown-list"
42
+ class="table-th-dropdown"
43
+ menuClass="table-th-dropdown-list"
46
44
  trigger="hover"
47
45
  :list="$getOperationList(getColOperationNames(col))"
48
46
  @click="$dispatchEvent($event, col, colIndex, columns)"
@@ -63,8 +61,8 @@
63
61
  </div>
64
62
 
65
63
  <!-- 数据行 -->
66
- <div class="DshCascaderTable-wrap-center-list">
67
- <div class="DshCascaderTable-wrap-center-list-inner">
64
+ <div class="DshCasTable-wrap-center-list">
65
+ <div class="DshCasTable-wrap-center-list-inner">
68
66
  <table
69
67
  class="table"
70
68
  border="1"
@@ -83,7 +81,12 @@
83
81
  <td
84
82
  v-if="['tree', 'summary'].includes(col.colType)"
85
83
  :key="col._key"
86
- :class="`bri-table-td table-row-${col.colType}`"
84
+ :class="{
85
+ [`table-td-${col.colType}`]: true,
86
+ 'bri-table-td': true , // 可以不要,为了position: relative,上面有
87
+ 'bri-table-td-edit': canEdit,
88
+ 'bri-table-td-show': !canEdit,
89
+ }"
87
90
  :style="getTdStyle(col, row)"
88
91
  :rowspan="geTdRowspan(col, row)"
89
92
  :colspan="geTdColspan(col, row)"
@@ -115,8 +118,8 @@
115
118
  <!-- 操作下拉 -->
116
119
  <dsh-dropdown
117
120
  v-if="$getOperationList(getNodeOperationNames(col, row, row[col._key])).length"
118
- class="table-row-tree-dropdown"
119
- menuClass="table-row-tree-dropdown-list"
121
+ class="table-td-tree-dropdown"
122
+ menuClass="table-td-tree-dropdown-list"
120
123
  trigger="hover"
121
124
  :list="$getOperationList(getNodeOperationNames(col, row, row[col._key]))"
122
125
  @click="$dispatchEvent($event, row, rowIndex, col)"
@@ -141,8 +144,13 @@
141
144
  <!-- 普通单元格 -->
142
145
  <td
143
146
  v-else
144
- :key="col._key + ''"
145
- class="bri-table-td"
147
+ :key="col._key + 'data'"
148
+ :class="{
149
+ // [`table-td-${col.colType}`]: true,
150
+ 'bri-table-td': true , // 可以不要,为了position: relative,上面有
151
+ 'bri-table-td-edit': canEdit,
152
+ 'bri-table-td-show': !canEdit,
153
+ }"
146
154
  :style="getTdStyle(col, row)"
147
155
  >
148
156
  <dsh-list-unit
@@ -194,14 +202,14 @@
194
202
  DshListUnit
195
203
  },
196
204
  props: {
197
- useCol: {
198
- type: Boolean,
199
- default: false
200
- },
201
205
  canEdit: {
202
206
  type: Boolean,
203
207
  default: true
204
208
  },
209
+ useCol: {
210
+ type: Boolean,
211
+ default: false
212
+ },
205
213
 
206
214
  data: {
207
215
  type: Object,
@@ -349,7 +357,7 @@
349
357
  _disabledBtns: false, // 禁用增删按钮
350
358
  ...this.propsObj,
351
359
 
352
- _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
360
+ _contentHeight: this.propsObj._contentHeight || 400 // 表格最大高度
353
361
  };
354
362
  },
355
363
  isShare () {
@@ -404,8 +412,8 @@
404
412
  },
405
413
  mounted () {
406
414
  setTimeout(() => {
407
- this.$el.querySelector(".DshCascaderTable-wrap-center-list").addEventListener("scroll", (e) => {
408
- this.$el.querySelector(".DshCascaderTable-wrap-center-top").scrollLeft = e.srcElement.scrollLeft;
415
+ this.$el.querySelector(".DshCasTable-wrap-center-list").addEventListener("scroll", (e) => {
416
+ this.$el.querySelector(".DshCasTable-wrap-center-top").scrollLeft = e.srcElement.scrollLeft;
409
417
  }, false);
410
418
  this.boxWidth = this.$refs.DshCascaderTable.clientWidth;
411
419
  }, 0);
@@ -887,7 +895,7 @@
887
895
  </script>
888
896
 
889
897
  <style lang="less">
890
- .DshCascaderTable {
898
+ .DshCasTable {
891
899
  width: 100%;
892
900
 
893
901
  &-wrap {
@@ -907,8 +915,10 @@
907
915
  border-color: #E5E5E5;
908
916
  line-height: 18px;
909
917
 
910
- &-col-th,
911
- &-row-tree {
918
+ &-th,
919
+ &-td-tree {
920
+ position: relative;
921
+
912
922
  &-dropdown {
913
923
  position: absolute;
914
924
  right: 0px;
@@ -928,26 +938,24 @@
928
938
  }
929
939
 
930
940
  &:hover {
931
- .table-col-th-dropdown,
932
- .table-row-tree-dropdown {
941
+ .table-th-dropdown,
942
+ .table-td-tree-dropdown {
933
943
  display: inline-block;
934
944
  }
935
945
  }
936
946
  }
937
947
 
938
- &-col {
939
-
940
- }
941
-
942
- &-row {
943
- .textarea {
944
- .ivu-input {
945
- min-height: 18px;
946
- padding: 0px;
947
- border: none;
948
- background-color: transparent;
949
- box-shadow: none;
950
- line-height: 18px;
948
+ &-td {
949
+ &-tree {
950
+ .textarea {
951
+ .ivu-input {
952
+ min-height: 18px;
953
+ padding: 0px;
954
+ border: none;
955
+ background-color: transparent;
956
+ box-shadow: none;
957
+ line-height: 18px;
958
+ }
951
959
  }
952
960
  }
953
961
  }
@@ -958,6 +966,7 @@
958
966
  }
959
967
  }
960
968
 
969
+ // 头部
961
970
  &-top {
962
971
  width: 100%;
963
972
  z-index: 99;
@@ -970,6 +979,7 @@
970
979
  }
971
980
  }
972
981
 
982
+ // 主体
973
983
  &-list {
974
984
  width: 100%;
975
985
  flex: 1;
@@ -63,7 +63,7 @@
63
63
  }
64
64
 
65
65
  // tbody.ve-table-body tr.ve-table-body-tr td.ve-table-body-td {
66
- // padding: 4px 20px 12px 20px;
66
+ // padding: 4px 20px;
67
67
  // }
68
68
  }
69
69
  }
@@ -144,6 +144,9 @@
144
144
  &-edit {
145
145
  padding: 4px 20px 12px 20px!important;
146
146
  }
147
+ &-show {
148
+ padding: 4px 20px!important;
149
+ }
147
150
  }
148
151
  }
149
152
 
@@ -47,6 +47,10 @@
47
47
  .text {
48
48
  .dsh-ellipsis();
49
49
  }
50
+
51
+ &.bri-control-nodata {
52
+ line-height: 1.5;
53
+ }
50
54
  }
51
55
 
52
56
  // 无数据