|
@@ -29,8 +29,13 @@ let contentOprObj = {
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
},
|
|
},
|
|
//将从清单库中添加的清单,把标准清单的工作内容转化成清单的工作内容
|
|
//将从清单库中添加的清单,把标准清单的工作内容转化成清单的工作内容
|
|
- buildJobContent: function () {
|
|
|
|
-
|
|
|
|
|
|
+ buildJobContent: function (jobs) {
|
|
|
|
+ let jobContent = [];
|
|
|
|
+ for(let i = 0, len = jobs.length; i < len; i++){
|
|
|
|
+ let newJob = {serialNo: i + 1, content: jobs[i].content, isChecked: true};//从清单库添加过来的默认输出
|
|
|
|
+ jobContent.push(newJob);
|
|
|
|
+ }
|
|
|
|
+ return jobContent;
|
|
},
|
|
},
|
|
//显示在jobSpread的数据
|
|
//显示在jobSpread的数据
|
|
showContentData: function (sheet, setting, datas) {
|
|
showContentData: function (sheet, setting, datas) {
|
|
@@ -196,15 +201,10 @@ let contentOprObj = {
|
|
selector: '#jobSpread',
|
|
selector: '#jobSpread',
|
|
build: function($triggerElement, e){
|
|
build: function($triggerElement, e){
|
|
//控制允许右键菜单在哪个位置出现
|
|
//控制允许右键菜单在哪个位置出现
|
|
- let clientX = e.originalEvent.clientX,
|
|
|
|
- clientY = e.originalEvent.clientY;
|
|
|
|
- let sheet = me.workBook.getSheet(0);
|
|
|
|
- let offset = $("#jobSpread").offset(),
|
|
|
|
- x = clientX - offset.left,
|
|
|
|
- y = clientY - offset.top;
|
|
|
|
- let target = sheet.hitTest(x, y);
|
|
|
|
|
|
+ let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
|
|
|
|
+ let sheet = me.workBook.getSheet(0);
|
|
if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
- let insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
|
|
|
+ let insertDis = pageCCOprObj.isBillsType() ? false : true, delDis = false, upDis = false, downDis = false;
|
|
if(typeof target.row !== 'undefined'){
|
|
if(typeof target.row !== 'undefined'){
|
|
//控制按钮是否可用
|
|
//控制按钮是否可用
|
|
sheet.setActiveCell(target.row, target.col);
|
|
sheet.setActiveCell(target.row, target.col);
|
|
@@ -214,11 +214,18 @@ let contentOprObj = {
|
|
upDis = true;
|
|
upDis = true;
|
|
}
|
|
}
|
|
else{//有数据
|
|
else{//有数据
|
|
- if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
|
|
|
+ if(typeof target.col === 'undefined'){//定位不在表格内
|
|
downDis = true;
|
|
downDis = true;
|
|
- }
|
|
|
|
- if(target.row === 0){//定位在第一行,不可上移
|
|
|
|
upDis = true;
|
|
upDis = true;
|
|
|
|
+ delDis = true;
|
|
|
|
+ }
|
|
|
|
+ else{//定位在表格内
|
|
|
|
+ if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
|
+ downDis = true;
|
|
|
|
+ }
|
|
|
|
+ if(target.row === 0){//定位在第一行,不可上移
|
|
|
|
+ upDis = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -230,7 +237,7 @@ let contentOprObj = {
|
|
return {
|
|
return {
|
|
callback: function(){},
|
|
callback: function(){},
|
|
items: {
|
|
items: {
|
|
- "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
|
|
|
+ "insert": {name: "添加", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
//插入空行
|
|
//插入空行
|
|
me.addRow(sheet);
|
|
me.addRow(sheet);
|
|
}},
|
|
}},
|
|
@@ -283,6 +290,20 @@ let characterOprObj = {
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
},
|
|
},
|
|
|
|
+ //将从清单库中添加的清单,把标准清单的项目特征转化成清单的项目特征
|
|
|
|
+ buildItemCharactet: function (items) {//从清单库过来的默认不输出
|
|
|
|
+ let itemCharacter = [];
|
|
|
|
+ for(let i = 0, len = items.length; i < len; i++){
|
|
|
|
+ let newItem = {serialNo: i + 1, character: items[i].content, eigenvalue: [], isChecked: false};
|
|
|
|
+ let eigenvalues = items[i].itemValue;
|
|
|
|
+ for(let j = 0, len = eigenvalues.length; j < len; j++){
|
|
|
|
+ let newValue = {value: eigenvalues[j].value, isSelected: false};
|
|
|
|
+ newItem.eigenvalue.push(newValue);
|
|
|
|
+ }
|
|
|
|
+ itemCharacter.push(newItem);
|
|
|
|
+ }
|
|
|
|
+ return itemCharacter;
|
|
|
|
+ },
|
|
//显示在itemSpread的数据
|
|
//显示在itemSpread的数据
|
|
showCharacterData: function (sheet, setting, datas) {
|
|
showCharacterData: function (sheet, setting, datas) {
|
|
let me = characterOprObj;
|
|
let me = characterOprObj;
|
|
@@ -414,6 +435,7 @@ let characterOprObj = {
|
|
let me = characterOprObj;
|
|
let me = characterOprObj;
|
|
me.unsetSelected(item);
|
|
me.unsetSelected(item);
|
|
me.setSelected(item, value);
|
|
me.setSelected(item, value);
|
|
|
|
+
|
|
},
|
|
},
|
|
insertValue: function (item, value) {
|
|
insertValue: function (item, value) {
|
|
let me = characterOprObj;
|
|
let me = characterOprObj;
|
|
@@ -434,14 +456,16 @@ let characterOprObj = {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //不存在,新增进eigenvalue
|
|
|
|
|
|
+ //不存在,新增进eigenvalue,自动打勾输出
|
|
if(!isExist){
|
|
if(!isExist){
|
|
//更新selected
|
|
//更新selected
|
|
me.insertValue(item, value);
|
|
me.insertValue(item, value);
|
|
|
|
+ item.isChecked = true;
|
|
}
|
|
}
|
|
- //存在,选择特征值
|
|
|
|
|
|
+ //存在,选择特征值,自动打勾输出
|
|
else{
|
|
else{
|
|
me.changeSelected(item, value);
|
|
me.changeSelected(item, value);
|
|
|
|
+ item.isChecked = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -457,9 +481,9 @@ let characterOprObj = {
|
|
let newCharacter = {character: '', eigenvalue: [newValue], isChecked: false, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
let newCharacter = {character: '', eigenvalue: [newValue], isChecked: false, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
me.currentCache.push(newCharacter);
|
|
me.currentCache.push(newCharacter);
|
|
}
|
|
}
|
|
- else if(character && value){
|
|
|
|
|
|
+ else if(character && value){//有了特征值自动打勾输出
|
|
let newValue = {value: value, isSelected: true};
|
|
let newValue = {value: value, isSelected: true};
|
|
- let newCharacter = {character:character , eigenvalue: [newValue], isChecked: false, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
|
|
|
|
+ let newCharacter = {character:character , eigenvalue: [newValue], isChecked: true, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
me.currentCache.push(newCharacter);
|
|
me.currentCache.push(newCharacter);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -539,7 +563,6 @@ let characterOprObj = {
|
|
}
|
|
}
|
|
let isChecked = args.sheet.getValue(args.row, args.col);
|
|
let isChecked = args.sheet.getValue(args.row, args.col);
|
|
if(me.currentCache.length > args.row){
|
|
if(me.currentCache.length > args.row){
|
|
- me.refreshColData = true;
|
|
|
|
me.currentCache[args.row].isChecked = isChecked;
|
|
me.currentCache[args.row].isChecked = isChecked;
|
|
me.save();
|
|
me.save();
|
|
}
|
|
}
|
|
@@ -554,15 +577,10 @@ let characterOprObj = {
|
|
selector: '#itemSpread',
|
|
selector: '#itemSpread',
|
|
build: function($triggerElement, e){
|
|
build: function($triggerElement, e){
|
|
//控制允许右键菜单在哪个位置出现
|
|
//控制允许右键菜单在哪个位置出现
|
|
- let clientX = e.originalEvent.clientX,
|
|
|
|
- clientY = e.originalEvent.clientY;
|
|
|
|
|
|
+ let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
|
|
let sheet = me.workBook.getSheet(0);
|
|
let sheet = me.workBook.getSheet(0);
|
|
- let offset = $("#itemSpread").offset(),
|
|
|
|
- x = clientX - offset.left,
|
|
|
|
- y = clientY - offset.top;
|
|
|
|
- let target = sheet.hitTest(x, y);
|
|
|
|
if(target.hitTestType === 3){//在表格内 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
if(target.hitTestType === 3){//在表格内 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
- let insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
|
|
|
+ let insertDis = pageCCOprObj.isBillsType() ? false : true, delDis = false, upDis = false, downDis = false;
|
|
if(typeof target.row !== 'undefined'){
|
|
if(typeof target.row !== 'undefined'){
|
|
//控制按钮是否可用
|
|
//控制按钮是否可用
|
|
sheet.setActiveCell(target.row, target.col);
|
|
sheet.setActiveCell(target.row, target.col);
|
|
@@ -572,11 +590,18 @@ let characterOprObj = {
|
|
upDis = true;
|
|
upDis = true;
|
|
}
|
|
}
|
|
else{//有数据
|
|
else{//有数据
|
|
- if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
|
|
|
+ if(typeof target.col === 'undefined'){//定位在表格外
|
|
downDis = true;
|
|
downDis = true;
|
|
- }
|
|
|
|
- if(target.row === 0){//定位在第一行,不可上移
|
|
|
|
upDis = true;
|
|
upDis = true;
|
|
|
|
+ delDis = true;
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
|
+ downDis = true;
|
|
|
|
+ }
|
|
|
|
+ if(target.row === 0){//定位在第一行,不可上移
|
|
|
|
+ upDis = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -588,7 +613,7 @@ let characterOprObj = {
|
|
return {
|
|
return {
|
|
callback: function(){},
|
|
callback: function(){},
|
|
items: {
|
|
items: {
|
|
- "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
|
|
|
+ "insert": {name: "添加", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
me.addRow(sheet);
|
|
me.addRow(sheet);
|
|
}},
|
|
}},
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
@@ -614,6 +639,30 @@ let characterOprObj = {
|
|
let pageCCOprObj = {
|
|
let pageCCOprObj = {
|
|
currentFindSet: null,
|
|
currentFindSet: null,
|
|
mainActiveCell: null,//mainSpread焦点单元格
|
|
mainActiveCell: null,//mainSpread焦点单元格
|
|
|
|
+ //获得造价书当前焦点行的类型:清单、定额
|
|
|
|
+ isBillsType: function () {
|
|
|
|
+ let rst = false;
|
|
|
|
+ let selectedNode = projectObj.mainController.tree.selected;
|
|
|
|
+ if(selectedNode && selectedNode.sourceType === projectObj.project.Bills.getSourceType()){//为清单
|
|
|
|
+ rst = true
|
|
|
|
+ }
|
|
|
|
+ return rst;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ setItemContentNode: function (node, jobs, items) {
|
|
|
|
+ let theCont = contentOprObj, theCha = characterOprObj,
|
|
|
|
+ jobContent, itemCharacter, contentTxt, characterTxt;
|
|
|
|
+ jobContent = theCont.buildJobContent(jobs);
|
|
|
|
+ itemCharacter = theCha.buildItemCharactet(items);
|
|
|
|
+ contentTxt = theCont.getColData(jobContent);
|
|
|
|
+ characterTxt = theCha.getColData(itemCharacter);
|
|
|
|
+ node.data.jobContent = jobContent;
|
|
|
|
+ node.data.itemCharacter = itemCharacter;
|
|
|
|
+ node.data.jobContentText = contentTxt ? contentTxt : '';
|
|
|
|
+ node.data.itemCharacterText = characterTxt ? characterTxt : '';
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
//设置特征及内容currentCache
|
|
//设置特征及内容currentCache
|
|
setCacheAndShow: function (node) {
|
|
setCacheAndShow: function (node) {
|
|
let theCont = contentOprObj, theCha = characterOprObj;
|
|
let theCont = contentOprObj, theCha = characterOprObj;
|
|
@@ -665,6 +714,8 @@ let pageCCOprObj = {
|
|
},
|
|
},
|
|
clearData: function () {
|
|
clearData: function () {
|
|
let theCon = contentOprObj, theCha = characterOprObj;
|
|
let theCon = contentOprObj, theCha = characterOprObj;
|
|
|
|
+ theCon.workBook.getSheet(0).setRowCount(0);
|
|
|
|
+ theCha.workBook.getSheet(0).setRowCount(0);
|
|
sheetCommonObj.cleanSheet(theCon.workBook.getSheet(0), theCon.setting, -1);
|
|
sheetCommonObj.cleanSheet(theCon.workBook.getSheet(0), theCon.setting, -1);
|
|
sheetCommonObj.cleanSheet(theCha.workBook.getSheet(0), theCha.setting, -1);
|
|
sheetCommonObj.cleanSheet(theCha.workBook.getSheet(0), theCha.setting, -1);
|
|
},
|
|
},
|