Browse Source

部分树结构操作bug

MaiXinRong 7 years ago
parent
commit
6c6c9e7549
3 changed files with 11 additions and 8 deletions
  1. 1 0
      app/controller/ledger_controller.js
  2. 1 1
      app/public/js/path_tree.js
  3. 9 7
      app/service/ledger.js

+ 1 - 0
app/controller/ledger_controller.js

@@ -148,6 +148,7 @@ module.exports = app => {
             } catch (err) {
                 responseData.err = 1;
                 responseData.msg = err;
+                console.log(err);
             }
 
             ctx.body = responseData;

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

@@ -111,7 +111,7 @@ const createNewPathTree = function (setting) {
         for (const node of loadedData) {
             const children = this.getChildren(node);
             if (!node.expanded && children.length > 0) {
-                node.expaned = true;
+                node.expanded = true;
                 this._refreshChildrenVisible(node);
             }
         }

+ 9 - 7
app/service/ledger.js

@@ -652,7 +652,7 @@ module.exports = app => {
          * @returns {Promise<*>}
          */
         async addStdNode(tenderId, selectId, stdData) {
-            const newData = this.filterStdData(stdData);
+            const newData = this._filterStdData(stdData);
             const result = await this.addNode(tenderId, selectId, newData);
             return result;
         }
@@ -797,12 +797,14 @@ module.exports = app => {
             if (deleteData.length > 0) {
                 updateData = await this.getNextsData(tenderId, selectData.ledger_pid, selectData.order - 1);
                 updateData = updateData ? updateData : [];
-                const updateData1 = await this.getDataByNodeId(tenderId, selectData.ledger_pid);
-                if (this.ctx.helper.checkZero(selectData.total_price)) {
-                    const updateData2 = await this.getFullLevelDataByFullPath(tenderId, updateData1.full_path);
-                    updateData = updateData.concat(updateData2);
-                } else if (updateData1.is_leaf !== parentData.is_leaf) {
-                    updateData.push(updateData1);
+                if (selectData.ledger_pid !== rootId) {
+                    const updateData1 = await this.getDataByNodeId(tenderId, selectData.ledger_pid);
+                    if (this.ctx.helper.checkZero(selectData.total_price)) {
+                        const updateData2 = await this.getFullLevelDataByFullPath(tenderId, updateData1.full_path);
+                        updateData = updateData.concat(updateData2);
+                    } else if (updateData1.is_leaf !== parentData.is_leaf) {
+                        updateData.push(updateData1);
+                    }
                 }
             }
             return { delete: deleteData, update: updateData };