|
@@ -3019,6 +3019,68 @@ $(document).ready(() => {
|
|
|
setting.reloadObj.click(function() {
|
|
|
self.reloadChangeData();
|
|
|
});
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#' + setting.changeBillsObj.attr('id'),
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, self.changeBillsSpread);
|
|
|
+ return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ 'locateZjjl': {
|
|
|
+ name: '定位至台账',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const checkPosMatch = function (bills, posName) {
|
|
|
+ const posRange = stagePos.getLedgerPos(p.id);
|
|
|
+ for (const pr of posRange) {
|
|
|
+ if (pr.name === posName) return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+ const checkBillsMatch = function (bills, checkData, posName) {
|
|
|
+ if (bills.children && bills.children.length > 0) return false;
|
|
|
+ const billsCheckData = {
|
|
|
+ b_code: bills.b_code || '',
|
|
|
+ name: bills.name || '',
|
|
|
+ unit: bills.unit || '',
|
|
|
+ unit_price: bills.unit_price || 0,
|
|
|
+ };
|
|
|
+ if (!_.isMatch(checkData, billsCheckData)) return false;
|
|
|
+ return !posName || checkPosMatch(bills, posName);
|
|
|
+ };
|
|
|
+ const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
|
|
|
+ const cb = {
|
|
|
+ b_code: changeBills.code || '',
|
|
|
+ name: changeBills.name || '',
|
|
|
+ unit: changeBills.unit || '',
|
|
|
+ unit_price: changeBills.unit_price || 0,
|
|
|
+ };
|
|
|
+ if (changeBills.lid) {
|
|
|
+ const node = stageTree.nodes.find(x => {return x.id === changeBills.lid});
|
|
|
+ const posterity = stageTree.getPosterity(node) || [];
|
|
|
+ posterity.unshift(node);
|
|
|
+ for (const p of posterity) {
|
|
|
+ if (checkBillsMatch(p, cb, changeBills.detail)) {
|
|
|
+ SpreadJsObj.locateTreeNode(slSpread.getActiveSheet(), p.ledger_id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (const node of stageTree.nodes) {
|
|
|
+ if (checkBillsMatch(node, cb, changeBills.detail)) {
|
|
|
+ SpreadJsObj.locateTreeNode(slSpread.getActiveSheet(), p.ledger_id);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const changeBills = SpreadJsObj.getSelectObject(self.changeBillsSheet);
|
|
|
+ return !changeBills;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
loadChangeDetailData() {
|
|
|
const change = SpreadJsObj.getSelectObject(this.changeSheet);
|