Переглянути джерело

清单指引库 插入全部

zhongzewei 6 роки тому
батько
коміт
3f7aa7231a

+ 11 - 4
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -68,18 +68,25 @@
                         <div style="width: 99%; float: left" id="de">
                             <div class="sidebar-tools-bar container-fluid tools-bar-height-q">
                                 <div class="p-1 row">
-                                    <div class="col-5 p-0">
+                                    <div class="col-4 p-0">
                                         <select class="form-control form-control-sm" id="rationLibSel">
                                         </select>
                                     </div>
-                                    <div class=" input-group col-5">
+                                    <div class=" input-group col-5 pl-0">
                                         <input id="searchText" type="text" class="form-control form-control-sm" placeholder="搜索定额">
                                         <span class="input-group-btn">
                                         <button id="searchBtn" class="btn btn-secondary btn-sm" type="button"><i class="fa fa-search" aria-hidden="true"></i></button>
                                     </span>
                                     </div>
-                                    <div class="col-2">
-                                        <button id="insertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                    <div class="col-3">
+                                        <div class="row">
+                                            <div class="col-5 pl-0">
+                                                <button id="insertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                            </div>
+                                            <div class="col-5">
+                                                <button id="insertAll" class="btn btn-primary btn-sm" type="button">插入全部</button>
+                                            </div>
+                                        </div>
                                     </div>
                                 </div>
                                 <!--搜索结果窗体-->

+ 17 - 1
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -443,6 +443,7 @@ const billsGuidance = (function () {
         //全部设为无效
         $('.tools-btn').children().addClass('disabled');
         $('#insertRation').addClass('disabled');
+        $('#insertAll').addClass('disabled');
         $('.main-bottom-content').find('textarea').attr('readonly', true);
         //插入
         if(bills.tree.selected && bills.tree.selected.guidance.tree){
@@ -484,6 +485,7 @@ const billsGuidance = (function () {
         //插入定额
         if(node && (node.children.length === 0 || allRationChildren(node))){
             $('#insertRation').removeClass('disabled');
+            $('#insertAll').removeClass('disabled');
         }
         //备注,奇数节点可用
         if(node && (node.depth() + 1) % 2 === 1 && node.data.type !== itemType.ration){
@@ -1135,10 +1137,15 @@ const billsGuidance = (function () {
     }
     //获取选中的定额表行
     //@return {Array}
-    function getCheckedRationRows(){
+    function getCheckedRationRows(all){
         let rst = [];
         let sheet = ration.workBook.getActiveSheet();
         for(let i = 0; i < sheet.getRowCount(); i++){
+            // 全选
+            if (all) {
+                rst.push(i);
+                continue;
+            }
             let checked = sheet.getValue(i, 0);
             if(checked){
                 rst.push(i);
@@ -1485,6 +1492,15 @@ const billsGuidance = (function () {
                 clearCheckedRation(checkedRows);
             }
         });
+        // 插入全部定额
+        $('#insertAll').click(function () {
+            let isAll = true;
+            let checkedRows = getCheckedRationRows(isAll);
+            let insertDatas = getInsertRations(checkedRows);
+            if(insertDatas.length > 0){
+                insert(insertDatas, false);
+            }
+        });
         //搜索定额
         $('#searchBtn').click(function () {
             let searchStr = $('#searchText').val();