tree_sheet_helper.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /**
  2. * Created by Mai on 2017/4/1.
  3. */
  4. var TREE_SHEET_HELPER = {
  5. getObjPos: function (obj) {
  6. let target = obj;
  7. let pos = {x: obj.offsetLeft, y: obj.offsetTop};
  8. target = obj.offsetParent;
  9. while (target) {
  10. pos.x += target.offsetLeft;
  11. pos.y += target.offsetTop;
  12. target = target.offsetParent;
  13. }
  14. return pos;
  15. },
  16. /**
  17. * 初始化setting,需要提示单元格text时,必须先初始化setting
  18. * @param obj
  19. * @param setting
  20. */
  21. /*initSetting: function (obj, setting) {
  22. setting.pos = this.getObjPos(obj);
  23. },*/
  24. initSetting: function (obj, setting) {
  25. setting.pos = this.getObjPos(obj);
  26. },
  27. createNewSpread: function (obj) {
  28. var spread = new GC.Spread.Sheets.Workbook(obj, {sheetCount: 1});
  29. spread.options.tabStripVisible = false;
  30. spread.options.scrollbarMaxAlign = true;
  31. spread.options.cutCopyIndicatorVisible = false;
  32. spread.options.allowCopyPasteExcelStyle = false;
  33. spread.options.allowUserDragDrop = false;
  34. spread.getActiveSheet().setRowCount(3);
  35. return spread;
  36. },
  37. getSheetCellStyle: function (setting) {
  38. var style = new GC.Spread.Sheets.Style();
  39. //style.locked = setting.readOnly ? true : false;
  40. style.name = setting.id;
  41. //style.font = setting.data.font;
  42. style.hAlign = setting.data.hAlign;
  43. style.vAlign = setting.data.vAlign;
  44. style.wordWrap = setting.data.wordWrap;
  45. if (setting.data.formatter) {
  46. style.formatter = setting.data.formatter;
  47. }
  48. return style;
  49. },
  50. loadSheetHeader: function (setting, sheet) {
  51. this.massOperationSheet(sheet, function () {
  52. if(setting.rowHeaderWidth !== undefined && setting.rowHeaderWidth !== null){
  53. sheet.setColumnWidth(0, setting.rowHeaderWidth, GC.Spread.Sheets.SheetArea.rowHeader);
  54. }
  55. if (setting.frozenCols) {
  56. sheet.frozenColumnCount(setting.frozenCols);
  57. }
  58. sheet.setColumnCount(setting.cols.length);
  59. sheet.setRowCount(setting.headRows, GC.Spread.Sheets.SheetArea.colHeader);
  60. setting.headRowHeight.forEach(function (rowHeight, index) {
  61. sheet.setRowHeight(index, rowHeight, GC.Spread.Sheets.SheetArea.colHeader);
  62. });
  63. setting.cols.forEach(function (col, index) {
  64. var i, iRow = 0, cell;
  65. for (i = 0; i < col.head.spanCols.length; i++) {
  66. if (col.head.spanCols[i] !== 0) {
  67. cell = sheet.getCell(iRow, index, GC.Spread.Sheets.SheetArea.colHeader);
  68. //cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
  69. cell.value(col.head.titleNames[i]).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]).wordWrap(true);
  70. }
  71. if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
  72. sheet.addSpan(iRow, index, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.colHeader);
  73. }
  74. iRow += col.head.spanRows[i];
  75. };
  76. sheet.setColumnWidth(index, col.width);
  77. sheet.setColumnVisible(index, col.visible && true);
  78. });
  79. });
  80. },
  81. protectdSheet: function (sheet) {
  82. var option = {
  83. allowSelectLockedCells: true,
  84. allowSelectUnlockedCells: true,
  85. allowResizeRows: true,
  86. allowResizeColumns: true
  87. };
  88. sheet.options.protectionOptions = option;
  89. sheet.options.isProtected = true;
  90. sheet.options.allowCellOverflow = false;
  91. },
  92. massOperationSheet: function (sheet, Operation) {
  93. sheet.suspendPaint();
  94. sheet.suspendEvent();
  95. Operation();
  96. sheet.resumeEvent();
  97. sheet.resumePaint();
  98. },
  99. refreshNodesVisible: function (nodes, sheet, recursive) {
  100. nodes.forEach(function (node) {
  101. var iRow;
  102. iRow = node.serialNo();
  103. sheet.setRowVisible(iRow, node.visible, GC.Spread.Sheets.SheetArea.viewport);
  104. if (recursive) {
  105. TREE_SHEET_HELPER.refreshNodesVisible(node.children, sheet, recursive);
  106. }
  107. })
  108. },
  109. refreshTreeNodeData: function (setting, sheet, nodes, recursive) {
  110. nodes.forEach(function (node) {
  111. let iRow = node.serialNo();
  112. if(setting.emptyRowHeader){
  113. sheet.setValue(iRow, 0, '', GC.Spread.Sheets.SheetArea.rowHeader);
  114. }
  115. if(typeof projectObj !== 'undefined'){
  116. let nodeStyle = projectObj.getNodeColorStyle(sheet, node);
  117. if(node.data.bgColour){
  118. nodeStyle.backColor = node.data.bgColour;
  119. }
  120. if(nodeStyle){
  121. sheet.setStyle(iRow, -1, nodeStyle);
  122. }
  123. }
  124. setting.cols.forEach(function (colSetting, iCol) {
  125. var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
  126. /* if(typeof projectObj !== 'undefined'){ 7/28 取消黑体显示
  127. let boldFontStyle = projectObj.getBoldFontStyle(node, colSetting);
  128. sheet.setStyle(iRow, iCol, boldFontStyle);
  129. }
  130. }*/
  131. // var getFieldText = function () {
  132. // var fields = colSetting.data.field.split('.');
  133. // var validField = fields.reduce(function (field1, field2) {
  134. // if (eval('node.data.' + field1)) {
  135. // return field1 + '.' + field2
  136. // } else {
  137. // return field1;
  138. // }
  139. // });
  140. // if (eval('node.data.' + validField)) {
  141. // return eval('node.data.' + validField);
  142. // } else {
  143. // return '';
  144. // }
  145. // };
  146. var getFieldText2 = function () {
  147. var fields = colSetting.data.field.split('.'), iField, data = node.data;
  148. for (iField = 0; iField < fields.length; iField++) {
  149. if (data[fields[iField]] && data[fields[iField]]!='0') {
  150. data = data[fields[iField]];
  151. } else {
  152. return '';
  153. }
  154. }
  155. return data;
  156. };
  157. if(sheet.name()=="mainSheet"){
  158. if(colSetting.data.field=="quantity"){
  159. let tag = node.data.quantityEXP?node.data.quantityEXP:'';
  160. sheet.setTag(iRow, iCol,tag);
  161. }
  162. if(colSetting.data.field=="code"){
  163. let tag = node.data.adjustState?node.data.adjustState:'';
  164. sheet.setTag(iRow, iCol,tag);
  165. }
  166. if(colSetting.data.field=="name"){
  167. let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
  168. sheet.setTag(iRow, iCol,tag);
  169. }
  170. }
  171. if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
  172. cell.value(colSetting.data.getText(node));
  173. } else {
  174. cell.value(getFieldText2());
  175. }
  176. if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
  177. cell.cellType(colSetting.data.cellType(node));
  178. }
  179. if(colSetting.data.autoHeight == true){
  180. colSetting.setAutoHeight(cell,node);
  181. }
  182. if(colSetting.editChecking&&colSetting.editChecking(node)){
  183. cell.locked(true);
  184. }else if (colSetting.readOnly) {
  185. if(typeof projectReadOnly !== 'undefined' && projectReadOnly){
  186. cell.locked(true);
  187. }else {
  188. if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
  189. cell.locked(colSetting.readOnly(node));
  190. } else {
  191. cell.locked(true);
  192. }
  193. }
  194. } else {
  195. cell.locked(typeof projectReadOnly !== 'undefined' && projectReadOnly ? true : false);
  196. }
  197. });
  198. if(setting.setAutoFitRow){
  199. setting.setAutoFitRow(sheet,node)
  200. }
  201. if (recursive) {
  202. TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, node.children, recursive);
  203. }
  204. });
  205. },
  206. refreshChildrenVisiable:function(sheet,tree,node,row,visiable){
  207. let iCount = node.posterityCount(), i, child;
  208. for (i = 0; i < iCount; i++) {
  209. child = tree.items[row + i +1];
  210. sheet.setRowVisible(row + i + 1, visiable?visiable:child.visible, GC.Spread.Sheets.SheetArea.viewport);
  211. }
  212. sheet.invalidateLayout();
  213. },
  214. showTreeData: function (setting, sheet, tree) {
  215. let indent = 20;
  216. let levelIndent = -5;
  217. let halfBoxLength = 5;
  218. let halfExpandLength = 3;
  219. let TreeNodeCellType = function () {
  220. };
  221. TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
  222. TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
  223. if (style.backColor) {
  224. ctx.save();
  225. ctx.fillStyle = style.backColor;
  226. ctx.fillRect(x, y, w, h);
  227. ctx.restore();
  228. } else {
  229. ctx.clearRect(x, y, w, h);
  230. }
  231. // ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
  232. let drawLine = function (canvas, x1, y1, x2, y2, color) {
  233. ctx.save();
  234. // ����ƫ����
  235. ctx.translate(0.5, 0.5);
  236. ctx.beginPath();
  237. ctx.moveTo(x1, y1);
  238. ctx.lineTo(x2, y2);
  239. ctx.strokeStyle = color;
  240. ctx.stroke();
  241. ctx.restore();
  242. };
  243. let drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
  244. let rect = {}, h1, h2, offset = 1;
  245. rect.top = centerY - halfBoxLength;
  246. rect.bottom = centerY + halfBoxLength;
  247. rect.left = centerX - halfBoxLength;
  248. rect.right = centerX + halfBoxLength;
  249. if (rect.left < x + w) {
  250. rect.right = Math.min(rect.right, x + w);
  251. ctx.save();
  252. // ����ƫ����
  253. ctx.translate(0.5, 0.5);
  254. ctx.strokeStyle = 'black';
  255. ctx.beginPath();
  256. ctx.moveTo(rect.left, rect.top);
  257. ctx.lineTo(rect.left, rect.bottom);
  258. ctx.lineTo(rect.right, rect.bottom);
  259. ctx.lineTo(rect.right, rect.top);
  260. ctx.lineTo(rect.left, rect.top);
  261. ctx.stroke();
  262. ctx.fillStyle = 'white';
  263. ctx.fill();
  264. ctx.restore();
  265. // Draw Horizontal Line
  266. h1 = centerX - halfExpandLength;
  267. h2 = Math.min(centerX + halfExpandLength, x + w);
  268. if (h2 > h1) {
  269. drawLine(ctx, h1, centerY, h2, centerY, 'black');
  270. }
  271. // Draw Vertical Line
  272. if (!expanded && (centerX < x + w)) {
  273. drawLine(ctx, centerX, centerY - halfExpandLength, centerX, centerY + halfExpandLength, 'black');
  274. }
  275. }
  276. }
  277. let node = tree.items[options.row];
  278. let showTreeLine = true;
  279. if (!node) { return; }
  280. let centerX = Math.floor(x) + node.depth() * indent + node.depth() * levelIndent + indent / 2;
  281. let x1 = centerX + indent / 2;
  282. let centerY = Math.floor((y + (y + h)) / 2);
  283. let y1;
  284. // Draw Sibling Line
  285. if (showTreeLine) {
  286. // Draw Horizontal Line
  287. if (centerX < x + w) {
  288. drawLine(ctx, centerX, centerY, Math.min(x1, x + w), centerY, 'gray');
  289. }
  290. // Draw Vertical Line
  291. if (centerX < x + w) {
  292. y1 = node.isLast() ? centerY : y + h;
  293. if (node.isFirst() && !node.parent) {
  294. drawLine(ctx, centerX, centerY, centerX, y1, 'gray');
  295. } else {
  296. drawLine(ctx, centerX, y, centerX, y1, 'gray');
  297. }
  298. }
  299. }
  300. // Draw Expand Box
  301. if (node.children.length > 0) {
  302. drawExpandBox(ctx, x, y, w, h, centerX, centerY, node.expanded);
  303. }
  304. // Draw Parent Line
  305. if (showTreeLine) {
  306. var parent = node.parent, parentCenterX = centerX - indent - levelIndent;
  307. while (parent) {
  308. if (!parent.isLast()) {
  309. if (parentCenterX < x + w) {
  310. drawLine(ctx, parentCenterX, y, parentCenterX, y + h, 'gray');
  311. }
  312. }
  313. parent = parent.parent;
  314. parentCenterX -= (indent + levelIndent);
  315. }
  316. };
  317. // Draw Text
  318. x = x + (node.depth() + 1) * indent + node.depth() * levelIndent;
  319. w = w - (node.depth() + 1) * indent - node.depth() * levelIndent;
  320. GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
  321. };
  322. TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
  323. return {
  324. x: x,
  325. y: y,
  326. row: context.row,
  327. col: context.col,
  328. cellStyle: cellStyle,
  329. cellRect: cellRect,
  330. sheetArea: context.sheetArea
  331. };
  332. };
  333. TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
  334. let offset = -1;
  335. let node = tree.items[hitinfo.row];
  336. tree.selected = node;
  337. if (!node || node.children.length === 0) { return; }
  338. let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
  339. let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
  340. if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
  341. node.setExpanded(!node.expanded);
  342. let sheetName = hitinfo.sheet.name();
  343. if(sheetName === 'stdBillsLib_bills'){
  344. sessionStorage.setItem('stdBillsLibExpState', billsLibObj.stdBillsTree.getExpState(billsLibObj.stdBillsTree.items));
  345. }
  346. else if(sheetName === 'stdRationLib_chapter'){
  347. sessionStorage.setItem('stdRationLibExpState', rationLibObj.tree.getExpState(rationLibObj.tree.items));
  348. }
  349. else if(sheetName === 'stdBillsGuidance_bills'){
  350. sessionStorage.setItem('stdBillsGuidanceExpState', billsGuidance.bills.tree.getExpState(billsGuidance.bills.tree.items));
  351. }
  352. TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
  353. let iCount = node.posterityCount(), i, child;
  354. for (i = 0; i < iCount; i++) {
  355. child = tree.items[hitinfo.row + i + 1];
  356. hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.visible, hitinfo.sheetArea);
  357. //hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.vis(), hitinfo.sheetArea);
  358. }
  359. hitinfo.sheet.invalidateLayout();
  360. });
  361. hitinfo.sheet.repaint();
  362. }
  363. };
  364. TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
  365. let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
  366. let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
  367. if(tag){
  368. TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
  369. }
  370. };
  371. TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
  372. let me = this;
  373. TREE_SHEET_HELPER.tipDiv = 'hide';
  374. if (me._toolTipElement) {
  375. $(me._toolTipElement).hide();
  376. me._toolTipElement = null;
  377. };
  378. TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
  379. };
  380. let TipCellType = function () {};
  381. TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
  382. TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
  383. return {
  384. x: x,
  385. y: y,
  386. row: context.row,
  387. col: context.col,
  388. cellStyle: cellStyle,
  389. cellRect: cellRect,
  390. sheet: context.sheet,
  391. sheetArea: context.sheetArea
  392. };
  393. };
  394. TipCellType.prototype.processMouseEnter = function (hitinfo) {
  395. let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
  396. let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
  397. let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
  398. let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
  399. zoom = hitinfo.sheet.zoom();
  400. let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
  401. let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
  402. let dataField = setting.cols[hitinfo.col].data.field;
  403. if(tag==''&&hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){//显示其它列的标记为空并且设置了自动换行
  404. return;
  405. }
  406. if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
  407. if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
  408. return;
  409. }
  410. if(hitinfo.sheet.name()=="mainSheet"){
  411. if(dataField=="quantity"){//显示工程量明细
  412. text = tag;
  413. }if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
  414. if(projectObj.ifItemCharHiden(setting)&&tag!=''){
  415. text = tag;
  416. }else if(textLength <= cellWidth){
  417. return;
  418. }
  419. }
  420. else if(tag !== undefined && tag) {
  421. text = tag;
  422. }
  423. }
  424. TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
  425. };
  426. TipCellType.prototype.processMouseLeave = function (hitinfo) {
  427. let me = TREE_SHEET_HELPER;
  428. TREE_SHEET_HELPER.tipDiv = 'hide';
  429. if (me._toolTipElement) {
  430. $(me._toolTipElement).hide();
  431. me._toolTipElement = null;
  432. };
  433. TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
  434. }
  435. TREE_SHEET_HELPER.protectdSheet(sheet);
  436. TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
  437. sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
  438. sheet.showRowOutline(false);
  439. if (setting.defaultRowHeight) {
  440. sheet.defaults.rowHeight = setting.defaultRowHeight;
  441. }
  442. sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
  443. sheet.getRange(tree.count(), -1, setting.emptyRows, -1).locked(true);
  444. setting.cols.forEach(function (colSetting, iCol) {
  445. sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
  446. if (colSetting.showHint) {
  447. sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
  448. }
  449. if(colSetting.formatter){
  450. sheet.setFormatter(-1, iCol, colSetting.formatter, GC.Spread.Sheets.SheetArea.viewport);
  451. }
  452. });
  453. sheet.getRange(-1, setting.treeCol, -1, 1).cellType(new TreeNodeCellType());
  454. TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, tree.roots, true);
  455. TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
  456. });
  457. },
  458. showTipsDiv:function (text,setting,hitinfo) {
  459. if (setting.pos && text && text !== '') {
  460. if (!this._toolTipElement) {
  461. let div = $('#autoTip')[0];
  462. if (!div) {
  463. div = document.createElement("div");
  464. $(div).css("position", "absolute")
  465. .css("border", "1px #C0C0C0 solid")
  466. .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
  467. .css("font", "0.9rem Calibri")
  468. .css("background", "White")
  469. .css("padding", 5)
  470. .attr("id", 'autoTip');
  471. $(div).hide();
  472. document.body.insertBefore(div, null);
  473. }
  474. this._toolTipElement = div;
  475. //实时读取位置信息
  476. if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
  477. setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
  478. }
  479. $(this._toolTipElement).text(text);
  480. //清单指引、清单库做特殊处理
  481. if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
  482. $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
  483. let marginLeftMouse;
  484. if($(this._toolTipElement).width() < hitinfo.x){
  485. marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
  486. }
  487. $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
  488. }
  489. else {
  490. $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
  491. }
  492. $(this._toolTipElement).show("fast");
  493. TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
  494. }
  495. }
  496. },
  497. tipDivCheck(){
  498. setTimeout(function () {
  499. let tips = $('#autoTip');
  500. if(TREE_SHEET_HELPER.tipDiv == 'show'){
  501. return;
  502. } else if(TREE_SHEET_HELPER.tipDiv == 'hide'&&tips){
  503. tips.hide();
  504. TREE_SHEET_HELPER._toolTipElement = null;
  505. }
  506. },600)
  507. }
  508. };