bri-components 1.3.48 → 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.48",
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
  }
@@ -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
  ? {
@@ -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
@@ -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>
@@ -54,7 +54,7 @@
54
54
  <template v-if="searchFormList.length">
55
55
  <dsh-default-search
56
56
  :formList="searchFormList"
57
- :initValue="advSearchObj.conditions"
57
+ :initValue="dftConditions"
58
58
  :labelWidth="searchLabelWidth"
59
59
  @change="searchCb"
60
60
  ></dsh-default-search>
@@ -126,7 +126,7 @@
126
126
  renderedListData () {
127
127
  return this.allListData.filter(row => {
128
128
  if (this.isSearching) {
129
- const bool = this.$isAdvRelyAccord(this.advSearchObj, row);
129
+ const bool = this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
130
130
 
131
131
  // 重置
132
132
  row.__isSearchShow__ = false;
@@ -339,19 +339,13 @@
339
339
  selfReset () {
340
340
  this.isExpandAction = false;
341
341
  this.searchMode = "flat";
342
- this.advSearchObj = {
343
- logic: "and",
344
- conditions: []
345
- };
342
+ this.dftConditions = [];
346
343
  },
347
344
 
348
345
  // 筛选回调
349
346
  searchCb (conditions) {
350
347
  this.isExpandAction = false;
351
- this.advSearchObj = {
352
- ...this.advSearchObj,
353
- conditions: conditions
354
- };
348
+ this.dftConditions = conditions;
355
349
  },
356
350
  // 展开/隐藏节点
357
351
  toggleExpand (row, bool = true) {
@@ -59,10 +59,7 @@ export default {
59
59
  showRuleMessage: false, // 进行全体校验
60
60
  ruleRecordMap: {}, // 单元格是否发生校验的记录映射
61
61
 
62
- advSearchObj: {
63
- logic: "and",
64
- conditions: []
65
- },
62
+ dftConditions: [],
66
63
 
67
64
  dshRenderName: undefined,
68
65
  showQuoteModal: false,
@@ -157,9 +154,6 @@ export default {
157
154
  commonPropsObj () {
158
155
  return {
159
156
  // isShare: false, // 是否是分享页在用
160
-
161
- _searchList: [], // 作为搜索的字段
162
- _searchLabelWidth: 100, // 搜索的label宽度
163
157
  _showRequired: true, // 表头显示校验符号*
164
158
  _showDescription: true, // 表头显示提示
165
159
  _headHeightAuto: false, // 表头高度自适应
@@ -172,6 +166,7 @@ export default {
172
166
  _disabledOldDataRow: false, // 置灰老数据行包含删除
173
167
  _isImport: false, // 导入
174
168
  _isExport: false, // 导出
169
+
175
170
  _isQuote: false, // 引用
176
171
  _quoteDataCanEdit: false, // 引用的数据是否能编辑
177
172
  _quoteListFields: [], // 引用列表的显示字段
@@ -179,6 +174,13 @@ export default {
179
174
  logic: "and",
180
175
  conditions: []
181
176
  }, // 引用列表筛选条件
177
+
178
+ _searchList: [], // 作为搜索的字段
179
+ _searchLabelWidth: 100, // 搜索的label宽度
180
+ _tableAdvSearch: {
181
+ logic: "and",
182
+ conditions: []
183
+ }, // 筛选默认值
182
184
  ...this.propsObj,
183
185
 
184
186
  _contentHeight: this.propsObj._contentHeight || 500 // 表格最大高度
@@ -187,18 +189,6 @@ export default {
187
189
  // isShare () {
188
190
  // return this.selfPropsObj.isShare;
189
191
  // },
190
- searchList () {
191
- return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
192
- },
193
- searchListMap () {
194
- return this.$arrToMap(this.searchList, "_key");
195
- },
196
- searchListFields () {
197
- return this.searchList.map(searchItem => searchItem._key);
198
- },
199
- searchLabelWidth () {
200
- return this.selfPropsObj._searchLabelWidth;
201
- },
202
192
  contentHeight () {
203
193
  return this.selfPropsObj._contentHeight;
204
194
  },
@@ -251,6 +241,50 @@ export default {
251
241
  return this.$transformAdvSearch(this.selfPropsObj._quoteAdvSearch, this.parentFormList, this.parentObj);
252
242
  },
253
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
+
254
288
  parentDataId () {
255
289
  return this.parentObj._id;
256
290
  },
@@ -320,18 +354,6 @@ export default {
320
354
  };
321
355
  },
322
356
 
323
- searchFormList () {
324
- return this.$filterList(this.searchListFields, this.columns).map(formItem => ({
325
- ...formItem,
326
- ...this.searchListMap[formItem._key],
327
- _name: formItem._name
328
- }));
329
- },
330
- isSearching () {
331
- return this.searchFormList.length && this.advSearchObj.conditions.some(conditionItem =>
332
- conditionItem.fieldValue.length && conditionItem.fieldValue.some(valItem => !this.$isEmptyData(valItem))
333
- );
334
- },
335
357
  filterColumns () {
336
358
  return this.columns.filter(col => this.$isAdvRelyShow(col, this.allListData, this.parentObj, true));
337
359
  },
@@ -459,13 +481,12 @@ export default {
459
481
  }, 0);
460
482
  }
461
483
  },
462
- created () { },
484
+ created () {
485
+ this.baseInit();
486
+ },
463
487
  methods: {
464
- // 共外部使用
465
- validate () {
466
- this.showRuleMessage = true;
467
-
468
- return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
488
+ baseInit () {
489
+ this.dftConditions = this.tableAdvSearch.conditions;
469
490
  },
470
491
  // 重置
471
492
  reset () {
@@ -473,6 +494,12 @@ export default {
473
494
  this.showRuleMessage = false;
474
495
  this.ruleRecordMap = {};
475
496
  },
497
+ // 共外部使用
498
+ validate () {
499
+ this.showRuleMessage = true;
500
+
501
+ return this.allListData.every((row, rowIndex) => this.getRowRuleResult(row, rowIndex));
502
+ },
476
503
 
477
504
  // 表单控件失去焦点
478
505
  controlBlur (operationItem, col, row, rowIndex, params) {
@@ -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
  });