bri-components 1.2.87 → 1.2.89

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.87",
3
+ "version": "1.2.89",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -131,7 +131,7 @@
131
131
  <dsh-dropdown
132
132
  v-if="conditionItem.dynamicList.length"
133
133
  class="extra-dynamic"
134
- :list="parameterPropsObj._data"
134
+ :list="['set'].includes(mode) && ['reference', 'flatTable'].includes(conditionItem.fieldType) ? [] : parameterPropsObj._data"
135
135
  @click="$dispatchEvent(operationMap.selectParameterType, conditionItem, conditionIndex, value.conditions, $event)"
136
136
  >
137
137
  <span class="extra-operator-wrap">
@@ -139,6 +139,7 @@
139
139
  {{ conditionItem.parameterTypeName }}
140
140
  </span>
141
141
  <Icon
142
+ v-if="!(['set'].includes(mode) && ['reference', 'flatTable'].includes(conditionItem.fieldType))"
142
143
  class="extra-operator-icon"
143
144
  type="ios-arrow-down"
144
145
  />
@@ -305,20 +306,8 @@
305
306
  );
306
307
  }
307
308
  },
308
- created () {
309
- this.init();
310
- },
311
- methods: {
312
- // 初始化
313
- init () {
314
- this.value.conditions = this.value.conditions.map(conditionItem => {
315
- const newConditionItem = this.createContionFunc(conditionItem, undefined, conditionItem.fieldKey);
316
- this.dealSubSearch(newConditionItem);
317
-
318
- return newConditionItem;
319
- });
320
- }
321
- }
309
+ created () {},
310
+ methods: {}
322
311
  };
323
312
  </script>
324
313
 
@@ -5,6 +5,12 @@ export default {
5
5
  DshFormUnit
6
6
  },
7
7
  props: {
8
+ initFields: {
9
+ type: Array,
10
+ default () {
11
+ return [];
12
+ }
13
+ },
8
14
  value: {
9
15
  type: Object,
10
16
  default () {
@@ -67,8 +73,22 @@ export default {
67
73
  return this.$arrToCategoryArr(this.dynamicFormList);
68
74
  }
69
75
  },
70
- created () { },
76
+ created () {
77
+ this.init();
78
+ },
71
79
  methods: {
80
+ // 初始化
81
+ init () {
82
+ this.value.conditions = [...this.initFields, ...this.value.conditions].map(conditionItem => {
83
+ const newConditionItem = typeof conditionItem === "string"
84
+ ? this.createContionFunc(undefined, undefined, conditionItem)
85
+ : this.createContionFunc(conditionItem, undefined, conditionItem.fieldKey);
86
+ this.dealSubSearch(newConditionItem);
87
+
88
+ return newConditionItem;
89
+ });
90
+ },
91
+
72
92
  // 新增筛选条件
73
93
  createCondition (operationItem, isLoop, formItem, list) {
74
94
  const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
@@ -138,21 +158,26 @@ export default {
138
158
  curFormItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
139
159
 
140
160
  if (curFormItem) {
141
- const fieldData = this.fieldMap[curFormItem._type];
161
+ const fieldType = curFormItem._type;
162
+ const fieldData = this.fieldMap[fieldType];
142
163
 
143
- const dynamicTypes = this.useChainField ? [...new Set([...(fieldData.categoryTypes || []), curFormItem._type])] : [curFormItem._type];
144
- let dynamicList = dynamicTypes.reduce((list, type) => [...list, ...(this.dynamicFieldsMap[type] || [])], []);
164
+ const dynamicTypes = this.useChainField ? [...new Set([...(fieldData.categoryTypes || []), fieldType])] : [fieldType];
165
+ let dynamicList = dynamicTypes.reduce((list, type) => list.concat(this.dynamicFieldsMap[type] || []), []);
145
166
  dynamicList = this.useChainField
146
- ? ["select", "checkbox", "cascader", "cascaders"].includes(curFormItem._type)
167
+ ? ["select", "checkbox", "cascader", "cascaders"].includes(fieldType)
147
168
  ? dynamicList.filter(dynamicItem => dynamicItem._resourceKey === curFormItem._resourceKey)
148
- : ["reference"].includes(curFormItem._type) && !!curFormItem._ref
169
+ : ["reference"].includes(fieldType) && !!curFormItem._ref
149
170
  ? dynamicList.filter(dynamicItem => dynamicItem._ref === curFormItem._ref)
150
171
  : dynamicList
151
172
  : dynamicList;
152
- const parameterType = initContion.parameterType || ((initContion.fieldParams || []).length || initContion.chainFieldKey ? "dynamicText" : "fixedText");
173
+ const parameterType = initContion.parameterType || (
174
+ (initContion.fieldParams || []).length || initContion.chainFieldKey || (!!dynamicList.length && ["set"].includes(this.mode) && ["reference", "flatTable"].includes(fieldType))
175
+ ? "dynamicText"
176
+ : "fixedText"
177
+ );
153
178
  const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
154
179
 
155
- const operators = fieldData[this.mode === "default" || dynamicList.length ? "operators" : "operatorsSet"] || fieldData.operators || [];
180
+ const operators = fieldData[!dynamicList.length && ["set"].includes(this.mode) ? "operatorsSet" : "operators"] || fieldData.operators || [];
156
181
  const fieldOperator = initContion.fieldOperator || (operators[0] || {})._key;
157
182
  const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
158
183
 
@@ -160,7 +185,7 @@ export default {
160
185
  _id: this.$ObjectID().str,
161
186
  logic: "field",
162
187
  fieldKey: curFormItem._key,
163
- fieldType: curFormItem._type,
188
+ fieldType: fieldType,
164
189
  fieldValue: [],
165
190
  fieldOperator: fieldOperator,
166
191
  fieldSearch: {
@@ -246,7 +271,9 @@ export default {
246
271
  if (conditionItem.finished !== true) {
247
272
  this.getModData(conditionItem.formItem, data => {
248
273
  conditionItem.finished = true;
249
- conditionItem.subFormList = data.screens[0].form;
274
+ conditionItem.subFormList = (data.screens.find(screenItem =>
275
+ this.mode === "set" ? screenItem.screenType === "all" : screenItem._key === conditionItem.formItem._screen
276
+ ) || { form: [] }).form;
250
277
  });
251
278
  }
252
279
  } else if (conditionItem.fieldOperator === "subTableSearch") {
@@ -262,8 +289,7 @@ export default {
262
289
  name: "schema"
263
290
  },
264
291
  params: {
265
- _key: obj._ref,
266
- fields: obj._refFields
292
+ _key: obj._ref
267
293
  },
268
294
  callback: data => {
269
295
  cb(data);
@@ -294,7 +320,7 @@ export default {
294
320
  : item[key]
295
321
  )
296
322
  : item[key]
297
- }), {})
323
+ }), {})
298
324
  );
299
325
  };
300
326