Chenshilong пре 7 година
родитељ
комит
704cc4ea31

+ 4 - 0
web/building_saas/main/html/main.html

@@ -153,6 +153,9 @@
                                   <li class="nav-item">
                                       <a class="nav-link" id="linkDESM" data-toggle="tab" href="#subSpread" role="tab">定额说明</a>
                                   </li>
+                                  <li class="nav-item">
+                                      <a class="nav-link" id="linkJSCXGL" data-toggle="tab" href="#subSpread" role="tab">计算程序管理</a>
+                                  </li>
                               </ul>
                               <!-- Tab panes -->
                               <div class="tab-content">
@@ -547,6 +550,7 @@
     <script type="text/javascript" src="/web/building_saas/main/js/views/glj_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/ration_calc_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/sub_view.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/views/ration_programs_manage.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/fee_rate_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/sub_fee_rate_views.js"></script>
 

+ 18 - 0
web/building_saas/main/html/ration_pm.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>计算程序管理</title>
+    <script src="/lib/jquery/jquery.min.js"></script>
+    <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css" type="text/css">
+    <script type="text/javascript" src="/lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
+    <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/models/ration_program.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/views/ration_programs_manage.js"></script>
+</head>
+<body>
+<div id="mainSpread" style="width:30%;height:400px;position:absolute;"></div>
+<div id="detailSpread" style="width:100%;height:400px;position:absolute;bottom:5px;"></div>
+
+</body>
+</html>

Разлика између датотеке није приказан због своје велике величине
+ 3190 - 142
web/building_saas/main/js/models/ration_program.js


+ 2 - 2
web/building_saas/main/js/views/project_view.js

@@ -168,8 +168,8 @@ var projectObj = {
 
             }
         });
-        this.rationProgram = new RationProgram(this.project);
-        this.rationProgram.compileAllTemps();
+        this.project.rationProgram = new RationProgram(this.project);
+        this.project.rationProgram.compileAllTemps();
     },
     loadMainSpreadContextMenu: function () {
         var project = this.project, spread = this.mainSpread, controller = this.mainController;

+ 8 - 6
web/building_saas/main/js/views/ration_calc_view.js

@@ -4,7 +4,7 @@
 
 let rationCalcView = {
     sheet: null,
-    ration: null,
+    treeNode: null,
 
     setting: {
         header: [
@@ -29,17 +29,19 @@ let rationCalcView = {
         sheetCommonObj.initSheet(me.sheet, me.setting, 20);
     },
 
-    showData: function (ration) {
+    showData: function (treeNode) {
         var me = this;
-        me.ration = ration;
-        projectObj.rationProgram.calculate(me.ration);
-        me.datas = me.ration.data.calcTemplate.calcItems;
+        me.treeNode = treeNode;
+        projectObj.project.rationProgram.calculate(treeNode);
+        me.datas = me.treeNode.data.calcTemplate.calcItems;
+        //me.sheet.setRowCount(me.datas.length);
+        sheetCommonObj.initSheet(me.sheet, me.setting, me.datas.length);
         sheetCommonObj.showData(me.sheet, me.setting, me.datas);
     },
 
     clearData: function (){
         var me = this;
-        me.ration = null;
+        me.treeNode = null;
         sheetCommonObj.cleanSheet(me.sheet, me.setting, -1);
     }
 

+ 77 - 0
web/building_saas/main/js/views/ration_programs_manage.js

@@ -0,0 +1,77 @@
+/**
+ * Created by CSL on 2017-08-03.
+ * 计算程序管理。
+ */
+let rationPM = {
+    datas: [],
+    mainSpread: null,
+    detailSpread: null,
+
+    mainSetting: {
+        header:[
+            {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
+            {headerName:"名称",headerWidth:200,dataCode:"name", dataType: "String"}
+        ],
+        view:{
+            comboBox:[],
+            lockColumns:[0,1]
+        }
+    },
+
+    detailSetting: {
+        header:[
+            {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
+            {headerName:"费用代号",headerWidth:80,dataCode:"code", dataType: "String"},
+            {headerName:"费用名称",headerWidth:200,dataCode:"name", dataType: "String"},
+            {headerName:"计算基数",headerWidth:180,dataCode:"dispExpr", dataType: "String"},
+            {headerName:"基数说明",headerWidth:300,dataCode:"statement", dataType: "String"},
+            {headerName:"费率",headerWidth:80,dataCode:"feeRate", dataType: "Number"},
+            {headerName:"字段名称",headerWidth:180,dataCode:"fieldName", dataType: "String"},
+            {headerName:"备注",headerWidth:100,dataCode:"memo", dataType: "String"}
+        ],
+        view:{
+            comboBox:[],
+            lockColumns:[0,1,2,3,4,5,6,7]
+        }
+    },
+
+    buildSheet: function (){
+        let me = this;
+        me.datas = calcTemplates;
+        me.mainSpread = sheetCommonObj.buildSheet($('#mainSpread')[0], me.mainSetting, 16);
+        me.detailSpread = sheetCommonObj.buildSheet($('#detailSpread')[0], me.detailSetting, 18);
+
+        //var coeType = new GC.Spread.Sheets.CellTypes.ComboBox();
+        //coeType.items(["单个","定额","人工","材料","机械"]);
+        //me.detailSpread.getSheet(0).getRange(-1, 0, -1, 1).cellType(coeType);
+
+        me.mainSpread.options.showVerticalScrollbar = false;
+        me.detailSpread.options.showVerticalScrollbar = false;
+
+        me.mainSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onMainEnterCell);
+        me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.CellChanged, me.onDetailCellChanged);
+
+        let mSheet = me.mainSpread.getSheet(0);
+        sheetCommonObj.showData(mSheet, me.mainSetting, me.datas);
+
+        let dSheet = me.detailSpread.getSheet(0);
+        sheetCommonObj.showData(dSheet, me.detailSetting, me.datas[0].calcItems);
+    },
+
+    onMainEnterCell: function(sender, args) {
+        var me = rationPM;
+        var row = args.sheet.getActiveRowIndex();
+
+        me.detailSpread.suspendPaint();
+        var dSheet = me.detailSpread.getSheet(0);
+        var dData = me.datas[row].calcItems;
+        sheetCommonObj.showData(dSheet, me.detailSetting, dData);
+        me.detailSpread.resumePaint();
+    }
+};
+
+$(document).ready(function(){
+    rationPM.buildSheet();
+});
+
+

+ 4 - 0
web/building_saas/main/js/views/sub_view.js

@@ -82,6 +82,10 @@ $("#linkDESM").click(function(){
     subSpread.getActiveSheet().setValue(0, 0, "定额说明");
 });
 
+$("#linkJSCXGL").click(function(){
+    location.href = '/web/building_saas/main/html/ration_pm.html';
+});
+
 function SubActiveSheetNameIs(sheetName){
     let rst = subSpread.getActiveSheet().name() == sheetName;
     return rst;