meixioacomponent 0.2.16 → 0.2.19

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": "meixioacomponent",
3
- "version": "0.2.16",
3
+ "version": "0.2.19",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -16,7 +16,6 @@
16
16
  "dayjs": "^1.11.3",
17
17
  "element-ui": "^2.15.6",
18
18
  "gulp": "^4.0.0",
19
- "js-md5": "^0.7.3",
20
19
  "register-service-worker": "^1.7.1",
21
20
  "vue": "^2.6.11",
22
21
  "vue-router": "^3.2.0",
@@ -29,6 +28,7 @@
29
28
  "@vue/cli-plugin-router": "~4.5.13",
30
29
  "@vue/cli-plugin-vuex": "~4.5.13",
31
30
  "@vue/cli-service": "~4.5.13",
31
+ "babel-plugin-component": "^1.1.1",
32
32
  "less": "^3.0.4",
33
33
  "less-loader": "^5.0.0",
34
34
  "vue-template-compiler": "^2.6.11"
@@ -92,7 +92,6 @@
92
92
  </template>
93
93
 
94
94
  <script>
95
- import { json } from "body-parser";
96
95
  import baseButtonHandleVue from "../baseButtonHandle/baseButtonHandle.vue";
97
96
  //
98
97
  import areaJson from "./area";
@@ -190,9 +189,7 @@ export default {
190
189
  },
191
190
  methods: {
192
191
  init() {
193
- //console.log("start");
194
192
  if (this.module && this.module instanceof Object) {
195
- //console.log("end");
196
193
  for (let i = 0; i < areaConfig.length; i++) {
197
194
  let item = areaConfig[i];
198
195
  let value = this.module[`${item.value}`];
@@ -377,6 +374,17 @@ export default {
377
374
  }
378
375
  },
379
376
  },
377
+ watch: {
378
+ module(newVal, oldVal) {
379
+ if (!newVal) {
380
+ this.areaValue=[];
381
+ return;
382
+ }
383
+ if (this.$parent.$options._componentTag == "el-form-item") {
384
+ this.init();
385
+ }
386
+ },
387
+ },
380
388
  };
381
389
  </script>
382
390
 
@@ -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
- v-model="formdata[`${citem.key}`]"
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="formdata"></slot>
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="formdata[`${citem.key}`]"
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="formdata[`${citem.key}`]"
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
- setFormData() {
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
- formList(newVal, oldVal) {
301
- this.setFormData();
302
- this.setFormLineList();
332
+ chunkLength(newVal, oldVal) {
333
+ if (this.loading) {
334
+ setTimeout(() => {
335
+ this.loading = false;
336
+ }, 1500);
337
+ }
303
338
  },
304
339
  },
305
340
  };
@@ -1,4 +1,5 @@
1
1
  import Vue from "vue";
2
+ import { useElementComponent } from "./useElement";
2
3
  import selectStore from "./storeModule/selectStore";
3
4
  const componentConfig = {
4
5
  store: null,
@@ -12,6 +13,8 @@ const componentConfig = {
12
13
  },
13
14
 
14
15
  initConfig: (_store, _router) => {
16
+ // 注册element 组件
17
+ useElementComponent();
15
18
  // 动态注册vuex modules
16
19
  _store.registerModule("selectStore", selectStore);
17
20
  // 注册vuex里面selectStore管理类
@@ -0,0 +1,122 @@
1
+ import Vue from "vue";
2
+ import {
3
+ Pagination,
4
+ Dialog,
5
+ Autocomplete,
6
+ Dropdown,
7
+ DropdownMenu,
8
+ DropdownItem,
9
+ Menu,
10
+ Submenu,
11
+ MenuItem,
12
+ MenuItemGroup,
13
+ Input,
14
+ InputNumber,
15
+ Radio,
16
+ RadioGroup,
17
+ RadioButton,
18
+ Checkbox,
19
+ CheckboxButton,
20
+ CheckboxGroup,
21
+ Switch,
22
+ Select,
23
+ Option,
24
+ OptionGroup,
25
+ Button,
26
+ Table,
27
+ TableColumn,
28
+ DatePicker,
29
+ TimeSelect,
30
+ TimePicker,
31
+ Popover,
32
+ Tooltip,
33
+ Breadcrumb,
34
+ BreadcrumbItem,
35
+ Form,
36
+ FormItem,
37
+ Tabs,
38
+ TabPane,
39
+ Tag,
40
+ Tree,
41
+ Alert,
42
+ Slider,
43
+ Spinner,
44
+ Badge,
45
+ Steps,
46
+ Step,
47
+ Cascader,
48
+ ColorPicker,
49
+ Transfer,
50
+ Calendar,
51
+ CascaderPanel,
52
+ Loading,
53
+ MessageBox,
54
+ Message,
55
+ Card,
56
+ Drawer,
57
+ } from "element-ui";
58
+
59
+ export const useElementComponent = () => {
60
+ let elementComponentList = [
61
+ Pagination,
62
+ Dialog,
63
+ Autocomplete,
64
+ Dropdown,
65
+ DropdownMenu,
66
+ DropdownItem,
67
+ Menu,
68
+ Submenu,
69
+ MenuItem,
70
+ MenuItemGroup,
71
+ Input,
72
+ InputNumber,
73
+ Radio,
74
+ RadioGroup,
75
+ RadioButton,
76
+ Checkbox,
77
+ CheckboxButton,
78
+ CheckboxGroup,
79
+ Switch,
80
+ Select,
81
+ Option,
82
+ OptionGroup,
83
+ Button,
84
+ Table,
85
+ TableColumn,
86
+ DatePicker,
87
+ TimeSelect,
88
+ TimePicker,
89
+ Popover,
90
+ Tooltip,
91
+ Breadcrumb,
92
+ BreadcrumbItem,
93
+ Form,
94
+ FormItem,
95
+ Tabs,
96
+ TabPane,
97
+ Tag,
98
+ Tree,
99
+ Alert,
100
+ Slider,
101
+ Spinner,
102
+ Badge,
103
+ Steps,
104
+ Step,
105
+ Cascader,
106
+ ColorPicker,
107
+ Transfer,
108
+ Calendar,
109
+ CascaderPanel,
110
+ Loading,
111
+ Card,
112
+ Drawer,
113
+ ];
114
+ elementComponentList.forEach((item) => {
115
+ Vue.use(item);
116
+ });
117
+ // 解决刷新自动调用这两个组件
118
+ Vue.prototype.$message = Message;
119
+ Vue.prototype.$messagebox = MessageBox;
120
+ // 通过函数调用messageBox的confirm方法
121
+ Vue.prototype.$confirm = MessageBox.confirm;
122
+ };