|
@@ -86,6 +86,44 @@ var rationLibObj = {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ loadStdRationContextMenu: function () {
|
|
|
+ let rationSpread = rationLibObj.sectionRationsSpread, rationSheet = rationSpread.getActiveSheet();
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#stdSectionRations',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ let target = SheetDataHelper.safeRightClickSelection($trigger, e, rationSpread);
|
|
|
+ return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ "insertStdRation": {
|
|
|
+ name: "插入定额",
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ let select = $('#stdRationLibSelect'), rationSelect = rationSheet.getSelections();
|
|
|
+ let rationCode = rationSelect.length > 0 ? rationSheet.getText(rationSelect[0].row, 0) : '';
|
|
|
+ if (rationCode !== '') {
|
|
|
+ CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, rationLibId: select.val(), code: rationCode}, function (data) {
|
|
|
+ ProjectController.addRation(projectObj.project, projectObj.mainController, data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "replaceStdRation": {
|
|
|
+ name: "替换定额",
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ let select = $('#stdRationLibSelect'), rationSelect = rationSheet.getSelections();
|
|
|
+ let rationCode = rationSelect.length > 0 ? rationSheet.getText(rationSelect[0].row, 0) : '';
|
|
|
+ if (rationCode !== '') {
|
|
|
+ CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, rationLibId: select.val(), code: rationCode}, function (data) {
|
|
|
+ ProjectController.replaceRation(projectObj.project, projectObj.mainController, data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
rationChapterTreeSetting: {
|
|
|
"emptyRows":0,
|
|
|
"headRows":1,
|
|
@@ -195,6 +233,7 @@ $('#stdRationTab').bind('click', function () {
|
|
|
rationLibObj.checkSpread();
|
|
|
if (select[0].options.length === 0) {
|
|
|
rationLibObj.loadStdRationLibs();
|
|
|
+ rationLibObj.loadStdRationContextMenu();
|
|
|
};
|
|
|
});
|
|
|
$('#stdRationLibSelect').change(function () {
|