bri-components 1.2.39 → 1.2.40
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
|
@@ -209,52 +209,41 @@
|
|
|
209
209
|
getFormVDom () {
|
|
210
210
|
return this.$refs.form;
|
|
211
211
|
},
|
|
212
|
+
// 校验
|
|
212
213
|
submit () {
|
|
213
214
|
this.errorObj = {
|
|
214
215
|
errors: []
|
|
215
216
|
};
|
|
216
217
|
|
|
217
|
-
this
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// if (resultObj.bool === false) {
|
|
224
|
-
// this.errorObj.errors.push(resultObj);
|
|
225
|
-
// }
|
|
226
|
-
// });
|
|
227
|
-
// }
|
|
228
|
-
const selfValid = this.selfValidate((valid, errorFormList) => {
|
|
229
|
-
if (valid === false) {
|
|
230
|
-
errorFormList.forEach(formItem => {
|
|
231
|
-
this.errorObj.errors.push({
|
|
232
|
-
bool: false,
|
|
233
|
-
message: `${formItem._name} 内部校验不正确!`
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
});
|
|
218
|
+
const bool = this.getValid();
|
|
219
|
+
if (bool) {
|
|
220
|
+
this.validateSuccess({});
|
|
221
|
+
} else {
|
|
222
|
+
this.validateFailed(this.errorObj);
|
|
223
|
+
}
|
|
238
224
|
|
|
239
|
-
|
|
240
|
-
this.rulesSuccess({});
|
|
241
|
-
} else {
|
|
242
|
-
this.rulesFailed(this.errorObj);
|
|
243
|
-
}
|
|
244
|
-
}, 0);
|
|
245
|
-
});
|
|
225
|
+
return bool;
|
|
246
226
|
},
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
227
|
+
// 获取校验结果
|
|
228
|
+
getValid () {
|
|
229
|
+
let bool = true;
|
|
230
|
+
|
|
231
|
+
this.getFormVDom().validate(valid => {
|
|
232
|
+
bool = bool && valid;
|
|
233
|
+
});
|
|
234
|
+
this.selfValidate((valid, errorFormList) => {
|
|
235
|
+
bool = bool && valid;
|
|
236
|
+
|
|
237
|
+
errorFormList.forEach(formItem => {
|
|
238
|
+
this.validateCb(formItem._key, false, `${formItem._name} 内部校验不正确!`);
|
|
253
239
|
});
|
|
254
|
-
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
return bool;
|
|
255
243
|
},
|
|
244
|
+
|
|
256
245
|
// 控件自己的校验
|
|
257
|
-
selfValidate (
|
|
246
|
+
selfValidate (cb) {
|
|
258
247
|
let bool = true;
|
|
259
248
|
let errorRefs = [];
|
|
260
249
|
|
|
@@ -264,17 +253,26 @@
|
|
|
264
253
|
} else {
|
|
265
254
|
bool = true;
|
|
266
255
|
}
|
|
267
|
-
|
|
256
|
+
cb && cb(bool, errorRefs.map(errorRefItem => errorRefItem.formItem));
|
|
268
257
|
|
|
269
258
|
return bool;
|
|
270
259
|
},
|
|
260
|
+
// iview的校验回调
|
|
261
|
+
validateCb (prop, valid, error) {
|
|
262
|
+
if (valid === false) {
|
|
263
|
+
this.errorObj.errors.push({
|
|
264
|
+
bool: false,
|
|
265
|
+
message: error
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
},
|
|
271
269
|
// 校验成功
|
|
272
|
-
|
|
273
|
-
this.$emit("
|
|
270
|
+
validateSuccess (obj) {
|
|
271
|
+
this.$emit("validateSuccess", obj);
|
|
274
272
|
},
|
|
275
273
|
// 校验失败
|
|
276
|
-
|
|
277
|
-
this.$emit("
|
|
274
|
+
validateFailed (errorObj) {
|
|
275
|
+
this.$emit("validateFailed", errorObj);
|
|
278
276
|
},
|
|
279
277
|
|
|
280
278
|
// 点击控件
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
:size="selfPropsObj._size"
|
|
8
8
|
>
|
|
9
9
|
<Step
|
|
10
|
-
class="DshSteps-item"
|
|
11
10
|
v-for="(stepItem, stepIndex) in list"
|
|
12
|
-
:key="stepItem.
|
|
11
|
+
:key="stepItem._key || stepItem._id || tepItem.type || stepIndex"
|
|
12
|
+
class="DshSteps-item"
|
|
13
13
|
:status="stepItem.status"
|
|
14
|
-
:title="stepItem.name"
|
|
14
|
+
:title="stepItem.name || stepItem._name"
|
|
15
15
|
:content="stepItem.description"
|
|
16
16
|
:icon="stepItem.icon"
|
|
17
17
|
@click.native="clickStepItem(stepItem, stepIndex)"
|