فهرست منبع

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhongzewei 8 سال پیش
والد
کامیت
1f0e19b3ab

+ 55 - 0
modules/main/controllers/bills_controller.js

@@ -0,0 +1,55 @@
+/**
+ * Created by jimiz on 2017/4/7.
+ */
+var billsData = require('../models/bills');
+
+//统一回调函数
+var callback = function(req, res, err, message, data){
+    res.json({error: err, message: message, data: data});
+};
+
+module.exports = {
+    getBills: function(req, res){
+        var data = JSON.parse(req.body.data);
+        billsData.getBills(data.projectId, function(err, message, billsList){
+            if (err === 0) {
+                callback(req, res, err, message, billsList);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    updateBills: function(req, res){
+        var data = JSON.parse(req.body.data);
+        billsData.updateBills(data, function(err, message, errList){
+            if (err) {
+                callback(req, res, err, message, errList);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    getBillsItemTemplate: function(req, res){
+        //var data = JSON.parse(req.body.data);
+        billsData.getBillsItemTemplate(function(err, message, billsItem){
+            if (billsItem) {
+                callback(req, res, err, message, billsItem);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    allocIDs: function(req, res){
+        billsData.allocIDs(function(err, message, data){
+            if (err) {
+                callback(req, res, err, message, data);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    }
+
+};

+ 55 - 0
modules/main/controllers/rations_controller.js

@@ -0,0 +1,55 @@
+/**
+ * Created by jimiz on 2017/4/9.
+ */
+var rationsData = require('../models/rations');
+
+//统一回调函数
+var callback = function(req, res, err, message, data){
+    res.json({error: err, message: message, data: data});
+};
+
+module.exports = {
+    getRations: function(req, res){
+        var data = JSON.parse(req.body.data);
+        rationsData.getRations(data.projectId, function(err, message, rationList){
+            if (err === 0) {
+                callback(req, res, err, message, rationList);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    updateRations: function(req, res){
+        var data = JSON.parse(req.body.data);
+        rationsData.updateRations(data, function(err, message, errList){
+            if (err) {
+                callback(req, res, err, message, errList);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    getRationItemTemplate: function(req, res){
+        //var data = JSON.parse(req.body.data);
+        rationsData.getRationItemTemplate(function(err, message, rationItem){
+            if (billsItem) {
+                callback(req, res, err, message, rationItem);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    },
+
+    allocIDs: function(req, res){
+        rationsData.allocIDs(function(err, message, data){
+            if (err) {
+                callback(req, res, err, message, data);
+            } else {
+                callback(req, res, err, message, null);
+            }
+        });
+    }
+
+};

+ 8 - 0
modules/main/db/project_db.js

@@ -0,0 +1,8 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var dbm = require("../../../config/db/db_manager");
+var db = dbm.getCfgConnection("scConstruct");
+
+module.exports = db;

+ 102 - 0
modules/main/models/bills.js

@@ -0,0 +1,102 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var db = require("../db/project_db");
+var subSchema = require("./billsSubSchemas");
+var Schema = mongoose.Schema;
+var counter = require("../../../public/counter/counter.js");
+
+var billsSchema = new Schema({
+    id: Number,
+    parentId: Number,
+    nextSiblingId: Number,
+    projectId: Number,
+    serialNo: Number,
+    chapterId: Number,
+    code: String,
+    fullCode: String,
+    name: String,
+    unit: String,
+    quantity: String, // Decimal
+    programId: Number,
+    comments: String,
+    // 调价
+    xs_Labour: String, // Decimal
+    xs_Material: String, // Decimal
+    xs_Machine: String, // Decimal
+    xs_FeeRate: String, // Decimal
+    xs_LabourPrice: String, // Decimal
+    xs_MaterialPrice: String, // Decimal
+    xs_MachinePrice: String, // Decimal
+    isTender_Labour: Boolean,
+    isTender_Material: Boolean,
+    isTender_Machine: Boolean,
+    tenderTargetPrice: String, // Decimal
+    tenderTargetUnitPrice: String, // Decimal
+    // 费用字段
+    fees: [subSchema.feesSchema],
+    // 标记字段
+    flags: [subSchema.flagsSchema]
+});
+
+var bills = db.model("bills", billsSchema);
+
+var billsDAO = function(){};
+
+billsDAO.prototype.getBills = function(projectId, callback){
+    Projects.find({projectId: projectId}, function(err, datas){
+        if (!err) {
+            callback(0, '', datas);
+        } else {
+            callback(1, '', null);
+        };
+    });
+};
+
+billsDAO.prototype.updateBills = function(datas, callback){
+    var data, errList = [], updateLength = 0;
+    var updateFunc = function (err, errData) {
+        if (err){
+            errList.push(errData);
+        };
+    };
+    if (datas){
+        for (var i = 0; i < datas.length; i++){
+            data = datas[i];
+            if (data.updateType === 'update') {
+                delete data.updateType;
+                data.save(updateFunc);
+            } else if (data.updateType === 'create') {
+                delete data.updateType;
+                data.save(updateFunc);
+            } else if (data.updateType === 'delete') {
+                delete data.updateType;
+                data.remove(updateFunc);
+            };
+        };
+        if (errList.length > 0){
+            callback(1, 'update error.', errList);
+        } else {
+            callback(0, '', null);
+        };
+    };
+};
+
+billsDAO.prototype.getBillsItemTemplate = function(callback){
+    var data = new bills;
+    /* to do: 需要根据标准配置库填充fees和flags字段,是否需要更多的参数? */
+    callback(0, '', data);
+};
+
+const
+    IDStep = 50, IDModule = 'bills';
+
+billsDAO.prototype.allocIDs = function(callback){
+    var lowID, highID;
+    counter.getIDAfterCount(IDModule, IDStep, function(highID, err){});
+    lowID = highID - IDStep + 1;
+    callback(0, '', {lowID, highID});
+};
+
+module.exports = new billsDAO();

+ 3 - 0
modules/main/models/billsExprs.js

@@ -0,0 +1,3 @@
+/**
+ * Created by jimiz on 2017/4/10.
+ */

+ 22 - 0
modules/main/models/billsSubSchemas.js

@@ -0,0 +1,22 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var Schema = mongoose.Schema;
+
+// 费用字段
+var feesSchema = new Schema({
+    fieldName: String,
+    unitFee: String, // Decimal. 单价
+    totalFee: String, // Decimal. 合价
+    tenderUnitFee: String, // Decimal. 调价后单价
+    tenderTotalFee: String // Decimal. 调价后合价
+});
+
+// 标记字段
+var flagsSchema = new Schema({
+    fieldName: String,
+    flag: Boolean
+});
+
+module.exports = {feesSchema, flagsSchema};

+ 3 - 0
modules/main/models/expressions.js

@@ -0,0 +1,3 @@
+/**
+ * Created by jimiz on 2017/4/10.
+ */

+ 24 - 0
modules/main/models/gljs.js

@@ -0,0 +1,24 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var db = require("../db/project_db");
+var Schema = mongoose.Schema;
+
+var gljSchema = new Schema({
+    id: Number,
+    projectID: Number,
+    orgRQuantity: String, //Decimal
+    rQuantity: String, //Decimal
+    customQuantity: String, //Decimal
+    quantity: String, //Decimal
+    rationItemQuantity: String, //Decimal
+    rationPrice: String, //Decimal
+    adjustPrice: String, //Decimal
+    price: String, //Decimal
+    tenderQuantity: String, //Decimal
+    tenderPrice: String, //Decimal
+    type: Number
+    // to do
+
+});

+ 21 - 0
modules/main/models/projectGLJ.js

@@ -0,0 +1,21 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var db = require("../db/project_db");
+var Schema = mongoose.Schema;
+
+var projectGLJSchema = new Schema({
+    id: Number,
+    projectId: Number,
+    code: Number,
+    name: String,
+    specs: String,
+    unit: String,
+    type: String,
+    amount: String, // Decimal
+    rationPrice: String, //Decimal
+    adjustPrice: String, //Decimal
+    price: String //Decimal
+    // to do
+});

+ 25 - 0
modules/main/models/rationPrograms.js

@@ -0,0 +1,25 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var db = require("../db/project_db");
+var Schema = mongoose.Schema;
+
+var rationProgramSchema = new Schema({
+    id: Number,
+    projectId: Number,
+    name: String,
+    programs: [{
+        id: Number,
+        serialNo: Number,
+        code: String,
+        name: String,
+        expression: String, // 表达式
+        displayExprs: String, // 显示用表达式/基数说明
+        feeRate: String, // Decimal
+        tenderFeeRate: String, // Decimal
+        feeRateID: Number, // 费率细目ID
+        mapField: String, // 对应定额表字段
+        comments: String // 备注
+    }]
+});

+ 89 - 0
modules/main/models/rations.js

@@ -0,0 +1,89 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var db = require("../db/project_db");
+var subSchema = require("./billsSubSchemas");
+var Schema = mongoose.Schema;
+
+var rationsSchema = new Schema({
+    id: Number,
+    projectId: Number,
+    billsItemId: Number,
+    serialNo: Number,
+    libID: Number,
+    code: String,
+    name: String,
+    maskName: String,
+    unit: String,
+    quantity: String, // Decimal
+    programId: Number,
+    content: String,
+    rationProjName: String,
+    comments: String,
+    // 费用字段
+    fees: [subSchema.feesSchema],
+    // 标记字段
+    flags: [subSchema.flagsSchema]
+});
+
+var rations = db.model("rations", rationsSchema);
+
+var rationsDAO = function(){};
+
+rationsDAO.prototype.getRations = function(projectId, callback){
+    Projects.find({projectID: projectId}, function(err, datas){
+        if (!err) {
+            callback(0, '', datas);
+        } else {
+            callback(1, '', null);
+        }
+    });
+};
+
+rationsDAO.prototype.updateRations = function(projectId, datas, callback){
+    var data, errList = [], updateLength = 0;
+    var updateFunc = function (err, errData) {
+        if (err){
+            errList.push(errData);
+        };
+    };
+    if (datas){
+        for (var i = 0; i < datas.length; i++){
+            data = datas[i];
+            if (data.updateType === 'update') {
+                delete data.updateType;
+                data.save(updateFunc);
+            } else if (data.updateType === 'create') {
+                delete data.updateType;
+                data.save(updateFunc);
+            } else if (data.updateType === 'delete') {
+                delete data.updateType;
+                data.remove(updateFunc);
+            };
+        };
+        if (errList.length > 0){
+            callback(1, 'update error.', errList);
+        } else {
+            callback(0, '', null);
+        };
+    };
+};
+
+rationsDAO.prototype.getRationItemTemplate = function(callback){
+    var data = new rations;
+    /* to do: 需要根据标准配置库填充fees和flags字段,是否需要更多的参数? */
+    callback(0, '', data);
+};
+
+const
+    IDStep = 50, IDModule = 'rations';
+
+rationsDAO.prototype.allocIDs = function(callback){
+    var lowID, highID;
+    counter.getIDAfterCount(IDModule, IDStep, function(highID, err){});
+    lowID = highID - IDStep + 1;
+    callback(0, '', {lowID, highID});
+};
+
+module.exports = new rationsDAO();

+ 13 - 0
modules/main/routes/bills_route.js

@@ -0,0 +1,13 @@
+/**
+ * Created by jimiz on 2017/4/7.
+ */
+var express = require('express');
+var billsRouter = express.Router();
+var billsController = require('../controllers/bills_controller');
+
+billsRouter.post('/getBills', billsController.getBills);
+billsRouter.post('/updateBills', billsController.updateBills);
+billsRouter.post('/getBillsItemTemplate', billsController.getBillsItemTemplate);
+billsRouter.post('/allocIDs', billsController.allocIDs);
+
+module.exports = billsRouter;

+ 13 - 0
modules/main/routes/rations_route.js

@@ -0,0 +1,13 @@
+/**
+ * Created by jimiz on 2017/4/7.
+ */
+var express = require('express');
+var rationsRouter = express.Router();
+var rationsController = require('../controllers/rations_controller');
+
+rationsRouter.post('/getRations', rationsController.getRations);
+rationsRouter.post('/updateRations', rationsController.updateRations);
+rationsRouter.post('/getRationsItemTemplate', rationsController.getRationItemTemplate);
+rationsRouter.post('/allocIDs', rationsController.allocIDs);
+
+module.exports = rationsRouter;

+ 125 - 9
modules/reports/util/rpt_excel_util.js

@@ -46,7 +46,7 @@ function writeApp(sheets) {
     rst.push('<ScaleCrop>false</ScaleCrop>');
     rst.push('<HeadingPairs>');
     rst.push('<vt:vector size="2" baseType="variant">');
-    rst.push('<vt:variant><vt:lpstr>工作</vt:lpstr></vt:variant>');
+    rst.push('<vt:variant><vt:lpstr>工作�?</vt:lpstr></vt:variant>');
     rst.push('<vt:variant><vt:i4>' + sheets.length + '</vt:i4></vt:variant>');
     rst.push('</vt:vector>');
     rst.push('</HeadingPairs>');
@@ -79,7 +79,7 @@ function writeCore() {
     rst.push('<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">');
     rst.push('<dc:creator>SmartCost</dc:creator>');
     rst.push('<cp:lastModifiedBy>SmartCost</cp:lastModifiedBy>');
-    var dt = new Date(), dtStr = dt.getFullYear() + '-' + p_fillZero(dt.getMonth()) + '-' + p_fillZero(dt.getDate()) + 'T' +
+    var dt = new Date(), dtStr = dt.getFullYear() + '-' + p_fillZero(dt.getMonth()+1) + '-' + p_fillZero(dt.getDate()) + 'T' +
         p_fillZero(dt.getHours()) + ':' + p_fillZero(dt.getMinutes()) + ':' + p_fillZero(dt.getSeconds()) + 'Z';
     rst.push('<dcterms:created xsi:type="dcterms:W3CDTF">' + dtStr + '</dcterms:created>');
     rst.push('<dcterms:modified xsi:type="dcterms:W3CDTF">' + dtStr + '</dcterms:modified>');
@@ -122,10 +122,10 @@ function writeXlRels(sheets){
     return rst;
 }
 function writeTheme(){
-    var rst = fs.readFileSync('./excel_base_files/theme1.xml', 'utf8', 'r');
+    var rst = fs.readFileSync(__dirname + '/excel_base_files/theme1.xml', 'utf8', 'r');
     return rst;
 }
-function writeStyles(styleList){
+function writeStyles(stylesObj){
     //
 }
 function writeSharedString(sharedStrList){
@@ -140,14 +140,14 @@ function writeSharedString(sharedStrList){
     }
     return rst;
 }
-function writeSheets(pageData, sharedStrList, styleList){
+function writeSheets(pageData, sharedStrList, stylesObj){
     var rst = [];
     for (var i = 0; i < pageData.items.length; i++) {
-        rst.push(writeSheet(pageData.items[i], sharedStrList, styleList));
+        rst.push(writeSheet(pageData.items[i], sharedStrList, stylesObj));
     }
     return rst;
 }
-function writeSheet(sheetData, sharedStrList, styleList){
+function writeSheet(sheetData, sharedStrList, stylesObj){
     var rst = [], xPos = [], yPos = [], headerStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     xPos.push(0);
     yPos.push(0);
@@ -209,9 +209,122 @@ function writeSheet(sheetData, sharedStrList, styleList){
         }
         return rst;
     };
+    private_getFontId = function(cell) {
+        var rst = 0, hasFont = false;
+        if (!(stylesObj.fonts)) {
+            stylesObj.fonts = [];
+            //for (var i = 0; i < sheetData.font_collection)
+        }
+        var sheetFont = sheetData.font_collection[cell.font];
+        for (var i = 0; i < stylesObj.fonts.length; i++) {
+            var font = stylesObj.fonts[i];
+            if (sheetFont) {
+                if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)) {
+                    hasFont = true;
+                    rst = i;
+                    break;
+                }
+            } else {
+                break;
+            }
+        }
+        if (!hasFont) {
+            var font = {};
+            font[JV.FONT_PROPS[0]] = sheetFont[JV.FONT_PROPS[0]];
+            font.size = Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4);
+            font.charset = 134;
+            font.scheme = "minor";
+            stylesObj.fonts.push(font);
+            rst = stylesObj.fonts.length - 1;
+        }
+        return rst;
+    };
+    private_checkBorder = function(border, sheetBorder) {
+        var rst = true, borderLineWidths = [], sheetBorderLineWidths = [];
+        borderLineWidths.push(border[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]);
+        borderLineWidths.push(border[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]);
+        borderLineWidths.push(border[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]);
+        borderLineWidths.push(border[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]);
+        if (sheetBorder[JV.PROP_LEFT] && sheetBorder[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]) {
+            sheetBorderLineWidths.push(parseInt(border[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]));
+        } else {
+            sheetBorderLineWidths.push(0);
+        }
+        if (sheetBorder[JV.PROP_RIGHT] && sheetBorder[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]) {
+            sheetBorderLineWidths.push(parseInt(border[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]));
+        } else {
+            sheetBorderLineWidths.push(0);
+        }
+        if (sheetBorder[JV.PROP_TOP] && sheetBorder[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]) {
+            sheetBorderLineWidths.push(parseInt(border[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]));
+        } else {
+            sheetBorderLineWidths.push(0);
+        }
+        if (sheetBorder[JV.PROP_BOTTOM] && sheetBorder[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]) {
+            sheetBorderLineWidths.push(parseInt(border[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]));
+        } else {
+            sheetBorderLineWidths.push(0);
+        }
+        for (var i = 0; i < 4; i++) {
+            if (borderLineWidths[i] != sheetBorderLineWidths[i]) {
+                rst = false;
+                break;
+            }
+        }
+        return rst;
+    };
+    private_getBorderId = function(cell) {
+        var rst = 0, hasBorder = false;
+        if (!(stylesObj.borders)) {
+            stylesObj.borders = [];
+        }
+        var sheetBorder = sheetData.style_collection[cell.style];
+        for (var i = 0; i < stylesObj.borders.length; i++) {
+            var border = stylesObj.borders[i];
+            if (private_checkBorder(border, sheetBorder)) {
+                hasBorder = true;
+                rst = i;
+                break;
+            }
+        }
+        if (!hasBorder) {
+            var border = {};
+            border[JV.PROP_LEFT] = {};
+            border[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT] = 0;
+            border[JV.PROP_RIGHT] = {};
+            border[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT] = 0;
+            border[JV.PROP_TOP] = {};
+            border[JV.PROP_TOP][JV.PROP_LINE_WEIGHT] = 0;
+            border[JV.PROP_BOTTOM] = {};
+            border[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT] = 0;
+            if (sheetBorder && sheetBorder[JV.PROP_LEFT]) {
+                border[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT] = parseInt(sheetBorder[JV.PROP_LEFT][JV.PROP_LINE_WEIGHT]);
+            }
+            if (sheetBorder && sheetBorder[JV.PROP_RIGHT]) {
+                border[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT] = parseInt(sheetBorder[JV.PROP_RIGHT][JV.PROP_LINE_WEIGHT]);
+            }
+            if (sheetBorder && sheetBorder[JV.PROP_TOP]) {
+                border[JV.PROP_TOP][JV.PROP_LINE_WEIGHT] = parseInt(sheetBorder[JV.PROP_TOP][JV.PROP_LINE_WEIGHT]);
+            }
+            if (sheetBorder && sheetBorder[JV.PROP_BOTTOM]) {
+                border[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT] = parseInt(sheetBorder[JV.PROP_BOTTOM][JV.PROP_LINE_WEIGHT]);
+            }
+            stylesObj.borders.push(border);
+            rst = stylesObj.borders.length - 1;
+        }
+        return rst;
+    };
     private_getStyleIdx = function(cell) {
-        var rst = 1;
-        //
+        var rst = 1, hasStyle = false;
+        if (!(stylesObj.cellXfs)) stylesObj.cellXfs = [];
+        for (var i = 0; i < stylesObj.cellXfs.length; i++) {
+            //check font and border
+            var fontId = private_getFontId(cell);
+            var cellStyle = stylesObj.cellXfs[i];
+        }
+        if (!hasStyle) {
+            //add new style
+        }
         return rst;
     };
     private_setCols = function(){
@@ -362,4 +475,7 @@ module.exports = {
     ,testWriteSharedString: function(sharedStrList){
         return writeSharedString(sharedStrList);
     }
+    ,testWriteTheme: function() {
+        return writeTheme();
+    }
 }

+ 0 - 470
public/web/idTree.js

@@ -1,470 +0,0 @@
-/**
- * Created by Mai on 2017/3/17.
- */
-var idTree = {
-    createNew: function (setting) {
-        var _setting = {
-            id: 'id',
-            pid: 'pid',
-            nid: 'nid',
-            rootId: -1
-        };
-
-        var _eventType = {
-            editedData: 'editedData'
-        };
-
-        var tools = {
-            findNode: function (nodes, check) {
-                for (var i = 0; i < nodes.length; i++) {
-                    if (check(nodes[i])) {
-                        return nodes[i];
-                    }
-                }
-                return null;
-            },
-            reSortNodes: function (nodes, recursive) {
-                var temp = [], first;
-                var findFirstNode = function (nodes) {
-                    return tools.findNode(nodes, function (node) {
-                        return node.preSibling === null;
-                    });
-                };
-                var moveNode = function (node, orgArray, newArray, newIndex) {
-                    var next;
-                    orgArray.splice(orgArray.indexOf(node), 1);
-                    newArray.splice(newIndex, 0, node);
-                    if (node.getNextSiblingID() !== -1) {
-                        next = node.nextSibling;
-                        if (next && (orgArray.indexOf(next) >= 0)) {
-                            moveNode(next, orgArray, newArray, newIndex + 1);
-                        }
-                    }
-                };
-                if (nodes.length === 0) {
-                    return nodes;
-                }
-                if (recursive) {
-                    nodes.forEach(function (node) {
-                        node.children = tools.reSortNodes(node.children, recursive);
-                    });
-                }
-                while (nodes.length > 0) {
-                    first = findFirstNode(nodes);
-                    first = first ? first : nodes[0];
-                    moveNode(first, nodes, temp, temp.length);
-                }
-                nodes = null;
-                tools.reSiblingNodes(temp);
-                return temp;
-            },
-            reSiblingNodes: function (nodes) {
-                var i;
-                for (i = 0; i < nodes.length; i++) {
-                    nodes[i].preSibling = (i === 0) ? null : nodes[i - 1];
-                    nodes[i].nextSibling = (i === nodes.length - 1) ? null : nodes[i + 1];
-                }
-            },
-            // ��nodes�У���iIndex����������ʼȫ���Ƴ�
-            removeNodes: function (tree, parent, iIndex, count) {
-                var children = parent ? parent.children : tree.roots;
-                var pre = (iIndex < 0 || iIndex >= children.length) ? null : children[iIndex].preSibling;
-                var next = (pre && iIndex + count - 1 < children.length) ? children[iIndex + count] : null;
-                if (pre) {
-                    pre.nextSibling = next;
-                }
-                if (next) {
-                    next.preSibling = pre;
-                }
-                if (arguments.length === 4) {
-                    children.splice(iIndex, count);
-                } else {
-                    children.splice(iIndex, children.length - iIndex);
-                }
-            },
-            // ��nodes������addNodes, λ�ô�index��ʼ
-            addNodes: function (tree, parent, nodes, iIndex) {
-                var children = parent ? parent.children : tree.roots;
-                var pre, next, i;
-                if (nodes.length === 0) { return; }
-                if (arguments.length === 4) {
-                    pre = (iIndex <= 0 || iIndex > children.length) ? null : children[iIndex - 1];
-                    next = pre ? pre.nextSibling : null;
-                } else if (arguments.length === 3) {
-                    pre = children.length === 0 ? null : children[children.length - 1];
-                    next = null;
-                }
-                if (pre) {
-                    pre.nextSibling = nodes[0];
-                }
-                nodes[0].preSibling = pre;
-                if (next) {
-                    next.preSibling = nodes[nodes.length - 1];
-                }
-                nodes[nodes.length - 1].nextSibling = next;
-                for (i = 0; i < nodes.length; i++) {
-                    if (arguments.length === 4) {
-                        children.splice(iIndex + i, 0, nodes[i]);
-                    } else if (arguments.length === 3) {
-                        children.push(nodes[i]);
-                    }
-                    nodes[i].parent = parent;
-                }
-            },
-            sortTreeItems: function (tree) {
-                var addItems = function (items) {
-                    var i;
-                    for (i = 0; i < items.length; i++) {
-                        tree.items.push(items[i]);
-                        addItems(items[i].children);
-                    }
-                };
-                tree.items.splice(0, tree.items.length);
-                addItems(tree.roots);
-            }
-        };
-
-        var Node = function (tree, data) {
-            // ���µ����ԣ�����Ԫ�������ֱ���޸�
-            this.tree = tree;
-            this.data = data;
-            this.children = [];
-
-            this.parent = null;
-            this.nextSibling = null;
-            this.preSibling = null;
-
-            this.expanded = true;
-            this.visible = true;
-
-            this.visible = true;
-
-            this.isUpdate = false;
-            this.isNew = false;
-        };
-
-        Node.prototype.getID = function () {
-            return this.data[this.tree.setting.id];
-        };
-        Node.prototype.getParentID = function () {
-            return this.parent ? this.parent.getID() : -1;
-        };
-        Node.prototype.getNextSiblingID = function () {
-            return this.nextSibling ? this.nextSibling.getID() : -1;
-        };
-
-        Node.prototype.firstChild = function () {
-            return this.children.length === 0 ? null : this.children[0];
-        };
-        Node.prototype.depth = function () {
-            return this.parent ? this.parent.depth() + 1 : 0;
-        };
-        Node.prototype.isFirst = function () {
-            if (this.parent) {
-                return this.parent.children.indexOf(this) === 0 ? true : false;
-            } else {
-                return this.tree.roots.indexOf(this) === 0 ? true : false;
-            }
-        };
-        Node.prototype.isLast = function () {
-            if (this.parent) {
-                return this.parent.children.indexOf(this) === this.parent.children.length - 1 ? true : false;
-            } else {
-                return this.tree.roots.indexOf(this) === this.tree.roots.length - 1 ? true : false;
-            }
-        };
-        Node.prototype.siblingIndex = function () {
-            return this.parent ? this.parent.children.indexOf(this) : this.tree.roots.indexOf(this);
-        }
-        Node.prototype.posterityCount = function () {
-            var iCount = 0;
-            if (this.children.length !== 0) {
-                iCount += this.children.length;
-                this.children.forEach(function (child) {
-                    iCount += child.posterityCount();
-                });
-            }
-            return iCount;
-            /*return (node.children.length === 0) ? 0 : node.children.reduce(function (x, y) {
-                return x.posterityCount() + y.posterityCount();
-            }) + node.children.count;*/
-        };
-
-        Node.prototype.setExpanded = function (expanded) {
-            var setNodesVisible = function (nodes, visible) {
-                nodes.forEach(function (node) {
-                    node.visible = visible;
-                    setNodesVisible(node.children, visible && node.expanded);
-                })
-            };
-            this.expanded = expanded;
-            setNodesVisible(this.children, expanded);
-        };
-        /*Node.prototype.vis = function () {
-            return this.parent ? this.parent.vis() && this.parent.expanded() : true;
-        };*/
-        Node.prototype.serialNo = function () {
-            return this.tree.items.indexOf(this);
-        }
-        /*Node.prototype.serialNo = function () {
-            if (this.preSibling) {
-                return this.preSibling.serialNo() + this.preSibling.posterityCount() + 1;
-            } else if (this.parent) {
-                return this.parent.serialNo() + 1;
-            } else {
-                return 0;
-            }
-        };*/
-
-        Node.prototype.addChild = function (node) {
-            var preSibling = this.children.length === 0 ? null : this.children[this.children.length - 1];
-            node.parent = this;
-            if (preSibling) {
-                preSibling.nextSibling = node;
-            }
-            node.preSibling = preSibling;
-            this.children.push(node);
-        };
-        Node.prototype.removeChild = function (node) {
-            var preSibling = node.preSibling, nextSibling = node.nextSibling;
-            if (preSibling) {
-                preSibling.nextSibling = nextSibling;
-            }
-            if (nextSibling) {
-                nextSibling.preSibling = preSibling;
-            }
-            this.children.splice(this.children.re)
-        };
-
-        Node.prototype.canUpLevel = function () {
-            return this.parent ? true : false;
-        };
-        Node.prototype.canDownLevel = function () {
-            return !this.isFirst();
-        };
-        Node.prototype.canUpMove = function () {
-            return !this.isFirst();
-        };
-        Node.prototype.canDownMove = function () {
-            return !this.isLast();
-        }
-
-        Node.prototype.upLevel = function () {
-            var success = false,
-                iIndex = this.parent.children.indexOf(this), orgParent = this.parent, newNextSibling = this.parent.nextSibling;
-            if (this.canUpLevel) {
-                // NextSiblings become child
-                tools.addNodes(this.tree, this, this.parent.children.slice(iIndex + 1));
-                // Orginal Parent remove node and nextSiblings
-                tools.removeNodes(this.tree, this.parent, iIndex);
-                // New Parent add node
-                tools.addNodes(this.tree, this.parent.parent, [this], this.parent.siblingIndex() + 1);
-                if (!this.expanded) {
-                    this.setExpanded(true);
-                }
-                success = true;
-            }
-            return success;
-        };
-        Node.prototype.downLevel = function () {
-            var success = false, iIndex = this.parent ? this.parent.children.indexOf(this) : this.tree.roots.indexOf(this);
-            var newParent = this.preSibling;
-            if (this.canDownLevel()) {
-                tools.removeNodes(this.tree, this.parent, this.siblingIndex(), 1);
-                tools.addNodes(this.tree, this.preSibling, [this]);
-                if (!newParent.expanded) {
-                    newParent.setExpanded(true);
-                }
-                success = true;
-            }
-            return success;
-        };
-        Node.prototype.upMove = function () {
-            var success = false;
-            var iIndex = this.siblingIndex(), belongArray = this.parent ? this.parent.children : this.tree.roots, orgPre = this.preSibling;
-            if (this.canUpMove()) {
-                orgPre.nextSibling = this.nextSibling;
-                this.preSibling = orgPre.preSibling;
-                orgPre.preSibling = this;
-                this.nextSibling = orgPre;
-                belongArray.splice(iIndex, 1);
-                belongArray.splice(iIndex - 1, 0, this);
-                tools.sortTreeItems(this.tree);
-                success = true;
-            }
-            return success;
-        };
-        Node.prototype.downMove = function () {
-            var success = false;
-            var iIndex = this.siblingIndex(), belongArray = this.parent ? this.parent.children : this.tree.roots, orgNext = this.nextSibling;
-            if (this.canDownMove()) {
-                orgNext.preSibling = this.preSibling;
-                this.nextSibling = orgNext.nextSibling;
-                orgNext.nextSibling = this;
-                this.preSibling = orgNext;
-                belongArray.splice(iIndex, 1);
-                belongArray.splice(iIndex + 1, 0, this);
-                tools.sortTreeItems(this.tree);
-                success = true;
-            }
-            return success;
-        }
-
-        var Tree = function (setting) {
-            this.nodes = {};
-            this.roots = [];
-            this.items = [];
-            this.setting = setting;
-            this.prefix = 'id_';
-            this.selected = null;
-
-            this.event = {};
-            this.eventType = _eventType;
-        };
-
-        Tree.prototype.maxNodeID = (function () {
-            var maxID = 0;
-            return function (ID) {
-                if (arguments.length === 0) {
-                    return maxID;
-                } else {
-                    maxID = Math.max(maxID, ID);
-                }
-            };
-        })();
-        Tree.prototype.rangeNodeID = (function () {
-            var rangeID = -1;
-            return function (ID) {
-                if (arguments.length === 0) {
-                    return rangeID;
-                } else {
-                    rangeID = Math.max(rangeID, ID);
-                }
-            }
-        })();
-        Tree.prototype.newNodeID = function () {
-            if (this.rangeNodeID() === -1) {
-                return this.maxNodeID() + 1;
-            } else {
-                if (this.maxNodeID() >= this.rangeNodeID()) {
-                    return this.maxNodeID() + 1;
-                } else {
-                    return -1;
-                }
-            }
-            /*if (this.maxID >= this.rangeNodeID() || this.rangeNodeID === -1) {
-                return -1;
-            } else {
-                return this.maxNodeID() + 1;
-            }*/
-        };
-
-        Tree.prototype.loadDatas = function (datas) {
-            var prefix = this.prefix, i, node, parent, next, that = this;
-            // prepare index
-            datas.forEach(function (data) {
-                var node = new Node(that, data);
-                that.nodes[prefix + data[that.setting.id]] = node;
-                that.maxNodeID(data[that.setting.id]);
-            });
-            // set parent by pid, set nextSibling by nid
-            datas.forEach(function (data) {
-                node = that.nodes[prefix + data[that.setting.id]];
-                if (data[that.setting.pid] === that.setting.rootId) {
-                    that.roots.push(node);
-                } else {
-                    parent = that.nodes[prefix + data[that.setting.pid]];
-                    if (parent) {
-                        node.parent = parent;
-                        parent.children.push(node);
-                    }
-                }
-                if (data[that.setting.nid] !== that.setting.rootId) {
-                    next = that.nodes[prefix + data[that.setting.nid]];
-                    if (next) {
-                        node.nextSibling = next;
-                        next.preSibling = node;
-                    }
-                }
-            })
-            // sort by nid
-            this.roots = tools.reSortNodes(this.roots, true);
-            tools.sortTreeItems(this);
-        };
-        Tree.prototype.firstNode = function () {
-            return this.roots.length === 0 ? null : this.roots[0];
-        };
-        Tree.prototype.findNode = function (id) {
-            return this.nodes[this.prefix + id];
-        };
-        Tree.prototype.count = function () {
-            var iCount = 0;
-            if (this.roots.length !== 0) {
-                iCount += this.roots.length;
-                this.roots.forEach(function (node) {
-                    iCount += node.posterityCount();
-                });
-            }
-            return iCount;
-        };
-
-        Tree.prototype.insert = function (parentID, nextSiblingID) {
-            var newID = this.newNodeID(), node = null, data = {};
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
-            if (newID !== -1) {
-                data = {};
-                data[this.setting.id] = newID;
-                data[this.setting.pid] = parentID;
-                data[this.setting.nid] = nextSiblingID;
-                node = new Node(this, data);
-                if (nextSibling) {
-                    tools.addNodes(this, parent, [node], nextSibling.siblingIndex());
-                } else {
-                    tools.addNodes(this, parent, [node]);
-                }
-                this.nodes[this.prefix + newID] = node;
-                tools.sortTreeItems(this);
-                this.maxNodeID(newID);
-            }
-            return node;
-        };
-        Tree.prototype.delete = function (node) {
-            var success = false;
-            if (node) {
-                delete this.nodes[this.prefix + node.getID()];
-                if (node.preSibling) {
-                    node.preSibling.nextSibling = node.nextSibling;
-                }
-                if (node.nextSibling) {
-                    node.nextSibling.preSibling = node.preSibling;
-                }
-                if (node.parent) {
-                    node.parent.children.splice(node.siblingIndex(), 1);
-                } else {
-                    this.roots.splice(node.siblingIndex(), 1);
-                }
-                tools.sortTreeItems(this);
-                success = true;
-            }
-            return success;
-        };
-        //willdel
-     /*   Tree.prototype.editedData = function (field, id, newText) {
-            var node = this.findNode(id), result = {allow: false, nodes: []};
-            if (this.event[this.eventType.editedData]) {
-                return this.event[this.eventType.editedData](field, node.data);
-            } else {
-                node.data[field] = newText;
-                result.allow = true;
-                return result;
-            }
-        };*/
-
-        Tree.prototype.bind = function (eventName, eventFun) {
-            this.event[eventName] = eventFun;
-        };
-
-        return new Tree(setting);
-    }
-};

+ 0 - 133
public/web/tree_sheet_controller.js

@@ -1,133 +0,0 @@
-/**
- * Created by Mai on 2017/4/1.
- */
-
-var TREE_SHEET_CONTROLLER = {
-    createNew: function (tree, sheet, setting) {
-        var controller = function () {
-            this.tree = tree;
-            this.sheet = sheet;
-            this.setting = setting;
-            this.event = {
-                treeSelectedChanged: null
-            }
-        };
-
-        controller.prototype.showTreeData = function () {
-            var that = this;
-            TREE_SHEET_HELPER.loadSheetHeader(this.setting, this.sheet);
-            TREE_SHEET_HELPER.showTreeData(this.setting, this.sheet, this.tree);
-
-            this.sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e, info) {
-                that.tree.selected = that.tree.findNode(info.sheet.getTag(info.newSelections[0].row, info.newSelections[0].col));
-                if (that.event.treeSelectedChanged) {
-                    that.event.treeSelectedChanged(that.tree.selected);
-                }
-            });
-            //willdel
-           /* this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, function (sender, args) {
-                if(args.sheet.getTag(args.row, args.col)){
-                    var result = tree.editedData(setting.cols[args.col].data.field, args.sheet.getTag(args.row, args.col), args.editingText);
-
-                    if (result.allow) {
-                        TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, result.nodes, false);
-                    } else {
-                        TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [tree.findNode(args.sheet.getTag(args.row, args.col))], false);
-                    };
-                }
-                else {
-                    args.sheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).text('');
-                }
-            });*/
-        };
-
-        controller.prototype.insert = function () {
-            var newNode = null, that = this;
-            if (this.tree) {
-                if (this.tree.selected) {
-                    newNode = this.tree.insert(this.tree.selected.getParentID(), this.tree.selected.getNextSiblingID());
-                } else {
-                    newNode = this.tree.insert();
-                }
-                if (newNode) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
-                        var sels = that.sheet.getSelections();
-                        var iRow = sels[0].row, newNodeRow = that.tree.selected ? iRow + that.tree.selected.posterityCount() + 1 : iRow;
-                        that.sheet.addRows(newNodeRow, 1);
-                        TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [newNode], false);
-                        that.tree.selected = newNode;
-                        that.sheet.setSelection(newNode.serialNo(), sels[0].col, 1, 1);
-                        that.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center)
-                    })
-                }
-            }
-        };
-        controller.prototype.delete = function () {
-            var that = this;
-            if (this.tree.selected) {
-                if (this.tree.delete(this.tree.selected)) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
-                        var sels = that.sheet.getSelections();
-                        var iRow = sels[0].row;
-                        that.sheet.deleteRows(iRow, that.tree.selected.posterityCount() + 1);
-                        that.tree.selected = that.tree.findNode(that.sheet.getTag(iRow, 0, GC.Spread.Sheets.SheetArea.viewport));
-                    });
-                }
-            }
-        };
-        controller.prototype.upLevel = function () {
-            var that = this;
-            if (this.tree.selected) {
-                if (this.tree.selected.upLevel()) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
-                        TREE_SHEET_HELPER.refreshNodesVisible([that.tree.selected], that.sheet, true);
-                        that.sheet.showRow(that.tree.selected.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
-                    });
-                }
-            }
-        };
-        controller.prototype.downLevel = function () {
-            var that = this;
-            if (this.tree.selected) {
-                if (this.tree.selected.downLevel()) {
-                    TREE_SHEET_HELPER.massOperationSheet(that.sheet, function () {
-                        TREE_SHEET_HELPER.refreshNodesVisible([that.tree.selected.parent], that.sheet, true);
-                        that.sheet.showRow(that.tree.selected.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
-                    });
-                }
-            }
-        };
-        controller.prototype.upMove = function () {
-            var that = this;
-            if (this.tree.selected) {
-                if (this.tree.selected.upMove()) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
-                        var sels = that.sheet.getSelections();
-                        var iRow = sels[0].row;
-                        TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [that.tree.selected, that.tree.selected.nextSibling], true);
-                        that.sheet.setSelection(that.tree.selected.serialNo(), sels[0].col, 1, 1);
-                    });
-                }
-            }
-        };
-        controller.prototype.downMove = function () {
-            var that = this;
-            if (this.tree.selected) {
-                if (this.tree.selected.downMove()) {
-                    TREE_SHEET_HELPER.massOperationSheet(this.sheet, function () {
-                        var sels = that.sheet.getSelections();
-                        var iRow = sels[0].row;
-                        TREE_SHEET_HELPER.refreshTreeNodeData(that.setting, that.sheet, [that.tree.selected, that.tree.selected.preSibling], true);
-                        that.sheet.setSelection(that.tree.selected.serialNo(), sels[0].col, 1, 1);
-                    });
-                }
-            }
-        };
-
-        controller.prototype.bind = function (eventName, eventFun) {
-            this.event[eventName] = eventFun;
-        };
-
-        return new controller();
-    }
-};

+ 5 - 0
server.js

@@ -66,6 +66,11 @@ app.get('/main',  function(req, res) {
     }
 });
 
+var bills_Router = require('./modules/main/routes/bills_route');
+var rations_Router = require('./modules/main/routes/rations_route');
+app.use('/bills', bills_Router);
+app.use('/rations', rations_Router);
+
 var rpt_Router = require("./modules/reports/routes/report_router");
 app.get('/report',  function(req, res) {
     if (!req.session.userAccount) {

+ 6 - 0
test/unit/excel_export/rpt_excel_export_test.js

@@ -42,5 +42,11 @@ test('check excel output', function(t){
     var sharedStr = rpt_xl_util.testWriteSharedString(sharedStrList);
     fsUtil.writeArrayToFile(sharedStr, '../../../tmp/sharedStrings.xml');
     t.pass('pass shared string');
+    var theme = rpt_xl_util.testWriteTheme();
+    //console.log(theme);
+    var themeArr = [];
+    themeArr.push(theme)
+    fsUtil.writeArrayToFile(themeArr, '../../../tmp/theme1.xml');
+    t.pass('pass theme');
     t.end();
 });

+ 9 - 7
web/main/html/main.html

@@ -515,6 +515,7 @@
     <script type="text/javascript" src="lib/ztree/jquery.ztree.excheck.js"></script>
     <!-- SpreadJs -->
     <script type="text/javascript" src="lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
+    <script>GC.Spread.Sheets.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";</script>
     <!-- Model -->
     <script type="text/javascript" src="web/main/js/models/project.js"></script>
     <script type="text/javascript" src="web/main/js/models/bills.js"></script>
@@ -619,9 +620,10 @@
         project.Rations.loadDatas(drawing_data);
         project.mainTree.loadDatas(project.Bills.tree, project.Rations.datas);
 
-        controller = TREE_SHEET_CONTROLLER.createNew(project.mainTree, billsSpread.getActiveSheet(), BillsGridSetting);
+        //controller = TREE_SHEET_CONTROLLER.createNew(project.mainTree, billsSpread.getActiveSheet(), BillsGridSetting);
+        controller = TREE_SHEET_CONTROLLER.createNew(project.Bills.tree, billsSpread.getActiveSheet(), BillsGridSetting);
         controller.showTreeData();
-        controller.bind('treeSelectedChanged', function (selected) {
+        controller.bind('refreshBaseActn', function (tree) {
             var showButton = function (show, btn) {
                 if (show) {
                     btn.show();
@@ -629,11 +631,11 @@
                     btn.hide();
                 }
             };
-            showButton(selected && selected.canUpLevel(), $('#upLevel'));
-            showButton(selected && selected.canDownLevel(), $('#downLevel'));
-            showButton(selected && selected.canUpMove(), $('#upMove'));
-            showButton(selected && selected.canDownMove(), $('#downMove'));
-            showButton(selected ? true : false, $('#delete'));
+            showButton(tree.selected && tree.selected.canUpLevel(), $('#upLevel'));
+            showButton(tree.selected && tree.selected.canDownLevel(), $('#downLevel'));
+            showButton(tree.selected && tree.selected.canUpMove(), $('#upMove'));
+            showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
+            showButton(tree.selected ? true : false, $('#delete'));
         });
 
         $('#insert').click(function () {

+ 3 - 0
web/main/js/models/cache_tree.js

@@ -3,6 +3,9 @@
  */
 var cacheTree = {
     createNew: function (owner) {
+        var _eventType = {
+            afterSelectedChanged: 'afterSelectedChanged'
+        };
         var tools = {
             findNode: function (nodes, check) {
                 for (var i = 0; i < nodes.length; i++) {