|  | @@ -3,13 +3,6 @@
 | 
	
		
			
				|  |  |   * 特征及内容
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  //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排序
 | 
	
	
		
			
				|  | @@ -23,6 +16,7 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          let me = contentOprObj;
 | 
	
		
			
				|  |  |          me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
 | 
	
		
			
				|  |  |          me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
 | 
	
		
			
				|  |  | +        me.workBook.options.allowCopyPasteExcelStyle = false;
 | 
	
		
			
				|  |  |          me.onContextmenuOpr();//右键菜单
 | 
	
		
			
				|  |  |          me.bindEvents(me.workBook);
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -31,6 +25,8 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          const EVENTS = GC.Spread.Sheets.Events;
 | 
	
		
			
				|  |  |          workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
 | 
	
		
			
				|  |  |          sheet.bind(EVENTS.EditEnded, me.onEditEnded);
 | 
	
		
			
				|  |  | +        sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
 | 
	
		
			
				|  |  | +        sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //显示在jobSpread的数据
 | 
	
		
			
				|  |  |      showContentData: function (sheet, setting, datas) {
 | 
	
	
		
			
				|  | @@ -71,7 +67,7 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
 | 
	
		
			
				|  |  |          checkBox.isThreeState = false;
 | 
	
		
			
				|  |  |          sheet.addRows(sheet.getRowCount(), 1);
 | 
	
		
			
				|  |  | -        sheet.getCell(sheet.getRowCount() - 1, 1).cellType(cellType);
 | 
	
		
			
				|  |  | +        sheet.getCell(sheet.getRowCount() - 1, 1).cellType(checkBox);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      upMove: function (rowIdx) {
 | 
	
		
			
				|  |  |          let me = contentOprObj;
 | 
	
	
		
			
				|  | @@ -82,12 +78,7 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          thisObj.serialNo = preObj.serialNo;
 | 
	
		
			
				|  |  |          preObj.serialNo = temp;
 | 
	
		
			
				|  |  |          me.sortCache(me.currentCache);
 | 
	
		
			
				|  |  | -        if(thisObj.isChecked === true && preObj.isChecked === true){
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      downMove: function (rowIdx) {
 | 
	
		
			
				|  |  |          let me = contentOprObj;
 | 
	
	
		
			
				|  | @@ -98,26 +89,31 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          thisObj.serialNo = nextObj.serialNo;
 | 
	
		
			
				|  |  |          nextObj.serialNo = temp;
 | 
	
		
			
				|  |  |          me.sortCache(me.currentCache);
 | 
	
		
			
				|  |  | -        if(thisObj.isChecked === true && nextObj.isChecked === true){
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      deleteContent: function (rowIdx) {
 | 
	
		
			
				|  |  |          let me = contentOprObj;
 | 
	
		
			
				|  |  | -        let deleteObj = me.currentCache[rowIdx];
 | 
	
		
			
				|  |  | -        let contentTxt;
 | 
	
		
			
				|  |  |          me.currentCache.splice(rowIdx, 1);
 | 
	
		
			
				|  |  | -        if(deleteObj.isChecked === true){//需要刷新显示
 | 
	
		
			
				|  |  | -            me.refreshColData = true;
 | 
	
		
			
				|  |  | -            contentTxt = me.getColData(me.currentCache);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //更新
 | 
	
		
			
				|  |  | +    updateContent: function (job, newContent) {
 | 
	
		
			
				|  |  | +        job.content = newContent;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //新增
 | 
	
		
			
				|  |  | +    insertContent: function (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);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    save: function () {
 | 
	
		
			
				|  |  | +        let me = contentOprObj;
 | 
	
		
			
				|  |  | +        let contentTxt = me.getColData(me.currentCache);
 | 
	
		
			
				|  |  |          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;
 | 
	
	
		
			
				|  | @@ -125,19 +121,14 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          if(args.editingText && args.editingText.toString().trim().length > 0){
 | 
	
		
			
				|  |  |              //更新
 | 
	
		
			
				|  |  |              if(args.row < me.currentCache.length ){
 | 
	
		
			
				|  |  | -                me.currentCache[args.row].content = args.editingText;
 | 
	
		
			
				|  |  | +                me.updateContent(me.currentCache[args.row], args.editingText);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //新增
 | 
	
		
			
				|  |  |              else{
 | 
	
		
			
				|  |  | -                let newObj = {content: args.editingText, isChecked: false};
 | 
	
		
			
				|  |  | -                newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
 | 
	
		
			
				|  |  | -                me.currentCache.push(newObj);
 | 
	
		
			
				|  |  | +                me.insertContent(args.editingText);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //保存
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +            me.save();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else{
 | 
	
		
			
				|  |  |              //恢复
 | 
	
	
		
			
				|  | @@ -153,10 +144,7 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |          let isChecked = args.sheet.getValue(args.row, args.col);
 | 
	
		
			
				|  |  |          if(me.currentCache.length > args.row){
 | 
	
		
			
				|  |  |              me.currentCache[args.row].isChecked = isChecked;
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +            me.save();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //else的情况就是新增
 | 
	
		
			
				|  |  |          else{
 | 
	
	
		
			
				|  | @@ -164,6 +152,28 @@ let contentOprObj = {
 | 
	
		
			
				|  |  |              args.sheet.setValue(args.row, args.col, 0);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    //复制粘贴
 | 
	
		
			
				|  |  | +    onClipboardPasting: function (sender, args) {
 | 
	
		
			
				|  |  | +        if(args.cellRange.colCount > 1 || args.cellRange.col !== 0){
 | 
	
		
			
				|  |  | +            args.cancel = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onClipboardPasted: function (sender, args) {
 | 
	
		
			
				|  |  | +        let me = contentOprObj;
 | 
	
		
			
				|  |  | +        let items = sheetCommonObj.analyzePasteData(me.setting, args);
 | 
	
		
			
				|  |  | +        for(let i = 0, len = items.length; i < len; i++){
 | 
	
		
			
				|  |  | +            let rowIdx = args.cellRange.row + i;
 | 
	
		
			
				|  |  | +            //更新
 | 
	
		
			
				|  |  | +            if(rowIdx < me.currentCache.length){
 | 
	
		
			
				|  |  | +                me.updateContent(me.currentCache[rowIdx], items[i].content);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //新增
 | 
	
		
			
				|  |  | +            else{
 | 
	
		
			
				|  |  | +                me.insertContent(items[i].content);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      sortCache: function (cacheArr) {
 | 
	
		
			
				|  |  |          cacheArr.sort(function (a, b) {
 | 
	
		
			
				|  |  |              let rst = 0;
 | 
	
	
		
			
				|  | @@ -256,6 +266,7 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
		
			
				|  |  |          me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
 | 
	
		
			
				|  |  |          me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
 | 
	
		
			
				|  |  | +        me.workBook.options.allowCopyPasteExcelStyle = false;
 | 
	
		
			
				|  |  |          me.onContextmenuOpr();
 | 
	
		
			
				|  |  |          me.bindEvents(me.workBook);
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -265,6 +276,8 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |          workBook.bind(EVENTS.ButtonClicked, me.onButtonClicked);
 | 
	
		
			
				|  |  |          sheet.bind(EVENTS.EditEnded, me.onEditEnded);
 | 
	
		
			
				|  |  |          sheet.bind(EVENTS.EditStarting, me.onEditStart);
 | 
	
		
			
				|  |  | +        sheet.bind(EVENTS.ClipboardPasting, me.onClipboardPasting);
 | 
	
		
			
				|  |  | +        sheet.bind(EVENTS.ClipboardPasted, me.onClipboardPasted);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //显示在itemSpread的数据
 | 
	
		
			
				|  |  |      showCharacterData: function (sheet, setting, datas) {
 | 
	
	
		
			
				|  | @@ -296,6 +309,17 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |          rst.combo = combo;
 | 
	
		
			
				|  |  |          return rst;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    //获得当前行选中的特征值
 | 
	
		
			
				|  |  | +    getCurrentSelected: function (item) {
 | 
	
		
			
				|  |  | +        let rst = null;
 | 
	
		
			
				|  |  | +        for(let i = 0, len = item.eigenvalue.length; i < len; i++){
 | 
	
		
			
				|  |  | +            if(item.eigenvalue[i].isSelected){
 | 
	
		
			
				|  |  | +                rst = item.eigenvalue[i].value;
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return rst;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      //显示到清单项目特征列的数据
 | 
	
		
			
				|  |  |      getColData: function (itemsArr) {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
	
		
			
				|  | @@ -342,64 +366,112 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
		
			
				|  |  |          let thisObj = me.currentCache[rowIdx],
 | 
	
		
			
				|  |  |              preObj = me.currentCache[rowIdx - 1],
 | 
	
		
			
				|  |  | -            temp, characterTxt;
 | 
	
		
			
				|  |  | +            temp;
 | 
	
		
			
				|  |  |          temp = thisObj.serialNo;
 | 
	
		
			
				|  |  |          thisObj.serialNo = preObj.serialNo;
 | 
	
		
			
				|  |  |          preObj.serialNo = temp;
 | 
	
		
			
				|  |  |          contentOprObj.sortCache(me.currentCache);
 | 
	
		
			
				|  |  | -        if(thisObj.isChecked === true && preObj.isChecked === true){
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      downMove: function (rowIdx) {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
		
			
				|  |  |          let thisObj = me.currentCache[rowIdx],
 | 
	
		
			
				|  |  |              nextObj = me.currentCache[rowIdx + 1],
 | 
	
		
			
				|  |  | -            temp, characterTxt;
 | 
	
		
			
				|  |  | +            temp;
 | 
	
		
			
				|  |  |          temp = thisObj.serialNo;
 | 
	
		
			
				|  |  |          thisObj.serialNo = nextObj.serialNo;
 | 
	
		
			
				|  |  |          nextObj.serialNo = temp;
 | 
	
		
			
				|  |  |          contentOprObj.sortCache(me.currentCache);
 | 
	
		
			
				|  |  | -        if(thisObj.isChecked === true && nextObj.isChecked === true){
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      deleteCharacter: function (rowIdx) {
 | 
	
		
			
				|  |  | -        let me = characterOprObj, characterTxt;
 | 
	
		
			
				|  |  | -        let deleteObj = me.currentCache[rowIdx];
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  |          me.currentCache.splice(rowIdx, 1);
 | 
	
		
			
				|  |  | -        if(deleteObj.isChecked === true){//需要刷新显示
 | 
	
		
			
				|  |  | -            me.refreshColData = true;
 | 
	
		
			
				|  |  | -            characterTxt = me.getColData(me.currentCache);
 | 
	
		
			
				|  |  | +        me.save();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //取消选择的特征值
 | 
	
		
			
				|  |  | +    unsetSelected: function (item) {
 | 
	
		
			
				|  |  | +        for(let i = 0, len = item.eigenvalue.length; i < len; i++){
 | 
	
		
			
				|  |  | +            if(item.eigenvalue[i].isSelected){
 | 
	
		
			
				|  |  | +                item.eigenvalue[i].isSelected = false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        let txtObj = characterTxt ? {field: 'itemCharacter', text: characterTxt} : null;
 | 
	
		
			
				|  |  | -        pageCCOprObj.updateCharacterContent(billId, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    onEditStart: function (sender, args) {
 | 
	
		
			
				|  |  | +    //设置选中的特征值
 | 
	
		
			
				|  |  | +    setSelected: function (item, value) {
 | 
	
		
			
				|  |  | +        for(let i = 0, len = item.eigenvalue.length; i < len; i++){
 | 
	
		
			
				|  |  | +            if(item.eigenvalue[i].value === value){
 | 
	
		
			
				|  |  | +                item.eigenvalue[i].isSelected = true;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //改变选择特征值
 | 
	
		
			
				|  |  | +    changeSelected: function (item, value) {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
		
			
				|  |  | -        if(args.col === 1){//改变选择的特征值
 | 
	
		
			
				|  |  | -            let selectedValue = args.sheet.getValue(args.row, 1);
 | 
	
		
			
				|  |  | -            if(selectedValue.toString().trim().length > 0){//当前有选择
 | 
	
		
			
				|  |  | -                me.currentSelectedValue = selectedValue;
 | 
	
		
			
				|  |  | +        me.unsetSelected(item);
 | 
	
		
			
				|  |  | +        me.setSelected(item, value);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    insertValue: function (item, value) {
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  | +        me.unsetSelected(item);
 | 
	
		
			
				|  |  | +        let newValue = {value: value, isSelected: true};
 | 
	
		
			
				|  |  | +        item.eigenvalue.push(newValue);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    updateCharacter: function (item, character, value) {
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  | +        if(character){
 | 
	
		
			
				|  |  | +            item.character = character;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if(value){
 | 
	
		
			
				|  |  | +            let isExist = false;
 | 
	
		
			
				|  |  | +            for(let i = 0, len = item.eigenvalue.length; i < len; i++){
 | 
	
		
			
				|  |  | +                if(item.eigenvalue[i].value === value){
 | 
	
		
			
				|  |  | +                    isExist = true;
 | 
	
		
			
				|  |  | +                    break;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //不存在,新增进eigenvalue
 | 
	
		
			
				|  |  | +            if(!isExist){
 | 
	
		
			
				|  |  | +                //更新selected
 | 
	
		
			
				|  |  | +                me.insertValue(item, value);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            //存在,选择特征值
 | 
	
		
			
				|  |  |              else{
 | 
	
		
			
				|  |  | -                me.currentSelectedValue = null;
 | 
	
		
			
				|  |  | +                me.changeSelected(item, value);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -  /*  onEnterCell: function (sender, args) {
 | 
	
		
			
				|  |  | +    insertCharacter: function (character, value) {
 | 
	
		
			
				|  |  |          let me = characterOprObj;
 | 
	
		
			
				|  |  | -        if(me.addRow && me.addRow !== args.row && typeof me.currentCache[me.addRow] !== 'undefined'){//新增空行后,当编辑完空行后保存
 | 
	
		
			
				|  |  | -            pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, null, 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);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -    },*/
 | 
	
		
			
				|  |  | -    onEditEnded: function (sender, args) {//新增保存逻辑:勾选了复选框或者离开当前编辑行
 | 
	
		
			
				|  |  | +        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: false, serialNo: preObj? preObj.serialNo + 1 : 1};
 | 
	
		
			
				|  |  | +            me.currentCache.push(newCharacter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    save: function () {
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  | +        let characterTxt = me.getColData(me.currentCache);
 | 
	
		
			
				|  |  | +        let txtObj =  {field: 'itemCharacterText', text: characterTxt ? characterTxt : ''};
 | 
	
		
			
				|  |  | +        pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onEditStart: function (sender, args) {
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  | +        if(args.col === 1){//改变选择的特征值
 | 
	
		
			
				|  |  | +            me.currentSelectedValue = me.currentCache.length > args.row ?  me.getCurrentSelected(me.currentCache[args.row]) : null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onEditEnded: function (sender, args) {
 | 
	
		
			
				|  |  |          let me = characterOprObj, characterTxt;
 | 
	
		
			
				|  |  |          let preObj = me.currentCache.length > 0 ?  me.currentCache[me.currentCache.length - 1] : null;
 | 
	
		
			
				|  |  |          if(args.editingText && args.editingText.toString().trim().length > 0){
 | 
	
	
		
			
				|  | @@ -407,57 +479,54 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |              if(args.row < me.currentCache.length){
 | 
	
		
			
				|  |  |                  let thisCha = me.currentCache[args.row];
 | 
	
		
			
				|  |  |                  if(args.col === 0){//特征
 | 
	
		
			
				|  |  | -                   thisCha.character = args.editingText;
 | 
	
		
			
				|  |  | +                   me.updateCharacter(thisCha, args.editingText, null);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  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;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    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;
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +                    me.updateCharacter(thisCha, null, args.editingText);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //新增
 | 
	
		
			
				|  |  |              else{
 | 
	
		
			
				|  |  |                  if(args.col === 0){//特征
 | 
	
		
			
				|  |  | -                    let newObj = {character: args.editingText, eigenvalue: [], isChecked: false};
 | 
	
		
			
				|  |  | -                    newObj.serialNo = preObj ? preObj.serialNo + 1 : 1;//得到新增对象的排序号
 | 
	
		
			
				|  |  | -                    me.currentCache.push(newObj);
 | 
	
		
			
				|  |  | +                    me.insertCharacter(args.editingText, null);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  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.insertCharacter(null, args.editingText);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //保存
 | 
	
		
			
				|  |  | -            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);
 | 
	
		
			
				|  |  | +            me.save();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else{//恢复
 | 
	
		
			
				|  |  | -            args.sheet.setValue(args.row, args.col, me.currentCache.length > args.row ? me.currentCache[args.row].content + '' : '');
 | 
	
		
			
				|  |  | +            if(args.col === 0){
 | 
	
		
			
				|  |  | +                args.sheet.setValue(args.row, args.col, me.currentCache.length > args.row ? me.currentCache[args.row].character + '' : '');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if(args.col === 1){
 | 
	
		
			
				|  |  | +                args.sheet.setValue(args.row, args.col, me.currentSelectedValue ? me.currentSelectedValue + '' : '');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    onClipboardPasting: function (sender, args) {
 | 
	
		
			
				|  |  | +        if(args.cellRange.col + args.colCount - 1 > 1){
 | 
	
		
			
				|  |  | +            args.cancel = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onClipboardPasted: function (sender, args) {
 | 
	
		
			
				|  |  | +        let me = characterOprObj;
 | 
	
		
			
				|  |  | +        let items = sheetCommonObj.analyzePasteData(me.setting, args);
 | 
	
		
			
				|  |  | +        for(let i = 0, len = items.length; i < len; i++){
 | 
	
		
			
				|  |  | +            //更新
 | 
	
		
			
				|  |  | +            let rowIdx = args.cellRange.row + i;
 | 
	
		
			
				|  |  | +            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();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      //复选框控制输出
 | 
	
		
			
				|  |  |      onButtonClicked: function (sender, args) {
 | 
	
		
			
				|  |  |          let me = characterOprObj, characterTxt;
 | 
	
	
		
			
				|  | @@ -468,9 +537,7 @@ let characterOprObj = {
 | 
	
		
			
				|  |  |          if(me.currentCache.length > args.row){
 | 
	
		
			
				|  |  |              me.refreshColData = true;
 | 
	
		
			
				|  |  |              me.currentCache[args.row].isChecked = isChecked;
 | 
	
		
			
				|  |  | -            characterTxt = me.getColData(me.currentCache);
 | 
	
		
			
				|  |  | -            let txtObj = {field: 'itemCharacterText', text: characterTxt ? characterTxt : ''};
 | 
	
		
			
				|  |  | -            pageCCOprObj.updateCharacterContent(pageCCOprObj.currentFindSet, {field: 'itemCharacter', updateArr: me.currentCache}, txtObj, characterOprObj);
 | 
	
		
			
				|  |  | +            me.save();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //else的情况就是新增
 | 
	
		
			
				|  |  |          else{
 | 
	
	
		
			
				|  | @@ -546,9 +613,9 @@ let pageCCOprObj = {
 | 
	
		
			
				|  |  |      //设置特征及内容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;
 | 
	
		
			
				|  |  | +        theCont.currentCache = node && typeof node.data.jobContent !== 'undefined' ? node.data.jobContent : [];
 | 
	
		
			
				|  |  | +        theCha.currentCache = node && typeof node.data.itemCharacter !== 'undefined' ? 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);
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -618,11 +685,8 @@ let pageCCOprObj = {
 | 
	
		
			
				|  |  |                      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){
 | 
	
		
			
				|  |  | -                            projectObj.mainSpread.getActiveSheet().setValue(me.mainActiveCell.row, updateCol, txtObj.text + ''); //刷新输出显示
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        oprObj.refreshColData = false;
 | 
	
		
			
				|  |  | +                    if(updateCol){
 | 
	
		
			
				|  |  | +                        projectObj.mainSpread.getActiveSheet().setValue(me.mainActiveCell.row, updateCol, txtObj.text + ''); //刷新输出显示
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 |