|
@@ -12,7 +12,92 @@ $(document).ready(function () {
|
|
$('#sectionTreeModal').on('hidden.bs.modal', function () {
|
|
$('#sectionTreeModal').on('hidden.bs.modal', function () {
|
|
batchSectionObj.clearChecked();
|
|
batchSectionObj.clearChecked();
|
|
});
|
|
});
|
|
|
|
+ $('#delConfirm').click(function () {
|
|
|
|
+ if(curDeleteType === feeItemObj.deleteType){
|
|
|
|
+ let me = feeItemObj, se = sectionObj, fr = feeRuleObj;
|
|
|
|
+ let fiPostData = [], sePostData = [];
|
|
|
|
+ let sels = me.workBook.getSheet(0).getSelections();
|
|
|
|
+ for(let i = 0, len = sels.length; i < len; i++){
|
|
|
|
+ let sel = sels[i];
|
|
|
|
+ //delete
|
|
|
|
+ if(sel.colCount === me.setting.header.length){
|
|
|
|
+ for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
|
|
|
|
+ let row = sel.row + j;
|
|
|
|
+ let feeItem = me.cache[row];
|
|
|
|
+ //有数据,删除数据
|
|
|
|
+ if(me.isDef(feeItem)){
|
|
|
|
+ fiPostData.push({updateType: me.updateType.update, updateData: {ID: feeItem.ID, deleted: true}});
|
|
|
|
+ //delete feeItem section
|
|
|
|
+ for(let section of feeItem.section){
|
|
|
|
+ sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //front delete
|
|
|
|
+ me.cache.splice(sel.row, sel.rowCount);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //update currentFeeItem
|
|
|
|
+ me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
|
|
|
|
+ se.cache = me.isDef(me.currentFeeItem) ? me.currentFeeItem.section : [];
|
|
|
|
+ if(fiPostData.length > 0){
|
|
|
|
+ me.updateFeeItem(fiPostData, function () {
|
|
|
|
+ me.sheet.setRowCount(me.cache.length + 10);
|
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
|
+ $('#delAlert').modal('hide');
|
|
|
|
+ });
|
|
|
|
+ if(sePostData.length > 0){
|
|
|
|
+ se.updateSection(sePostData);
|
|
|
|
+ }
|
|
|
|
+ sheetCommonObj.cleanData(se.sheet, se.setting, 10);
|
|
|
|
+ sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $('#delAlert').modal('hide');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if(curDeleteType === sectionObj.deleteType){
|
|
|
|
+ let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
|
|
|
|
+ let sePostData = [], fiPostData = [];
|
|
|
|
+ let sels = me.workBook.getSheet(0).getSelections();
|
|
|
|
+ for(let i = 0, len = sels.length; i < len; i++){
|
|
|
|
+ let sel = sels[i];
|
|
|
|
+ //delete
|
|
|
|
+ if(sel.colCount === me.setting.header.length){
|
|
|
|
+ for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
|
|
|
|
+ let row = sel.row + j;
|
|
|
|
+ let section = me.cache[row];
|
|
|
|
+ //有数据,删除数据
|
|
|
|
+ if(me.isDef(section)){
|
|
|
|
+ sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
|
|
|
|
+ fiPostData.push({updateType: me.updateType.update, updateData: {ID: fi.currentFeeItem.ID, $pull: {section: {ID: section.ID}}}});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //front delete
|
|
|
|
+ me.cache.splice(sel.row, sel.rowCount);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //update currentSection
|
|
|
|
+ me.currentSection = fi.getCurrentData(me.sheet, me.cache);
|
|
|
|
+ fr.cache = me.isDef(me.currentSection) ? me.currentSection.feeRule : [];
|
|
|
|
+ if(sePostData.length > 0){
|
|
|
|
+ me.updateSection(sePostData, function () {
|
|
|
|
+ me.sheet.setRowCount(me.cache.length + 5);
|
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
|
+ $('#delAlert').modal('hide');
|
|
|
|
+ });
|
|
|
|
+ if(fiPostData.length > 0){
|
|
|
|
+ fi.updateFeeItem(fiPostData);
|
|
|
|
+ }
|
|
|
|
+ sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ $('#delAlert').modal('hide');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
+let curDeleteType = null;
|
|
//费用项
|
|
//费用项
|
|
let feeItemObj = {
|
|
let feeItemObj = {
|
|
rationRepId: null,
|
|
rationRepId: null,
|
|
@@ -22,6 +107,7 @@ let feeItemObj = {
|
|
currentFeeItem: null,
|
|
currentFeeItem: null,
|
|
feeType: {ZM: '子目费用', FX: '分项费用', CS: '措施费用'},
|
|
feeType: {ZM: '子目费用', FX: '分项费用', CS: '措施费用'},
|
|
updateType: {update: 'update', new: 'new'},
|
|
updateType: {update: 'update', new: 'new'},
|
|
|
|
+ deleteType: 'feeItem',
|
|
setting: {
|
|
setting: {
|
|
header:[
|
|
header:[
|
|
{headerName:"费用项",headerWidth:300,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
|
|
{headerName:"费用项",headerWidth:300,dataCode:"feeItem", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
|
|
@@ -225,43 +311,17 @@ let feeItemObj = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
feeItemDelOpr: function () {
|
|
feeItemDelOpr: function () {
|
|
- let me = feeItemObj, se = sectionObj, fr = feeRuleObj;
|
|
|
|
- let fiPostData = [], sePostData = [];
|
|
|
|
|
|
+ let me = this;
|
|
me.workBook.commandManager().register('feeItemDel', function () {
|
|
me.workBook.commandManager().register('feeItemDel', function () {
|
|
|
|
+ curDeleteType = me.deleteType;
|
|
let sels = me.workBook.getSheet(0).getSelections();
|
|
let sels = me.workBook.getSheet(0).getSelections();
|
|
for(let i = 0, len = sels.length; i < len; i++){
|
|
for(let i = 0, len = sels.length; i < len; i++){
|
|
let sel = sels[i];
|
|
let sel = sels[i];
|
|
//delete
|
|
//delete
|
|
if(sel.colCount === me.setting.header.length){
|
|
if(sel.colCount === me.setting.header.length){
|
|
- for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
|
|
|
|
- let row = sel.row + j;
|
|
|
|
- let feeItem = me.cache[row];
|
|
|
|
- //有数据,删除数据
|
|
|
|
- if(me.isDef(feeItem)){
|
|
|
|
- fiPostData.push({updateType: me.updateType.update, updateData: {ID: feeItem.ID, deleted: true}});
|
|
|
|
- //delete feeItem section
|
|
|
|
- for(let section of feeItem.section){
|
|
|
|
- sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //front delete
|
|
|
|
- me.cache.splice(sel.row, sel.rowCount);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //update currentFeeItem
|
|
|
|
- me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
|
|
|
|
- se.cache = me.isDef(me.currentFeeItem) ? me.currentFeeItem.section : [];
|
|
|
|
- if(fiPostData.length > 0){
|
|
|
|
- me.updateFeeItem(fiPostData, function () {
|
|
|
|
- me.sheet.setRowCount(me.cache.length + 10);
|
|
|
|
- sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
|
- });
|
|
|
|
- if(sePostData.length > 0){
|
|
|
|
- se.updateSection(sePostData);
|
|
|
|
|
|
+ $('#delAlert').modal('show');
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- sheetCommonObj.cleanData(se.sheet, se.setting, 10);
|
|
|
|
- sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
@@ -313,6 +373,7 @@ let sectionObj = {
|
|
cache: [],
|
|
cache: [],
|
|
currentSection: null,
|
|
currentSection: null,
|
|
updateType: {update: 'update', new: 'new'},
|
|
updateType: {update: 'update', new: 'new'},
|
|
|
|
+ deleteType: 'section',
|
|
setting: {
|
|
setting: {
|
|
header:[
|
|
header:[
|
|
{headerName:"分册章节",headerWidth:600,dataCode:"name", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
|
|
{headerName:"分册章节",headerWidth:600,dataCode:"name", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"}
|
|
@@ -510,39 +571,17 @@ let sectionObj = {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
sectionDelOpr: function () {
|
|
sectionDelOpr: function () {
|
|
- let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
|
|
|
|
- let sePostData = [], fiPostData = [];
|
|
|
|
|
|
+ let me = this;
|
|
me.workBook.commandManager().register('sectionDel', function () {
|
|
me.workBook.commandManager().register('sectionDel', function () {
|
|
|
|
+ curDeleteType = me.deleteType;
|
|
let sels = me.workBook.getSheet(0).getSelections();
|
|
let sels = me.workBook.getSheet(0).getSelections();
|
|
for(let i = 0, len = sels.length; i < len; i++){
|
|
for(let i = 0, len = sels.length; i < len; i++){
|
|
let sel = sels[i];
|
|
let sel = sels[i];
|
|
//delete
|
|
//delete
|
|
if(sel.colCount === me.setting.header.length){
|
|
if(sel.colCount === me.setting.header.length){
|
|
- for(let j = 0, jLen = sel.rowCount; j < jLen; j++){
|
|
|
|
- let row = sel.row + j;
|
|
|
|
- let section = me.cache[row];
|
|
|
|
- //有数据,删除数据
|
|
|
|
- if(me.isDef(section)){
|
|
|
|
- sePostData.push({updateType: me.updateType.update, updateData: {ID: section.ID, deleted: true}});
|
|
|
|
- fiPostData.push({updateType: me.updateType.update, updateData: {ID: fi.currentFeeItem.ID, $pull: {section: {ID: section.ID}}}});
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //front delete
|
|
|
|
- me.cache.splice(sel.row, sel.rowCount);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //update currentSection
|
|
|
|
- me.currentSection = fi.getCurrentData(me.sheet, me.cache);
|
|
|
|
- fr.cache = me.isDef(me.currentSection) ? me.currentSection.feeRule : [];
|
|
|
|
- if(sePostData.length > 0){
|
|
|
|
- me.updateSection(sePostData, function () {
|
|
|
|
- me.sheet.setRowCount(me.cache.length + 5);
|
|
|
|
- sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
|
- });
|
|
|
|
- if(fiPostData.length > 0){
|
|
|
|
- fi.updateFeeItem(fiPostData);
|
|
|
|
|
|
+ $('#delAlert').modal('show');
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- sheetCommonObj.cleanData(fr.sheet, fr.setting, 10);
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|
|
me.workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
|