Browse Source

批量插入清单-计量单元,签约清单,查找功能

MaiXinRong 3 years ago
parent
commit
cfb451ac6e
4 changed files with 104 additions and 10 deletions
  1. 37 4
      app/public/js/ledger.js
  2. 37 4
      app/public/js/revise.js
  3. 15 1
      app/view/ledger/explode_modal.ejs
  4. 15 1
      app/view/revise/info_modal.ejs

+ 37 - 4
app/public/js/ledger.js

@@ -2929,6 +2929,7 @@ $(document).ready(function() {
                 font: '12px 微软雅黑',
             };
             this.dealSpread = SpreadJsObj.createNewSpread($('.batch-r', this.obj)[0]);
+            this.dealSheet = this.dealSpread.getActiveSheet();
             // 初始化 清单编号、部位数量复核表 表格
             this.initView();
             SpreadJsObj.initSheet(this.dealSpread.getActiveSheet(), this.dealSpreadSetting);
@@ -3094,6 +3095,42 @@ $(document).ready(function() {
             $('input[name=batch-filter]').change(function () {
                 setLocalCache('zh-calc-batch-filter', this.checked ? 1 : 0);
             });
+            this.initDealBillsSearch();
+        }
+        search(keyword) {
+            this.searchResult = [];
+            this.searchCur = 0;
+            if (keyword) {
+                for (const [i, d] of this.dealSheet.zh_data.entries()) {
+                    if (d.code.indexOf(keyword) >= 0 || d.name.indexOf(keyword) >= 0) this.searchResult.push(d);
+                }
+            }
+            $('#batch-dbs-count').html(`结果:${this.searchResult.length}`);
+            if (this.searchResult.length > 0) SpreadJsObj.locateData(this.dealSheet, this.searchResult[0]);
+        }
+        searchPre() {
+            if (this.searchResult.length <= 1) return;
+            this.searchCur = this.searchCur - 1;
+            if (this.searchCur < 0) this.searchCur = this.searchResult.length - 1;
+            SpreadJsObj.locateData(this.dealSheet, this.searchResult[this.searchCur]);
+        }
+        searchNext() {
+            if (this.searchResult.length <= 1) return;
+            this.searchCur = this.searchCur + 1;
+            if (this.searchCur >= this.searchResult.length) this.searchCur = 0;
+            SpreadJsObj.locateData(this.dealSheet, this.searchResult[this.searchCur]);
+        }
+        initDealBillsSearch() {
+            const self = this;
+            $('#batch-dbs-keyword').change(function () { self.search(this.value); });
+            $('#batch-dbs-pre').click(function (e) {
+                self.searchPre();
+                e.stopPropagation();
+            });
+            $('#batch-dbs-next').click(function (e) {
+                self.searchNext();
+                e.stopPropagation();
+            });
         }
         // 初始化左侧表格
         initView () {
@@ -3120,10 +3157,6 @@ $(document).ready(function() {
             posSheet.clear(0, 0, posSheet.getRowCount(), posSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
             posSheet.setSelection(0, 0, 1 ,1);
             SpreadJsObj.endMassOperation(posSheet);
-            // 检查签约清单数据,以工具栏数据为准
-            if (dealBills) {
-                SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
-            }
             this.dealSpread.getActiveSheet().setSelection(0, 0, 1, 1);
         }
         // 获取界面数据

+ 37 - 4
app/public/js/revise.js

@@ -2212,6 +2212,7 @@ $(document).ready(() => {
                 font: '12px 微软雅黑',
             };
             this.dealSpread = SpreadJsObj.createNewSpread($('.batch-r', this.obj)[0]);
+            this.dealSheet = this.dealSpread.getActiveSheet();
             // 初始化 清单编号、部位数量复核表 表格
             this.initView();
             SpreadJsObj.initSheet(this.dealSpread.getActiveSheet(), this.dealSpreadSetting);
@@ -2379,6 +2380,42 @@ $(document).ready(() => {
                     },
                 }
             });
+            this.initDealBillsSearch();
+        }
+        search(keyword) {
+            this.searchResult = [];
+            this.searchCur = 0;
+            if (keyword) {
+                for (const [i, d] of this.dealSheet.zh_data.entries()) {
+                    if (d.code.indexOf(keyword) >= 0 || d.name.indexOf(keyword) >= 0) this.searchResult.push(d);
+                }
+            }
+            $('#batch-dbs-count').html(`结果:${this.searchResult.length}`);
+            if (this.searchResult.length > 0) SpreadJsObj.locateData(this.dealSheet, this.searchResult[0]);
+        }
+        searchPre() {
+            if (this.searchResult.length <= 1) return;
+            this.searchCur = this.searchCur - 1;
+            if (this.searchCur < 0) this.searchCur = this.searchResult.length - 1;
+            SpreadJsObj.locateData(this.dealSheet, this.searchResult[this.searchCur]);
+        }
+        searchNext() {
+            if (this.searchResult.length <= 1) return;
+            this.searchCur = this.searchCur + 1;
+            if (this.searchCur >= this.searchResult.length) this.searchCur = 0;
+            SpreadJsObj.locateData(this.dealSheet, this.searchResult[this.searchCur]);
+        }
+        initDealBillsSearch() {
+            const self = this;
+            $('#batch-dbs-keyword').change(function () { self.search(this.value); });
+            $('#batch-dbs-pre').click(function (e) {
+                self.searchPre();
+                e.stopPropagation();
+            });
+            $('#batch-dbs-next').click(function (e) {
+                self.searchNext();
+                e.stopPropagation();
+            });
         }
         // 初始化左侧表格
         initView () {
@@ -2404,10 +2441,6 @@ $(document).ready(() => {
             posSheet.clear(0, 0, posSheet.getRowCount(), posSheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
             posSheet.setSelection(0, 0, 1 ,1);
             SpreadJsObj.endMassOperation(posSheet);
-            // 检查签约节点数据,以工具栏数据为准
-            if (dealBills) {
-                SpreadJsObj.loadSheetData(this.dealSpread.getActiveSheet(), 'data', dealBills.data);
-            }
             this.dealSpread.getActiveSheet().setSelection(0, 0, 1, 1);
         }
         // 获取界面数据

+ 15 - 1
app/view/ledger/explode_modal.ejs

@@ -85,7 +85,21 @@
                         </div>
                     </div>
                     <div class="col-6">
-                        <h6>签约清单</h6>
+                        <div class="d-inline-flex">
+                            <h6 class="mr-2 mt-1">签约清单</h6>
+                            <div class="mx-2 mb-2">
+                                <div class="input-group input-group-sm">
+                                    <input type="text" class="form-control" id="batch-dbs-keyword" placeholder="输入编号/名称查找">
+                                    <div class="input-group-append" >
+                                        <span class="input-group-text" id="batch-dbs-count">结果:0</span>
+                                    </div>
+                                    <div class="input-group-append" >
+                                        <button class="btn btn-outline-secondary" id="batch-dbs-pre" type="button" title="上一个"><i class="fa fa-angle-double-left"></i></button>
+                                        <button class="btn btn-outline-secondary" id="batch-dbs-next" type="button" title="下一个"><i class="fa fa-angle-double-right"></i></button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
                         <div class="batch-r">
                         </div>
                     </div>

+ 15 - 1
app/view/revise/info_modal.ejs

@@ -28,7 +28,21 @@
                         </div>
                     </div>
                     <div class="col-6">
-                        <h6>签约清单</h6>
+                        <div class="d-inline-flex">
+                            <h6 class="mr-2 mt-1">签约清单</h6>
+                            <div class="mx-2 mb-2">
+                                <div class="input-group input-group-sm">
+                                    <input type="text" class="form-control" id="batch-dbs-keyword" placeholder="输入编号/名称查找">
+                                    <div class="input-group-append" >
+                                        <span class="input-group-text" id="batch-dbs-count">结果:0</span>
+                                    </div>
+                                    <div class="input-group-append" >
+                                        <button class="btn btn-outline-secondary" id="batch-dbs-pre" type="button" title="上一个"><i class="fa fa-angle-double-left"></i></button>
+                                        <button class="btn btn-outline-secondary" id="batch-dbs-next" type="button" title="下一个"><i class="fa fa-angle-double-right"></i></button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
                         <div class="batch-r">
                         </div>
                     </div>