瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 年之前
父節點
當前提交
32dc4d9274
共有 4 個文件被更改,包括 12 次插入18 次删除
  1. 1 1
      app/controller/ledger_controller.js
  2. 1 0
      app/lib/sum_load.js
  3. 7 15
      app/public/js/path_tree.js
  4. 3 2
      app/public/js/shares/tenders2tree.js

+ 1 - 1
app/controller/ledger_controller.js

@@ -937,7 +937,7 @@ module.exports = app => {
                 if (!fileInfo || !Object.keys(fileInfo).length) {
                     throw '该文件不存在';
                 }
-                if (!fileInfo.extra_upload && ctx.stage.status === auditConst.status.checked) {
+                if (!fileInfo.extra_upload && ctx.tender.status === auditConst.status.checked) {
                     throw '无权限删除';
                 }
                 if (fileInfo !== undefined && fileInfo !== '') {

+ 1 - 0
app/lib/sum_load.js

@@ -74,6 +74,7 @@ class loadGclBaseTree {
                 qtcl_qty: 0,
                 sjcl_qyt: 0,
                 quantity: 0,
+                is_leaf: source.is_leaf,
             };
             this.keyNodeId += 1;
             parent.children.push(node);

+ 7 - 15
app/public/js/path_tree.js

@@ -307,9 +307,7 @@ const createNewPathTree = function (type, setting) {
                     if (!isResort) {
                         nodes[i].children = self.getChildren(nodes[i]);
                     } else {
-                        nodes[i].children.sort(function (a, b) {
-                            return a.order - b.order;
-                        })
+                        nodes[i].children.sort((a, b) => { return a[self.setting.order] - b[self.setting.order]; })
                     }
                     addSortNodes(nodes[i].children);
                 }
@@ -318,9 +316,7 @@ const createNewPathTree = function (type, setting) {
             if (!isResort) {
                 this.children = this.getChildren();
             } else {
-                this.children.sort(function (a, b) {
-                    return a.order - b.order;
-                })
+                this.children.sort((a, b) => { return a[self.setting.order] - b[self.setting.order]; });
             }
             addSortNodes(this.children);
         }
@@ -329,7 +325,7 @@ const createNewPathTree = function (type, setting) {
          * @param datas
          */
         loadDatas(datas) {
-            self = this;
+            const self = this;
             // 清空旧数据
             this.items = {};
             this.nodes = [];
@@ -358,9 +354,7 @@ const createNewPathTree = function (type, setting) {
                     }
                 }
             }
-            this.children.sort(function (a, b) {
-                return a.order - b.order;
-            });
+            this.children.sort((a, b) => { return a[self.setting.order] - b[self.setting.order]; });
             this.sortTreeNode(true);
             if (this.hasMark) {
                 if (this.setting.markExpandKey) {
@@ -477,9 +471,7 @@ const createNewPathTree = function (type, setting) {
             const children = this.datas.filter(function (x) {
                 return x[setting.pid] === pid;
             });
-            children.sort(function (a, b) {
-                return a.order - b.order;
-            });
+            children.sort((a, b) => { return a[setting.order] - b[setting.order]; });
             return children;
         };
 
@@ -524,7 +516,7 @@ const createNewPathTree = function (type, setting) {
          */
         isLastSibling(node) {
             const siblings = this.getChildren(this.getParent(node));
-            return (siblings && siblings.length > 0) ? node.order === siblings[siblings.length - 1].order : false;
+            return (siblings && siblings.length > 0) ? node[this.setting.order] === siblings[siblings.length - 1][this.setting.order] : false;
         };
 
         /**
@@ -1546,7 +1538,7 @@ const createNewPathTree = function (type, setting) {
                     return fun(a[field], b[field]);
                 });
                 for (const [i, node] of nodes.entries()) {
-                    node.order = i + 1;
+                    node[self.setting.order] = i + 1;
                 }
             };
             const addSortNodes = function (nodes) {

+ 3 - 2
app/public/js/shares/tenders2tree.js

@@ -12,7 +12,7 @@ const Tender2Tree = (function () {
     const treeSetting = {
         id: 'tmt_id',
         pid: 'tmt_pid',
-        order: 'order',
+        order: 'sort',
         level: 'level',
         rootId: -1,
         fullPath: 'full_path',
@@ -48,6 +48,7 @@ const Tender2Tree = (function () {
                 vid: value,
                 name: cateValue.value,
             }, parent);
+            if (cateValue.sort) cate.sort = cateValue.sort;
         }
         return cate;
     }
@@ -92,7 +93,7 @@ const Tender2Tree = (function () {
             }
             tenderTree.addNode(node, parent);
         }
-        tenderTree.sortTreeNode(false);
+        tenderTree.sortTreeNode(true);
         return tenderTree;
     }
     return { convert }