Browse Source

重庆18人材机相关、机型

zhongzewei 7 years ago
parent
commit
f9e9ca2d93

+ 2 - 1
modules/all_models/stdGlj_glj.js

@@ -29,7 +29,8 @@ const std_glj = new Schema({
     adjCoe: Number,
     adjCoe: Number,
     component: [std_gljComponent],
     component: [std_gljComponent],
     materialType: Number, //三材类型:钢材1、钢筋2、木材3、水泥4、标准砖5
     materialType: Number, //三材类型:钢材1、钢筋2、木材3、水泥4、标准砖5
-    materialCoe: Number //三材系数
+    materialCoe: Number, //三材系数
+    model: Number, //机型
 },{versionKey: false});
 },{versionKey: false});
 
 
 mongoose.model('std_glj_lib_gljList', std_glj, 'std_glj_lib_gljList');
 mongoose.model('std_glj_lib_gljList', std_glj, 'std_glj_lib_gljList');

+ 13 - 2
modules/std_glj_lib/controllers/viewsController.js

@@ -4,6 +4,9 @@
  */
  */
 
 
 import BaseController from "../../common/base/base_controller";
 import BaseController from "../../common/base/base_controller";
+import mongoose from 'mongoose';
+const compilationModel = mongoose.model('compilation');
+const stdGljLibModel = mongoose.model('std_glj_lib_map');
 let config = require("../../../config/config.js");
 let config = require("../../../config/config.js");
 class ViewsController extends BaseController{
 class ViewsController extends BaseController{
     redirectMain(req, res){
     redirectMain(req, res){
@@ -12,11 +15,19 @@ class ViewsController extends BaseController{
             userAccount: req.session.managerData.username
             userAccount: req.session.managerData.username
         });
         });
     }
     }
-    redirectGlj(req, res){
+    async redirectGlj(req, res){
+        let overWriteUrl = null;
+        let stdGljLib = await stdGljLibModel.findOne({ID: req.query.gljLibId, deleted: false});
+        if(stdGljLib){
+           let compilation = await compilationModel.findOne({_id: mongoose.Types.ObjectId(stdGljLib.compilationId)});
+           overWriteUrl = stdGljLib.compilationId === '5b4d581023a924000b760f2d' ? null : compilation.overWriteUrl;
+           console.log(overWriteUrl);
+        }
         res.render('maintain/std_glj_lib/html/gongliao.html',
         res.render('maintain/std_glj_lib/html/gongliao.html',
         {
         {
             userAccount: req.session.managerData.username,
             userAccount: req.session.managerData.username,
-            LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
+            LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
+            overWriteUrl: overWriteUrl
         });
         });
     }
     }
 }
 }

+ 7 - 4
public/web/sheet/sheet_common.js

@@ -292,11 +292,14 @@ var sheetCommonObj = {
         let me = this;
         let me = this;
         sheet.suspendPaint();
         sheet.suspendPaint();
         let combo = me.getDynamicCombo();
         let combo = me.getDynamicCombo();
+        if(itemsHeight) {
+            combo.itemHeight(itemsHeight);
+            combo._maxDropDownItems = itemsHeight + 5;
+        }
+        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);
         for(let i = 0, len = rowCount; i < len; i++){
         for(let i = 0, len = rowCount; i < len; i++){
-            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.getCell(beginRow + i, col).cellType(combo);
         }
         }
         sheet.resumePaint();
         sheet.resumePaint();

+ 24 - 0
public/web/tools_const.js

@@ -0,0 +1,24 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2018/8/15
+ * @version
+ */
+//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、机械台班、机械组成物、机上人工、主材、设备
+let allowGljType = [1, 201, 202, 203, 204, 205, 206, 301, 302, 303, 4, 5];
+
+//允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、主材
+let allowComponent = [202, 203, 204, 301, 4];
+//可以作为组成物的工料机类型:普通材料、机械组成物、机上人工、主材
+let componentType = [201, 302, 303, 4];
+//允许含有组成物的机械工料机类型:机械台班
+let machineAllowComponent = [301];
+//可以作为机械工料机组成物的工料机类型:机械组成物、机上人工
+let machineComponent = [302, 303];
+//允许含有组成物的材料工料机类型:混凝土、砂浆、配合比
+let materialAllowComponent = [202, 203, 204];
+//可以作为材料工料机组成物的工料机类型:普通材料
+let materialComponent = [201];

+ 2 - 0
web/maintain/std_glj_lib/html/gongliao.html

@@ -180,6 +180,7 @@
     <script type="text/javascript" src="/public/web/QueryParam.js"></script>
     <script type="text/javascript" src="/public/web/QueryParam.js"></script>
     <script type="text/javascript" src="/public/web/common_ajax.js"></script>
     <script type="text/javascript" src="/public/web/common_ajax.js"></script>
     <script type="text/javascript" src="/public/web/id_tree.js"></script>
     <script type="text/javascript" src="/public/web/id_tree.js"></script>
+    <script type="text/javascript" src="/public/web/tools_const.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
     <script type="text/javascript" src="/public/web/ration_glj_units.js"></script>
     <script type="text/javascript" src="/public/web/ration_glj_units.js"></script>
@@ -191,6 +192,7 @@
     <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
     <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
     <script type="text/javascript" src="/web/maintain/std_glj_lib/js/sheetsOpr.js"></script>
     <script type="text/javascript" src="/web/maintain/std_glj_lib/js/sheetsOpr.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
+    <script type="text/javascript" src="<%= overWriteUrl %>"></script>
     <SCRIPT type="text/javascript">
     <SCRIPT type="text/javascript">
         let userAccount = '<%=userAccount %>';
         let userAccount = '<%=userAccount %>';
         let gljSetting = {
         let gljSetting = {

+ 2 - 5
web/maintain/std_glj_lib/js/components.js

@@ -71,13 +71,10 @@ let componentOprObj = {
         }
         }
     },
     },
     setShowGljList: function (gljList, clearChecked) {
     setShowGljList: function (gljList, clearChecked) {
-        //初始为所有工料机,机械类型可添加机械组成物、机上人工,混凝土,砂浆、配合比可添加普通材料, 主材只能添加没有组成物的主材
-        let machineArr = [302, 303];
-        let materialArr = [202, 203, 204];//混凝土、砂浆、配合比, 201普通材料
         let that = repositoryGljObj, me = componentOprObj;
         let that = repositoryGljObj, me = componentOprObj;
         for(let i = 0; i < gljList.length; i++){
         for(let i = 0; i < gljList.length; i++){
-            if(that.currentGlj.gljType === 301 && machineArr.indexOf(gljList[i].gljType) !== -1 ||
-                materialArr.indexOf(that.currentGlj.gljType) !== -1 && gljList[i].gljType === 201||
+            if(machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljList[i].gljType) ||
+                materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201||
                 that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && (!gljList[i].component || gljList[i].component.length === 0) && gljList[i].ID !== that.currentGlj.ID){
                 that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && (!gljList[i].component || gljList[i].component.length === 0) && gljList[i].ID !== that.currentGlj.ID){
                 let isExist = false;
                 let isExist = false;
                 for(let j = 0; j < that.currentComponent.length; j++){
                 for(let j = 0; j < that.currentComponent.length; j++){

+ 85 - 25
web/maintain/std_glj_lib/js/glj.js

@@ -39,12 +39,12 @@ let repositoryGljObj = {
     currentCache: null,
     currentCache: null,
     parentNodeIds: {},
     parentNodeIds: {},
     gljList: [],
     gljList: [],
-    allowComponent: [202, 203, 204, 301, 4],//可带组成物类型:混凝土、砂浆、配合比、机械台班
-    componentGljType: [201, 302, 303, 4],//可成为组成物的工料机类型: 普通材料、 机械组成物、 机上人工
     //materialType: ['钢材', '木材', '水泥', '钢筋', '标准砖'],//三材类型:钢材1、钢筋101、木材2、水泥3、标准砖4
     //materialType: ['钢材', '木材', '水泥', '钢筋', '标准砖'],//三材类型:钢材1、钢筋101、木材2、水泥3、标准砖4
     materialType: {textArr: ['钢材', '钢筋', '木材', '水泥', '标准砖'], comboItems: [{text: '钢材', value: 1}, {text: '钢筋', value: 2},{text: '木材', value: 3},//三材类型:钢材1、钢筋101、木材2、水泥3、标准砖4
     materialType: {textArr: ['钢材', '钢筋', '木材', '水泥', '标准砖'], comboItems: [{text: '钢材', value: 1}, {text: '钢筋', value: 2},{text: '木材', value: 3},//三材类型:钢材1、钢筋101、木材2、水泥3、标准砖4
          {text: '水泥', value: 4}, {text: '标准砖', value: 5}]},
          {text: '水泥', value: 4}, {text: '标准砖', value: 5}]},
     materialTypeIdx: {'1': '钢材', '2': '钢筋', '3': '木材', '4': '水泥', '5': '标准砖'},
     materialTypeIdx: {'1': '钢材', '2': '钢筋', '3': '木材', '4': '水泥', '5': '标准砖'},
+    machineModel: {textArr: ['特', '大', '中', '小'], comboItems: [{text: '特', value: 1}, {text: '大', value: 2},{text: '中', value: 3}, {text: '小', value: 4}]},
+    machineModelIdx: {'1': '特', '2': '大', '3': '中', '4': '小'},
     distTypeTree: null,//add
     distTypeTree: null,//add
     setting: {
     setting: {
         owner: "glj",
         owner: "glj",
@@ -58,6 +58,7 @@ let repositoryGljObj = {
             {headerName:"调整系数",headerWidth:60,dataCode:"adjCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
             {headerName:"调整系数",headerWidth:60,dataCode:"adjCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
             {headerName:"三材类别",headerWidth:90,dataCode:"materialType", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"三材类别",headerWidth:90,dataCode:"materialType", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"三材系数",headerWidth:60,dataCode:"materialCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
             {headerName:"三材系数",headerWidth:60,dataCode:"materialCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"机型",headerWidth:60,dataCode:"model", dataType: "Number", hAlign: "center", vAlign: "center"},
         ],
         ],
         view:{
         view:{
             comboBox:[
             comboBox:[
@@ -67,6 +68,14 @@ let repositoryGljObj = {
             ]
             ]
         }
         }
     },
     },
+    existsGljType: function (gljType, v) {
+        for(let attr in gljType){
+            if(gljType[attr] == v){
+                return true;
+            }
+        }
+        return false;
+    },
     setUnitCombo: function (sheet, headers) {
     setUnitCombo: function (sheet, headers) {
         let me = this;
         let me = this;
         sheet.suspendPaint();
         sheet.suspendPaint();
@@ -97,15 +106,19 @@ let repositoryGljObj = {
                 children: [],
                 children: [],
                 parent: null
                 parent: null
             }
             }
-            distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
-            distTypeTree.distTypesArr.push(typeObj);
+            if(allowGljType.includes(typeData.ID)){
+                distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
+                distTypeTree.distTypesArr.push(typeObj);
+            }
         });
         });
         gljDistType.forEach(function (typeData) {
         gljDistType.forEach(function (typeData) {
-            distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
-            let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
-            if(parent){
-                distType.parent = parent;
-                parent.children.push(distType);
+            if(allowGljType.includes(typeData.ID)){
+                distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
+                let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
+                if(parent){
+                    distType.parent = parent;
+                    parent.children.push(distType);
+                }
             }
             }
         });
         });
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
@@ -208,9 +221,10 @@ let repositoryGljObj = {
         if (me.workBook) {
         if (me.workBook) {
             let cacheSection = data;
             let cacheSection = data;
             sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
             sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
-            sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree, me.materialTypeIdx);
-            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, false, 'text');
+            sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection, me.distTypeTree, me.materialTypeIdx, me.machineModelIdx);
+            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 5, me.workBook.getActiveSheet().getRowCount(), me.distTypeTree.comboDatas, 10, 'text');
             sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 7, me.workBook.getActiveSheet().getRowCount(), me.materialType.comboItems, false, 'text');
             sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 7, me.workBook.getActiveSheet().getRowCount(), me.materialType.comboItems, false, 'text');
+            sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 9, me.workBook.getActiveSheet().getRowCount(), me.machineModel.comboItems, false, 'text');
             cacheSection = null;
             cacheSection = null;
             me.initSel(0);
             me.initSel(0);
         }
         }
@@ -363,7 +377,7 @@ let repositoryGljObj = {
         if(row < me.currentCache.length){
         if(row < me.currentCache.length){
             //标记当前工料机
             //标记当前工料机
             me.currentGlj = me.currentCache[row];
             me.currentGlj = me.currentCache[row];
-            if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
+            if(allowComponent.includes(me.currentCache[row].gljType)){
                 //展示数据
                 //展示数据
                 if(me.currentGlj.component.length > 0){
                 if(me.currentGlj.component.length > 0){
                     me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
                     me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
@@ -394,7 +408,7 @@ let repositoryGljObj = {
         let thisDataCode = me.setting.header[args.col].dataCode,
         let thisDataCode = me.setting.header[args.col].dataCode,
             lastDataCode = me.setting.header[me.lastCell.col].dataCode;
             lastDataCode = me.setting.header[me.lastCell.col].dataCode;
         if(thisDataCode === 'unit'|| lastDataCode === 'unit' || thisDataCode === 'gljType' || lastDataCode === 'gljType'
         if(thisDataCode === 'unit'|| lastDataCode === 'unit' || thisDataCode === 'gljType' || lastDataCode === 'gljType'
-            || thisDataCode === 'materialType' || lastDataCode === 'materialType'){
+            || thisDataCode === 'materialType' || lastDataCode === 'materialType' || thisDataCode === 'model' || lastDataCode === 'model'){
             let rects = [];
             let rects = [];
             rects.push(args.sheet.getCellRect(args.row, args.col));
             rects.push(args.sheet.getCellRect(args.row, args.col));
             if(me.lastCell){
             if(me.lastCell){
@@ -417,7 +431,6 @@ let repositoryGljObj = {
         }
         }
         if(isHasData){
         if(isHasData){
             if(me.editingRowIdx !== me.cellRowIdx) {
             if(me.editingRowIdx !== me.cellRowIdx) {
-                let isComple = true;
                 let focusToCol;
                 let focusToCol;
                 function getFocusToCol (me){
                 function getFocusToCol (me){
                     if(!me.addGljObj[me.setting.header[0].dataCode]){
                     if(!me.addGljObj[me.setting.header[0].dataCode]){
@@ -474,10 +487,11 @@ let repositoryGljObj = {
         if(args.row < me.currentCache.length){
         if(args.row < me.currentCache.length){
             let dataCode = me.setting.header[args.col].dataCode;
             let dataCode = me.setting.header[args.col].dataCode;
             me.currentGlj = me.currentCache[args.row];
             me.currentGlj = me.currentCache[args.row];
-            if(dataCode === 'code' || (dataCode === 'basePrice' && me.allowComponent.indexOf(me.currentGlj.gljType) !== -1
+            if(dataCode === 'code' || (dataCode === 'basePrice' && allowComponent.includes(me.currentGlj.gljType)
                 && me.currentGlj.component.length > 0)
                 && me.currentGlj.component.length > 0)
                 || (dataCode === 'adjCoe' && me.currentGlj.gljType !== 1 && me.currentGlj.gljType !== 303)
                 || (dataCode === 'adjCoe' && me.currentGlj.gljType !== 1 && me.currentGlj.gljType !== 303)
-                || (dataCode === 'materialCoe' && !me.currentGlj.materialType)){
+                || (dataCode === 'materialCoe' && !me.currentGlj.materialType)
+                || (dataCode === 'model' && me.currentGlj.gljType !== 301)){
                 args.cancel = true;
                 args.cancel = true;
             }
             }
             else {
             else {
@@ -513,8 +527,13 @@ let repositoryGljObj = {
                             if((me.currentEditingGlj.gljType === 1 || me.currentEditingGlj.gljType === 303) && !(rObj.gljType === 1 || rObj.gljType === 303)){
                             if((me.currentEditingGlj.gljType === 1 || me.currentEditingGlj.gljType === 303) && !(rObj.gljType === 1 || rObj.gljType === 303)){
                                 rObj.adjCoe = null;
                                 rObj.adjCoe = null;
                             }
                             }
-                            if(me.componentGljType.indexOf(me.currentEditingGlj.gljType) !== -1 &&
-                                !(me.currentEditingGlj.gljType === 302 && rObj.gljType === 303) && !(me.currentEditingGlj.gljType === 303 && rObj.gljType === 302)){//修改了原本是组成物的工料机
+                            //工料机类型不为机械台班时,清空机型
+                            if(me.currentEditingGlj.gljType === 301 && rObj.gljType !== 301 && me.currentEditingGlj.model){
+                                rObj.model = null;
+                            }
+                            if(componentType.includes(me.currentEditingGlj.gljType)&&
+                                !(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType)) &&
+                                !(materialComponent.includes(me.currentEditingGlj.gljType) && materialComponent.includes(rObj.gljType))){//修改了原本是组成物的工料机
                                //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                                //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                                 let updateGljs = me.getUpdateGljs(rObj, true);
                                 let updateGljs = me.getUpdateGljs(rObj, true);
                                 if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
                                 if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
@@ -680,8 +699,8 @@ let repositoryGljObj = {
                                     else {
                                     else {
                                         if(dataCode === 'basePrice'){
                                         if(dataCode === 'basePrice'){
                                             //如果类型不为混凝土、砂浆、配合比、机械、主材且无组成物,才可删除单价 basePrice = 0
                                             //如果类型不为混凝土、砂浆、配合比、机械、主材且无组成物,才可删除单价 basePrice = 0
-                                            if(me.allowComponent.indexOf(updateObj.gljType) === -1 ||
-                                                (me.allowComponent.indexOf(updateObj.gljType) !== -1 && updateObj.component.length === 0)){
+                                            if(!allowComponent.includes(updateObj.gljType) ||
+                                                (allowComponent.includes(updateObj.gljType) && updateObj.component.length === 0)){
                                                 canUpdate = true;
                                                 canUpdate = true;
                                                 updateObj[dataCode] = 0;
                                                 updateObj[dataCode] = 0;
                                                 updateBasePrcArr.push({gljId: updateObj.ID, gljType: updateObj.gljType, basePrice: 0});
                                                 updateBasePrcArr.push({gljId: updateObj.ID, gljType: updateObj.gljType, basePrice: 0});
@@ -775,8 +794,13 @@ let repositoryGljObj = {
                     else if((pasteObj.gljType === 1 || pasteObj.gljType === 303) && typeof pasteObj.adjCoe !== 'undefined' && !isNaN(pasteObj.adjCoe) && pasteObj.adjCoe % 1 === 0) {
                     else if((pasteObj.gljType === 1 || pasteObj.gljType === 303) && typeof pasteObj.adjCoe !== 'undefined' && !isNaN(pasteObj.adjCoe) && pasteObj.adjCoe % 1 === 0) {
                         tempObj.adjCoe = pasteObj.adjCoe;
                         tempObj.adjCoe = pasteObj.adjCoe;
                     }
                     }
-                    if(me.componentGljType.indexOf(tempObj.gljType) !== -1 &&
-                        !(tempObj.gljType === 302 && pasteObj.gljType === 303) && !(tempObj.gljType === 303 && pasteObj.gljType === 302)){//修改了原本是组成物的工料机
+                    if(pasteObj.gljType !== 301 && tempObj.gljType === 301){
+                        tempObj.model = null;
+                    }
+                    if(componentType.includes(tempObj.gljType) &&
+                        //!(tempObj.gljType === 302 && pasteObj.gljType === 303) && !(tempObj.gljType === 303 && pasteObj.gljType === 302)){//修改了原本是组成物的工料机
+                        !(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
+                        !(materialComponent.includes(tempObj.gljType) && materialComponent.includes(pasteObj.gljType))){//修改了原本是组成物的工料机
                         //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                         //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                         let updateGljs = me.getUpdateGljs(tempObj, true);
                         let updateGljs = me.getUpdateGljs(tempObj, true);
                         if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
                         if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
@@ -850,6 +874,29 @@ let repositoryGljObj = {
                 tempObj.materialCoe = pasteObj.materialCoe !== '' ? scMathUtil.roundTo(parseFloat(pasteObj.materialCoe), -5) : null;
                 tempObj.materialCoe = pasteObj.materialCoe !== '' ? scMathUtil.roundTo(parseFloat(pasteObj.materialCoe), -5) : null;
             }
             }
         }
         }
+        if(typeof pasteObj.model !== 'undefined'){
+            if(!me.machineModel.textArr.includes(pasteObj.model)){
+                isValid = false;
+            }
+            else {
+                let existsModel = false;
+                if((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 301) ||
+                    (tempObj.gljType && tempObj.gljType === 301)){
+                    me.machineModel.comboItems.forEach(function (item) {
+                        if(item.text === pasteObj.model){
+                            tempObj.model = item.value;
+                            existsModel = true;
+                        }
+                    });
+                    if(!existsModel){
+                        isValid = false;
+                    }
+                }
+                else {
+                    isValid = false;
+                }
+            }
+        }
         if(isValid){
         if(isValid){
             rst.updateGlj.push(tempObj);
             rst.updateGlj.push(tempObj);
             if(reCalBasePrc){
             if(reCalBasePrc){
@@ -916,6 +963,16 @@ let repositoryGljObj = {
                 return false;
                 return false;
             }
             }
         }
         }
+        if(typeof pasteObj.model !== 'undefined' && pasteObj.model){
+            if(!me.machineModel.textArr.includes(pasteObj.model) || pasteObj.gljType !== 301){
+                return false;
+            }
+            me.machineModel.comboItems.forEach(function (item) {
+                if(item.text === pasteObj.model){
+                    pasteObj.model = item.value;
+                }
+            });
+        }
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
         if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
         if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
             pasteObj.gljClass = me.gljCurTypeId;
             pasteObj.gljClass = me.gljCurTypeId;
@@ -939,7 +996,7 @@ let repositoryGljObj = {
                 for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
                 for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
                     let row = i + info.cellRange.row;
                     let row = i + info.cellRange.row;
                     if(row < me.currentCache.length){
                     if(row < me.currentCache.length){
-                        if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1 && me.currentCache[row].component.length > 0){
+                        if(allowComponent.includes(me.currentCache[row].gljType) && me.currentCache[row].component.length > 0){
                             rst = false;
                             rst = false;
                         }
                         }
                     }
                     }
@@ -996,7 +1053,7 @@ let repositoryGljObj = {
                 }
                 }
             }
             }
             //if(info.cellRange.colCount === me.setting.header.length){
             //if(info.cellRange.colCount === me.setting.header.length){
-            if(info.cellRange.colCount >= me.setting.header.length - 3 && info.cellRange.colCount <= me.setting.header.length){
+            if(info.cellRange.colCount >= me.setting.header.length - 4 && info.cellRange.colCount <= me.setting.header.length){
                 for(let i = updateCount ; i < items.length; i++){
                 for(let i = updateCount ; i < items.length; i++){
                     if(me.isValidObj(items[i])){
                     if(me.isValidObj(items[i])){
                         items[i].component = [];
                         items[i].component = [];
@@ -1011,7 +1068,7 @@ let repositoryGljObj = {
         }
         }
         else{
         else{
             //if(info.cellRange.colCount === me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
             //if(info.cellRange.colCount === me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
-            if(info.cellRange.colCount >= me.setting.header.length - 3 && info.cellRange.colCount <= me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
+            if(info.cellRange.colCount >= me.setting.header.length - 4 && info.cellRange.colCount <= me.setting.header.length && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
                 for(let i = 0; i < items.length; i++){
                 for(let i = 0; i < items.length; i++){
                     if(me.isValidObj(items[i])){
                     if(me.isValidObj(items[i])){
                         items[i].component = [];
                         items[i].component = [];
@@ -1040,6 +1097,9 @@ let repositoryGljObj = {
                         else if(dCode === 'materialType'){
                         else if(dCode === 'materialType'){
                             info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode] ? me.materialTypeIdx[me.currentCache[resumeArr[i]][dCode]]: '');
                             info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode] ? me.materialTypeIdx[me.currentCache[resumeArr[i]][dCode]]: '');
                         }
                         }
+                        else if(dCode === 'model'){
+                            info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode] ? me.machineModelIdx[me.currentCache[resumeArr[i]][dCode]]: '');
+                        }
                         else{
                         else{
                             info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode]);
                             info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode]);
                         }
                         }

+ 13 - 14
web/maintain/std_glj_lib/js/gljComponent.js

@@ -151,7 +151,7 @@ let gljComponentOprObj = {
                     //控制按钮是否可用
                     //控制按钮是否可用
                     let insertDis = false,
                     let insertDis = false,
                         delDis = false;
                         delDis = false;
-                    if(!(that.currentGlj && that.allowComponent.indexOf(that.currentGlj.gljType) !== -1) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
+                    if(!(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
                         insertDis = true;
                         insertDis = true;
                     }
                     }
                     if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
                     if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
@@ -213,7 +213,7 @@ let gljComponentOprObj = {
         let thatRow = that.workBook.getSheet(0).getSelections()[0].row;
         let thatRow = that.workBook.getSheet(0).getSelections()[0].row;
         if(thatRow < that.currentCache.length){
         if(thatRow < that.currentCache.length){
             that.currentGlj = that.currentCache[thatRow];
             that.currentGlj = that.currentCache[thatRow];
-            if(me.setting.view.lockedCols.indexOf(args.col) !== -1 || that.allowComponent.indexOf(that.currentGlj.gljType) === -1 ||
+            if(me.setting.view.lockedCols.indexOf(args.col) !== -1 || !allowComponent.includes(that.currentGlj.gljType) ||
                 (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList)) ||
                 (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList)) ||
                 (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
                 (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
                 args.cancel = true;
                 args.cancel = true;
@@ -225,15 +225,15 @@ let gljComponentOprObj = {
     },
     },
     onCellEditEnd: function (sender, args) {
     onCellEditEnd: function (sender, args) {
         let me = gljComponentOprObj, that = repositoryGljObj, updateBasePrc = [];
         let me = gljComponentOprObj, that = repositoryGljObj, updateBasePrc = [];
-        let gljList = that.gljList, updateArr = [], materialComponent = [202, 203, 204], machineComponent = [302, 303];
+        let gljList = that.gljList, updateArr = [];
         //if(args.editingText !== me.currentEditingComponent.code){
         //if(args.editingText !== me.currentEditingComponent.code){
         if(args.col === 0 && args.editingText && args.editingText.trim().length > 0 && args.editingText !== me.currentEditingComponent.code){
         if(args.col === 0 && args.editingText && args.editingText.trim().length > 0 && args.editingText !== me.currentEditingComponent.code){
             let component = that.currentGlj.component, hasCode = false;
             let component = that.currentGlj.component, hasCode = false;
             for(let i = 0; i < gljList.length; i++){
             for(let i = 0; i < gljList.length; i++){
                 if(gljList[i].code === args.editingText){//有效的组成物
                 if(gljList[i].code === args.editingText){//有效的组成物
                     hasCode = true;
                     hasCode = true;
-                    if((materialComponent.indexOf(that.currentGlj.gljType) !== -1 && gljList[i].gljType === 201)
-                        || (that.currentGlj.gljType === 301 && machineComponent.indexOf(gljList[i].gljType) !== -1 )
+                    if((materialAllowComponent.includes(that.currentGlj.gljType) && gljList[i].gljType === 201)
+                        || (machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljList[i].gljType))
                         || (that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && that.currentGlj.ID !== gljList[i].ID)){//普通材料
                         || (that.currentGlj.gljType === 4 && gljList[i].gljType === 4 && that.currentGlj.ID !== gljList[i].ID)){//普通材料
                         //是否与原有组成物不同
                         //是否与原有组成物不同
                         let isExist = false;
                         let isExist = false;
@@ -292,11 +292,11 @@ let gljComponentOprObj = {
 
 
                     }
                     }
                     else{
                     else{
-                        if(materialComponent.indexOf(that.currentGlj.gljType) === 1){
-                            alert("该组成物只能是普通材料!");
+                        if(materialAllowComponent.includes(that.currentGlj.gljType)){
+                            alert("无效的组成物!");
                         }
                         }
-                        else if(that.currentGlj.gljType === 301){
-                            alert("该组成物只能是机械组成物或机上人工!")
+                        else if(machineAllowComponent.includes(that.currentGlj.gljType)){
+                            alert("无效的组成物!")
                         }
                         }
                         args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
                         args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
                             me.currentEditingComponent[me.setting.header[args.col].dataCode]: '');
                             me.currentEditingComponent[me.setting.header[args.col].dataCode]: '');
@@ -366,19 +366,18 @@ let gljComponentOprObj = {
         }
         }
     },
     },
     onClipboardPasted: function (sender, info) {
     onClipboardPasted: function (sender, info) {
-        let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [] ,materialComponent = [202, 203, 204], machineComponent = [302, 303],
-            component = that.currentGlj.component, newComponent = [], concatComponent = [], isChange = false, updateBasePrc = [];
+        let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [],
+            component = that.currentGlj.component, isChange = false, updateBasePrc = [];
         let items = sheetCommonObj.analyzePasteData(me.setting, info);
         let items = sheetCommonObj.analyzePasteData(me.setting, info);
         let gljCache = that.gljList;
         let gljCache = that.gljList;
-        let resumeArr = [];
         if(info.cellRange.col === 0){
         if(info.cellRange.col === 0){
             for(let i = 0; i < items.length; i++){
             for(let i = 0; i < items.length; i++){
                 let existCode = false;
                 let existCode = false;
                 for(let j = 0; j < gljCache.length; j++){
                 for(let j = 0; j < gljCache.length; j++){
                     if(items[i].code === gljCache[j].code){
                     if(items[i].code === gljCache[j].code){
                         existCode = true;
                         existCode = true;
-                        if((materialComponent.indexOf(that.currentGlj.gljType) !== -1 && gljCache[j].gljType === 201)
-                            || (that.currentGlj.gljType === 301 && machineComponent.indexOf(gljCache[j].gljType) !== -1 )
+                        if((materialAllowComponent.includes(that.currentGlj.gljType) && gljCache[j].gljType === 201)
+                            || (machineAllowComponent.includes(that.currentGlj.gljType) && machineComponent.includes(gljCache[j].gljType))
                             || (that.currentGlj.gljType === 4 && gljCache[j].gljType === 4 && that.currentGlj.ID !== gljCache[i].ID)){
                             || (that.currentGlj.gljType === 4 && gljCache[j].gljType === 4 && that.currentGlj.ID !== gljCache[i].ID)){
                             //是否与原有组成物不同
                             //是否与原有组成物不同
                             let isExist = false;
                             let isExist = false;

+ 13 - 1
web/maintain/std_glj_lib/js/sheetsOpr.js

@@ -22,7 +22,7 @@ let sheetsOprObj = {
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
         }
         }
     },
     },
-    showData: function(sheet, setting, data, distTypeTree, materialTypeIdx) {
+    showData: function(sheet, setting, data, distTypeTree, materialTypeIdx, machineModelIdx) {
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         sheet.suspendPaint();
         sheet.suspendPaint();
         sheet.suspendEvent();
         sheet.suspendEvent();
@@ -45,6 +45,7 @@ let sheetsOprObj = {
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
             }
             }
             for (var row = 0; row < data.length; row++) {
             for (var row = 0; row < data.length; row++) {
+               // console.log(row);
                 //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);
                 //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);
                 if(setting.header[col].dataCode === 'gljType' && data[row].gljType){
                 if(setting.header[col].dataCode === 'gljType' && data[row].gljType){
                     let distTypeVal =  distTypeTree.distTypes[distTypeTree.prefix + data[row].gljType].data.fullName;
                     let distTypeVal =  distTypeTree.distTypes[distTypeTree.prefix + data[row].gljType].data.fullName;
@@ -53,6 +54,9 @@ let sheetsOprObj = {
                 else if(setting.header[col].dataCode === 'materialType' && data[row].materialType){
                 else if(setting.header[col].dataCode === 'materialType' && data[row].materialType){
                     sheet.setValue(row, col, materialTypeIdx[data[row].materialType]);
                     sheet.setValue(row, col, materialTypeIdx[data[row].materialType]);
                 }
                 }
+                else if(setting.header[col].dataCode === 'model' && data[row].model){
+                    sheet.setValue(row, col, machineModelIdx[data[row].model]);
+                }
                 else if(setting.header[col].dataCode === 'select'){
                 else if(setting.header[col].dataCode === 'select'){
                     if(data[row].isChecked === true){
                     if(data[row].isChecked === true){
                         sheet.getCell(row, col).value(1);
                         sheet.getCell(row, col).value(1);
@@ -74,6 +78,7 @@ let sheetsOprObj = {
         let items = comboBoxCellType.items();
         let items = comboBoxCellType.items();
         let materialTypeCombo = sheet.getCellType(row, 7);
         let materialTypeCombo = sheet.getCellType(row, 7);
         let materialItems = materialTypeCombo.items();
         let materialItems = materialTypeCombo.items();
+        let machineItems = sheet.getCellType(row, 9).items();
         for (var col = 0; col < setting.header.length; col++) {
         for (var col = 0; col < setting.header.length; col++) {
             if(setting.header[col].dataCode === 'gljType'){
             if(setting.header[col].dataCode === 'gljType'){
                 items.forEach(function(item){
                 items.forEach(function(item){
@@ -92,6 +97,13 @@ let sheetsOprObj = {
                     }
                     }
                 });
                 });
             }
             }
+            else if(setting.header[col].dataCode === 'model'){
+                machineItems.forEach(function(item){
+                    if(sheet.getValue(row, col) === item.text){
+                        rst[setting.header[col].dataCode] = item.value;
+                    }
+                });
+            }
             else if (setting.header[col].dataCode === 'code'){
             else if (setting.header[col].dataCode === 'code'){
                 if(repositoryGljObj){
                 if(repositoryGljObj){
                     let gljList = repositoryGljObj.gljList,
                     let gljList = repositoryGljObj.gljList,

+ 32 - 0
web/over_write/js/chongqing_2018.js

@@ -0,0 +1,32 @@
+/**
+ * Created by Zhong on 2018/8/14.
+ */
+//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆、其他材料费、机械台班、机上人工、机械组成物、仪器仪表、燃料动力费、折旧费、
+// 检修费、维护费、安拆费及场外运费、校验费、其他费用、主材、企业管理费、利润、一般风险费
+if(allowGljType){
+    allowGljType = [1, 201, 202, 203, 204, 205, 206, 207, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 4, 6, 7, 8];
+}
+if(allowComponent){
+    //允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、仪器仪表、主材
+    allowComponent = [202, 203, 204, 301, 304, 4];
+}
+if(componentType){
+    //可以作为组成物的工料机类型:普通材料、机械组成物、机上人工、燃料动力费、折旧费、检修费、维护费、安拆费及场外运费、校验费、其他费用、主材
+    componentType = [201, 302, 303, 305, 306, 307, 308, 309, 310, 311, 4];
+}
+if(machineAllowComponent){
+    //允许含有组成物的机械工料机类型:机械台班、仪器仪表
+    machineAllowComponent = [301, 304];
+}
+if(machineComponent){
+    //可以作为机械工料机组成物的工料机类型:机械组成物、机上人工、燃料动力费、折旧费、检修费、维护费、安拆费及场外运费、校验费、其他费用
+    machineComponent = [302, 303, 305, 306, 307, 308, 309, 310, 311];
+}
+if(materialAllowComponent){
+    //允许含有组成物的材料工料机类型:混凝土、砂浆、配合比
+    materialAllowComponent = [202, 203, 204];
+}
+if(materialComponent){
+    //可以作为材料工料机组成物的工料机类型:普通材料
+    materialComponent = [201];
+}