|
@@ -1735,6 +1735,73 @@ const billsGuidance = (function () {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 替换定额
|
|
|
+ function replaceRation(newRation, orgItem) {
|
|
|
+ if (newRation.ID === orgItem.data.rationID) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ const updateAttrs = {name: getRationItemName(newRation), rationID: newRation.ID};
|
|
|
+ const updateData = [{updateType: updateType.update, findData: {ID: orgItem.getID()}, updateData: updateAttrs }];
|
|
|
+ updateGuideItems(updateData, function () {
|
|
|
+ Object.assign(orgItem.data, updateAttrs);
|
|
|
+ const row = orgItem.serialNo();
|
|
|
+ guideItem.workBook.getSheet(0).setValue(row, 0, orgItem.data.name);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始化定额右键菜单
|
|
|
+ function initRationContextMenu() {
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#rationSpread',
|
|
|
+ build: function($triggerElement, e){
|
|
|
+ //控制允许右键菜单在哪个位置出现
|
|
|
+ let sheet = ration.workBook.getActiveSheet();;
|
|
|
+ let offset = $("#rationSpread").offset(),
|
|
|
+ x = e.pageX - offset.left,
|
|
|
+ y = e.pageY - offset.top;
|
|
|
+ let target = sheet.hitTest(x, y);
|
|
|
+ if(target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){//在表格内
|
|
|
+ let sel = sheet.getSelections()[0];
|
|
|
+ if(sel && sel.rowCount === 1){
|
|
|
+ sheet.setActiveCell(target.row, target.col);
|
|
|
+ }
|
|
|
+ sel = sheet.getSelections()[0];
|
|
|
+ if(sel){
|
|
|
+ sel.row = sel.row === -1 ? 0 : sel.row;
|
|
|
+ }
|
|
|
+ //右键在多选内则不重设焦点
|
|
|
+ if(!sel || sel.rowCount === 1 || !(target.row >= sel.row && target.row <= sel.row + sel.rowCount - 1)){
|
|
|
+ sheet.setActiveCell(target.row, target.col);
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ callback: function(){},
|
|
|
+ items: {
|
|
|
+ "replace": {
|
|
|
+ name: "替换定额",
|
|
|
+ disabled: function () {
|
|
|
+ return locked || !bills.tree.selected || !bills.tree.selected.guidance || !bills.tree.selected.guidance.tree || !bills.tree.selected.guidance.tree.selected || bills.tree.selected.guidance.tree.selected.data.type !== itemType.ration;
|
|
|
+ },
|
|
|
+ icon: "fa-copy",
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const row = sheet.getActiveRowIndex();
|
|
|
+ if (!ration.cache[row]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ replaceRation(ration.cache[row], bills.tree.selected.guidance.tree.selected);
|
|
|
+ // copyBlocks(blockNodes);
|
|
|
+ }},
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//展开至搜索出来点的节点
|
|
|
//@param {Array}nodes @return {void}
|
|
|
function expandSearchNodes(sheet, nodes, roots){
|
|
@@ -1979,6 +2046,7 @@ const billsGuidance = (function () {
|
|
|
});
|
|
|
}
|
|
|
$('.top-content').hide();
|
|
|
+ $('#deResize').hide();
|
|
|
$('#searchCount').text(`搜索结果: ${ration.cache.length}`);
|
|
|
$('#rationSearchResult').show();
|
|
|
autoFlashHeight();
|
|
@@ -1992,6 +2060,7 @@ const billsGuidance = (function () {
|
|
|
//关闭搜索
|
|
|
$('#rationSearchResult a').click(function () {
|
|
|
$('.top-content').show();
|
|
|
+ $('#deResize').show();
|
|
|
$('#rationSearchResult').hide();
|
|
|
autoFlashHeight();
|
|
|
renderSheetFunc(ration.workBook.getActiveSheet(), function () {
|
|
@@ -2137,16 +2206,18 @@ const billsGuidance = (function () {
|
|
|
bottom: $('#bottomContent'),
|
|
|
bottomSpread: $('#rationSpread')
|
|
|
};
|
|
|
- SlideResize.loadVerticalHeight(heightEleObj.module, heightEleObj,
|
|
|
- {totalHeight: `$(window).height()-$('.header').height()-$('.sidebar-tools-bar').height()-10`,
|
|
|
- notTopSpread: 0, notBottomSpread: 0}, function () {
|
|
|
- if(section.workBook){
|
|
|
- section.workBook.refresh();
|
|
|
- }
|
|
|
- if(ration.workBook){
|
|
|
- ration.workBook.refresh();
|
|
|
- }
|
|
|
- });
|
|
|
+ if (!$('#rationSearchResult').is(':visible')) {
|
|
|
+ SlideResize.loadVerticalHeight(heightEleObj.module, heightEleObj,
|
|
|
+ {totalHeight: `$(window).height()-$('.header').height()-$('.sidebar-tools-bar').height()-10`,
|
|
|
+ notTopSpread: 0, notBottomSpread: 0}, function () {
|
|
|
+ if(section.workBook){
|
|
|
+ section.workBook.refresh();
|
|
|
+ }
|
|
|
+ if(ration.workBook){
|
|
|
+ ration.workBook.refresh();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
//水平
|
|
|
SlideResize.loadHorizonWidth(moduleName, [$('#slideResizeLeft'), $('#slideResizeRight')], [$('#leftContent'), $('#midContent'), $('#rightContent')], function () {
|
|
|
refreshALlWorkBook();
|
|
@@ -2161,6 +2232,7 @@ const billsGuidance = (function () {
|
|
|
getLibWithBills(libID);
|
|
|
initBtn();
|
|
|
initContextMenu();
|
|
|
+ initRationContextMenu();
|
|
|
initSlideSize();
|
|
|
}
|
|
|
|