Explorar el Código

计算程序展示计算数据。

Chenshilong hace 8 años
padre
commit
937bd977bd

+ 3 - 4
web/building_saas/main/js/views/project_view.js

@@ -53,12 +53,11 @@ var projectObj = {
                     gljOprObj.showDataIfRationSelect(node);
 
                     // CSL.2017.07.25
-                    if(node.sourceType=="ration" && subSpread.getActiveSheet().name()=='JSCX'){
+                    if(node.sourceType=="ration" && SubActiveSheetNameIs('JSCX')){
                         rationCalcView.showData(node);
                     }else{
-                        if (subSpread.getActiveSheet().name()=='JSCX'){
-                            //alert('clearData');
-                            rationCalcView.clearData;
+                        if (SubActiveSheetNameIs('JSCX')) {
+                            rationCalcView.clearData();
                         }
                     }
                 });

+ 3 - 4
web/building_saas/main/js/views/ration_calc_view.js

@@ -61,9 +61,8 @@ let calcRation = {
 
 let rationCalcView = {
     sheet: null,
-    libID: null,
     ration: null,
-    datas: [],
+
     setting: {
         header: [
             {headerName: "费用代号", headerWidth: 75, dataCode: "code", dataType: "String", formatter: "A"+"0", hAlign: "center"},
@@ -100,8 +99,8 @@ let rationCalcView = {
 
     clearData: function (){
         var me = this;
-        sheetCommonObj.showData(me.sheet, me.setting,[]);
-        //sheetCommonObj.cleanSheet(me.sheet, me.setting, -1);  无效
+        me.ration = null;
+        sheetCommonObj.cleanSheet(me.sheet, me.setting, -1);
     }
 
 }

+ 13 - 2
web/building_saas/main/js/views/sub_view.js

@@ -54,7 +54,13 @@ $("#linkGCLMX").click(function(){
 $("#linkJSCX").click(function(){        // 计算程序
     subSpread.setActiveSheetIndex(4);
     rationCalcView.initSheet(subSpread.getSheet(4));
-    //rationCalcView.showData();
+    let sel = projectObj.mainController.tree.selected;
+    if (sel.sourceType == 'ration'){
+        rationCalcView.showData(sel);
+    }
+    else{
+        rationCalcView.clearData();
+    };
 });
 
 $("#linkFXSM").click(function(){
@@ -67,4 +73,9 @@ $("#linkDESM").click(function(){
     subSpread.setActiveSheetIndex(6);
     // for test
     subSpread.getActiveSheet().setValue(0, 0, "定额说明");
-});
+});
+
+function SubActiveSheetNameIs(sheetName){
+    let rst = subSpread.getActiveSheet().name() == sheetName;
+    return rst;
+}