|
@@ -9,6 +9,7 @@ function getTenderId() {
|
|
|
return window.location.pathname.split('/')[2];
|
|
|
}
|
|
|
const selects = [];
|
|
|
+let slh = [];
|
|
|
$(function () {
|
|
|
autoFlashHeight();
|
|
|
// 初始化台账
|
|
@@ -77,6 +78,8 @@ $(function () {
|
|
|
node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
|
|
|
}
|
|
|
});
|
|
|
+ // slh = _.map(data.slh, 'ledger_id');
|
|
|
+ slh = data.slh;
|
|
|
const datas = addIsSelect(data.bills);
|
|
|
baseLedgerTree.loadDatas(datas);
|
|
|
treeCalc.calculateAll(baseLedgerTree);
|
|
@@ -149,6 +152,9 @@ $(function () {
|
|
|
});
|
|
|
},
|
|
|
buttonClicked: function (e, info) {
|
|
|
+ if(revising) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (info.sheet.zh_setting) {
|
|
|
const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
@@ -194,6 +200,46 @@ $(function () {
|
|
|
return;
|
|
|
}
|
|
|
$(this).attr('disabled', true);
|
|
|
+ const [under_ledger, parent_ledger] = getPAndULedger(select_ledger);
|
|
|
+ postData(window.location.pathname + '/save', { select_ledger: _.map(select_ledger, 'ledger_id'), under_ledger, parent_ledger } , function (result) {
|
|
|
+ toastr.success('设置成功');
|
|
|
+ setTimeout(function () {
|
|
|
+ window.location.reload();
|
|
|
+ },1500);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ $('#update-ledger').click(function () {
|
|
|
+ const addLedgerData = _.map(_.differenceBy(ledgerTree.nodes, slh, 'ledger_id'), 'ledger_id');
|
|
|
+ const select_ledger = _.filter(ledgerTree.nodes, { 'is_select': 1 });
|
|
|
+ // 找出addLedgerData父节点并一起加入到select_ledger中
|
|
|
+ if (addLedgerData.length > 0) {
|
|
|
+ for (const a of addLedgerData) {
|
|
|
+ const ainfo = _.find(ledgerTree.nodes, { 'ledger_id': a });
|
|
|
+ select_ledger.push(ainfo);
|
|
|
+ findandpush(ainfo.ledger_pid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function findandpush(ledger) {
|
|
|
+ const parent = _.find(ledgerTree.nodes, { ledger_id: ledger });
|
|
|
+ if (parent) {
|
|
|
+ const hadinfo = _.find(select_ledger, { ledger_id: parent.ledger_id });
|
|
|
+ if (!hadinfo) {
|
|
|
+ select_ledger.push(parent);
|
|
|
+ findandpush(parent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(this).attr('disabled', true);
|
|
|
+ const [under_ledger, parent_ledger] = getPAndULedger(select_ledger);
|
|
|
+ postData(window.location.pathname + '/save', { select_ledger: _.map(select_ledger, 'ledger_id'), under_ledger, parent_ledger } , function (result) {
|
|
|
+ toastr.success('进度台账数据修正成功');
|
|
|
+ setTimeout(function () {
|
|
|
+ window.location.reload();
|
|
|
+ },1500);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function getPAndULedger(select_ledger) {
|
|
|
// 找出所选的最底层,并统计总设计金额用
|
|
|
const under_ledger = [];
|
|
|
for (const sl of select_ledger) {
|
|
@@ -218,13 +264,8 @@ $(function () {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- postData(window.location.pathname + '/save', { select_ledger: _.map(select_ledger, 'ledger_id'), under_ledger, parent_ledger } , function (result) {
|
|
|
- toastr.success('设置成功');
|
|
|
- setTimeout(function () {
|
|
|
- window.location.reload();
|
|
|
- },1500);
|
|
|
- });
|
|
|
- });
|
|
|
+ return [under_ledger, parent_ledger];
|
|
|
+ }
|
|
|
|
|
|
$.subMenu({
|
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
@@ -304,9 +345,6 @@ function updateParentCanSelect(datas, ledger_pid) {
|
|
|
}
|
|
|
|
|
|
function updateChildrenSelect(datas, is_select) {
|
|
|
- if(revising) {
|
|
|
- return;
|
|
|
- }
|
|
|
for (const data of datas) {
|
|
|
if (data.can_select) {
|
|
|
data.is_select = is_select;
|
|
@@ -319,9 +357,6 @@ function updateChildrenSelect(datas, is_select) {
|
|
|
}
|
|
|
|
|
|
function updateSiblingsSelect(tree, pid, is_select, select_msg) {
|
|
|
- if(revising) {
|
|
|
- return;
|
|
|
- }
|
|
|
const parent = pid !== -1 ? _.find(tree.nodes, { 'ledger_id': pid }) : tree;
|
|
|
if (parent) {
|
|
|
for(const d of parent.children) {
|
|
@@ -338,9 +373,6 @@ function updateSiblingsSelect(tree, pid, is_select, select_msg) {
|
|
|
}
|
|
|
|
|
|
function updateOtherSiblingsSelect(tree, pid, is_select, select_msg) {
|
|
|
- if(revising) {
|
|
|
- return;
|
|
|
- }
|
|
|
if(pid === -1) {
|
|
|
return;
|
|
|
}
|
|
@@ -376,9 +408,6 @@ function updateOtherSiblingsSelect(tree, pid, is_select, select_msg) {
|
|
|
}
|
|
|
|
|
|
function updateParentSelect(tree, pid, is_select) {
|
|
|
- if(revising) {
|
|
|
- return;
|
|
|
- }
|
|
|
if (pid !== -1) {
|
|
|
const parent = _.find(tree.nodes, { 'ledger_id': pid });
|
|
|
if (parent) {
|