Browse Source

标段管理页面bug

MaiXinRong 6 years ago
parent
commit
2dd81cbeb1
1 changed files with 9 additions and 8 deletions
  1. 9 8
      app/public/js/tender_list.js

+ 9 - 8
app/public/js/tender_list.js

@@ -92,7 +92,7 @@ function onDropNode(event, treeId, treeNodes, targetNode, moveType) {
 // 查询方法
 // 查询方法
 function findNode (key, value, arr) {
 function findNode (key, value, arr) {
     for (const a of arr) {
     for (const a of arr) {
-        if (a[key] && a[key] === value) {
+        if (a[key] && a[key] == value) {
             return a;
             return a;
         }
         }
     }
     }
@@ -143,7 +143,7 @@ function getCategoryHtml() {
         html.push('<lable>', cate.name, '</lable>');
         html.push('<lable>', cate.name, '</lable>');
         html.push('<select class="form-control">');
         html.push('<select class="form-control">');
         for (const v of cate.value) {
         for (const v of cate.value) {
-            html.push('<option>', v, '</option>');
+            html.push('<option value="' + v.id + '">', v.value, '</option>');
         }
         }
         html.push('</select>');
         html.push('</select>');
         html.push('</div>');
         html.push('</div>');
@@ -156,8 +156,8 @@ function getCategoryHtml() {
         html.push('<div>');
         html.push('<div>');
         for (const v of cate.value) {
         for (const v of cate.value) {
             html.push('<div class="form-check-inline">');
             html.push('<div class="form-check-inline">');
-            html.push('<input class="form-check-input" type="radio"', 'value="' , v,  '">');
-            html.push('<label class="form-check-label">', v, '</label>');
+            html.push('<input class="form-check-input" type="radio"', 'value="' , v.id,  '">');
+            html.push('<label class="form-check-label">', v.value, '</label>');
             html.push('</div>');
             html.push('</div>');
         }
         }
         html.push('</div>');
         html.push('</div>');
@@ -181,7 +181,7 @@ function initTenderTree () {
     });
     });
     function findCategoryNode(cid, value, array) {
     function findCategoryNode(cid, value, array) {
         for (const a of array) {
         for (const a of array) {
-            if (a.cid === cid && a.vid === value) {
+            if (a.cid === cid && a.vid == value) {
                 return a;
                 return a;
             }
             }
         }
         }
@@ -190,10 +190,11 @@ function initTenderTree () {
         const array = parent ?  parent.children : tenderTree;
         const array = parent ?  parent.children : tenderTree;
         let cate = findCategoryNode(category.id, value, array);
         let cate = findCategoryNode(category.id, value, array);
         if (!cate) {
         if (!cate) {
+            const cateValue = findNode('id', value, category.value);
             cate = {
             cate = {
                 cid: category.id,
                 cid: category.id,
                 vid: value,
                 vid: value,
-                name: findNode('id', value, category.value).value,
+                name: cateValue.value,
                 children: [],
                 children: [],
                 level: category.level,
                 level: category.level,
             };
             };
@@ -328,9 +329,9 @@ $(document).ready(() => {
         for (const c of category) {
         for (const c of category) {
             const cate = {cid: c.id};
             const cate = {cid: c.id};
             if (c.type === categoryType.key.dropDown) {
             if (c.type === categoryType.key.dropDown) {
-                cate.value = $('select', '[cate-id=' + c.id + ']').val();
+                cate.value = parseInt($('select', '[cate-id=' + c.id + ']').val());
             } else if (c.type === categoryType.key.radio) {
             } else if (c.type === categoryType.key.radio) {
-                cate.value = $('input:checked', '[cate-id=' + c.id + ']').val();
+                cate.value = parseInt($('input:checked', '[cate-id=' + c.id + ']').val());
             }
             }
             data.category.push(cate);
             data.category.push(cate);
         }
         }