xianniu-ui 0.3.22 → 0.3.24
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/lib/xianniu-ui.common.js +97 -59
- package/lib/xianniu-ui.umd.js +97 -59
- package/lib/xianniu-ui.umd.min.js +3 -3
- package/package.json +1 -1
- package/packages/search/main.vue +36 -25
package/package.json
CHANGED
package/packages/search/main.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="xn-search">
|
|
3
3
|
<el-form ref="form" inline :model="form" :label-width="labelWidth">
|
|
4
4
|
<el-row :gutter="0" class="xn-search--row">
|
|
5
|
-
<template v-for="(item, idx) in
|
|
5
|
+
<template v-for="(item, idx) in form.value">
|
|
6
6
|
<el-col v-bind="{ ...col }" :key="idx" v-show="item.isShow || isColl">
|
|
7
7
|
<el-form-item
|
|
8
8
|
v-if="item.type === 'city'"
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
class="xn-search--row_col"
|
|
13
13
|
>
|
|
14
14
|
<xn-city
|
|
15
|
+
:key="item.prop"
|
|
15
16
|
:data-level="(item.options && item.options.dataLevel) || 2"
|
|
16
|
-
v-model="
|
|
17
|
+
v-model="item.modelVal"
|
|
17
18
|
@on-city="handleChangeCity"
|
|
18
19
|
/>
|
|
19
20
|
</el-form-item>
|
|
@@ -25,9 +26,10 @@
|
|
|
25
26
|
class="xn-search--row_col"
|
|
26
27
|
>
|
|
27
28
|
<el-input
|
|
29
|
+
:key="item.prop"
|
|
28
30
|
style="width: 100%"
|
|
29
31
|
v-bind="item.options ? { ...item.options } : {}"
|
|
30
|
-
v-model="
|
|
32
|
+
v-model="item.modelVal"
|
|
31
33
|
:clearable="item.clearable || true"
|
|
32
34
|
:placeholder="item.placeholder || '请填写' + item.label"
|
|
33
35
|
/>
|
|
@@ -40,8 +42,9 @@
|
|
|
40
42
|
class="xn-search--row_col"
|
|
41
43
|
>
|
|
42
44
|
<el-select
|
|
45
|
+
:key="item.prop"
|
|
43
46
|
style="width: 100%"
|
|
44
|
-
v-model="
|
|
47
|
+
v-model="item.modelVal"
|
|
45
48
|
:placeholder="item.placeholder || '请选择' + item.label"
|
|
46
49
|
:clearable="item.clearable || true"
|
|
47
50
|
filterable
|
|
@@ -71,7 +74,8 @@
|
|
|
71
74
|
class="xn-search--row_col"
|
|
72
75
|
>
|
|
73
76
|
<xn-date
|
|
74
|
-
|
|
77
|
+
:key="item.prop"
|
|
78
|
+
v-model="item.modelVal"
|
|
75
79
|
:mode="item.mode || 'range'"
|
|
76
80
|
:type="item.type || 'daterange'"
|
|
77
81
|
:is-shortcut="showShortcut(item)"
|
|
@@ -154,9 +158,6 @@ export default {
|
|
|
154
158
|
return val && typeof val === "function";
|
|
155
159
|
};
|
|
156
160
|
},
|
|
157
|
-
_formData() {
|
|
158
|
-
return this.formData;
|
|
159
|
-
},
|
|
160
161
|
toggle() {
|
|
161
162
|
return this.isColl ? "el-icon-arrow-up" : "el-icon-arrow-down";
|
|
162
163
|
},
|
|
@@ -203,20 +204,34 @@ export default {
|
|
|
203
204
|
};
|
|
204
205
|
},
|
|
205
206
|
created() {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
207
|
+
// this.init();
|
|
208
|
+
},
|
|
209
|
+
watch: {
|
|
210
|
+
formData: {
|
|
211
|
+
handler(n) {
|
|
212
|
+
n && n.length && this.init();
|
|
213
|
+
},
|
|
214
|
+
immediate: true,
|
|
215
|
+
deep: true,
|
|
216
|
+
},
|
|
214
217
|
},
|
|
215
218
|
methods: {
|
|
219
|
+
init() {
|
|
220
|
+
this.form.value = [];
|
|
221
|
+
for (let i = 0, formData = this.formData; i < formData.length; i++) {
|
|
222
|
+
const item = formData[i];
|
|
223
|
+
item.isShow = i > 3 && this.showColl ? false : true;
|
|
224
|
+
this.form.value.push({
|
|
225
|
+
...item,
|
|
226
|
+
key: item.prop,
|
|
227
|
+
modelVal: "",
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
},
|
|
216
231
|
onSearch() {
|
|
217
232
|
const formValue = {};
|
|
218
|
-
if (this.
|
|
219
|
-
for (let i = 0, formData = this.
|
|
233
|
+
if (this.form.value) {
|
|
234
|
+
for (let i = 0, formData = this.form.value; i < formData.length; i++) {
|
|
220
235
|
const item = formData[i];
|
|
221
236
|
const index = i;
|
|
222
237
|
const key = item.prop;
|
|
@@ -239,13 +254,9 @@ export default {
|
|
|
239
254
|
this.$emit("on-search", formValue);
|
|
240
255
|
},
|
|
241
256
|
onReset() {
|
|
242
|
-
this.form.value
|
|
243
|
-
for (let i = 0, formData = this.formData; i < formData.length; i++) {
|
|
257
|
+
for (let i = 0, formData = this.form.value; i < formData.length; i++) {
|
|
244
258
|
const item = formData[i];
|
|
245
|
-
|
|
246
|
-
key: item.prop,
|
|
247
|
-
modelVal: "",
|
|
248
|
-
});
|
|
259
|
+
item.modelVal = "";
|
|
249
260
|
}
|
|
250
261
|
this.$emit("on-reset");
|
|
251
262
|
this.$emit("on-search", {});
|
|
@@ -261,7 +272,7 @@ export default {
|
|
|
261
272
|
},
|
|
262
273
|
setData(key, data) {
|
|
263
274
|
const row =
|
|
264
|
-
this.
|
|
275
|
+
this.form.value && this.form.value.find((item) => item.label === key);
|
|
265
276
|
this.$set(row, "data", data);
|
|
266
277
|
},
|
|
267
278
|
},
|