bri-components 1.3.47 → 1.3.49

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.47",
3
+ "version": "1.3.49",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -201,7 +201,7 @@
201
201
  &-show {
202
202
  &-auto,
203
203
  &-ellipsis {
204
- margin: 6px;
204
+ margin: 5px 0px;
205
205
  }
206
206
  }
207
207
  }
@@ -24,7 +24,7 @@
24
24
  ...commonClass
25
25
  }"
26
26
  >
27
- {{ showVal }}
27
+ <span class="text"> {{ showVal }}</span>
28
28
  </div>
29
29
  </bri-tooltip>
30
30
 
@@ -119,7 +119,7 @@
119
119
  const curDateStr = this.$transformDate(date, "/", this.subType);
120
120
 
121
121
  // 日期字段的对比
122
- const compareResultObj = this.$validateComparedRuleFunc(
122
+ const compareResult = this.$validateComparedRuleFunc(
123
123
  this.selfPropsObj,
124
124
  {
125
125
  ...this.value,
@@ -142,7 +142,7 @@
142
142
  calResultObj = this.$isComparedAccord(curDateStr, parentDateStr, this.compareOperator, "date", this.subType, this.subType);
143
143
  }
144
144
 
145
- return !compareResultObj.bool && !calResultObj.bool;
145
+ return !compareResult || !calResultObj.bool;
146
146
  }
147
147
  };
148
148
  }
@@ -223,7 +223,7 @@ export default {
223
223
  : {
224
224
  [this.saveKey]: val,
225
225
  [this.nameKey]: `提示:选项${val}已不存在`
226
- };
226
+ };
227
227
 
228
228
  return !this.$isEmptyData(val)
229
229
  ? {
@@ -130,7 +130,7 @@ export default {
130
130
  },
131
131
  // 是否为tag显示
132
132
  tagShow () {
133
- return ["users", "departments", "select", "checkbox", "regions", "cascaders", "switch"].includes(this.controlType);
133
+ return ["users", "departments", "select", "checkbox", "regions", "cascaders", "switch", "labels", "refSelect"].includes(this.controlType);
134
134
  },
135
135
  commonDealPropsObj () {
136
136
  const selectControlTypes = ["date", "switch", "select", "checkbox", "file", "region", "regions", "cascader", "cascaders", "coordinates", "users", "departments"];
@@ -25,6 +25,9 @@
25
25
  >
26
26
  <dsh-adv-search
27
27
  :mode="mode"
28
+ :isSimpleSearch="isSimpleSearch"
29
+ :themeWord="themeWord"
30
+ :useLoop="useLoop"
28
31
  :isInner="true"
29
32
  :value="conditionItem"
30
33
  :formList="canSearchFormList"
@@ -74,6 +77,9 @@
74
77
  v-if="conditionItem.finished === true"
75
78
  style="padding: 0px 0px 0px 8px;"
76
79
  :mode="mode"
80
+ :isSimpleSearch="isSimpleSearch"
81
+ :themeWord="themeWord"
82
+ :useLoop="useLoop"
77
83
  :isInner="true"
78
84
  :value="conditionItem.fieldSearch"
79
85
  :formList="conditionItem.subFormList"
@@ -149,7 +155,7 @@
149
155
 
150
156
  <!-- operators 操作类型 -->
151
157
  <dsh-dropdown
152
- v-if="conditionItem.operators.length"
158
+ v-if="!isSimpleSearch && conditionItem.operators.length"
153
159
  class="extra-operator"
154
160
  :list="conditionItem.operators"
155
161
  @click="$dispatchEvent(operationMap.selectOperator, conditionItem, conditionIndex, advSearchObj.conditions, $event)"
@@ -250,6 +256,11 @@
250
256
  return ["default", "set"].includes(val);
251
257
  }
252
258
  },
259
+ // 用高级筛选 但简单的像默认筛选那样使用(不要逻辑条件,筛选层,右上筛选条件)
260
+ isSimpleSearch: {
261
+ type: Boolean,
262
+ default: false
263
+ },
253
264
  themeWord: {
254
265
  type: String,
255
266
  default: "筛选"
@@ -270,6 +281,7 @@
270
281
  _key: "logic",
271
282
  _optionKind: "flat",
272
283
  _clearable: false,
284
+ _disabled: this.isSimpleSearch,
273
285
  _data: [
274
286
  { _key: "and", name: "且" },
275
287
  { _key: "or", name: "或" }
@@ -328,7 +340,7 @@
328
340
  return this.$categoryMapToMap(
329
341
  this.allOperationMap,
330
342
  undefined,
331
- this.useLoop === false ? ["createLoopContion"] : []
343
+ this.isSimpleSearch === true || this.useLoop === false ? ["createLoopContion"] : []
332
344
  );
333
345
  }
334
346
  },
@@ -26,7 +26,6 @@ export default {
26
26
  return [];
27
27
  }
28
28
  },
29
-
30
29
  useChainField: {
31
30
  type: Boolean,
32
31
  default: false
@@ -106,7 +106,7 @@
106
106
  }
107
107
 
108
108
  &-create {
109
- margin-top: 8px;
109
+ margin-top: 3px;
110
110
  }
111
111
  }
112
112
  </style>
@@ -15,7 +15,7 @@
15
15
  <dsh-default-search
16
16
  v-if="searchFormList.length && !isEnlarge"
17
17
  :formList="searchFormList"
18
- :initValue="advSearchObj.conditions"
18
+ :initValue="dftConditions"
19
19
  :labelWidth="searchLabelWidth"
20
20
  @change="searchCb"
21
21
  ></dsh-default-search>
@@ -34,23 +34,27 @@
34
34
  <!-- 添加行 -->
35
35
  <dsh-buttons
36
36
  v-if="!isSearching"
37
- class="DshFlatTable-create"
37
+ class="DshTreeTable-create"
38
38
  :list="$getOperationList(['canCreate'])"
39
39
  @click="$dispatchEvent($event)"
40
40
  ></dsh-buttons>
41
41
 
42
42
  <!-- 全屏模式 -->
43
43
  <dsh-modal
44
+ class="DshTreeTable-fullscreen"
44
45
  v-model="isEnlarge"
45
46
  :mode="modalPropsObj.mode"
46
47
  :propsObj="modalPropsObj"
47
48
  >
48
- <template v-if="isEnlargeFlag">
49
+ <div
50
+ v-if="isEnlargeFlag"
51
+ class="DshTreeTable-fullscreen-inner"
52
+ >
49
53
  <!-- 搜索条件 -->
50
54
  <template v-if="searchFormList.length">
51
55
  <dsh-default-search
52
56
  :formList="searchFormList"
53
- :initValue="advSearchObj.conditions"
57
+ :initValue="dftConditions"
54
58
  :labelWidth="searchLabelWidth"
55
59
  @change="searchCb"
56
60
  ></dsh-default-search>
@@ -69,11 +73,11 @@
69
73
 
70
74
  <!-- 添加行 -->
71
75
  <dsh-buttons
72
- class="DshFlatTable-create"
76
+ class="DshTreeTable-create"
73
77
  :list="$getOperationList(['canCreate'])"
74
78
  @click="$dispatchEvent($event)"
75
79
  ></dsh-buttons>
76
- </template>
80
+ </div>
77
81
  </dsh-modal>
78
82
 
79
83
  <!-- 各种模态框共用 -->
@@ -98,44 +102,18 @@
98
102
  deleteProperties: ["__treeIndex__", "__old__", "__isExpand__", "__isRendered__", "__isShow__", "__isTmpShow__", "__isSearchShow__"], // 除了__readonly__和__isQuote__不处理
99
103
  isExpandAction: false,
100
104
 
101
- searchMode: "flat", // "flat", "tree"
102
- advSearchObj: {
103
- logic: "and",
104
- conditions: []
105
- }
105
+ searchMode: "flat" // "flat", "tree"
106
106
  };
107
107
  },
108
108
  computed: {
109
109
  selfPropsObj () {
110
110
  return {
111
- _searchFields: [], // 作为搜索的字段
112
- _searchLabelWidth: 100, // 搜索的label宽度
113
- ...this.commonPropsObj,
114
-
115
- _maxLevel: this.commonPropsObj._maxLevel || 3
111
+ _maxLevel: 3, // 最大级数
112
+ ...this.commonPropsObj
116
113
  };
117
114
  },
118
115
  maxLevel () {
119
- return this.selfPropsObj._maxLevel;
120
- },
121
- searchLabelWidth () {
122
- return this.selfPropsObj._searchLabelWidth;
123
- },
124
- searchFormList () {
125
- return (this.selfPropsObj._searchFields || []) // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
126
- .map(fieldKey => this.columns.find(column => column._key === fieldKey))
127
- .filter(column => !!column)
128
- .map(column => {
129
- return {
130
- ...column,
131
- _span: 6
132
- };
133
- });
134
- },
135
- isSearching () {
136
- return this.searchFormList.length && this.advSearchObj.conditions.some(conditionItem =>
137
- conditionItem.fieldValue.length && conditionItem.fieldValue.some(valItem => !this.$isEmptyData(valItem))
138
- );
116
+ return this.selfPropsObj._maxLevel || 3;
139
117
  },
140
118
 
141
119
  allTreeData () {
@@ -148,7 +126,7 @@
148
126
  renderedListData () {
149
127
  return this.allListData.filter(row => {
150
128
  if (this.isSearching) {
151
- const bool = this.$isAdvRelyAccord(this.advSearchObj, row);
129
+ const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
152
130
 
153
131
  // 重置
154
132
  row.__isSearchShow__ = false;
@@ -361,19 +339,13 @@
361
339
  selfReset () {
362
340
  this.isExpandAction = false;
363
341
  this.searchMode = "flat";
364
- this.advSearchObj = {
365
- logic: "and",
366
- conditions: []
367
- };
342
+ this.dftConditions = [];
368
343
  },
369
344
 
370
345
  // 筛选回调
371
346
  searchCb (conditions) {
372
347
  this.isExpandAction = false;
373
- this.advSearchObj = {
374
- ...this.advSearchObj,
375
- conditions: conditions
376
- };
348
+ this.dftConditions = conditions;
377
349
  },
378
350
  // 展开/隐藏节点
379
351
  toggleExpand (row, bool = true) {
@@ -599,7 +571,13 @@
599
571
  }
600
572
 
601
573
  &-create {
602
- margin-top: 8px;
574
+ margin-top: 3px;
575
+ }
576
+
577
+ &-fullscreen {
578
+ &-inner {
579
+ padding: 10px 20px;
580
+ }
603
581
  }
604
582
  }
605
583
  </style>
@@ -59,6 +59,8 @@ export default {
59
59
  showRuleMessage: false, // 进行全体校验
60
60
  ruleRecordMap: {}, // 单元格是否发生校验的记录映射
61
61
 
62
+ dftConditions: [],
63
+
62
64
  dshRenderName: undefined,
63
65
  showQuoteModal: false,
64
66
  showImportModal: false,
@@ -152,7 +154,6 @@ export default {
152
154
  commonPropsObj () {
153
155
  return {
154
156
  // isShare: false, // 是否是分享页在用
155
-
156
157
  _showRequired: true, // 表头显示校验符号*
157
158
  _showDescription: true, // 表头显示提示
158
159
  _headHeightAuto: false, // 表头高度自适应
@@ -165,6 +166,7 @@ export default {
165
166
  _disabledOldDataRow: false, // 置灰老数据行包含删除
166
167
  _isImport: false, // 导入
167
168
  _isExport: false, // 导出
169
+
168
170
  _isQuote: false, // 引用
169
171
  _quoteDataCanEdit: false, // 引用的数据是否能编辑
170
172
  _quoteListFields: [], // 引用列表的显示字段
@@ -172,6 +174,13 @@ export default {
172
174
  logic: "and",
173
175
  conditions: []
174
176
  }, // 引用列表筛选条件
177
+
178
+ _searchList: [], // 作为搜索的字段
179
+ _searchLabelWidth: 100, // 搜索的label宽度
180
+ _tableAdvSearch: {
181
+ logic: "and",
182
+ conditions: []
183
+ }, // 筛选默认值
175
184
  ...this.propsObj,
176
185
 
177
186
  _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
@@ -232,6 +241,50 @@ export default {
232
241
  return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
233
242
  },
234
243
 
244
+ searchList () {
245
+ return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
246
+ },
247
+ searchListMap () {
248
+ return this.$arrToMap(this.searchList, "_key");
249
+ },
250
+ searchListFields () {
251
+ return this.searchList.map(searchItem => searchItem._key);
252
+ },
253
+ searchLabelWidth () {
254
+ return this.selfPropsObj._searchLabelWidth;
255
+ },
256
+ tableAdvSearch () {
257
+ return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.parentFormList, this.parentObj);
258
+ },
259
+ // 配置的默认筛选值里 隐藏的看不到的筛选条件
260
+ hideConditions () {
261
+ return this.tableAdvSearch.conditions.filter(conditionItem =>
262
+ !this.searchListFields.includes(conditionItem.fieldKey)
263
+ );
264
+ },
265
+ // 过滤行数据的 最终的筛选条件
266
+ finalTableAdvSearch () {
267
+ return {
268
+ logic: "and",
269
+ conditions: [
270
+ ...this.dftConditions,
271
+ ...this.hideConditions
272
+ ]
273
+ };
274
+ },
275
+ searchFormList () {
276
+ return this.$filterList(this.searchListFields, this.columns).map(formItem => ({
277
+ ...formItem,
278
+ ...this.searchListMap[formItem._key],
279
+ _name: formItem._name
280
+ }));
281
+ },
282
+ isSearching () {
283
+ return this.searchFormList.length && this.finalTableAdvSearch.conditions.some(conditionItem =>
284
+ conditionItem.fieldValue.length && conditionItem.fieldValue.some(valItem => !this.$isEmptyData(valItem))
285
+ );
286
+ },
287
+
235
288
  parentDataId () {
236
289
  return this.parentObj._id;
237
290
  },
@@ -428,13 +481,12 @@ export default {
428
481
  }, 0);
429
482
  }
430
483
  },
431
- created () { },
484
+ created () {
485
+ this.baseInit();
486
+ },
432
487
  methods: {
433
- // 共外部使用
434
- validate () {
435
- this.showRuleMessage = true;
436
-
437
- return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
488
+ baseInit () {
489
+ this.dftConditions = this.tableAdvSearch.conditions;
438
490
  },
439
491
  // 重置
440
492
  reset () {
@@ -442,6 +494,12 @@ export default {
442
494
  this.showRuleMessage = false;
443
495
  this.ruleRecordMap = {};
444
496
  },
497
+ // 共外部使用
498
+ validate () {
499
+ this.showRuleMessage = true;
500
+
501
+ return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
502
+ },
445
503
 
446
504
  // 表单控件失去焦点
447
505
  controlBlur (operationItem, col, row, rowIndex, params) {
@@ -672,7 +730,8 @@ export default {
672
730
  (col._oldReadonly ? !row.__old__ : true) && // 老数据行里某些列不可编辑
673
731
  (row.__isQuote__ ? this.quoteDataCanEdit : true) && // 引用过来的数据是否可编辑
674
732
  col._enterType !== "calculate" && // 计算的不可编辑
675
- col._readonly !== true; // 不能为只读
733
+ col._readonly !== true && // 不能为只读
734
+ col.canEdit;
676
735
  },
677
736
  // 单元格最终编辑状态
678
737
  getUnitCanEdit (col, row) {
@@ -42,16 +42,34 @@
42
42
  padding: 4px 8px;
43
43
 
44
44
  .ve-table-filter .ve-table-filter-icon {
45
+ position: absolute;
46
+ top: 0px;
47
+ left: 0px;
48
+
45
49
  &:hover {
46
50
  color: @themeColor;
47
51
  }
48
52
  }
53
+
54
+ // 过滤
55
+ .ve-dropdown {
56
+ position: absolute;
57
+ top: 0px;
58
+ bottom: 0px;
59
+ margin-top: auto;
60
+ margin-bottom: auto;
61
+ right: 17px;
62
+ }
49
63
 
50
64
  // 排序
51
65
  .ve-table-sort {
52
- position: absolute !important;
53
- top: 5px;
54
- right: 4px;
66
+ height: 30px;
67
+ position: absolute;
68
+ top: 0px;
69
+ bottom: 0px;
70
+ margin-top: auto;
71
+ margin-bottom: auto;
72
+ right: 0px;
55
73
 
56
74
  .icon-vet-sort-top-arrow:before {
57
75
  content: "\e6347";
@@ -47,6 +47,10 @@
47
47
  border: 1px solid @border-readonly;
48
48
  background: @inputBg-readonly;
49
49
  border-radius: @borderRadius;
50
+
51
+ &.bri-control-nodata {
52
+ .dsh-ellipsis();
53
+ }
50
54
  }
51
55
 
52
56
  // 带边框 frame
@@ -60,6 +64,11 @@
60
64
  #custom-show ();
61
65
  background: transparent;
62
66
  padding: 1px 4px;
67
+
68
+ &.bri-control-nodata {
69
+ padding: 3px 7px;
70
+ line-height: 24px
71
+ }
63
72
  }
64
73
  }
65
74
 
@@ -74,6 +83,11 @@
74
83
  #custom-show ();
75
84
  border: none;
76
85
  padding: 2px 4px;
86
+
87
+ &.bri-control-nodata {
88
+ padding: 4px 7px;
89
+ line-height: 24px
90
+ }
77
91
  }
78
92
  }
79
93
 
@@ -8,12 +8,12 @@ const getHeadRender = function (h, column, {
8
8
  return h("div", {
9
9
  style: {
10
10
  display: "inline-block",
11
- maxWidth: "100%",
11
+ maxWidth: `calc(100% - ${column.sortBy || column.sortBy === "" || !!column.filter ? 10 : 0}px)`,
12
12
  paddingLeft: "8px",
13
- paddingRight: column._description ? "26px" : "8px",
13
+ paddingRight: `${(column.sortBy || column.sortBy === "" || !!column.filter ? 0 : 8) + (column._description ? 18 : 0)}px`,
14
14
  verticalAlign: "middle",
15
15
  position: "relative",
16
- marginRight: ["number", "date"].includes(column._type) && column.align === "right" ? "10px" : 0
16
+ marginRight: `${column.sortBy || column.sortBy === "" || !!column.filter ? 10 : 0}px`
17
17
  }
18
18
  }, [
19
19
  showRequired && column._required && h("i", {
@@ -132,16 +132,16 @@ const transformToColumns = function (form, {
132
132
  },
133
133
  renderBodyCell: col._type
134
134
  ? col._type === "operation"
135
- ? (params, h) => {
135
+ ? ({ row, column, rowIndex }, h) => {
136
136
  return h("dsh-buttons", {
137
137
  class: "bri-table-td-operation",
138
138
  props: {
139
- list: col._getBtnList ? col._getBtnList.call(this, params.row) : this.$getOperationList(col._list),
139
+ list: col._getBtnList ? col._getBtnList.call(this, row) : this.$getOperationList(col._list),
140
140
  itemClass: "bri-table-td-operation-btn"
141
141
  },
142
142
  on: {
143
143
  click: (operationItem) => {
144
- this.$dispatchEvent(operationItem, params);
144
+ this.$dispatchEvent(operationItem, { row, column, rowIndex });
145
145
  }
146
146
  }
147
147
  });