bri-components 1.2.83 → 1.2.85

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.83",
3
+ "version": "1.2.85",
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
  <!-- 单选模式 查看 -->
@@ -31,7 +31,7 @@
31
31
  height: auto;
32
32
  padding: 6px 0px;
33
33
  margin-right: 12px;
34
- margin-bottom: 4px;
34
+ margin-top: 4px;
35
35
  white-space: normal;
36
36
 
37
37
  .ivu-@{control-type} {
@@ -86,7 +86,7 @@
86
86
 
87
87
 
88
88
  & + span {
89
- color: #aaaaaa;
89
+ color: #999999;
90
90
  }
91
91
  }
92
92
  }
@@ -97,6 +97,67 @@
97
97
  }
98
98
 
99
99
  &-color {
100
+ #template (@color) {
101
+ .ivu-@{control-type} {
102
+ .ivu-@{control-type}-inner {
103
+ border-color: @color;
104
+ }
105
+
106
+ &-checked {
107
+ // 因为不一致,所以明确名字分开写
108
+ .ivu-radio-inner {
109
+ &::after {
110
+ background-color: @color;
111
+ }
112
+ }
113
+ .ivu-checkbox-inner {
114
+ background-color: @color;
115
+ }
116
+ }
117
+ }
118
+
119
+ &-checked {
120
+ border-color: @color;
121
+ }
122
+
123
+ &-disabled {
124
+ border-color: transparent;
125
+
126
+ .ivu-@{control-type} {
127
+ .ivu-@{control-type}-inner {
128
+ border-color: #cccccc;
129
+ }
130
+
131
+ &-checked {
132
+ // 因为不一致,所以明确名字分开写
133
+ .ivu-radio-inner {
134
+ &::after {
135
+ background-color: #cccccc;
136
+ }
137
+ }
138
+ .ivu-checkbox-inner {
139
+ background-color: #cccccc;
140
+
141
+ // 对勾的颜色
142
+ &::after {
143
+ border-color: #f3f3f3;
144
+ }
145
+ }
146
+ }
147
+
148
+
149
+ & + span {
150
+ color: @color;
151
+ opacity: 0.6;
152
+ }
153
+ }
154
+
155
+ &.ivu-@{control-type}-wrapper-checked {
156
+ border-color: #cccccc;
157
+ }
158
+ }
159
+ }
160
+
100
161
  .ivu-@{control-type}-wrapper {
101
162
  padding: 6px 15px;
102
163
  border-radius: 4px;
@@ -105,10 +166,8 @@
105
166
 
106
167
  .ivu-@{control-type} {
107
168
  .ivu-@{control-type}-inner {
108
- border: 2px solid @themeColor;
109
- background-color: transparent;
169
+ border: 2px solid #aaaaaa;
110
170
  }
111
-
112
171
  // 因为不一致,所以明确名字分开写
113
172
  .ivu-radio-inner {
114
173
  width: 14px;
@@ -119,77 +178,50 @@
119
178
  height: 6px;
120
179
  left: 2px;
121
180
  top: 2px;
181
+ background-color: transparent;
122
182
  }
123
183
  }
124
184
  .ivu-checkbox-inner {
185
+ background-color: transparent;
186
+
125
187
  &::after {
126
188
  top: 2px;
127
189
  left: 4px;
128
190
  }
129
191
  }
130
- }
131
- }
132
-
133
- each(@resourceColor, {
134
- .color-@{index}.ivu-@{control-type}-wrapper {
135
- .ivu-@{control-type} {
136
- .ivu-@{control-type}-inner {
137
- border-color: @value;
138
- }
139
192
 
140
- &-checked {
141
- // 因为不一致,所以明确名字分开写
142
- .ivu-radio-inner {
143
- &::after {
144
- background-color: @value;
145
- }
146
- }
147
- .ivu-checkbox-inner {
148
- background-color: @value;
193
+ &-checked {
194
+ // 因为不一致,所以明确名字分开写
195
+ .ivu-radio-inner {
196
+ &::after {
197
+ background-color: #aaaaaa;
149
198
  }
150
199
  }
200
+ .ivu-checkbox-inner {
201
+ background-color: #aaaaaa;
202
+ }
151
203
  }
204
+ }
152
205
 
153
- &-checked {
154
- border-color: @value;
206
+ &-checked {
207
+ border-color: #aaaaaa;
208
+ }
209
+ }
210
+
211
+ .color-default.ivu-@{control-type}-wrapper {
212
+ // 为了填补default主题下无style
213
+ // background-color: @theme-focus!important;
214
+ .ivu-@{control-type} {
215
+ & + span {
216
+ color: @themeColor;
155
217
  }
218
+ }
156
219
 
157
- &-disabled {
158
- border-color: transparent;
159
-
160
- .ivu-@{control-type} {
161
- .ivu-@{control-type}-inner {
162
- border-color: #cccccc;
163
- }
164
-
165
- &-checked {
166
- // 因为不一致,所以明确名字分开写
167
- .ivu-radio-inner {
168
- &::after {
169
- background-color: #cccccc;
170
- }
171
- }
172
- .ivu-checkbox-inner {
173
- background-color: #cccccc;
174
-
175
- // 对勾的颜色
176
- &::after {
177
- border-color: #f3f3f3;
178
- }
179
- }
180
- }
181
-
182
-
183
- & + span {
184
- color: @value;
185
- opacity: 0.6;
186
- }
187
- }
188
-
189
- &.ivu-@{control-type}-wrapper-checked {
190
- border-color: #cccccc;
191
- }
192
- }
220
+ #template(@themeColor);
221
+ }
222
+ each(@resourceColor, {
223
+ .color-@{index}.ivu-@{control-type}-wrapper {
224
+ #template(@value);
193
225
  }
194
226
  });
195
227
  }
@@ -201,6 +233,7 @@
201
233
 
202
234
  .ivu-@{control-type}-wrapper {
203
235
  height: 30px;
236
+ margin-top: 0px;
204
237
  margin-bottom: 2px;
205
238
  white-space: nowrap;
206
239
  }
@@ -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>
@@ -50,14 +50,17 @@
50
50
  <dsh-form-unit
51
51
  v-else-if="['field', undefined].includes(conditionItem.logic)"
52
52
  :key="`${conditionItem._id}field`"
53
- class="DshAdvSearch-conditions-item"
53
+ :class="{
54
+ 'DshAdvSearch-conditions-item': true,
55
+ 'DshAdvSearch-conditions-item-dynamic': conditionItem.dynamicList.length
56
+ }"
54
57
  :formData="conditionItem"
55
58
  :formItem="conditionItem.formItem"
56
59
  height="80"
57
- @change="change(conditionItem, arguments)"
60
+ @change="change('control', conditionItem, ...arguments)"
58
61
  >
59
- <slot :conditionItem="conditionItem">
60
- <template v-if="!conditionItem.__isDelete__">
62
+ <template v-if="!conditionItem.__isDelete__">
63
+ <slot :conditionItem="conditionItem">
61
64
  <!-- 子表的筛选,出现是有条件的,递归 -->
62
65
  <template v-if="['subSearch', 'subTableSearch'].includes(conditionItem.fieldOperator)">
63
66
  <dsh-adv-search
@@ -67,7 +70,7 @@
67
70
  :value="conditionItem.fieldSearch"
68
71
  :formList="conditionItem.subFormList"
69
72
  :dynamicFieldsMap="dynamicFieldsMap"
70
- @change="change(conditionItem, arguments)"
73
+ @change="change('subSearch', conditionItem, ...arguments)"
71
74
  ></dsh-adv-search>
72
75
 
73
76
  <div
@@ -77,25 +80,39 @@
77
80
  </template>
78
81
 
79
82
  <!-- 动态筛选字段,出现是有条件的 -->
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>
83
+ <template v-else-if="conditionItem.parameterType === 'dynamicText'">
84
+ <dsh-select
85
+ v-if="useChainField"
86
+ class="DshAdvSearch-conditions-item-control"
87
+ :value="conditionItem"
88
+ :propsObj="{
89
+ _name: `${conditionItem.formItem._name}的联动字段`,
90
+ _key: 'chainFieldKey',
91
+ _data: conditionItem.dynamicList
92
+ }"
93
+ @change="change('parameterTypeControl', conditionItem, ...arguments)"
94
+ ></dsh-select>
95
+
96
+ <dsh-checkbox
97
+ v-else
98
+ class="DshAdvSearch-conditions-item-control"
99
+ :value="conditionItem"
100
+ :propsObj="{
101
+ _name: `${conditionItem.formItem._name}的动态参数`,
102
+ _key: 'fieldParams',
103
+ _data: conditionItem.dynamicList
104
+ }"
105
+ @change="change('parameterTypeControl', conditionItem, ...arguments)"
106
+ ></dsh-checkbox>
107
+ </template>
91
108
 
92
109
  <!-- 为空和不为空时 啥不显示 -->
93
110
  <div
94
111
  v-else-if="['isnull', 'notnull', 'nosize', 'size', 'nolist', 'list'].includes(conditionItem.fieldOperator)"
95
112
  class="DshAdvSearch-conditions-item-blank"
96
113
  >请选择右上角条件</div>
97
- </template>
98
- </slot>
114
+ </slot>
115
+ </template>
99
116
 
100
117
  <!-- 右上角 -->
101
118
  <div
@@ -104,13 +121,22 @@
104
121
  class="DshAdvSearch-conditions-item-extra"
105
122
  >
106
123
  <!-- 动态or固定 筛选条件,出现是有条件的 -->
107
- <dsh-select
124
+ <dsh-dropdown
108
125
  v-if="conditionItem.dynamicList.length"
109
126
  class="extra-dynamic"
110
- :value="conditionItem"
111
- :propsObj="parameterPropsObj"
112
- @change="parameterChange(conditionItem, arguments)"
113
- ></dsh-select>
127
+ :list="parameterPropsObj._data"
128
+ @click="$dispatchEvent(operationMap.selectParameterType, conditionItem, conditionIndex, value.conditions, $event)"
129
+ >
130
+ <span class="extra-operator-wrap">
131
+ <span class="extra-operator-name">
132
+ {{ conditionItem.parameterTypeName }}
133
+ </span>
134
+ <Icon
135
+ class="extra-operator-icon"
136
+ type="ios-arrow-down"
137
+ />
138
+ </span>
139
+ </dsh-dropdown>
114
140
 
115
141
  <!-- operators 筛选条件 -->
116
142
  <dsh-dropdown
@@ -135,7 +161,7 @@
135
161
  <dsh-icons
136
162
  slot="corner"
137
163
  class="DshAdvSearch-conditions-delete"
138
- :list="$getOperationList(['deleteContion'])"
164
+ :list="$getOperationList(['deleteCondition'])"
139
165
  @click="$dispatchEvent($event, conditionItem, conditionIndex, value.conditions)"
140
166
  />
141
167
  </dsh-form-unit>
@@ -167,20 +193,19 @@
167
193
  :list="canSearchFormList"
168
194
  :useSearch="true"
169
195
  trigger="click"
170
- @click="$dispatchEvent(operationMap.createContion, false, $event)"
196
+ @click="$dispatchEvent(operationMap.createCondition, false, $event, value.conditions)"
171
197
  >
172
198
  <dsh-buttons
173
- itemClass="DshAdvSearch-btns-field-create"
174
- :list="$getOperationList(['createContion'])"
199
+ itemClass="DshAdvSearch-btns-item"
200
+ :list="$getOperationList(['createCondition'])"
175
201
  ></dsh-buttons>
176
202
  </dsh-dropdown>
177
203
 
178
204
  <!-- 添加循环层 -->
179
205
  <dsh-buttons
180
206
  class="DshAdvSearch-btns-loop"
181
- itemClass="DshAdvSearch-btns-loop-create"
182
207
  :list="$getOperationList(['createLoopContion'])"
183
- @click="$dispatchEvent($event, true)"
208
+ @click="$dispatchEvent($event, true, undefined, value.conditions)"
184
209
  ></dsh-buttons>
185
210
  </div>
186
211
  </template>
@@ -188,7 +213,10 @@
188
213
  <!-- 无可筛选字段 -->
189
214
  <div
190
215
  v-else
191
- class="DshAdvSearch-nodata"
216
+ :class="{
217
+ 'DshAdvSearch-nodata': !isInner,
218
+ 'DshAdvSearch-nodata-small': isInner
219
+ }"
192
220
  >
193
221
  当前无可筛选的字段
194
222
  </div>
@@ -210,19 +238,9 @@
210
238
  default: "default",
211
239
  validator: function (val) {
212
240
  // 用户态、 配置端、高级依赖、以及仪表盘乱用的地方
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
- };
241
+ return ["default", "set", "rely"].includes(val);
223
242
  }
224
243
  },
225
-
226
244
  useLoop: {
227
245
  type: Boolean,
228
246
  default: true
@@ -234,35 +252,14 @@
234
252
  },
235
253
  data () {
236
254
  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
255
  allOperationMap: {
259
- createContion: {
256
+ createCondition: {
260
257
  name: "添加筛选条件",
261
- type: "createContion",
258
+ type: "createCondition",
262
259
  icon: "md-add",
263
260
  size: this.isInner ? "small" : "default",
264
261
  long: true,
265
- event: "createContion"
262
+ event: "createCondition"
266
263
  },
267
264
  createLoopContion: {
268
265
  name: "添加筛选层",
@@ -270,19 +267,24 @@
270
267
  icon: "md-add",
271
268
  size: this.isInner ? "small" : "default",
272
269
  long: true,
273
- event: "createContion"
270
+ event: "createCondition"
274
271
  },
275
- deleteContion: {
272
+ deleteCondition: {
276
273
  name: "删除筛选条件",
277
- type: "deleteContion",
274
+ type: "deleteCondition",
278
275
  customIcon: "bico-delete",
279
276
  size: "16",
280
- event: "deleteContion"
277
+ event: "deleteCondition"
281
278
  },
282
279
  selectOperator: {
283
280
  name: "选择筛选类型",
284
281
  type: "selectOperator",
285
- event: "selectOperator"
282
+ event: "changeOperator"
283
+ },
284
+ selectParameterType: {
285
+ name: "选择筛选方式",
286
+ type: "selectParameterType",
287
+ event: "changeParameterType"
286
288
  }
287
289
  }
288
290
  };
@@ -308,50 +310,6 @@
308
310
 
309
311
  return newConditionItem;
310
312
  });
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
313
  }
356
314
  }
357
315
  };
@@ -361,8 +319,8 @@
361
319
  .DshAdvSearch {
362
320
  #title {
363
321
  font-weight: 400;
364
- color: #999999;
365
322
  font-size: 14px;
323
+ color: #999999;
366
324
  }
367
325
 
368
326
  &-title {
@@ -376,6 +334,7 @@
376
334
  &-title {
377
335
  #title();
378
336
  }
337
+
379
338
  &-option {
380
339
  flex: 1;
381
340
  min-width: 100px;
@@ -385,12 +344,12 @@
385
344
 
386
345
  &-conditions {
387
346
  &-delete {
388
- display: none;
389
- padding: 3px;
390
347
  position: absolute;
391
- top: 6px;
392
- right: 2px;
348
+ top: 3px;
349
+ right: -3px;
350
+ padding: 3px;
393
351
  color: red;
352
+ display: none;
394
353
  }
395
354
 
396
355
  &-loop,
@@ -417,10 +376,6 @@
417
376
  margin-bottom: 10px!important;
418
377
  cursor: pointer;
419
378
 
420
- .DshFormUnit-label-right {
421
- flex: 6;
422
- }
423
-
424
379
  &-loading {
425
380
  margin: 5px 0px;
426
381
  text-align: center;
@@ -440,33 +395,27 @@
440
395
 
441
396
  &-extra {
442
397
  text-align: right;
443
- padding-right: 10px;
444
398
 
445
399
  .extra {
446
- &-dynamic {
447
- width: 90px;
448
- display: inline-block;
449
- }
450
-
400
+ &-dynamic,
451
401
  &-operator {
452
- .dsh-margin-right10();
453
-
454
402
  &-wrap {
455
403
  display: inline-block;
456
- padding: 5px;
404
+ padding: 3px 5px;
405
+ border-radius: 3px;
457
406
 
458
407
  &:hover {
459
- background-color: #E8F3FD;
408
+ background-color: #e9f2f9;
460
409
  }
461
410
  }
462
411
 
463
412
  &-name {
464
413
  display: inline-block;
465
- min-width: 36px;
414
+ min-width: 24px;
466
415
  }
467
416
 
468
417
  &-icon {
469
- .dsh-margin-left5();
418
+
470
419
  }
471
420
  }
472
421
  }
@@ -485,27 +434,20 @@
485
434
  &-list {
486
435
  width: 330px;
487
436
  }
488
-
489
- &-create {
490
- #btn-style();
491
- }
492
437
  }
493
438
 
494
439
  &-loop {
495
440
  flex: 1;
496
441
  margin-left: 12px;
497
-
498
- &-create {
499
- #btn-style();
500
- }
501
442
  }
502
443
  }
503
444
 
504
445
  &-nodata {
505
- margin: 20px 0px;
506
- text-align: center;
507
- font-size: 16px;
508
- color: #B8BECC;
446
+ #dsh-nodata();
447
+
448
+ &-small {
449
+ #dsh-nodata-small();
450
+ }
509
451
  }
510
452
  }
511
453
  </style>
@@ -514,15 +456,13 @@
514
456
  &-conditions {
515
457
  &-item {
516
458
  .DshFormUnit-label-right {
517
- flex: 2;
459
+ flex: 3;
460
+ margin-right: 10px;
518
461
  }
519
462
 
520
- // 左右显示时
521
- .DshFormUnit-line {
522
- padding-left: 0px;
523
-
463
+ &-dynamic {
524
464
  .DshFormUnit-label-right {
525
- flex: none;
465
+ flex: 4;
526
466
  }
527
467
  }
528
468
  }
@@ -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
  };
@@ -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;