bri-components 1.2.85 → 1.2.86

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.85",
3
+ "version": "1.2.86",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -24,11 +24,12 @@
24
24
  class="DshAdvSearch-conditions-loop"
25
25
  >
26
26
  <dsh-adv-search
27
- :isInner="true"
28
27
  :mode="mode"
28
+ :isInner="true"
29
29
  :value="conditionItem"
30
30
  :formList="canSearchFormList"
31
- :dynamicFieldsMap="dynamicFieldsMap"
31
+ :useChainField="useChainField"
32
+ :dynamicFormList="dynamicFormList"
32
33
  @change="change('loopControl', conditionItem, ...arguments)"
33
34
  >
34
35
  <slot
@@ -52,7 +53,7 @@
52
53
  :key="`${conditionItem._id}field`"
53
54
  :class="{
54
55
  'DshAdvSearch-conditions-item': true,
55
- 'DshAdvSearch-conditions-item-dynamic': conditionItem.dynamicList.length
56
+ 'DshAdvSearch-conditions-item-dynamic': conditionItem.dynamicList && conditionItem.dynamicList.length
56
57
  }"
57
58
  :formData="conditionItem"
58
59
  :formItem="conditionItem.formItem"
@@ -61,26 +62,8 @@
61
62
  >
62
63
  <template v-if="!conditionItem.__isDelete__">
63
64
  <slot :conditionItem="conditionItem">
64
- <!-- 子表的筛选,出现是有条件的,递归 -->
65
- <template v-if="['subSearch', 'subTableSearch'].includes(conditionItem.fieldOperator)">
66
- <dsh-adv-search
67
- v-if="conditionItem.finished === true"
68
- :isInner="true"
69
- :mode="mode"
70
- :value="conditionItem.fieldSearch"
71
- :formList="conditionItem.subFormList"
72
- :dynamicFieldsMap="dynamicFieldsMap"
73
- @change="change('subSearch', conditionItem, ...arguments)"
74
- ></dsh-adv-search>
75
-
76
- <div
77
- v-else
78
- class="DshAdvSearch-conditions-item-loading"
79
- >加载中……</div>
80
- </template>
81
-
82
- <!-- 动态筛选字段,出现是有条件的 -->
83
- <template v-else-if="conditionItem.parameterType === 'dynamicText'">
65
+ <!-- 动态文本 -匹配的动态筛选字段 -->
66
+ <template v-if="conditionItem.parameterType === 'dynamicText'">
84
67
  <dsh-select
85
68
  v-if="useChainField"
86
69
  class="DshAdvSearch-conditions-item-control"
@@ -106,11 +89,33 @@
106
89
  ></dsh-checkbox>
107
90
  </template>
108
91
 
109
- <!-- 为空和不为空时 啥不显示 -->
110
- <div
111
- v-else-if="['isnull', 'notnull', 'nosize', 'size', 'nolist', 'list'].includes(conditionItem.fieldOperator)"
112
- class="DshAdvSearch-conditions-item-blank"
113
- >请选择右上角条件</div>
92
+ <!-- 固定文本 -筛选条件对应的显示 -->
93
+ <template v-else>
94
+ <!-- 子表的筛选,出现是有条件的,递归 -->
95
+ <template v-if="['subSearch', 'subTableSearch'].includes(conditionItem.fieldOperator)">
96
+ <dsh-adv-search
97
+ v-if="conditionItem.finished === true"
98
+ :mode="mode"
99
+ :isInner="true"
100
+ :value="conditionItem.fieldSearch"
101
+ :formList="conditionItem.subFormList"
102
+ :useChainField="useChainField"
103
+ :dynamicFormList="dynamicFormList"
104
+ @change="change('subSearch', conditionItem, ...arguments)"
105
+ ></dsh-adv-search>
106
+
107
+ <div
108
+ v-else
109
+ class="DshAdvSearch-conditions-item-loading"
110
+ >加载中……</div>
111
+ </template>
112
+
113
+ <!-- 为空和不为空时 啥不显示 -->
114
+ <div
115
+ v-else-if="['isnull', 'notnull', 'nosize', 'size', 'nolist', 'list'].includes(conditionItem.fieldOperator)"
116
+ class="DshAdvSearch-conditions-item-blank"
117
+ >请选择右上角条件</div>
118
+ </template>
114
119
  </slot>
115
120
  </template>
116
121
 
@@ -176,11 +176,6 @@
176
176
  ? {
177
177
  _useShortcuts: false
178
178
  }
179
- // labels类型的
180
- : ["labels"].includes(formItem._type)
181
- ? {
182
- mode: "defaultSearch"
183
- }
184
179
  : {}
185
180
  )
186
181
  };
@@ -21,15 +21,15 @@ export default {
21
21
  }
22
22
  },
23
23
 
24
+ useChainField: {
25
+ type: Boolean,
26
+ default: false
27
+ },
24
28
  dynamicFormList: {
25
29
  type: Array,
26
30
  default () {
27
31
  return [];
28
32
  }
29
- },
30
- useChainField: {
31
- type: Boolean,
32
- default: false
33
33
  }
34
34
  },
35
35
  data () {
@@ -51,6 +51,7 @@ export default {
51
51
  _key: "parameterType",
52
52
  _clearable: false,
53
53
  _size: "small",
54
+ _default: "fixedText",
54
55
  _data: [
55
56
  { _key: "fixedText", name: "固定文本" },
56
57
  { _key: "dynamicText", name: "动态文本" }
@@ -116,25 +117,32 @@ export default {
116
117
  // 生成筛选条件的值
117
118
  createContionFunc (initContion = { logic: "field" }, curFormItem, fieldKey) {
118
119
  if (["field", undefined].includes(initContion.logic)) {
119
- const formItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
120
+ curFormItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
120
121
 
121
- if (formItem) {
122
- const fieldData = this.fieldMap[formItem._type];
122
+ if (curFormItem) {
123
+ const fieldData = this.fieldMap[curFormItem._type];
123
124
 
124
- const dynamicTypes = this.useChainField ? (fieldData.categoryKinds || []) : [formItem._type];
125
- const dynamicList = dynamicTypes.reduce((list, type) => [...list, ...(this.dynamicFieldsMap[type] || [])], []) || [];
125
+ const dynamicTypes = this.useChainField ? [...new Set([...(fieldData.categoryTypes || []), curFormItem._type])] : [curFormItem._type];
126
+ let dynamicList = dynamicTypes.reduce((list, type) => [...list, ...(this.dynamicFieldsMap[type] || [])], []);
127
+ dynamicList = this.useChainField
128
+ ? ["select", "checkbox", "cascader", "cascaders"].includes(curFormItem._type)
129
+ ? dynamicList.filter(dynamicItem => dynamicItem._resourceKey === curFormItem._resourceKey)
130
+ : ["reference"].includes(curFormItem._type) && !!curFormItem._ref
131
+ ? dynamicList.filter(dynamicItem => dynamicItem._ref === curFormItem._ref)
132
+ : dynamicList
133
+ : dynamicList;
126
134
  const parameterType = initContion.parameterType || ((initContion.fieldParams || []).length || initContion.chainFieldKey ? "dynamicText" : "fixedText");
127
- const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || {}).name;
135
+ const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
128
136
 
129
137
  const operators = fieldData[this.mode === "set" ? "operatorsSet" : this.mode === "rely" ? "operatorsRely" : "operators"] || fieldData.operators || [];
130
138
  const fieldOperator = initContion.fieldOperator || (operators[0] || {})._key;
131
- const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || {}).name;
139
+ const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
132
140
 
133
141
  return {
134
142
  _id: this.$ObjectID().str,
135
143
  logic: "field",
136
- fieldKey: formItem._key,
137
- fieldType: formItem._type,
144
+ fieldKey: curFormItem._key,
145
+ fieldType: curFormItem._type,
138
146
  fieldValue: [],
139
147
  fieldOperator: fieldOperator,
140
148
  fieldSearch: {
@@ -151,8 +159,8 @@ export default {
151
159
  parameterTypeName: parameterTypeName,
152
160
  operators: operators,
153
161
  fieldOperatorName: fieldOperatorName,
154
- formItem: this.getFormItem(formItem),
155
- subFormList: formItem._subForm || [],
162
+ formItem: this.getFormItem(curFormItem),
163
+ subFormList: curFormItem._subForm || [],
156
164
  finished: false // 标记 reference类型请求form数据 是否完成状态
157
165
  };
158
166
  } else {