|
@@ -2034,7 +2034,6 @@ $(document).ready(function() {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
- SpreadJsObj.forbiddenSpreadContextMenu(selector, this.spread);
|
|
|
$('#upload-deal-bills').click(function () {
|
|
|
const file = $('#deal-bills-file')[0];
|
|
|
const formData = new FormData();
|
|
@@ -2047,6 +2046,42 @@ $(document).ready(function() {
|
|
|
$('#upload-deal').modal('hide');
|
|
|
});
|
|
|
});
|
|
|
+ if (!readOnly) {
|
|
|
+ $.contextMenu({
|
|
|
+ selector: selector,
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, self.spread);
|
|
|
+ return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ apply: {
|
|
|
+ name: '应用全部清单单价至台账',
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const sheet = self.spread.getActiveSheet();
|
|
|
+ return sheet.getRowCount() === 0;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ const datas = [], sourceData = self.spread.getActiveSheet().zh_data;
|
|
|
+ for (const db of sourceData) {
|
|
|
+ const targets = ledgerTree.nodes.filter(function (x) {
|
|
|
+ return x.b_code === db.code && x.name === db.name && x.unit === db.unit;
|
|
|
+ });
|
|
|
+ for (const t of targets) {
|
|
|
+ if (t.children && t.children.length > 0) continue;
|
|
|
+ const data = ledgerTree.getNodeKeyData(t);
|
|
|
+ data.unit_price = db.unit_price;
|
|
|
+ datas.push(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
+ const refreshNode = ledgerTree.loadPostData(result);
|
|
|
+ treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
loadData () {
|
|
|
const self = this;
|