bri-components 1.5.22 → 1.6.1
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/README.md +83 -83
- package/lib/styles/bundle.css +12 -12
- package/lib/styles/font/fontello.svg +31 -31
- package/package.json +127 -125
- package/src/components/Error/Error403.vue +42 -42
- package/src/components/Error/Error404.vue +40 -40
- package/src/components/Error/Error500.vue +51 -51
- package/src/components/Error/error.less +162 -162
- package/src/components/Error/errorBack.vue +40 -40
- package/src/components/controls/DshControlInput.vue +195 -195
- package/src/components/controls/base/BriUpload/BriUpload.vue +435 -434
- package/src/components/controls/base/BriUpload/BriUploadImage.vue +430 -377
- package/src/components/controls/base/BriUpload/uploadList.vue +738 -727
- package/src/components/controls/base/BriUpload/uploadMixin.js +453 -446
- package/src/components/controls/base/DshCascader/DshCascader.vue +215 -215
- package/src/components/controls/base/DshCascader/components/cascaderModal.vue +366 -366
- package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +416 -416
- package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -141
- package/src/components/controls/base/DshCascader/components/cascaderTree.vue +151 -151
- package/src/components/controls/base/DshCoordinates.vue +587 -585
- package/src/components/controls/base/DshDate/DshDate.vue +191 -191
- package/src/components/controls/base/DshDate/DshDaterange.vue +186 -186
- package/src/components/controls/base/DshDivider.vue +201 -201
- package/src/components/controls/base/DshEditor.vue +274 -274
- package/src/components/controls/base/DshInput/BriInputs.vue +166 -166
- package/src/components/controls/base/DshInput/DshInput.vue +260 -260
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +435 -435
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -34
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -14
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -322
- package/src/components/controls/base/DshNumber/DshNumber.vue +143 -143
- package/src/components/controls/base/DshNumber/DshNumberange.vue +109 -109
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +168 -168
- package/src/components/controls/base/DshSelect/DshSelect.vue +180 -180
- package/src/components/controls/base/DshSelect/DshSelectAll.vue +269 -269
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
- package/src/components/controls/control.less +324 -324
- package/src/components/controls/controlMap.js +117 -117
- package/src/components/controls/extra/DshColor.vue +81 -81
- package/src/components/controls/extra/DshThemeColor.vue +100 -100
- package/src/components/controls/extra/DshThemeIcon.vue +122 -122
- package/src/components/controls/mixins/cascaderMixin.js +325 -325
- package/src/components/controls/mixins/cascaderPickerMixin.js +227 -227
- package/src/components/controls/mixins/cascaderTableMixin.js +130 -130
- package/src/components/controls/mixins/controlMixin.js +393 -393
- package/src/components/controls/mixins/dateMixin.js +149 -149
- package/src/components/controls/mixins/flatTableMixin.js +111 -111
- package/src/components/controls/mixins/numberMixin.js +112 -112
- package/src/components/controls/mixins/selectMixin.js +233 -233
- package/src/components/controls/mixins/switchMixin.js +87 -87
- package/src/components/controls/mixins/userAndDepartMixin.js +260 -260
- package/src/components/controls/senior/DshLabels.vue +333 -333
- package/src/components/controls/senior/DshPackage.vue +57 -57
- package/src/components/controls/senior/cascaderTable.vue +213 -213
- package/src/components/controls/senior/correlation.vue +135 -135
- package/src/components/controls/senior/flatTable.vue +138 -138
- package/src/components/controls/senior/selectDepartments.vue +397 -399
- package/src/components/controls/senior/selectUsers/departMenu.vue +296 -293
- package/src/components/controls/senior/selectUsers/selectUsers.vue +712 -712
- package/src/components/controls/special/DshBack.vue +42 -42
- package/src/components/controls/special/DshUndeveloped.vue +41 -41
- package/src/components/form/DshAdvSearch.vue +510 -510
- package/src/components/form/DshDefaultSearch.vue +260 -260
- package/src/components/form/DshForm.vue +494 -494
- package/src/components/form/searchMixin.js +376 -376
- package/src/components/list/BriCard.vue +95 -95
- package/src/components/list/BriTable.vue +205 -205
- package/src/components/list/BriTree.vue +529 -529
- package/src/components/list/BriTreeItem.vue +163 -163
- package/src/components/list/DshBox/DshBox.vue +219 -219
- package/src/components/list/DshBox/DshCard.vue +446 -446
- package/src/components/list/DshBox/DshCrossTable.vue +827 -827
- package/src/components/list/DshBox/DshList.vue +404 -404
- package/src/components/list/DshBox/DshPanel.vue +669 -669
- package/src/components/list/DshBox/DshSingleData.vue +119 -119
- package/src/components/list/DshBox/DshTable.vue +239 -239
- package/src/components/list/DshCascaderTable.vue +115 -115
- package/src/components/list/DshFlatTable.vue +334 -337
- package/src/components/list/DshPage.vue +194 -194
- package/src/components/list/DshTreeTable.vue +113 -113
- package/src/components/list/common/importModal.vue +243 -243
- package/src/components/list/common/quoteListModal.vue +206 -206
- package/src/components/list/mixins/DshCascaderTableMixin.js +278 -278
- package/src/components/list/mixins/DshFlatTableMixin.js +509 -509
- package/src/components/list/mixins/DshTreeTableMixin.js +286 -286
- package/src/components/list/mixins/tableBaseMixin.js +1653 -1653
- package/src/components/list/mixins/treeTableBaseMixin.js +145 -145
- package/src/components/other/BriAvatar.vue +166 -166
- package/src/components/other/BriCode.vue +125 -125
- package/src/components/other/BriCollapseTree.vue +207 -207
- package/src/components/other/BriGantt.vue +1087 -1087
- package/src/components/other/BriIframe.vue +116 -116
- package/src/components/other/BriLoading.vue +171 -171
- package/src/components/other/BriSvg.vue +27 -27
- package/src/components/other/DshColorPanel.vue +128 -128
- package/src/components/other/DshMenuNav.vue +188 -188
- package/src/components/other/DshVideoPlayer.vue +184 -0
- package/src/components/small/BriButton.vue +71 -71
- package/src/components/small/BriDrawer.vue +169 -169
- package/src/components/small/BriTooltip.vue +87 -87
- package/src/components/small/DshBtnModal.vue +68 -68
- package/src/components/small/DshButtons.vue +324 -324
- package/src/components/small/DshDropdown.vue +225 -225
- package/src/components/small/DshIcons.vue +59 -59
- package/src/components/small/DshListRender.js +21 -21
- package/src/components/small/DshModal.vue +160 -160
- package/src/components/small/DshSteps.vue +141 -141
- package/src/components/small/DshTabs.vue +598 -598
- package/src/components/small/DshTabsSet.vue +309 -309
- package/src/components/small/DshTags.vue +251 -251
- package/src/components/small/DshTitle.vue +50 -50
- package/src/components/small/render.js +20 -20
- package/src/components/unit/DshFormUnit.vue +398 -398
- package/src/components/unit/DshListUnit.vue +115 -115
- package/src/components/unit/unitMixin.js +86 -86
- package/src/data/index.js +4 -4
- package/src/index.js +287 -285
- package/src/styles/bundle.css +12 -12
- package/src/styles/components/BriButton.less +307 -307
- package/src/styles/components/BriTable.less +344 -344
- package/src/styles/components/DshModal.less +257 -257
- package/src/styles/components/index.less +3 -3
- package/src/styles/global/animate.less +11 -11
- package/src/styles/global/base.less +45 -45
- package/src/styles/global/box.less +186 -186
- package/src/styles/global/control.less +122 -122
- package/src/styles/global/flex.less +282 -282
- package/src/styles/global/global.less +8 -8
- package/src/styles/global/text.less +59 -59
- package/src/styles/global/variables.less +85 -85
- package/src/styles/iconfont/iconfont.css +254 -254
- package/src/styles/iconfont/iconfont.json +422 -422
- package/src/styles/iconfont/iconfont.svg +137 -137
- package/src/styles/index.less +26 -26
- package/src/styles/reset-easytable.less +21 -21
- package/src/styles/reset-iview-controls.less +145 -145
- package/src/styles/reset-iview-other.less +49 -49
- package/src/styles/reset-iview-variables.less +43 -43
- package/src/styles/reset.less +45 -45
- package/src/utils/index.js +3 -5
- package/lib/0.bri-components.min.js +0 -1
- package/lib/1.bri-components.min.js +0 -1
- package/lib/10.bri-components.min.js +0 -1
- package/lib/11.bri-components.min.js +0 -1
- package/lib/2.bri-components.min.js +0 -1
- package/lib/3.bri-components.min.js +0 -1
- package/lib/4.bri-components.min.js +0 -1
- package/lib/5.bri-components.min.js +0 -1
- package/lib/6.bri-components.min.js +0 -1
- package/lib/7.bri-components.min.js +0 -1
- package/lib/8.bri-components.min.js +0 -1
- package/lib/9.bri-components.min.js +0 -1
- package/lib/bri-components.min.js +0 -18
- package/src/utils/table.js +0 -175
|
@@ -1,376 +1,376 @@
|
|
|
1
|
-
import DshFormUnit from "../unit/DshFormUnit.vue";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
components: {
|
|
5
|
-
DshFormUnit
|
|
6
|
-
},
|
|
7
|
-
props: {
|
|
8
|
-
initFields: {
|
|
9
|
-
type: Array,
|
|
10
|
-
default () {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
value: {
|
|
15
|
-
type: Object,
|
|
16
|
-
default () {
|
|
17
|
-
return {
|
|
18
|
-
logic: "and",
|
|
19
|
-
conditions: []
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
formList: {
|
|
24
|
-
type: Array,
|
|
25
|
-
default () {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
useChainField: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false
|
|
32
|
-
},
|
|
33
|
-
dynamicFormList: {
|
|
34
|
-
type: Array,
|
|
35
|
-
default () {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
data () {
|
|
41
|
-
return {
|
|
42
|
-
fieldMap: this.$modFieldMap,
|
|
43
|
-
|
|
44
|
-
advSearchObj: {
|
|
45
|
-
logic: "and",
|
|
46
|
-
conditions: []
|
|
47
|
-
},
|
|
48
|
-
parameterPropsObj: {
|
|
49
|
-
_name: "参数类型",
|
|
50
|
-
_key: "parameterType",
|
|
51
|
-
_clearable: false,
|
|
52
|
-
_size: "small",
|
|
53
|
-
_default: "fixedText",
|
|
54
|
-
_data: [
|
|
55
|
-
{ _key: "fixedText", name: "固定文本" },
|
|
56
|
-
{ _key: "dynamicText", name: "动态文本" }
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
computed: {
|
|
62
|
-
canSearchFormList () {
|
|
63
|
-
return this.formList.filter(formItem =>
|
|
64
|
-
this.$formHasAbility(formItem, "canSearch") &&
|
|
65
|
-
(this.mode === "set" ? true : formItem._displayType !== "hide")
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
dynamicFieldsMap () {
|
|
69
|
-
return this.$arrToCategoryArr(this.dynamicFormList);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
created () {
|
|
73
|
-
this.init();
|
|
74
|
-
},
|
|
75
|
-
methods: {
|
|
76
|
-
// 初始化
|
|
77
|
-
init () {
|
|
78
|
-
this.advSearchObj = this.$deepCopy(this.value);
|
|
79
|
-
this.advSearchObj.conditions = [...this.initFields, ...this.advSearchObj.conditions].map(conditionItem => {
|
|
80
|
-
const newConditionItem = typeof conditionItem === "string"
|
|
81
|
-
? this.createContionFunc(undefined, undefined, conditionItem)
|
|
82
|
-
: this.createContionFunc(conditionItem, undefined, conditionItem.fieldKey);
|
|
83
|
-
this.dealSubSearch(newConditionItem);
|
|
84
|
-
|
|
85
|
-
return newConditionItem;
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
// 新增条件项
|
|
90
|
-
createCondition (operationItem, isLoop, formItem, list) {
|
|
91
|
-
const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
|
|
92
|
-
this.dealSubSearch(newConditionItem);
|
|
93
|
-
list.push(newConditionItem);
|
|
94
|
-
|
|
95
|
-
this.change(operationItem.type, newConditionItem);
|
|
96
|
-
},
|
|
97
|
-
// 删除条件项
|
|
98
|
-
deleteCondition (operationItem, conditionItem, conditionIndex, list) {
|
|
99
|
-
list.splice(conditionIndex, 1);
|
|
100
|
-
|
|
101
|
-
this.change(operationItem.type, conditionItem);
|
|
102
|
-
},
|
|
103
|
-
// 获取动态文本或固定文本类型 选项列表
|
|
104
|
-
getParameterData (conditionItem) {
|
|
105
|
-
// 配置端 且 含有子集的
|
|
106
|
-
return !!conditionItem.dynamicList.length && conditionItem.operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key))
|
|
107
|
-
? []
|
|
108
|
-
: this.parameterPropsObj._data;
|
|
109
|
-
},
|
|
110
|
-
// 选择某控件的动态文本或固定文本类型
|
|
111
|
-
changeParameterType (operationItem, conditionItem, conditionIndex, list, optionItem) {
|
|
112
|
-
conditionItem.parameterType = optionItem._key;
|
|
113
|
-
conditionItem.parameterTypeName = optionItem.name;
|
|
114
|
-
conditionItem.fieldParams = [];
|
|
115
|
-
conditionItem.chainFieldKey = "";
|
|
116
|
-
conditionItem.fieldValue = [];
|
|
117
|
-
|
|
118
|
-
this.change(operationItem.type, conditionItem);
|
|
119
|
-
},
|
|
120
|
-
// 选择某控件的操作类型
|
|
121
|
-
changeOperator (operationItem, conditionItem, conditionIndex, list, optionItem) {
|
|
122
|
-
if (optionItem._key !== conditionItem.fieldOperator) {
|
|
123
|
-
conditionItem.fieldOperator = optionItem._key;
|
|
124
|
-
conditionItem.fieldOperatorName = optionItem.name;
|
|
125
|
-
|
|
126
|
-
if (["isnull", "notnull", "nosize", "size", "nolist", "list"].includes(conditionItem.fieldOperator)) {
|
|
127
|
-
conditionItem.fieldParams = [];
|
|
128
|
-
conditionItem.chainFieldKey = "";
|
|
129
|
-
conditionItem.fieldValue = [];
|
|
130
|
-
conditionItem.fieldSearch = {
|
|
131
|
-
logic: "and",
|
|
132
|
-
conditions: []
|
|
133
|
-
};
|
|
134
|
-
} else if (["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(conditionItem.fieldOperator)) {
|
|
135
|
-
conditionItem.fieldParams = [];
|
|
136
|
-
conditionItem.chainFieldKey = "";
|
|
137
|
-
conditionItem.fieldValue = [];
|
|
138
|
-
this.dealSubSearch(conditionItem);
|
|
139
|
-
} else {
|
|
140
|
-
conditionItem.fieldSearch = {
|
|
141
|
-
logic: "and",
|
|
142
|
-
conditions: []
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
this.change(operationItem.type, conditionItem);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
// 发生改动
|
|
150
|
-
change (operationType, conditionItem, ...params) {
|
|
151
|
-
if (operationType === "loopSearch") {
|
|
152
|
-
const subAdvSearchObj = params[0];
|
|
153
|
-
Object.assign(conditionItem, subAdvSearchObj);
|
|
154
|
-
} else if (operationType === "subSearch") {
|
|
155
|
-
const subAdvSearchObj = params[0];
|
|
156
|
-
Object.assign(conditionItem.fieldSearch, subAdvSearchObj);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const advSearchObj = {
|
|
160
|
-
...this.advSearchObj,
|
|
161
|
-
conditions: this.transformConditions(this.advSearchObj.conditions)
|
|
162
|
-
};
|
|
163
|
-
this.$emit("change", advSearchObj, operationType, conditionItem);
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
/* -------- 方法 ----------- */
|
|
167
|
-
// 生成条件项的值
|
|
168
|
-
createContionFunc (initContion = { logic: "field" }, curFormItem, fieldKey) {
|
|
169
|
-
if (["field", undefined].includes(initContion.logic)) {
|
|
170
|
-
curFormItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
|
|
171
|
-
|
|
172
|
-
if (curFormItem) {
|
|
173
|
-
const fieldType = curFormItem._type;
|
|
174
|
-
fieldKey = curFormItem._key;
|
|
175
|
-
const fieldData = this.fieldMap[fieldType];
|
|
176
|
-
|
|
177
|
-
const dynamicTypes = this.useChainField
|
|
178
|
-
? [...new Set([...(fieldData.categoryTypes || []), fieldType])]
|
|
179
|
-
: [fieldType];
|
|
180
|
-
let dynamicList = dynamicTypes.reduce((list, type) => list.concat(this.dynamicFieldsMap[type] || []), []);
|
|
181
|
-
dynamicList = this.useChainField
|
|
182
|
-
? ["select", "checkbox", "cascader", "cascaders"].includes(fieldType)
|
|
183
|
-
? dynamicList.filter(dynamicItem => dynamicItem._resourceKey === curFormItem._resourceKey)
|
|
184
|
-
: ["reference"].includes(fieldType) && !!curFormItem._ref
|
|
185
|
-
? dynamicList.filter(dynamicItem => dynamicItem._ref === curFormItem._ref)
|
|
186
|
-
: dynamicList
|
|
187
|
-
: dynamicList;
|
|
188
|
-
|
|
189
|
-
const operators = (
|
|
190
|
-
["_id"].includes(fieldKey)
|
|
191
|
-
? []
|
|
192
|
-
: ["cascaderTable"].includes(fieldType)
|
|
193
|
-
? curFormItem._subType === "old"
|
|
194
|
-
? fieldData.operators.filter(operator => !["treeTableSearch"].includes(operator._key))
|
|
195
|
-
: fieldData.operators.filter(operator => !["cascaderTableSearch"].includes(operator._key))
|
|
196
|
-
// 单条关联类型 -配置端:无动态字段的地方过滤掉“是”和“不是”筛选条件,有动态字段的地方用的全部条件;用户端:用的全部条件,
|
|
197
|
-
: ["reference"].includes(fieldType)
|
|
198
|
-
? this.mode === "set" && !dynamicList.length
|
|
199
|
-
? fieldData.operators.filter(operator => !["eq", "ne"].includes(operator._key))
|
|
200
|
-
: fieldData.operators
|
|
201
|
-
: fieldData.operators
|
|
202
|
-
) || [];
|
|
203
|
-
|
|
204
|
-
const fieldOperator = initContion.fieldOperator || (
|
|
205
|
-
["_id"].includes(fieldKey)
|
|
206
|
-
? "eq"
|
|
207
|
-
: ["reference"].includes(fieldType) && this.isSimpleSearch
|
|
208
|
-
? "eq"
|
|
209
|
-
: (operators[0] || {})._key
|
|
210
|
-
);
|
|
211
|
-
const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
|
|
212
|
-
|
|
213
|
-
const parameterType = initContion.parameterType || (
|
|
214
|
-
(
|
|
215
|
-
(initContion.fieldParams || []).length ||
|
|
216
|
-
initContion.chainFieldKey ||
|
|
217
|
-
(!!dynamicList.length && operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key)))
|
|
218
|
-
) ? "dynamicText" : "fixedText"
|
|
219
|
-
);
|
|
220
|
-
const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
_id: this.$ObjectID().str,
|
|
224
|
-
logic: "field",
|
|
225
|
-
fieldKey,
|
|
226
|
-
fieldType,
|
|
227
|
-
fieldOperator,
|
|
228
|
-
fieldValue: [],
|
|
229
|
-
fieldSearch: {
|
|
230
|
-
logic: "and",
|
|
231
|
-
conditions: []
|
|
232
|
-
},
|
|
233
|
-
parameterType,
|
|
234
|
-
fieldParams: [],
|
|
235
|
-
chainFieldKey: "",
|
|
236
|
-
...initContion,
|
|
237
|
-
|
|
238
|
-
// 下面的是前端所用
|
|
239
|
-
dynamicList: dynamicList,
|
|
240
|
-
parameterTypeName: parameterTypeName,
|
|
241
|
-
operators,
|
|
242
|
-
fieldOperatorName: fieldOperatorName,
|
|
243
|
-
formItem: this.getFormItem(curFormItem),
|
|
244
|
-
subFormList: curFormItem._subForm || [],
|
|
245
|
-
finished: !operators.some(operator => ["subSearch"].includes(operator._key)) // 子集条件的 请求form数据 是否完成状态
|
|
246
|
-
};
|
|
247
|
-
} else {
|
|
248
|
-
return {
|
|
249
|
-
_id: this.$ObjectID().str,
|
|
250
|
-
...initContion,
|
|
251
|
-
__isDelete__: true, // 前端用它标识对应字段已被删除的条件项
|
|
252
|
-
formItem: {
|
|
253
|
-
__realKey__: initContion.fieldKey
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
} else if (["and", "or"].includes(initContion.logic)) {
|
|
258
|
-
return {
|
|
259
|
-
_id: this.$ObjectID().str,
|
|
260
|
-
logic: "and",
|
|
261
|
-
conditions: [],
|
|
262
|
-
...initContion
|
|
263
|
-
};
|
|
264
|
-
} else if (["text"].includes(initContion.logic)) {
|
|
265
|
-
return {
|
|
266
|
-
_id: this.$ObjectID().str,
|
|
267
|
-
logic: "text",
|
|
268
|
-
textSearch: "",
|
|
269
|
-
...initContion
|
|
270
|
-
};
|
|
271
|
-
} else if (["native"].includes(initContion.logic)) {
|
|
272
|
-
return {
|
|
273
|
-
_id: this.$ObjectID().str,
|
|
274
|
-
logic: "native",
|
|
275
|
-
nativeSearch: {},
|
|
276
|
-
...initContion
|
|
277
|
-
};
|
|
278
|
-
} else {
|
|
279
|
-
return {
|
|
280
|
-
_id: this.$ObjectID().str,
|
|
281
|
-
...initContion
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
// 获取表单配置
|
|
286
|
-
getFormItem (formItem) {
|
|
287
|
-
return {
|
|
288
|
-
...this.formatFormItem(formItem),
|
|
289
|
-
|
|
290
|
-
_line: false,
|
|
291
|
-
_span: 24,
|
|
292
|
-
_useColor: true
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
// 格式化表单配置,适合需要
|
|
296
|
-
formatFormItem (formItem) {
|
|
297
|
-
return {
|
|
298
|
-
...formItem,
|
|
299
|
-
inSearch: true,
|
|
300
|
-
|
|
301
|
-
_key: "fieldValue",
|
|
302
|
-
__realKey__: formItem._key,
|
|
303
|
-
_description: undefined,
|
|
304
|
-
_disabled: false,
|
|
305
|
-
_readonly: false,
|
|
306
|
-
_required: false,
|
|
307
|
-
_br: false,
|
|
308
|
-
_wrap: false,
|
|
309
|
-
_noLabel: false,
|
|
310
|
-
|
|
311
|
-
_multiple: true,
|
|
312
|
-
_enterType: undefined,
|
|
313
|
-
canEdit: true
|
|
314
|
-
};
|
|
315
|
-
},
|
|
316
|
-
// 处理operator为子集subSearch\subTableSearch,1.subTableSearch为flatTable类型,使用_subForm;2.subSearch为reference类型,请求form
|
|
317
|
-
dealSubSearch (conditionItem) {
|
|
318
|
-
if (conditionItem.fieldOperator === "subSearch") {
|
|
319
|
-
if (conditionItem.finished !== true) {
|
|
320
|
-
this.getModData(conditionItem.formItem, data => {
|
|
321
|
-
conditionItem.finished = true;
|
|
322
|
-
conditionItem.subFormList = (data.screens.find(screenItem =>
|
|
323
|
-
this.mode === "set"
|
|
324
|
-
? screenItem.screenType === "all"
|
|
325
|
-
: screenItem._key === conditionItem.formItem._screen
|
|
326
|
-
) || { form: [] }).form;
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
// 加载 reference数据
|
|
332
|
-
getModData (obj, cb) {
|
|
333
|
-
this.$https({
|
|
334
|
-
url: {
|
|
335
|
-
module: "sheet",
|
|
336
|
-
name: "schema" // 管理员下,不管传不传screenKey,且screenKey是不是全部视图,全部视图的form数据一定返回
|
|
337
|
-
},
|
|
338
|
-
params: {
|
|
339
|
-
_key: obj._ref,
|
|
340
|
-
screenKey: obj._screen
|
|
341
|
-
},
|
|
342
|
-
callback: data => {
|
|
343
|
-
cb(data);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
},
|
|
347
|
-
// 剔除conditions项里不要的属性
|
|
348
|
-
transformConditions (list = []) {
|
|
349
|
-
const loop = (list = []) => {
|
|
350
|
-
const conditionFields = [
|
|
351
|
-
"_id", "logic", "conditions", "textSearch", "nativeSearch",
|
|
352
|
-
"fieldKey", "fieldType", "fieldValue", "fieldOperator", "fieldSearch",
|
|
353
|
-
"parameterType", "fieldParams", "chainFieldKey"
|
|
354
|
-
];
|
|
355
|
-
|
|
356
|
-
return list.map(item =>
|
|
357
|
-
conditionFields.reduce((obj, key) => ({
|
|
358
|
-
...obj,
|
|
359
|
-
[key]: item[key]
|
|
360
|
-
? key === "fieldSearch"
|
|
361
|
-
? {
|
|
362
|
-
...item[key],
|
|
363
|
-
conditions: loop(item[key].conditions)
|
|
364
|
-
}
|
|
365
|
-
: key === "conditions"
|
|
366
|
-
? loop(item[key])
|
|
367
|
-
: item[key]
|
|
368
|
-
: item[key]
|
|
369
|
-
}), {})
|
|
370
|
-
);
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
return loop(list);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
};
|
|
1
|
+
import DshFormUnit from "../unit/DshFormUnit.vue";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
components: {
|
|
5
|
+
DshFormUnit
|
|
6
|
+
},
|
|
7
|
+
props: {
|
|
8
|
+
initFields: {
|
|
9
|
+
type: Array,
|
|
10
|
+
default () {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
value: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default () {
|
|
17
|
+
return {
|
|
18
|
+
logic: "and",
|
|
19
|
+
conditions: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
formList: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default () {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
useChainField: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
dynamicFormList: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default () {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
data () {
|
|
41
|
+
return {
|
|
42
|
+
fieldMap: this.$modFieldMap,
|
|
43
|
+
|
|
44
|
+
advSearchObj: {
|
|
45
|
+
logic: "and",
|
|
46
|
+
conditions: []
|
|
47
|
+
},
|
|
48
|
+
parameterPropsObj: {
|
|
49
|
+
_name: "参数类型",
|
|
50
|
+
_key: "parameterType",
|
|
51
|
+
_clearable: false,
|
|
52
|
+
_size: "small",
|
|
53
|
+
_default: "fixedText",
|
|
54
|
+
_data: [
|
|
55
|
+
{ _key: "fixedText", name: "固定文本" },
|
|
56
|
+
{ _key: "dynamicText", name: "动态文本" }
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
canSearchFormList () {
|
|
63
|
+
return this.formList.filter(formItem =>
|
|
64
|
+
this.$formHasAbility(formItem, "canSearch") &&
|
|
65
|
+
(this.mode === "set" ? true : formItem._displayType !== "hide")
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
dynamicFieldsMap () {
|
|
69
|
+
return this.$arrToCategoryArr(this.dynamicFormList);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
created () {
|
|
73
|
+
this.init();
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
// 初始化
|
|
77
|
+
init () {
|
|
78
|
+
this.advSearchObj = this.$deepCopy(this.value);
|
|
79
|
+
this.advSearchObj.conditions = [...this.initFields, ...this.advSearchObj.conditions].map(conditionItem => {
|
|
80
|
+
const newConditionItem = typeof conditionItem === "string"
|
|
81
|
+
? this.createContionFunc(undefined, undefined, conditionItem)
|
|
82
|
+
: this.createContionFunc(conditionItem, undefined, conditionItem.fieldKey);
|
|
83
|
+
this.dealSubSearch(newConditionItem);
|
|
84
|
+
|
|
85
|
+
return newConditionItem;
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// 新增条件项
|
|
90
|
+
createCondition (operationItem, isLoop, formItem, list) {
|
|
91
|
+
const newConditionItem = this.createContionFunc({ logic: isLoop ? "and" : "field" }, formItem);
|
|
92
|
+
this.dealSubSearch(newConditionItem);
|
|
93
|
+
list.push(newConditionItem);
|
|
94
|
+
|
|
95
|
+
this.change(operationItem.type, newConditionItem);
|
|
96
|
+
},
|
|
97
|
+
// 删除条件项
|
|
98
|
+
deleteCondition (operationItem, conditionItem, conditionIndex, list) {
|
|
99
|
+
list.splice(conditionIndex, 1);
|
|
100
|
+
|
|
101
|
+
this.change(operationItem.type, conditionItem);
|
|
102
|
+
},
|
|
103
|
+
// 获取动态文本或固定文本类型 选项列表
|
|
104
|
+
getParameterData (conditionItem) {
|
|
105
|
+
// 配置端 且 含有子集的
|
|
106
|
+
return !!conditionItem.dynamicList.length && conditionItem.operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key))
|
|
107
|
+
? []
|
|
108
|
+
: this.parameterPropsObj._data;
|
|
109
|
+
},
|
|
110
|
+
// 选择某控件的动态文本或固定文本类型
|
|
111
|
+
changeParameterType (operationItem, conditionItem, conditionIndex, list, optionItem) {
|
|
112
|
+
conditionItem.parameterType = optionItem._key;
|
|
113
|
+
conditionItem.parameterTypeName = optionItem.name;
|
|
114
|
+
conditionItem.fieldParams = [];
|
|
115
|
+
conditionItem.chainFieldKey = "";
|
|
116
|
+
conditionItem.fieldValue = [];
|
|
117
|
+
|
|
118
|
+
this.change(operationItem.type, conditionItem);
|
|
119
|
+
},
|
|
120
|
+
// 选择某控件的操作类型
|
|
121
|
+
changeOperator (operationItem, conditionItem, conditionIndex, list, optionItem) {
|
|
122
|
+
if (optionItem._key !== conditionItem.fieldOperator) {
|
|
123
|
+
conditionItem.fieldOperator = optionItem._key;
|
|
124
|
+
conditionItem.fieldOperatorName = optionItem.name;
|
|
125
|
+
|
|
126
|
+
if (["isnull", "notnull", "nosize", "size", "nolist", "list"].includes(conditionItem.fieldOperator)) {
|
|
127
|
+
conditionItem.fieldParams = [];
|
|
128
|
+
conditionItem.chainFieldKey = "";
|
|
129
|
+
conditionItem.fieldValue = [];
|
|
130
|
+
conditionItem.fieldSearch = {
|
|
131
|
+
logic: "and",
|
|
132
|
+
conditions: []
|
|
133
|
+
};
|
|
134
|
+
} else if (["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(conditionItem.fieldOperator)) {
|
|
135
|
+
conditionItem.fieldParams = [];
|
|
136
|
+
conditionItem.chainFieldKey = "";
|
|
137
|
+
conditionItem.fieldValue = [];
|
|
138
|
+
this.dealSubSearch(conditionItem);
|
|
139
|
+
} else {
|
|
140
|
+
conditionItem.fieldSearch = {
|
|
141
|
+
logic: "and",
|
|
142
|
+
conditions: []
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this.change(operationItem.type, conditionItem);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// 发生改动
|
|
150
|
+
change (operationType, conditionItem, ...params) {
|
|
151
|
+
if (operationType === "loopSearch") {
|
|
152
|
+
const subAdvSearchObj = params[0];
|
|
153
|
+
Object.assign(conditionItem, subAdvSearchObj);
|
|
154
|
+
} else if (operationType === "subSearch") {
|
|
155
|
+
const subAdvSearchObj = params[0];
|
|
156
|
+
Object.assign(conditionItem.fieldSearch, subAdvSearchObj);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const advSearchObj = {
|
|
160
|
+
...this.advSearchObj,
|
|
161
|
+
conditions: this.transformConditions(this.advSearchObj.conditions)
|
|
162
|
+
};
|
|
163
|
+
this.$emit("change", advSearchObj, operationType, conditionItem);
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
/* -------- 方法 ----------- */
|
|
167
|
+
// 生成条件项的值
|
|
168
|
+
createContionFunc (initContion = { logic: "field" }, curFormItem, fieldKey) {
|
|
169
|
+
if (["field", undefined].includes(initContion.logic)) {
|
|
170
|
+
curFormItem = curFormItem || this.canSearchFormList.find(formItem => formItem._key === fieldKey);
|
|
171
|
+
|
|
172
|
+
if (curFormItem) {
|
|
173
|
+
const fieldType = curFormItem._type;
|
|
174
|
+
fieldKey = curFormItem._key;
|
|
175
|
+
const fieldData = this.fieldMap[fieldType];
|
|
176
|
+
|
|
177
|
+
const dynamicTypes = this.useChainField
|
|
178
|
+
? [...new Set([...(fieldData.categoryTypes || []), fieldType])]
|
|
179
|
+
: [fieldType];
|
|
180
|
+
let dynamicList = dynamicTypes.reduce((list, type) => list.concat(this.dynamicFieldsMap[type] || []), []);
|
|
181
|
+
dynamicList = this.useChainField
|
|
182
|
+
? ["select", "checkbox", "cascader", "cascaders"].includes(fieldType)
|
|
183
|
+
? dynamicList.filter(dynamicItem => dynamicItem._resourceKey === curFormItem._resourceKey)
|
|
184
|
+
: ["reference"].includes(fieldType) && !!curFormItem._ref
|
|
185
|
+
? dynamicList.filter(dynamicItem => dynamicItem._ref === curFormItem._ref)
|
|
186
|
+
: dynamicList
|
|
187
|
+
: dynamicList;
|
|
188
|
+
|
|
189
|
+
const operators = (
|
|
190
|
+
["_id"].includes(fieldKey)
|
|
191
|
+
? []
|
|
192
|
+
: ["cascaderTable"].includes(fieldType)
|
|
193
|
+
? curFormItem._subType === "old"
|
|
194
|
+
? fieldData.operators.filter(operator => !["treeTableSearch"].includes(operator._key))
|
|
195
|
+
: fieldData.operators.filter(operator => !["cascaderTableSearch"].includes(operator._key))
|
|
196
|
+
// 单条关联类型 -配置端:无动态字段的地方过滤掉“是”和“不是”筛选条件,有动态字段的地方用的全部条件;用户端:用的全部条件,
|
|
197
|
+
: ["reference"].includes(fieldType)
|
|
198
|
+
? this.mode === "set" && !dynamicList.length
|
|
199
|
+
? fieldData.operators.filter(operator => !["eq", "ne"].includes(operator._key))
|
|
200
|
+
: fieldData.operators
|
|
201
|
+
: fieldData.operators
|
|
202
|
+
) || [];
|
|
203
|
+
|
|
204
|
+
const fieldOperator = initContion.fieldOperator || (
|
|
205
|
+
["_id"].includes(fieldKey)
|
|
206
|
+
? "eq"
|
|
207
|
+
: ["reference"].includes(fieldType) && this.isSimpleSearch
|
|
208
|
+
? "eq"
|
|
209
|
+
: (operators[0] || {})._key
|
|
210
|
+
);
|
|
211
|
+
const fieldOperatorName = (operators.find(operatorItem => operatorItem._key === fieldOperator) || { name: `${fieldOperator}不存在` }).name;
|
|
212
|
+
|
|
213
|
+
const parameterType = initContion.parameterType || (
|
|
214
|
+
(
|
|
215
|
+
(initContion.fieldParams || []).length ||
|
|
216
|
+
initContion.chainFieldKey ||
|
|
217
|
+
(!!dynamicList.length && operators.some(operator => ["subSearch", "subTableSearch", "cascaderTableSearch", "treeTableSearch"].includes(operator._key)))
|
|
218
|
+
) ? "dynamicText" : "fixedText"
|
|
219
|
+
);
|
|
220
|
+
const parameterTypeName = (this.parameterPropsObj._data.find(parameterTypeItem => parameterTypeItem._key === parameterType) || { name: `${parameterType}不存在` }).name;
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
_id: this.$ObjectID().str,
|
|
224
|
+
logic: "field",
|
|
225
|
+
fieldKey,
|
|
226
|
+
fieldType,
|
|
227
|
+
fieldOperator,
|
|
228
|
+
fieldValue: [],
|
|
229
|
+
fieldSearch: {
|
|
230
|
+
logic: "and",
|
|
231
|
+
conditions: []
|
|
232
|
+
},
|
|
233
|
+
parameterType,
|
|
234
|
+
fieldParams: [],
|
|
235
|
+
chainFieldKey: "",
|
|
236
|
+
...initContion,
|
|
237
|
+
|
|
238
|
+
// 下面的是前端所用
|
|
239
|
+
dynamicList: dynamicList,
|
|
240
|
+
parameterTypeName: parameterTypeName,
|
|
241
|
+
operators,
|
|
242
|
+
fieldOperatorName: fieldOperatorName,
|
|
243
|
+
formItem: this.getFormItem(curFormItem),
|
|
244
|
+
subFormList: curFormItem._subForm || [],
|
|
245
|
+
finished: !operators.some(operator => ["subSearch"].includes(operator._key)) // 子集条件的 请求form数据 是否完成状态
|
|
246
|
+
};
|
|
247
|
+
} else {
|
|
248
|
+
return {
|
|
249
|
+
_id: this.$ObjectID().str,
|
|
250
|
+
...initContion,
|
|
251
|
+
__isDelete__: true, // 前端用它标识对应字段已被删除的条件项
|
|
252
|
+
formItem: {
|
|
253
|
+
__realKey__: initContion.fieldKey
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
} else if (["and", "or"].includes(initContion.logic)) {
|
|
258
|
+
return {
|
|
259
|
+
_id: this.$ObjectID().str,
|
|
260
|
+
logic: "and",
|
|
261
|
+
conditions: [],
|
|
262
|
+
...initContion
|
|
263
|
+
};
|
|
264
|
+
} else if (["text"].includes(initContion.logic)) {
|
|
265
|
+
return {
|
|
266
|
+
_id: this.$ObjectID().str,
|
|
267
|
+
logic: "text",
|
|
268
|
+
textSearch: "",
|
|
269
|
+
...initContion
|
|
270
|
+
};
|
|
271
|
+
} else if (["native"].includes(initContion.logic)) {
|
|
272
|
+
return {
|
|
273
|
+
_id: this.$ObjectID().str,
|
|
274
|
+
logic: "native",
|
|
275
|
+
nativeSearch: {},
|
|
276
|
+
...initContion
|
|
277
|
+
};
|
|
278
|
+
} else {
|
|
279
|
+
return {
|
|
280
|
+
_id: this.$ObjectID().str,
|
|
281
|
+
...initContion
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
// 获取表单配置
|
|
286
|
+
getFormItem (formItem) {
|
|
287
|
+
return {
|
|
288
|
+
...this.formatFormItem(formItem),
|
|
289
|
+
|
|
290
|
+
_line: false,
|
|
291
|
+
_span: 24,
|
|
292
|
+
_useColor: true
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
// 格式化表单配置,适合需要
|
|
296
|
+
formatFormItem (formItem) {
|
|
297
|
+
return {
|
|
298
|
+
...formItem,
|
|
299
|
+
inSearch: true,
|
|
300
|
+
|
|
301
|
+
_key: "fieldValue",
|
|
302
|
+
__realKey__: formItem._key,
|
|
303
|
+
_description: undefined,
|
|
304
|
+
_disabled: false,
|
|
305
|
+
_readonly: false,
|
|
306
|
+
_required: false,
|
|
307
|
+
_br: false,
|
|
308
|
+
_wrap: false,
|
|
309
|
+
_noLabel: false,
|
|
310
|
+
|
|
311
|
+
_multiple: true,
|
|
312
|
+
_enterType: undefined,
|
|
313
|
+
canEdit: true
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
// 处理operator为子集subSearch\subTableSearch,1.subTableSearch为flatTable类型,使用_subForm;2.subSearch为reference类型,请求form
|
|
317
|
+
dealSubSearch (conditionItem) {
|
|
318
|
+
if (conditionItem.fieldOperator === "subSearch") {
|
|
319
|
+
if (conditionItem.finished !== true) {
|
|
320
|
+
this.getModData(conditionItem.formItem, data => {
|
|
321
|
+
conditionItem.finished = true;
|
|
322
|
+
conditionItem.subFormList = (data.screens.find(screenItem =>
|
|
323
|
+
this.mode === "set"
|
|
324
|
+
? screenItem.screenType === "all"
|
|
325
|
+
: screenItem._key === conditionItem.formItem._screen
|
|
326
|
+
) || { form: [] }).form;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
// 加载 reference数据
|
|
332
|
+
getModData (obj, cb) {
|
|
333
|
+
this.$https({
|
|
334
|
+
url: {
|
|
335
|
+
module: "sheet",
|
|
336
|
+
name: "schema" // 管理员下,不管传不传screenKey,且screenKey是不是全部视图,全部视图的form数据一定返回
|
|
337
|
+
},
|
|
338
|
+
params: {
|
|
339
|
+
_key: obj._ref,
|
|
340
|
+
screenKey: obj._screen
|
|
341
|
+
},
|
|
342
|
+
callback: data => {
|
|
343
|
+
cb(data);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
},
|
|
347
|
+
// 剔除conditions项里不要的属性
|
|
348
|
+
transformConditions (list = []) {
|
|
349
|
+
const loop = (list = []) => {
|
|
350
|
+
const conditionFields = [
|
|
351
|
+
"_id", "logic", "conditions", "textSearch", "nativeSearch",
|
|
352
|
+
"fieldKey", "fieldType", "fieldValue", "fieldOperator", "fieldSearch",
|
|
353
|
+
"parameterType", "fieldParams", "chainFieldKey"
|
|
354
|
+
];
|
|
355
|
+
|
|
356
|
+
return list.map(item =>
|
|
357
|
+
conditionFields.reduce((obj, key) => ({
|
|
358
|
+
...obj,
|
|
359
|
+
[key]: item[key]
|
|
360
|
+
? key === "fieldSearch"
|
|
361
|
+
? {
|
|
362
|
+
...item[key],
|
|
363
|
+
conditions: loop(item[key].conditions)
|
|
364
|
+
}
|
|
365
|
+
: key === "conditions"
|
|
366
|
+
? loop(item[key])
|
|
367
|
+
: item[key]
|
|
368
|
+
: item[key]
|
|
369
|
+
}), {})
|
|
370
|
+
);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
return loop(list);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|