jqh 5 years ago
parent
commit
6e767aeee9

+ 10 - 10
resources/assets/dcat-admin/form.js

@@ -1,4 +1,4 @@
-(function (w) {
+(function () {
     /**
      * 表单提交
      *
@@ -24,11 +24,11 @@
             tpl = opts.template,
             $form = opts.$form,
             tabSelector = '.tab-pane',
-            getTabId = function ($c) {
+            get_tab_id = function ($c) {
                 return $c.parents(tabSelector).attr('id');
             },
-            getTabTitleError = function ($c) {
-                var id = getTabId($c);
+            get_tab_title_error = function ($c) {
+                var id = get_tab_id($c);
                 if (!id) return $('<none></none>');
                 return $("[href='#" + id + "'] .text-red");
             };
@@ -125,7 +125,7 @@
                 p.removeClass(cls);
                 p.find('error').html('');
 
-                t = getTabTitleError($eColumns[i]);
+                t = get_tab_title_error($eColumns[i]);
                 if (!t.hasClass('hide')) {
                     t.addClass('hide');
                 }
@@ -139,7 +139,7 @@
         function show_field_error($form, column, errors) {
             var $c = get_field_obj($form, column);
 
-            getTabTitleError($c).removeClass('hide');
+            get_tab_title_error($c).removeClass('hide');
 
             // 保存字段原始数据
             originalVals[column] = get_val($c);
@@ -156,7 +156,7 @@
             p.addClass(cls);
 
             for (j in errors) {
-                p.find('error').append(tpl.replace('_message_', errors[j]));
+                p.find('error').eq(0).append(tpl.replace('_message_', errors[j]));
             }
 
             if (!opts.disableRemoveError) {
@@ -240,9 +240,9 @@
                 p.find('error').html('');
 
                 // tab页下没有错误信息了,隐藏title的错误图标
-                var id = getTabId($c), t;
+                var id = get_tab_id($c), t;
                 if (id && !$('#'+id).find('.'+cls).length) {
-                    t = getTabTitleError($c);
+                    t = get_tab_title_error($c);
                     if (!t.hasClass('hide')) {
                         t.addClass('hide');
                     }
@@ -254,4 +254,4 @@
         }
 
     };
-})(window);
+})();

+ 8 - 8
resources/assets/dcat-admin/main.js

@@ -743,11 +743,11 @@ window.require = window.define = window.exports = window.module = undefined;
             tpl = opts.template,
             $form = opts.$form,
             tabSelector = '.tab-pane',
-            getTabId = function ($c) {
+            get_tab_id = function ($c) {
                 return $c.parents(tabSelector).attr('id');
             },
-            getTabTitleError = function ($c) {
-                var id = getTabId($c);
+            get_tab_title_error = function ($c) {
+                var id = get_tab_id($c);
                 if (!id) return $('<none></none>');
                 return $("[href='#" + id + "'] .text-red");
             };
@@ -844,7 +844,7 @@ window.require = window.define = window.exports = window.module = undefined;
                 p.removeClass(cls);
                 p.find('error').html('');
 
-                t = getTabTitleError($eColumns[i]);
+                t = get_tab_title_error($eColumns[i]);
                 if (!t.hasClass('hide')) {
                     t.addClass('hide');
                 }
@@ -858,7 +858,7 @@ window.require = window.define = window.exports = window.module = undefined;
         function show_field_error($form, column, errors) {
             var $c = get_field_obj($form, column);
 
-            getTabTitleError($c).removeClass('hide');
+            get_tab_title_error($c).removeClass('hide');
 
             // 保存字段原始数据
             originalVals[column] = get_val($c);
@@ -875,7 +875,7 @@ window.require = window.define = window.exports = window.module = undefined;
             p.addClass(cls);
 
             for (j in errors) {
-                p.find('error').append(tpl.replace('_message_', errors[j]));
+                p.find('error').eq(0).append(tpl.replace('_message_', errors[j]));
             }
 
             if (!opts.disableRemoveError) {
@@ -959,9 +959,9 @@ window.require = window.define = window.exports = window.module = undefined;
                 p.find('error').html('');
 
                 // tab页下没有错误信息了,隐藏title的错误图标
-                var id = getTabId($c), t;
+                var id = get_tab_id($c), t;
                 if (id && !$('#'+id).find('.'+cls).length) {
-                    t = getTabTitleError($c);
+                    t = get_tab_title_error($c);
                     if (!t.hasClass('hide')) {
                         t.addClass('hide');
                     }

File diff suppressed because it is too large
+ 0 - 0
resources/assets/dcat-admin/main.min.js


+ 6 - 2
resources/views/form/hasmanytable.blade.php

@@ -1,7 +1,11 @@
 
-<div class="row">
-    <div class="{{$viewClass['label']}}"><h4 class="pull-right">{!! $label !!}</h4></div>
+<div class="row form-group">
+    <div class="{{$viewClass['label']}} "><h4 class="pull-right"><label class="control-label">{!! $label !!}</label></h4></div>
     <div class="{{$viewClass['field']}}">
+        @include('admin::form.error')
+
+        <span name="{{$column}}"></span> {{-- 用于显示错误信息 --}}
+
         <div id="has-many-{{$column}}" >
             <table class="table table-has-many has-many-{{$column}}">
                 <thead>

Some files were not shown because too many files changed in this diff