laiguoran 3 yıl önce
ebeveyn
işleme
ca1e9b164d

+ 27 - 7
app/public/js/setting_datacollect_tender.js

@@ -117,16 +117,16 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
 function getTenderTreeHtml () {
     if (tenderTree.length > 0) {
         const html = [];
-        html.push('<table class="table table-hover table-bordered">');
-        html.push('<thead>', '<tr>');
-        html.push('<th>名称</th>');
-        html.push('<th width="40">选择</th>');
-        html.push('</tr>', '</thead>');
+        // html.push('<table class="table table-hover table-bordered">');
+        // html.push('<thead>', '<tr>');
+        // html.push('<th>名称</th>');
+        // html.push('<th width="60">选择 <input type="checkbox" id="select-tender-all"></th>');
+        // html.push('</tr>', '</thead>');
         parentId = 0;
         for (const t of tenderTree) {
             html.push(recursiveGetTenderNodeHtml(t, tenderTree, ''));
         }
-        html.push('</table>');
+        // html.push('</table>');
         return html.join('');
     } else {
         return EmptyTenderHtml.join('');
@@ -138,6 +138,11 @@ $(document).ready(function () {
         const html = getTenderTreeHtml();
         $('#copyModalContent').html(html);
         $('#sort input[value="'+ addDataCollect +'"]').prop('checked', true);
+        if($('#copyModalContent input[type="checkbox"]:not(:checked)').length === 0) {
+            $('#select-tender-all').prop('checked', true);
+        } else {
+            $('#select-tender-all').prop('checked', false);
+        }
         $('#sort').modal('show');
     });
 
@@ -157,7 +162,6 @@ $(document).ready(function () {
         if (parseInt(add_datacollect) === addDataCollect) {
             is_collect_update = false;
         }
-        console.log(_.sortBy(dcTidList), _.sortBy(noTidList), is_list_update, is_collect_update);
         if (is_list_update || is_collect_update) {
             postData('/setting/datacollect/save', { type: 'tender', add_datacollect: parseInt(add_datacollect), tids: noTidList }, function (result) {
                 addDataCollect = result.addDataCollect;
@@ -167,4 +171,20 @@ $(document).ready(function () {
         }
         $('#sort').modal('hide');
     });
+
+    $('#select-tender-all').click(function () {
+        const is_checked = $(this).is(':checked');
+        if(is_checked) {
+            $("#copyModalContent input[type='checkbox']").prop('checked', true);
+        } else {
+            $("#copyModalContent input[type='checkbox']").prop('checked', false);
+        }
+    });
+    $('body').on('click', "#copyModalContent input[type='checkbox']", function () {
+        if($('#copyModalContent input[type="checkbox"]:not(:checked)').length === 0) {
+            $('#select-tender-all').prop('checked', true);
+        } else {
+            $('#select-tender-all').prop('checked', false);
+        }
+    })
 });

+ 11 - 2
app/view/setting/datacollect_modal.ejs

@@ -22,8 +22,17 @@
                     </a>
                 </div>
                 <div class="alert alert-warning mb-1">已勾选的标段将展示到决策大屏中</div>
-                <div class="zTreeDemoBackground left modal-height-500" id="copyModalContent" style="overflow: auto">
-                    <!--<ul id="treeDemo" class="ztree"></ul>-->
+                <div class="zTreeDemoBackground left modal-height-500" style="overflow: auto">
+                    <table class="table table-hover table-bordered">
+                        <thead>
+                        <tr>
+                            <th>名称</th>
+                            <th width="40"><input style="vertical-align: middle" type="checkbox" id="select-tender-all"></th>
+                        </tr>
+                        </thead>
+                        <tbody id="copyModalContent">
+                        </tbody>
+                    </table>
                 </div>
             </div>
             <div class="modal-footer">