|
@@ -27,6 +27,32 @@ let contentOprObj = {
|
|
|
sheet.bind(EVENTS.EditEnded, me.onEditEnded);
|
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
|
+ sheet.bind(EVENTS.SelectionChanged, me.onSelectionChanged);
|
|
|
+ me.bindTools();
|
|
|
+ },
|
|
|
+ bindTools: function () {
|
|
|
+ let me = contentOprObj;
|
|
|
+ let sheet = me.workBook.getActiveSheet();
|
|
|
+ $('#jobAdd').click(function () {
|
|
|
+ me.insertContent(sheet, me.currentCache.length, '');
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#jobInsert').click(function(){
|
|
|
+ me.insertContent(sheet, sheet.getActiveRowIndex(), '');
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#jobDel').click(function(){
|
|
|
+ me.deleteContent(sheet.getActiveRowIndex());
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#jobUp').click(function(){
|
|
|
+ me.upMove({row: sheet.getActiveRowIndex(), col: sheet.getActiveColumnIndex()});
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#jobDown').click(function(){
|
|
|
+ me.downMove({row: sheet.getActiveRowIndex(), col: sheet.getActiveColumnIndex()});
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
},
|
|
|
//将从清单库中添加的清单,把标准清单的工作内容转化成清单的工作内容
|
|
|
buildJobContent: function (jobs) {
|
|
@@ -72,11 +98,11 @@ let contentOprObj = {
|
|
|
return null;
|
|
|
},
|
|
|
//新增行
|
|
|
- addRow: function (sheet) {
|
|
|
+ addRow: function (idx, sheet) {
|
|
|
let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
checkBox.isThreeState = false;
|
|
|
- sheet.addRows(sheet.getRowCount(), 1);
|
|
|
- sheet.getCell(sheet.getRowCount() - 1, 1).cellType(checkBox);
|
|
|
+ sheet.addRows(idx, 1);
|
|
|
+ sheet.getCell(idx - 1, 1).cellType(checkBox);
|
|
|
},
|
|
|
upMove: function (cell) {
|
|
|
let me = contentOprObj;
|
|
@@ -88,6 +114,7 @@ let contentOprObj = {
|
|
|
preObj.serialNo = temp;
|
|
|
me.sortCache(me.currentCache);
|
|
|
me.save(function () {
|
|
|
+ me.workBook.focus();
|
|
|
me.workBook.getSheet(0).setActiveCell(cell.row - 1, cell.col);
|
|
|
});
|
|
|
},
|
|
@@ -101,6 +128,7 @@ let contentOprObj = {
|
|
|
nextObj.serialNo = temp;
|
|
|
me.sortCache(me.currentCache);
|
|
|
me.save(function () {
|
|
|
+ me.workBook.focus();
|
|
|
me.workBook.getSheet(0).setActiveCell(cell.row + 1, cell.col);
|
|
|
});
|
|
|
},
|
|
@@ -108,18 +136,24 @@ let contentOprObj = {
|
|
|
let me = contentOprObj;
|
|
|
me.currentCache.splice(rowIdx, 1);
|
|
|
me.save();
|
|
|
+ me.workBook.focus();
|
|
|
},
|
|
|
//更新
|
|
|
updateContent: function (job, newContent) {
|
|
|
+ let me = contentOprObj;
|
|
|
job.content = newContent;
|
|
|
+ me.save();
|
|
|
},
|
|
|
//新增
|
|
|
- insertContent: function (content) {
|
|
|
+ insertContent: function (sheet, idx, content) {
|
|
|
let me = contentOprObj;
|
|
|
- let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
- let newObj = {content: content, isCheceked: false, serialNo: preObj ? preObj.serialNo + 1 : 1};
|
|
|
- me.currentCache.push(newObj);
|
|
|
-
|
|
|
+ me.addRow(idx, sheet);
|
|
|
+ let newObj = {content: content, isChecked: true};
|
|
|
+ me.currentCache.splice(idx, 0, newObj);
|
|
|
+ //重新排序赋值
|
|
|
+ pageCCOprObj.resortNo(me.currentCache);
|
|
|
+ me.save();
|
|
|
+ me.workBook.focus();
|
|
|
},
|
|
|
save: function (callback) {
|
|
|
let selectedNode = projectObj.mainController.tree.selected;
|
|
@@ -128,24 +162,15 @@ let contentOprObj = {
|
|
|
},
|
|
|
onEditEnded: function (sender, args) {
|
|
|
let me = contentOprObj;
|
|
|
- let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
- let contentTxt;
|
|
|
- if(args.editingText && args.editingText.toString().trim().length > 0){
|
|
|
- //更新
|
|
|
- if(args.row < me.currentCache.length ){
|
|
|
- me.updateContent(me.currentCache[args.row], args.editingText);
|
|
|
- }
|
|
|
- //新增
|
|
|
- else{
|
|
|
- me.insertContent(args.editingText);
|
|
|
- }
|
|
|
- //保存
|
|
|
- me.save();
|
|
|
+ if(me.setting.header[args.col].dataCode === 'isChecked'){
|
|
|
+ return;
|
|
|
}
|
|
|
- else{
|
|
|
- //恢复
|
|
|
- args.sheet.setValue(args.row, args.col, me.currentCache.length > args.row ? me.currentCache[args.row].content + '' : '');
|
|
|
+ args.editingText = args.editingText ? args.editingText : '';
|
|
|
+ //更新
|
|
|
+ if(args.row < me.currentCache.length ){
|
|
|
+ me.updateContent(me.currentCache[args.row], args.editingText);
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
//复选框控制输出
|
|
|
onButtonClicked: function (sender, args) {
|
|
@@ -179,12 +204,42 @@ let contentOprObj = {
|
|
|
if(rowIdx < me.currentCache.length){
|
|
|
me.updateContent(me.currentCache[rowIdx], items[i].content);
|
|
|
}
|
|
|
- //新增
|
|
|
- else{
|
|
|
- me.insertContent(items[i].content);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSelectionChanged: function (sender, args) {
|
|
|
+ let me = contentOprObj;
|
|
|
+ if(args.newSelections && args.newSelections.length > 0){
|
|
|
+ me.initSelection(args.newSelections[0].row);
|
|
|
+ }
|
|
|
+ me.initSelection(args.newSelections[0].row);
|
|
|
+ },
|
|
|
+ initSelection: function (row) {
|
|
|
+ let me = contentOprObj;
|
|
|
+ let disObj = {jobAdd: false, jobInsert: true, jobDel: true, jobUp: true, jobDown: true};
|
|
|
+ if(row !== -1){
|
|
|
+ //在表内
|
|
|
+ if(row < me.currentCache.length){
|
|
|
+ disObj.jobDel = false;
|
|
|
+ disObj.jobInsert = false;
|
|
|
+ if(row !== 0){
|
|
|
+ disObj.jobUp = false;
|
|
|
+ }
|
|
|
+ if(row !== me.currentCache.length - 1){
|
|
|
+ disObj.jobDown = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ me.refreshTools(disObj);
|
|
|
+ },
|
|
|
+ //刷新工具条
|
|
|
+ refreshTools: function (disObj) {
|
|
|
+ for(let o in disObj){
|
|
|
+ let jqSel = $(`#${o}`);
|
|
|
+ jqSel.removeClass('disabled');
|
|
|
+ if(disObj[o]){
|
|
|
+ jqSel.addClass('disabled');
|
|
|
}
|
|
|
}
|
|
|
- me.save();
|
|
|
},
|
|
|
sortCache: function (cacheArr) {
|
|
|
cacheArr.sort(function (a, b) {
|
|
@@ -206,18 +261,20 @@ let contentOprObj = {
|
|
|
//控制允许右键菜单在哪个位置出现
|
|
|
let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
|
|
|
let sheet = me.workBook.getSheet(0);
|
|
|
+ let addDis = pageCCOprObj.isBillsType() ? false : true, insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
|
- let insertDis = pageCCOprObj.isBillsType() ? false : true, delDis = false, upDis = false, downDis = false;
|
|
|
if(typeof target.row !== 'undefined'){
|
|
|
//控制按钮是否可用
|
|
|
sheet.setActiveCell(target.row, target.col);
|
|
|
if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
+ insertDis = true;
|
|
|
delDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
}
|
|
|
else{//有数据
|
|
|
if(typeof target.col === 'undefined'){//定位不在表格内
|
|
|
+ insertDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
delDis = true;
|
|
@@ -233,16 +290,20 @@ let contentOprObj = {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
+ insertDis = true;
|
|
|
delDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
}
|
|
|
+ me.refreshTools({jobAdd: addDis, jobInsert: insertDis, jobDel: delDis, jobUp: upDis, jobDown: downDis});
|
|
|
return {
|
|
|
callback: function(){},
|
|
|
items: {
|
|
|
- "insert": {name: "添加", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
- //插入空行
|
|
|
- me.addRow(sheet);
|
|
|
+ "insert": {name: "插入", disabled: insertDis, icon: "context-menu-icon context-menu-icon-add", callback: function (key, opt) {
|
|
|
+ me.insertContent(sheet, sheet.getActiveRowIndex(), '');
|
|
|
+ }},
|
|
|
+ "add": {name: "添加", disabled: addDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
+ me.insertContent(sheet, me.currentCache.length, '');
|
|
|
}},
|
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
|
me.deleteContent(target.row);
|
|
@@ -258,6 +319,7 @@ let contentOprObj = {
|
|
|
};
|
|
|
}
|
|
|
else{
|
|
|
+ me.refreshTools({jobAdd: addDis, jobInsert: insertDis, jobDel: delDis, jobUp: upDis, jobDown: downDis});
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -293,7 +355,33 @@ let characterOprObj = {
|
|
|
sheet.bind(EVENTS.EditStarting, me.onEditStart);
|
|
|
sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
|
|
|
sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
|
|
|
+ sheet.bind(EVENTS.SelectionChanged, me.onSelectionChanged);
|
|
|
workBook.bind(EVENTS.RangeChanged, me.onRangeChanged);
|
|
|
+ me.bindTools();
|
|
|
+ },
|
|
|
+ bindTools: function () {
|
|
|
+ let me = characterOprObj;
|
|
|
+ let sheet = me.workBook.getActiveSheet();
|
|
|
+ $('#itemAdd').click(function () {
|
|
|
+ me.insertCharacter(sheet, me.currentCache.length, '');
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#itemInsert').click(function(){
|
|
|
+ me.insertCharacter(sheet, sheet.getActiveRowIndex(), '');
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#itemDel').click(function(){
|
|
|
+ me.deleteCharacter(sheet.getActiveRowIndex());
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#itemUp').click(function(){
|
|
|
+ me.upMove({row: sheet.getActiveRowIndex(), col: sheet.getActiveColumnIndex()});
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
+ $('#itemDown').click(function(){
|
|
|
+ me.downMove({row: sheet.getActiveRowIndex(), col: sheet.getActiveColumnIndex()});
|
|
|
+ me.workBook.focus();
|
|
|
+ });
|
|
|
},
|
|
|
//将从清单库中添加的清单,把标准清单的项目特征转化成清单的项目特征
|
|
|
buildItemCharactet: function (items) {//从清单库过来的默认不输出
|
|
@@ -382,15 +470,14 @@ let characterOprObj = {
|
|
|
}
|
|
|
return null;
|
|
|
},
|
|
|
- addRow: function (sheet) {
|
|
|
+ addRow: function (idx, sheet) {
|
|
|
let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox(),
|
|
|
combo = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
checkBox.isThreeState = false;
|
|
|
combo.editable(true);
|
|
|
- let rowIdx = sheet.getRowCount();
|
|
|
- sheet.addRows(rowIdx, 1);
|
|
|
- sheet.getCell(rowIdx, 1).cellType(combo);
|
|
|
- sheet.getCell(rowIdx, 2).cellType(checkBox);
|
|
|
+ sheet.addRows(idx, 1);
|
|
|
+ sheet.getCell(idx, 1).cellType(combo);
|
|
|
+ sheet.getCell(idx, 2).cellType(checkBox);
|
|
|
},
|
|
|
upMove: function (cell) {
|
|
|
let me = characterOprObj;
|
|
@@ -403,6 +490,7 @@ let characterOprObj = {
|
|
|
contentOprObj.sortCache(me.currentCache);
|
|
|
me.save(function () {
|
|
|
me.workBook.getSheet(0).setActiveCell(cell.row - 1, cell.col);
|
|
|
+ me.workBook.focus();
|
|
|
});
|
|
|
},
|
|
|
downMove: function (cell) {
|
|
@@ -416,12 +504,14 @@ let characterOprObj = {
|
|
|
contentOprObj.sortCache(me.currentCache);
|
|
|
me.save(function () {
|
|
|
me.workBook.getSheet(0).setActiveCell(cell.row + 1, cell.col);
|
|
|
+ me.workBook.focus();
|
|
|
});
|
|
|
},
|
|
|
deleteCharacter: function (rowIdx) {
|
|
|
let me = characterOprObj;
|
|
|
me.currentCache.splice(rowIdx, 1);
|
|
|
me.save();
|
|
|
+ me.workBook.focus();
|
|
|
},
|
|
|
//取消选择的特征值
|
|
|
unsetSelected: function (item) {
|
|
@@ -477,24 +567,16 @@ let characterOprObj = {
|
|
|
item.isChecked = true;
|
|
|
}
|
|
|
}
|
|
|
+ me.save();
|
|
|
},
|
|
|
- insertCharacter: function (character, value) {
|
|
|
+ insertCharacter: function (sheet, idx, character) {
|
|
|
let me = characterOprObj;
|
|
|
- let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
- if(character && !value){
|
|
|
- let newCharacter = {character: character, eigenvalue: [], isChecked: false, serialNo: preObj ? preObj.serialNo + 1 : 1};
|
|
|
- me.currentCache.push(newCharacter);
|
|
|
- }
|
|
|
- else if(!character && value){
|
|
|
- let newValue = {value: value, isSelected: true};
|
|
|
- let newCharacter = {character: '', eigenvalue: [newValue], isChecked: false, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
|
- me.currentCache.push(newCharacter);
|
|
|
- }
|
|
|
- else if(character && value){//有了特征值自动打勾输出
|
|
|
- let newValue = {value: value, isSelected: true};
|
|
|
- let newCharacter = {character:character , eigenvalue: [newValue], isChecked: true, serialNo: preObj? preObj.serialNo + 1 : 1};
|
|
|
- me.currentCache.push(newCharacter);
|
|
|
- }
|
|
|
+ me.addRow(idx, sheet);
|
|
|
+ let newObj = {character: character, eigenvalue: [], isChecked: false};
|
|
|
+ me.currentCache.splice(idx, 0, newObj);
|
|
|
+ pageCCOprObj.resortNo(me.currentCache);
|
|
|
+ me.save();
|
|
|
+ me.workBook.focus();
|
|
|
},
|
|
|
save: function (callback) {
|
|
|
let selectedNode = projectObj.mainController.tree.selected;
|
|
@@ -521,7 +603,7 @@ let characterOprObj = {
|
|
|
me.updateCharacter(thisCha, null, args.editingText);
|
|
|
}
|
|
|
}
|
|
|
- //新增
|
|
|
+ /*//新增
|
|
|
else{
|
|
|
if(args.col === 0){//特征
|
|
|
me.insertCharacter(args.editingText, null);
|
|
@@ -529,9 +611,7 @@ let characterOprObj = {
|
|
|
else if(args.col === 1){//特征值
|
|
|
me.insertCharacter(null, args.editingText);
|
|
|
}
|
|
|
- }
|
|
|
- //保存
|
|
|
- me.save();
|
|
|
+ }*/
|
|
|
}
|
|
|
else{//恢复
|
|
|
if(args.col === 0){
|
|
@@ -556,12 +636,11 @@ let characterOprObj = {
|
|
|
if(me.currentCache.length > rowIdx){
|
|
|
me.updateCharacter(me.currentCache[rowIdx], items[i].character, items[i].eigenvalue);
|
|
|
}
|
|
|
- //新增
|
|
|
+ /* //新增
|
|
|
else{
|
|
|
me.insertCharacter(items[i].character, items[i].eigenvalue);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
- me.save();
|
|
|
},
|
|
|
onRangeChanged: function (sender, args) {
|
|
|
let me = characterOprObj;
|
|
@@ -597,6 +676,40 @@ let characterOprObj = {
|
|
|
args.sheet.setValue(args.row, args.col, 0);
|
|
|
}
|
|
|
},
|
|
|
+ onSelectionChanged: function (sender, args) {
|
|
|
+ let me = characterOprObj;
|
|
|
+ if(args.newSelections && args.newSelections.length > 0){
|
|
|
+ me.initSelection(args.newSelections[0].row);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initSelection: function (row) {
|
|
|
+ let me = characterOprObj;
|
|
|
+ let disObj = {itemAdd: false, itemInsert: true, itemDel: true, itemUp: true, itemDown: true};
|
|
|
+ if(row !== -1){
|
|
|
+ //在表内
|
|
|
+ if(row < me.currentCache.length){
|
|
|
+ disObj.itemDel = false;
|
|
|
+ disObj.itemInsert = false;
|
|
|
+ if(row !== 0){
|
|
|
+ disObj.itemUp = false;
|
|
|
+ }
|
|
|
+ if(row !== me.currentCache.length - 1){
|
|
|
+ disObj.itemDown = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ me.refreshTools(disObj);
|
|
|
+ },
|
|
|
+ //刷新工具条
|
|
|
+ refreshTools: function (disObj) {
|
|
|
+ for(let o in disObj){
|
|
|
+ let jqSel = $(`#${o}`);
|
|
|
+ jqSel.removeClass('disabled');
|
|
|
+ if(disObj[o]){
|
|
|
+ jqSel.addClass('disabled');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
onContextmenuOpr: function () {//右键菜单
|
|
|
let me = characterOprObj;
|
|
|
$.contextMenu({
|
|
@@ -605,18 +718,20 @@ let characterOprObj = {
|
|
|
//控制允许右键菜单在哪个位置出现
|
|
|
let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
|
|
|
let sheet = me.workBook.getSheet(0);
|
|
|
+ let addDis = pageCCOprObj.isBillsType() ? false : true, insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
if(target.hitTestType === 3){//在表格内 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
|
- let insertDis = pageCCOprObj.isBillsType() ? false : true, delDis = false, upDis = false, downDis = false;
|
|
|
if(typeof target.row !== 'undefined'){
|
|
|
//控制按钮是否可用
|
|
|
sheet.setActiveCell(target.row, target.col);
|
|
|
if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
+ insertDis = true;
|
|
|
delDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
}
|
|
|
else{//有数据
|
|
|
if(typeof target.col === 'undefined'){//定位在表格外
|
|
|
+ insertDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
delDis = true;
|
|
@@ -632,15 +747,20 @@ let characterOprObj = {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
+ insertDis = true;
|
|
|
delDis = true;
|
|
|
downDis = true;
|
|
|
upDis = true;
|
|
|
}
|
|
|
+ me.refreshTools({itemAdd: addDis, itemInsert: insertDis, itemDel: delDis, itemUp: upDis, itemDown: downDis});
|
|
|
return {
|
|
|
callback: function(){},
|
|
|
items: {
|
|
|
- "insert": {name: "添加", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
- me.addRow(sheet);
|
|
|
+ "insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
+ me.insertCharacter(sheet, sheet.getActiveRowIndex(), '');
|
|
|
+ }},
|
|
|
+ "add": {name: "添加", disabled: addDis, icon: "context-menu-icon context-menu-icon-add", callback: function (key, opt) {
|
|
|
+ me.insertCharacter(sheet, me.currentCache.length, '');
|
|
|
}},
|
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
|
me.deleteCharacter(target.row);
|
|
@@ -655,6 +775,7 @@ let characterOprObj = {
|
|
|
};
|
|
|
}
|
|
|
else{
|
|
|
+ me.refreshTools({jobAdd: addDis, jobInsert: insertDis, jobDel: delDis, jobUp: upDis, jobDown: downDis});
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -666,6 +787,13 @@ let pageCCOprObj = {
|
|
|
currentFindSet: null,
|
|
|
mainActiveCell: null,//mainSpread焦点单元格
|
|
|
nameCache: '',
|
|
|
+ //重新赋serialNo
|
|
|
+ resortNo: function (items) {
|
|
|
+ let count = 1;
|
|
|
+ for(let item of items){
|
|
|
+ item.serialNo = count++;
|
|
|
+ }
|
|
|
+ },
|
|
|
//获得造价书当前焦点行的类型:清单、定额
|
|
|
isBillsType: function () {
|
|
|
let rst = false;
|
|
@@ -699,8 +827,10 @@ let pageCCOprObj = {
|
|
|
//设置特征及内容currentCache
|
|
|
setCacheAndShow: function (node) {
|
|
|
let theCont = contentOprObj, theCha = characterOprObj;
|
|
|
- theCont.currentCache = node && typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
|
|
|
- theCha.currentCache = node && typeof node.data.itemCharacter !== 'undefined' ? node.data.itemCharacter : [];
|
|
|
+ node.data.jobContent = node && typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
|
|
|
+ node.data.itemCharacter = node && typeof node.data.itemCharacter !== 'undefined' ? node.data.itemCharacter : [];
|
|
|
+ theCont.currentCache = node.data.jobContent;
|
|
|
+ theCha.currentCache = node.data.itemCharacter;
|
|
|
this.currentFindSet = node && typeof node.data.ID !== 'undefined' && typeof node.data.projectID ? {ID: node.data.ID, projectID: node.data.projectID} : null;
|
|
|
this.showData(theCont.workBook.getSheet(0), theCont.setting, theCont.currentCache);
|
|
|
this.showData(theCha.workBook.getSheet(0), theCha.setting, theCha.currentCache);
|
|
@@ -744,6 +874,8 @@ let pageCCOprObj = {
|
|
|
sheet.autoFitRow(row);
|
|
|
}
|
|
|
}
|
|
|
+ contentOprObj.initSelection(0);
|
|
|
+ characterOprObj.initSelection(0);
|
|
|
sheet.resumeEvent();
|
|
|
sheet.resumePaint();
|
|
|
},
|
|
@@ -842,6 +974,9 @@ let pageCCOprObj = {
|
|
|
* @return {void}
|
|
|
*/
|
|
|
setCharacterBySetting: function(node, setting, callback = null, oprObj = null) {
|
|
|
+ if(!node){
|
|
|
+ return;
|
|
|
+ }
|
|
|
let self = this;
|
|
|
// 保存的条件数据
|
|
|
const findSet = { ID: node.data.ID, projectID: node.data.projectID };
|
|
@@ -941,7 +1076,10 @@ let pageCCOprObj = {
|
|
|
}
|
|
|
const itemCharacter = node.data.itemCharacter;
|
|
|
const itemJob = node.data.jobContent;
|
|
|
- if (itemCharacter === undefined || itemCharacter.length <= 0 || itemJob === undefined || itemJob.length <= 0) {
|
|
|
+ /* if (itemCharacter === undefined || itemCharacter.length <= 0 || itemJob === undefined || itemJob.length <= 0) {
|
|
|
+ throw '内部数据错误';
|
|
|
+ }*/
|
|
|
+ if (itemCharacter === undefined || itemJob === undefined) {
|
|
|
throw '内部数据错误';
|
|
|
}
|
|
|
// 默认名称
|
|
@@ -1011,9 +1149,20 @@ let pageCCOprObj = {
|
|
|
let updateData = {
|
|
|
itemCharacterText: '',
|
|
|
jobContentText: '',
|
|
|
- name: '',
|
|
|
+ name: node.data.name ? node.data.name : '',
|
|
|
};
|
|
|
- if (node.data.name === undefined || node.data.itemCharacter.length <= 0 || node.data.jobContent.length <= 0) {
|
|
|
+ /* let updateData = {
|
|
|
+ itemCharacterText: '',
|
|
|
+ jobContentText: '',
|
|
|
+ name: '',
|
|
|
+ };*/
|
|
|
+ if(!node.data.itemCharacter){
|
|
|
+ node.data.itemCharacter = [];
|
|
|
+ }
|
|
|
+ if(!node.data.jobContent){
|
|
|
+ node.data.jobContent = [];
|
|
|
+ }
|
|
|
+ if (node.data.name === undefined || (node.data.itemCharacter.length <= 0 && node.data.jobContent.length <= 0)) {
|
|
|
return updateData;
|
|
|
}
|
|
|
// 获取原名称
|