|
@@ -140,8 +140,7 @@ let calcBaseView = {
|
|
|
ifEdit: function (type, row) {
|
|
ifEdit: function (type, row) {
|
|
|
if (type == 'ration'){
|
|
if (type == 'ration'){
|
|
|
return true;
|
|
return true;
|
|
|
- }
|
|
|
|
|
- else{
|
|
|
|
|
|
|
+ } else{
|
|
|
let selected = projectObj.project.mainTree.items[row];
|
|
let selected = projectObj.project.mainTree.items[row];
|
|
|
return selected && MainTreeCol.readOnly.forCalcBase(selected)?false:true;
|
|
return selected && MainTreeCol.readOnly.forCalcBase(selected)?false:true;
|
|
|
}
|
|
}
|
|
@@ -347,90 +346,18 @@ let calcBaseView = {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- getCalcBaseCellType:function (type) {
|
|
|
|
|
- var ns = GC.Spread.Sheets;
|
|
|
|
|
- function CalcBaseCellType() {
|
|
|
|
|
- var init=false;
|
|
|
|
|
|
|
+ onCalcBaseButtonClick:function (hitinfo) {
|
|
|
|
|
+ let me = calcBaseView;
|
|
|
|
|
+ hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
|
|
|
|
|
+ if(hitinfo.sheet.getParent() === projectObj.mainSpread){
|
|
|
|
|
+ let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
|
|
|
|
|
+ projectObj.mainController.setTreeSelected(node);
|
|
|
}
|
|
}
|
|
|
- CalcBaseCellType.prototype = new ns.CellTypes.Text();
|
|
|
|
|
- CalcBaseCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
|
|
|
|
|
- if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
|
|
|
|
|
- if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
|
|
|
|
|
- var image = document.getElementById('f_btn'),imageMagin = 3;
|
|
|
|
|
- var imageHeight = 15;
|
|
|
|
|
- var imageWidth = 25;
|
|
|
|
|
- var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
|
|
|
|
|
- ctx.save();
|
|
|
|
|
- ctx.fillStyle = style.backColor;
|
|
|
|
|
- ctx.fillRect(x,y,w,h);
|
|
|
|
|
- ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
|
|
|
|
|
- ctx.beginPath();
|
|
|
|
|
- ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
|
|
|
|
|
- ctx.arc(imageX+imageWidth/2-4,imageY+imageHeight/2,1,0,360,false);
|
|
|
|
|
- ctx.arc(imageX+imageWidth/2+4,imageY+imageHeight/2,1,0,360,false);
|
|
|
|
|
- ctx.fillStyle="black";//填充颜色,默认是黑色
|
|
|
|
|
- ctx.fill();//画实心圆
|
|
|
|
|
- ctx.closePath();
|
|
|
|
|
- ctx.restore();
|
|
|
|
|
- w = w - imageWidth - imageMagin;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
|
|
|
|
|
- };
|
|
|
|
|
- CalcBaseCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
|
|
|
|
|
- return {
|
|
|
|
|
- x: x,
|
|
|
|
|
- y: y,
|
|
|
|
|
- row: context.row,
|
|
|
|
|
- col: context.col,
|
|
|
|
|
- cellStyle: cellStyle,
|
|
|
|
|
- cellRect: cellRect,
|
|
|
|
|
- sheetArea: context.sheetArea
|
|
|
|
|
- };
|
|
|
|
|
- };
|
|
|
|
|
- CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
|
|
|
|
|
- let me = calcBaseView;
|
|
|
|
|
- if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
|
|
|
|
|
- var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
|
|
|
|
|
- var imageWidth = 25;
|
|
|
|
|
- if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
|
|
|
|
|
- if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
|
|
|
|
|
- let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
|
|
|
|
|
- if(hitinfo.sheet.getParent() === projectObj.mainSpread){
|
|
|
|
|
- projectObj.mainController.setTreeSelected(node);
|
|
|
|
|
- }
|
|
|
|
|
- hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
|
|
|
|
|
- calcBaseView.confirmBtn.attr('toggle', 'calcBase');
|
|
|
|
|
- changeCalcBaseFeeRate('calcBase');
|
|
|
|
|
- $('#tabCalcBase').tab('show');
|
|
|
|
|
- calcBaseView.initCalctor(type);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
|
|
|
|
|
- let me = calcBaseView;
|
|
|
|
|
- if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
|
|
|
|
|
- var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
|
|
|
|
|
- var imageWidth = 25;
|
|
|
|
|
- if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
|
|
|
|
|
- if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
|
|
|
|
|
- hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
|
|
|
|
|
- if(hitinfo.sheet.getParent() === projectObj.mainSpread){
|
|
|
|
|
- let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
|
|
|
|
|
- projectObj.mainController.setTreeSelected(node);
|
|
|
|
|
- }
|
|
|
|
|
- calcBaseView.confirmBtn.attr('toggle', 'calcBase');
|
|
|
|
|
- changeCalcBaseFeeRate('calcBase');
|
|
|
|
|
- $('#tabCalcBase').tab('show');
|
|
|
|
|
- calcBaseView.initCalctor(type);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- return new CalcBaseCellType();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ calcBaseView.confirmBtn.attr('toggle', 'calcBase');
|
|
|
|
|
+ changeCalcBaseFeeRate('calcBase');
|
|
|
|
|
+ $('#tabCalcBase').tab('show');
|
|
|
|
|
+ calcBaseView.initCalctor('ration');
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
$(document).ready(function () {
|