|
@@ -326,6 +326,22 @@ const billsGuidance = (function () {
|
|
|
guideItemInitSel(guideSheet.getActiveRowIndex() ? guideSheet.getActiveRowIndex() : 0);
|
|
|
}
|
|
|
}
|
|
|
+ //选中的节点是否全是同层节点
|
|
|
+ //@param {Object}sheet {Array}items @return {Boolean}
|
|
|
+ function itemsSameDepth(sheet, items) {
|
|
|
+ let sels = sheet.getSelections();
|
|
|
+ if(sels.length === 0 || items.length === 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let depths = [];
|
|
|
+ for(let i = 0; i < sels[0].rowCount; i++){
|
|
|
+ let row = sels[0].row + i;
|
|
|
+ let node = items[row];
|
|
|
+ if(node){
|
|
|
+ depths.push(node.depth());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//节点子项是否全是工作内容
|
|
|
//@param {Object}node @return {Boolean}
|
|
|
function allJobChildren(node){
|
|
@@ -395,6 +411,7 @@ const billsGuidance = (function () {
|
|
|
//项目指引表焦点控制
|
|
|
//@param {Number}row @return {void}
|
|
|
function guideItemInitSel(row){
|
|
|
+ console.log('et');
|
|
|
let billsNode = bills.tree.selected;
|
|
|
let node = null;
|
|
|
if(billsNode && billsNode.guidance.tree){
|
|
@@ -417,6 +434,105 @@ const billsGuidance = (function () {
|
|
|
buildSheet(module);
|
|
|
}
|
|
|
}
|
|
|
+ function tipDivCheck(){
|
|
|
+ setTimeout(function () {
|
|
|
+ let tips = $('#autoTip');
|
|
|
+ if(ration.tipDiv == 'show'){
|
|
|
+ return;
|
|
|
+ } else if(ration.tipDiv == 'hide'&&tips){
|
|
|
+ tips.hide();
|
|
|
+ ration._toolTipElement = null;
|
|
|
+ }
|
|
|
+ },600)
|
|
|
+ }
|
|
|
+ //获取悬浮提示单元格
|
|
|
+ //@param {Object}sheet @return {Object}
|
|
|
+ function getTipCellType(sheet) {
|
|
|
+ let setting = {};
|
|
|
+ let TipCellType = function () {};
|
|
|
+ TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
|
|
|
+ TipCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
|
|
|
+ return {
|
|
|
+ x: x,
|
|
|
+ y: y,
|
|
|
+ row: context.row,
|
|
|
+ col: context.col,
|
|
|
+ cellStyle: cellStyle,
|
|
|
+ cellRect: cellRect,
|
|
|
+ sheet: context.sheet,
|
|
|
+ sheetArea: context.sheetArea
|
|
|
+ };
|
|
|
+ };
|
|
|
+ TipCellType.prototype.processMouseEnter = function (hitinfo) {
|
|
|
+ let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
|
|
|
+ let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
|
|
|
+ /* let hintHeight = datas[hitinfo.row] ?
|
|
|
+ datas[hitinfo.row].hintHeight ? datas[hitinfo.row].hintHeight : null
|
|
|
+ : null; //定额库定额悬浮提示位置相关*/
|
|
|
+ if(tag !== undefined && tag){
|
|
|
+ text = tag;
|
|
|
+ }
|
|
|
+ if(sheet && sheet.getParent().qo){
|
|
|
+ setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
|
|
|
+ }
|
|
|
+ if (setting.pos && text && text !== '') {
|
|
|
+ //固定不显示的div,存储文本获取固定div宽度,toolTipElement由于显示和隐藏,获取宽度不正确
|
|
|
+ if(!this._fixedTipElement){
|
|
|
+ let div = $('#fixedTip')[0];
|
|
|
+ if (!div) {
|
|
|
+ div = document.createElement("div");
|
|
|
+ $(div).css("padding", 5)
|
|
|
+ .attr("id", 'fixedTip');
|
|
|
+ $(div).hide();
|
|
|
+ document.body.insertBefore(div, null);
|
|
|
+ }
|
|
|
+ this._fixedTipElement = div;
|
|
|
+ }
|
|
|
+ $(this._fixedTipElement).html(text);
|
|
|
+ if (!this._toolTipElement) {
|
|
|
+ let div = $('#autoTip')[0];
|
|
|
+ if (!div) {
|
|
|
+ div = document.createElement("div");
|
|
|
+ $(div).css("position", "absolute")
|
|
|
+ .css("border", "1px #C0C0C0 solid")
|
|
|
+ .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
|
|
|
+ .css("font", "0.9rem Calibri")
|
|
|
+ .css("background", "white")
|
|
|
+ .css("padding", 5)
|
|
|
+ .attr("id", 'autoTip');
|
|
|
+ $(div).hide();
|
|
|
+ document.body.insertBefore(div, null);
|
|
|
+ }
|
|
|
+ this._toolTipElement = div;
|
|
|
+ //实时读取位置信息
|
|
|
+ if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
|
|
|
+ setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
+ }
|
|
|
+ $(this._toolTipElement).html(text);
|
|
|
+ //定额库定额特殊处理
|
|
|
+ if($(hitinfo.sheet.getParent().qo).attr('id') === 'rationSpread'){
|
|
|
+ let divWidth = $(this._fixedTipElement).width(),
|
|
|
+ divHeight = $(this._fixedTipElement).height();
|
|
|
+ $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y - divHeight).css("left", setting.pos.x - divWidth);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y +15).css("left", setting.pos.x + hitinfo.x + 15);
|
|
|
+ }
|
|
|
+ $(this._toolTipElement).show("fast");
|
|
|
+ ration.tipDiv = 'show';//做个标记
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ TipCellType.prototype.processMouseLeave = function (hininfo) {
|
|
|
+ ration.tipDiv = 'hide';
|
|
|
+ if (this._toolTipElement) {
|
|
|
+ $(this._toolTipElement).hide();
|
|
|
+ this._toolTipElement = null;
|
|
|
+ }
|
|
|
+ tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
|
|
|
+ }
|
|
|
+ return new TipCellType();
|
|
|
+ }
|
|
|
//输出表数据(定额表)
|
|
|
//@param {Object}sheet {Array}headers {Array}datas @return {void}
|
|
|
function showData(sheet, headers, datas){
|
|
@@ -424,12 +540,17 @@ const billsGuidance = (function () {
|
|
|
sheet.setRowCount(datas.length);
|
|
|
//复选框
|
|
|
let checkBoxType = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
+ let tipCellType = getTipCellType(sheet);
|
|
|
sheet.setCellType(-1, 0, checkBoxType);
|
|
|
for(let col = 0, cLen = headers.length; col < cLen; col++){
|
|
|
for(let row = 0, rLen = datas.length; row < rLen; row++){
|
|
|
sheet.setValue(row, col, datas[row][headers[col]['dataCode']]);
|
|
|
+ if(col === 1){
|
|
|
+ sheet.setTag(row, col, datas[row]['hint']);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ sheet.setCellType(-1, 1, tipCellType);
|
|
|
};
|
|
|
renderSheetFunc(sheet, fuc);
|
|
|
}
|
|
@@ -463,7 +584,7 @@ const billsGuidance = (function () {
|
|
|
let sectionSheet = section.workBook.getActiveSheet();
|
|
|
CommonAjax.post('/rationRepository/api/getRationTree', {rationLibId: rationLibId}, function (sectionDatas) {
|
|
|
//获取所有定额数据
|
|
|
- CommonAjax.post('/rationRepository/api/getRationItemsByLib', {rationLibId: rationLibId}, function (rstData) {
|
|
|
+ CommonAjax.post('/rationRepository/api/getRationItemsByLib', {rationLibId: rationLibId, showHint: true, returnFields: '-_id code ID sectionId name unit basePrice rationGljList'}, function (rstData) {
|
|
|
section.cache = sectionDatas;
|
|
|
initTree(section, section.workBook.getActiveSheet(), section.treeSetting, sectionDatas);
|
|
|
//初始焦点在第一行(切换库)
|
|
@@ -658,7 +779,7 @@ const billsGuidance = (function () {
|
|
|
//更新父节点
|
|
|
updateDatas.push({updateType: updateType.update, findData: {ID: selected.getParentID()}, updateData: {NextSiblingID: selected.getID()}});
|
|
|
//更新选中节点
|
|
|
- updateDatas.push({udpateType: updateType.update, findData: {ID: selected.getID()},
|
|
|
+ updateDatas.push({updateType: updateType.update, findData: {ID: selected.getID()},
|
|
|
updateData: {ParentID: selected.parent.getParentID(), NextSiblingID: selected.parent.getNextSiblingID()}});
|
|
|
if(selected.nextSibling && selected.children.length > 0){
|
|
|
//更新选中节点最末子节点
|
|
@@ -704,7 +825,7 @@ const billsGuidance = (function () {
|
|
|
updateDatas.push({updateType: updateType.update, findData: {ID: selected.preSibling.getID()}, updateData: {NextSiblingID: selected.getNextSiblingID()}});
|
|
|
//更新前前节点
|
|
|
if(selected.preSibling.preSibling){
|
|
|
- updateDatas.push({udpateType: updateType.update, findData: {ID: selected.preSibling.preSibling.getID()}, updateData: {NextSiblingID: selected.getID()}});
|
|
|
+ updateDatas.push({updateType: updateType.update, findData: {ID: selected.preSibling.preSibling.getID()}, updateData: {NextSiblingID: selected.getID()}});
|
|
|
}
|
|
|
//更新选中节点
|
|
|
updateDatas.push({updateType: updateType.update, findData: {ID: selected.getID()}, updateData: {NextSiblingID: selected.preSibling.getID()}});
|
|
@@ -847,8 +968,9 @@ const billsGuidance = (function () {
|
|
|
ration.cache = ration.datas;
|
|
|
}
|
|
|
else{
|
|
|
+ let reg = new RegExp(searchStr, 'i');
|
|
|
ration.cache = _.filter(ration.datas, function (data) {
|
|
|
- return data.code.includes(searchStr);
|
|
|
+ return reg.test(data.code);
|
|
|
});
|
|
|
}
|
|
|
$('.top-content').hide();
|