|
@@ -5,7 +5,7 @@
|
|
|
var TREE_SHEET_HELPER = {
|
|
|
getObjPos: function (obj) {
|
|
|
let target = obj;
|
|
|
- let pos = {x: obj.offsetLeft, y: obj.offsetTop};
|
|
|
+ let pos = { x: obj.offsetLeft, y: obj.offsetTop };
|
|
|
|
|
|
target = obj.offsetParent;
|
|
|
while (target) {
|
|
@@ -24,7 +24,7 @@ var TREE_SHEET_HELPER = {
|
|
|
setting.pos = this.getObjPos(obj);
|
|
|
},
|
|
|
createNewSpread: function (obj) {
|
|
|
- var spread = new GC.Spread.Sheets.Workbook(obj, {sheetCount: 1});
|
|
|
+ var spread = new GC.Spread.Sheets.Workbook(obj, { sheetCount: 1 });
|
|
|
spread.options.tabStripVisible = false;
|
|
|
spread.options.scrollbarMaxAlign = true;
|
|
|
spread.options.cutCopyIndicatorVisible = false;
|
|
@@ -138,7 +138,9 @@ var TREE_SHEET_HELPER = {
|
|
|
cell.value(getFieldText2());
|
|
|
}
|
|
|
if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
|
|
|
- cell.cellType(colSetting.data.cellType);
|
|
|
+ if (colSetting.needCellType === undefined || colSetting.needCellType(node)) {
|
|
|
+ cell.cellType(colSetting.data.cellType);
|
|
|
+ }
|
|
|
}
|
|
|
if (colSetting.readOnly) {
|
|
|
if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
|
|
@@ -156,11 +158,11 @@ var TREE_SHEET_HELPER = {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- refreshChildrenVisiable:function(sheet,tree,node,row,visiable){
|
|
|
+ refreshChildrenVisiable: function (sheet, tree, node, row, visiable) {
|
|
|
let iCount = node.posterityCount(), i, child;
|
|
|
for (i = 0; i < iCount; i++) {
|
|
|
- child = tree.items[row + i +1];
|
|
|
- sheet.setRowVisible(row + i + 1, visiable?visiable:child.visible, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
+ child = tree.items[row + i + 1];
|
|
|
+ sheet.setRowVisible(row + i + 1, visiable ? visiable : child.visible, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
}
|
|
|
sheet.invalidateLayout();
|
|
|
},
|
|
@@ -311,16 +313,16 @@ var TREE_SHEET_HELPER = {
|
|
|
hitinfo.sheet.repaint();
|
|
|
}
|
|
|
};
|
|
|
- TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
|
|
|
- if(hitinfo.sheet.name() === 'stdBillsGuidance_bills'){
|
|
|
- TREE_SHEET_HELPER.delayShowTips(hitinfo,setting);
|
|
|
+ TreeNodeCellType.prototype.processMouseEnter = function (hitinfo) {
|
|
|
+ if (hitinfo.sheet.name() === 'stdBillsGuidance_bills') {
|
|
|
+ TREE_SHEET_HELPER.delayShowTips(hitinfo, setting);
|
|
|
}
|
|
|
};
|
|
|
TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
|
|
|
TREE_SHEET_HELPER.hideTipsDiv();
|
|
|
};
|
|
|
|
|
|
- let TipCellType = function () {};
|
|
|
+ let TipCellType = function () { };
|
|
|
TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
|
|
|
TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
|
|
|
return {
|
|
@@ -380,10 +382,10 @@ var TREE_SHEET_HELPER = {
|
|
|
TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
|
|
|
});
|
|
|
},
|
|
|
- showTipsDiv:function (text,setting,hitinfo) {
|
|
|
+ showTipsDiv: function (text, setting, hitinfo) {
|
|
|
if (text && text !== '') {
|
|
|
- if(text) text = replaceAll(/[\n]/,'<br>',text);
|
|
|
- if(!this._fixedTipElement){
|
|
|
+ if (text) text = replaceAll(/[\n]/, '<br>', text);
|
|
|
+ if (!this._fixedTipElement) {
|
|
|
let div = $('#fixedTip')[0];
|
|
|
if (!div) {
|
|
|
div = document.createElement("div");
|
|
@@ -413,20 +415,20 @@ var TREE_SHEET_HELPER = {
|
|
|
this._toolTipElement = div;
|
|
|
$(this._toolTipElement).width('');
|
|
|
//实时读取位置信息
|
|
|
- if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
|
|
|
+ if (hitinfo.sheet && hitinfo.sheet.getParent().qo) {
|
|
|
setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
}
|
|
|
$(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border_up"></div><div class="triangle-border tb-background_up"></div>`);
|
|
|
//清单指引、清单库做特殊处理
|
|
|
- if($(hitinfo.sheet.name === 'stdBillsGuidance_bills')){
|
|
|
+ if ($(hitinfo.sheet.name === 'stdBillsGuidance_bills')) {
|
|
|
$(this._toolTipElement).html(`<span>${text}</span>`);
|
|
|
let divWidth = $(this._fixedTipElement).width(),
|
|
|
divHeight = $(this._fixedTipElement).height();
|
|
|
- if(divWidth > 600){
|
|
|
+ if (divWidth > 600) {
|
|
|
divWidth = 590;
|
|
|
$(this._toolTipElement).width(divWidth);
|
|
|
}
|
|
|
- let top = setting.pos.y + hitinfo.y - divHeight / 2 < 0 ? 0 : setting.pos.y + hitinfo.y - divHeight / 2;
|
|
|
+ let top = setting.pos.y + hitinfo.y - divHeight / 2 < 0 ? 0 : setting.pos.y + hitinfo.y - divHeight / 2;
|
|
|
$(this._toolTipElement).css("top", top).css("left", hitinfo.x + 20);
|
|
|
} else {
|
|
|
//计算显示的初始位置
|
|
@@ -435,8 +437,8 @@ var TREE_SHEET_HELPER = {
|
|
|
let left = setting.pos.x + hitinfo.cellRect.x;
|
|
|
$(this._toolTipElement).css("top", top).css("left", left);*/
|
|
|
//显示在下方,三角形指
|
|
|
- let top = setting.pos.y + hitinfo.cellRect.y+26;
|
|
|
- let left = setting.pos.x + hitinfo.cellRect.x;
|
|
|
+ let top = setting.pos.y + hitinfo.cellRect.y + 26;
|
|
|
+ let left = setting.pos.x + hitinfo.cellRect.x;
|
|
|
$(this._toolTipElement).css("top", top).css("left", left);
|
|
|
|
|
|
}
|
|
@@ -445,7 +447,7 @@ var TREE_SHEET_HELPER = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- hideTipsDiv:function () {
|
|
|
+ hideTipsDiv: function () {
|
|
|
TREE_SHEET_HELPER.tipTimeStamp = +new Date();//这个是为了造价书清单编号树节点的那个延时显示而打的时间戳,防止已经要隐藏的提示框,延时显示
|
|
|
let me = TREE_SHEET_HELPER;
|
|
|
TREE_SHEET_HELPER.tipDiv = 'hide';
|
|
@@ -455,31 +457,31 @@ var TREE_SHEET_HELPER = {
|
|
|
}
|
|
|
TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
|
|
|
},
|
|
|
- tipDivCheck(){
|
|
|
+ tipDivCheck() {
|
|
|
setTimeout(function () {
|
|
|
let tips = $('#autoTip');
|
|
|
- if(TREE_SHEET_HELPER.tipDiv == 'show'){
|
|
|
+ if (TREE_SHEET_HELPER.tipDiv == 'show') {
|
|
|
return;
|
|
|
- } else if(TREE_SHEET_HELPER.tipDiv == 'hide'&&tips){
|
|
|
+ } else if (TREE_SHEET_HELPER.tipDiv == 'hide' && tips) {
|
|
|
tips.hide();
|
|
|
TREE_SHEET_HELPER._toolTipElement = null;
|
|
|
}
|
|
|
- },600)
|
|
|
+ }, 600)
|
|
|
},
|
|
|
- delayShowTips:function(hitinfo,setting,tips){//延时显示
|
|
|
+ delayShowTips: function (hitinfo, setting, tips) {//延时显示
|
|
|
let delayTimes = 500; //延时时间
|
|
|
let now_timeStamp = +new Date();
|
|
|
TREE_SHEET_HELPER.tipTimeStamp = now_timeStamp;
|
|
|
setTimeout(function () {
|
|
|
- if(now_timeStamp - TREE_SHEET_HELPER.tipTimeStamp == 0){//鼠标停下的时候才显示
|
|
|
+ if (now_timeStamp - TREE_SHEET_HELPER.tipTimeStamp == 0) {//鼠标停下的时候才显示
|
|
|
let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
|
|
|
- if(tips && tips !=""){ //有tips的话优先显示tips
|
|
|
+ if (tips && tips != "") { //有tips的话优先显示tips
|
|
|
tag = tips;
|
|
|
}
|
|
|
- if(tag&&tag!=''){
|
|
|
- TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
|
|
|
+ if (tag && tag != '') {
|
|
|
+ TREE_SHEET_HELPER.showTipsDiv(tag, setting, hitinfo);
|
|
|
}
|
|
|
}
|
|
|
- },delayTimes);
|
|
|
+ }, delayTimes);
|
|
|
}
|
|
|
};
|