浏览代码

1. sync, global.js & main.css
2. new tender, copy main_tree_col

MaiXinRong 7 年之前
父节点
当前提交
edc3e8db73

+ 30 - 0
modules/main/models/proj_setting_model.js

@@ -0,0 +1,30 @@
+/**
+ * Created by Mai on 2017/9/14.
+ */
+
+let baseModel = require('./base_model');
+import {default as projSettingSchema, collectionName as collectionName} from "./schemas/proj_setting";
+
+class projSettingModel extends baseModel {
+
+    constructor() {
+        super(projSettingSchema);
+        this.collectionName = collectionName;
+    }
+
+    getData (projectID, callback) {
+        this.model.findOne({"projectID": projectID}, '-_id', function (err, result) {
+            if (!err) {
+                callback(0, '', result);
+            } else {
+                callback(1, '查询数据失败。', null);
+            }
+        });
+    };
+
+    save (user_id, data, callback) {
+        this.model.update({"projectID": data.projectID}, data, callback);
+    };
+}
+
+module.exports = new projSettingModel();

+ 17 - 0
modules/main/models/schemas/proj_setting.js

@@ -0,0 +1,17 @@
+/**
+ * Created by Mai on 2017/9/14.
+ */
+
+let mongoose = require("mongoose");
+let Schema = mongoose.Schema;
+let collectionName = 'proj_setting';
+let projSettingSchema = {
+    projectID: Number,
+    // 列设置
+    main_tree_col: {
+        type: Schema.Types.Mixed,
+        default: {}
+    }
+};
+let model = mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));
+export {model as default, collectionName as collectionName};

+ 8 - 0
modules/pm/controllers/new_proj_controller.js

@@ -4,9 +4,11 @@
 
 let billsData = require('../../main/models/bills');
 let projCounter = require('../../main/models/proj_counter');
+let projSetting = require('../../main/models/proj_setting_model');
 let async = require('async');
 
 import BillsTemplateModel from "../models/templates/bills_template_model";
+import EngineeringLibModel from "../../users/models/engineering_lib_model";
 
 module.exports = {
     copyTemplateData: async function (property, newProjID, callback) {
@@ -22,7 +24,13 @@ module.exports = {
                 billsData.insertData(billsDatas, callback);
             },
             function (cb) {
+                console.log(projCounter);
                 projCounter.insertData({"projectID": newProjID}, cb);
+            },
+            async function (cb) {
+                let engineeringModel = new EngineeringLibModel();
+                let engineering = await engineeringModel.getEngineering(property.engineering_id);
+                projSetting.insertData({"projectID": newProjID, main_tree_col: engineering.main_tree_col}, cb);
             }
         ], (err) => callback(err));
     }

+ 22 - 17
public/web/sheet/sheet_data_helper.js

@@ -61,23 +61,28 @@ var SheetDataHelper = {
         }
         sheet.setColumnCount(setting.cols.length);
         sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
-        setting.headRowHeight.forEach(function (rowHeight, index) {
-            sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
-        })
-        setting.cols.forEach(function (col, index) {
-            var i, iRow = 0, cell;
-            for (i = 0; i < col.head.spanCols.length; i++) {
-                if (col.head.spanCols[i] !== 0) {
-                    cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
-                    cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
-                }
-                if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
-                    sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
-                }
-                iRow += col.head.spanRows[i];
-            };
-            sheet.setColumnWidth(index, col.width);
-        });
+        if (setting.headRowHeight) {
+            setting.headRowHeight.forEach(function (rowHeight, index) {
+                sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
+            });
+        }
+        if (setting.cols) {
+            sheet.setColumnCount(setting.cols.length);
+            setting.cols.forEach(function (col, index) {
+                var i, iRow = 0, cell;
+                for (i = 0; i < col.head.spanCols.length; i++) {
+                    if (col.head.spanCols[i] !== 0) {
+                        cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
+                        cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
+                    }
+                    if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
+                        sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
+                    }
+                    iRow += col.head.spanRows[i];
+                };
+                sheet.setColumnWidth(index, col.width);
+            });
+        }
     },
     protectdSheet: function (sheet) {
         var option = {

+ 3 - 5
public/web/tree_sheet/tree_sheet_helper.js

@@ -30,7 +30,6 @@ var TREE_SHEET_HELPER = {
         spread.options.cutCopyIndicatorVisible = false;
         spread.options.allowCopyPasteExcelStyle = false;
         spread.options.allowUserDragDrop = false;
-        spread.options.
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },
@@ -61,7 +60,7 @@ var TREE_SHEET_HELPER = {
             for (i = 0; i < col.head.spanCols.length; i++) {
                 if (col.head.spanCols[i] !== 0) {
                     cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
-                    cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(col.head.wordWrap);
+                    cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
                 }
                 if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
                     sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
@@ -131,12 +130,12 @@ var TREE_SHEET_HELPER = {
                     }
                     return data;
                 };
-                if (colSetting.data.getText) {
+                if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
                     cell.value(colSetting.data.getText(node));
                 } else {
                     cell.value(getFieldText2());
                 }
-                if (colSetting.data.cellType) {
+                if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
                     cell.cellType(colSetting.data.cellType);
                 }
                 if (colSetting.readOnly) {
@@ -164,7 +163,6 @@ 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;

+ 43 - 43
web/building_saas/css/main.css

@@ -8,7 +8,7 @@ body {
     font-size: 0.9rem
 }
 .btn.disabled, .btn:disabled {
-    color:#999
+  color:#999
 }
 /*自定义css*/
 .header {
@@ -25,10 +25,10 @@ body {
     line-height: inherit
 }
 .top-msg{
-    position: fixed;
-    top:0;
-    width:100%;
-    z-index: 999
+  position: fixed;
+  top:0;
+  width:100%;
+  z-index: 999
 }
 .in-1{padding-left:0px!important}
 .in-2{padding-left:21px!important}
@@ -67,7 +67,7 @@ body {
     color: #333
 }
 .main-nav .nav-tabs{
-    border-bottom: none
+  border-bottom: none
 }
 .content {
     border-left: 1px solid #ccc;
@@ -75,7 +75,7 @@ body {
     background: #fff
 }
 .toolsbar,.toolsbar-f {
-    border-bottom: 1px solid #ccc
+  border-bottom: 1px solid #ccc
 }
 .tools-btn {
     height: 30px;
@@ -89,23 +89,23 @@ body {
     overflow-y: hidden;
 }
 .main-data-top,.main-data-full{
-    overflow: hidden;
-    width:100%
+  overflow: hidden;
+  width:100%
 }
 .main-content.col-lg-8{
-    width:66.666667%
+  width:66.666667%
 }
 .main-content.col-lg-12{
-    width:100%
+  width:100%
 }
 .main-side.col-lg-4{
-    width: 33.333333%;
+  width: 33.333333%;
 }
 .main-side.col-lg-0{
-    width:0%;
+  width:0%;
 }
 .sidebar-bottom,.sidebar-bottom .col-lg-6,.sidebar-bottom .col-lg-12 {
-    height:200px
+  height:200px
 }
 .top-content, .fluid-content {
     overflow: auto;
@@ -121,7 +121,7 @@ body {
     padding: 0.2em 0.5em
 }
 .side-tabs .nav-tabs .nav-item {
-    z-index: 999
+  z-index: 999
 }
 .side-tabs .nav-tabs {
     border-bottom: none;
@@ -248,60 +248,60 @@ body {
     overflow: auto;
 }
 .poj-list span.poj-icon {
-    padding-right:7px;
-    color:#ccc
+  padding-right:7px;
+  color:#ccc
 }
 .poj-list a.tree-open,.poj-list a.tree-close{
-    width:15px;
-    display: inline-block;
+  width:15px;
+  display: inline-block;
 }
 .print-toolsbar{
-    padding:5px
+  padding:5px
 }
 .print-toolsbar .panel {
-    display:inline-block;
-    vertical-align:top;
-    background:#f7f7f9
+  display:inline-block;
+  vertical-align:top;
+  background:#f7f7f9
 }
 .print-toolsbar .panel .panel-foot{
-    text-align: center;
-    font-size: 12px
+  text-align: center;
+  font-size: 12px
 }
 .print-list {
-    border-right:1px solid #ccc
+  border-right:1px solid #ccc
 }
 .print-list .form-list {
-    overflow: auto
+  overflow: auto
 }
 .print-list .list-tools{
-    height:50px;
-    padding:10px 0;
-    border-bottom:1px solid #f2f2f2
+  height:50px;
+  padding:10px 0;
+  border-bottom:1px solid #f2f2f2
 }
 .pageContainer {
-    background: #ededed;
-    text-align: center
+  background: #ededed;
+  text-align: center
 }
 .pageContainer .page{
-    border:9px solid transparent;
-    display: inline-block;
+  border:9px solid transparent;
+  display: inline-block;
 }
 .pageContainer .page img{
-    width:inherit;
-    height: inherit;
+  width:inherit;
+  height: inherit;
 }
 .modal-auto-height {
-    height: 400px;
-    overflow-y: auto;
+  height: 400px;
+  overflow-y: auto;
 }
 .modal-fixed-height {
-    height: 400px;
-    overflow-y: hidden;
+  height: 400px;
+  overflow-y: hidden;
 }
 .sidebar-tools-bar {
-    background:#fff
+  background:#fff
 }
 .side-search-box{
-    background:#fff;
-    border-bottom:1px solid #ddd
+  background:#fff;
+  border-bottom:1px solid #ddd
 }

+ 11 - 11
web/building_saas/js/global.js

@@ -20,11 +20,11 @@ function autoFlashHeight(){
 $(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/
 $(function(){
-    /*侧滑*/
-    $(".open-sidebar").click(function(){
-        $(".slide-sidebar").animate({width:"800"}).addClass("open");
-    });
-    $("body").click(function(event){
+/*侧滑*/
+$(".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')) {
             var elem = event.target || e.srcElement;
@@ -38,10 +38,10 @@ $(function(){
         }
 
     });
-    /*侧滑*/
-    /*工具提示*/
-    $(function () {
-        $('[data-toggle="tooltip"]').tooltip()
-    });
-    /*工具提示*/
+/*侧滑*/
+/*工具提示*/
+$(function () {
+  $('[data-toggle="tooltip"]').tooltip()
+});
+/*工具提示*/
 });