bri-components 1.3.26 → 1.3.28

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.
Files changed (27) hide show
  1. package/package.json +1 -1
  2. package/src/components/controls/base/BriUpload/BriUpload.vue +10 -10
  3. package/src/components/controls/base/BriUpload/uploadList.vue +3 -3
  4. package/src/components/controls/base/DshCascader/DshCascader.vue +2 -2
  5. package/src/components/controls/base/DshCascader/components/cascaderModal.vue +3 -3
  6. package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +4 -4
  7. package/src/components/controls/base/DshCoordinates.vue +10 -9
  8. package/src/components/controls/base/DshNumber/DshNumber.vue +2 -2
  9. package/src/components/controls/base/DshSelect/DshCheckbox.vue +1 -1
  10. package/src/components/controls/base/DshSelect/DshSelect.vue +2 -2
  11. package/src/components/controls/mixins/cascaderMixin.js +1 -1
  12. package/src/components/controls/mixins/cascaderPickerMixin.js +2 -2
  13. package/src/components/controls/mixins/controlMixin.js +1 -1
  14. package/src/components/controls/mixins/selectMixin.js +1 -1
  15. package/src/components/controls/senior/cascaderTable.vue +14 -12
  16. package/src/components/controls/senior/selectDepartments.vue +18 -1
  17. package/src/components/controls/senior/selectUsers/selectUsers.vue +19 -4
  18. package/src/components/list/DshBox/DshCrossTable.vue +11 -2
  19. package/src/components/list/DshCascaderTable.vue +42 -96
  20. package/src/components/list/DshFlatTable.vue +5 -8
  21. package/src/components/list/DshTreeTable.vue +203 -40
  22. package/src/components/list/mixins/{tableMixin.js → flatTableMixin.js} +81 -27
  23. package/src/components/list/mixins/{DshFlatTableMixin.js → tableBaseMixin.js} +28 -82
  24. package/src/styles/components/list/BriTable.less +41 -31
  25. package/src/styles/global/text.less +0 -3
  26. package/src/styles/reset-iview-other.less +0 -4
  27. package/src/utils/table.js +6 -5
@@ -1,31 +1,70 @@
1
1
  export default {
2
2
  mixins: [],
3
3
  components: {},
4
- props: {},
4
+ props: {
5
+ columns: {
6
+ type: Array,
7
+ default () {
8
+ return [];
9
+ }
10
+ },
11
+ data: {
12
+ type: Array,
13
+ default () {
14
+ return [];
15
+ }
16
+ },
17
+ oldData: {
18
+ type: Array,
19
+ default () {
20
+ return [];
21
+ }
22
+ }
23
+ },
24
+ model: {
25
+ prop: "data",
26
+ event: "change"
27
+ },
5
28
  data () {
6
29
  return {};
7
30
  },
8
31
  computed: {
32
+ listData () {
33
+ this.data.forEach(item => {
34
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
35
+ });
36
+ return this.data;
37
+ },
38
+ oldListData () {
39
+ this.oldData.forEach(item => {
40
+ !item._id && this.$set(item, "_id", this.$ObjectID().str);
41
+ });
42
+ return this.oldData;
43
+ },
44
+ useCampare () {
45
+ return !!this.oldListData.length;
46
+ },
9
47
  footerData () {
10
- if (this.useSummary && this.listData.length) {
11
- return [
48
+ return this.useSummary && this.listData.length
49
+ ? [
12
50
  this.filterColumns.reduce((obj, col) => {
13
51
  return {
14
52
  ...obj,
15
- [col._key]: col._type === "number"
16
- ? this.$calNumList(this.listData.map(item => item[col._key]), col._summaryType, { ...col, _defaultDigit: 2 })
53
+ [col._key]: col._type === "number" && ![undefined, null, "", "no"].includes(col._summaryType)
54
+ ? this.$calNumList(
55
+ this.listData.map(item => item[col._key]),
56
+ col._summaryType,
57
+ { ...col, _defaultDigit: 2 }
58
+ )
17
59
  : (obj[col._key] || "--")
18
60
  };
19
61
  }, {
20
62
  _id: this.$ObjectID().str,
21
63
  __index__: "汇总",
22
- __isExpand__: "-",
23
64
  __operation__: "——"
24
65
  })
25
- ];
26
- } else {
27
- return [];
28
- }
66
+ ]
67
+ : [];
29
68
  },
30
69
 
31
70
  tablePropsObj () {
@@ -47,19 +86,10 @@ export default {
47
86
  ...this.commonPropsObj
48
87
  };
49
88
  },
50
- showRequired () {
51
- return this.selfPropsObj._showRequired;
52
- },
53
- showDescription () {
54
- return this.selfPropsObj._showDescription;
55
- },
56
- headHeightAuto () {
57
- return this.selfPropsObj._headHeightAuto;
58
- },
59
- heightAuto () {
60
- return this.selfPropsObj._heightAuto;
61
- },
62
89
 
90
+ filterColumns () {
91
+ return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
92
+ },
63
93
  showColumns () {
64
94
  return [
65
95
  ...(this.useSelection === true ? [this.selectionColumn] : []),
@@ -218,17 +248,21 @@ export default {
218
248
  disabled: false,
219
249
  event: "clickDelete"
220
250
  },
221
- // expand: {
222
- // name: "展开",
223
- // type: "expand",
224
- // event: "clickExpand"
225
- // },
226
251
  changeVal: {
227
252
  name: "改变输入框值",
228
253
  type: "changeVal",
229
254
  event: "changeVal"
230
255
  }
231
256
  };
257
+ },
258
+ operationMap () {
259
+ return this.canEdit
260
+ ? this.$categoryMapToMap(
261
+ this.allOperationMap,
262
+ null,
263
+ this.disabledBtns ? ["canCreate", "canDelete"] : []
264
+ )
265
+ : {};
232
266
  }
233
267
  },
234
268
  created () { },
@@ -246,6 +280,18 @@ export default {
246
280
 
247
281
  this.change("createRow", null, newRow, newRowIndex);
248
282
  },
283
+ // 点击 -删除行
284
+ clickDelete (operationItem, row, rowIndex, list) {
285
+ this.$Modal.confirm({
286
+ title: "警告",
287
+ content: "确定删除吗?",
288
+ onOk: () => {
289
+ list.splice(rowIndex, 1);
290
+
291
+ this.change("deleteRow", null, row, rowIndex);
292
+ }
293
+ });
294
+ },
249
295
  changeSelect (list) {
250
296
  this.$emit("changeSelect", list);
251
297
  },
@@ -258,6 +304,9 @@ export default {
258
304
  controlBlur (operationItem, col, row, params) {
259
305
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
260
306
  },
307
+ change (...params) {
308
+ this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
309
+ },
261
310
 
262
311
  resetCol (col, row) {
263
312
  let resetMap = {
@@ -274,6 +323,11 @@ export default {
274
323
  // isShare: this.isShare,
275
324
  _heightAuto: this.heightAuto
276
325
  };
326
+ },
327
+ isShowCompare (col, row, oldRow = {}) {
328
+ return this.useCampare && ["number"].includes(col._type) &&
329
+ !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
330
+ row[col._key] !== oldRow[col._key];
277
331
  }
278
332
  }
279
333
  };
@@ -1,29 +1,15 @@
1
+ import DshListUnit from "../../unit/DshListUnit.vue";
2
+
1
3
  export default {
2
4
  mixins: [],
3
- components: {},
5
+ components: {
6
+ DshListUnit
7
+ },
4
8
  props: {
5
9
  canEdit: {
6
10
  type: Boolean,
7
11
  default: true
8
12
  },
9
- columns: {
10
- type: Array,
11
- default () {
12
- return [];
13
- }
14
- },
15
- data: {
16
- type: Array,
17
- default () {
18
- return [];
19
- }
20
- },
21
- oldData: {
22
- type: Array,
23
- default () {
24
- return [];
25
- }
26
- },
27
13
  rowDefault: {
28
14
  type: Object,
29
15
  default () {
@@ -50,10 +36,6 @@ export default {
50
36
  }
51
37
  }
52
38
  },
53
- model: {
54
- prop: "data",
55
- event: "change"
56
- },
57
39
  data () {
58
40
  return {
59
41
  showRuleMessage: false, // 显示校验文字
@@ -61,22 +43,6 @@ export default {
61
43
  };
62
44
  },
63
45
  computed: {
64
- listData () {
65
- this.data.forEach(item => {
66
- !item._id && this.$set(item, "_id", this.$ObjectID().str);
67
- });
68
- return this.data;
69
- },
70
- oldListData () {
71
- this.oldData.forEach(item => {
72
- !item._id && this.$set(item, "_id", this.$ObjectID().str);
73
- });
74
- return this.oldData;
75
- },
76
- useCampare () {
77
- return !!this.oldListData.length;
78
- },
79
-
80
46
  commonPropsObj () {
81
47
  return {
82
48
  // isShare: false, // 是否是分享页在用
@@ -87,7 +53,7 @@ export default {
87
53
  _heightAuto: false, // 单元格高度自适应
88
54
  _useSelection: false, // 使用选择列
89
55
  _useIndex: true, // 使用序号列
90
- _useSummary: true, // 使用汇总行
56
+ _useSummary: false, // 使用汇总行
91
57
  _disabledBtns: false, // 禁用增删按钮
92
58
  _disabledCreateBtn: false, // 置灰新增按钮,目前只内部使用,comp_web数据表配置页那块
93
59
  _disabledOldDataRow: false, // 置灰老数据行包含删除
@@ -102,6 +68,18 @@ export default {
102
68
  contentHeight () {
103
69
  return this.selfPropsObj._contentHeight;
104
70
  },
71
+ showRequired () {
72
+ return this.selfPropsObj._showRequired;
73
+ },
74
+ showDescription () {
75
+ return this.selfPropsObj._showDescription;
76
+ },
77
+ headHeightAuto () {
78
+ return this.selfPropsObj._headHeightAuto;
79
+ },
80
+ heightAuto () {
81
+ return this.selfPropsObj._heightAuto;
82
+ },
105
83
  useSelection () {
106
84
  return this.selfPropsObj._useSelection;
107
85
  },
@@ -121,22 +99,8 @@ export default {
121
99
  return this.selfPropsObj._disabledOldDataRow;
122
100
  },
123
101
 
124
- filterColumns () {
125
- console.log(this.listData);
126
- return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
127
- },
128
102
  selfRowDefault () {
129
103
  return this.$filterObj(this.filterColumns, this.rowDefault);
130
- },
131
-
132
- operationMap () {
133
- return this.canEdit
134
- ? this.$categoryMapToMap(
135
- this.allOperationMap,
136
- null,
137
- this.disabledBtns ? ["canCreate", "canDelete"] : []
138
- )
139
- : {};
140
104
  }
141
105
  },
142
106
  created () { },
@@ -145,14 +109,14 @@ export default {
145
109
  validate () {
146
110
  this.showRuleMessage = true;
147
111
 
148
- return this.listData.every(row => this.getRowRuleResult(row));
112
+ return this.listData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
149
113
  },
150
114
  // 整行校验结果
151
- getRowRuleResult (row) {
152
- return this.filterColumns.every(column => this.getColRuleResult(column, row).bool);
115
+ getRowRuleResult (row, rowIndex) {
116
+ return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
153
117
  },
154
118
  // 单元格校验结果
155
- getColRuleResult (col, row) {
119
+ getColRuleResult (col, row, rowIndex) {
156
120
  col = this.$transformFieldProperty(col, row, this.parentObj);
157
121
  if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
158
122
  return this.$getFieldRuleResult(col, row);
@@ -163,39 +127,21 @@ export default {
163
127
  }
164
128
  },
165
129
 
166
- // 点击 -删除行
167
- clickDelete (operationItem, row, rowIndex, list) {
168
- this.$Modal.confirm({
169
- title: "警告",
170
- content: "确定删除吗?",
171
- onOk: () => {
172
- list.splice(rowIndex, 1);
173
-
174
- this.change("deleteRow", null, row, rowIndex);
175
- }
176
- });
177
- },
178
- change (...params) {
179
- this.$emit("change", { list: this.listData, rowDefault: this.rowDefault }, ...params);
180
- },
181
-
182
130
  /* --------------- 工具方法 ------------- */
183
131
  getRowCanEdit (row) {
184
- return this.canEdit && // 是否是编辑状态
185
- (this.disabledOldDataRow ? !!row.__isCreate__ : true); // 是否让老数据行置灰
132
+ return this.canEdit && ( // 是否是编辑状态
133
+ this.disabledOldDataRow ? !!row.__isCreate__ : true); // 是否让老数据行置灰
186
134
  },
187
135
  getColCanEdit (col, row) {
188
- return col.dependRowCanEdit ? row.canEdit !== false : true;// 在老数据行里某些列不可编辑
136
+ return (col.dependRowCanEdit ? row.canEdit !== false : true) && // 在老数据行里某些列不可编辑
137
+ col._enterType !== "calculate" && // 计算的不可编辑
138
+ col._readonly !== true && // 不能为只读
139
+ (["number"].includes(col._type) && ![undefined, null, "", "no"].includes(col._summaryType) ? row.isLeaf !== false : true); // 级联表格 -“需要计的数字列 且 不是叶子行的”不可编辑(必须用isLeaf !== false判断,因为牵扯内部表格也在用)
189
140
  },
190
141
  getUnitCanEdit (col, row) {
191
142
  return this.getRowCanEdit(row) &&
192
143
  this.getColCanEdit(col, row) &&
193
144
  this.$isAdvRelyShow(col, row, this.parentObj, true);
194
- },
195
- isShowCompare (col, row, oldRow = {}) {
196
- return this.useCampare && ["number"].includes(col._type) &&
197
- !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
198
- row[col._key] !== oldRow[col._key];
199
145
  }
200
146
  }
201
147
  };
@@ -37,34 +37,43 @@
37
37
  height: 100% !important;
38
38
 
39
39
  .ve-table-content-wrapper table.ve-table-content {
40
- thead.ve-table-header tr.ve-table-header-tr th.ve-table-header-th {
41
- padding: 4px 8px;
42
-
43
- .ve-table-filter .ve-table-filter-icon {
44
- &:hover {
45
- color: @themeColor;
40
+ thead.ve-table-header {
41
+ tr.ve-table-header-tr th.ve-table-header-th {
42
+ padding: 4px 8px;
43
+
44
+ .ve-table-filter .ve-table-filter-icon {
45
+ &:hover {
46
+ color: @themeColor;
47
+ }
46
48
  }
47
- }
48
-
49
- // 排序
50
- .ve-table-sort {
51
- position: absolute !important;
52
- top: 5px;
53
- right: 4px;
54
-
55
- .icon-vet-sort-top-arrow:before {
56
- content: "\e6347";
49
+
50
+ // 排序
51
+ .ve-table-sort {
52
+ position: absolute !important;
53
+ top: 5px;
54
+ right: 4px;
55
+
56
+ .icon-vet-sort-top-arrow:before {
57
+ content: "\e6347";
58
+ }
59
+
60
+ .icon-vet-sort-bottom-arrow:before {
61
+ content: "\e6349";
62
+ }
57
63
  }
64
+ }
65
+ }
66
+
67
+ tbody.ve-table-body {
68
+ tr.ve-table-body-tr,
69
+ tr.ve-table-expand-tr {
70
+ height: auto;
58
71
 
59
- .icon-vet-sort-bottom-arrow:before {
60
- content: "\e6349";
72
+ td.ve-table-body-td {
73
+ padding: 4px 16px;
61
74
  }
62
75
  }
63
76
  }
64
-
65
- // tbody.ve-table-body tr.ve-table-body-tr td.ve-table-body-td {
66
- // padding: 4px 12px;
67
- // }
68
77
  }
69
78
  }
70
79
 
@@ -91,7 +100,7 @@
91
100
  &-empty {
92
101
  width: 100%;
93
102
  height: 100%;
94
- padding: 9px 20px;
103
+ padding: 9px 16px;
95
104
  border: 1px solid @borderColor;
96
105
  border-top: none;
97
106
  // border-bottom-left-radius: @borderRadius;
@@ -115,12 +124,12 @@
115
124
  position: relative;
116
125
 
117
126
  &-tip {
118
- padding: 0px 0px 0px 20px;
127
+ padding: 0px 0px 0px 16px;
119
128
  font-size: 12px;
120
129
  line-height: 1;
121
130
  color: #ed4014;
122
131
  position: absolute;
123
- top: calc(100% - 13px);
132
+ top: calc(100% - 12px);
124
133
  left: 0px;
125
134
  }
126
135
 
@@ -142,19 +151,20 @@
142
151
  }
143
152
 
144
153
  &-edit {
145
- padding: 4px 20px 12px 20px!important;
154
+ padding: 4px 16px 12px 16px!important;
146
155
  }
147
156
  &-show {
148
- padding: 4px 20px!important;
149
- // padding: 4px 12px!important;
157
+
150
158
  }
151
- &-normal {
152
- padding: 4px 8px!important;
153
- // padding: 4px 12px!important;
159
+ &-hide {
160
+ display: none!important;
154
161
  }
155
162
  &-index {
156
163
  padding: 4px 16px 4px 12px!important;
157
164
  }
165
+ &-expand {
166
+
167
+ }
158
168
  }
159
169
  }
160
170
 
@@ -33,9 +33,6 @@
33
33
  font-weight: 600;
34
34
  color: @textColor;
35
35
  }
36
- .dsh-hide {
37
- display: none!important;
38
- }
39
36
  .dsh-subtip {
40
37
  width: 100%;
41
38
  text-align: center;
@@ -38,8 +38,4 @@
38
38
  .ivu-select-dropdown:not(.ivu-cascader-transfer) {
39
39
  max-width: 420px;
40
40
  max-height: 300px;
41
- }
42
-
43
- .ivu-cascader-menu {
44
- max-width: 350px;
45
41
  }
@@ -9,8 +9,8 @@ const getHeadRender = function (h, column, {
9
9
  style: {
10
10
  display: "inline-block",
11
11
  maxWidth: "100%",
12
- paddingLeft: "12px",
13
- paddingRight: column._description ? "30px" : "12px",
12
+ paddingLeft: "8px",
13
+ paddingRight: column._description ? "26px" : "8px",
14
14
  verticalAlign: "middle",
15
15
  position: "relative"
16
16
  }
@@ -19,7 +19,7 @@ const getHeadRender = function (h, column, {
19
19
  style: {
20
20
  position: "absolute",
21
21
  top: "0px",
22
- left: "0px",
22
+ left: "-2px",
23
23
  color: "#ed4014"
24
24
  }
25
25
  }, "*"),
@@ -41,7 +41,7 @@ const getHeadRender = function (h, column, {
41
41
  style: {
42
42
  position: "absolute",
43
43
  bottom: "1px",
44
- right: "12px",
44
+ right: "8px",
45
45
  cursor: "pointer"
46
46
  },
47
47
  props: {
@@ -68,6 +68,7 @@ const transformToColumns = function (form, {
68
68
  return form
69
69
  .map(col => {
70
70
  const typeData = this.$modFieldMap[col._type] || {};
71
+ const typeWidth = typeData.width + (col._type === "number" && col._unit ? col._unit.length * 16 : 0);
71
72
 
72
73
  return {
73
74
  title: col._name,
@@ -75,7 +76,7 @@ const transformToColumns = function (form, {
75
76
  key: col._key,
76
77
  align: col._align || typeData.align,
77
78
  fixed: col._fixed,
78
- width: col._width || typeData.width,
79
+ width: col._width || typeWidth,
79
80
  sortBy: showHeadFilter
80
81
  ? col._sortBy || typeData.sortBy
81
82
  : undefined,