Browse Source

1.项目列表修复管理标段页新建标段初始无法选中类别问题
2.变更令添加多重验证方法防止重复添加

laiguoran 5 years ago
parent
commit
b9cf930e70
3 changed files with 13 additions and 4 deletions
  1. 3 0
      app/public/js/change.js
  2. 9 3
      app/public/js/tender_list_manage.js
  3. 1 1
      app/view/tender/sub_menu.ejs

+ 3 - 0
app/public/js/change.js

@@ -179,6 +179,7 @@ $(document).ready(() => {
     $('#autoCode').click(getNewCode);
     // 新增变更令 确认
     $('#addOk').click(function () {
+        $(this).attr('disabled', true);
         const data = {
             code: $('#bj-code').val(),
             name: $('#bj-name').val(),
@@ -187,10 +188,12 @@ $(document).ready(() => {
             postData('/tender/'+ $('#tenderId').val() +'/change/add', data, function (rst) {
                 $('#bj-code').removeClass('is-invalid');
                 $('#mj-add').modal('hide');
+                $(this).attr('disabled', false);
                 window.location.href = '/tender/'+ $('#tenderId').val() +'/change/' + rst.cid + '/info';
             }, function () {
                 $('#mj-code').addClass('is-invalid');
                 $('#mj-Hint').show();
+                $(this).attr('disabled', false);
             });
         }
     });

+ 9 - 3
app/public/js/tender_list_manage.js

@@ -315,13 +315,14 @@ function bindTenderUrl() {
         }
     });
     // 编辑
-    $('a[name=edit]', '.c-body').bind('click', function () {
+    $('a[name=edit]', '.c-body').on('click', function () {
         const tid = parseInt($(this).parent().attr('tid'));
         const tender = _.find(tenders, {id: tid});
         $('[name=name]', '#edit-bd').val(tender.name);
+        $('input[type=radio]', '#add-bd').prop('checked', false);
         for (const c of tender.category) {
-            $('input[value=' + c.value + ']', '#edit-bd').attr('checked', 'checked');
-            $('option[value=' + c.value + ']', '#edit-bd').attr('selected', true);
+            $('input[value=' + c.value + ']', '#edit-bd').prop('checked', 'checked');
+            $('option[value=' + c.value + ']', '#edit-bd').prop('selected', true);
         }
         $('#edit-bd-ok').attr('tid', tid);
         $('#edit-bd').modal('show');
@@ -371,6 +372,11 @@ $(document).ready(() => {
             $('#cate-set').modal('hide');
         });
     });
+
+    $('a[name=add]').click(function () {
+        $('input[type=radio]', '#edit-bd').prop('checked', false);
+        $('input[type=radio]', '#add-bd').eq(0).prop('checked', true);
+    });
     // 新增标段
     $('#add-bd-ok').click(function () {
         const data = {

+ 1 - 1
app/view/tender/sub_menu.ejs

@@ -30,7 +30,7 @@
         </div>
         <% if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) { %>
         <div>
-            <a href="#add-bd" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
+            <a href="#add-bd" name="add" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
         </div>
         <% } %>
     </div>