meixioacomponent 0.2.8 → 0.2.11

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.08",
3
+ "version": "0.2.11",
4
4
  "private": false,
5
5
  "author": "YuRi",
6
6
  "main": "lib/meixioacomponent.umd.min.js",
@@ -22,7 +22,7 @@
22
22
  :event="true"
23
23
  @iconClick="backArea"
24
24
  v-show="activeIndex > 1"
25
- :name="`icon-icon-arrow-left`"
25
+ :name="`meixicomponenticon-icon-arrow-left`"
26
26
  ></base-icon>
27
27
  </div>
28
28
  </div>
@@ -92,6 +92,7 @@
92
92
  </template>
93
93
 
94
94
  <script>
95
+ import { json } from "body-parser";
95
96
  import baseButtonHandleVue from "../baseButtonHandle/baseButtonHandle.vue";
96
97
  //
97
98
  import areaJson from "./area";
@@ -116,23 +117,6 @@ export default {
116
117
  },
117
118
  created() {
118
119
  this.init();
119
- this.handleConfig = [
120
- {
121
- type: "info",
122
- text: this.module ? "取消" : "清空",
123
- plain: false,
124
- click: () => {
125
- this.cancelValue();
126
- },
127
- },
128
- {
129
- type: "primary",
130
- text: "确定",
131
- click: () => {
132
- this.confirmValue();
133
- },
134
- },
135
- ];
136
120
  },
137
121
 
138
122
  props: {
@@ -151,13 +135,14 @@ export default {
151
135
  computed: {
152
136
  module: {
153
137
  set(val) {
154
- //console.log(val);
138
+ console.log(val);
155
139
  this.$emit("input", val);
156
140
  },
157
141
  get() {
158
142
  return this.$props.value;
159
143
  },
160
144
  },
145
+
161
146
  suffixIcon() {
162
147
  if (this.isOpen) {
163
148
  return "el-icon-arrow-up";
@@ -223,8 +208,34 @@ export default {
223
208
  if (!this.isReview) {
224
209
  this.review();
225
210
  }
211
+ this.setHandleConfig();
226
212
  this.scrollToProvince();
227
213
  },
214
+ setHandleConfig() {
215
+ console.log(this.$props.value);
216
+ this.handleConfig = [
217
+ {
218
+ type: "info",
219
+ text: this.module ? "清空" : "取消",
220
+ plain: false,
221
+ click: () => {
222
+ if (!this.module) {
223
+ this.cancelValue();
224
+ } else {
225
+ this.cancelValue();
226
+ this.module = null;
227
+ }
228
+ },
229
+ },
230
+ {
231
+ type: "primary",
232
+ text: "确定",
233
+ click: () => {
234
+ this.confirmValue();
235
+ },
236
+ },
237
+ ];
238
+ },
228
239
 
229
240
  review() {
230
241
  // let provice = areaJson.findIndex((item) => {});
@@ -321,31 +332,29 @@ export default {
321
332
  this.areaValue = [];
322
333
  } else {
323
334
  this.init();
335
+ // this.module = null;
324
336
  this.isReview = false;
325
337
  }
326
- this.$refs.popover.doClose();
338
+ this.doClose();
327
339
  },
328
340
 
329
341
  confirmValue() {
330
342
  let value = {};
331
343
  for (let i = 0; i < this.areaValue.length; i++) {
332
344
  value[`${areaConfig[i].value}`] = this.areaValue[i].label;
333
- // if (this.module instanceof Object) {
334
- // this.module[`${areaConfig[i].value}`] = this.areaValue[i].label;
335
- // } else if (this.$props.value != null && !this.module) {
336
- // this.$emit("changeValue", {});
337
- // //console.log(this.value);
338
- // this.module[`${areaConfig[i].value}`] = this.areaValue[i].label;
339
- // // let obj = {};
340
- // // obj[`${areaConfig[i].value}`] = this.areaValue[i].label;
341
- // // this.module = obj;
342
- // }
343
345
  }
346
+ if (JSON.stringify(value) !== "{}") {
347
+ this.module = value;
348
+ }
349
+ if (this.$parent.$options._componentTag == "el-form-item") {
350
+ this.$emit("confirmAreaValue");
351
+ } else {
352
+ this.$emit("confirmAreaValue", value);
353
+ this.doClose();
354
+ }
355
+ },
344
356
 
345
- this.module = value;
346
-
347
- this.$emit("confirmAreaValue", value);
348
- //console.log(this.module);
357
+ doClose() {
349
358
  this.$refs.popover.doClose();
350
359
  },
351
360
 
@@ -36,8 +36,14 @@
36
36
  <baseAreaVue
37
37
  :disable="citem.disabled"
38
38
  v-if="citem.type == 'area'"
39
+ :ref="`area-${citem.key}`"
39
40
  v-model="formdata[`${citem.key}`]"
40
41
  :class="[`form-item-${citem.key}`]"
42
+ @confirmAreaValue="
43
+ formItemConfirm({
44
+ config: citem,
45
+ })
46
+ "
41
47
  ></baseAreaVue>
42
48
  <baseUploadVue
43
49
  :max="formConfig.max"
@@ -187,27 +193,47 @@ export default {
187
193
  }
188
194
  this.chunkLength = 3;
189
195
  },
196
+
190
197
  formItemConfirm(params) {
198
+ if (params.config.type == "area") {
199
+ this.formAreaConfirm(params);
200
+ return;
201
+ }
202
+ let result = this.submitVerifiData(params);
203
+ console.log(result);
204
+ if (result) {
205
+ params.this.handleConfirm();
206
+ this.$emit("formItemConfirm", params.config);
207
+ }
208
+ },
209
+ formAreaConfirm(params) {
210
+ let result = this.submitVerifiData(params);
211
+ if (result) {
212
+ this.$refs[`area-${params.config.key}`][0].doClose();
213
+ } else {
214
+ this.$message.error("请重新选择");
215
+ }
216
+ },
217
+ submitVerifiData(params) {
191
218
  if (this.$props.rules) {
192
219
  // element 验证单条表单修改
220
+ let confrim = true;
193
221
  const rulesItem = this.$props.rules[params.config.key];
194
222
  if (rulesItem) {
195
223
  this.$refs.form.validateField(
196
224
  [`${params.config.key}`],
197
225
  (errorMsg) => {
198
- //console.log(errorMsg);
199
- if (!errorMsg) {
200
- params.this.handleConfirm();
201
- this.$emit("formItemConfirm", params.config);
202
- return;
226
+ console.log(errorMsg);
227
+ if (errorMsg) {
228
+ confrim = false;
203
229
  }
204
230
  }
205
231
  );
206
232
  }
207
- return;
233
+ return confrim;
234
+ } else {
235
+ return true;
208
236
  }
209
- params.this.handleConfirm();
210
- this.$emit("formItemConfirm", params.config);
211
237
  },
212
238
  setFormData() {
213
239
  this.formdata = {};
@@ -329,6 +355,11 @@ export default {
329
355
  /deep/ .el-form-item__label {
330
356
  line-height: 24px !important;
331
357
  }
358
+
359
+ /deep/ .el-form-item__error {
360
+ line-height: 0px;
361
+ padding-top: 0px;
362
+ }
332
363
  }
333
364
  }
334
365
  </style>
@@ -488,7 +488,6 @@ export default {
488
488
 
489
489
  .item-content {
490
490
  min-height: 24px;
491
- max-height: 24px;
492
491
  /deep/ .base-icon-wrap {
493
492
  width: 20px !important;
494
493
  height: 20px !important;