|
@@ -13,7 +13,7 @@ let zmhs_obj = {
|
|
|
{headerName: "内容", headerWidth: 350, dataCode: "content", dataType: "String", hAlign: "left"}
|
|
|
],
|
|
|
view: {
|
|
|
- lockColumns: [0,1,2]
|
|
|
+ lockColumns:[0,1,2]
|
|
|
}
|
|
|
},
|
|
|
assSpread:null,
|
|
@@ -62,14 +62,13 @@ let zmhs_obj = {
|
|
|
coeList = ration_coe.getCoeByRationID(ration.ID);
|
|
|
}
|
|
|
sheetCommonObj.showData(this.coeSheet, this.coeSetting,coeList);
|
|
|
- this.coeSheet.floatingObjects.remove("customerCoe");
|
|
|
if (coeList.length > 0) {
|
|
|
var cus_index = _.findIndex(coeList, function (item) {
|
|
|
return item.coeID == -1;
|
|
|
})
|
|
|
if (cus_index != -1) {
|
|
|
- this.addDropDownList();
|
|
|
- this.addCusButton(cus_index, 1, coeList[cus_index].name);
|
|
|
+ this.coeSheet.getCell(cus_index, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
+ this.coeSheet.setCellType(cus_index, 1, sheetCommonObj.getCustomerCoeCellType(this.generateHtmlString,this.bindCusEditorValue,this.updateCusCoeAfterEditor), GC.Spread.Sheets.SheetArea.viewport);
|
|
|
}
|
|
|
}
|
|
|
this.coeSheetData = coeList;
|
|
@@ -96,77 +95,41 @@ let zmhs_obj = {
|
|
|
if(this.coeSpread&& this.assSpread && $('#linkZMHS').hasClass('active')){
|
|
|
this.showCoeData(node);
|
|
|
this.showAssData(node);
|
|
|
- //hide floatingObject
|
|
|
- var floatingObject = this.coeSheet.floatingObjects.get('customerCoe');
|
|
|
- if (floatingObject) {
|
|
|
- floatingObject.isVisible(false);
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
onCoeCellClick: function (sender, args) {
|
|
|
let me = zmhs_obj;
|
|
|
- let floatingObject = me.coeSheet.floatingObjects.get('customerCoe');
|
|
|
- if(floatingObject){
|
|
|
- let isVisable = floatingObject.isVisible();
|
|
|
- if (isVisable) {
|
|
|
- let result = me.checkIfNeedUpdate();
|
|
|
- if (result.isNeed) {
|
|
|
- projectObj.project.ration_coe.updateCustomerCoe(result);
|
|
|
- }
|
|
|
- floatingObject.isVisible(false);
|
|
|
- }
|
|
|
+ let sheet = args.sheet, row = args.row, col = args.col;
|
|
|
+ if(sheet.getCell(row, col).locked() !=true){
|
|
|
+ if(!sheet.isEditing()) sheet.startEdit();
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
onButtonClick:function (sender, args) {
|
|
|
let me = zmhs_obj;
|
|
|
let sheet = args.sheet, row = args.row, col = args.col;
|
|
|
let cellType = sheet.getCellType(row, col);
|
|
|
- if(args.sheet.isEditing()){
|
|
|
- args.sheet.endEdit();
|
|
|
- }
|
|
|
- if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
|
|
|
- if(args.sheetName == 'ration_coe'){
|
|
|
- me.onCusButtonClick(sender, args);
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (args.sheetName == 'ration_coe' && cellType instanceof GC.Spread.Sheets.CellTypes.CheckBox) {
|
|
|
me.onCoeCheckBoxClick(sender, args)
|
|
|
}
|
|
|
},
|
|
|
- onCusButtonClick: function (sender, args) {
|
|
|
- var me = zmhs_obj;
|
|
|
- var floatingObject = me.coeSheet.floatingObjects.get('customerCoe');
|
|
|
- var isVisable = floatingObject.isVisible();
|
|
|
- if (!isVisable) {
|
|
|
- me.coeSheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
- me.showFloationObject(floatingObject, me.coeSheetData[args.row]);
|
|
|
- } else {
|
|
|
- var result = me.checkIfNeedUpdate();
|
|
|
- if (result.isNeed) {
|
|
|
- projectObj.project.ration_coe.updateCustomerCoe(result);
|
|
|
- }
|
|
|
- floatingObject.isVisible(false);
|
|
|
+ bindCusEditorValue:function(context){
|
|
|
+ let me = zmhs_obj;
|
|
|
+ if(me.coeSheetData[context.row]){
|
|
|
+ let data = me.coeSheetData[context.row];
|
|
|
+ $('#coe_ration').val(data.coes[0].amount);
|
|
|
+ $('#manual').val(data.coes[1].amount);
|
|
|
+ $('#material').val(data.coes[2].amount);
|
|
|
+ $('#manchine').val(data.coes[3].amount);
|
|
|
+ $('#mainM').val(data.coes[4].amount);
|
|
|
+ $('#equipment').val(data.coes[5].amount);
|
|
|
}
|
|
|
},
|
|
|
- showFloationObject(floatingObject, data){
|
|
|
- floatingObject.isVisible(true);
|
|
|
- var sheet = this.coeSheet;
|
|
|
- var startRow = this.coeSheetData.length;
|
|
|
- var endRow = startRow + 7;
|
|
|
- floatingObject.startRow(startRow);
|
|
|
- floatingObject.startColumn(1);
|
|
|
- floatingObject.endColumn(2);
|
|
|
- floatingObject.endRow(endRow);
|
|
|
- this.bindFloadingObjectValue(data);
|
|
|
- sheet.repaint();
|
|
|
- },
|
|
|
- bindFloadingObjectValue(data){
|
|
|
- $('#coe_ration').val(data.coes[0].amount);
|
|
|
- $('#manual').val(data.coes[1].amount);
|
|
|
- $('#material').val(data.coes[2].amount);
|
|
|
- $('#manchine').val(data.coes[3].amount);
|
|
|
- $('#mainM').val(data.coes[4].amount);
|
|
|
- $('#equipment').val(data.coes[5].amount);
|
|
|
+ updateCusCoeAfterEditor:function(){
|
|
|
+ let me = zmhs_obj;
|
|
|
+ let result = me.checkIfNeedUpdate();
|
|
|
+ if (result.isNeed) {
|
|
|
+ projectObj.project.ration_coe.updateCustomerCoe(result);
|
|
|
+ }
|
|
|
},
|
|
|
onInputChange(id, name){
|
|
|
var coe = _.find(zmhs_obj.coeSheetData, function (c) {
|
|
@@ -266,50 +229,23 @@ let zmhs_obj = {
|
|
|
let recode = me.coeSheetData[args.row];
|
|
|
projectObj.project.ration_coe.adjustCoeClick(recode, newval);
|
|
|
},
|
|
|
- addCusButton: function (row, col, text) {
|
|
|
- zmhs_obj.coeSheet.suspendPaint();
|
|
|
- var cus_button = new GC.Spread.Sheets.CellTypes.Button();
|
|
|
- zmhs_obj.coeSheet.setCellType(row, col, cus_button, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
- cus_button.marginLeft(0);
|
|
|
- cus_button.marginTop(0);
|
|
|
- cus_button.marginRight(-2);
|
|
|
- cus_button.marginBottom(-2);
|
|
|
- cus_button.text(text);
|
|
|
- cus_button.buttonBackColor('white');
|
|
|
- zmhs_obj.coeSheet.resumePaint();
|
|
|
- //zmhs_obj.coeSheet.repaint();
|
|
|
- },
|
|
|
- addDropDownList: function () {
|
|
|
- var sheet = this.coeSheet;
|
|
|
- sheet.suspendPaint();
|
|
|
- var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("customerCoe");
|
|
|
- var div = document.createElement('div');
|
|
|
- div.innerHTML = this.generateHtmlString();
|
|
|
- customFloatingObject.startRow(1);
|
|
|
- customFloatingObject.startColumn(1);
|
|
|
- customFloatingObject.endColumn(2);
|
|
|
- customFloatingObject.endRow(2);
|
|
|
- $(div).css('background', 'white');
|
|
|
- customFloatingObject.content(div);
|
|
|
- sheet.floatingObjects.add(customFloatingObject);
|
|
|
- customFloatingObject.isVisible(false);
|
|
|
- sheet.resumePaint();
|
|
|
- },
|
|
|
- generateHtmlString: function () {
|
|
|
- var newString = "<form ><table border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;>";
|
|
|
- newString += this.getOneRow('定额', 0, 'coe_ration');
|
|
|
- newString += this.getOneRow('人工', 1, 'manual');
|
|
|
- newString += this.getOneRow('材料', 2, 'material');
|
|
|
- newString += this.getOneRow('机械', 3, 'manchine');
|
|
|
- newString += this.getOneRow('主材', 4, 'mainM');
|
|
|
- newString += this.getOneRow('设备', 5, 'equipment');
|
|
|
+ generateHtmlString: function (context,cellRect) {
|
|
|
+ let me = zmhs_obj;
|
|
|
+ let height = cellRect.height;
|
|
|
+ let newString = "<div style='height:"+ height+"px'><div onclick='zmhs_obj.coeSheet.endEdit()' style='margin:-1px 1px 0px'>自定义系数</div></div><form style='margin-top:1px' ><table width='100%' cellpadding='0' border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;'>";
|
|
|
+ newString += me.getOneRow('定额', 0, 'coe_ration',height);
|
|
|
+ newString += me.getOneRow('人工', 1, 'manual',height);
|
|
|
+ newString += me.getOneRow('材料', 2, 'material',height);
|
|
|
+ newString += me.getOneRow('机械', 3, 'manchine',height);
|
|
|
+ newString += me.getOneRow('主材', 4, 'mainM',height);
|
|
|
+ newString += me.getOneRow('设备', 5, 'equipment',height);
|
|
|
newString += "</table></form>";
|
|
|
return newString;
|
|
|
},
|
|
|
- getOneRow: function (text, name, id) {
|
|
|
- var rowstr = "<tr style='height:10px'><td style='width: 50px'>" + text
|
|
|
- + ":</td><td style='width: 70px' align='right'><input type='text'value='1' name=" + name
|
|
|
- + " style='width:30px;border:0;height:14px' align='right' id=" + id + " onchange='zmhs_obj.onInputChange(this.id,this.name)'onfocus = 'zmhs_obj.coeStartEdit()' autocomplete='off'></td></tr>";
|
|
|
+ getOneRow: function (text, name, id,inputHeight) {
|
|
|
+ var rowstr = "<tr ><td style='width: 40%'>" + text
|
|
|
+ + ":</td><td style='width: 60%' align='right'><input type='text' value='1' name=" + name
|
|
|
+ + " style='width:40px;border:0;height:"+ inputHeight+"px;' align='right' id=" + id + " onchange='zmhs_obj.onInputChange(this.id,this.name)' autocomplete='off'></td></tr>";
|
|
|
return rowstr;
|
|
|
|
|
|
},
|
|
@@ -319,7 +255,6 @@ let zmhs_obj = {
|
|
|
}else {
|
|
|
zmhs_obj.coeSheet.startEdit();
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
onAssEditEnded:function (e,args) {
|
|
|
var me = zmhs_obj;
|
|
@@ -341,7 +276,6 @@ let zmhs_obj = {
|
|
|
if (args.sheetName == 'ration_ass') {
|
|
|
me.updateRationAss(args);
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
updateRationAss: function (args) {
|
|
|
var me = zmhs_obj;
|
|
@@ -389,5 +323,4 @@ let zmhs_obj = {
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
};
|