MaiXinRong 5 years ago
parent
commit
86b6967cbc
3 changed files with 64 additions and 4 deletions
  1. 1 1
      app/public/js/ledger.js
  2. 61 1
      app/public/js/revise.js
  3. 2 2
      app/view/measure/stage_modal.ejs

+ 1 - 1
app/public/js/ledger.js

@@ -924,7 +924,7 @@ $(document).ready(function() {
                 }
             }
             this.addClass(item._icon);
-            const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; padding-right: 4px;">行</div>')
+            const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
                 .appendTo(this);
             const $input = $obj.find('input');
             const event = () => { item.batchInsert($input[0], root); };

+ 61 - 1
app/public/js/revise.js

@@ -781,7 +781,7 @@ $(document).ready(() => {
                 }
             }
             this.addClass(item._icon);
-            const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; padding-right: 4px;">行</div>')
+            const $obj = $('<div>' + item.name + '<input class="text-right ml-1 mr-1" type="tel" max="20" min="1" value="' + item.value + '" style="width: 30px; height: 18px; padding-right: 4px;">行</div>')
                 .appendTo(this);
             const $input = $obj.find('input');
             const event = () => { item.batchInsert($input[0], root); };
@@ -1343,6 +1343,66 @@ $(document).ready(() => {
             }
         }
     }
+    class BgBills {
+        constructor (selector, spreadSetting) {
+            const self = this;
+            this.loaded = false;
+            this.obj = $(selector)[0];
+            this.url = '/tender/' + window.location.pathname.split('/')[2] + '/deal';
+            this.spreadSetting = spreadSetting;
+            this.spread = SpreadJsObj.createNewSpread(this.obj);
+            SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
+            if (!readOnly) {
+                this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
+                    const dealSheet = info.sheet;
+                    const mainSheet = billsSheet;
+
+                    const dealBills = SpreadJsObj.getSelectObject(dealSheet);
+                    if (!dealBills) { return; }
+                    const mainTree = mainSheet.zh_tree;
+                    const mainNode = SpreadJsObj.getSelectObject(mainSheet);
+                    if (!mainNode || !mainTree) { return; }
+
+                    if (mainNode.code && mainNode.code !== '' && !mainTree.isLeafXmj(mainNode)) {
+                        toastr.warning('非最底层项目下,不应添加节点');
+                        return;
+                    }
+
+                    postData(window.location.pathname + '/update', {
+                        postType: 'add-deal',
+                        postData: {
+                            id: mainNode.ledger_id,
+                            type: mainNode.code ? 'child' : 'next',
+                            dealBills: {
+                                b_code: dealBills.code, name: dealBills.name, unit: dealBills.unit,
+                                unit_price: dealBills.unit_price,
+                            }
+                        },
+                    }, function (result) {
+                        const refreshData = mainTree.loadPostData(result);
+                        billsTreeSpreadObj.refreshTree(mainSheet, refreshData);
+                        const sel = mainSheet.getSelections()[0];
+                        if (sel && refreshData.create[0]) {
+                            mainSheet.setSelection(mainTree.nodes.indexOf(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
+                        }
+                        billsTreeSpreadObj.refreshOperationValid(mainSheet);
+                        billsSpread.focus();
+                        posSpreadObj.loadCurPosData();
+                    });
+                });
+            }
+            SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
+        }
+        loadData () {
+            if (this.loaded) return;
+            const self = this;
+            postData('/tender/' + window.location.pathname.split('/')[2] +'/get-bg-bills', {}, function (data) {
+                self.data = data;
+                SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'data', data);
+                self.loaded = true;
+            });
+        }
+    }
     class BatchInsertBillsPosObj {
         constructor (obj) {
             const self = this;

+ 2 - 2
app/view/measure/stage_modal.ejs

@@ -149,11 +149,11 @@
                 </div>
                 <div class="form-group">
                     <label>计量年月</label>
-                    <input class="datepicker-here form-control form-control-sm" id="edit-date" name="date" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text">
+                    <input class="datepicker-here form-control form-control-sm" autocomplete="off" id="edit-date" name="date" placeholder="点击选择年月" data-view="months" data-min-view="months" data-date-format="yyyy-MM" data-language="zh" type="text">
                 </div>
                 <div class="form-group">
                     <label>开始-截止日期</label>
-                    <input class="datepicker-here form-control form-control-sm" id="edit-period" name="period" placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text">
+                    <input class="datepicker-here form-control form-control-sm" autocomplete="off" id="edit-period" name="period" placeholder="点击选择时间" data-range="true" data-multiple-dates-separator=" ~ " data-language="zh" type="text">
                 </div>
             </div>
             <div class="modal-footer">