bri-components 1.2.82 → 1.2.84

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.2.82",
3
+ "version": "1.2.84",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -4,10 +4,10 @@
4
4
  v-if="canEdit"
5
5
  class="DshCheckbox"
6
6
  >
7
- <!-- 有选项 -->
8
- <template v-if="listData.length">
9
- <!-- flat方式 -->
10
- <template v-if="showType === 'flat'">
7
+ <!-- flat方式 -->
8
+ <template v-if="showType === 'flat'">
9
+ <!-- 有选项 -->
10
+ <template v-if="listData.length">
11
11
  <CheckboxGroup
12
12
  :class="{
13
13
  'DshCheckbox-flat': true,
@@ -34,46 +34,46 @@
34
34
  </CheckboxGroup>
35
35
  </template>
36
36
 
37
- <!-- dropdown模式 -->
38
- <template v-else>
39
- <Select
40
- :class="{
41
- 'DshCheckbox-dropdown': true,
42
- 'DshCheckbox-dropdown-auto': isHeightAuto,
43
- 'DshCheckbox-dropdown-scroll': !isHeightAuto,
44
- }"
45
- :value="curValList"
46
- :multiple="true"
47
- :placeholder="selfPropsObj._placeholder"
48
- :disabled="selfPropsObj._disabled"
49
- :filterable="selfPropsObj._filterable"
50
- :transfer="selfPropsObj._transfer"
51
- :transfer-class-name="selfPropsObj._transferClassName"
52
- :max-tag-count="selfPropsObj._maxTagCount"
53
- @on-select="changeCheckValue"
37
+ <!-- 无选项 -->
38
+ <div
39
+ v-else
40
+ class="dsh-subtip"
41
+ >-- 无选择项 --</div>
42
+ </template>
43
+
44
+ <!-- dropdown模式 -->
45
+ <template v-else>
46
+ <Select
47
+ :class="{
48
+ 'DshCheckbox-dropdown': true,
49
+ 'DshCheckbox-dropdown-auto': isHeightAuto,
50
+ 'DshCheckbox-dropdown-scroll': !isHeightAuto,
51
+ }"
52
+ :value="curValList"
53
+ :multiple="true"
54
+ :placeholder="selfPropsObj._placeholder"
55
+ :disabled="selfPropsObj._disabled"
56
+ :filterable="selfPropsObj._filterable"
57
+ :transfer="selfPropsObj._transfer"
58
+ :transfer-class-name="selfPropsObj._transferClassName"
59
+ :max-tag-count="selfPropsObj._maxTagCount"
60
+ @on-select="changeCheckValue"
61
+ >
62
+ <Option
63
+ v-for="(item, index) in listData"
64
+ :key="item._key"
65
+ :value="item._key"
66
+ :label="item.name || item._name"
67
+ :disabled="getCheckItemDisabled(item, index)"
54
68
  >
55
- <Option
56
- v-for="(item, index) in listData"
57
- :key="item._key"
58
- :value="item._key"
59
- :label="item.name || item._name"
60
- :disabled="getCheckItemDisabled(item, index)"
61
- >
62
- <Checkbox :value="getItemCheckStatus(item)"></Checkbox>
69
+ <Checkbox :value="getItemCheckStatus(item)"></Checkbox>
63
70
 
64
- <slot :item="item"></slot>
71
+ <slot :item="item"></slot>
65
72
 
66
- <span>{{ item.name || item._name }}</span>
67
- </Option>
68
- </Select>
69
- </template>
73
+ <span>{{ item.name || item._name }}</span>
74
+ </Option>
75
+ </Select>
70
76
  </template>
71
-
72
- <!-- 无选项 -->
73
- <div
74
- v-else
75
- class="dsh-subtip"
76
- >-- 无选择项 --</div>
77
77
  </div>
78
78
 
79
79
  <!-- 查看 -->
@@ -4,10 +4,10 @@
4
4
  v-if="!multipleMode && canEdit"
5
5
  class="DshSelect"
6
6
  >
7
- <!-- 有选项 -->
8
- <template v-if="listData.length">
9
- <!-- flat方式 -->
10
- <template v-if="['flat', 'button'].includes(showType)">
7
+ <!-- flat方式 -->
8
+ <template v-if="['flat', 'button'].includes(showType)">
9
+ <!-- 有选项 -->
10
+ <template v-if="listData.length">
11
11
  <RadioGroup
12
12
  :class="{
13
13
  'DshSelect-flat': true,
@@ -37,49 +37,49 @@
37
37
  </RadioGroup>
38
38
  </template>
39
39
 
40
- <!-- dropdown模式 -->
41
- <template v-else>
42
- <Select
43
- class="DshSelect-dropdown"
44
- v-model="curVal"
45
- :placeholder="selfPropsObj._placeholder"
46
- :multiple="false"
47
- :disabled="!finalCanEdit"
48
- :clearable="selfPropsObj._clearable"
49
- :filterable="selfPropsObj._filterable"
50
- :size="selfPropsObj._size"
51
- :transfer="selfPropsObj._transfer"
52
- :transfer-class-name="selfPropsObj._transferClassName"
40
+ <!-- 无选项 -->
41
+ <div
42
+ v-else
43
+ class="dsh-subtip"
44
+ >-- 无选择项 --</div>
45
+ </template>
46
+
47
+ <!-- dropdown模式 -->
48
+ <template v-else>
49
+ <Select
50
+ class="DshSelect-dropdown"
51
+ v-model="curVal"
52
+ :placeholder="selfPropsObj._placeholder"
53
+ :multiple="false"
54
+ :disabled="!finalCanEdit"
55
+ :clearable="selfPropsObj._clearable"
56
+ :filterable="selfPropsObj._filterable"
57
+ :size="selfPropsObj._size"
58
+ :transfer="selfPropsObj._transfer"
59
+ :transfer-class-name="selfPropsObj._transferClassName"
60
+ >
61
+ <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
62
+ <Option
63
+ v-for="(item, index) in listData"
64
+ :key="item._key"
65
+ :value="item._key"
66
+ :label="item.name || item._name"
67
+ :disabled="getRadioItemDisabled(item, index)"
53
68
  >
54
- <!-- </Option>必须和输出内容在一行,否则出现空格导致_filterable出bug -->
55
- <Option
56
- v-for="(item, index) in listData"
57
- :key="item._key"
58
- :value="item._key"
59
- :label="item.name || item._name"
60
- :disabled="getRadioItemDisabled(item, index)"
61
- >
62
- <Icon
63
- v-if="item.icon || item.customIcon"
64
- :type="item.icon"
65
- :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
66
- :color="item.color"
67
- :size="item.size || 20"
68
- />
69
+ <Icon
70
+ v-if="item.icon || item.customIcon"
71
+ :type="item.icon"
72
+ :custom="item.customIcon ? `bico-font ${item.customIcon}` : undefined"
73
+ :color="item.color"
74
+ :size="item.size || 20"
75
+ />
69
76
 
70
- <slot :item="item"></slot>
77
+ <slot :item="item"></slot>
71
78
 
72
- <span>{{ item.name || item._name }}</span>
73
- </Option>
74
- </Select>
75
- </template>
79
+ <span>{{ item.name || item._name }}</span>
80
+ </Option>
81
+ </Select>
76
82
  </template>
77
-
78
- <!-- 无选项 -->
79
- <div
80
- v-else
81
- class="dsh-subtip"
82
- >-- 无选择项 --</div>
83
83
  </div>
84
84
 
85
85
  <!-- 单选模式 查看 -->
@@ -29,7 +29,7 @@
29
29
  :value="conditionItem"
30
30
  :formList="canSearchFormList"
31
31
  :dynamicFieldsMap="dynamicFieldsMap"
32
- @change="change(conditionItem, arguments)"
32
+ @change="change('loopControl', conditionItem, ...arguments)"
33
33
  >
34
34
  <slot
35
35
  slot-scope="{ conditionItem }"
@@ -41,7 +41,7 @@
41
41
  <dsh-icons
42
42
  slot="corner"
43
43
  class="DshAdvSearch-conditions-delete"
44
- :list="$getOperationList(['deleteContion'])"
44
+ :list="$getOperationList(['deleteCondition'])"
45
45
  @click="$dispatchEvent($event, conditionItem, conditionIndex, value.conditions)"
46
46
  />
47
47
  </div>
@@ -54,7 +54,7 @@
54
54
  :formData="conditionItem"
55
55
  :formItem="conditionItem.formItem"
56
56
  height="80"
57
- @change="change(conditionItem, arguments)"
57
+ @change="change('control', conditionItem, ...arguments)"
58
58
  >
59
59
  <slot :conditionItem="conditionItem">
60
60
  <template v-if="!conditionItem.__isDelete__">
@@ -67,7 +67,7 @@
67
67
  :value="conditionItem.fieldSearch"
68
68
  :formList="conditionItem.subFormList"
69
69
  :dynamicFieldsMap="dynamicFieldsMap"
70
- @change="change(conditionItem, arguments)"
70
+ @change="change('subSearch', conditionItem, ...arguments)"
71
71
  ></dsh-adv-search>
72
72
 
73
73
  <div
@@ -77,17 +77,31 @@
77
77
  </template>
78
78
 
79
79
  <!-- 动态筛选字段,出现是有条件的 -->
80
- <dsh-checkbox
81
- v-else-if="conditionItem.parameterType === 'dynamicText'"
82
- class="DshAdvSearch-conditions-item-control"
83
- :value="conditionItem"
84
- :propsObj="{
85
- _name: `${conditionItem.formItem._name}的动态参数`,
86
- _key: 'fieldParams',
87
- _data: conditionItem.dynamicList
88
- }"
89
- @change="change(conditionItem, arguments)"
90
- ></dsh-checkbox>
80
+ <template v-else-if="conditionItem.parameterType === 'dynamicText'">
81
+ <dsh-select
82
+ v-if="useChainField"
83
+ class="DshAdvSearch-conditions-item-control"
84
+ :value="conditionItem"
85
+ :propsObj="{
86
+ _name: `${conditionItem.formItem._name}的联动字段`,
87
+ _key: 'chainFieldKey',
88
+ _data: conditionItem.dynamicList
89
+ }"
90
+ @change="change('parameterTypeControl', conditionItem, ...arguments)"
91
+ ></dsh-select>
92
+
93
+ <dsh-checkbox
94
+ v-else
95
+ class="DshAdvSearch-conditions-item-control"
96
+ :value="conditionItem"
97
+ :propsObj="{
98
+ _name: `${conditionItem.formItem._name}的动态参数`,
99
+ _key: 'fieldParams',
100
+ _data: conditionItem.dynamicList
101
+ }"
102
+ @change="change('parameterTypeControl', conditionItem, ...arguments)"
103
+ ></dsh-checkbox>
104
+ </template>
91
105
 
92
106
  <!-- 为空和不为空时 啥不显示 -->
93
107
  <div
@@ -104,13 +118,22 @@
104
118
  class="DshAdvSearch-conditions-item-extra"
105
119
  >
106
120
  <!-- 动态or固定 筛选条件,出现是有条件的 -->
107
- <dsh-select
121
+ <dsh-dropdown
108
122
  v-if="conditionItem.dynamicList.length"
109
123
  class="extra-dynamic"
110
- :value="conditionItem"
111
- :propsObj="parameterPropsObj"
112
- @change="parameterChange(conditionItem, arguments)"
113
- ></dsh-select>
124
+ :list="parameterPropsObj._data"
125
+ @click="$dispatchEvent(operationMap.selectParameterType, conditionItem, conditionIndex, value.conditions, $event)"
126
+ >
127
+ <span class="extra-operator-wrap">
128
+ <span class="extra-operator-name">
129
+ {{ conditionItem.parameterTypeName }}
130
+ </span>
131
+ <Icon
132
+ class="extra-operator-icon"
133
+ type="ios-arrow-down"
134
+ />
135
+ </span>
136
+ </dsh-dropdown>
114
137
 
115
138
  <!-- operators 筛选条件 -->
116
139
  <dsh-dropdown
@@ -135,7 +158,7 @@
135
158
  <dsh-icons
136
159
  slot="corner"
137
160
  class="DshAdvSearch-conditions-delete"
138
- :list="$getOperationList(['deleteContion'])"
161
+ :list="$getOperationList(['deleteCondition'])"
139
162
  @click="$dispatchEvent($event, conditionItem, conditionIndex, value.conditions)"
140
163
  />
141
164
  </dsh-form-unit>
@@ -167,20 +190,19 @@
167
190
  :list="canSearchFormList"
168
191
  :useSearch="true"
169
192
  trigger="click"
170
- @click="$dispatchEvent(operationMap.createContion, false, $event)"
193
+ @click="$dispatchEvent(operationMap.createCondition, false, $event, value.conditions)"
171
194
  >
172
195
  <dsh-buttons
173
- itemClass="DshAdvSearch-btns-field-create"
174
- :list="$getOperationList(['createContion'])"
196
+ itemClass="DshAdvSearch-btns-item"
197
+ :list="$getOperationList(['createCondition'])"
175
198
  ></dsh-buttons>
176
199
  </dsh-dropdown>
177
200
 
178
201
  <!-- 添加循环层 -->
179
202
  <dsh-buttons
180
203
  class="DshAdvSearch-btns-loop"
181
- itemClass="DshAdvSearch-btns-loop-create"
182
204
  :list="$getOperationList(['createLoopContion'])"
183
- @click="$dispatchEvent($event, true)"
205
+ @click="$dispatchEvent($event, true, undefined, value.conditions)"
184
206
  ></dsh-buttons>
185
207
  </div>
186
208
  </template>
@@ -188,7 +210,10 @@
188
210
  <!-- 无可筛选字段 -->
189
211
  <div
190
212
  v-else
191
- class="DshAdvSearch-nodata"
213
+ :class="{
214
+ 'DshAdvSearch-nodata': !isInner,
215
+ 'DshAdvSearch-nodata-small': isInner
216
+ }"
192
217
  >
193
218
  当前无可筛选的字段
194
219
  </div>
@@ -210,19 +235,9 @@
210
235
  default: "default",
211
236
  validator: function (val) {
212
237
  // 用户态、 配置端、高级依赖、以及仪表盘乱用的地方
213
- return ["default", "set", "dashbord", "rely"].includes(val);
214
- }
215
- },
216
- value: {
217
- type: Object,
218
- default () {
219
- return {
220
- logic: "and",
221
- conditions: []
222
- };
238
+ return ["default", "set", "rely"].includes(val);
223
239
  }
224
240
  },
225
-
226
241
  useLoop: {
227
242
  type: Boolean,
228
243
  default: true
@@ -234,35 +249,14 @@
234
249
  },
235
250
  data () {
236
251
  return {
237
- selfLogicPropsObj: {
238
- _name: "筛选逻辑",
239
- _key: "logic",
240
- _optionKind: "flat",
241
- _clearable: false,
242
- _data: [
243
- { _key: "and", name: "且" },
244
- { _key: "or", name: "或" }
245
- ]
246
- },
247
- parameterPropsObj: {
248
- _name: "参数类型",
249
- _key: "parameterType",
250
- _clearable: false,
251
- _size: "small",
252
- _data: [
253
- { _key: "fixedText", name: "固定文本" },
254
- { _key: "dynamicText", name: "动态文本" }
255
- ]
256
- },
257
-
258
252
  allOperationMap: {
259
- createContion: {
253
+ createCondition: {
260
254
  name: "添加筛选条件",
261
- type: "createContion",
255
+ type: "createCondition",
262
256
  icon: "md-add",
263
257
  size: this.isInner ? "small" : "default",
264
258
  long: true,
265
- event: "createContion"
259
+ event: "createCondition"
266
260
  },
267
261
  createLoopContion: {
268
262
  name: "添加筛选层",
@@ -270,19 +264,24 @@
270
264
  icon: "md-add",
271
265
  size: this.isInner ? "small" : "default",
272
266
  long: true,
273
- event: "createContion"
267
+ event: "createCondition"
274
268
  },
275
- deleteContion: {
269
+ deleteCondition: {
276
270
  name: "删除筛选条件",
277
- type: "deleteContion",
271
+ type: "deleteCondition",
278
272
  customIcon: "bico-delete",
279
273
  size: "16",
280
- event: "deleteContion"
274
+ event: "deleteCondition"
281
275
  },
282
276
  selectOperator: {
283
277
  name: "选择筛选类型",
284
278
  type: "selectOperator",
285
- event: "selectOperator"
279
+ event: "changeOperator"
280
+ },
281
+ selectParameterType: {
282
+ name: "选择筛选方式",
283
+ type: "selectParameterType",
284
+ event: "changeParameterType"
286
285
  }
287
286
  }
288
287
  };
@@ -308,50 +307,6 @@
308
307
 
309
308
  return newConditionItem;
310
309
  });
311
- },
312
-
313
- // 新增筛选条件
314
- createContion (operationItem, isLoop, formItem) {
315
- const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
316
- this.value.conditions.push(newConditionItem);
317
-
318
- this.change(newConditionItem);
319
- },
320
- // 删除筛选条件
321
- deleteContion (operationItem, conditionItem, conditionIndex, list) {
322
- list.splice(conditionIndex, 1);
323
-
324
- this.change(conditionItem);
325
- },
326
- // 选择某控件的筛选类型
327
- selectOperator (operationItem, conditionItem, conditionIndex, list, opertorItem) {
328
- // 重置这些数据
329
- conditionItem.fieldOperator = opertorItem._key;
330
- conditionItem.fieldOperatorName = opertorItem.name;
331
- conditionItem.fieldSearch = {
332
- logic: "and",
333
- conditions: []
334
- };
335
- this.dealSubSearch(conditionItem);
336
-
337
- this.change(conditionItem);
338
- },
339
- // 动态文本和固定文本切换类型
340
- parameterChange (conditionItem) {
341
- if (conditionItem.parameterType === "fixedText") {
342
- conditionItem.fieldParams = [];
343
- } else if (conditionItem.parameterType === "dynamicText") {
344
- conditionItem.fieldValue = [];
345
- }
346
- this.change();
347
- },
348
- // 发生改动
349
- change (conditionItem) {
350
- const advSearchObj = {
351
- ...this.value,
352
- conditions: this.transformConditions(this.value.conditions)
353
- };
354
- this.$emit("change", advSearchObj, conditionItem);
355
310
  }
356
311
  }
357
312
  };
@@ -361,8 +316,8 @@
361
316
  .DshAdvSearch {
362
317
  #title {
363
318
  font-weight: 400;
364
- color: #999999;
365
319
  font-size: 14px;
320
+ color: #999999;
366
321
  }
367
322
 
368
323
  &-title {
@@ -376,6 +331,7 @@
376
331
  &-title {
377
332
  #title();
378
333
  }
334
+
379
335
  &-option {
380
336
  flex: 1;
381
337
  min-width: 100px;
@@ -385,12 +341,12 @@
385
341
 
386
342
  &-conditions {
387
343
  &-delete {
388
- display: none;
389
- padding: 3px;
390
344
  position: absolute;
391
- top: 6px;
392
- right: 2px;
345
+ top: 3px;
346
+ right: -2px;
347
+ padding: 3px;
393
348
  color: red;
349
+ display: none;
394
350
  }
395
351
 
396
352
  &-loop,
@@ -417,10 +373,6 @@
417
373
  margin-bottom: 10px!important;
418
374
  cursor: pointer;
419
375
 
420
- .DshFormUnit-label-right {
421
- flex: 6;
422
- }
423
-
424
376
  &-loading {
425
377
  margin: 5px 0px;
426
378
  text-align: center;
@@ -440,33 +392,27 @@
440
392
 
441
393
  &-extra {
442
394
  text-align: right;
443
- padding-right: 10px;
444
395
 
445
396
  .extra {
446
- &-dynamic {
447
- width: 90px;
448
- display: inline-block;
449
- }
450
-
397
+ &-dynamic,
451
398
  &-operator {
452
- .dsh-margin-right10();
453
-
454
399
  &-wrap {
455
400
  display: inline-block;
456
- padding: 5px;
401
+ padding: 3px 5px;
402
+ border-radius: 3px;
457
403
 
458
404
  &:hover {
459
- background-color: #E8F3FD;
405
+ background-color: #e9f2f9;
460
406
  }
461
407
  }
462
408
 
463
409
  &-name {
464
410
  display: inline-block;
465
- min-width: 36px;
411
+ min-width: 24px;
466
412
  }
467
413
 
468
414
  &-icon {
469
- .dsh-margin-left5();
415
+ margin-left: 3px;
470
416
  }
471
417
  }
472
418
  }
@@ -485,27 +431,20 @@
485
431
  &-list {
486
432
  width: 330px;
487
433
  }
488
-
489
- &-create {
490
- #btn-style();
491
- }
492
434
  }
493
435
 
494
436
  &-loop {
495
437
  flex: 1;
496
438
  margin-left: 12px;
497
-
498
- &-create {
499
- #btn-style();
500
- }
501
439
  }
502
440
  }
503
441
 
504
442
  &-nodata {
505
- margin: 20px 0px;
506
- text-align: center;
507
- font-size: 16px;
508
- color: #B8BECC;
443
+ #dsh-nodata();
444
+
445
+ &-small {
446
+ #dsh-nodata-small();
447
+ }
509
448
  }
510
449
  }
511
450
  </style>
@@ -514,7 +453,8 @@
514
453
  &-conditions {
515
454
  &-item {
516
455
  .DshFormUnit-label-right {
517
- flex: 2;
456
+ flex: 4;
457
+ margin-right: 12px;
518
458
  }
519
459
 
520
460
  // 左右显示时
@@ -154,13 +154,18 @@
154
154
  toggleSpreadStatus () {
155
155
  this.isSpreadStatus = !this.isSpreadStatus;
156
156
  },
157
+ // 发生改动
158
+ change (conditionItem) {
159
+ const conditionList = this.transformConditions(this.conditionList).filter(item => !!item.fieldValue.length);
160
+
161
+ this.$emit("change", conditionList, conditionItem);
162
+ },
157
163
 
158
164
  // 获取表单配置
159
165
  getFormItem (formItem) {
160
166
  return {
161
167
  ...this.formatFormItem(formItem),
162
168
  onDftSearch: true,
163
-
164
169
  _line: true,
165
170
  _useColor: false,
166
171
  _optionKind: "dropdown",
@@ -179,14 +184,6 @@
179
184
  : {}
180
185
  )
181
186
  };
182
- },
183
- // 发生改动
184
- change (conditionItem) {
185
- const conditionList = this.transformConditions(this.conditionList).filter(item =>
186
- !!item.fieldValue.length
187
- );
188
-
189
- this.$emit("change", conditionList, conditionItem);
190
187
  }
191
188
  }
192
189
  };
@@ -5,6 +5,15 @@ export default {
5
5
  DshFormUnit
6
6
  },
7
7
  props: {
8
+ value: {
9
+ type: Object,
10
+ default () {
11
+ return {
12
+ logic: "and",
13
+ conditions: []
14
+ };
15
+ }
16
+ },
8
17
  formList: {
9
18
  type: Array,
10
19
  default () {
@@ -12,25 +21,97 @@ export default {
12
21
  }
13
22
  },
14
23
 
15
- dynamicFieldsMap: {
16
- type: Object,
24
+ dynamicFormList: {
25
+ type: Array,
17
26
  default () {
18
- return {};
27
+ return [];
19
28
  }
29
+ },
30
+ useChainField: {
31
+ type: Boolean,
32
+ default: false
20
33
  }
21
34
  },
22
35
  data () {
23
36
  return {
24
- fieldMap: this.$modFieldMap
37
+ fieldMap: this.$modFieldMap,
38
+
39
+ selfLogicPropsObj: {
40
+ _name: "筛选逻辑",
41
+ _key: "logic",
42
+ _optionKind: "flat",
43
+ _clearable: false,
44
+ _data: [
45
+ { _key: "and", name: "且" },
46
+ { _key: "or", name: "或" }
47
+ ]
48
+ },
49
+ parameterPropsObj: {
50
+ _name: "参数类型",
51
+ _key: "parameterType",
52
+ _clearable: false,
53
+ _size: "small",
54
+ _data: [
55
+ { _key: "fixedText", name: "固定文本" },
56
+ { _key: "dynamicText", name: "动态文本" }
57
+ ]
58
+ }
25
59
  };
26
60
  },
27
61
  computed: {
28
62
  canSearchFormList () {
29
63
  return this.formList.filter(formItem => this.$formHasAbility(formItem, "canSearch"));
64
+ },
65
+ dynamicFieldsMap () {
66
+ return this.$arrToCategoryArr(this.dynamicFormList);
30
67
  }
31
68
  },
32
69
  created () { },
33
70
  methods: {
71
+ // 新增筛选条件
72
+ createCondition (operationItem, isLoop, formItem, list) {
73
+ const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
74
+ list.push(newConditionItem);
75
+
76
+ this.change(operationItem.type, newConditionItem);
77
+ },
78
+ // 删除筛选条件
79
+ deleteCondition (operationItem, conditionItem, conditionIndex, list) {
80
+ list.splice(conditionIndex, 1);
81
+
82
+ this.change(operationItem.type, conditionItem);
83
+ },
84
+ // 选择某控件的动态文本或固定文本类型
85
+ changeParameterType (operationItem, conditionItem, conditionIndex, list, optionItem) {
86
+ conditionItem.parameterType = optionItem._key;
87
+ conditionItem.parameterTypeName = optionItem.name;
88
+ conditionItem.fieldParams = [];
89
+ conditionItem.chainFieldKey = "";
90
+ conditionItem.fieldValue = [];
91
+
92
+ this.change(operationItem.type, conditionItem);
93
+ },
94
+ // 选择某控件的筛选类型
95
+ changeOperator (operationItem, conditionItem, conditionIndex, list, optionItem) {
96
+ conditionItem.fieldOperator = optionItem._key;
97
+ conditionItem.fieldOperatorName = optionItem.name;
98
+ conditionItem.fieldSearch = {
99
+ logic: "and",
100
+ conditions: []
101
+ };
102
+ this.dealSubSearch(conditionItem);
103
+
104
+ this.change(operationItem.type, conditionItem);
105
+ },
106
+ // 发生改动
107
+ change (operationType, conditionItem) {
108
+ const advSearchObj = {
109
+ ...this.value,
110
+ conditions: this.transformConditions(this.value.conditions)
111
+ };
112
+ this.$emit("change", advSearchObj, operationType, conditionItem);
113
+ },
114
+
34
115
  /* -------- 方法 ----------- */
35
116
  // 生成筛选条件的值
36
117
  createContionFunc (initContion = { logic: "field" }, curFormItem, fieldKey) {
@@ -39,16 +120,16 @@ export default {
39
120
 
40
121
  if (formItem) {
41
122
  const fieldData = this.fieldMap[formItem._type];
42
- const subFormList = formItem._subForm || [];
123
+
124
+ const dynamicTypes = this.useChainField ? (fieldData.categoryKinds || []) : [formItem._type];
125
+ const dynamicList = dynamicTypes.reduce((list, type) => [...list, ...(this.dynamicFieldsMap[type] || [])], []) || [];
126
+ const parameterType = initContion.parameterType || ((initContion.fieldParams || []).length || initContion.chainFieldKey ? "dynamicText" : "fixedText");
127
+ const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || {}).name;
43
128
 
44
129
  const operators = fieldData[this.mode === "set" ? "operatorsSet" : this.mode === "rely" ? "operatorsRely" : "operators"] || fieldData.operators || [];
45
130
  const fieldOperator = initContion.fieldOperator || (operators[0] || {})._key;
46
131
  const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || {}).name;
47
132
 
48
- const fieldValue = initContion.fieldValue || [];
49
- const dynamicList = this.dynamicFieldsMap[formItem._type] || [];
50
- const parameterType = initContion.parameterType || (!dynamicList.length || fieldValue.length ? "fixedText" : "dynamicText");
51
-
52
133
  return {
53
134
  _id: this.$ObjectID().str,
54
135
  logic: "field",
@@ -56,20 +137,22 @@ export default {
56
137
  fieldType: formItem._type,
57
138
  fieldValue: [],
58
139
  fieldOperator: fieldOperator,
59
- fieldParams: [],
60
140
  fieldSearch: {
61
141
  logic: "and",
62
142
  conditions: []
63
143
  },
144
+ fieldParams: [],
145
+ chainFieldKey: "",
64
146
  ...initContion,
147
+ parameterType: parameterType,
65
148
 
66
149
  // 下面的是前端所用
67
- parameterType: parameterType,
68
150
  dynamicList: dynamicList,
69
- fieldOperatorName: fieldOperatorName,
151
+ parameterTypeName: parameterTypeName,
70
152
  operators: operators,
153
+ fieldOperatorName: fieldOperatorName,
71
154
  formItem: this.getFormItem(formItem),
72
- subFormList: subFormList,
155
+ subFormList: formItem._subForm || [],
73
156
  finished: false // 标记 reference类型请求form数据 是否完成状态
74
157
  };
75
158
  } else {
@@ -143,7 +226,6 @@ export default {
143
226
  canEdit: true
144
227
  };
145
228
  },
146
-
147
229
  // 处理operator为子集subSearch\subTableSearch,1.subTableSearch为flatTable类型,使用_subForm;2.subSearch为reference类型,请求form
148
230
  dealSubSearch (conditionItem) {
149
231
  if (conditionItem.fieldOperator === "subSearch") {
@@ -174,32 +256,35 @@ export default {
174
256
  }
175
257
  });
176
258
  },
177
-
178
259
  // 剔除conditions项里不要的属性
179
260
  transformConditions (list = []) {
180
- const conditionFields = [
181
- "_id", "logic", "conditions", "textSearch", "nativeSearch",
182
- "fieldKey", "fieldType", "fieldValue", "fieldParams", "fieldOperator", "fieldSearch", "parameterType",
183
- "chainFieldKey"
184
- ];
185
-
186
- return list.map(item =>
187
- conditionFields.reduce((obj, key) =>
188
- Object.assign(obj, {
189
- [key]: item[key]
190
- ? (
191
- key === "fieldSearch"
192
- ? {
193
- ...item[key],
194
- conditions: this.transformConditions(item[key].conditions)
195
- }
196
- : key === "conditions"
197
- ? this.transformConditions(item[key])
198
- : item[key]
199
- )
200
- : item[key]
201
- }), {})
202
- );
261
+ const loop = (list) => {
262
+ const conditionFields = [
263
+ "_id", "logic", "conditions", "textSearch", "nativeSearch",
264
+ "fieldKey", "fieldType", "fieldValue", "fieldOperator", "fieldSearch",
265
+ "parameterType", "fieldParams", "chainFieldKey"
266
+ ];
267
+
268
+ return list.map(item =>
269
+ conditionFields.reduce((obj, key) =>
270
+ Object.assign(obj, {
271
+ [key]: item[key]
272
+ ? (
273
+ key === "fieldSearch"
274
+ ? {
275
+ ...item[key],
276
+ conditions: loop(item[key].conditions)
277
+ }
278
+ : key === "conditions"
279
+ ? loop(item[key])
280
+ : item[key]
281
+ )
282
+ : item[key]
283
+ }), {})
284
+ );
285
+ };
286
+
287
+ return loop(list);
203
288
  }
204
289
  }
205
290
  };
@@ -5,7 +5,7 @@
5
5
  v-if="isLoading"
6
6
  class="DshCard-loading"
7
7
  ></bri-loading>
8
- <template>
8
+ <template v-else>
9
9
  <!-- 有数据 -->
10
10
  <CheckboxGroup
11
11
  v-if="data.length"
@@ -5,7 +5,7 @@
5
5
  v-if="isLoading"
6
6
  class="DshPanel-loading"
7
7
  ></bri-loading>
8
- <template>
8
+ <template v-else>
9
9
  <!-- 有数据 -->
10
10
  <template v-if="data.length">
11
11
  <div
@@ -34,13 +34,4 @@
34
34
  background-color: #f75252;
35
35
  font-size: 12px;
36
36
  color: #ffffff;
37
- }
38
-
39
- #btn-style {
40
- background: #F4F8FF;
41
- border: 1px solid #6694ED;
42
- border-radius: 4px;
43
- font-weight: bold;
44
- font-family: titleFontFamily;
45
- color: @themeColor;
46
37
  }
@@ -27,7 +27,7 @@
27
27
  #dsh-nodata-small {
28
28
  width: 100%;
29
29
  margin: auto;
30
- padding: 10px 10px;
30
+ padding: 10px 5px;
31
31
  text-align: center;
32
32
  font-size: 12px;
33
33
  font-weight: 500;