|
@@ -397,11 +397,14 @@ $(function () {
|
|
|
$('.mode-select').on('click', function () {
|
|
|
const _self = $(this);
|
|
|
const this_mode = _self.data('mode');
|
|
|
- // 重新计算所有月份数据
|
|
|
+ // 重新计算所有未使用的月份数据
|
|
|
const under_ledger = _.filter(ledgerTree.nodes, { is_leaf: true});
|
|
|
const update_nodes = [];
|
|
|
+ const newMonthList = _.map(_.filter(scheduleMonth, function (item) {
|
|
|
+ return item.stage_gcl_used === 0 && item.stage_tp_used === 0;
|
|
|
+ }), 'yearmonth');
|
|
|
for (const ul of under_ledger) {
|
|
|
- for (const m of monthList) {
|
|
|
+ for (const m of newMonthList) {
|
|
|
if (ul[m+'_tp'] || ul[m+'_gcl']) {
|
|
|
update_nodes.push(ul);
|
|
|
break;
|
|
@@ -412,14 +415,14 @@ $(function () {
|
|
|
if(update_nodes.length > 0) {
|
|
|
for (const un of update_nodes) {
|
|
|
if (this_mode === mode.gcl) {
|
|
|
- for (const m of monthList) {
|
|
|
+ for (const m of newMonthList) {
|
|
|
if(un[m+'_tp']) {
|
|
|
un[m+'_tp'] = un.dgn_price && un.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(un[m+'_gcl'], un.dgn_price), 0) : 0;
|
|
|
update_under_ledger.push({lid: un.ledger_id, yearmonth: m, plan_tp: un[m+'_tp'], plan_gcl: un[m+'_gcl']});
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- for (const m of monthList) {
|
|
|
+ for (const m of newMonthList) {
|
|
|
if(un[m+'_gcl']) {
|
|
|
un[m+'_gcl'] = un.dgn_price && un.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(un[m+'_tp'], un.dgn_price), 3) : 0;
|
|
|
update_under_ledger.push({lid: un.ledger_id, yearmonth: m, plan_tp: un[m+'_tp'], plan_gcl: un[m+'_gcl']});
|