|
@@ -3,6 +3,13 @@
|
|
|
* 特征及内容
|
|
|
*/
|
|
|
//todo:清单库相关联的操作
|
|
|
+/*let testDatas = [
|
|
|
+ {jobConten: [{content: '安装', serialNo: 1, isChecked: true}, {content: '压力测试', serialNo: 2, isChecked: false}],
|
|
|
+ itemCharacter: [{character: '焊接方法', eigenvalue: [{value: '电焊', isSelected: true}], isChecked: true}, {character: '材质', eigenvalue: [], isChecked: false}]},
|
|
|
+ {jobConten: [{content: '安装', serialNo: 2, isChecked: true}, {content: '压力测试', serialNo: 2, isChecked: false}],
|
|
|
+ itemCharacter: [{character: '焊接方法', eigenvalue: [{value: '电焊', isSelected: true}], isChecked: true}, {character: '材质', eigenvalue: [], isChecked: false}]},
|
|
|
+];*/
|
|
|
+
|
|
|
let contentOprObj = {
|
|
|
workBook: null,
|
|
|
currentCache: [],//按照serialNo排序
|
|
@@ -17,6 +24,13 @@ let contentOprObj = {
|
|
|
me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
|
|
|
me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
me.onContextmenuOpr();//右键菜单
|
|
|
+ me.bindEvents(me.workBook);
|
|
|
+ },
|
|
|
+ bindEvents: function (workBook) {
|
|
|
+ let sheet = workBook.getActiveSheet(), me = contentOprObj;
|
|
|
+ const EVENTS = GC.Spread.Sheets.Events;
|
|
|
+ workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
|
|
|
+ sheet.bind(EVENTS.EditEnded, me.onEditEnded);
|
|
|
},
|
|
|
//显示在jobSpread的数据
|
|
|
showContentData: function (sheet, setting, datas) {
|
|
@@ -52,6 +66,13 @@ let contentOprObj = {
|
|
|
}
|
|
|
return null;
|
|
|
},
|
|
|
+ //新增行
|
|
|
+ addRow: function (sheet) {
|
|
|
+ let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
+ checkBox.isThreeState = false;
|
|
|
+ sheet.addRows(sheet.getRowCount(), 1);
|
|
|
+ sheet.getCell(sheet.getRowCount() - 1, 1).cellType(cellType);
|
|
|
+ },
|
|
|
upMove: function (rowIdx) {
|
|
|
let me = contentOprObj;
|
|
|
let thisObj = me.currentCache[rowIdx],
|
|
@@ -65,8 +86,8 @@ let contentOprObj = {
|
|
|
me.refreshColData = true;
|
|
|
contentTxt = me.getColData(me.currentCache);
|
|
|
}
|
|
|
- let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
+ let txtObj = {field: 'jobContentText', text: contentTxt ? contentTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
},
|
|
|
downMove: function (rowIdx) {
|
|
|
let me = contentOprObj;
|
|
@@ -81,8 +102,8 @@ let contentOprObj = {
|
|
|
me.refreshColData = true;
|
|
|
contentTxt = me.getColData(me.currentCache);
|
|
|
}
|
|
|
- let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
+ let txtObj = {field: 'jobContentText', text: contentTxt ? contentTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
},
|
|
|
deleteContent: function (rowIdx) {
|
|
|
let me = contentOprObj;
|
|
@@ -93,23 +114,34 @@ let contentOprObj = {
|
|
|
me.refreshColData = true;
|
|
|
contentTxt = me.getColData(me.currentCache);
|
|
|
}
|
|
|
- let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
+ let txtObj = {field: 'jobContentText', text: contentTxt ? contentTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'jobContent', updateArr: me.currentCache}, txtObj, 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.toString().trim().length > 0){
|
|
|
- let newObj = {content: args.editingText, isChecked: false};
|
|
|
- newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
|
|
|
- me.currentCache.push(newObj);
|
|
|
- /*if(newObj.isChecked === true){//可能编辑内容前就打勾
|
|
|
- me.refreshColData = true;
|
|
|
- contentTxt = me.getColData(me.currentCache);
|
|
|
- }*/
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, null, contentOprObj);
|
|
|
+ if(args.editingText && args.editingText.toString().trim().length > 0){
|
|
|
+ //更新
|
|
|
+ if(args.row < me.currentCache.length ){
|
|
|
+ me.currentCache[args.row].content = args.editingText;
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ else{
|
|
|
+ let newObj = {content: args.editingText, isChecked: false};
|
|
|
+ newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
|
|
|
+ me.currentCache.push(newObj);
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ me.refreshColData = true;
|
|
|
+ contentTxt = me.getColData(me.currentCache);
|
|
|
+ let txtObj = {field: 'jobContentText', text: contentTxt ? contentTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ //恢复
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentCache.length > args.row ? me.currentCache[args.row].content + '' : '');
|
|
|
}
|
|
|
},
|
|
|
//复选框控制输出
|
|
@@ -123,12 +155,11 @@ let contentOprObj = {
|
|
|
me.currentCache[args.row].isChecked = isChecked;
|
|
|
me.refreshColData = true;
|
|
|
contentTxt = me.getColData(me.currentCache);
|
|
|
- let txtObj = contentTxt ? {field: 'jobContentText', text: contentTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
+ let txtObj = {field: 'jobContentText', text: contentTxt ? contentTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'jobContent', updateArr: me.currentCache}, txtObj, contentOprObj);
|
|
|
}
|
|
|
//else的情况就是新增
|
|
|
else{
|
|
|
-
|
|
|
//还没数据清空复选框
|
|
|
args.sheet.setValue(args.row, args.col, 0);
|
|
|
}
|
|
@@ -158,29 +189,36 @@ let contentOprObj = {
|
|
|
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'){//在表格内
|
|
|
- sheet.setActiveCell(target.row, target.col);
|
|
|
- //控制按钮是否可用
|
|
|
+ if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
|
let insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
- if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
- delDis = true;
|
|
|
- downDis = true;
|
|
|
- upDis = true;
|
|
|
- }
|
|
|
- else{//有数据
|
|
|
- if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
+ if(typeof target.row !== 'undefined'){
|
|
|
+ //控制按钮是否可用
|
|
|
+ sheet.setActiveCell(target.row, target.col);
|
|
|
+ if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
+ delDis = true;
|
|
|
downDis = true;
|
|
|
- }
|
|
|
- if(target.row === 0){//定位在第一行,不可上移
|
|
|
upDis = true;
|
|
|
}
|
|
|
+ else{//有数据
|
|
|
+ if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
+ downDis = true;
|
|
|
+ }
|
|
|
+ if(target.row === 0){//定位在第一行,不可上移
|
|
|
+ upDis = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ delDis = true;
|
|
|
+ downDis = true;
|
|
|
+ upDis = true;
|
|
|
}
|
|
|
return {
|
|
|
callback: function(){},
|
|
|
items: {
|
|
|
"insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
//插入空行
|
|
|
- me.workBook.getSheet(0).addRows(me.workBook.getSheet(0).getRowCount(), 1);
|
|
|
+ me.addRow(sheet);
|
|
|
}},
|
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
|
me.deleteContent(target.row);
|
|
@@ -219,6 +257,14 @@ let characterOprObj = {
|
|
|
me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
|
|
|
me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
|
|
|
me.onContextmenuOpr();
|
|
|
+ me.bindEvents(me.workBook);
|
|
|
+ },
|
|
|
+ bindEvents: function (workBook) {
|
|
|
+ let sheet = workBook.getActiveSheet(), me = characterOprObj;
|
|
|
+ const EVENTS = GC.Spread.Sheets.Events;
|
|
|
+ workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
|
|
|
+ sheet.bind(EVENTS.EditEnded, me.onEditEnded);
|
|
|
+ sheet.bind(EVENTS.EditStarting, me.onEditStart);
|
|
|
},
|
|
|
//显示在itemSpread的数据
|
|
|
showCharacterData: function (sheet, setting, datas) {
|
|
@@ -237,7 +283,7 @@ let characterOprObj = {
|
|
|
},
|
|
|
//获得项目特征特征值comboBox
|
|
|
getComboBox: function (characterItem) {
|
|
|
- let rst;
|
|
|
+ let rst = {};
|
|
|
let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
let comboItems = [], eigenvalues = characterItem.eigenvalue;
|
|
|
for(let i = 0, len = eigenvalues.length; i < len; i++){
|
|
@@ -272,7 +318,7 @@ let characterOprObj = {
|
|
|
else{
|
|
|
rstStr += " ";
|
|
|
}
|
|
|
- rstStr += count + " " + itemsArr[i].content + ": " + eigenvalueStr + "\n";
|
|
|
+ rstStr += count + " " + itemsArr[i].character + ": " + eigenvalueStr + "\n";
|
|
|
}
|
|
|
}
|
|
|
if(rstStr.trim().length > 0){
|
|
@@ -282,6 +328,16 @@ let characterOprObj = {
|
|
|
}
|
|
|
return null;
|
|
|
},
|
|
|
+ addRow: function (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);
|
|
|
+ },
|
|
|
upMove: function (rowIdx) {
|
|
|
let me = characterOprObj;
|
|
|
let thisObj = me.currentCache[rowIdx],
|
|
@@ -337,65 +393,69 @@ let characterOprObj = {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onEnterCell: function (sender, args) {
|
|
|
+ /* onEnterCell: function (sender, args) {
|
|
|
let me = characterOprObj;
|
|
|
if(me.addRow && me.addRow !== args.row && typeof me.currentCache[me.addRow] !== 'undefined'){//新增空行后,当编辑完空行后保存
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, null, characterOprObj);
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, null, characterOprObj);
|
|
|
}
|
|
|
- },
|
|
|
+ },*/
|
|
|
onEditEnded: function (sender, args) {//新增保存逻辑:勾选了复选框或者离开当前编辑行
|
|
|
let me = characterOprObj, characterTxt;
|
|
|
- //只有空行时才可以输入,即是新增时用,新增的空行只有输入了值,才保存
|
|
|
- if(args.col === 0){
|
|
|
- let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
- if(args.editingText.toString().trim().length > 0){
|
|
|
- let newObj = {character: args.editingText, isChecked: false};
|
|
|
- newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
|
|
|
- newObj.eigenvalue = [];
|
|
|
- me.currentCache.push(newObj);
|
|
|
- }
|
|
|
- }
|
|
|
- else if(args.col === 1){//改变特征值
|
|
|
- if(me.addRow && me.addRow === args.row){//新增时用户向空特征值输入数据
|
|
|
- if(args.editingText.toString().trim().length > 0){
|
|
|
- //只有项目特征列有数据,特征值才保存
|
|
|
- if(typeof me.currentCache[args.row] !== 'undefined'){
|
|
|
- let newValue = {value: args.editingText, isSelected: true};
|
|
|
- me.currentCache[args.row].eigenvalue.push(newValue);
|
|
|
- }
|
|
|
+ let preObj = me.currentCache.length > 0 ? me.currentCache[me.currentCache.length - 1] : null;
|
|
|
+ if(args.editingText && args.editingText.toString().trim().length > 0){
|
|
|
+ //更新
|
|
|
+ if(args.row < me.currentCache.length){
|
|
|
+ let thisCha = me.currentCache[args.row];
|
|
|
+ if(args.col === 0){//特征
|
|
|
+ thisCha.character = args.editingText;
|
|
|
}
|
|
|
- }
|
|
|
- else{//平时选择
|
|
|
- let eigenvalues = me.currentCache[args.row].eigenvalue;
|
|
|
- let isValid = false;
|
|
|
- //更新Selected
|
|
|
- if(me.currentSelectedValue && me.currentSelectedValue !== args.editingText){
|
|
|
- for(let i = 0, len = eigenvalues.length; i < len; i++){
|
|
|
- if(eigenvalues[i].value === me.currentSelectedValue){
|
|
|
- eigenvalues[i].isSelected = false;
|
|
|
- }
|
|
|
- if(eigenvalues[i].value === args.editingText){
|
|
|
- eigenvalues[i].isSelected = true;
|
|
|
+ else if(args.col === 1){//特征值
|
|
|
+ let isExist = false;
|
|
|
+ for(let i = 0, len = thisCha.eigenvalue.length; i < len; i++){
|
|
|
+ if(thisCha.eigenvalue[i].value === args.editingText){
|
|
|
+ isExist = true;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- isValid = true;
|
|
|
- }
|
|
|
- else if(!me.currentSelectedValue){
|
|
|
- for(let i = 0, len = eigenvalues.length; i < len; i++){
|
|
|
- if(eigenvalues[i].value === args.editingText){
|
|
|
- eigenvalues[i].isSelected = true;
|
|
|
- break;
|
|
|
+ if(!isExist){//新增特征值
|
|
|
+ let newValue = {value: args.editingText, isSelected: true};
|
|
|
+ thisCha.eigenvalue.push(newValue);
|
|
|
+ }
|
|
|
+ else{//选择特征值
|
|
|
+ console.log(me.currentSelectedValue);
|
|
|
+ for(let i = 0, len = thisCha.eigenvalue.length; i < len; i++){
|
|
|
+ if(thisCha.eigenvalue[i].value === me.currentSelectedValue){
|
|
|
+ thisCha.eigenvalue[i].isSelected = false;
|
|
|
+ }
|
|
|
+ if(thisCha.eigenvalue[i].value === args.editingText){
|
|
|
+ thisCha.eigenvalue[i].isSelected = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- isValid = true;
|
|
|
}
|
|
|
- if(isValid){
|
|
|
- me.refreshColData = true;
|
|
|
- characterTxt = me.getColData(me.currentCache);
|
|
|
- let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ else{
|
|
|
+ if(args.col === 0){//特征
|
|
|
+ let newObj = {character: args.editingText, eigenvalue: [], isChecked: false};
|
|
|
+ newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
|
|
|
+ me.currentCache.push(newObj);
|
|
|
+ }
|
|
|
+ else if(args.col === 1){//特征值
|
|
|
+ let newValue = {value: args.editingText, isSelected: true};
|
|
|
+ let newObj = {character: '', eigenvalue: [newValue], isChecked: false};
|
|
|
+ newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
|
|
|
+ me.currentCache.push(newObj);
|
|
|
}
|
|
|
}
|
|
|
+ //保存
|
|
|
+ me.refreshColData = true;
|
|
|
+ characterTxt = me.getColData(me.currentCache);
|
|
|
+ let txtObj = {field: 'itemCharacterText', text: characterTxt ? characterTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
|
|
|
+ }
|
|
|
+ else{//恢复
|
|
|
+ args.sheet.setValue(args.row, args.col, me.currentCache.length > args.row ? me.currentCache[args.row].content + '' : '');
|
|
|
}
|
|
|
},
|
|
|
//复选框控制输出
|
|
@@ -406,11 +466,11 @@ let characterOprObj = {
|
|
|
}
|
|
|
let isChecked = args.sheet.getValue(args.row, args.col);
|
|
|
if(me.currentCache.length > args.row){
|
|
|
- me.currentCache[args.row].isChecked = isChecked;
|
|
|
me.refreshColData = true;
|
|
|
+ me.currentCache[args.row].isChecked = isChecked;
|
|
|
characterTxt = me.getColData(me.currentCache);
|
|
|
- let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
|
|
|
- pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
|
|
|
+ let txtObj = {field: 'itemCharacterText', text: characterTxt ? characterTxt : ''};
|
|
|
+ pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
|
|
|
}
|
|
|
//else的情况就是新增
|
|
|
else{
|
|
@@ -430,29 +490,35 @@ let characterOprObj = {
|
|
|
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'){//在表格内
|
|
|
- sheet.setActiveCell(target.row, target.col);
|
|
|
- //控制按钮是否可用
|
|
|
+ if(target.hitTestType === 3){//在表格内 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
|
|
|
let insertDis = false, delDis = false, upDis = false, downDis = false;
|
|
|
- if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
- delDis = true;
|
|
|
- downDis = true;
|
|
|
- upDis = true;
|
|
|
- }
|
|
|
- else{//有数据
|
|
|
- if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
+ if(typeof target.row !== 'undefined'){
|
|
|
+ //控制按钮是否可用
|
|
|
+ sheet.setActiveCell(target.row, target.col);
|
|
|
+ if(!me.currentCache ||target.row >= me.currentCache.length){//右键定位在有数据的行,删除键才显示可用
|
|
|
+ delDis = true;
|
|
|
downDis = true;
|
|
|
- }
|
|
|
- if(target.row === 0){//定位在第一行,不可上移
|
|
|
upDis = true;
|
|
|
}
|
|
|
+ else{//有数据
|
|
|
+ if(target.row === me.currentCache.length -1){//定位在最后一行,不可下移
|
|
|
+ downDis = true;
|
|
|
+ }
|
|
|
+ if(target.row === 0){//定位在第一行,不可上移
|
|
|
+ upDis = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ delDis = true;
|
|
|
+ downDis = true;
|
|
|
+ upDis = true;
|
|
|
}
|
|
|
return {
|
|
|
callback: function(){},
|
|
|
items: {
|
|
|
"insert": {name: "插入", disabled: insertDis, icon: "fa-sign-in", callback: function (key, opt) {
|
|
|
- me.workBook.getSheet(0).addRows(me.workBook.getSheet(0).getRowCount(), 1);
|
|
|
- me.addRow = me.workBook.getSheet(0).getRowCount() - 1;
|
|
|
+ me.addRow(sheet);
|
|
|
}},
|
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
|
me.deleteCharacter(target.row);
|
|
@@ -475,12 +541,14 @@ let characterOprObj = {
|
|
|
};
|
|
|
|
|
|
let pageCCOprObj = {
|
|
|
+ currentFindSet: null,
|
|
|
mainActiveCell: null,//mainSpread焦点单元格
|
|
|
//设置特征及内容currentCache
|
|
|
setCacheAndShow: function (node) {
|
|
|
let theCont = contentOprObj, theCha = characterOprObj;
|
|
|
theCont.currentCache = typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
|
|
|
theCha.currentCache = typeof node.data.itemCharacter !== 'undefined' ? node.data.itemCharacter : [];
|
|
|
+ this.currentFindSet = 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);
|
|
|
},
|
|
@@ -490,6 +558,7 @@ let pageCCOprObj = {
|
|
|
sheet.suspendPaint();
|
|
|
sheet.suspendEvent();
|
|
|
sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
|
|
|
+ sheet.setRowCount(data.length);
|
|
|
for (let col = 0; col < setting.header.length; col++) {
|
|
|
var hAlign = "left", vAlign = "center";
|
|
|
if (setting.header[col].hAlign) {
|
|
@@ -512,7 +581,7 @@ let pageCCOprObj = {
|
|
|
}
|
|
|
else if(setting.header[col].cellType === 'comboBox'){
|
|
|
let comboObj = characterOprObj.getComboBox(data[row]);
|
|
|
- comboObj.combo.editable(false);//不可编辑
|
|
|
+ comboObj.combo.editable(true);//不可编辑
|
|
|
sheet.getCell(row, 1).cellType(comboObj.combo).value(typeof comboObj.selectedValue !== 'undefined' ? comboObj.selectedValue : '');
|
|
|
}
|
|
|
else{
|
|
@@ -529,10 +598,10 @@ let pageCCOprObj = {
|
|
|
sheetCommonObj.cleanSheet(theCha.workBook.getSheet(0), theCha.setting, -1);
|
|
|
},
|
|
|
//更新特征及内容数据
|
|
|
- updateCharacterContent: function (billId, updateObj, txtObj, oprObj) {
|
|
|
+ updateCharacterContent: function (findSet, updateObj, txtObj, oprObj) {
|
|
|
let me = pageCCOprObj, updateCol;
|
|
|
if(txtObj){
|
|
|
- updateCol = txtObj.field === 'itemCharacter' ? 4 : 5;//更新清单行特征列或内容列
|
|
|
+ updateCol = txtObj.field === 'itemCharacterText' ? 4 : 5;//更新清单行特征列或内容列
|
|
|
}
|
|
|
else{
|
|
|
updateCol = null;
|
|
@@ -541,10 +610,13 @@ let pageCCOprObj = {
|
|
|
type: 'post',
|
|
|
url: '/bills/updateCharacterContent',
|
|
|
dataType: 'json',
|
|
|
- data: {billId: billId, updateObj: JSON.stringify(updateObj), txtObj: JSON.stringify(txtObj)},
|
|
|
+ data: {findSet: JSON.stringify(findSet), updateObj: JSON.stringify(updateObj), txtObj: JSON.stringify(txtObj)},
|
|
|
success: function (result) {
|
|
|
if(!result.error){
|
|
|
- oprObj.addRow = null;
|
|
|
+ //更新节点数据
|
|
|
+ let selectedNode = projectObj.mainController.tree.selected;
|
|
|
+ selectedNode.data[updateObj.field] = updateObj.updateArr;
|
|
|
+ selectedNode.data[txtObj.field] = txtObj.text;
|
|
|
me.showData(oprObj.workBook.getSheet(0), oprObj.setting, oprObj.currentCache);//刷新特征及内容Spread
|
|
|
if(oprObj.refreshColData){
|
|
|
if(updateCol){
|