|
@@ -189,9 +189,17 @@ let rationOprObj = {
|
|
|
callback: function(){},
|
|
|
items: {
|
|
|
"delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
|
|
|
- me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
|
|
|
- me.mixDel = 1;
|
|
|
- me.mixUpdateRequest([], [], [ration.ID]);
|
|
|
+
|
|
|
+ let removeInfo = `确定要删除定额 “${ration.code}” 及其下的所有数据吗?`;
|
|
|
+ $('#delRationAlert').find('.modal-body h5').text(removeInfo);
|
|
|
+ $('#delRationAlert').modal('show');
|
|
|
+ $('#delRationConfirm').bind('click', function () {
|
|
|
+ me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
|
|
|
+ me.mixDel = 1;
|
|
|
+ me.mixUpdateRequest([], [], [ration.ID]);
|
|
|
+ $('#delRationConfirm').unbind('click');
|
|
|
+ $('#delRationAlert').modal('hide');
|
|
|
+ });
|
|
|
}}
|
|
|
}
|
|
|
};
|
|
@@ -207,6 +215,7 @@ let rationOprObj = {
|
|
|
me.workBook.commandManager().register('rationDelete', function () {
|
|
|
let rationSheet = me.workBook.getActiveSheet();
|
|
|
let sels = rationSheet.getSelections(), updateArr = [], removeArr = [], lockCols = me.setting.view.lockColumns;
|
|
|
+ let removeCodes = [];
|
|
|
let cacheSection = me.getCache();
|
|
|
if(sels.length > 0){
|
|
|
for(let sel = 0; sel < sels.length; sel++){
|
|
@@ -215,6 +224,7 @@ let rationOprObj = {
|
|
|
for(let i = 0; i < sels[sel].rowCount; i++){
|
|
|
if(sels[sel].row + i < cacheSection.length){
|
|
|
removeArr.push(cacheSection[sels[sel].row + i].ID);
|
|
|
+ removeCodes.push(cacheSection[sels[sel].row + i].code);
|
|
|
me.rationsCodes.splice(me.rationsCodes.indexOf(cacheSection[sels[sel].row + i].code.toString()), 1);
|
|
|
}
|
|
|
}
|
|
@@ -248,10 +258,25 @@ let rationOprObj = {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(updateArr.length > 0 || removeArr.length > 0){
|
|
|
+ /* if(updateArr.length > 0 || removeArr.length > 0){
|
|
|
me.mixUpdate = 1;
|
|
|
me.mixDel = removeArr.length > 0 ? 1 : 0;
|
|
|
me.mixUpdateRequest(updateArr, [], removeArr);
|
|
|
+ }*/
|
|
|
+ if(updateArr.length > 0){
|
|
|
+ me.mixUpdate = 1;
|
|
|
+ me.mixUpdateRequest(updateArr, [], []);
|
|
|
+ }
|
|
|
+ if(removeArr.length > 0){
|
|
|
+ let removeInfo = `确定要删除定额 “${removeCodes.join(',')}” 及其下的所有数据吗?`;
|
|
|
+ $('#delRationAlert').find('.modal-body h5').text(removeInfo);
|
|
|
+ $('#delRationAlert').modal('show');
|
|
|
+ $('#delRationConfirm').bind('click', function () {
|
|
|
+ me.mixDel = 1;
|
|
|
+ me.mixUpdateRequest([], [], removeArr);
|
|
|
+ $('#delRationConfirm').unbind('click');
|
|
|
+ $('#delRationAlert').modal('hide');
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
});
|
|
@@ -586,6 +611,7 @@ let rationOprObj = {
|
|
|
//annotation
|
|
|
annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
|
me.showRationItems(sectionID);
|
|
|
+ sectionTreeObj.removeBtn.removeClass('disabled');
|
|
|
} else {
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
@@ -605,8 +631,10 @@ let rationOprObj = {
|
|
|
annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
|
|
|
me.showRationItems(sectionID);
|
|
|
}
|
|
|
+ sectionTreeObj.removeBtn.removeClass('disabled');
|
|
|
},
|
|
|
error:function(err){
|
|
|
+ sectionTreeObj.removeBtn.removeClass('disabled');
|
|
|
alert(err);
|
|
|
}
|
|
|
})
|