فهرست منبع

main, unit column

MaiXinRong 7 سال پیش
والد
کامیت
0196419173

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

@@ -112,6 +112,9 @@ var TREE_SHEET_HELPER = {
                 } else {
                 } else {
                     cell.value(getFieldText2());
                     cell.value(getFieldText2());
                 }
                 }
+                if (colSetting.data.cellType) {
+                    cell.cellType(colSetting.data.cellType);
+                }
                 if (colSetting.readOnly) {
                 if (colSetting.readOnly) {
                     if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
                     if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
                         cell.locked(colSetting.readOnly(node));
                         cell.locked(colSetting.readOnly(node));

+ 4 - 3
test/tmp_data/bills_grid_setting.js

@@ -102,8 +102,8 @@ var BillsGridSetting ={
             }
             }
         },
         },
         {
         {
-            "width":40,
-            "readOnly":false,
+            "width":60,
+            "readOnly":'readOnly.ration',
             "head":{
             "head":{
                 "titleNames":[
                 "titleNames":[
                     "计量\n单位"
                     "计量\n单位"
@@ -131,7 +131,8 @@ var BillsGridSetting ={
                 "field":"unit",
                 "field":"unit",
                 "vAlign":1,
                 "vAlign":1,
                 "hAlign":1,
                 "hAlign":1,
-                "font":"Arial"
+                "font":"Arial",
+                "cellType": 'cellType.unit'
             }
             }
         },
         },
         {
         {

+ 8 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -43,6 +43,14 @@ let MainTreeCol = {
             return MainTreeCol.readOnly.billsParent && MainTreeCol.readOnly.non_bills;
             return MainTreeCol.readOnly.billsParent && MainTreeCol.readOnly.non_bills;
         }
         }
     },
     },
+    cellType: {
+        unit: function () {
+            let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
+            combo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
+                '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']);
+            return combo;
+        }
+    },
     getEvent: function (eventName) {
     getEvent: function (eventName) {
         let names = eventName.split('.');
         let names = eventName.split('.');
         let event = this;
         let event = this;

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

@@ -94,6 +94,10 @@ var projectObj = {
                     if (col.readOnly && Object.prototype.toString.apply(col.readOnly) === "[object String]") {
                     if (col.readOnly && Object.prototype.toString.apply(col.readOnly) === "[object String]") {
                         col.readOnly = MainTreeCol.getEvent(col.readOnly);
                         col.readOnly = MainTreeCol.getEvent(col.readOnly);
                     }
                     }
+                    if (col.data.cellType && Object.prototype.toString.apply(col.data.cellType) === "[object String]") {
+                        let getCellType = MainTreeCol.getEvent(col.data.cellType);
+                        col.data.cellType = getCellType();
+                    }
                     if (col.data.digit && Object.prototype.toString.apply(col.data.digit) === "[object String]") {
                     if (col.data.digit && Object.prototype.toString.apply(col.data.digit) === "[object String]") {
                         col.data.decimal = that.project.getDecimal(col.data.digit);
                         col.data.decimal = that.project.getDecimal(col.data.digit);
                         col.data.formatter = MainTreeCol.getNumberFormatter(col.data.decimal);
                         col.data.formatter = MainTreeCol.getNumberFormatter(col.data.decimal);