t20-common-lib 0.15.25 → 0.15.26

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": "t20-common-lib",
3
- "version": "0.15.25",
3
+ "version": "0.15.26",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -490,6 +490,21 @@ export default {
490
490
  this.isApplyingLinkage = false;
491
491
  });
492
492
  },
493
+ /**
494
+ * 提交校验失败时,将可视区域滚动到第一个未通过的表单项(依赖 Element 的 .is-error)。
495
+ */
496
+ scrollToFirstFormError() {
497
+ const formRef = this.$refs.dynamicForms;
498
+ const formEl = formRef && formRef.$el;
499
+ if (!formEl || typeof formEl.querySelector !== "function") return;
500
+ const firstError = formEl.querySelector(".el-form-item.is-error");
501
+ if (!firstError || typeof firstError.scrollIntoView !== "function") return;
502
+ firstError.scrollIntoView({
503
+ behavior: "smooth",
504
+ block: "center",
505
+ inline: "nearest",
506
+ });
507
+ },
493
508
  /**
494
509
  * 触发表单校验;通过后由返回值携带表单数据与附件(与 needFile 一致时含已落档行)。
495
510
  * @returns {Promise<{ valid: false, formData: object } | { valid: true, formData: object, operate?: string, fileUploadTableData?: array }>}
@@ -503,6 +518,9 @@ export default {
503
518
  formRef.validate((valid) => resolve(valid));
504
519
  });
505
520
  if (!pass) {
521
+ this.$nextTick(() => {
522
+ this.scrollToFirstFormError();
523
+ });
506
524
  callback(false, this.formData);
507
525
  }
508
526
  const fileUploadTableData = (this.fileUploadTableData || []).filter(