|
@@ -221,6 +221,9 @@ const billsGuidance = (function () {
|
|
|
},
|
|
|
RangeChanged: function (sender, args) {
|
|
|
edit(args.sheet, args.changedCells);
|
|
|
+ },
|
|
|
+ CellDoubleClick: function(sender, args) {
|
|
|
+ locateAtRation(args.row);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -356,7 +359,6 @@ const billsGuidance = (function () {
|
|
|
return;
|
|
|
}
|
|
|
const Events = GC.Spread.Sheets.Events;
|
|
|
- let sheet = workBook.getActiveSheet();
|
|
|
for(let event in events){
|
|
|
workBook.bind(Events[event], events[event]);
|
|
|
}
|
|
@@ -386,6 +388,12 @@ const billsGuidance = (function () {
|
|
|
bindEvent(module.workBook, module.events);
|
|
|
}
|
|
|
lockUtil.lockSpreads([module.workBook], locked);
|
|
|
+ if (locked) {
|
|
|
+ // 锁定表格后双击事件失效了,但是需要双击定位,因此重新绑定双击
|
|
|
+ if (module === guideItem) {
|
|
|
+ module.workBook.bind('CellDoubleClick', module.events.CellDoubleClick);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//清空表数据
|
|
|
//@param {Object}sheet {Array}headers {Number}rowCount @return {void}
|
|
@@ -815,7 +823,7 @@ const billsGuidance = (function () {
|
|
|
}
|
|
|
//初始化定额条目
|
|
|
//@param {Number}rationLibId @return {void}
|
|
|
- function initRationItems(rationLibId){
|
|
|
+ function initRationItems(rationLibId, successCb){
|
|
|
$.bootstrapLoading.start();
|
|
|
//获取定额章节树
|
|
|
let sectionSheet = section.workBook.getActiveSheet();
|
|
@@ -841,6 +849,9 @@ const billsGuidance = (function () {
|
|
|
ration.datas = rstData;
|
|
|
sectionInitSel(0);
|
|
|
$.bootstrapLoading.end();
|
|
|
+ if (successCb) {
|
|
|
+ successCb();
|
|
|
+ }
|
|
|
}, function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
@@ -848,12 +859,16 @@ const billsGuidance = (function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ // 可用的定额库ID
|
|
|
+ const rationLibIDs = [];
|
|
|
//初始化定额库选择
|
|
|
//@param {String}compilationId @return {void}
|
|
|
function initRationLibs(compilationId){
|
|
|
CommonAjax.post('/rationRepository/api/getRationLibsByCompilation', {compilationId: compilationId}, function (rstData) {
|
|
|
$('#rationLibSel').empty();
|
|
|
for(let rationLib of rstData){
|
|
|
+ rationLibIDs.push(+rationLib.ID);
|
|
|
let opt = `<option value="${rationLib.ID}">${rationLib.dispName}</option>`;
|
|
|
$('#rationLibSel').append(opt);
|
|
|
}
|
|
@@ -865,6 +880,13 @@ const billsGuidance = (function () {
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ // 变更定额库
|
|
|
+ function changeRationLib(libID, successCb) {
|
|
|
+ $('#rationLibSel').val(libID);
|
|
|
+ initRationItems(libID, successCb);
|
|
|
+ }
|
|
|
+
|
|
|
// 设置清单名称文本色
|
|
|
function setBillsForeColor(billsNodes) {
|
|
|
const sheet = bills.workBook.getActiveSheet();
|
|
@@ -1007,8 +1029,6 @@ const billsGuidance = (function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 展开收起清单树()
|
|
|
-
|
|
|
//更新清单备注
|
|
|
function updateBillsComment(updateData, callback, errCB) {
|
|
|
CommonAjax.post('/stdBillsEditor/updateBills', updateData, function () {
|
|
@@ -1556,6 +1576,53 @@ const billsGuidance = (function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ // 双击定位定额
|
|
|
+ async function locateAtRation(row) {
|
|
|
+ const node = bills.tree.selected.guidance.tree.items[row];
|
|
|
+ if (!node || !node.data.rationID) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const rationItem = ration.datas.find(item => item.ID === node.data.rationID);
|
|
|
+ // 当前库没有找到,需要后端查找
|
|
|
+ if (!rationItem) {
|
|
|
+ const findedRation = await ajaxPost('/rationRepository/api/getRationByID',{ ID: node.data.rationID });
|
|
|
+ if (!findedRation || !rationLibIDs.includes(findedRation.rationRepId)) {
|
|
|
+ alert('无法定位此定额,此定额已被删除');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ changeRationLib(findedRation.rationRepId, () => {
|
|
|
+ located(findedRation.ID, findedRation.sectionId);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ located(rationItem.ID, rationItem.sectionId);
|
|
|
+ }
|
|
|
+ function located(rationID, sectionID) {
|
|
|
+ if (!section.tree) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const sectionNode = section.tree.nodes[section.tree.prefix + sectionID];
|
|
|
+ if (!sectionNode) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 定位到对应章节树
|
|
|
+ const sectionSheet = section.workBook.getActiveSheet();
|
|
|
+ const sectionRow = sectionNode.serialNo();
|
|
|
+ expandSearchNodes(sectionSheet, [sectionNode], section.tree.roots);
|
|
|
+ sectionSheet.setSelection(sectionRow, 0, 1, 1);
|
|
|
+ sectionSheet.showRow(sectionRow, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ sectionInitSel(sectionRow);
|
|
|
+
|
|
|
+ // 定位到对应定额
|
|
|
+ const locatedRationRow = ration.cache.findIndex(item => item.ID === rationID);
|
|
|
+ if (locatedRationRow !== -1) {
|
|
|
+ const rationSheet = ration.workBook.getActiveSheet();
|
|
|
+ rationSheet.setSelection(locatedRationRow, 1, 1, 1);
|
|
|
+ rationSheet.showRow(locatedRationRow, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//初始化右键菜单
|
|
|
//@return {void}
|
|
|
function initContextMenu() {
|