|
@@ -17,7 +17,6 @@ let pageOprObj = {
|
|
|
repositoryGljObj.getGljTree(gljLibId, function () {
|
|
|
repositoryGljObj.getGljItems(gljLibId);
|
|
|
});
|
|
|
- sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -79,10 +78,6 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
});
|
|
|
distTypeTree.distTypesArr.forEach(function (distTypeObj) {
|
|
|
- /* if(distTypeObj.children.length === 0 && distTypeObj.data.fullName !== '普通机械' &&distTypeObj.data.fullName !== '机械组成物'
|
|
|
- && distTypeObj.data.fullName !== '机上人工'){
|
|
|
- distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
|
|
|
- }*/
|
|
|
if(distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械'){
|
|
|
distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
|
|
|
}
|
|
@@ -99,9 +94,6 @@ let repositoryGljObj = {
|
|
|
if(!result.error && callback){
|
|
|
me.distTypeTree = me.getComboData(result.data);
|
|
|
console.log(me.distTypeTree);
|
|
|
- /*let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
|
|
|
- combo.items(me.distTypeTree.comboDatas).editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
|
|
|
- me.workBook.getSheet(0).getCell(-1, 5, GC.Spread.Sheets.SheetArea.viewport).cellType(combo);*/
|
|
|
callback();
|
|
|
}
|
|
|
}
|
|
@@ -289,10 +281,6 @@ let repositoryGljObj = {
|
|
|
//混凝土202、砂浆203、配合比204、机械3
|
|
|
if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
|
|
|
let row = info.newSelections[0].row;
|
|
|
- sheetCommonObj.lockCells(that.workBook.getSheet(0), that.setting);
|
|
|
- that.workBook.getSheet(0).getRange(-1, 0 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
- that.workBook.getSheet(0).getRange(-1, 4 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
- //that.workBook.getSheet(0).options.isProtected = true;
|
|
|
sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, -1);
|
|
|
me.workBook.focus(true);
|
|
|
me.currentComponent = [];
|
|
@@ -301,10 +289,6 @@ let repositoryGljObj = {
|
|
|
//标记当前工料机
|
|
|
me.currentGlj = me.currentCache[row];
|
|
|
if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
|
|
|
- that.workBook.getSheet(0).getRange(-1, 0 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
- that.workBook.getSheet(0).getRange(-1, 4 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
- //that.workBook.getSheet(0).options.isProtected = false;
|
|
|
- //sheetCommonObj.lockCells(that.workBook.getSheet(0), that.setting);
|
|
|
//展示数据
|
|
|
if(me.currentGlj.component.length > 0){
|
|
|
me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
|
|
@@ -359,24 +343,13 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
else {
|
|
|
$('#gljAlertBtn').click();
|
|
|
- //me.workBook.getSheet(0).options.isProtected = true;
|
|
|
- sheetCommonObj.lockAllCells(args.sheet);
|
|
|
$('#aleConfBtn').click(function () {
|
|
|
- // me.workBook.getSheet(0).options.isProtected = false;
|
|
|
- sheetCommonObj.unLockAllCells(args.sheet);
|
|
|
- sheetsOprObj.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
|
|
|
me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
|
|
|
});
|
|
|
$('#gljAleClose').click(function () {
|
|
|
- // me.workBook.getSheet(0).options.isProtected = false;
|
|
|
- sheetCommonObj.unLockAllCells(args.sheet);
|
|
|
- sheetsOprObj.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
|
|
|
me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
|
|
|
});
|
|
|
$('#aleCanceBtn').click(function () {
|
|
|
- // me.workBook.getSheet(0).options.isProtected = false;
|
|
|
- sheetCommonObj.unLockAllCells(args.sheet);
|
|
|
- sheetsOprObj.reLockSomeCodes(args.sheet, 0, repositoryGljObj.currentCache.length);
|
|
|
me.addGljObj = null;
|
|
|
for(let col=0; col<me.setting.header.length; col++){
|
|
|
if(col === 0){
|
|
@@ -395,18 +368,19 @@ let repositoryGljObj = {
|
|
|
let rObj = sheetsOprObj.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
|
|
|
me.currentEditingGlj = rObj;
|
|
|
me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
|
|
|
- let cacheSection = me.gljList;
|
|
|
- if (cacheSection) {
|
|
|
- for (let j = 0; j < cacheSection.length; j++) {
|
|
|
- if (cacheSection[j][me.setting.header[0].dataCode] && cacheSection[j][me.setting.header[0].dataCode] == rObj[me.setting.header[0].dataCode]) {
|
|
|
- rObj["ID"] = cacheSection[j]["ID"];
|
|
|
- rObj.gljClass = cacheSection[j].gljClass;
|
|
|
- break;
|
|
|
- }
|
|
|
+ if(args.row < me.currentCache.length){
|
|
|
+ me.currentGlj = me.currentCache[args.row];
|
|
|
+ if(args.col === 0 || (args.col === 4 && me.allowComponent.indexOf(me.currentGlj.gljType) !== -1)
|
|
|
+ || (args.col === 6 && me.currentGlj.gljType !== 1 && me.currentGlj.gljType !== 303)){
|
|
|
+ args.cancel = true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ rObj.ID = me.currentGlj.ID;
|
|
|
+ rObj.gljClass = me.currentGlj.gljClass;
|
|
|
}
|
|
|
}
|
|
|
- if(me.currentEditingGlj.gljType !== 1 && me.currentEditingGlj.gljType !== 303 && me.setting.header[args.col].dataCode === 'adjCoe'){
|
|
|
- args.cancel = true;
|
|
|
+ else {
|
|
|
+ me.currentGlj = null;
|
|
|
}
|
|
|
},
|
|
|
onCellEditEnd: function(sender, args) {
|
|
@@ -537,7 +511,6 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
if(updateArr.length >0 || addArr.length >0){
|
|
|
me.currentEditingGlj = null;
|
|
|
- //me.workBook.getSheet(0).setValue(11, 5, "人工");
|
|
|
me.mixUpdateRequest(updateArr, addArr, []);
|
|
|
}
|
|
|
},
|
|
@@ -611,12 +584,9 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
$('#alertText').text(text + "不可为空!");
|
|
|
$('#codeAlertBtn').click();
|
|
|
- sheet.options.isProtected = true;
|
|
|
$('#codAleConfBtn').click(function () {
|
|
|
- sheetsOprObj.lockSomeCodes(sheet, 0, cacheSection.length);
|
|
|
});
|
|
|
$('#codAleClose').click(function () {
|
|
|
- sheetsOprObj.lockSomeCodes(sheet, 0, cacheSection.length);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -794,127 +764,153 @@ let repositoryGljObj = {
|
|
|
pasteObj.gljClass = me.gljCurTypeId;
|
|
|
return true;
|
|
|
},
|
|
|
- onClipboardPasting: function(sender, args) {
|
|
|
+ canPasted: function (info) {
|
|
|
+ let rst = true;
|
|
|
let me = repositoryGljObj;
|
|
|
- if (me.gljCurTypeId < 0 ) {
|
|
|
- args.cancel = true;
|
|
|
+ if(me.gljCurTypeId < 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(info.cellRange.col + info.cellRange.colCount - 1 > me.setting.header.length - 1){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(info.cellRange.row < me.currentCache.length){
|
|
|
+ if(info.cellRange.col === 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else if(info.cellRange.col <= 4 && info.cellRange.col + info.cellRange.colCount - 1 >= 4){
|
|
|
+ for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
|
|
|
+ let row = i + info.cellRange.row;
|
|
|
+ if(row < me.currentCache.length){
|
|
|
+ if(me.allowComponent.indexOf(me.currentCache[row].gljType) !== -1){
|
|
|
+ rst = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
+ onClipboardPasting: function(sender, args) {
|
|
|
+ let me = repositoryGljObj;
|
|
|
//复制的列数超过正确的列数,不可复制
|
|
|
- if(maxCol >= me.setting.header.length){
|
|
|
+ if(!me.canPasted(args)){
|
|
|
args.cancel = true;
|
|
|
}
|
|
|
},
|
|
|
onClipboardPasted: function(e, info) {
|
|
|
let me = repositoryGljObj;
|
|
|
- let updateArr = [], addArr = [];
|
|
|
- let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
- let beginRow = info.cellRange.row, endRow = info.cellRange.row + info.cellRange.rowCount - 1,
|
|
|
- maxRow = me.currentCache.length - 1,
|
|
|
- updateBasePrcArr = [] ,
|
|
|
- updateCount, resumeArr = [];
|
|
|
- if(endRow <= maxRow){
|
|
|
- //updateItems = items;
|
|
|
- for(let i = 0; i < items.length; i++){
|
|
|
- let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
|
- if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
|
|
|
- //updateArr = updateObj.updateGlj;
|
|
|
- updateArr = updateArr.concat(updateObj.updateGlj);
|
|
|
- if(typeof updateObj.updateBasePrc !== 'undefined'){
|
|
|
- //updateBasePrcArr = updateObj.updateBasePrc;
|
|
|
- updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
|
|
|
- }
|
|
|
+ let updateArr = [], addArr = [];
|
|
|
+ let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
+ let beginRow = info.cellRange.row, endRow = info.cellRange.row + info.cellRange.rowCount - 1,
|
|
|
+ maxRow = me.currentCache.length - 1,
|
|
|
+ updateBasePrcArr = [] ,
|
|
|
+ updateCount, resumeArr = [];
|
|
|
+ if(endRow <= maxRow){
|
|
|
+ //updateItems = items;
|
|
|
+ for(let i = 0; i < items.length; i++){
|
|
|
+ let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
|
+ if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
|
|
|
+ //updateArr = updateObj.updateGlj;
|
|
|
+ updateArr = updateArr.concat(updateObj.updateGlj);
|
|
|
+ if(typeof updateObj.updateBasePrc !== 'undefined'){
|
|
|
+ //updateBasePrcArr = updateObj.updateBasePrc;
|
|
|
+ updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
|
|
|
}
|
|
|
- else{
|
|
|
- resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(beginRow <= maxRow && endRow > maxRow){
|
|
|
+ updateCount = maxRow - beginRow + 1;
|
|
|
+ for(let i = 0; i < updateCount; i++){
|
|
|
+ let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
|
+ if(updateObj && typeof updateObj.updateGlj !== 'undefined'){
|
|
|
+ updateArr = updateArr.concat(updateObj.updateGlj);
|
|
|
+ if(typeof updateObj.updateBasePrc !== 'undefined'){
|
|
|
+ updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
|
|
|
}
|
|
|
}
|
|
|
+ else{
|
|
|
+ resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
}
|
|
|
- else if(beginRow <= maxRow && endRow > maxRow){
|
|
|
- updateCount = maxRow - beginRow + 1;
|
|
|
- for(let i = 0; i < updateCount; i++){
|
|
|
- let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
|
|
|
- if(updateObj && typeof updateObj.updateGlj !== 'undefined'){
|
|
|
- updateArr = updateArr.concat(updateObj.updateGlj);
|
|
|
- if(typeof updateObj.updateBasePrc !== 'undefined'){
|
|
|
- updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrc);
|
|
|
+ if(info.cellRange.colCount === me.setting.header.length){
|
|
|
+ for(let i = updateCount ; i < items.length; i++){
|
|
|
+ if(me.isValidObj(items[i])){
|
|
|
+ items[i].component = [];
|
|
|
+ //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
|
|
|
+ if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
+ items[i].basePrice = 0;
|
|
|
}
|
|
|
+ addArr.push(items[i]);
|
|
|
}
|
|
|
else{
|
|
|
resumeArr.push(info.cellRange.row + i);
|
|
|
}
|
|
|
}
|
|
|
- if(info.cellRange.colCount === me.setting.header.length){
|
|
|
- for(let i = updateCount ; i < items.length; i++){
|
|
|
- if(me.isValidObj(items[i])){
|
|
|
- items[i].component = [];
|
|
|
- //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
|
|
|
- if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
- items[i].basePrice = 0;
|
|
|
- }
|
|
|
- addArr.push(items[i]);
|
|
|
- }
|
|
|
- else{
|
|
|
- resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ for(let i = updateCount ; i < items.length; i++){
|
|
|
+ resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(info.cellRange.colCount === me.setting.header.length - 1 && info.cellRange.col + info.cellRange.colCount - 1 >= 5){
|
|
|
+ for(let i = 0; i < items.length; i++){
|
|
|
+ if(me.isValidObj(items[i])){
|
|
|
+ items[i].component = [];
|
|
|
+ if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
+ items[i].basePrice = 0;
|
|
|
}
|
|
|
+ addArr.push(items[i]);
|
|
|
}
|
|
|
- }
|
|
|
- else{
|
|
|
- for(let i = updateCount ; i < items.length; i++){
|
|
|
+ else{
|
|
|
resumeArr.push(info.cellRange.row + i);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
- if(info.cellRange.colCount === me.setting.header.length){
|
|
|
- for(let i = 0; i < items.length; i++){
|
|
|
- if(me.isValidObj(items[i])){
|
|
|
- items[i].component = [];
|
|
|
- if(me.allowComponent.indexOf(items[i].gljType) !== -1){
|
|
|
- items[i].basePrice = 0;
|
|
|
- }
|
|
|
- addArr.push(items[i]);
|
|
|
+ for(let i = 0; i < items.length; i++){
|
|
|
+ resumeArr.push(info.cellRange.row + i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //repaint
|
|
|
+ if(resumeArr.length > 0){
|
|
|
+ info.sheet.suspendPaint();
|
|
|
+ for(let i = 0; i < resumeArr.length ; i++){
|
|
|
+ if(resumeArr[i] < me.currentCache.length){
|
|
|
+ for(let col = 0; col < me.setting.header.length; col++){
|
|
|
+ if(me.setting.header[col].dataCode === 'gljType'){
|
|
|
+ let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
|
|
|
+ info.sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
|
|
|
}
|
|
|
else{
|
|
|
- resumeArr.push(info.cellRange.row + i);
|
|
|
+ info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
- for(let i = 0; i < items.length; i++){
|
|
|
- resumeArr.push(info.cellRange.row + i);
|
|
|
+ for(let col = 0; col < me.setting.header.length; col++){
|
|
|
+ info.sheet.setValue(resumeArr[i], col, '');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //repaint
|
|
|
- if(resumeArr.length > 0){
|
|
|
- info.sheet.suspendPaint();
|
|
|
- for(let i = 0; i < resumeArr.length ; i++){
|
|
|
- if(resumeArr[i] < me.currentCache.length){
|
|
|
- for(let col = 0; col < me.setting.header.length; col++){
|
|
|
- if(me.setting.header[col].dataCode === 'gljType'){
|
|
|
- let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
|
|
|
- info.sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
|
|
|
- }
|
|
|
- else{
|
|
|
- info.sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
- for(let col = 0; col < me.setting.header.length; col++){
|
|
|
- info.sheet.setValue(resumeArr[i], col, '');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- info.sheet.resumePaint();
|
|
|
- }
|
|
|
- if (updateArr.length > 0 || addArr.length > 0) {
|
|
|
- me.mixUpdateRequest(updateArr, addArr, []);
|
|
|
- }
|
|
|
- if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
|
|
|
- me.updateRationBasePrcRq(updateBasePrcArr);
|
|
|
- }
|
|
|
+ info.sheet.resumePaint();
|
|
|
+ }
|
|
|
+ if (updateArr.length > 0 || addArr.length > 0) {
|
|
|
+ console.log(addArr);
|
|
|
+ me.mixUpdateRequest(updateArr, addArr, []);
|
|
|
+ }
|
|
|
+ if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
|
|
|
+ me.updateRationBasePrcRq(updateBasePrcArr);
|
|
|
+ }
|
|
|
},
|
|
|
updateRationBasePrcRq: function (basePrcArr) {
|
|
|
$.ajax({
|
|
@@ -963,14 +959,12 @@ let repositoryGljObj = {
|
|
|
}
|
|
|
else{
|
|
|
me.currentCache = me.getCache();
|
|
|
- //sheetCommonObj.unLockAllCells(me.workBook.getSheet(0));
|
|
|
- sheetsOprObj.reLockSomeCodes(me.workBook.getSheet(0), 0, me.currentCache.length);
|
|
|
- //sheetCommonObj.lockSomeCodes(me.workBook.getSheet(0), 0, me.currentCache.length);
|
|
|
}
|
|
|
me.showGljItems(me.gljList, me.gljCurTypeId);
|
|
|
}
|
|
|
},
|
|
|
error:function(err){
|
|
|
+ console.log(err);
|
|
|
alert("保存失败");
|
|
|
}
|
|
|
})
|
|
@@ -1053,20 +1047,14 @@ let gljTypeTreeOprObj = {
|
|
|
gljTypeId = treeNode.ID;
|
|
|
me.gljCurTypeId = treeNode.ID;
|
|
|
me.addGljObj = null;
|
|
|
- //me.currentCache = me.getCache();
|
|
|
sheetCommonObj.cleanSheet(that.workBook.getSheet(0), that.setting, 5);
|
|
|
- that.workBook.getSheet(0).getRange(-1, 0 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
- that.workBook.getSheet(0).getRange(-1, 4 , -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
if (me.parentNodeIds["_pNodeId_" + treeNode.ID]) {
|
|
|
me.currentOprParent = 1;
|
|
|
me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + treeNode.ID]);
|
|
|
- sheetsOprObj.lockCodeCells(me.workBook.getSheet(0), me.currentCache.length);
|
|
|
me.workBook.getSheet(0).setRowCount(me.currentCache.length);
|
|
|
} else {
|
|
|
me.currentOprParent = 0;
|
|
|
me.currentCache = me.getCache();
|
|
|
- sheetCommonObj.unLockAllCells(me.workBook.getSheet(0));
|
|
|
- sheetsOprObj.reLockSomeCodes(me.workBook.getSheet(0), 0, me.currentCache.length);
|
|
|
}
|
|
|
me.showGljItems(me.gljList, gljTypeId);
|
|
|
},
|