Browse Source

1. 210 台账分解,前兄弟节点含部位明细时,不允许降级
2. 216 台账分解,右侧工具栏,所有列调整对齐
3. 215 本期计量台账,不可输入部位数据时,提示用户后,应清空输入

MaiXinRong 6 years ago
parent
commit
131be6a6dd
3 changed files with 55 additions and 20 deletions
  1. 23 20
      app/public/js/ledger.js
  2. 31 0
      app/public/js/path_tree.js
  3. 1 0
      app/public/js/stage.js

+ 23 - 20
app/public/js/ledger.js

@@ -81,18 +81,21 @@ $(document).ready(function() {
             const tree = sheet.zh_tree;
             if (!tree) { return; }
             const node = sheet.zh_tree.nodes[row];
+            const preNode = tree.getPreSiblingNode(node);
             const valid = !sheet.zh_setting.readOnly;
 
             setObjEnable($('#delete'), valid && node);
-            setObjEnable($('#up-move'), valid && node && node.order > 1);
+            setObjEnable($('#up-move'), valid && node && preNode);
             setObjEnable($('#down-move'), valid && node && !tree.isLastSibling(node));
             if (checkTzMeasureType()) {
                 const posRange = node ? pos.getLedgerPos(node.id) : [];
                 setObjEnable($('#up-level'), valid && node && tree.getParent(node) && node.level > 2 && (!posRange || posRange.length === 0));
+                const preNodePosRange = preNode ? pos.getLedgerPos(preNode.id) : [];
+                setObjEnable($('#down-level'), valid && node && preNode && (!preNodePosRange || preNodePosRange.length === 0));
             } else {
                 setObjEnable($('#up-level'), valid && node && tree.getParent(node));
+                setObjEnable($('#down-level'), valid && node && preNode);
             }
-            setObjEnable($('#down-level'), valid && node && node.order > 1);
         },
         refreshTree: function (sheet, data) {
             SpreadJsObj.massOperationSheet(sheet, function () {
@@ -919,9 +922,9 @@ $(document).ready(function() {
                         keys: ['id', 'list_id', 'chapter_id'],
                     }, {
                         cols: [
-                            {title: '项目节编号', field: 'code', width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
-                            {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
-                            {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true}
+                            {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
+                            {title: '名称', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
+                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
                         ],
                         treeCol: 0,
                         emptyRows: 0,
@@ -943,9 +946,9 @@ $(document).ready(function() {
                         keys: ['id', 'list_id', 'bill_id']
                     }, {
                         cols: [
-                            {title: '清单编号', field: 'code', width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
-                            {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
-                            {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true}
+                            {title: '清单编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true, cellType: 'tree'},
+                            {title: '名称', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
+                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true}
                         ],
                         treeCol: 0,
                         emptyRows: 0,
@@ -960,12 +963,12 @@ $(document).ready(function() {
                 if (!dealBills) {
                     dealBills = new DealBills($('#deal-bills-spread')[0], {
                         cols: [
-                            {title: '清单编号', field: 'code', width: 120, formatter: '@', readOnly: true},
-                            {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
-                            {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
-                            {title: '单价', field: 'unit_price', width: 50, readOnly: true},
-                            {title: '数量', field: 'quantity', width: 50, readOnly: true},
-                            {title: '金额', field: 'total_price', width: 50, readOnly: true},
+                            {title: '清单编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
+                            {title: '名称', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
+                            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
+                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
+                            {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
+                            {title: '金额', field: 'total_price', hAlign: 2, width: 50, readOnly: true},
                         ],
                         emptyRows: 0,
                         headRows: 1,
@@ -979,12 +982,12 @@ $(document).ready(function() {
                 if (!searchLedger) {
                     searchLedger = new SearchLedger($('#search'), {
                         cols: [
-                            {title: '项目节编号', field: 'code', width: 120, formatter: '@', readOnly: true},
-                            {title: '清单编号', field: 'b_code', width: 120, formatter: '@', readOnly: true},
-                            {title: '名称', field: 'name', width: 230, formatter: '@', readOnly: true},
-                            {title: '单位', field: 'unit', width: 50, formatter: '@', readOnly: true},
-                            {title: '单价', field: 'unit_price', width: 50, readOnly: true},
-                            {title: '数量', field: 'quantity', width: 50, readOnly: true},
+                            {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
+                            {title: '清单编号', field: 'b_code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
+                            {title: '名称', field: 'name', width: 230, hAlign: 0, formatter: '@', readOnly: true},
+                            {title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@', readOnly: true},
+                            {title: '单价', field: 'unit_price', hAlign: 2, width: 50, readOnly: true},
+                            {title: '数量', field: 'quantity', hAlign: 2, width: 50, readOnly: true},
                         ],
                         emptyRows: 3,
                         headRows: 1,

+ 31 - 0
app/public/js/path_tree.js

@@ -312,6 +312,37 @@ const createNewPathTree = function (type, setting) {
         };
 
         /**
+         * 查找node的前兄弟节点
+         * @param node
+         * @returns {*}
+         */
+        getPreSiblingNode(node) {
+            const parent = this.getParent(node);
+            const siblings = parent ? parent.children : this.children;
+            const index = siblings.indexOf(node);
+            if (index > 0) {
+                return siblings[index - 1];
+            } else {
+                return null;
+            }
+        }
+        /**
+         * 查找node的后兄弟节点
+         * @param node
+         * @returns {*}
+         */
+        getNextSiblingNode(node) {
+            const parent = this.getParent(node);
+            const siblings = parent ? parent.children : this.children;
+            const index = siblings.indexOf(node);
+            if (index >= 0 && index < siblings.length - 1) {
+                return siblings[index + 1];
+            } else {
+                return null;
+            }
+        }
+
+        /**
          * 根据path查找完整节点
          * @param {Number} path
          */

+ 1 - 0
app/public/js/stage.js

@@ -582,6 +582,7 @@ $(document).ready(() => {
                 // 台账模式下,不可新增
                 if (checkTzMeasureType() && !posData) {
                     toast('台账模式不可新增部位明细数据', 'error');
+                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
                     info.cancel = true;
                     return ;
                 }