|
@@ -64,9 +64,9 @@ let feeItemObj = {
|
|
|
combo.items(comboItems).editable = false;
|
|
|
sheet.getRange(-1, col, -1, 1).cellType(combo);
|
|
|
},
|
|
|
- updateCurrentData: function (sheet, currentData, cache) {
|
|
|
+ getCurrentData: function (sheet, cache) {
|
|
|
let acRow = sheet.getActiveRowIndex();
|
|
|
- currentData = this.isDef(cache[acRow]) ? cache[acRow] : null;
|
|
|
+ return this.isDef(cache[acRow]) ? cache[acRow] : null;
|
|
|
},
|
|
|
buildSheet: function () {
|
|
|
let me = this, se = sectionObj, fr = feeRuleObj, bs = batchSectionObj;
|
|
@@ -114,17 +114,18 @@ let feeItemObj = {
|
|
|
let me = this, se = sectionObj, fr = feeRuleObj;
|
|
|
sheetCommonObj.cleanSheet(se.sheet, se.setting, -1);
|
|
|
sheetCommonObj.cleanSheet(fr.sheet, fr.setting, -1);
|
|
|
- me.workBook.focus(true);
|
|
|
if(!me.isDef(feeItem)){
|
|
|
+ me.workBook.focus(true);
|
|
|
me.currentFeeItem = null;
|
|
|
return;
|
|
|
}
|
|
|
fr.addObj = null;
|
|
|
fr.updateObj = null;
|
|
|
me.currentFeeItem = feeItem;
|
|
|
- se.cache = feeItem.section;
|
|
|
+ se.cache = me.currentFeeItem.section;
|
|
|
sheetCommonObj.showData(se.sheet, se.setting, se.cache);
|
|
|
se.initSelection(se.cache[0]);
|
|
|
+ me.workBook.focus(true);
|
|
|
|
|
|
},
|
|
|
onSelectionChanged: function (sender, info) {
|
|
@@ -148,7 +149,7 @@ let feeItemObj = {
|
|
|
}
|
|
|
},
|
|
|
onEditEnded: function (sender, args) {
|
|
|
- let me = feeItemObj;
|
|
|
+ let me = feeItemObj, se = sectionObj;
|
|
|
let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : '';
|
|
|
let feeItem = me.cache[args.row];
|
|
|
let updateObj = {updateType: '', updateData: {}};
|
|
@@ -181,12 +182,14 @@ let feeItemObj = {
|
|
|
updateObj.updateData.section = [];
|
|
|
me.cache.push(updateObj.updateData);
|
|
|
me.currentFeeItem = updateObj.updateData;
|
|
|
+ se.cache = me.currentFeeItem.section;
|
|
|
}
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
//ajax
|
|
|
me.updateFeeItem([updateObj]);
|
|
|
},
|
|
|
onClipboardPasted: function (sender, info) {
|
|
|
- let me = feeItemObj;
|
|
|
+ let me = feeItemObj, se = sectionObj;
|
|
|
let postData = [];
|
|
|
let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
for(let i = 0, len = items.length; i < len; i++){
|
|
@@ -213,7 +216,8 @@ let feeItemObj = {
|
|
|
}
|
|
|
}
|
|
|
//update currentFeeItem
|
|
|
- me.updateCurrentData(me.sheet, me.currentFeeItem, me.cache);
|
|
|
+ me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
|
|
|
+ se.cache = me.currentFeeItem.section;
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
if(postData.length > 0){
|
|
|
//ajax then refresh
|
|
@@ -246,7 +250,8 @@ let feeItemObj = {
|
|
|
}
|
|
|
}
|
|
|
//update currentFeeItem
|
|
|
- me.updateCurrentData(me.sheet, me.currentFeeItem, me.cache);
|
|
|
+ me.currentFeeItem = me.getCurrentData(me.sheet, me.cache);
|
|
|
+ se.cache = me.currentFeeItem.section;
|
|
|
if(fiPostData.length > 0){
|
|
|
me.updateFeeItem(fiPostData, function () {
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
@@ -423,7 +428,7 @@ let sectionObj = {
|
|
|
}
|
|
|
},
|
|
|
onEditEnded: function (sender, args) {
|
|
|
- let me = sectionObj, fi = feeItemObj;
|
|
|
+ let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
|
|
|
let v = me.isDef(args.editingText) ? args.editingText.toString().trim() : '';
|
|
|
let section = me.cache[args.row];
|
|
|
let updateObj = {updateType: '', updateData: {}};
|
|
@@ -455,7 +460,9 @@ let sectionObj = {
|
|
|
updateObj.updateData.feeRule = [];
|
|
|
me.cache.push(updateObj.updateData);
|
|
|
me.currentSection = updateObj.updateData;
|
|
|
+ fr.cache = me.currentSection.feeRule;
|
|
|
}
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
me.updateSection([updateObj]);
|
|
|
fi.updateFeeItem([{updateType: fi.updateType.update, updateData: {ID: fi.currentFeeItem.ID, $addToSet: {section: {ID: updateObj.updateData.ID}}}}]);
|
|
|
},
|
|
@@ -466,7 +473,7 @@ let sectionObj = {
|
|
|
}
|
|
|
},
|
|
|
onClipboardPasted: function (sender, info) {
|
|
|
- let me = sectionObj, fi = feeItemObj;
|
|
|
+ let me = sectionObj, fi = feeItemObj, fr = feeRuleObj;
|
|
|
let sePostData = [], fiPostData = [];
|
|
|
let items = sheetCommonObj.analyzePasteData(me.setting, info);
|
|
|
for(let i = 0, len = items.length; i < len; i++){
|
|
@@ -488,7 +495,8 @@ let sectionObj = {
|
|
|
}
|
|
|
}
|
|
|
//update currentSection
|
|
|
- fi.updateCurrentData(me.sheet, me.currentSection, me.cache);
|
|
|
+ me.currentSection = fi.getCurrentData(me.sheet, me.cache);
|
|
|
+ fr.cache = me.currentSection.feeRule;
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
if(sePostData.length > 0){
|
|
|
me.updateSection(sePostData);
|
|
@@ -520,7 +528,8 @@ let sectionObj = {
|
|
|
}
|
|
|
}
|
|
|
//update currentSection
|
|
|
- fi.updateCurrentData(me.sheet, me.currentSection, me.cache);
|
|
|
+ me.currentSection = fi.getCurrentData(me.sheet, me.cache);
|
|
|
+ fr.cache = me.currentSection.feeRule;
|
|
|
if(sePostData.length > 0){
|
|
|
me.updateSection(sePostData, function () {
|
|
|
sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
@@ -890,6 +899,7 @@ let feeRuleObj = {
|
|
|
updateObj.updateType = se.updateType.update;
|
|
|
updateObj.updateData.ID = se.currentSection.ID;
|
|
|
updateObj.updateData.feeRule = me.cache;
|
|
|
+ sheetCommonObj.showData(me.sheet, me.setting, me.cache);
|
|
|
se.updateSection([{updateType: se.updateType.update, updateData: se.currentSection}]);
|
|
|
me.addObj = null;
|
|
|
}
|