tree_sheet_helper.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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"){ 2018-08-06 去掉工程量列表达式
  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 ="";
  164. if(node.sourceType == ModuleNames.ration){//定额的时候换算子目
  165. tag = node.data.adjustState?node.data.adjustState:'';
  166. }else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
  167. tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
  168. }
  169. sheet.setTag(iRow, iCol,tag);
  170. }
  171. /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
  172. let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
  173. sheet.setTag(iRow, iCol,tag);
  174. }*/
  175. }
  176. if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
  177. cell.value(colSetting.data.getText(node));
  178. } else {
  179. cell.value(getFieldText2());
  180. }
  181. if (colSetting.data.cellType && Object.prototype.toString.apply(colSetting.data.cellType) !== "[object String]") {
  182. cell.cellType(colSetting.data.cellType(node));
  183. }
  184. if(colSetting.data.autoHeight == true){
  185. colSetting.setAutoHeight(cell,node);
  186. }
  187. if(colSetting.editChecking&&colSetting.editChecking(node)){
  188. cell.locked(true);
  189. }else if (colSetting.readOnly) {
  190. if(typeof projectReadOnly !== 'undefined' && projectReadOnly){
  191. cell.locked(true);
  192. }else {
  193. if (Object.prototype.toString.apply(colSetting.readOnly) === "[object Function]") {
  194. cell.locked(colSetting.readOnly(node));
  195. } else {
  196. cell.locked(true);
  197. }
  198. }
  199. } else {
  200. cell.locked(typeof projectReadOnly !== 'undefined' && projectReadOnly ? true : false);
  201. }
  202. });
  203. if(setting.setAutoFitRow){
  204. setting.setAutoFitRow(sheet,node)
  205. }
  206. if (recursive) {
  207. TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, node.children, recursive);
  208. }
  209. });
  210. },
  211. refreshChildrenVisiable:function(sheet,tree,node,row,visiable){
  212. let iCount = node.posterityCount(), i, child;
  213. for (i = 0; i < iCount; i++) {
  214. child = tree.items[row + i +1];
  215. sheet.setRowVisible(row + i + 1, visiable?visiable:child.visible, GC.Spread.Sheets.SheetArea.viewport);
  216. }
  217. sheet.invalidateLayout();
  218. },
  219. showTreeData: function (setting, sheet, tree) {
  220. let indent = 20;
  221. let levelIndent = -5;
  222. let halfBoxLength = 5;
  223. let halfExpandLength = 3;
  224. let TreeNodeCellType = function () {
  225. };
  226. TreeNodeCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
  227. TreeNodeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
  228. if (style.backColor) {
  229. ctx.save();
  230. ctx.fillStyle = style.backColor;
  231. ctx.fillRect(x, y, w, h);
  232. ctx.restore();
  233. } else {
  234. ctx.clearRect(x, y, w, h);
  235. }
  236. // ������(x1, y1)���(��, ��), (x2, y2)�յ�(��, ��), ��ɫ
  237. let drawLine = function (canvas, x1, y1, x2, y2, color) {
  238. ctx.save();
  239. // ����ƫ����
  240. ctx.translate(0.5, 0.5);
  241. ctx.beginPath();
  242. ctx.moveTo(x1, y1);
  243. ctx.lineTo(x2, y2);
  244. ctx.strokeStyle = color;
  245. ctx.stroke();
  246. ctx.restore();
  247. };
  248. let drawExpandBox = function (ctx, x, y, w, h, centerX, centerY, expanded) {
  249. let rect = {}, h1, h2, offset = 1;
  250. rect.top = centerY - halfBoxLength;
  251. rect.bottom = centerY + halfBoxLength;
  252. rect.left = centerX - halfBoxLength;
  253. rect.right = centerX + halfBoxLength;
  254. if (rect.left < x + w) {
  255. rect.right = Math.min(rect.right, x + w);
  256. ctx.save();
  257. // ����ƫ����
  258. ctx.translate(0.5, 0.5);
  259. ctx.strokeStyle = 'black';
  260. ctx.beginPath();
  261. ctx.moveTo(rect.left, rect.top);
  262. ctx.lineTo(rect.left, rect.bottom);
  263. ctx.lineTo(rect.right, rect.bottom);
  264. ctx.lineTo(rect.right, rect.top);
  265. ctx.lineTo(rect.left, rect.top);
  266. ctx.stroke();
  267. ctx.fillStyle = 'white';
  268. ctx.fill();
  269. ctx.restore();
  270. // Draw Horizontal Line
  271. h1 = centerX - halfExpandLength;
  272. h2 = Math.min(centerX + halfExpandLength, x + w);
  273. if (h2 > h1) {
  274. drawLine(ctx, h1, centerY, h2, centerY, 'black');
  275. }
  276. // Draw Vertical Line
  277. if (!expanded && (centerX < x + w)) {
  278. drawLine(ctx, centerX, centerY - halfExpandLength, centerX, centerY + halfExpandLength, 'black');
  279. }
  280. }
  281. }
  282. let node = tree.items[options.row];
  283. let showTreeLine = true;
  284. if (!node) { return; }
  285. let centerX = Math.floor(x) + node.depth() * indent + node.depth() * levelIndent + indent / 2;
  286. let x1 = centerX + indent / 2;
  287. let centerY = Math.floor((y + (y + h)) / 2);
  288. let y1;
  289. // Draw Sibling Line
  290. if (showTreeLine) {
  291. // Draw Horizontal Line
  292. if (centerX < x + w) {
  293. drawLine(ctx, centerX, centerY, Math.min(x1, x + w), centerY, 'gray');
  294. }
  295. // Draw Vertical Line
  296. if (centerX < x + w) {
  297. y1 = node.isLast() ? centerY : y + h;
  298. if (node.isFirst() && !node.parent) {
  299. drawLine(ctx, centerX, centerY, centerX, y1, 'gray');
  300. } else {
  301. drawLine(ctx, centerX, y, centerX, y1, 'gray');
  302. }
  303. }
  304. }
  305. // Draw Expand Box
  306. if (node.children.length > 0) {
  307. drawExpandBox(ctx, x, y, w, h, centerX, centerY, node.expanded);
  308. }
  309. // Draw Parent Line
  310. if (showTreeLine) {
  311. var parent = node.parent, parentCenterX = centerX - indent - levelIndent;
  312. while (parent) {
  313. if (!parent.isLast()) {
  314. if (parentCenterX < x + w) {
  315. drawLine(ctx, parentCenterX, y, parentCenterX, y + h, 'gray');
  316. }
  317. }
  318. parent = parent.parent;
  319. parentCenterX -= (indent + levelIndent);
  320. }
  321. };
  322. // Draw Text
  323. x = x + (node.depth() + 1) * indent + node.depth() * levelIndent;
  324. w = w - (node.depth() + 1) * indent - node.depth() * levelIndent;
  325. GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
  326. };
  327. TreeNodeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
  328. return {
  329. x: x,
  330. y: y,
  331. row: context.row,
  332. col: context.col,
  333. cellStyle: cellStyle,
  334. cellRect: cellRect,
  335. sheetArea: context.sheetArea
  336. };
  337. };
  338. TreeNodeCellType.prototype.processMouseDown = function (hitinfo) {
  339. let offset = -1;
  340. let node = tree.items[hitinfo.row];
  341. tree.selected = node;
  342. if (!node || node.children.length === 0) { return; }
  343. let centerX = hitinfo.cellRect.x + offset + node.depth() * indent + node.depth() * levelIndent + indent / 2;
  344. let centerY = (hitinfo.cellRect.y + offset + (hitinfo.cellRect.y + offset + hitinfo.cellRect.height)) / 2;
  345. if (hitinfo.x > centerX - halfBoxLength && hitinfo.x < centerX + halfBoxLength && hitinfo.y > centerY - halfBoxLength && hitinfo.y < centerY + halfBoxLength) {
  346. node.setExpanded(!node.expanded);
  347. let sheetName = hitinfo.sheet.name();
  348. if(sheetName === 'stdBillsLib_bills'){
  349. sessionStorage.setItem('stdBillsLibExpState', billsLibObj.stdBillsTree.getExpState(billsLibObj.stdBillsTree.items));
  350. }
  351. else if(sheetName === 'stdRationLib_chapter'){
  352. sessionStorage.setItem('stdRationLibExpState', rationLibObj.tree.getExpState(rationLibObj.tree.items));
  353. }
  354. else if(sheetName === 'stdBillsGuidance_bills'){
  355. sessionStorage.setItem('stdBillsGuidanceExpState', billsGuidance.bills.tree.getExpState(billsGuidance.bills.tree.items));
  356. }
  357. TREE_SHEET_HELPER.massOperationSheet(hitinfo.sheet, function () {
  358. let iCount = node.posterityCount(), i, child;
  359. for (i = 0; i < iCount; i++) {
  360. child = tree.items[hitinfo.row + i + 1];
  361. hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.visible, hitinfo.sheetArea);
  362. //hitinfo.sheet.setRowVisible(hitinfo.row + i + 1, child.vis(), hitinfo.sheetArea);
  363. }
  364. hitinfo.sheet.invalidateLayout();
  365. });
  366. hitinfo.sheet.repaint();
  367. }
  368. };
  369. TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
  370. let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
  371. let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
  372. if(tag&&tag!=''){
  373. TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
  374. }
  375. };
  376. TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
  377. let me = TREE_SHEET_HELPER;
  378. TREE_SHEET_HELPER.tipDiv = 'hide';
  379. if (me._toolTipElement) {
  380. $(me._toolTipElement).hide();
  381. me._toolTipElement = null;
  382. };
  383. TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
  384. };
  385. let TipCellType = function () {};
  386. TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
  387. TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
  388. return {
  389. x: x,
  390. y: y,
  391. row: context.row,
  392. col: context.col,
  393. cellStyle: cellStyle,
  394. cellRect: cellRect,
  395. sheet: context.sheet,
  396. sheetArea: context.sheetArea
  397. };
  398. };
  399. TipCellType.prototype.processMouseEnter = function (hitinfo) {
  400. let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
  401. let value = hitinfo.sheet.getValue(hitinfo.row, hitinfo.col);
  402. let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
  403. let acStyle = hitinfo.sheet.getActualStyle(hitinfo.row, hitinfo.col),
  404. zoom = hitinfo.sheet.zoom();
  405. let textLength = this.getAutoFitWidth(value, text, acStyle, zoom, {sheet: hitinfo.sheet, row: hitinfo.row, col: hitinfo.col, sheetArea: GC.Spread.Sheets.SheetArea.viewport});
  406. let cellWidth = hitinfo.sheet.getCell(-1, hitinfo.col).width();
  407. let dataField = setting.cols[hitinfo.col].data.field;
  408. if((tag==undefined||tag=='')&&hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){//显示其它列的标记为空并且设置了自动换行
  409. return;
  410. }
  411. if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'||dataField=="name"){
  412. if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
  413. return;
  414. }
  415. if(hitinfo.sheet.name()=="mainSheet"){
  416. if(dataField=="quantity"){//显示工程量明细
  417. text = tag;
  418. }/*if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
  419. if(projectObj.ifItemCharHiden(setting)&&tag!=''){
  420. text = tag;
  421. }else if(textLength <= cellWidth){
  422. return;
  423. }
  424. }*/
  425. else if(tag !== undefined && tag) {
  426. text = tag;
  427. }
  428. }
  429. TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
  430. };
  431. TipCellType.prototype.processMouseLeave = function (hitinfo) {
  432. let me = TREE_SHEET_HELPER;
  433. TREE_SHEET_HELPER.tipDiv = 'hide';
  434. if (me._toolTipElement) {
  435. $(me._toolTipElement).hide();
  436. me._toolTipElement = null;
  437. };
  438. TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
  439. }
  440. TREE_SHEET_HELPER.protectdSheet(sheet);
  441. TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
  442. sheet.rowOutlines.direction(GC.Spread.Sheets.Outlines.OutlineDirection.backward);
  443. sheet.showRowOutline(false);
  444. if (setting.defaultRowHeight) {
  445. sheet.defaults.rowHeight = setting.defaultRowHeight;
  446. }
  447. sheet.setRowCount(tree.count() + setting.emptyRows, GC.Spread.Sheets.SheetArea.viewport);
  448. sheet.getRange(tree.count(), -1, setting.emptyRows, -1).locked(true);
  449. setting.cols.forEach(function (colSetting, iCol) {
  450. sheet.setStyle(-1, iCol, TREE_SHEET_HELPER.getSheetCellStyle(colSetting));
  451. if (colSetting.showHint) {
  452. sheet.getRange(-1, iCol, -1, 1).cellType(new TipCellType());
  453. }
  454. if(colSetting.formatter){
  455. sheet.setFormatter(-1, iCol, colSetting.formatter, GC.Spread.Sheets.SheetArea.viewport);
  456. }
  457. });
  458. sheet.getRange(-1, setting.treeCol, -1, 1).cellType(new TreeNodeCellType());
  459. TREE_SHEET_HELPER.refreshTreeNodeData(setting, sheet, tree.roots, true);
  460. TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
  461. });
  462. },
  463. showTipsDiv:function (text,setting,hitinfo) {
  464. if (setting.pos && text && text !== '') {
  465. if (!this._toolTipElement) {
  466. let div = $('#autoTip')[0];
  467. if (!div) {
  468. div = document.createElement("div");
  469. $(div).addClass("message-box");
  470. $(div) .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. if(text) text = replaceAll(/[\n]/,'<br>',text);
  480. $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border"></div><div class="triangle-border tb-background"></div>`);
  481. //清单指引、清单库做特殊处理
  482. if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
  483. $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
  484. let marginLeftMouse;
  485. if($(this._toolTipElement).width() < hitinfo.x){
  486. marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
  487. }
  488. $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y -$(this._toolTipElement).height() -20).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
  489. } else {
  490. //计算显示的初始位置
  491. let top = setting.pos.y + hitinfo.cellRect.y -$(this._toolTipElement).height() -26;
  492. let left = setting.pos.x + hitinfo.cellRect.x;
  493. $(this._toolTipElement).css("top", top).css("left", left);
  494. }
  495. $(this._toolTipElement).show("fast");
  496. TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
  497. }
  498. }
  499. },
  500. tipDivCheck(){
  501. setTimeout(function () {
  502. let tips = $('#autoTip');
  503. if(TREE_SHEET_HELPER.tipDiv == 'show'){
  504. return;
  505. } else if(TREE_SHEET_HELPER.tipDiv == 'hide'&&tips){
  506. tips.hide();
  507. TREE_SHEET_HELPER._toolTipElement = null;
  508. }
  509. },600)
  510. }
  511. };