meixioacomponent 0.2.16 → 0.2.17
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/meixioacomponent.common.js +205 -84
- package/lib/meixioacomponent.umd.js +205 -84
- package/lib/meixioacomponent.umd.min.js +16 -16
- package/package.json +1 -1
- package/packages/components/proForm/proForm/pro_form-item_skeleton.vue +38 -0
- package/packages/components/proForm/proForm/pro_form.vue +58 -23
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-item-skeleton-wrap">
|
|
3
|
+
<div class="skeleton-left">
|
|
4
|
+
<base-skeleton :shape="`rect`" :lines="[1]"> </base-skeleton>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="skeleton-right">
|
|
7
|
+
<base-skeleton :shape="`rect`" :lines="[4, 7]"> </base-skeleton>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
data() {
|
|
15
|
+
return {};
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<style lang="less" scoped>
|
|
21
|
+
.form-item-skeleton-wrap {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
flex-flow: row nowrap;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
.skeleton-left {
|
|
29
|
+
width: 30%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
margin-right: var(--margin-5);
|
|
32
|
+
}
|
|
33
|
+
.skeleton-right {
|
|
34
|
+
height: 60px;
|
|
35
|
+
width: calc(70% - 10px);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="pro_form_content" ref="proFormWrap">
|
|
3
3
|
<el-form
|
|
4
|
+
v-if="!loading"
|
|
4
5
|
ref="form"
|
|
5
6
|
:rules="rules"
|
|
6
7
|
:model="formdata"
|
|
@@ -27,17 +28,20 @@
|
|
|
27
28
|
:class="[`form-item-${citem.key}`]"
|
|
28
29
|
v-if="formType == 'default' && citem.type != 'area'"
|
|
29
30
|
@formItemConfirm="formItemConfirm"
|
|
30
|
-
|
|
31
|
+
@proFormItemChange="
|
|
32
|
+
proFormItemChange($event, findFormItem(index, cindex))
|
|
33
|
+
"
|
|
34
|
+
v-model="formList[findFormItem(index, cindex)].value"
|
|
31
35
|
>
|
|
32
36
|
<template slot="template" v-if="citem.type == 'template'">
|
|
33
|
-
<slot :name="`form-${citem.key}`" :scope="
|
|
37
|
+
<slot :name="`form-${citem.key}`" :scope="formList"></slot>
|
|
34
38
|
</template>
|
|
35
39
|
</pro_form_itemVue>
|
|
36
40
|
<baseAreaVue
|
|
37
41
|
:disable="citem.disabled"
|
|
38
42
|
v-if="citem.type == 'area'"
|
|
39
43
|
:ref="`area-${citem.key}`"
|
|
40
|
-
v-model="
|
|
44
|
+
v-model="formList[findFormItem(index, cindex)].value"
|
|
41
45
|
:class="[`form-item-${citem.key}`]"
|
|
42
46
|
@confirmAreaValue="
|
|
43
47
|
formItemConfirm({
|
|
@@ -48,7 +52,7 @@
|
|
|
48
52
|
<baseUploadVue
|
|
49
53
|
:max="formConfig.max"
|
|
50
54
|
v-if="formType == `upload`"
|
|
51
|
-
v-model="
|
|
55
|
+
v-model="formList[findFormItem(index, cindex)].value"
|
|
52
56
|
:class="[`form-item-${citem.key}`]"
|
|
53
57
|
></baseUploadVue>
|
|
54
58
|
</el-form-item>
|
|
@@ -62,6 +66,23 @@
|
|
|
62
66
|
:config="handleConfig"
|
|
63
67
|
></baseButtonHandleVue>
|
|
64
68
|
</el-form>
|
|
69
|
+
|
|
70
|
+
<div class="form-skeleton-wrap" v-else>
|
|
71
|
+
<div
|
|
72
|
+
:key="index"
|
|
73
|
+
class="form-line-box"
|
|
74
|
+
v-for="(item, index) in formLineList"
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
class="form-skeleton-item-wrap"
|
|
78
|
+
:key="cindex"
|
|
79
|
+
v-for="(citem, cindex) in item"
|
|
80
|
+
:class="[`chunk-${chunkLength}`, `${flexClass}`, size]"
|
|
81
|
+
>
|
|
82
|
+
<pro_formItem_skeletonVue></pro_formItem_skeletonVue>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
65
86
|
</div>
|
|
66
87
|
</template>
|
|
67
88
|
|
|
@@ -69,6 +90,7 @@
|
|
|
69
90
|
import pro_form_itemVue from "./pro_form_item.vue";
|
|
70
91
|
import baseAreaVue from "../../base/baseArea/baseArea.vue";
|
|
71
92
|
import baseUploadVue from "../../base/baseUpload/baseUpload.vue";
|
|
93
|
+
import pro_formItem_skeletonVue from "./pro_form-item_skeleton.vue";
|
|
72
94
|
import baseButtonHandleVue from "../../base/baseButtonHandle/baseButtonHandle.vue";
|
|
73
95
|
//
|
|
74
96
|
import { ArrayChunk } from "../../../utils/utils";
|
|
@@ -76,20 +98,17 @@ export default {
|
|
|
76
98
|
name: "baseForm",
|
|
77
99
|
data() {
|
|
78
100
|
return {
|
|
79
|
-
formdata: {},
|
|
80
101
|
handleConfig: [],
|
|
81
|
-
formLineList: [],
|
|
82
102
|
chunkLength: null,
|
|
103
|
+
loading: true,
|
|
83
104
|
};
|
|
84
105
|
},
|
|
85
|
-
created() {
|
|
106
|
+
created() {},
|
|
107
|
+
mounted() {
|
|
86
108
|
this.$nextTick(() => {
|
|
87
109
|
this.init();
|
|
88
|
-
this.setFormData();
|
|
89
|
-
this.setFormLineList();
|
|
90
110
|
});
|
|
91
111
|
},
|
|
92
|
-
mounted() {},
|
|
93
112
|
props: {
|
|
94
113
|
rules: {
|
|
95
114
|
type: Object,
|
|
@@ -143,6 +162,7 @@ export default {
|
|
|
143
162
|
baseUploadVue,
|
|
144
163
|
pro_form_itemVue,
|
|
145
164
|
baseButtonHandleVue,
|
|
165
|
+
pro_formItem_skeletonVue,
|
|
146
166
|
},
|
|
147
167
|
computed: {
|
|
148
168
|
flexClass() {
|
|
@@ -153,6 +173,18 @@ export default {
|
|
|
153
173
|
return "flex-row";
|
|
154
174
|
}
|
|
155
175
|
},
|
|
176
|
+
|
|
177
|
+
formdata() {
|
|
178
|
+
let obj = {};
|
|
179
|
+
this.$props.formList.forEach((item) => {
|
|
180
|
+
obj[`${item.key}`] = item.value;
|
|
181
|
+
});
|
|
182
|
+
return obj;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
formLineList() {
|
|
186
|
+
return ArrayChunk(this.$props.formList, this.chunkLength);
|
|
187
|
+
},
|
|
156
188
|
},
|
|
157
189
|
methods: {
|
|
158
190
|
init() {
|
|
@@ -176,7 +208,9 @@ export default {
|
|
|
176
208
|
},
|
|
177
209
|
];
|
|
178
210
|
}
|
|
179
|
-
|
|
211
|
+
this.setChunkLength();
|
|
212
|
+
},
|
|
213
|
+
setChunkLength() {
|
|
180
214
|
if (this.$props.rowNumber) {
|
|
181
215
|
this.chunkLength = this.$props.rowNumber;
|
|
182
216
|
return;
|
|
@@ -221,6 +255,8 @@ export default {
|
|
|
221
255
|
let confrim = true;
|
|
222
256
|
const rulesItem = this.$props.rules[params.config.key];
|
|
223
257
|
if (rulesItem) {
|
|
258
|
+
console.log(rulesItem);
|
|
259
|
+
console.log(this.$refs.form);
|
|
224
260
|
this.$refs.form.validateField(
|
|
225
261
|
[`${params.config.key}`],
|
|
226
262
|
(errorMsg) => {
|
|
@@ -236,15 +272,7 @@ export default {
|
|
|
236
272
|
return true;
|
|
237
273
|
}
|
|
238
274
|
},
|
|
239
|
-
|
|
240
|
-
this.formdata = {};
|
|
241
|
-
this.$props.formList.forEach((item) => {
|
|
242
|
-
this.$set(this.formdata, `${item.key}`, item.value);
|
|
243
|
-
});
|
|
244
|
-
},
|
|
245
|
-
setFormLineList() {
|
|
246
|
-
this.formLineList = ArrayChunk(this.$props.formList, this.chunkLength);
|
|
247
|
-
},
|
|
275
|
+
|
|
248
276
|
// 返回form表单值
|
|
249
277
|
returnFormValue() {
|
|
250
278
|
return this.formdata;
|
|
@@ -295,11 +323,18 @@ export default {
|
|
|
295
323
|
onCancel() {
|
|
296
324
|
this.$emit("onCancel");
|
|
297
325
|
},
|
|
326
|
+
|
|
327
|
+
findFormItem(index, cindex) {
|
|
328
|
+
return index * this.chunkLength + cindex;
|
|
329
|
+
},
|
|
298
330
|
},
|
|
299
331
|
watch: {
|
|
300
|
-
|
|
301
|
-
this.
|
|
302
|
-
|
|
332
|
+
chunkLength(newVal, oldVal) {
|
|
333
|
+
if (this.loading) {
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
this.loading = false;
|
|
336
|
+
}, 1500);
|
|
337
|
+
}
|
|
303
338
|
},
|
|
304
339
|
},
|
|
305
340
|
};
|