bri-components 1.3.17 → 1.3.19

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.17",
3
+ "version": "1.3.19",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -70,7 +70,7 @@ const pathMap = {
70
70
  selectDepartments: "./senior/selectDepartments.vue",
71
71
  BriLabels: "./senior/BriLabels.vue",
72
72
  DshPackage: "./senior/DshPackage.vue",
73
- flatTable: "./senior/flatTable.vue",
73
+ flatTable: "./senior/flatTable/flatTable.vue",
74
74
  cascaderTable: "./senior/cascaderTable"
75
75
  },
76
76
  special: {
@@ -88,9 +88,9 @@
88
88
  </template>
89
89
 
90
90
  <script>
91
- import controlMixin from "../mixins/controlMixin.js";
92
- import DshBtnModal from "../../small/DshBtnModal.vue";
93
- import BriFlatTable from "../../list/BriFlatTable.vue";
91
+ import controlMixin from "../../mixins/controlMixin.js";
92
+ import DshBtnModal from "../../../small/DshBtnModal.vue";
93
+ import BriFlatTable from "../../../list/BriFlatTable.vue";
94
94
  import flatTableImportModal from "./flatTableImportModal.vue";
95
95
 
96
96
  export default {
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div class="DshAdvSearch">
3
- <!-- 无可筛选字段 -->
3
+ <!-- 有可选择字段 -->
4
4
  <template v-if="canSearchFormList.length">
5
- <!-- 筛选逻辑 -->
5
+ <!-- 逻辑 -->
6
6
  <div class="DshAdvSearch-logic">
7
- <div class="DshAdvSearch-logic-title">筛选逻辑</div>
7
+ <div class="DshAdvSearch-logic-title">{{ logicStr }}</div>
8
8
  <dsh-select
9
9
  class="DshAdvSearch-logic-option"
10
10
  :value="advSearchObj"
@@ -13,8 +13,8 @@
13
13
  ></dsh-select>
14
14
  </div>
15
15
 
16
- <!-- 筛选条件 -->
17
- <div class="DshAdvSearch-title">筛选条件</div>
16
+ <!-- 条件 -->
17
+ <div class="DshAdvSearch-title">{{ conditionStr }}</div>
18
18
  <div class="DshAdvSearch-conditions">
19
19
  <template v-for="(conditionItem, conditionIndex) in advSearchObj.conditions">
20
20
  <!-- 'and', 'or' 循环模式 -->
@@ -90,7 +90,7 @@
90
90
 
91
91
  <!-- 其它条件 -->
92
92
  <template v-else>
93
- <!-- 动态文本 -匹配的动态筛选字段 -->
93
+ <!-- 动态文本 -匹配的动态字段 -->
94
94
  <template v-if="conditionItem.parameterType === 'dynamicText'">
95
95
  <dsh-select
96
96
  v-if="useChainField"
@@ -117,7 +117,7 @@
117
117
  ></dsh-checkbox>
118
118
  </template>
119
119
 
120
- <!-- 固定文本 -筛选条件对应的显示 -->
120
+ <!-- 固定文本 -->
121
121
  </template>
122
122
  </slot>
123
123
  </template>
@@ -147,7 +147,7 @@
147
147
  </span>
148
148
  </dsh-dropdown>
149
149
 
150
- <!-- operators 筛选条件 -->
150
+ <!-- operators 操作类型 -->
151
151
  <dsh-dropdown
152
152
  v-if="conditionItem.operators.length"
153
153
  class="extra-operator"
@@ -195,7 +195,7 @@
195
195
 
196
196
  <!-- 按钮s -->
197
197
  <div class="DshAdvSearch-btns">
198
- <!-- 添加筛选项 -->
198
+ <!-- 添加条件项 -->
199
199
  <dsh-dropdown
200
200
  class="DshAdvSearch-btns-field"
201
201
  menuClass="DshAdvSearch-btns-field-list"
@@ -219,7 +219,7 @@
219
219
  </div>
220
220
  </template>
221
221
 
222
- <!-- 无可筛选字段 -->
222
+ <!-- 无可选择字段 -->
223
223
  <div
224
224
  v-else
225
225
  :class="{
@@ -227,7 +227,7 @@
227
227
  'DshAdvSearch-nodata-small': isInner
228
228
  }"
229
229
  >
230
- 当前无可筛选的字段
230
+ {{ noFormListStr }}
231
231
  </div>
232
232
  </div>
233
233
  </template>
@@ -250,6 +250,10 @@
250
250
  return ["default", "set"].includes(val);
251
251
  }
252
252
  },
253
+ themeWord: {
254
+ type: String,
255
+ default: "筛选"
256
+ },
253
257
  useLoop: {
254
258
  type: Boolean,
255
259
  default: true
@@ -261,9 +265,20 @@
261
265
  },
262
266
  data () {
263
267
  return {
268
+ selfLogicPropsObj: {
269
+ _name: `添加${this.themeWord}逻辑`,
270
+ _key: "logic",
271
+ _optionKind: "flat",
272
+ _clearable: false,
273
+ _data: [
274
+ { _key: "and", name: "且" },
275
+ { _key: "or", name: "或" }
276
+ ]
277
+ },
278
+
264
279
  allOperationMap: {
265
280
  createCondition: {
266
- name: "添加筛选条件",
281
+ name: `添加${this.themeWord}条件`,
267
282
  type: "createCondition",
268
283
  icon: "md-add",
269
284
  size: this.isInner ? "small" : "default",
@@ -271,7 +286,7 @@
271
286
  event: "createCondition"
272
287
  },
273
288
  createLoopContion: {
274
- name: "添加筛选层",
289
+ name: `添加${this.themeWord === "筛选" ? this.themeWord : "逻辑"}层`,
275
290
  type: "createLoopContion",
276
291
  icon: "md-add",
277
292
  size: this.isInner ? "small" : "default",
@@ -279,19 +294,19 @@
279
294
  event: "createCondition"
280
295
  },
281
296
  deleteCondition: {
282
- name: "删除筛选条件",
297
+ name: `删除${this.themeWord}条件`,
283
298
  type: "deleteCondition",
284
299
  customIcon: "bico-delete",
285
300
  size: "16",
286
301
  event: "deleteCondition"
287
302
  },
288
303
  selectOperator: {
289
- name: "选择筛选类型",
304
+ name: `选择${this.themeWord}类型`,
290
305
  type: "selectOperator",
291
306
  event: "changeOperator"
292
307
  },
293
308
  selectParameterType: {
294
- name: "选择筛选方式",
309
+ name: `选择${this.themeWord}方式`,
295
310
  type: "selectParameterType",
296
311
  event: "changeParameterType"
297
312
  }
@@ -299,6 +314,16 @@
299
314
  };
300
315
  },
301
316
  computed: {
317
+ logicStr () {
318
+ return `${this.themeWord}逻辑`;
319
+ },
320
+ conditionStr () {
321
+ return `${this.themeWord}条件`;
322
+ },
323
+ noFormListStr () {
324
+ return "当前无可选择的字段";
325
+ },
326
+
302
327
  operationMap () {
303
328
  return this.$categoryMapToMap(
304
329
  this.allOperationMap,
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <div class="DshDefaultSearch">
3
- <!-- 筛选表单 -->
4
3
  <div
5
4
  class="DshDefaultSearch-form"
6
5
  :style="{
@@ -86,6 +85,8 @@
86
85
  },
87
86
  data () {
88
87
  return {
88
+ isSimpleSearch: true,
89
+
89
90
  conditionList: [],
90
91
  isSpreadStatus: false, // 是否展开
91
92
 
@@ -46,16 +46,6 @@ export default {
46
46
  logic: "and",
47
47
  conditions: []
48
48
  },
49
- selfLogicPropsObj: {
50
- _name: "筛选逻辑",
51
- _key: "logic",
52
- _optionKind: "flat",
53
- _clearable: false,
54
- _data: [
55
- { _key: "and", name: "且" },
56
- { _key: "or", name: "或" }
57
- ]
58
- },
59
49
  parameterPropsObj: {
60
50
  _name: "参数类型",
61
51
  _key: "parameterType",
@@ -94,7 +84,7 @@ export default {
94
84
  });
95
85
  },
96
86
 
97
- // 新增筛选条件
87
+ // 新增条件项
98
88
  createCondition (operationItem, isLoop, formItem, list) {
99
89
  const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
100
90
  this.dealSubSearch(newConditionItem);
@@ -102,7 +92,7 @@ export default {
102
92
 
103
93
  this.change(operationItem.type, newConditionItem);
104
94
  },
105
- // 删除筛选条件
95
+ // 删除条件项
106
96
  deleteCondition (operationItem, conditionItem, conditionIndex, list) {
107
97
  list.splice(conditionIndex, 1);
108
98
 
@@ -118,7 +108,7 @@ export default {
118
108
 
119
109
  this.change(operationItem.type, conditionItem);
120
110
  },
121
- // 选择某控件的筛选类型
111
+ // 选择某控件的操作类型
122
112
  changeOperator (operationItem, conditionItem, conditionIndex, list, optionItem) {
123
113
  if (optionItem._key !== conditionItem.fieldOperator) {
124
114
  conditionItem.fieldOperator = optionItem._key;
@@ -165,7 +155,7 @@ export default {
165
155
  },
166
156
 
167
157
  /* -------- 方法 ----------- */
168
- // 生成筛选条件的值
158
+ // 生成条件项的值
169
159
  createContionFunc (initContion = { logic: "field" }, curFormItem, fieldKey) {
170
160
  if (["field", undefined].includes(initContion.logic)) {
171
161
  curFormItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
@@ -191,10 +181,12 @@ export default {
191
181
  const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
192
182
 
193
183
  const operators = fieldData[!dynamicList.length && ["set"].includes(this.mode) ? "operatorsSet" : "operators"] || fieldData.operators || [];
194
- const fieldOperator = initContion.fieldOperator || (
195
- ["reference"].includes(fieldType) && !["set"].includes(this.mode)
196
- ? "eq"
197
- : (operators[0] || {})._key
184
+ const fieldOperator = ["_id"].includes(curFormItem._key)
185
+ ? "eq"
186
+ : initContion.fieldOperator || (
187
+ ["reference"].includes(fieldType) && this.isSimpleSearch
188
+ ? "eq"
189
+ : (operators[0] || {})._key
198
190
  );
199
191
  const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
200
192
 
@@ -227,7 +219,7 @@ export default {
227
219
  return {
228
220
  _id: this.$ObjectID().str,
229
221
  ...initContion,
230
- __isDelete__: true, // 前端用它标识对应字段已被删除的筛选项
222
+ __isDelete__: true, // 前端用它标识对应字段已被删除的条件项
231
223
  formItem: {
232
224
  __realKey__: initContion.fieldKey
233
225
  }
@@ -345,7 +337,7 @@ export default {
345
337
  : item[key]
346
338
  )
347
339
  : item[key]
348
- }), {})
340
+ }), {})
349
341
  );
350
342
  };
351
343
 
@@ -181,11 +181,11 @@
181
181
  return !!this.oldListData.length;
182
182
  },
183
183
  filterColumns () {
184
- return this.columns.filter(column => {
185
- return column._isRelyParent
186
- ? this.$isFormItemShow(column, this.parentObj, true)
187
- : !["hide"].includes(column._displayType);
188
- });
184
+ return this.columns.filter(column =>
185
+ column._isRelyByParent
186
+ ? this.$isAdvRelyShow(column, this.parentObj, true, true, this.listData)
187
+ : !["hide"].includes(column._displayType)
188
+ );
189
189
  },
190
190
  showColumns () {
191
191
  const operationList = this.$getOperationList(["delete"]);
@@ -226,7 +226,7 @@
226
226
  filter: undefined,
227
227
  sortBy: undefined,
228
228
  renderBodyCell: ({ row, column, rowIndex }, h) => {
229
- column = this.$transformFieldProperty(column, row);
229
+ column = this.$transformFieldProperty(column, column._isRuleByParent ? this.parentObj : row);
230
230
 
231
231
  return [
232
232
  this.isShowCompare(column, row, this.oldListData[rowIndex])
@@ -371,7 +371,7 @@
371
371
 
372
372
  return this.listData.every(row =>
373
373
  this.filterColumns.every(column => {
374
- column = this.$transformFieldProperty(column, row);
374
+ column = this.$transformFieldProperty(column, column._isRuleByParent ? this.parentObj : row);
375
375
  return this.getRuleResult(column, row).bool;
376
376
  })
377
377
  );
@@ -432,7 +432,7 @@
432
432
  ...(resetMap[col._type] || {}),
433
433
  isShare: this.isShare,
434
434
  _heightAuto: this.heightAuto
435
- // canEdit: this.$isAdvRelyShow(col, row, true)
435
+ // canEdit: col._isRelyByParent ? true : this.$isAdvRelyShow(col, row, true)
436
436
  };
437
437
  },
438
438
  getUnitCanEdit (col, row) {
@@ -440,7 +440,7 @@
440
440
  // (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
441
441
  (!this.disabledOldDataRow || !!row.__isCreate__) && // 是否让老数据行置灰
442
442
  (!col.dependRowCanEdit || row.canEdit !== false) &&
443
- this.$isAdvRelyShow(col, row, true); // 在老数据行里某些列不可编辑; // 在老数据行里某些列不可编辑
443
+ (col._isRelyByParent ? true : this.$isAdvRelyShow(col, row, true)); // 在老数据行里某些列不可编辑; // 在老数据行里某些列不可编辑
444
444
  },
445
445
  isShowCompare (col, row, oldRow = {}) {
446
446
  return this.useCampare && ["number"].includes(col._type) &&