|
@@ -41,37 +41,89 @@ var projectObj = {
|
|
|
}
|
|
|
};
|
|
|
let selected = tree.selected, that = projectObj;
|
|
|
+
|
|
|
let canUpLevel = function (node) {
|
|
|
- if (selected && selected.depth() > 1 && selected.canUpLevel()) {
|
|
|
- if (selected.sourceType === that.project.Bills.getSourceType()) {
|
|
|
- return (!selected.nextSibling) || (selected.children.length === 0) || (selected.source.children.length > 0);
|
|
|
- } else {
|
|
|
+ if(!node){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.depth()<=1){//焦点行是树结构的第一/二层节点,灰显。
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.sourceType !== that.project.Bills.getSourceType()){//焦点行是定额/量价/工料机,灰显。
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ if(node.data.type == billType.FX){//是分项,灰显。
|
|
|
return false;
|
|
|
}
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ if(node.data.type == billType.FB&&node.nextSibling&&node.children.length>0){//焦点行是分部有后兄弟,有子项.
|
|
|
+ if(node.children[0].data.type==billType.FX){ //焦点行子项是分项
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(node.data.type == billType.BILL &&node.nextSibling){//焦点行是清单有后兄弟
|
|
|
+ if(node.data.calcBase&&node.data.calcBase!=""){//有基数计算
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.children.length>0&&node.children[0].sourceType !== that.project.Bills.getSourceType()){//有子项,并且子项不是清单
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ return true;
|
|
|
};
|
|
|
let canDownLevel = function (node) {
|
|
|
- if (selected && selected.depth() > 0 && selected.canDownLevel()) {
|
|
|
- if (selected.sourceType === that.project.Bills.getSourceType()) {
|
|
|
- return (selected.preSibling.children.length === 0) || (selected.preSibling.source.children.length > 0);
|
|
|
- } else {
|
|
|
+ if(!node){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.depth()==0){//焦点行是树结构的第一层节点,灰显。
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.sourceType !== that.project.Bills.getSourceType()) {//焦点行是定额/量价/工料机,灰显。
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ if(node.data.type == billType.FX){//是分项,灰显。
|
|
|
return false;
|
|
|
}
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ if(!node.preSibling){//无前兄弟,灰显
|
|
|
+ return false;
|
|
|
+ }else if(node.preSibling.data.calcBase&&node.preSibling.data.calcBase!=""){//前兄弟有基数计算
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(node.preSibling.children.length>0){//前兄弟有子项,子项是分项,灰显。
|
|
|
+ if(node.data.type==billType.FB&&node.preSibling.children[0].data.type==billType.FX){//焦点行是分部前兄弟有子项,子项是分项,灰显。
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(node.data.type==billType.BILL&&node.preSibling.children[0].sourceType !== that.project.Bills.getSourceType()){//焦点行是清单,子项不是清单
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ return true;
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ let canUpMove = function (node) {
|
|
|
+ if(node&&node.preSibling){//有前兄弟
|
|
|
+ if(node.sourceType==that.project.Bills.getSourceType()&&node.data.type == billType.DXFY&&node.data.isAdd!==1){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ };
|
|
|
+ let canDownMove = function (node) {
|
|
|
+ if(node&&node.nextSibling){
|
|
|
+ if(node.sourceType==that.project.Bills.getSourceType()&&node.data.type == billType.DXFY&&node.data.isAdd!==1){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ };
|
|
|
+
|
|
|
setButtonValid(ifCanDelete(), $('#delete'));
|
|
|
setButtonValid(canUpLevel(selected), $('#upLevel'));
|
|
|
setButtonValid(canDownLevel(selected), $('#downLevel'));
|
|
|
- setButtonValid(selected && (selected.depth() > 0) && selected.canUpMove(), $('#upMove'));
|
|
|
- setButtonValid(selected && (selected.depth() > 0) && selected.canDownMove(), $('#downMove'));
|
|
|
-
|
|
|
+ setButtonValid(canUpMove(selected) , $('#upMove'));
|
|
|
+ setButtonValid(canDownMove(selected), $('#downMove'));
|
|
|
},
|
|
|
checkCommonField: function (editingText, colSetting) {
|
|
|
let value;
|
|
@@ -471,6 +523,7 @@ var projectObj = {
|
|
|
that.loadFocusLocation();
|
|
|
let endTime = +new Date();
|
|
|
console.log("加载完成-----"+endTime);
|
|
|
+ console.log(`时间——${endTime - startTime}`);
|
|
|
}
|
|
|
else {
|
|
|
|
|
@@ -801,63 +854,90 @@ var projectObj = {
|
|
|
};
|
|
|
},
|
|
|
|
|
|
- //根据节点获取行style(颜色、字体加粗)
|
|
|
- getNodeColorStyle: function (node) {
|
|
|
- let type, backColor = null, foreColor = null;
|
|
|
+ //根据节点获取行style(颜色、字体加粗)
|
|
|
+ getNodeColorStyle: function (node, colSetting) {
|
|
|
+ let colorSetting = optionsOprObj.getOption(optionsOprObj.optionsTypes.COLOROPTS);
|
|
|
+ let mapping = {DEFAULT: 'DEFAULT', DXFY: 'DXFY', FB: 'FB', UNLEAFBILL: 'UNLEAFBILL',
|
|
|
+ FX: 'FX', UNCBBILL: 'UNCBBILL', CBBILL: 'CBBILL', ZCSB: 'ZCSB'};
|
|
|
+ let styleMap = null;
|
|
|
+ //中文字段名,由于同一节点中,中文字体大小和数字字体大小不同
|
|
|
+ let stringFields = [
|
|
|
+ 'code',
|
|
|
+ 'subType',
|
|
|
+ 'name',
|
|
|
+ 'unit',
|
|
|
+ 'itemCharacterText',
|
|
|
+ 'jobContentText',
|
|
|
+ 'adjustState',
|
|
|
+ 'calcBase',
|
|
|
+ 'programID',
|
|
|
+ 'ruleText'
|
|
|
+ ];
|
|
|
if(!isDef(node)){
|
|
|
return null;
|
|
|
}
|
|
|
//清单大类
|
|
|
if(node.sourceType === this.project.Bills.getSourceType()){
|
|
|
+ //大项费用
|
|
|
+ if(node.data.type === billType.DXFY){
|
|
|
+ styleMap = mapping.DXFY;
|
|
|
+ }
|
|
|
//分部
|
|
|
if(node.data.type === billType.FB){
|
|
|
- type = 1;
|
|
|
+ styleMap = mapping.FB;
|
|
|
}
|
|
|
//分项
|
|
|
else if(node.data.type === billType.FX){
|
|
|
- type = 2;
|
|
|
+ styleMap = mapping.FX;
|
|
|
}
|
|
|
//清单
|
|
|
else if(node.data.type === billType.BILL){
|
|
|
//非叶子节点的清单
|
|
|
if(node.source.children.length > 0){
|
|
|
- type = 1;
|
|
|
+ styleMap = mapping.UNLEAFBILL;
|
|
|
}
|
|
|
//未使用基数计算的叶子节点的清单
|
|
|
else if(node.source.children.length === 0 && (!isDef(node.data.calcBase) || node.data.calcBase === '')){
|
|
|
- type = 2;
|
|
|
+ styleMap = mapping.UNCBBILL;
|
|
|
}
|
|
|
//使用基数计算的叶子节点的清单
|
|
|
else if(node.source.children.length === 0 && isDef(node.data.calcBase && node.data.calcBaseValue !== '')){
|
|
|
- type = 3;
|
|
|
+ styleMap = mapping.CBBILL;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//定额下的主材、设备
|
|
|
else if(node.sourceType === this.project.ration_glj.getSourceType()){
|
|
|
- type = 4;
|
|
|
+ styleMap = mapping.ZCSB;
|
|
|
}
|
|
|
- switch (type){
|
|
|
- //case 0: font = 'bold 13px "Arial"'; break;
|
|
|
- case 1: backColor = '#c1d3e3'; break;
|
|
|
- case 2: backColor = '#dae5ee'; break;
|
|
|
- case 3: backColor = '#e5f3f2'; break;
|
|
|
- case 4: foreColor = '#4D7BFF'; break;
|
|
|
+ else {
|
|
|
+ styleMap = mapping.DEFAULT;
|
|
|
}
|
|
|
- if(!backColor && !foreColor){
|
|
|
+ let styleSetting = colorSetting[styleMap];
|
|
|
+ let defaultSetting = colorSetting[mapping.DEFAULT];
|
|
|
+ if(!isDef(styleSetting)){
|
|
|
return null;
|
|
|
}
|
|
|
let style = new GC.Spread.Sheets.Style();
|
|
|
- if(foreColor){
|
|
|
- style.foreColor = foreColor;
|
|
|
- }
|
|
|
- if(backColor){
|
|
|
- style.backColor = backColor;
|
|
|
- style.borderLeft = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
- style.borderTop = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
- style.borderRight = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
- style.borderBottom = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
+ //设置style属性
|
|
|
+ for(let attr in styleSetting){
|
|
|
+ if(attr !== 'stringFont' && attr !== 'numFont'){
|
|
|
+ style[attr] = styleSetting[attr] === 'default' || !isDef(styleSetting[attr]) ? defaultSetting[attr] : styleSetting[attr];
|
|
|
+ }
|
|
|
+ //暂时不开放字体设置,开放的话只能每个单元格进入此方法
|
|
|
+ /* else {
|
|
|
+ if(stringFields.indexOf(colSetting.data.field) > 0){
|
|
|
+ style.font = styleSetting.stringFont === 'default' || !isDef(styleSetting.stringFont) ? defaultSetting.stringFont : styleSetting.stringFont;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ style.font = styleSetting.numFont === 'default' || !isDef(styleSetting.numFont) ? defaultSetting.numFont : styleSetting.numFont;
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|
|
|
+ style.borderLeft = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
+ style.borderTop = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
+ style.borderRight = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
+ style.borderBottom = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
|
|
|
return style;
|
|
|
},
|
|
|
//大项费用则字体加粗,String 15px, Number 13px
|
|
@@ -887,6 +967,7 @@ var projectObj = {
|
|
|
}
|
|
|
return style;
|
|
|
}
|
|
|
+
|
|
|
};
|
|
|
// 点击合计框中的复制
|
|
|
$("body").on("click", "#total-tips a", function() {
|
|
@@ -926,7 +1007,7 @@ $('#upLevel').click(function () {
|
|
|
if (selected && selected.sourceType === project.Bills.getSourceType()) {
|
|
|
project.Bills.upLevelBills(selected.source);
|
|
|
controller.upLevel();
|
|
|
- projectObj.converseCalculateBills(orgParent);
|
|
|
+ projectObj.project.calcProgram.calcBillsAndSave([selected,orgParent]);
|
|
|
}
|
|
|
});
|
|
|
$('#downLevel').click(function () {
|