فهرست منبع

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang 8 سال پیش
والد
کامیت
fc3a9c6e61
39فایلهای تغییر یافته به همراه943 افزوده شده و 447 حذف شده
  1. 2 1
      modules/glj/controllers/glj_controller.js
  2. 4 8
      modules/glj/models/glj_list_model.js
  3. 7 0
      modules/glj/models/schemas/glj.js
  4. 0 7
      modules/glj/models/schemas/unit_price.js
  5. 18 0
      modules/glj/models/unit_price_file_model.js
  6. 1 3
      modules/glj/models/unit_price_model.js
  7. 3 0
      modules/main/models/bills.js
  8. 37 14
      modules/pm/controllers/pm_controller.js
  9. 74 20
      modules/pm/models/project_model.js
  10. 1 0
      modules/pm/routes/pm_route.js
  11. 8 6
      modules/ration_glj/facade/glj_calculate_facade.js
  12. 1 1
      modules/ration_glj/facade/quantity_detail_facade.js
  13. 2 0
      modules/ration_repository/models/ration_section_tree.js
  14. 2 0
      public/calc_util.js
  15. 59 0
      public/web/sheet/sheet_data_helper.js
  16. 4 0
      public/web/tree_sheet/tree_sheet_controller.js
  17. 75 1
      public/web/tree_sheet/tree_sheet_helper.js
  18. 3 1
      test/tmp_data/bills_grid_setting.js
  19. 2 0
      web/building_saas/complementary_glj_lib/js/sheetOpr.js
  20. 0 4
      web/building_saas/js/global.js
  21. 12 15
      web/building_saas/main/html/calc_program_manage.html
  22. 6 8
      web/building_saas/main/html/main.html
  23. 20 4
      web/building_saas/main/js/calc/calc_fees.js
  24. 4 0
      web/building_saas/main/js/models/bills.js
  25. 168 168
      web/building_saas/main/js/models/calc_program.js
  26. 16 10
      web/building_saas/main/js/views/calc_program_manage.js
  27. 16 13
      web/building_saas/main/js/views/character_content_view.js
  28. 1 1
      web/building_saas/main/js/views/glj_view.js
  29. 8 0
      web/building_saas/main/js/views/project_view.js
  30. 35 1
      web/building_saas/main/js/views/std_bills_lib.js
  31. 37 28
      web/building_saas/main/js/views/sub_view.js
  32. 92 66
      web/building_saas/pm/html/project-management.html
  33. 205 54
      web/building_saas/pm/js/pm_main.js
  34. 5 1
      web/glj/html/glj_index.html
  35. 1 1
      web/glj/html/header.html
  36. 3 2
      web/glj/js/common_spread.js
  37. 3 2
      web/glj/js/composition_spread.js
  38. 2 0
      web/glj/js/project_glj.js
  39. 6 7
      web/glj/js/project_glj_spread.js

+ 2 - 1
modules/glj/controllers/glj_controller.js

@@ -60,7 +60,8 @@ class GLJController extends BaseController {
                 ownCompositionTypes: gljListModel.ownCompositionTypes,
                 hostname: request.hostname,
                 roomId: unitPriceFileId,
-                GLJTypeConst: JSON.stringify(GLJTypeConst)
+                GLJTypeConst: JSON.stringify(GLJTypeConst),
+                userID: request.session.sessionUser.ssoId,
             };
             response.render('glj/html/glj_index', renderData);
         } catch (error) {

+ 4 - 8
modules/glj/models/glj_list_model.js

@@ -412,7 +412,6 @@ class GLJListModel extends BaseModel {
         // 查找对应组成物的项目工料机数据
         let [projectGljList, compositionList] = await this.getCompositionGLJList(code, projectId, 'name');
 
-
         // 整理配合比待插入数据
         let mixRatioInsertData = [];
         for (let tmp of compositionList) {
@@ -434,7 +433,6 @@ class GLJListModel extends BaseModel {
         if (!addMixRatioResult) {
             throw '组成物插入单价数据失败!';
         }
-
         // 如果已经存在则后续操作停止
         if(projectGljList.length === compositionList.length) {
             return;
@@ -456,11 +454,10 @@ class GLJListModel extends BaseModel {
         if (notInGLJId.length <= 0) {
             return;
         }
-
         // 查找对应工料机总库数据
         let stdRationLibGLJListModel = new STDRationLibGLJListModel();
         let stdGLJData = await stdRationLibGLJListModel.getDataById(notInGLJId);
-        if (stdGLJData === null) {
+        if (stdGLJData === null || stdGLJData.length <= 0) {
             throw '没有找到对应的工料机总库数据';
         }
 
@@ -480,7 +477,9 @@ class GLJListModel extends BaseModel {
                 glj_id: tmp.ID,
                 project_id: projectId,
                 code: tmp.code,
-                name: tmp.name
+                name: tmp.name,
+                specs: tmp.specs,
+                unit: tmp.unit,
             };
             gljInsertData.push(gljData);
 
@@ -491,8 +490,6 @@ class GLJListModel extends BaseModel {
                 market_price: tmp.basePrice,
                 code: tmp.code,
                 name: tmp.name,
-                specs: tmp.specs,
-                unit: tmp.unit,
                 unit_price_file_id: unitPriceFileId,
                 // 如果没有对应的工料机类型则默认设置为普通材料
                 type: gljType[tmp.gljDistType] !== undefined ? gljType[tmp.gljDistType] : GLJTypeConst.GENERAL_MATERIAL
@@ -526,7 +523,6 @@ class GLJListModel extends BaseModel {
         try {
             // 查找对应的项目工料机数据
             let projectGLJData = await this.getDataById(projectGLJId);
-
             let allowType = [GLJTypeConst.MIX_RATIO, GLJTypeConst.CONCRETE, GLJTypeConst.MORTAR,
                 GLJTypeConst.GENERAL_MACHINE];
 

+ 7 - 0
modules/glj/models/schemas/glj.js

@@ -62,6 +62,13 @@ let modelSchema = {
         type: Number,
         default: 1
     },
+    // 规格型号
+    specs: {
+        type: String,
+        default: ''
+    },
+    // 单位
+    unit: String,
     // 显示调整基价
     adjust_price: Number,
     // 显示关联单价文件的字段

+ 0 - 7
modules/glj/models/schemas/unit_price.js

@@ -26,13 +26,6 @@ let modelSchema = {
         type: String,
         index: true
     },
-    // 规格型号
-    specs: {
-        type: String,
-        default: ''
-    },
-    // 单位
-    unit: String,
     // 类型
     type: Number,
     // 单价文件表id

+ 18 - 0
modules/glj/models/unit_price_file_model.js

@@ -107,6 +107,24 @@ class UnitPriceFileModel extends BaseModel {
         let result = await this.db.create(data);
         return result;
     }
+
+    /**
+     * 根据单位工程获取对应单价文件
+     *
+     * @param {Array} idList
+     * @return {Promise|Array}
+     */
+    async getDataByTenderId(idList) {
+        let result = [];
+        if (idList.length <= 0) {
+            return result;
+        }
+
+        let condition = {project_id: {$in: idList}};
+        result = await this.findDataByCondition(condition, null, false);
+
+        return result;
+    }
 }
 
 export default UnitPriceFileModel;

+ 1 - 3
modules/glj/models/unit_price_model.js

@@ -83,7 +83,7 @@ class UnitPriceModel extends BaseModel {
             return [null, false];
         }
 
-        // 先查找是否有同code的单价记录 @todo 后续可能会加入单位这个字段进一步确定唯一性
+        // 先查找是否有同code的单价记录
         let unitPriceData = await this.findDataByCondition({code: data.code, unit_price_file_id: unitPriceFileId}, null, false);
 
         // 如果有记录,判断是否存在一样的市场单价,有则直接返回数据
@@ -98,7 +98,6 @@ class UnitPriceModel extends BaseModel {
             let firstUnitPrice = unitPriceData[0] !== undefined ? unitPriceData[0] : [];
             data.base_price = firstUnitPrice.base_price !== undefined ? firstUnitPrice.base_price : 0;
             data.type = firstUnitPrice.type !== undefined ? firstUnitPrice.type : 0;
-            data.unit = firstUnitPrice.unit !== undefined ? firstUnitPrice.unit : 0;
         }
 
         // 更改名称
@@ -116,7 +115,6 @@ class UnitPriceModel extends BaseModel {
             unit_price_file_id: unitPriceFileId,
             name: data.name,
             type: data.type,
-            unit: data.unit
         };
 
         let addPriceResult = await this.add(insertData);

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

@@ -28,6 +28,9 @@ let billsSchema = new Schema({
     quantity: String, // Decimal
     isFromDetail:{type: Number,default:0},//1 true 0 false
     programID: Number,
+    // 工程量计算规则
+    ruleText: String,
+    // 说明
     comments: String,
     // 调价
     xs_Labour: String, // Decimal

+ 37 - 14
modules/pm/controllers/pm_controller.js

@@ -1,6 +1,7 @@
 /**
  * Created by Mai on 2017/1/18.
  */
+import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
 let ProjectsData = require('../models/project_model').project;
 let projType = require('../models/project_model').projType;
 const engineering = require("../../common/const/engineering");
@@ -67,7 +68,7 @@ module.exports = {
     },
     rename: function (req, res) {
         let data = JSON.parse(req.body.data);
-        ProjectsData.rename(req.session.sessionUser.ssoId, data.id, data.newName, function (err, message) {
+        ProjectsData.rename(req.session.sessionUser.ssoId, data, function (err, message) {
             callback(req, res, err, message, null);
         });
     },
@@ -76,10 +77,13 @@ module.exports = {
         ProjectsData.getUserProject(req.session.sessionUser.ssoId, data.proj_id, async function(err, message, data){
             if (err === 0) {
                 let engineeringLibModel = new EngineeringLibModel();
-                let engineeringInfo = await engineeringLibModel.getEngineering(data.property.engineering_id);
+                let engineeringInfo = data !== null && data.property.engineering_id !== undefined ?
+                    await engineeringLibModel.getEngineering(data.property.engineering_id) : null;
                 let strData = JSON.stringify(data);
                 let projInfo = JSON.parse(strData);
-                projInfo.engineeringInfo = engineeringInfo;
+                if (engineeringInfo !== null) {
+                    projInfo.engineeringInfo = engineeringInfo;
+                }
                 callback(req, res, err, message, projInfo);
             } else {
                 callback(req, res, err, message, null);
@@ -128,24 +132,43 @@ module.exports = {
 
         response.render('building_saas/pm/html/project-management.html', renderData);
     },
-    // 获取项目的属性
-    getProjectProperty: async function(request, response) {
+    // 获取单价文件列表
+    getUnitFileList: async function(request, response) {
         let data = request.body.data;
         try {
             data = JSON.parse(data);
-            let id = data.id !== undefined ? data.id : 0;
-            if (isNaN(id) && id <= 0) {
-                throw 'id数据有误!';
+            let projectId = data.parentID !== undefined ? data.parentID : 0;
+            if (isNaN(projectId) && projectId <= 0) {
+                throw {msg: 'id数据有误!', err: 1};
+            }
+            // 获取对应建设项目下所有的单位工程id
+            let idList = await ProjectsData.getTenderByProjectId(projectId);
+            if (idList.length <= 0) {
+                throw {msg: '不存在对应单位工程', err: 0};
+            }
+            // 获取对应的单价文件
+            let unitPriceFileModel = new UnitPriceFileModel();
+            let unitPriceFileData = await unitPriceFileModel.getDataByTenderId(idList);
+            console.log(unitPriceFileData);
+            if (unitPriceFileData === null) {
+                throw {msg: '不存在对应单价文件', err: 0};
             }
-            let property = await ProjectsData.getProjectProperty(id);
 
-            if (Object.keys(property).length <= 0) {
-                throw '操作失败';
+            // 整理数据
+            let unitPriceFileList = [];
+            for (let unitPriceFile of unitPriceFileData) {
+                let tmp = {
+                    name: unitPriceFile.name,
+                    id: unitPriceFile.id
+                };
+                unitPriceFileList.push(tmp);
             }
-            callback(request, response, 0, '', property);
+
+            callback(request, response, 0, '', unitPriceFileList);
         } catch (error) {
-            callback(request, response, 1, error, null);
+            console.log(error);
+            let responseData = error.err === 1 ? null : [];
+            callback(request, response, error.err, error.msg, responseData);
         }
-
     }
 };

+ 74 - 20
modules/pm/models/project_model.js

@@ -54,7 +54,10 @@ ProjectsDAO.prototype.updateUserProjects = async function(userId, datas, callbac
     if (datas){
         for (i = 0; i < datas.length && !hasError; i++){
             data = datas[i];
-            data.updateData.name = data.updateData.name !== undefined ? data.updateData.name.trim() : null;
+            if (data.updateData.name !== undefined) {
+                data.updateData.name = data.updateData.name.trim();
+            }
+
             if (data.updateType === 'update') {
                 Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll)
             } else if (data.updateType === 'new') {
@@ -71,17 +74,20 @@ ProjectsDAO.prototype.updateUserProjects = async function(userId, datas, callbac
                 newProject.save(async function (err, result) {
                     if (!err && result._doc.projType === projectType.tender) {
                         newProjController.copyTemplateData(data.updateData.property, newProject.ID, updateAll);
-                        // 新增单价文件
-                        let unitPriceFileModel = new UnitPriceFileModel();
-                        let insertData = {
-                            name: data.updateData.name,
-                            project_id: data.updateData.ID
-                        };
-                        let addResult = await unitPriceFileModel.add(insertData);
-                        if (!addResult) {
-                            callback(1, '新增单价文件失败.', null);
-                            return;
+                        // 如果没有选中单价文件则新增单价文件
+                        if (data.updateData.property !== null && data.updateData.property.unitPriceFile === '') {
+                            let unitPriceFileModel = new UnitPriceFileModel();
+                            let insertData = {
+                                name: data.updateData.name,
+                                project_id: data.updateData.ID
+                            };
+                            let addResult = await unitPriceFileModel.add(insertData);
+                            if (!addResult) {
+                                callback(1, '新增单价文件失败.', null);
+                                return;
+                            }
                         }
+
                     } else {
                         updateAll(err);
                     }
@@ -138,14 +144,31 @@ ProjectsDAO.prototype.copyUserProjects = function (userId, datas, callback) {
     }
 };
 
-ProjectsDAO.prototype.rename = function (userId, projectId, newName, callback){
-    Projects.update({userID: userId, ID: projectId}, {name: newName}, function(err){
-       if (err){
-           callback(1, '项目不存在.');
-       } else {
-           callback(0, '');
-       }
-    });
+ProjectsDAO.prototype.rename = async function (userId, data, callback){
+    try {
+        if (data.id === undefined || data.id === '') {
+            throw '数据错误!';
+        }
+        if (data.newName === undefined || data.newName === '') {
+            throw '请填写名称!';
+        }
+
+        // 查找同级是否存在同名数据
+        let exist = await this.isExist(data.newName, data.parentID);
+        if (exist) {
+            throw '同级目录已存在相同名称数据';
+        }
+
+        Projects.update({userID: userId, ID: data.id}, {name: data.newName}, function(err){
+            if (err){
+                throw '项目不存在';
+            }
+        });
+    } catch (error) {
+        callback(1, error, null);
+        return;
+    }
+    callback(0, '');
 };
 
 ProjectsDAO.prototype.beforeOpenProject = function (userId, projectId, updateData, callback){
@@ -196,10 +219,41 @@ ProjectsDAO.prototype.isExist = async function(name, parentID) {
         return true;
     }
     let count = await Projects.count({ParentID: parentID, name: name});
-
     return count > 0;
 };
 
+/**
+ * 获取对应建设项目下所有的单位工程id
+ *
+ * @param {Number} projectId
+ * @return {Promise}
+ */
+ProjectsDAO.prototype.getTenderByProjectId = async function(projectId) {
+    let result = [];
+    // 首先获取对应的单位工程id
+    let engineeringData = await Projects.find({ParentID: projectId});
+    if (engineeringData.length <= 0) {
+        return result;
+    }
+
+    let engineeringIdList = [];
+    for(let tmp of engineeringData) {
+        engineeringIdList.push(tmp.ID);
+    }
+
+    // 查找对应的单位工程id
+    let tenderData = await Projects.find({ParentID: {$in: engineeringIdList}});
+    if (tenderData.length <= 0) {
+        return result;
+    }
+
+    for(let tmp of tenderData) {
+        result.push(tmp.ID);
+    }
+
+    return result;
+};
+
 module.exports ={
     project: new ProjectsDAO(),
     projType: projectType

+ 1 - 0
modules/pm/routes/pm_route.js

@@ -40,6 +40,7 @@ module.exports = function (app) {
     pmRouter.post('/beforeOpenProject', pmController.beforeOpenProject);
     pmRouter.post('/getProject', pmController.getProject);
     pmRouter.post('/getNewProjectID', pmController.getNewProjectID);
+    pmRouter.post('/getUnitFile', pmController.getUnitFileList);
 
     app.use('/pm/api', pmRouter);
 };

+ 8 - 6
modules/ration_glj/facade/glj_calculate_facade.js

@@ -121,12 +121,14 @@ async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState,is
 
 function calculateAss(quantity,assList,glj) {
     for(let i=0;i<assList.length;i++){
-        let assglj = _.find(assList[i].assRation.rationGljList,function (aglj) {
-            return aglj.gljId == glj.GLJID
-        })
-        if(assglj){
-            let calQuantity = assglj.consumeAmt*assList[i].times;
-            quantity += calQuantity
+        if(assList[i].assRation){
+            let assglj = _.find(assList[i].assRation.rationGljList,function (aglj) {
+                return aglj.gljId == glj.GLJID
+            })
+            if(assglj){
+                let calQuantity = assglj.consumeAmt*assList[i].times;
+                quantity += calQuantity
+            }
         }
     }
     return quantity;

+ 1 - 1
modules/ration_glj/facade/quantity_detail_facade.js

@@ -184,7 +184,7 @@ async function insertRecodeWithReg (doc) {
         let detailList = await getDatailList(doc,returnData);
         doc.result =getEvalResult(referenceIndexs,detailList,regex);
         let refreshQuantity =false;
-        if(doc.refreshQuantity=true){
+        if(doc.refreshQuantity==true){
             refreshQuantity = true;
         }
         delete doc.refreshQuantity;

+ 2 - 0
modules/ration_repository/models/ration_section_tree.js

@@ -14,6 +14,8 @@ var rationChapterTreeSchema = new Schema({//章节树  //生成唯一id改为sec
     ParentID:Number,
     NextSiblingID:Number,
     name: String,
+    explanation: String,//说明
+    ruleText: String,//计算规则
     isDeleted: Boolean
 });
 var rationChapterTreeModel = chapterTreeDb.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");

+ 2 - 0
public/calc_util.js

@@ -203,9 +203,11 @@ class Calculation {
         let private_compile_feeType = function() {
             if (feeTypes) {
                 me.compiledFeeTypes = {};
+                me.compiledFeeTypeNames = [];
                 for (let ft of feeTypes) {
                     me.compiledFeeTypes[ft.type] = ft.name;
                     me.compiledFeeTypes[ft.name] = ft.type;    // 中文预编译,可靠性有待验证
+                    me.compiledFeeTypeNames.push(ft.name);
                 }
             }
         };

+ 59 - 0
public/web/sheet/sheet_data_helper.js

@@ -30,6 +30,21 @@ var __settingTemp = {
 };
 
 var SheetDataHelper = {
+    getObjPos: function (obj) {
+        let target = obj;
+        let pos = {x: obj.offsetLeft, y: obj.offsetTop};
+
+        target = obj.offsetParent;
+        while (target) {
+            pos.x += target.offsetLeft;
+            pos.y += target.offsetTop;
+            target = target.offsetParent;
+        }
+        return pos;
+    },
+    initSetting: function (obj, setting) {
+        setting.pos = this.getObjPos(obj);
+    },
     createNewSpread: function (obj) {
         var spread = new GC.Spread.Sheets.Workbook(obj, {sheetCount: 1});
         spread.options.tabStripVisible = false;
@@ -88,6 +103,47 @@ var SheetDataHelper = {
     loadSheetData: function (setting, sheet, datas) {
         SheetDataHelper.protectdSheet(sheet);
 
+        let TipCellType = function () {};
+        TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
+        TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheet: context.sheet,
+                sheetArea: context.sheetArea
+            };
+        };
+        TipCellType.prototype.processMouseEnter = function (hitinfo) {
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            if (setting.pos && text && text !== '') {
+                if (!this._toolTipElement) {
+                    var div = document.createElement("div");
+                    $(div).css("position", "absolute")
+                        .css("border", "1px #C0C0C0 solid")
+                        .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                        .css("font", "9pt Arial")
+                        .css("background", "white")
+                        .css("padding", 5);
+
+                    this._toolTipElement = div;
+                }
+                $(this._toolTipElement).text(text).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                $(this._toolTipElement).hide();
+                document.body.insertBefore(this._toolTipElement, null);
+                $(this._toolTipElement).show("fast");
+            }
+        };
+        TipCellType.prototype.processMouseLeave = function (hininfo) {
+            if (this._toolTipElement) {
+                document.body.removeChild(this._toolTipElement);
+                this._toolTipElement = null;
+            }
+        }
+
         sheet.suspendPaint();
         sheet.suspendEvent();
 
@@ -98,6 +154,9 @@ var SheetDataHelper = {
         sheet.setRowCount(datas.length + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
         setting.cols.forEach(function (colSetting, iCol) {       
             sheet.setStyle(-1, iCol, SheetDataHelper.getSheetCellStyle(colSetting));
+            if (colSetting.showHint) {
+                sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
+            }
             datas.forEach(function (data, iRow) {
                 var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
                 var getFieldText2 = function () {

+ 4 - 0
public/web/tree_sheet/tree_sheet_controller.js

@@ -118,6 +118,9 @@ var TREE_SHEET_CONTROLLER = {
         }
 
         controller.prototype.setTreeSelected = function (node) {
+            if (this.event.beforeTreeSelectedChange) {
+                this.event.beforeTreeSelectedChange(this.tree.selected);
+            }
             this.tree.selected = node;
             if (this.event.refreshBaseActn) {
                 this.event.refreshBaseActn(this.tree);
@@ -135,6 +138,7 @@ var TREE_SHEET_CONTROLLER = {
     },
     eventName: {
         refreshBaseActn: 'refreshBaseActn',
+        beforeTreeSelectedChange: 'beforeTreeSelectedChange',
         treeSelectedChanged: 'treeSelectedChanged',
         cellDoubleClick: 'cellDoubleClick'
     }

+ 75 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -3,6 +3,26 @@
  */
 
 var TREE_SHEET_HELPER = {
+    getObjPos: function (obj) {
+        let target = obj;
+        let pos = {x: obj.offsetLeft, y: obj.offsetTop};
+
+        target = obj.offsetParent;
+        while (target) {
+            pos.x += target.offsetLeft;
+            pos.y += target.offsetTop;
+            target = target.offsetParent;
+        }
+        return pos;
+    },
+    /**
+     * 初始化setting,需要提示单元格text时,必须先初始化setting
+     * @param obj
+     * @param setting
+     */
+    initSetting: function (obj, setting) {
+        setting.pos = this.getObjPos(obj);
+    },
     createNewSpread: function (obj) {
         var spread = new GC.Spread.Sheets.Workbook(obj, {sheetCount: 1});
         spread.options.tabStripVisible = false;
@@ -10,6 +30,7 @@ var TREE_SHEET_HELPER = {
         spread.options.cutCopyIndicatorVisible = false;
         spread.options.allowCopyPasteExcelStyle = false;
         spread.options.allowUserDragDrop = false;
+        spread.options.
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },
@@ -143,6 +164,15 @@ var TREE_SHEET_HELPER = {
         };
         TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
+            console.log(style);
+            if (style.backColor) {
+                ctx.save();
+                ctx.fillStyle = style.backColor;
+                ctx.fillRect(x, y, w, h);
+                ctx.restore();
+            } else {
+                ctx.clearRect(x, y, w, h);
+            }
             // ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
             var drawLine = function (canvas, x1, y1, x2, y2, color) {
                 ctx.save();
@@ -249,7 +279,7 @@ var TREE_SHEET_HELPER = {
                 cellRect: cellRect,
                 sheetArea: context.sheetArea
             };
-        }
+        };
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
             var offset = -1;
             var node = tree.items[hitinfo.row];
@@ -273,6 +303,47 @@ var TREE_SHEET_HELPER = {
             }
         };
 
+        let TipCellType = function () {};
+        TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
+        TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
+            return {
+                x: x,
+                y: y,
+                row: context.row,
+                col: context.col,
+                cellStyle: cellStyle,
+                cellRect: cellRect,
+                sheet: context.sheet,
+                sheetArea: context.sheetArea
+            };
+        };
+        TipCellType.prototype.processMouseEnter = function (hitinfo) {
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            if (setting.pos && text && text !== '') {
+                if (!this._toolTipElement) {
+                    var div = document.createElement("div");
+                    $(div).css("position", "absolute")
+                        .css("border", "1px #C0C0C0 solid")
+                        .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                        .css("font", "9pt Arial")
+                        .css("background", "white")
+                        .css("padding", 5);
+
+                    this._toolTipElement = div;
+                }
+                $(this._toolTipElement).text(text).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                $(this._toolTipElement).hide();
+                document.body.insertBefore(this._toolTipElement, null);
+                $(this._toolTipElement).show("fast");
+            }
+        };
+        TipCellType.prototype.processMouseLeave = function (hininfo) {
+            if (this._toolTipElement) {
+                document.body.removeChild(this._toolTipElement);
+                this._toolTipElement = null;
+            }
+        }
+
         TREE_SHEET_HELPER.protectdSheet(sheet);
         TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
             sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
@@ -283,6 +354,9 @@ var TREE_SHEET_HELPER = {
             sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
             setting.cols.forEach(function (colSetting, iCol) {
                 sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
+                if (colSetting.showHint) {
+                    sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
+                }
             });
             sheet.getRange(-1, setting.treeCol, -1, 1).cellType(new TreeNodeCellType());
             TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, tree.roots, true);

+ 3 - 1
test/tmp_data/bills_grid_setting.js

@@ -74,6 +74,7 @@ var BillsGridSetting ={
         {
             "width":200,
             "readOnly":false,
+            "showHint": true,
             "head":{
                 "titleNames":[
                     "项目名称"
@@ -261,6 +262,7 @@ var BillsGridSetting ={
         {
             "width":120,
             "readOnly": 'readOnly.volumePrice',
+            "showHint": true,
             "head":{
                 "titleNames":[
                     "工程量计算规则"
@@ -282,7 +284,7 @@ var BillsGridSetting ={
                 ]
             },
             "data":{
-                "field":"programID",
+                "field":"ruleText",
                 "vAlign":1,
                 "hAlign":0,
                 "font":"Arial"

+ 2 - 0
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -8,6 +8,7 @@ let sheetOpr = {
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.tabStripVisible = false;
         spreadBook.options.showHorizontalScrollbar = false;
+        spreadBook.options.allowUserDragDrop = false;
         return spreadBook;
     },
 
@@ -35,6 +36,7 @@ let sheetOpr = {
         spreadBook.options.scrollbarMaxAlign = true;
         spreadBook.options.allowCopyPasteExcelStyle = false;
         spreadBook.options.allowExtendPasteRange = true;
+        spreadBook.options.allowUserDragDrop = false;
         var spreadNS = GC.Spread.Sheets;
         var sheet = spreadBook.getSheet(0);
         sheet.suspendPaint();

+ 0 - 4
web/building_saas/js/global.js

@@ -26,10 +26,6 @@ function getQueryString(name) {
 $(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/
 $(function(){
-/*侧滑*/
-$(".open-sidebar").click(function(){
-    $(".slide-sidebar").animate({width:"800"}).addClass("open");
-});
 $("body").click(function(event){
         var e = event || window.event; //浏览器兼容性
         if(!$(event.target).is('a')) {

+ 12 - 15
web/building_saas/main/html/calc_program_manage.html

@@ -8,26 +8,23 @@
 </head>
 
 <body>
-    <div class="main">
-        <div class="content">
-            <div class="toolsbar">
+    <div class="toolsbar px-1">
+    </div>
+    <div class="container-fluid">
+        <div class="row">
+        <div class="col-lg-3 p-0">
+            <div class="main-data-full" id="mainSpread">
             </div>
-            <div class="container-fluid">
-                <div class="row">
-                  <div class="col-lg-3 p-0">
-                    <div class="main-data-full" id="mainSpread">
-                     </div>
-                   </div>
-                  <div class="col-lg-9 p-0">
-                    <div class="main-data-full" id="detailSpread">
-                    </div>
-                  </div>
-                </div>
+        </div>
+        <div class="col-lg-9 p-0">
+            <div class="main-data-full" id="detailSpread">
             </div>
         </div>
     </div>
+    </div>
+
     <!--弹出 计算基数-->
-    <div class="modal fade" id="jsjs" data-backdrop="static">
+<div class="modal fade" id="jsjs" data-backdrop="static">
         <div class="modal-dialog" role="document">
             <div class="modal-content">
                 <div class="modal-header">

+ 6 - 8
web/building_saas/main/html/main.html

@@ -147,10 +147,7 @@
                                       <a class="nav-link" id="linkJSCX" data-toggle="tab" href="#subSpread" role="tab">计算程序</a>
                                   </li>
                                   <li class="nav-item">
-                                      <a class="nav-link" id="linkFXSM" data-toggle="tab" href="#subSpread" role="tab">分项说明</a>
-                                  </li>
-                                  <li class="nav-item">
-                                      <a class="nav-link" id="linkDESM" data-toggle="tab" href="#subSpread" role="tab">定额说明</a>
+                                      <a class="nav-link" data-toggle="tab" href="#comments" role="tab" id="linkComments">说明信息</a>
                                   </li>
                                   <li class="nav-item">
                                       <a class="nav-link" id="linkTZJNR" data-toggle="tab" href="#subSpread" role="tab">特征及内容</a>
@@ -158,9 +155,12 @@
                               </ul>
                               <!-- Tab panes -->
                               <div class="tab-content" id="tabCon">
-                                  <div class="tab-pane active" id="gl" role="tabpanel">
+                                  <div class="tab-pane active" id="subItems" role="tabpanel">
                                       <div class="main-data-bottom ovf-hidden" id="subSpread" style="display: none">
                                       </div>
+                                      <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
+                                          <textarea class="form-control" rows="8"></textarea>
+                                      </div>
                                       <div id="tzjnrCon" class="main-data-bottom">
                                           <div class="main-data-bottom ovf-hidden" style="width: 40%; float: left;" id="jobSpread">
                                           </div>
@@ -502,10 +502,8 @@
     <script src="/lib/spreadjs/views/gc.spread.views.dataview.10.0.0.min.js" type="text/javascript"></script>
     <!--<script src="/lib/spreadjs/views/common/gc.spread.common.10.0.0.min.js" type="text/javascript"></script>-->
     <script src="/lib/spreadjs/views/plugins/gc.spread.views.gridlayout.10.0.0.min.js" type="text/javascript"></script>
-    <!--<script src="/lib/spreadjs/views/locale/gc.spread.views.dataview.locale.zh-CN.10.0.0.min.js" type="text/javascript"></script>-->
     <script>GC.Spread.Views.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";</script>
-
-
+    <!--<script src="/lib/spreadjs/views/locale/gc.spread.views.dataview.locale.zh-CN.10.0.0.min.js" type="text/javascript"></script>-->
     <!-- Model -->
     <script type="text/javascript" src="/web/building_saas/main/js/models/main_consts.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/models/project.js"></script>

+ 20 - 4
web/building_saas/main/js/calc/calc_fees.js

@@ -3,14 +3,30 @@
  */
 
 let feeType = [
-    {type: 'common', name: '工程造价'},
-    {type: 'baseLabour', name: '基价人工费'},
+    // {type: 'common', name: '工程造价'},
+    // {type: 'baseLabour', name: '基价人工费'},
+    // {type: 'material', name: '材料费'},
+    // {type: 'machine', name: '机械费'},
+    // {type: 'rationDirect', name: '定额直接费'},
+    // {type: 'manage', name: '企业管理费'},
+    // {type: 'profit', name: '利润'},
+    // {type: 'risk', name: '风险费'},
+
+// 以下标准由缪佩玲提供
+    {type: 'direct', name: '直接费'},
+    {type: 'labour', name: '人工费'},
     {type: 'material', name: '材料费'},
     {type: 'machine', name: '机械费'},
-    {type: 'rationDirect', name: '定额直接费'},
-    {type: 'manageFee', name: '企业管理费'},
+    {type: 'mainMaterial', name: '主材费'},
+    {type: 'manage', name: '企业管理费'},
     {type: 'profit', name: '利润'},
     {type: 'risk', name: '风险费'},
+    {type: 'labourDiff', name: '人工价差'},
+    {type: 'materialDiff', name: '材料价差'},
+    {type: 'machineDiff', name: '机械价差'},
+    {type: 'common', name: '工程造价'},
+    {type: 'adjustLabour', name: '调整人工费'},
+    {type: 'adjustMachineLabour', name: '调整机上人工费'},
     // 模拟用户新增
     {type: 'fee1', name: '甲供材料费'}
 ];

+ 4 - 0
web/building_saas/main/js/models/bills.js

@@ -149,6 +149,10 @@ var Bills = {
                     data.data.code = stdBillsData.code;
                     data.data.name = stdBillsData.name;
                     data.data.unit = stdBillsData.unit;
+                    // 工程量计算规则
+                    data.data.ruleText = stdBillsData.ruleText;
+                    // 说明(补注)
+                    data.data.comments = stdBillsData.recharge;
                     //zhong 特征及内容
                     data.data.jobContent = stdBillsData.jobContent;
                     data.data.itemCharacter = stdBillsData.itemCharacter;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 168 - 168
web/building_saas/main/js/models/calc_program.js


+ 16 - 10
web/building_saas/main/js/views/calc_program_manage.js

@@ -9,7 +9,7 @@ let rationPM = {
 
     mainSetting: {
         header:[
-            {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
+            // {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
             {headerName:"名称",headerWidth:200,dataCode:"name", dataType: "String"}
         ],
         view:{
@@ -20,33 +20,39 @@ let rationPM = {
 
     detailSetting: {
         header:[
-            {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
+            // {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
             {headerName:"费用代号",headerWidth:80,dataCode:"code", dataType: "String"},
             {headerName:"费用名称",headerWidth:200,dataCode:"name", dataType: "String"},
             {headerName:"计算基数",headerWidth:180,dataCode:"dispExpr", dataType: "String"},
             {headerName:"基数说明",headerWidth:300,dataCode:"statement", dataType: "String"},
             {headerName:"费率",headerWidth:80,dataCode:"feeRate", dataType: "Number"},
-            {headerName:"字段名称",headerWidth:100,dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
+            {headerName:"字段名称",headerWidth:140,dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
             {headerName:"备注",headerWidth:100,dataCode:"memo", dataType: "String"}
         ],
         view:{
             comboBox:[],
-            lockColumns:[0,1,2,3,4,5,6,7]
+            lockColumns:[0,1,2,3,4,6]
         }
     },
 
     buildSheet: function (){
         let me = this;
         me.datas = calcTemplates;
+        if (me.mainSpread) {
+            me.mainSpread.destroy();
+            me.mainSpread = null;
+        };
+        if (me.detailSpread) {
+            me.detailSpread.destroy();
+            me.detailSpread = null;
+        };
         me.mainSpread = sheetCommonObj.buildSheet($('#mainSpread')[0], me.mainSetting, me.datas.length);
         me.detailSpread = sheetCommonObj.buildSheet($('#detailSpread')[0], me.detailSetting, me.datas[0].calcItems.length);
 
-        //var coeType = new GC.Spread.Sheets.CellTypes.ComboBox();
-        //coeType.items(["单个","定额","人工","材料","机械"]);
-        //me.detailSpread.getSheet(0).getRange(-1, 0, -1, 1).cellType(coeType);
-
-        me.mainSpread.options.showVerticalScrollbar = false;
-        me.detailSpread.options.showVerticalScrollbar = false;
+        var fieldName = new GC.Spread.Sheets.CellTypes.ComboBox();
+        fieldName.items(projectObj.project.calcProgram.calc.compiledFeeTypeNames);
+        // fieldName.items(["直接费","人工费","材料费","机械费","主材费","企业管理费","利润","风险费","人工价差","材料价差","机械价差","工程造价","调整人工费","调整机上人工费","甲供材料费"]);
+        me.detailSpread.getSheet(0).getRange(-1, 5, -1, 1).cellType(fieldName);
 
         me.mainSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onMainEnterCell);
         me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.CellChanged, me.onDetailCellChanged);

+ 16 - 13
web/building_saas/main/js/views/character_content_view.js

@@ -2,19 +2,19 @@
  * Created by Zhong on 2017/8/31.
  * 特征及内容
  */
-//todo:清单库相关联的操作
 let contentOprObj = {
     workBook: null,
     currentCache: [],//按照serialNo排序
     setting: {
         header: [
-            {headerName:"工作内容",headerWidth:160,dataCode:"content", dataType: "String", hAlign: "center", vAlign: "center"},
+            {headerName:"工作内容",headerWidth:160,dataCode:"content", dataType: "String", hAlign: "left", vAlign: "center"},
             {headerName:"输出",headerWidth:80,dataCode:"isChecked", cellType:"checkBox", hAlign: "center", vAlign: "center"}
         ]
     },
     buildSheet: function(container) {
         let me = contentOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
+        me.workBook.options.allowUserDragDrop = false;
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.options.allowCopyPasteExcelStyle = false;
         me.onContextmenuOpr();//右键菜单
@@ -55,18 +55,18 @@ let contentOprObj = {
         for(let i = 0, len = jobsArr.length; i < len; i++){
             if(jobsArr[i].isChecked === true){
                 count ++;
-                if(count === 1){
+              /*  if(count === 1){
                     rstStr += "“";
                 }
                 else{
                     rstStr += " ";
-                }
-                rstStr += count + " " + jobsArr[i].content + "\n";
+                }*/
+                rstStr += count + ". " + jobsArr[i].content + "\n";
             }
         }
         if(rstStr.trim().length > 0){
             let reg = /\n+$/g;
-            let newStr = rstStr.replace(reg, "");
+            let newStr = rstStr.replace(reg, "");
             return newStr;
         }
         return null;
@@ -268,14 +268,15 @@ let characterOprObj = {
     currentCache: [],
     setting: {
         header: [
-            {headerName:"项目特征",headerWidth:160,dataCode:"character", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"特征值",headerWidth:160,dataCode:"eigenvalue", dataType: "String", cellType: "comboBox", hAlign: "center", vAlign: "center"},
+            {headerName:"项目特征",headerWidth:160,dataCode:"character", dataType: "String", hAlign: "left", vAlign: "center"},
+            {headerName:"特征值",headerWidth:160,dataCode:"eigenvalue", dataType: "String", cellType: "comboBox", hAlign: "left", vAlign: "center"},
             {headerName:"输出",headerWidth:80,dataCode:"isChecked", cellType:"checkBox", hAlign: "center", vAlign: "center"}
         ]
     },
     buildSheet: function(container) {
         let me = characterOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
+        me.workBook.options.allowUserDragDrop = false;
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.options.allowCopyPasteExcelStyle = false;
         me.onContextmenuOpr();
@@ -361,18 +362,18 @@ let characterOprObj = {
                     }
                 }
                 count ++;
-                if(count === 1){
+                /*if(count === 1){
                     rstStr += "“";
                 }
                 else{
                     rstStr += " ";
-                }
-                rstStr += count + " " + itemsArr[i].character + ": " + eigenvalueStr + "\n";
+                }*/
+                rstStr += count + ". " + itemsArr[i].character + ": " + eigenvalueStr + "\n";
             }
         }
         if(rstStr.trim().length > 0){
             let reg = /\n+$/g;
-            let newStr = rstStr.replace(reg, "");
+            let newStr = rstStr.replace(reg, "");
             return newStr;
         }
         return null;
@@ -701,12 +702,14 @@ let pageCCOprObj = {
                 }
                 else if(setting.header[col].cellType === 'comboBox'){
                     let comboObj = characterOprObj.getComboBox(data[row]);
-                    comboObj.combo.editable(true);//可编辑
+                    comboObj.combo.editable(true);//可编辑
                     sheet.getCell(row, 1).cellType(comboObj.combo).value(typeof comboObj.selectedValue !== 'undefined' ? comboObj.selectedValue : '');
                 }
                 else{
                     sheet.setValue(row, col, val, ch);
                 }
+                sheet.getCell(row, col).wordWrap(true);
+                sheet.autoFitRow(row);
             }
         }
         sheet.resumeEvent();

+ 1 - 1
web/building_saas/main/js/views/glj_view.js

@@ -474,7 +474,7 @@ var gljOprObj = {
         this.coeSheetData=coeList;
     },
     showRationAssData:function (node) {
-        var assList = node.data.rationAssList;
+        var assList = node.data.rationAssList ? node.data.rationAssList : [];
         sheetCommonObj.showData(this.assSheet,this.assSetting,assList);
         this.assSheetData =assList;
     },

+ 8 - 0
web/building_saas/main/js/views/project_view.js

@@ -7,6 +7,11 @@ var projectObj = {
     mainSpread: null,
     mainController: null,
     gljSpreed:null,
+    beforeMainTreeSelectedChange: function (node) {
+        if (node) {
+            subViewObj.saveComments(node);
+        }
+    },
     checkCommonField: function (editingText, colSetting) {
         let value;
         if (colSetting.data.decimal) {
@@ -86,6 +91,7 @@ var projectObj = {
         this.project = PROJECT.createNew(scUrlUtil.GetQueryString('project'), userID);
         this.project.loadDatas(function (err) {
             if (!err) {
+                TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], BillsGridSetting);
                 BillsGridSetting.cols.forEach(function (col) {
                     col.data.splitFields = col.data.field.split('.');
                     if (col.data.getText && Object.prototype.toString.apply(col.data.getText) === "[object String]") {
@@ -162,7 +168,9 @@ var projectObj = {
                 that.project.calcProgram = new CalcProgram(that.project);
                 that.project.calcProgram.compileAllTemps();
 
+                that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.beforeTreeSelectedChange, that.beforeMainTreeSelectedChange);
                 that.mainController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, function (node) {
+                    subViewObj.loadComments(node);
                     gljOprObj.showDataIfRationSelect(node);
 
                     // CSL.2017.07.25

+ 35 - 1
web/building_saas/main/js/views/std_bills_lib.js

@@ -7,9 +7,14 @@ var billsLibObj = {
     stdBillsSpread: null,
     stdBillsJobSpread: null,
     stdBillsFeatureSpread: null,
+    refreshSettingForHint: function () {
+        TREE_SHEET_HELPER.initSetting($('#stdBillsSpread')[0], billsLibObj.stdBillsTreeSetting);
+    },
     checkBillsSpread: function () {
         if (!this.stdBillsSpread) {
             this.stdBillsSpread = SheetDataHelper.createNewSpread($('#stdBillsSpread')[0]);
+            // 刷新setting中记录的spread的位置
+            this.refreshSettingForHint();
         }
     },
     refreshBillsSpread: function () {
@@ -33,6 +38,14 @@ var billsLibObj = {
             this.stdBillsFeatureSpread.refresh();
         }
     },
+    clearHighLight: function (spread) {
+        if (spread) {
+            let sheet = spread.getActiveSheet();
+            sheet.suspendPaint();
+            sheet.getRange(0, -1, sheet.getRowCount(), -1, GC.Spread.Sheets.SheetArea.viewport).backColor(undefined);
+            sheet.resumePaint();
+        }
+    },
     loadStdBillsLib: function () {
         let i, select = $('#stdBillsLibSelect');
         select.empty();
@@ -158,6 +171,10 @@ var billsLibObj = {
                 stdBillsTreeController.setTreeSelected(result[0]);
                 billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
 
+                for (let node of result) {
+                    billsLibObj.stdBillsSpread.getActiveSheet().getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
+                }
+
                 $('#nextStdBills').show();
                 $('#nextStdBills').click(function () {
                     var cur = stdBillsTree.selected, resultIndex = result.indexOf(cur), sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
@@ -170,6 +187,7 @@ var billsLibObj = {
                     }
                 });
             } else {
+                billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
                 $('#nextStdBills').hide();
             }
             $('#stdBillsSearchResultCount').text('搜索结果:' + result.length);
@@ -239,6 +257,7 @@ var billsLibObj = {
         }, {
             "width":100,
             "readOnly": true,
+            "showHint": true,
             "head":{
                 "titleNames":["工程量计算规则"],
                 "spanCols":[1],
@@ -305,6 +324,15 @@ var billsLibObj = {
     }
 };
 
+function addEventOnResize(fn){
+    let originFn = window.onresize;
+    window.onresize =function () {
+        originFn && originFn();
+        fn();
+    }
+}
+addEventOnResize(billsLibObj.refreshSettingForHint);
+
 $('#stdBillsTab').bind('click', function () {
     refreshSubSpread();//subSpread、jobSpread、itemSpread显示问题
     $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
@@ -317,13 +345,19 @@ $('#stdBillsTab').bind('click', function () {
     };
 });
 $('#stdBillsLibSelect').change(function () {
+    $('#stdBillsSearchResult').hide();
+    $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
+
     var select = $(this);
     if (this.children.length !== 0) {
-        LoadStdBills(select.val());
+        billsLibObj.loadStdBills(select.val());
     }
 });
 
+// 关闭搜索结果
 $('#closeSearchStdBills').click(function () {
     $('#stdBillsSearchResult').hide();
     $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
 });

+ 37 - 28
web/building_saas/main/js/views/sub_view.js

@@ -8,7 +8,7 @@ contentOprObj.buildSheet($("#jobSpread")[0]);
 characterOprObj.buildSheet($("#itemSpread")[0]);
 $("#tzjnrCon").hide();
 $("#subSpread").show();
-var subSpread = sheetCommonObj.createSpread($("#subSpread")[0], 7);
+var subSpread = sheetCommonObj.createSpread($("#subSpread")[0], 5);
 subSpread.getSheet(4).name('JSCX');
 
 pageCCOprObj.active = false;
@@ -33,7 +33,7 @@ SheetDataHelper.protectdSheet(subSpread.getSheet(3));
 
 
 $("#linkGLJ").click(function(){
-    $("#tzjnrCon").hide();//控制显示subSpread,隐藏特征及内容spread
+    $("#subItems").children().hide();//控制显示subSpread,隐藏特征及内容spread
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -45,7 +45,7 @@ $("#linkGLJ").click(function(){
 });
 
 $("#linkFZDE").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -55,7 +55,7 @@ $("#linkFZDE").click(function(){
   //  subSpread.getActiveSheet().setValue(0, 0, "辅助定额");
 });
 $("#linkFZTJ").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -66,7 +66,7 @@ $("#linkFZTJ").click(function(){
 });
 
 $("#linkGCLMX").click(function(){
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -78,7 +78,7 @@ $("#linkGCLMX").click(function(){
 });
 
 $("#linkJSCX").click(function(){        // 计算程序
-    $("#tzjnrCon").hide();
+    $("#subItems").children().hide();
     $("#subSpread").show();
     pageCCOprObj.active = false;
     refreshSubSpread();
@@ -93,29 +93,9 @@ $("#linkJSCX").click(function(){        // 计算程序
     };
 });
 
-$("#linkFXSM").click(function(){
-    $("#tzjnrCon").hide();
-    $("#subSpread").show();
-    pageCCOprObj.active = false;
-    refreshSubSpread();
-    subSpread.setActiveSheetIndex(5);
-    // for test
-    subSpread.getActiveSheet().setValue(0, 0, "分项说明");
-});
-
-$("#linkDESM").click(function(){
-    $("#tzjnrCon").hide();
-    $("#subSpread").show();
-    pageCCOprObj.active = false;
-    refreshSubSpread();
-    subSpread.setActiveSheetIndex(6);
-    // for test
-    subSpread.getActiveSheet().setValue(0, 0, "定额说明");
-});
-
 //特征及内容
 $("#linkTZJNR").click(function () {
-    $("#subSpread").hide();
+    $("#subItems").children().hide();
     $("#tzjnrCon").show();
     pageCCOprObj.active = true;
     refreshSubSpread();
@@ -141,4 +121,33 @@ function refreshSubSpread(){
     else{
         subSpread.refresh();
     }
-}
+}
+
+let subViewObj = {
+    linkTabClick: function () {
+        $("#subItems").children().hide();
+        $($(this).attr('href')).show();
+    },
+    loadComments: function (node) {
+        let select = node;
+        if (node && (node.sourceType === projectObj.project.Bills.getSourceType() || node.sourceType === projectObj.project.Ration.getSourceType())) {
+            $('#comments>textarea').val(node.data.comments).removeAttr('readOnly');
+        } else {
+            $('#rationComments>textarea').val('').attr('readOnly', true);
+        }
+    },
+    saveComments: function (node) {
+        let text = $('#comments>textarea').val();
+        if (node && node.sourceType === projectObj.project.Bills.getSourceType()) {
+            if (node.data.comments !== text) {
+                projectObj.project.Bills.updateField(node.source, "comments", text);
+            }
+        } else if (node && node.sourceType === projectObj.project.Ration.getSourceType()) {
+            if (node.data.comments !== text) {
+                projectObj.project.Ration.updateField(node.source, "comments", text);
+            }
+        }
+    }
+}
+
+$("#linkComments").click(subViewObj.linkTabClick);

+ 92 - 66
web/building_saas/pm/html/project-management.html

@@ -17,6 +17,14 @@
         var userAccount = '<%- userAccount %>';
         var userID = '<%- userID %>';
     </script>
+    <style type="text/css">
+        .hidden-area{
+            display: none;
+        }
+        #summary-engineering,#summary-project{
+            display: none;
+        }
+    </style>
 </head>
 
 <body>
@@ -152,70 +160,92 @@
     </div>
     <div class="slide-sidebar">
         <div class="side-content">
-            <div class="p-3">
-                <legend>1号生产车间 汇总</legend>
-                <table class="table table-bordered table-hover table-sm">
+            <!--建设项目汇总-->
+            <div class="p-3" id="summary-project">
+                <legend><span id="summary-project-name">船体生产车间</span> 汇总</legend>
+                <table class="table table-bordered table-hover table-sm" id="summary-project-table">
                     <thead>
                     <tr>
                         <th rowspan="2"></th>
                         <th rowspan="2">序号</th>
-                        <th rowspan="2">名称</th>
-                        <th rowspan="2">金额</th>
-                        <th colspan="6">其中</th>
-                        <th rowspan="2">占造价比例(%)</th>
-                        <th rowspan="2">建筑面积</th>
-                        <th rowspan="2">单方造价</th>
+                        <th rowspan="2">单位工程名称</th>
+                        <th rowspan="2">金额(元)</th>
+                        <th colspan="3">其中</th>
                     </tr>
                     <tr>
-                        <th>分部分项合计</th>
-                        <th>措施项目合计</th>
-                        <th>其他项目合计</th>
-                        <th>安全文明施工费</th>
-                        <th>规费</th>
-                        <th>税金</th>
+                        <th>暂估价(元)</th>
+                        <th>安全文明施工费(元)</th>
+                        <th>规费(元)</th>
+                    </tr>
+                    </thead>
+                    <tbody></tbody>
+                </table>
+                <div class="row">
+                    <div class="col-md-6">
+                        <legend>单价文件</legend>
+                        <table class="table table-bordered table-hover table-sm">
+                            <thead><th></th><th>名称</th></thead>
+                            <tbody>
+                            <tr><td>1</td><td>A单价文件</td></tr>
+                            <tr><td>2</td><td>B单价文件</td></tr>
+                            <tr><td>3</td><td>C单价文件</td></tr>
+                            </tbody>
+                        </table>
+                    </div>
+                    <div class="col-md-6">
+                        <legend>费率文件</legend>
+                        <table class="table table-bordered table-hover table-sm">
+                            <thead><th></th><th>名称</th></thead>
+                            <tbody>
+                            <tr><td>1</td><td>A费率文件</td></tr>
+                            <tr><td>2</td><td>B费率文件</td></tr>
+                            <tr><td>3</td><td>C费率文件</td></tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+            <!--单项工程汇总-->
+            <div class="p-3" id="summary-engineering">
+                <legend><span id="summary-engineering-name">6号生产车间</span> 汇总</legend>
+                <table class="table table-bordered table-hover table-sm" id="summary-engineering-table">
+                    <thead>
+                    <tr>
+                        <th rowspan="2"></th>
+                        <th rowspan="2">序号</th>
+                        <th rowspan="2">单位工程名称</th>
+                        <th rowspan="2">金额(元)</th>
+                        <th colspan="3">其中</th>
+                    </tr>
+                    <tr>
+                        <th>暂估价(元)</th>
+                        <th>安全文明施工费(元)</th>
+                        <th>规费(元)</th>
                     </tr>
                     </thead>
                     <tbody>
                     <tr>
                         <td>1</td>
-                        <td>一</td>
-                        <td>建筑工程</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
+                        <td>1</td>
+                        <td>建筑工程3</td>
+                        <td>12345.67</td>
+                        <td>5436.87</td>
+                        <td>54345.68</td>
+                        <td>514.54</td>
                     </tr>
                     <tr>
                         <td>2</td>
-                        <td>二</td>
-                        <td>建筑工程</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
+                        <td>2</td>
+                        <td>建筑工程4</td>
+                        <td>12345.67</td>
+                        <td>5436.87</td>
+                        <td>54345.68</td>
+                        <td>514.54</td>
                     </tr>
                     <tr>
                         <td>3</td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
+                        <td>3</td>
+                        <td>建筑工程5</td>
                         <td> </td>
                         <td> </td>
                         <td> </td>
@@ -223,18 +253,14 @@
                     </tr>
                     <tr>
                         <td>4</td>
-                        <td>一</td>
-                        <td>合计</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td>0</td>
-                        <td> </td>
-                        <td> </td>
                         <td> </td>
+                        <td>合计</td>
+                        <td>110789.36</td>
+                        <td>5971.32</td>
+                        <td>58900.46</td>
+                        <td>1049.41
+
+                        </td>
                     </tr>
                     </tbody>
                 </table>
@@ -276,7 +302,7 @@
                     </div>
                     <div class="form-group">
                         <label>计价规则</label>
-                        <select class="form-control" id="valuation"><option value="">请选择计规则</option></select>
+                        <select class="form-control" id="valuation"><option value="">请选择计规则</option></select>
                     </div>
                 </form>
             </div>
@@ -331,12 +357,16 @@
                         <input type="text" class="form-control" placeholder="输入单位工程名称" id="tender-name">
                     </div>
                     <div class="form-group">
+                        <label>工程专业</label>
+                        <select class="form-control" id="tender-engineering"><option>建筑工程</option></select>
+                    </div>
+                    <div class="form-group hidden-area">
                         <label>单价文件</label>
-                        <select class="form-control"><option>新建单价文件</option></select>
+                        <select class="form-control" id="unit-price"><option value="">新建单价文件</option></select>
                     </div>
-                    <div class="form-group">
+                    <div class="form-group hidden-area">
                         <label>费率文件</label>
-                        <select class="form-control" id="tender-fee-rate"><option>请选择费率文件</option></select>
+                        <select class="form-control" id="tender-fee-rate"><option value="">请选择费率文件</option></select>
                     </div>
                     <div class="form-group">
                         <label>计价方式</label>
@@ -357,10 +387,6 @@
                         <label>计价规则</label>
                         <select class="form-control" id="tender-valuation" disabled><option>重庆[2008]调整人工单价</option></select>
                     </div>
-                    <div class="form-group">
-                        <label>工程专业</label>
-                        <select class="form-control" id="tender-engineering"><option>建筑工程</option></select>
-                    </div>
                 </form>
             </div>
             <div class="modal-footer">

+ 205 - 54
web/building_saas/pm/js/pm_main.js

@@ -40,6 +40,7 @@ let ProjTreeSetting = {
             event: {
                 getText: function (html, node, text) {
                     let className = '';
+                    let aClassName = '';
                     switch (node.data.projType) {
                         case projectType.folder:
                             className = "fa fa-folder-open-o";
@@ -49,14 +50,19 @@ let ProjTreeSetting = {
                             break;
                         case projectType.project:
                             className = "fa fa-cubes";
+                            aClassName = "open-sidebar";
                             break;
                         case projectType.engineering:
                             className = "fa fa-cube";
+                            aClassName = "open-sidebar";
                             break;
                     }
                     let icon = '<i class ="tree-icon '+ className +'"></i>';
                     html.push((node && node.data && node.data.projType === projectType.folder) ? '&nbsp;' : '');
                     html.push('<a ');
+                    if (aClassName !== '') {
+                        html.push('class="'+ aClassName +'" ');
+                    }
                     if (node && node.data) {
                         //html.push('href="/main?project=', node.id(), '"');
                         html.push('href="javacript:void(0);"');
@@ -144,6 +150,12 @@ let ProjTreeSetting = {
 $(document).ready(function() {
     init();
 
+    // 侧滑数据
+    $(".poj-list").on('click', ".open-sidebar", function() {
+        setDataToSideBar();
+        $(".slide-sidebar").animate({width:"800"}).addClass("open");
+    });
+
     // 新增建设项目点击
     $('#add-project-btn').click(function () {
         let selectedItem = Tree.selected();
@@ -235,6 +247,9 @@ $(document).ready(function() {
             getProperty(projectInfo.data);
         }
 
+        // 获取单价文件数据
+        getUnitFile(projectInfo.data.ID);
+
     });
 
     // 新增单位工程
@@ -342,8 +357,7 @@ $(document).ready(function() {
             dialog.modal('hide');
             return false;
         }
-
-        RenameProject(select.id(), newName, function () {
+        RenameProject(select.id(), newName, select.data.ParentID, function () {
             dialog.modal('hide');
             select.data.name = newName;
             Tree.refreshNodesDom([select]);
@@ -364,6 +378,7 @@ $(document).ready(function() {
 
     // 移动到操作
     $('#move-to-confirm').click(function () {
+        console.log(111);
         let updateData = null;
         let dialog = $('#move-to-dialog');
         let target = GetTargetTreeNode($.fn.zTree.getZTreeObj('treeDemo'));
@@ -377,6 +392,18 @@ $(document).ready(function() {
             alert("请移动到单项工程中!");
             return false;
         }
+        // 判断同级是否有同名
+        if (target.children.length > 0) {
+            for (let tmp in target.children) {
+                if (tmp === 0) {
+                    continue;
+                }
+                if (target.children[tmp].data.name === cur.data.name) {
+                    alert("对应单项工程中存在同名数据!");
+                    return false;
+                }
+            }
+        }
 
         let parent = target;
         let next = target.firstChild();
@@ -435,6 +462,19 @@ $(document).ready(function() {
             dialog.modal('hide');
         }
 
+        // 判断同级是否有同名
+        if (target.children.length > 0) {
+            for (let tmp in target.children) {
+                if (tmp === 0) {
+                    continue;
+                }
+                if (target.children[tmp].data.name === cur.data.name) {
+                    alert("对应单项工程中存在同名数据!");
+                    return false;
+                }
+            }
+        }
+
         if (target.data.projType === projectType.tender) {
             parent = target.parent;
             next = target.nextSibling;
@@ -450,7 +490,11 @@ $(document).ready(function() {
                     projType: cur.data.projectType
                 };
                 let updateData = GetUpdateData(parent, next, cur.data.name, cur.data.property, IDs.lowID, typeInfo);
-                updateData['srcProjectId'] = cur.id();
+                updateData.forEach(function (data) {
+                    if (data.updateType === 'copy') {
+                        data['srcProjectId'] = cur.id();
+                    }
+                });
                 pre = GetNeedUpdatePreNode(parent, next);
                 if (pre) {
                     updateData = {};
@@ -500,6 +544,7 @@ $(document).ready(function() {
         }
         $("#tender-fee-rate").html(feeHtml);
 
+        $(this).parent().siblings('.hidden-area').slideDown('fast');
     });
 });
 
@@ -663,55 +708,74 @@ function AddEngineering() {
  * @return {boolean}
  */
 function AddTender() {
-    let name = $('#tender-name').val();
-    if (name === '') {
-        alert('请填写单位工程名称');
-        return false;
-    }
+    try {
+        let name = $('#tender-name').val();
+        if (name === '') {
+            throw '请填写单位工程名称';
+        }
 
-    let valuation = $("#tender-valuation").val();
-    let valuationName = $("#tender-valuation").children("option:selected").text();
-    let valuationType = $("input[name='tender_valuation_type']:checked").val();
-    let engineering = $("#tender-engineering").val();
+        let engineering = $("#tender-engineering").val();
+        if (engineering === '') {
+            throw '请选择工程专业';
+        }
 
-    let engineering_id = undefined;
-    let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
-    let engineeringList = [];
-    for(let tmp of valuationData) {
-        if (tmp._id === valuation) {
-            engineeringList = tmp.engineering_list;
-            break;
+        let unitPriceFile = $("#unit-price").val();
+
+        let feeFile = $("#tender-fee-rate").val();
+        if (feeFile === '') {
+            throw '请选择费率文件';
         }
-    }
-    for(let tmp of engineeringList) {
-        if (tmp.engineering == engineering) {
-            engineering_id = tmp.engineering_id;
-            break;
+
+        let valuation = $("#tender-valuation").val();
+        let valuationName = $("#tender-valuation").children("option:selected").text();
+        let valuationType = $("input[name='tender_valuation_type']:checked").val();
+
+        let engineering_id = undefined;
+        let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
+        let engineeringList = [];
+        for(let tmp of valuationData) {
+            if (tmp._id === valuation) {
+                engineeringList = tmp.engineering_list;
+                break;
+            }
+        }
+        for(let tmp of engineeringList) {
+            if (tmp.engineering == engineering) {
+                engineering_id = tmp.engineering_id;
+                break;
+            }
+        }
+        let engineeringName = $('#tender-engineering').children("option:selected").text();
+
+        let callback = function() {
+            $("#add-tender-dialog").modal("hide");
+            $('#tender-name').val('');
+            $("#tender-fee-rate").children("option").removeAttr("selected");
+            $("#tender-engineering").children("option").removeAttr("selected");
+            $(".hidden-area").hide();
+        };
+        let selectedItem = Tree.selected();
+        let tenderInfo = {
+            valuation: valuation,
+            valuationType: valuationType,
+            valuationName: valuationName,
+            engineering: engineering,
+            engineering_id: engineering_id,
+            engineeringName: engineeringName,
+            unitPriceFile: unitPriceFile,
+            feeFile: feeFile
+        };
+        // 如果选择的是单项工程则新增同级数据
+        if (selectedItem !== null && selectedItem.data.projType === projectType.tender) {
+            AddSiblingsItem(name, tenderInfo, projectType.tender, callback);
+        } else {
+            AddChildrenItem(name, tenderInfo, projectType.tender, callback);
         }
-    }
-    let engineeringName = $('#tender-engineering').children("option:selected").text();
 
-    let callback = function() {
-        $("#add-tender-dialog").modal("hide");
-        $('#tender-name').val('');
-        $("#tender-fee-rate").children("option").removeAttr("selected");
-        $("#tender-engineering").children("option").removeAttr("selected");
-    };
-    let selectedItem = Tree.selected();
-    let tenderInfo = {
-        valuation: valuation,
-        valuationType: valuationType,
-        valuationName: valuationName,
-        engineering: engineering,
-        engineering_id: engineering_id,
-        engineeringName: engineeringName
-    };
-    // 如果选择的是单项工程则新增同级数据
-    if (selectedItem !== null && selectedItem.data.projType === projectType.tender) {
-        AddSiblingsItem(name, tenderInfo, projectType.tender, callback);
-    } else {
-        AddChildrenItem(name, tenderInfo, projectType.tender, callback);
+    } catch (error) {
+        alert(error);
     }
+
 }
 
 /**
@@ -727,6 +791,10 @@ function AddFolder() {
     }
 
     let selectedItem = Tree.selected();
+    let callback = function() {
+        $("#add-folder-dialog").modal("hide");
+        $("#folder-name").val('');
+    };
     if (selectedItem !== null) {
         // 判断是否超过3层
         if (selectedItem.parent !== null && selectedItem.parent.parent !== null &&
@@ -734,13 +802,9 @@ function AddFolder() {
             alert("文件夹不能超过3层");
             return false;
         }
-        AddChildrenItem(name, null, projectType.folder, function() {
-            $("#add-folder-dialog").modal("hide");
-        });
+        AddChildrenItem(name, null, projectType.folder, callback);
     } else {
-        AddSiblingsItem(name, null, projectType.folder, function() {
-            $("#add-folder-dialog").modal("hide");
-        });
+        AddSiblingsItem(name, null, projectType.folder, callback);
     }
 }
 
@@ -864,14 +928,15 @@ function GetNewProjectId(callback) {
  *
  * @param {Number} projectId
  * @param {String} newName
+ * @param {Number} parentID
  * @param {function} callback
  * @return {void}
  */
-function RenameProject(projectId, newName, callback) {
+function RenameProject(projectId, newName, parentID, callback) {
     $.ajax({
         type: "POST",
         url: '/pm/api/renameProject',
-        data: {'data': JSON.stringify({"user_id": userID, "id": projectId, "newName": newName})},
+        data: {'data': JSON.stringify({"user_id": userID, "id": projectId, "newName": newName, "parentID": parentID})},
         dataType: 'json',
         cache: false,
         timeout: 5000,
@@ -988,4 +1053,90 @@ function getProperty(projectInfo) {
     $("input[name='tender_valuation_type']").attr('disabled', 'disabled').removeAttr('checked', 'checked');
     $("input[name='tender_valuation_type'][value='"+ projectProperty.valuationType +"']")
         .attr("checked", "checked").removeAttr('disabled', 'disabled');
+}
+
+/**
+ * 获取单价文件
+ *
+ * @param {Number} parentID
+ * @return {void}
+ */
+function getUnitFile(parentID) {
+    parentID = parseInt(parentID);
+    if (isNaN(parentID) && parentID <= 0) {
+        return;
+    }
+
+    $.ajax({
+        url: '/pm/api/getUnitFile',
+        type: 'post',
+        data: {'data': JSON.stringify({"user_id": userID, "parentID": parentID})},
+        dataType: 'json',
+        error: function() {
+            alert('数据传输错误!');
+        },
+        beforeSend: function() {
+
+        },
+        success: function(response) {
+            if (response.error === 1) {
+                alert('获取失败!');
+            } else {
+                if (response.data.length <= 0) {
+                    return false;
+                }
+                let unitFileHtml = '';
+                for(let tmp of response.data) {
+                    unitFileHtml += '<option value="'+ tmp.id +'">'+ tmp.name +'</option>';
+                }
+                $("#unit-price").children("option").first().after(unitFileHtml);
+            }
+        }
+    });
+
+}
+
+/**
+ * 加载数据到侧边栏
+ *
+ * @return {void}
+ */
+function setDataToSideBar() {
+    // 获取当前点击的数据
+    let selectedItem = Tree.selected();
+    let name = selectedItem.data.name;
+    let target = selectedItem.data.projType === projectType.project ? '#summary-project' : '#summary-engineering';
+    $(".side-content .p-3").hide();
+    $(target).show();
+    $(target + '-name').html(name);
+
+    if (selectedItem.children.length <= 0) {
+        return;
+    }
+    // 建设项目相关
+    let counter = 1;
+    let html = '';
+    for(let tmp of selectedItem.children) {
+        html += '<tr>' +
+            '<td>'+ counter +'</td>' +
+            '<td>'+ counter +'</td>' +
+            '<td>'+ tmp.data.name +'</td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '</tr>';
+
+    }
+    html += '<tr>' +
+        '<td>'+ (counter + 1) +'</td>' +
+        '<td> </td>' +
+        '<td>合计</td>' +
+        '<td></td>' +
+        '<td></td>' +
+        '<td></td>' +
+        '<td></td>' +
+        '</tr>';
+    $(target + '-table tbody').html(html);
+
 }

+ 5 - 1
web/glj/html/glj_index.html

@@ -78,6 +78,7 @@
     // 混凝土、砂浆、配合比、机械 市场单价不能修改
     let canNotChangeTypeId = '<%- ownCompositionTypes %>';
     canNotChangeTypeId = canNotChangeTypeId !== '' ? canNotChangeTypeId.split(",") : '';
+    let userID = '<%=userID %>';
 </script>
 <%include footer.html %>
 <script type="text/javascript" src="/lib/jquery-contextmenu/jquery.contextMenu.js"></script>
@@ -90,9 +91,12 @@
 <script type="text/javascript" src="/web/glj/js/project_glj.js"></script>
 <script type="text/javascript" src="/web/glj/js/composition.js"></script>
 <script type="text/javascript" src="/web/building_saas/js/global.js"></script>
+<script type="text/javascript" src="/public/web/common_ajax.js"></script>
+<script type="text/javascript" src="/public/web/url_util.js"></script>
+<script type="text/javascript" src="/web/building_saas/main/js/views/project_info.js"></script>
 <script type="text/javascript">
 $(document).ready(function() {
     let projectId = getQueryString("project");
-    $(".nav li > a").not(".active").attr("href", "/main?project=" + projectId);
+    $(".main-nav .nav li > a").not(".active").attr("href", "/main?project=" + projectId);
 });
 </script>

+ 1 - 1
web/glj/html/header.html

@@ -33,7 +33,7 @@
     </div>
     <nav class="navbar navbar-toggleable-lg navbar-light bg-faded p-0 justify-content-between">
         <span class="header-logo px-2">Smartcost</span>
-        <div class="navbar-text"><a href="project-management.html">项目管理</a><i class="fa fa-angle-right fa-fw"></i>文件夹<i
+        <div class="navbar-text" id="fullpath"><a href="project-management.html">项目管理</a><i class="fa fa-angle-right fa-fw"></i>文件夹<i
                 class="fa fa-angle-right fa-fw"></i>建设项目<i class="fa fa-angle-right fa-fw"></i>单项工程<i
                 class="fa fa-angle-right fa-fw"></i>单位工程
         </div>

+ 3 - 2
web/glj/js/common_spread.js

@@ -33,8 +33,9 @@ CommonSpreadJs.prototype.init = function(target) {
     };
     this.columnInfo = [];
     for(let tmp of this.header) {
-        setting.header.push({headerName: tmp.name, headerWidth: 120});
-        this.columnInfo.push({name: tmp.field, displayName: tmp.name, visible: tmp.visible, cellType: tmp.cellType, size: 120});
+        let width = tmp.field === 'name' ? 200 : 120;
+        setting.header.push({headerName: tmp.name, headerWidth: width});
+        this.columnInfo.push({name: tmp.field, displayName: tmp.name, visible: tmp.visible, cellType: tmp.cellType, size: width});
     }
 
     this.spread = sheetCommonObj.buildSheet(document.getElementById(target), setting, 10);

+ 3 - 2
web/glj/js/composition_spread.js

@@ -29,7 +29,7 @@ CompositionSpread.prototype.init = function(target) {
     let header = [
         {name: '编码', field: 'code', visible: true},
         {name: '名称', field: 'name', visible: true},
-        {name: '单位', field: 'unit_price.unit', visible: true},
+        {name: '单位', field: 'unit', visible: true},
         {name: 'ID', field: 'id', visible: false},
         {name: '类型', field: 'unit_price.type', visible: false},
         {name: '基价单价', field: "unit_price.base_price", visible: true},
@@ -44,7 +44,7 @@ CompositionSpread.prototype.init = function(target) {
 
     // 获取列号
     let codeColumn = this.sheetObj.getFieldColumn('code');
-    let unitColumn = this.sheetObj.getFieldColumn('unit_price.unit');
+    let unitColumn = this.sheetObj.getFieldColumn('unit');
     let consumptionColumn = this.sheetObj.getFieldColumn('consumption');
 
     // 居中样式
@@ -125,6 +125,7 @@ CompositionSpread.prototype.getRatioData = function(projectGLJid) {
         success: function(response) {
             if (response.err === 0) {
                 response.data = JSON.parse(response.data);
+                console.log(response.data);
                 // 设置数据
                 self.sheetObj.setData(response.data);
                 self.specialColumn(response.data);

+ 2 - 0
web/glj/js/project_glj.js

@@ -11,6 +11,8 @@ let currentTag = '';
 let isChanging = false;
 $(document).ready(function () {
 
+    projectInfoObj.showProjectInfo();
+
     projectGLJSpread = new ProjectGLJSpread();
     projectGLJSpread.successCallback = successTrigger;
     projectGLJSheet = projectGLJSpread.init();

+ 6 - 7
web/glj/js/project_glj_spread.js

@@ -29,8 +29,8 @@ ProjectGLJSpread.prototype.init = function () {
     let header = [
         {name: '编码', field: 'code', visible: true},
         {name: '名称', field: 'name', visible: true},
-        {name: '规格型号', field: 'unit_price.specs', visible: true},
-        {name: '单位', field: 'unit_price.unit', visible: true},
+        {name: '规格型号', field: 'specs', visible: true},
+        {name: '单位', field: 'unit', visible: true},
         {name: 'ID', field: 'id', visible: false},
         {name: '类型', field: 'unit_price.type', visible: false},
         {name: '总消耗量', field: 'quantity', visible: true},
@@ -69,7 +69,7 @@ ProjectGLJSpread.prototype.init = function () {
     // 获取列号
     let isEvaluateColumn = this.sheetObj.getFieldColumn('is_evaluate');
     let isAdjustPriceColumn = this.sheetObj.getFieldColumn('is_adjust_price');
-    let unitColumn = this.sheetObj.getFieldColumn('unit_price.unit');
+    let unitColumn = this.sheetObj.getFieldColumn('unit');
     let quantityColumn = this.sheetObj.getFieldColumn('quantity');
     let basePriceColumn = this.sheetObj.getFieldColumn('unit_price.base_price');
     let adjustPriceColumn = this.sheetObj.getFieldColumn('adjust_price');
@@ -170,7 +170,7 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
     // 直接在前端计算后传值后台改
     let extend = {};
     let parentMarketPrice = projectGLJSpread.compositionCalculate(row);
-    if (Object.keys(parentMarketPrice).length > 0) {
+    if (parentMarketPrice !== null && Object.keys(parentMarketPrice).length > 0) {
         for (let activeCode in parentMarketPrice) {
             let tmpObject = {
                 market_price: parentMarketPrice[activeCode],
@@ -178,6 +178,7 @@ ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
             extend[activeCode] = tmpObject;
         }
     }
+
     extend = Object.keys(extend).length > 0 ?  JSON.stringify(extend) : '';
     $.ajax({
         url: '/glj/update',
@@ -273,13 +274,11 @@ ProjectGLJSpread.prototype.compositionCalculate = function(row) {
     let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
 
     let activeConnectCode = activeSheet.getValue(row, connectCodeColumn);
-
     // 不属于组成物则忽略
-    if (activeConnectCode === '' || activeConnectCode === undefined) {
+    if (activeConnectCode === '' || activeConnectCode === null) {
         return null;
     }
     activeConnectCode = activeConnectCode.split(',');
-
     // 计算同级组成物的价格
     // 遍历所有记录
     let maxRow = activeSheet.getRowCount();