Jelajahi Sumber

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

Chenshilong 7 tahun lalu
induk
melakukan
8f2e4f5719

+ 3 - 0
Dockerfile

@@ -4,8 +4,11 @@ COPY . ConstructionCost
 
 WORKDIR ConstructionCost
 
+RUN cnpm install -g gulp
+
 RUN cnpm install
 
+RUN gulp build
 
 EXPOSE 6060
 

+ 4 - 0
Dockerfile_qa

@@ -4,8 +4,12 @@ COPY . ConstructionCost
 
 WORKDIR ConstructionCost
 
+RUN cnpm install -g gulp
+
 RUN cnpm install
 
+RUN gulp build
+
 EXPOSE 6060
 
 ENV NODE_ENV=qa

+ 147 - 101
gulpfile.js

@@ -7,7 +7,6 @@ let gulpLoadPlugins = require('gulp-load-plugins');
 let del = require('del');
 let uglify = require('gulp-uglify-es').default;
 let config = require("./config/gulpConfig.js");
-let  runSequence = require('run-sequence');
 
 const $ = gulpLoadPlugins();
 let common_jspaths=config.common_jspaths;
@@ -18,131 +17,178 @@ let login_jspaths=config.login_jspaths;
 let main_jspaths=config.main_jspaths;
 let main_csspaths=config.main_css;
 let version=config.version;
+let cssDest='web/dest/css';
+let scriptsDest='web/dest/scripts';
+
+let commonOptions={
+    jspaths:common_jspaths,
+    csspaths:common_css,
+    concatName:'common.all.min'
+};
+
+let headerOptions={
+    version:version,
+    scriptsDest:'web/dest/scripts',
+    concatName:'header.all.min',
+    srcHtml:'web/src/html/common/header.html',
+    htmlDest:'web/common/html',
+    htmlName:'header.html',
+    injectList:['web/dest/scripts/common.all.min.'+version+'.js']
+};
+
+let loginOptions={
+    version:version,
+    scriptsDest:'web/dest/scripts',
+    jspaths:login_jspaths,
+    concatName:'login.all.min',
+    srcHtml:'web/src/html/login/login.html',
+    htmlDest:'web/users/html',
+    htmlName:'login.html',
+    injectList:[  'web/dest/scripts/common.all.min.'+version+'.js',
+        'web/dest/scripts/login.all.min.'+version+'.js',
+        'web/dest/css/common.all.min.'+version+'.css']
+}
 
-let taskObject={};
-function task_init(options) {
-    taskObject=options;
-    taskObject.version=version;
-    taskObject.scriptsDest='web/dest/scripts';
+let pmOptions={
+    version:version,
+    scriptsDest:'web/dest/scripts',
+    jspaths:pm_jspaths,
+    csspaths:pm_csspaths,
+    concatName:'pm.all.min',
+    srcHtml:'web/src/html/pm/!*.html',
+    htmlDest:'web/building_saas/pm/html',
+    htmlName:'project-management.html',
+    injectList:['web/dest/scripts/pm.all.min.'+version+'.js',
+        'web/dest/css/common.all.min.'+version+'.css',
+        'web/dest/css/pm.all.min.'+version+'.css']
+};
+
+let mainOptions={
+    version:version,
+    scriptsDest:'web/dest/scripts',
+    jspaths:main_jspaths,
+    csspaths:main_csspaths,
+    concatName:'main.all.min',
+    srcHtml:'web/src/html/main/main.html',
+    htmlDest:'web/building_saas/main/html',
+    htmlName:'main.html',
+    injectList:['web/dest/scripts/main.all.min.'+version+'.js',
+        'web/dest/css/common.all.min.'+version+'.css',
+        'web/dest/css/main.all.min.'+version+'.css']
 }
 
-gulp.task('minify', function (){
-    if(taskObject.jspaths){
-        return gulp.src(taskObject.jspaths)
+function minify(options) {
+    if(options.jspaths){
+        return gulp.src(options.jspaths)
+            .pipe($.plumber())
+            .pipe(uglify())
+            .pipe($.concat(options.concatName+"."+version+".js"))
+            .pipe(gulp.dest(scriptsDest));
+    }
+    return;
+}
+
+function css(options) {
+    if(options.csspaths){
+        return gulp.src(options.csspaths)
             .pipe($.plumber())
-           // .pipe(uglify())
-            .pipe($.concat(taskObject.concatName+"."+version+".js"))
-            .pipe(gulp.dest(taskObject.scriptsDest));
+            .pipe($.cssnano())
+            .pipe($.concat(options.concatName+"."+version+".css"))
+            .pipe(gulp.dest(cssDest));
     }
-   return;
+    return;
+}
+
+function inject(options) {
+    var target = gulp.src(options.htmlDest+'/'+options.htmlName);
+    var sources = gulp.src(options.injectList, {read: false});
+
+    return target.pipe($.plumber())
+        .pipe($.inject(sources))
+        .pipe(gulp.dest(options.htmlDest));
+}
+
+function htmlmin(options) {
+    return gulp.src(options.htmlDest+'/*.html')
+    //  .pipe($.htmlmin({collapseWhitespace: true}))
+        .pipe(gulp.dest(options.htmlDest));
+}
+
+
+gulp.task('minify', function (){
+    return minify(commonOptions);
 });
 
+gulp.task('css',function () {
+    return css(commonOptions);
+})
+
+gulp.task('common', ['minify','css']);
 
-gulp.task('copy',function () {
-    return gulp.src(taskObject.srcHtml)
-            .pipe($.plumber())
-            .pipe(gulp.dest(taskObject.htmlDest));
+gulp.task('login_minify',['common'], function (){
+    return minify(loginOptions);
+});
+
+gulp.task('login_css',function () {
+    return css(loginOptions);
 })
 
-gulp.task('inject',['minify','css'], function () {
-    var target = gulp.src(taskObject.htmlDest+'/'+taskObject.htmlName);
-    var sources = gulp.src(taskObject.injectList, {read: false});
+gulp.task('login_inject',['login_minify','login_css'],function () {
+    return inject(loginOptions);
+})
 
-    return target.pipe($.plumber())
-         .pipe($.inject(sources))
-         .pipe(gulp.dest(taskObject.htmlDest));
+gulp.task('login',['login_inject'], function (){
+    return htmlmin(loginOptions);
+});
+
+
+gulp.task('header_minify',['common'], function (){
+    return minify(headerOptions);
 });
 
-gulp.task('htmlmin',function () {
-    return gulp.src(taskObject.htmlDest+'/*.html')
-      //  .pipe($.htmlmin({collapseWhitespace: true}))
-        .pipe(gulp.dest(taskObject.htmlDest));
+gulp.task('header_css',function () {
+    return css(headerOptions);
 })
 
-gulp.task('css',function () {
-    if(taskObject.pm_csspaths){
-        return gulp.src(taskObject.pm_csspaths)
-            .pipe($.plumber())
-            .pipe($.cssnano())
-            .pipe($.concat(taskObject.concatName+"."+version+".css"))
-            .pipe(gulp.dest(taskObject.cssDest));
-    }
-    return;
+gulp.task('header_inject',['header_minify','header_css'],function () {
+    return inject(headerOptions);
 })
 
-gulp.task('common', function (){
-    let options = {
-        jspaths:common_jspaths,
-        pm_csspaths:common_css,
-        concatName:'common.all.min',
-        cssDest:'web/dest/css'
-    }
-    task_init(options);
-    runSequence('minify','css');
+gulp.task('header',['header_inject'], function (){
+    return htmlmin(headerOptions);
 });
 
-gulp.task('header', function (){
-    let options = {
-        concatName:'header.all.min',
-        srcHtml:'web/src/html/common/header.html',
-        htmlDest:'web/common/html',
-        htmlName:'header.html',
-        injectList:['web/dest/scripts/common.all.min.'+version+'.js']
-    };
-    task_init(options);
-    runSequence('inject','htmlmin');
+gulp.task('pm_minify',['common'], function (){
+    return minify(pmOptions);
 });
 
+gulp.task('pm_css',function () {
+    return css(pmOptions);
+})
 
-gulp.task('login', function (){
-    let options = {
-        jspaths:login_jspaths,
-        concatName:'login.all.min',
-        srcHtml:'web/src/html/login/login.html',
-        htmlDest:'web/users/html',
-        htmlName:'login.html',
-        injectList:[  'web/dest/scripts/common.all.min.'+version+'.js',
-                        'web/dest/scripts/login.all.min.'+version+'.js',
-                        'web/dest/css/common.all.min.'+version+'.css']
-    }
-    task_init(options);
-    runSequence('inject','htmlmin');
+gulp.task('pm_inject',['pm_minify','pm_css'],function () {
+    return inject(pmOptions);
+})
+
+gulp.task('pm',['pm_inject'], function (){
+    return htmlmin(pmOptions);
 });
 
-gulp.task('pm', function (){
-    let options = {
-        jspaths:pm_jspaths,
-        pm_csspaths:pm_csspaths,
-        concatName:'pm.all.min',
-        cssDest:'web/dest/css',
-        srcHtml:'web/src/html/pm/*.html',
-        htmlDest:'web/building_saas/pm/html',
-        htmlName:'project-management.html',
-        injectList:['web/dest/scripts/pm.all.min.'+version+'.js',
-                      'web/dest/css/common.all.min.'+version+'.css',
-                      'web/dest/css/pm.all.min.'+version+'.css']
-    }
-    task_init(options);
-    runSequence('inject','htmlmin');
+gulp.task('main_minify',['common'], function (){
+    return minify(mainOptions);
 });
 
-gulp.task('main',function () {
-    let options ={
-        jspaths:main_jspaths,
-        pm_csspaths:main_csspaths,
-        concatName:'main.all.min',
-        cssDest:'web/dest/css',
-        srcHtml:'web/src/html/main/main.html',
-        htmlDest:'web/building_saas/main/html',
-        htmlName:'main.html',
-        injectList:['web/dest/scripts/main.all.min.'+version+'.js',
-            'web/dest/css/common.all.min.'+version+'.css',
-            'web/dest/css/main.all.min.'+version+'.css']
-    }
-    task_init(options);
-    runSequence('inject','htmlmin');
+gulp.task('main_css',function () {
+    return css(mainOptions);
 })
 
-gulp.task('build',['common'],function () {
-    runSequence('header',['login','pm','main']);
-});
+gulp.task('main_inject',['main_minify','main_css'],function () {
+    return inject(mainOptions);
+})
+
+gulp.task('main',['main_inject'], function (){
+    return htmlmin(mainOptions);
+});
+
+
+gulp.task('build',['header','login','pm','main']);

+ 149 - 0
gulpfile.js.copy

@@ -0,0 +1,149 @@
+
+/**
+ * Created by chen on 2017/9/26.
+ */
+
+let gulp =require( 'gulp');
+let gulpLoadPlugins = require('gulp-load-plugins');
+let del = require('del');
+let uglify = require('gulp-uglify-es').default;
+let config = require("./config/gulpConfig.js");
+let  runSequence = require('run-sequence');
+
+const $ = gulpLoadPlugins();
+let common_jspaths=config.common_jspaths;
+let common_css=config.common_css;
+let pm_jspaths=config.pm_jspaths;
+let pm_csspaths=config.pm_css;
+let login_jspaths=config.login_jspaths;
+let main_jspaths=config.main_jspaths;
+let main_csspaths=config.main_css;
+let version=config.version;
+
+let taskObject={};
+function task_init(options) {
+    taskObject=options;
+    taskObject.version=version;
+    taskObject.scriptsDest='web/dest/scripts';
+}
+
+gulp.task('minify', function (){
+    if(taskObject.jspaths){
+        return gulp.src(taskObject.jspaths)
+            .pipe($.plumber())
+           // .pipe(uglify())
+            .pipe($.concat(taskObject.concatName+"."+version+".js"))
+            .pipe(gulp.dest(taskObject.scriptsDest));
+    }
+   return;
+});
+
+
+gulp.task('copy',function () {
+    return gulp.src(taskObject.srcHtml)
+            .pipe($.plumber())
+            .pipe(gulp.dest(taskObject.htmlDest));
+})
+
+gulp.task('inject',['minify','css'], function () {
+    var target = gulp.src(taskObject.htmlDest+'/'+taskObject.htmlName);
+    var sources = gulp.src(taskObject.injectList, {read: false});
+
+    return target.pipe($.plumber())
+         .pipe($.inject(sources))
+         .pipe(gulp.dest(taskObject.htmlDest));
+});
+
+gulp.task('htmlmin',function () {
+    return gulp.src(taskObject.htmlDest+'/*.html')
+      //  .pipe($.htmlmin({collapseWhitespace: true}))
+        .pipe(gulp.dest(taskObject.htmlDest));
+})
+
+gulp.task('css',function () {
+    if(taskObject.pm_csspaths){
+        return gulp.src(taskObject.pm_csspaths)
+            .pipe($.plumber())
+            .pipe($.cssnano())
+            .pipe($.concat(taskObject.concatName+"."+version+".css"))
+            .pipe(gulp.dest(taskObject.cssDest));
+    }
+    return;
+})
+
+gulp.task('common', function (){
+    let options = {
+        jspaths:common_jspaths,
+        pm_csspaths:common_css,
+        concatName:'common.all.min',
+        cssDest:'web/dest/css'
+    }
+    task_init(options);
+    runSequence('minify','css');
+});
+
+gulp.task('header', function (){
+    let options = {
+        concatName:'header.all.min',
+        srcHtml:'web/src/html/common/header.html',
+        htmlDest:'web/common/html',
+        htmlName:'header.html',
+        injectList:['web/dest/scripts/common.all.min.'+version+'.js']
+    };
+    task_init(options);
+    runSequence('inject','htmlmin');
+});
+
+
+gulp.task('login', function (){
+    let options = {
+        jspaths:login_jspaths,
+        concatName:'login.all.min',
+        srcHtml:'web/src/html/login/login.html',
+        htmlDest:'web/users/html',
+        htmlName:'login.html',
+        injectList:[  'web/dest/scripts/common.all.min.'+version+'.js',
+                        'web/dest/scripts/login.all.min.'+version+'.js',
+                        'web/dest/css/common.all.min.'+version+'.css']
+    }
+    task_init(options);
+    runSequence('inject','htmlmin');
+});
+
+gulp.task('pm', function (){
+    let options = {
+        jspaths:pm_jspaths,
+        pm_csspaths:pm_csspaths,
+        concatName:'pm.all.min',
+        cssDest:'web/dest/css',
+        srcHtml:'web/src/html/pm/*.html',
+        htmlDest:'web/building_saas/pm/html',
+        htmlName:'project-management.html',
+        injectList:['web/dest/scripts/pm.all.min.'+version+'.js',
+                      'web/dest/css/common.all.min.'+version+'.css',
+                      'web/dest/css/pm.all.min.'+version+'.css']
+    }
+    task_init(options);
+    runSequence('inject','htmlmin');
+});
+
+gulp.task('main',function () {
+    let options ={
+        jspaths:main_jspaths,
+        pm_csspaths:main_csspaths,
+        concatName:'main.all.min',
+        cssDest:'web/dest/css',
+        srcHtml:'web/src/html/main/main.html',
+        htmlDest:'web/building_saas/main/html',
+        htmlName:'main.html',
+        injectList:['web/dest/scripts/main.all.min.'+version+'.js',
+            'web/dest/css/common.all.min.'+version+'.css',
+            'web/dest/css/main.all.min.'+version+'.css']
+    }
+    task_init(options);
+    runSequence('inject','htmlmin');
+})
+
+gulp.task('build',['common'],function () {
+    runSequence('header',['login','pm','main']);
+});

+ 2 - 0
modules/common/const/glj_type_const.js

@@ -28,6 +28,8 @@ const gljType = {
     GENERAL_MACHINE: 301,
     // 机械组成物
     MACHINE_COMPOSITION: 302,
+    // 机上人工
+    MACHINE_LABOUR: 303,
     // ==============机械类型=================
     // 主材
     MAIN_MATERIAL: 4,

+ 12 - 15
modules/glj/models/glj_list_model.js

@@ -13,8 +13,8 @@ import UnitPriceFileModel from "./unit_price_file_model";
 import GLJTypeConst from "../../common/const/glj_type_const";
 import RationGLJFacade from "../../ration_glj/facade/ration_glj_facade";
 import STDGLJLibGLJListModel from "../../common/std/std_glj_lib_glj_list_model";
-import STDGLJType from "../../../public/cache/std_glj_type_util";
 import MixRatioModel from "./mix_ratio_model";
+const ProjectModel = require('../../pm/models/project_model').project;
 
 class GLJListModel extends BaseModel {
 
@@ -109,7 +109,14 @@ class GLJListModel extends BaseModel {
             let quantityList = {};
             // 整理数据
             for (let tmp of quantityData) {
-                quantityList[tmp.projectGLJID] = tmp.quantity;
+                let tmpNum = parseInt(tmp.rationQuantity);
+                tmpNum = isNaN(tmpNum) ? 1 : tmpNum;
+                if (quantityList[tmp.projectGLJID] === undefined) {
+                    quantityList[tmp.projectGLJID] = tmp.quantity * tmpNum;
+                } else {
+                    quantityList[tmp.projectGLJID] += tmp.quantity * tmpNum;
+                }
+
             }
 
             // 查找组成物的消耗量
@@ -242,12 +249,10 @@ class GLJListModel extends BaseModel {
             }
 
             // 获取标段对应的单价文件id
-            let unitPriceFileModel = new UnitPriceFileModel();
-            let unitPriceFile = await unitPriceFileModel.getDataByProject(data.project_id);
-            if (!unitPriceFile) {
+            let unitPriceFileId = await ProjectModel.getUnitPriceFileId(data.project_id);
+            if (unitPriceFileId <= 0) {
                 throw '没有对应的单价文件';
             }
-            let unitPriceFileId = unitPriceFile.id;
 
             // 判断类型,如果是混凝土、砂浆或者配合比则查找对应的组成物(前提是没有对应的项目工料机数据)
             if (isAddProjectGLJ && (data.type === GLJTypeConst.CONCRETE || data.type === GLJTypeConst.MORTAR ||
@@ -437,13 +442,6 @@ class GLJListModel extends BaseModel {
             return;
         }
 
-        // 获取工料机类型以及整理数据
-        let gljTypeList = STDGLJType.getStdGljTypeCacheObj().toArray();
-        let gljType = {};
-        for (let tmp of gljTypeList) {
-            gljType[tmp.fullName] = tmp.ID;
-        }
-
         // 整理插入的数据
         let gljInsertData = [];
         let unitPriceInsertData = [];
@@ -470,8 +468,7 @@ class GLJListModel extends BaseModel {
                 code: tmp.code,
                 name: tmp.name,
                 unit_price_file_id: unitPriceFileId,
-                // 如果没有对应的工料机类型则默认设置为普通材料
-                type: gljType[tmp.gljDistType] !== undefined ? gljType[tmp.gljDistType] : GLJTypeConst.GENERAL_MATERIAL
+                type: tmp.gljType
             };
             unitPriceInsertData.push(unitPriceData);
         }

+ 1 - 0
modules/ration_repository/models/coe.js

@@ -20,6 +20,7 @@ var coeSchema = mongoose.Schema({
 var coeListSchema = mongoose.Schema({
     libID: Number,                      // 所属定额定ID
     ID: Number,                         // 系数ID(流水号ID)
+    serialNo: Number,                  //编号
     name: String,                       // 名称
     content: String,                    // 说明
     coes: [coeSchema]

+ 1 - 0
modules/ration_repository/models/ration_item.js

@@ -36,6 +36,7 @@ var rationItemSchema = mongoose.Schema({
     caption: String,
     feeType: Number,
     jobContent: String,
+    annotation: String,
     rationGljList: [rationGljItemSchema],
     rationCoeList: Array,
     rationAssList: [rationAssItemSchema]

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

@@ -17,6 +17,7 @@ var rationChapterTreeSchema = new Schema({//章节树  //生成唯一id改为sec
     explanation: String,//说明
     ruleText: String,//计算规则,
     jobContentSituation: String,//工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
+    annotationSituation: String,//附注适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
     isDeleted: Boolean
 });
 var rationChapterTreeModel = chapterTreeDb.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");

+ 1 - 6
package.json

@@ -36,25 +36,20 @@
     "gulp-autoprefixer": "^3.0.1",
     "gulp-babel": "^6.1.1",
     "babel-core": "^6.4.0",
-    "gulp-cache": "^0.2.8",
     "gulp-cssnano": "^2.0.0",
     "gulp-eslint": "^0.13.2",
     "gulp-htmlmin": "^1.3.0",
-    "gulp-if": "^1.2.5",
     "gulp-imagemin": "^2.2.1",
     "gulp-load-plugins": "^0.10.0",
     "gulp-plumber": "^1.0.1",
     "gulp-sass": "^2.0.0",
     "gulp-size": "^1.2.1",
-    "gulp-sourcemaps": "^1.5.0",
     "gulp-uglify": "^1.1.0",
-    "gulp-useref": "^3.0.0",
     "gulp-inject":"^4.3.0",
     "gulp-concat": "^2.6.1",
     "main-bower-files": "^2.5.0",
     "wiredep": "^2.2.2",
-    "gulp-uglify-es":"^0.1.3",
-    "run-sequence":"^2.2.0"
+    "gulp-uglify-es":"^0.1.3"
   },
   "scripts": {
     "start": "C:\\Users\\mai\\AppData\\Roaming\\npm\\babel-node.cmd server.js"

+ 50 - 0
public/web/sheet/sheet_common.js

@@ -207,5 +207,55 @@ var sheetCommonObj = {
             }
         }
         return rst;
+    },
+    //add by zhong 2017-10-10
+    //动态下拉框,配合EnterCell, args.sheet.repaint();
+    getDynamicCombo: function () {
+        let ComboCellForActiveCell = function () { };
+        ComboCellForActiveCell.prototype = new GC.Spread.Sheets.CellTypes.ComboBox();
+        ComboCellForActiveCell.prototype.paintValue = function (ctx, value, x, y, w, h, style, options) {
+            let sheet = options.sheet;
+            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
+                GC.Spread.Sheets.CellTypes.ComboBox.prototype.paintValue.apply(this, arguments);
+
+            } else {
+                GC.Spread.Sheets.CellTypes.Base.prototype.paintValue.apply(this, arguments);
+            }
+        };
+        ComboCellForActiveCell.prototype.getHitInfo = function (x, y, cellStyle, cellRect, options) {
+            let sheet = options.sheet;
+            if (options.row === sheet.getActiveRowIndex() && options.col === sheet.getActiveColumnIndex()) {
+                return GC.Spread.Sheets.CellTypes.ComboBox.prototype.getHitInfo.apply(this, arguments);
+
+            } else {
+                return GC.Spread.Sheets.CellTypes.Base.prototype.getHitInfo.apply(this, arguments);
+            }
+        };
+        return new ComboCellForActiveCell();
+    },
+    setDynamicCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
+        let me = this;
+        sheet.suspendPaint();
+        for(let i = 0, len = rowCount; i < len; i++){
+            let combo = me.getDynamicCombo();
+            if(itemsHeight) combo.itemHeight(itemsHeight);
+            if(itemsType === 'value') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
+            else if(itemsType === 'text') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
+            else combo.items(items);
+            sheet.getCell(beginRow + i, col).cellType(combo);
+        }
+        sheet.resumePaint();
+    },
+    setStaticCombo: function (sheet, beginRow, col, rowCount, items, itemsHeight, itemsType) {
+        sheet.suspendPaint();
+        for(let i = 0, len = rowCount; i < len; i++){
+            let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
+            if(itemsHeight) combo.itemHeight(itemsHeight);
+            if(itemsType === 'value') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
+            else if(itemsType === 'text') combo.items(items).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
+            else combo.items(items);
+            sheet.getCell(beginRow + i, col).cellType(combo);
+        }
+        sheet.resumePaint();
     }
 }

+ 52 - 40
public/web/sheet/sheet_data_helper.js

@@ -55,35 +55,44 @@ var SheetDataHelper = {
         spread.getActiveSheet().setRowCount(3);
         return spread;
     },
+    massOperationSheet: function (sheet, Operation) {
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        Operation();
+        sheet.resumeEvent();
+        sheet.resumePaint();
+    },
     loadSheetHeader: function (setting, sheet) {
-        if (setting.frozenCols) {
-            sheet.frozenColumnCount(setting.frozenCols);
-        }
-        sheet.setColumnCount(setting.cols.length);
-        sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
-        if (setting.headRowHeight) {
-            setting.headRowHeight.forEach(function (rowHeight, index) {
-                sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
-            });
-        }
-        if (setting.cols) {
+        this.massOperationSheet(sheet, function () {
+            if (setting.frozenCols) {
+                sheet.frozenColumnCount(setting.frozenCols);
+            }
             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);
-                sheet.setColumnVisible(index, col.visible);
-            });
-        }
+            sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
+            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);
+                    sheet.setColumnVisible(index, col.visible);
+                });
+            }
+        });
     },
     protectdSheet: function (sheet) {
         var option = {
@@ -127,25 +136,28 @@ var SheetDataHelper = {
             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);
-
+                    let div = $('#autoTip')[0];
+                    if (!div) {
+                        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)
+                            .attr("id", 'autoTip');
+                        $(div).hide();
+                        document.body.insertBefore(div, null);
+                    }
                     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).show("fast");
                 }
-                $(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).hide();
                 this._toolTipElement = null;
             }
         }

+ 34 - 32
public/web/tree_sheet/tree_sheet_helper.js

@@ -156,11 +156,11 @@ var TREE_SHEET_HELPER = {
         });
     },
     showTreeData: function (setting, sheet, tree) {
-        var indent = 20;
-        var halfBoxLength = 5;
-        var halfExpandLength = 3;
+        let indent = 20;
+        let halfBoxLength = 5;
+        let halfExpandLength = 3;
 
-        var TreeNodeCellType = function () {
+        let TreeNodeCellType = function () {
         };
         TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
@@ -173,7 +173,7 @@ var TREE_SHEET_HELPER = {
                 ctx.clearRect(x, y, w, h);
             }
             // ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
-            var drawLine = function (canvas, x1, y1, x2, y2, color) {
+            let drawLine = function (canvas, x1, y1, x2, y2, color) {
                 ctx.save();
                 // ����ƫ����
                 ctx.translate(0.5, 0.5);
@@ -184,8 +184,8 @@ var TREE_SHEET_HELPER = {
                 ctx.stroke();
                 ctx.restore();
             };
-            var drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
-                var rect = {}, h1, h2, offset = 1;
+            let drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
+                let rect = {}, h1, h2, offset = 1;
                 rect.top = centerY - halfBoxLength;
                 rect.bottom = centerY + halfBoxLength;
                 rect.left = centerX - halfBoxLength;
@@ -221,16 +221,15 @@ var TREE_SHEET_HELPER = {
                     }
                 }
             }
-            var node = tree.items[options.row];
-            var showTreeLine = true;
+            let node = tree.items[options.row];
+            let showTreeLine = true;
 
             if (!node) { return; }
 
-            var iLevel = node.depth();
-            var centerX = Math.floor(x) + node.depth() * indent + indent / 2;
-            var x1 = centerX + indent / 2;
-            var centerY = Math.floor((y + (y + h)) / 2);
-            var y1;
+            let centerX = Math.floor(x) + node.depth() * indent + indent / 2;
+            let x1 = centerX + indent / 2;
+            let centerY = Math.floor((y + (y + h)) / 2);
+            let y1;
             // Draw Sibling Line
             if (showTreeLine) {
                 // Draw Horizontal Line
@@ -280,17 +279,17 @@ var TREE_SHEET_HELPER = {
             };
         };
         TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
-            var offset = -1;
-            var node = tree.items[hitinfo.row];
+            let offset = -1;
+            let node = tree.items[hitinfo.row];
             tree.selected = node;
             if (!node || node.children.length === 0) { return; }
-            var centerX = hitinfo.cellRect.x + offset + node.depth() * indent + indent / 2;
-            var centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
+            let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + indent / 2;
+            let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
 
             if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
                 node.setExpanded(!node.expanded);
                 TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
-                    var iCount = node.posterityCount(), i, child;
+                    let iCount = node.posterityCount(), i, child;
                     for (i = 0; i < iCount; i++) {
                         child = tree.items[hitinfo.row + i + 1];
                         hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.visible, hitinfo.sheetArea);
@@ -320,25 +319,28 @@ var TREE_SHEET_HELPER = {
             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);
-
+                    let div = $('#autoTip')[0];
+                    if (!div) {
+                        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)
+                            .attr("id", 'autoTip');
+                        $(div).hide();
+                        document.body.insertBefore(div, null);
+                    }
                     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).show("fast");
                 }
-                $(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 (hitinfo) {
             if (this._toolTipElement) {
-                document.body.removeChild(this._toolTipElement);
+                $(this._toolTipElement).hide();
                 this._toolTipElement = null;
             }
         }

+ 2 - 26
web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html

@@ -19,32 +19,7 @@
 </head>
 <body>
     <div class="header">
-        <!-- <div class="top-msg clearfix">
-            <div class="alert alert-warning mb-0 py-0" role="alert">
-                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
-                  <span aria-hidden="true">&times;</span>
-                </button>
-                <strong>Warning!</strong> Better check yourself, you're not looking too good.
-            </div>
-        </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="/pm">项目管理</a></div>
-            <div class="float-lg-right navbar-text pt-0">
-                <div class="dropdown d-inline-block">
-                    <button class="btn btn-link btn-sm dropdown-toggle" type="button" data-toggle="dropdown">陈特</button>
-                    <div class="dropdown-menu dropdown-menu-right">
-                        <a class="dropdown-item" href="user-info.html" target="_blank">账号资料</a>
-                        <a class="dropdown-item" href="user-buy.html" target="_blank">产品购买</a>
-                        <a class="dropdown-item" href="user-set.html" target="_blank">偏好设置</a>
-                    </div>
-                </div>
-                <span class="btn btn-link btn-sm new-msg">
-                  <i class="fa fa-envelope-o" aria-hidden="true"></i>&nbsp;2
-                </span>
-                <button class="btn btn-link btn-sm">注销</button>
-            </div>
-        </nav>
+        <%include ../../../common/html/header.html %>
         <nav class="navbar navbar-toggleable-lg justify-content-between navbar-light p-0">
             <ul class="nav navbar-nav px-1">
                 <li class="nav-item">
@@ -219,6 +194,7 @@
     <script type="text/javascript" src="/web/building_saas/complementary_glj_lib/js/gljComponent.js"></script>
     <script type="text/javascript" src="/web/building_saas/complementary_glj_lib/js/components.js"></script>
     <script type="text/javascript" src="/public/web/ztree_common.js"></script>
+    <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
     <script type="text/javascript" src="/web/building_saas/complementary_glj_lib/js/sheetOpr.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <SCRIPT type="text/javascript">

+ 5 - 7
web/building_saas/complementary_glj_lib/js/glj.js

@@ -85,10 +85,6 @@ let repositoryGljObj = {
             }
         });
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
-           /* if(distTypeObj.children.length === 0 && distTypeObj.data.fullName !== '普通机械' &&distTypeObj.data.fullName !== '机械组成物'
-                && distTypeObj.data.fullName !== '机上人工'){
-                distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
-            }*/
             if(distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械'){
                 distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
             }
@@ -105,15 +101,14 @@ let repositoryGljObj = {
                 if(!result.error && callback){
                     me.distTypeTree = me.getComboData(result.data);
                     console.log(me.distTypeTree);
-                    let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
+                   /* let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
                     combo.items(me.distTypeTree.comboDatas).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
-                    me.workBook.getSheet(0).getCell(-1, 5, GC.Spread.Sheets.SheetArea.viewport).cellType(combo).value(me.distTypeTree.comboDatas[0].text);
+                    me.workBook.getSheet(0).getCell(-1, 5, GC.Spread.Sheets.SheetArea.viewport).cellType(combo).value(me.distTypeTree.comboDatas[0].text);*/
                     callback();
                 }
             }
         })
     },
-
     getGljTree: function(gljLibId, callback) {
         let me = this;
         $.ajax({
@@ -184,6 +179,8 @@ let repositoryGljObj = {
             }
             sheetOpr.cleanData(me.workBook.getSheet(0), me.setting, -1);
             sheetOpr.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree);
+            sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 5, cacheSection.length, me.distTypeTree.comboDatas, false, 'text');
+            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), cacheSection.length, 5, me.workBook.getActiveSheet().getRowCount() - cacheSection.length, me.distTypeTree.comboDatas, false, 'text');
 
             cacheSection = null;
         }
@@ -320,6 +317,7 @@ let repositoryGljObj = {
     },
     onEnterCell: function (sender, args) {
         let me = repositoryGljObj;
+        args.sheet.repaint();
         me.cellRowIdx = args.row;
         let isHasData = false;
         if(me.addGljObj){

+ 5 - 5
web/building_saas/main/html/main.html

@@ -444,25 +444,25 @@
                                         <fieldset class="form-group">
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" name="optionsRadios" id="optionsRadios1" value="option1" checked="" type="radio">
+                                                    <input class="form-check-input" name="calcFlag" id="rationContent" value="0" checked="" type="radio">
                                                     子目含量取费
                                                 </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" name="optionsRadios" id="optionsRadios2" value="option2" type="radio">
+                                                    <input class="form-check-input" name="calcFlag" id="rationPrice" value="1" type="radio">
                                                     子目单价取费(反算):清单综合合价=清单综合单价*清单工程量
                                                 </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" name="optionsRadios" id="optionsRadios3" value="option3" type="radio">
+                                                    <input class="form-check-input" name="calcFlag" id="rationPriceConverse" value="2" type="radio">
                                                     子目单价取费(正算):清单综合合价=∑子目综合合价
                                                 </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label">
-                                                    <input class="form-check-input" name="optionsRadios" id="optionsRadios4" value="option4" type="radio">
+                                                    <input class="form-check-input" name="calcFlag" id="billsPrice" value="3" type="radio">
                                                     清单单价取费
                                                 </label>
                                             </div>
@@ -489,7 +489,7 @@
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                    <a href="" class="btn btn-primary">确定</a>
+                    <a href="javascript:void(0);" class="btn btn-primary" id="property_ok" data-dismiss="modal">确定</a>
                 </div>
             </div>
         </div>

+ 26 - 38
web/building_saas/main/js/calc/bills_calc.js

@@ -235,31 +235,9 @@ let baseCalcField = [
 ];
 
 class BillsCalcHelper {
-    constructor (project, CalcFlag) {
+    constructor (project, calcFlag) {
         this.project = project;
-        this.CalcFlag = CalcFlag;
-        this.calcField = JSON.parse(JSON.stringify(feeType));
-        for (let field of this.calcField) {
-            // unitFeeCalcFlag
-            if (this.calcFlag === rationContent) {
-                field.unitFeeFlag = rationContentUnitFeeFlag;
-            } else if ( this.calcFlag === billsPrice) {
-                field.unitFeeFlag = billsPriceUnitFeeFlag;
-            } else {
-                field.unitFeeFlag = averageQtyUnitFeeFlag;
-            }
-            // totalFeeCalcFlag
-            if (field.type === 'common') {
-                if (this.CalcFlag === rationPriceConverse) {
-                    field.totalFeeFlag = sumTotalFeeFlag;
-                } else {
-                    field.totalFeeFlag = totalFeeFlag;
-                }
-            } else {
-                field.totalFeeFlag = sumTotalFeeFlag;
-            }
-        }
-        this.InitFields(this.calcField);
+        this.InitFields(this.project.calcFields);
     };
 
     getBillsGLjs (node) {
@@ -277,7 +255,7 @@ class BillsCalcHelper {
         let nodeCalc = nodeCalcObj, virData= null;
 
         // 清单单价:套用定额计算程序
-        if (this.CalcFlag === billsPrice) {
+        if (this.project.calcFlag === billsPrice) {
             rationCalcObj.calcGljs = this.getBillsGLjs(node);
             console.log(rationCalcObj.calcGljs);
             rationCalcObj.calcFields = rationCalcFields;
@@ -325,26 +303,36 @@ class BillsCalcHelper {
             node.data.feesIndex[field.type].totalFee = nodeCalcObj.sumTotalFee().toDecimal(this.project.Decimal.common.totalFee);
         }
     };
+    calcNode(node) {
+        if (node.source.children.length > 0) {
+            this.calcParent(node, this.project.calcFields);
+        } else {
+            if (node.children.length > 0) {
+                if (node.firstChild().sourceType === this.project.Ration.getSourceType()) {
+                    this.calcRationLeaf(node, this.project.calcFields);
+                } else {
+                    this.calcVolumePriceLeaf(node, this.project.calcFields);
+                }
+            } else {
+
+            }
+        }
+    }
     calcNodes (nodes) {
         for (let node of nodes) {
             if (node.sourceType !== this.project.Bills.getSourceType()) {
                 return;
             }
-
             if (node.source.children.length > 0) {
                 this.calcNodes(node.children);
-                this.calcParent(node, this.calcField);
-            } else {
-                if (node.children.length > 0) {
-                    if (node.firstChild().sourceType === this.project.Ration.getSourceType()) {
-                        this.calcRationLeaf(node, this.calcField);
-                    } else {
-                        this.calcVolumePriceLeaf(node, this.calcField);
-                    }
-                } else {
-
-                }
             }
+            this.calcNode(node);
+        }
+    };
+    converseCalc (node) {
+        if (node && node.sourceType === this.project.Bills.getSourceType()) {
+            this.calcNode(node);
+            this.converseCalc(node.parent);
         }
     };
     calcAll () {
@@ -362,5 +350,5 @@ class BillsCalcHelper {
             field.tenderTotalFee = 'feesIndex.' + field.type + '.tenderTotalFee';
             field.tenderTotalFeeSplit = field.tenderTotalFee.split('.');
         }
-    }
+    };
 }

+ 2 - 1
web/building_saas/main/js/controllers/project_controller.js

@@ -104,7 +104,8 @@ ProjectController = {
         }
     },
     calculateAll: function (project, sheetController, CalcType) {
-        let calc = new BillsCalcHelper(project, CalcType);
+        this.project.setCalcFlag(CalcType);
+        let calc = new BillsCalcHelper(project);
         calc.calcAll();
         sheetController.showTreeData();
         project.Bills.updateAll();

+ 26 - 0
web/building_saas/main/js/models/project.js

@@ -287,6 +287,32 @@ var PROJECT = {
             }
         };
 
+        project.prototype.setCalcFlag = function (calcFlag) {
+            this.calcFlag = calcFlag;
+            if (this.calcFields) {
+                for (let field of this.calcFields) {
+                    // unitFeeCalcFlag
+                    if (this.calcFlag === rationContent) {
+                        field.unitFeeFlag = rationContentUnitFeeFlag;
+                    } else if ( this.calcFlag === billsPrice) {
+                        field.unitFeeFlag = billsPriceUnitFeeFlag;
+                    } else {
+                        field.unitFeeFlag = averageQtyUnitFeeFlag;
+                    }
+                    // totalFeeCalcFlag
+                    if (field.type === 'common') {
+                        if (this.calcFlag === rationPriceConverse) {
+                            field.totalFeeFlag = sumTotalFeeFlag;
+                        } else {
+                            field.totalFeeFlag = totalFeeFlag;
+                        }
+                    } else {
+                        field.totalFeeFlag = sumTotalFeeFlag;
+                    }
+                }
+            }
+        }
+
         return new project();
     }
 };

+ 3 - 0
web/building_saas/main/js/views/calc_program_view.js

@@ -227,6 +227,9 @@ let calcProgramObj = {
         me.treeNode = treeNode;
         if (treeNode.sourceType === projectObj.project.Ration.getSourceType()) {
             projectObj.project.calcProgram.calculate(treeNode);
+           if (treeNode.parent) {
+                projectObj.converseCalculateBills(treeNode.parent);
+            }
             me.datas = me.treeNode.data.calcTemplate.calcItems;
             sheetCommonObj.initSheet(me.sheet, me.setting, me.datas.length);
             sheetCommonObj.showData(me.sheet, me.setting, me.datas);

+ 34 - 22
web/building_saas/main/js/views/project_view.js

@@ -91,6 +91,9 @@ var projectObj = {
         this.project = PROJECT.createNew(scUrlUtil.GetQueryString('project'), userID);
         this.project.loadDatas(function (err) {
             if (!err) {
+                that.project.calcFields = JSON.parse(JSON.stringify(feeType));
+                that.project.setCalcFlag(rationContent);
+
                 let str = JSON.stringify(that.project.projSetting.main_tree_col);
                 that.project.projSetting.mainGridSetting = JSON.parse(str);
                 that.project.projSetting.mainGridSetting.frozenCols = 4;
@@ -302,31 +305,31 @@ var projectObj = {
                 },
                 "spr2":'--------',
                 "calculateAll_RationContent": {
-                    name: '造价计算(子目含量取费)',
-                    callback: function () {
-                        ProjectController.calculateAll(project, controller, rationContent);
-                    }
-                },
-                "calculateAll_RationPrice": {
-                    name: '造价计算(子目单价取费)',
-                    callback: function () {
-                        ProjectController.calculateAll(project, controller, rationPrice);
-                    }
-                },
-                "calculateAll_RationPriceConverse": {
-                    name: '造价计算(子目单价取费-反算)',
-                    callback: function () {
-                        ProjectController.calculateAll(project, controller, rationPriceConverse);
-                    }
-                },
-                "calculateAll_BillsPrice": {
-                    name: '造价计算(清单单价取费)',
-                    callback: function () {
-                        ProjectController.calculateAll(project, controller, billsPrice);
-                    }
+                    name: '造价计算',
+                    callback: projectObj.calculateAll
                 }
             }
         });
+    },
+    // 计算node及node的所有父项
+    converseCalculateBills: function (node) {
+        let calc = new BillsCalcHelper(this.project);
+        calc.converseCalc(node, this.project.calcFields);
+        let cur = node, nodes = [];
+        while (cur) {
+            nodes.push(cur);
+            cur = cur.parent;
+        }
+        this.mainController.refreshTreeNode(nodes, false);
+        calc = null;
+    },
+    // 计算全部清单
+    calculateAll: function () {
+        let calc = new BillsCalcHelper(this.project);
+        calc.calcAll();
+        this.mainController.showTreeData();
+        this.project.Bills.updateAll();
+        calc = null;
     }
 };
 
@@ -407,3 +410,12 @@ $('#downMove').click(function () {
     }
 });
 
+$('#rationContent').val(rationContent);
+$('#rationPrice').val(rationPrice);
+$('#rationPriceConverse').val(rationPriceConverse);
+$('#billsPrice').val(billsPrice);
+$('#property_ok').click(function () {
+    projectObj.project.setCalcFlag(parseInt($("input[name='calcFlag']:checked").val()));
+    projectObj.calculateAll();
+});
+

TEMPAT SAMPAH
web/dest/css/fonts/fontawesome-webfont.woff2


+ 1 - 1
web/users/html/login.html

@@ -37,7 +37,6 @@
             </div>
         </form>
 
-        <script type="text/javascript" src="/web/users/js/login.js"></script>
     </div>
     <!--弹出信息-->
     <div class="modal fade" id="ver" data-backdrop="static">
@@ -75,6 +74,7 @@
     <script src="/lib/tether/tether.min.js"></script>
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/web/building_saas/js/global.js"></script>
+    <script type="text/javascript" src="/web/users/js/login.js"></script>
     <!-- endinject -->
 </body>