|
@@ -9,14 +9,15 @@ var rationAssistOprObj = {
|
|
|
header:[
|
|
|
{headerName:"调整名称",headerWidth:200,dataCode:"name", dataType: "String", hAlign: "left"},
|
|
|
{headerName:"辅助定额号",headerWidth:120,dataCode:"assistCode", dataType: "String", hAlign: "center"},
|
|
|
- {headerName:"标准值",headerWidth:100,dataCode:"stdValue", dataType: "Number", hAlign: "right"},
|
|
|
- {headerName:"步距",headerWidth:100,dataCode:"stepValue", dataType: "Number", hAlign: "right"},
|
|
|
- {headerName:"精度",headerWidth:80,dataCode:"decimal", formatter: "0", dataType: "Number", hAlign: "right"},
|
|
|
+ {headerName:"标准值",headerWidth:100,dataCode:"stdValue", dataType: "String", hAlign: "right"},
|
|
|
+ {headerName:"步距",headerWidth:100,dataCode:"stepValue", dataType: "String", hAlign: "right"},
|
|
|
+ {headerName:"精度",headerWidth:80,dataCode:"decimal", dataType: "String", hAlign: "right"},
|
|
|
{headerName:"进位方式",headerWidth:100,dataCode:"carryBit", dataType: "String", hAlign: "center"},
|
|
|
- {headerName:"最小值",headerWidth:100,dataCode:"minValue", dataType: "Number", hAlign: "right"},
|
|
|
- {headerName:"最大值",headerWidth:100,dataCode:"maxValue", dataType: "Number", hAlign: "right"}
|
|
|
+ {headerName:"最小值",headerWidth:100,dataCode:"minValue", dataType: "String", hAlign: "right"},
|
|
|
+ {headerName:"最大值",headerWidth:100,dataCode:"maxValue", dataType: "String", hAlign: "right"}
|
|
|
],
|
|
|
- view:{}
|
|
|
+ view:{},
|
|
|
+ comboItems: ["四舍五入", "进一"]
|
|
|
},
|
|
|
|
|
|
buildSheet: function(sheet) {
|
|
@@ -27,16 +28,21 @@ var rationAssistOprObj = {
|
|
|
|
|
|
sheetCommonObj.initSheet(me.sheet, me.setting, 30);
|
|
|
|
|
|
- var carryBit = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
+ /*var carryBit = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
carryBit.items(["四舍五入","进一"]);
|
|
|
- me.sheet.getRange(-1, 5, -1, 1).cellType(carryBit);
|
|
|
+ me.sheet.getRange(-1, 5, -1, 1).cellType(carryBit);*/
|
|
|
|
|
|
me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
|
|
|
me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
|
|
|
me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
|
|
|
+ me.sheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onEnterCell);
|
|
|
//me.sheet.bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
|
|
|
},
|
|
|
|
|
|
+ onEnterCell: function (sender, args) {
|
|
|
+ args.sheet.repaint();
|
|
|
+ },
|
|
|
+
|
|
|
onClipboardPasting: function(sender, args) {
|
|
|
var me = rationAssistOprObj;
|
|
|
if (!me.ration) {
|
|
@@ -60,6 +66,8 @@ var rationAssistOprObj = {
|
|
|
me.sheet.getParent().focus(true);
|
|
|
});
|
|
|
sheetCommonObj.cleanData(me.sheet, me.setting, -1);
|
|
|
+ sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
|
|
|
+ sheetCommonObj.setDynamicCombo(me.sheet, assList.length, 5, me.sheet.getRowCount() - assList.length, me.setting.comboItems, false, false);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.ration.rationAssList);
|
|
|
},
|
|
|
|
|
@@ -69,7 +77,18 @@ var rationAssistOprObj = {
|
|
|
var assList = me.ration.rationAssList;
|
|
|
//var assObj = sheetCommonObj.combineRowData(me.sheet, me.setting, args.row);
|
|
|
var assObj = sheetsOprObj.combineRationRowData(me.sheet, me.setting, args.row);
|
|
|
- if(args.col === 2 || args.col === 3 || args.col === 6 || args.col === 7){
|
|
|
+ let dataCode = me.setting.header[args.col].dataCode;
|
|
|
+ if((args.col === 2 || args.col === 3 || args.col === 6 || args.col === 7)
|
|
|
+ && args.editingText && args.editingText.toString().trim().length > 0 && isNaN(args.editingText)){
|
|
|
+ args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : '');
|
|
|
+ alert(me.setting.header[args.col].headerName + '只能为数值!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if(args.col === 4 && args.editingText && (args.editingText.toString().trim().length === 0 ||
|
|
|
+ isNaN(args.editingText) || args.editingText % 1 !== 0)){
|
|
|
+ args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : 0);
|
|
|
+ alert(me.setting.header[args.col].headerName + '只能为整数!');
|
|
|
+ return;
|
|
|
}
|
|
|
// 新增
|
|
|
if ((assList == undefined) || (assList && args.row >= assList.length)) {
|
|
@@ -84,6 +103,8 @@ var rationAssistOprObj = {
|
|
|
me.sheet.getParent().focus(true);
|
|
|
});
|
|
|
sheetCommonObj.cleanData(me.sheet, me.setting, -1);
|
|
|
+ sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
|
|
|
+ sheetCommonObj.setDynamicCombo(me.sheet, assList.length, 5, me.sheet.getRowCount() - assList.length, me.setting.comboItems, false, false);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, assList);
|
|
|
},
|
|
|
|
|
@@ -125,6 +146,8 @@ var rationAssistOprObj = {
|
|
|
workBook.focus(true);
|
|
|
});
|
|
|
sheetCommonObj.cleanData(me.sheet, me.setting, -1);
|
|
|
+ sheetCommonObj.setStaticCombo(me.sheet, 0, 5, curCahe.length, me.setting.comboItems, false);
|
|
|
+ sheetCommonObj.setDynamicCombo(me.sheet, curCahe.length, 5, me.sheet.getRowCount() - curCahe.length, me.setting.comboItems, false);
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, curCahe);
|
|
|
}
|
|
|
}
|
|
@@ -140,9 +163,11 @@ var rationAssistOprObj = {
|
|
|
sheetCommonObj.cleanSheet(me.sheet, me.setting, -1);
|
|
|
sheetCommonObj.unShieldAllCells(me.sheet);
|
|
|
|
|
|
+ sheetCommonObj.setStaticCombo(me.sheet, 0, 5, ration.rationAssList.length, me.setting.comboItems, false);
|
|
|
+ sheetCommonObj.setDynamicCombo(me.sheet, ration.rationAssList.length, 5, me.sheet.getRowCount() - ration.rationAssList.length, me.setting.comboItems, false, false);
|
|
|
+
|
|
|
if (ration == undefined || ration.rationAssList == undefined ||
|
|
|
ration.rationAssList.length == 0){return;};
|
|
|
-
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, ration.rationAssList);
|
|
|
}
|
|
|
}
|