Преглед на файлове

金额模式计划月数据修正

laiguoran преди 4 години
родител
ревизия
bdb4753a44
променени са 5 файла, в които са добавени 26 реда и са изтрити 23 реда
  1. 14 10
      app/controller/schedule_controller.js
  2. 0 1
      app/middleware/stage_check.js
  3. 3 3
      app/public/js/schedule_stage_gcl.js
  4. 8 8
      app/public/js/schedule_stage_tp.js
  5. 1 1
      app/view/schedule/ledger.ejs

+ 14 - 10
app/controller/schedule_controller.js

@@ -108,18 +108,19 @@ module.exports = app => {
                 curScheduleStage = _.find(scheduleStage, { order: parseInt(ctx.params.order) });
             }
             if (curScheduleStage) {
-                const newSS = _.sortBy(scheduleStage, 'yearmonth');
-                const nowScheduleStage = _.findIndex(newSS, { yearmonth: curScheduleStage.yearmonth });
+                // const newSS = _.sortBy(scheduleStage, 'yearmonth');
+                const newSM = _.sortBy(scheduleMonth, 'yearmonth');
+                const nowScheduleStage = _.findIndex(newSM, { yearmonth: curScheduleStage.yearmonth });
                 slmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: curScheduleStage.yearmonth } });
-                const nextScheduleStage = nowScheduleStage >= 0 && nowScheduleStage + 1 <= newSS.length - 1 ? newSS[nowScheduleStage + 1] : null;
+                const nextScheduleStage = nowScheduleStage >= 0 && nowScheduleStage + 1 <= newSM.length - 1 ? newSM[nowScheduleStage + 1] : null;
                 if (nextScheduleStage) nextSlmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: nextScheduleStage.yearmonth } });
                 if (nowScheduleStage === 0) {
                     endSlmList = slmList;
                 } else if (nowScheduleStage > 0) {
-                    const endYearmonthCollection = _.map(_.take(newSS, nowScheduleStage + 1), 'yearmonth');
+                    const endYearmonthCollection = _.map(_.take(newSM, nowScheduleStage + 1), 'yearmonth');
                     endSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, endYearmonthCollection);
                 }
-                const yearConllection = _.map(_.filter(newSS, function(item) {
+                const yearConllection = _.map(_.filter(newSM, function(item) {
                     return item.yearmonth.indexOf(curScheduleStage.yearmonth.split('-')[0]) !== -1;
                 }), 'yearmonth');
                 yearSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, yearConllection);
@@ -128,6 +129,7 @@ module.exports = app => {
                 const stageList = _.filter(stageOrderList, function(item) {
                     return item.s_time.indexOf(curStage.s_time.split('-')[0]) !== -1;
                 });
+                const newSS = _.sortBy(scheduleStage, 'yearmonth');
                 const stageIdList = _.map(_.filter(stageList, function(item) {
                     return _.find(newSS, { order: item.order });
                 }), 'id');
@@ -184,6 +186,7 @@ module.exports = app => {
                 const tender = ctx.tender;
                 // const ledgerData = await ctx.controller.stage._getStageLedgerData(ctx);
                 // console.log(ledgerData);
+                const scheduleMonth = await ctx.service.scheduleMonth.getAllDataByCondition({ where: { tid: tender.id }, orders: [['yearmonth', 'asc']] });
                 const stageOrderList = await ctx.service.stage.getAllDataByCondition({ columns: ['id', 's_time', 'order'], where: { tid: tender.id } });
                 const scheduleStage = await ctx.service.scheduleStage.getAllDataByCondition({ where: { tid: tender.id }, orders: [['order', 'desc']] });
                 const curScheduleStage = _.find(scheduleStage, { order: parseInt(ctx.params.order) });
@@ -193,18 +196,18 @@ module.exports = app => {
                 let yearSlmList = [];
                 let curYearStageData = [];
                 if (curScheduleStage) {
-                    const newSS = _.sortBy(scheduleStage, 'yearmonth');
-                    const nowScheduleStage = _.findIndex(newSS, { yearmonth: curScheduleStage.yearmonth });
+                    const newSM = _.sortBy(scheduleMonth, 'yearmonth');
+                    const nowScheduleStage = _.findIndex(newSM, { yearmonth: curScheduleStage.yearmonth });
                     slmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: curScheduleStage.yearmonth } });
-                    const nextScheduleStage = nowScheduleStage >= 0 && nowScheduleStage + 1 <= newSS.length - 1 ? newSS[nowScheduleStage + 1] : null;
+                    const nextScheduleStage = nowScheduleStage >= 0 && nowScheduleStage + 1 <= newSM.length - 1 ? newSM[nowScheduleStage + 1] : null;
                     if (nextScheduleStage) nextSlmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: nextScheduleStage.yearmonth } });
                     if (nowScheduleStage === 0) {
                         endSlmList = slmList;
                     } else if (nowScheduleStage > 0) {
-                        const endYearmonthCollection = _.map(_.take(newSS, nowScheduleStage + 1), 'yearmonth');
+                        const endYearmonthCollection = _.map(_.take(newSM, nowScheduleStage + 1), 'yearmonth');
                         endSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, endYearmonthCollection);
                     }
-                    const yearConllection = _.map(_.filter(newSS, function(item) {
+                    const yearConllection = _.map(_.filter(newSM, function(item) {
                         return item.yearmonth.indexOf(curScheduleStage.yearmonth.split('-')[0]) !== -1;
                     }), 'yearmonth');
                     yearSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, yearConllection);
@@ -213,6 +216,7 @@ module.exports = app => {
                     const stageList = _.filter(stageOrderList, function(item) {
                         return item.s_time.indexOf(curStage.s_time.split('-')[0]) !== -1;
                     });
+                    const newSS = _.sortBy(scheduleStage, 'yearmonth');
                     const stageIdList = _.map(_.filter(stageList, function(item) {
                         return _.find(newSS, { order: item.order });
                     }), 'id');

+ 0 - 1
app/middleware/stage_check.js

@@ -62,7 +62,6 @@ module.exports = options => {
             // todo 校验权限 (标段参与人、分享)
             // 因为进度需要,暂时先处理所有accountId都为原报本人,才能获取到所有期数据,之后调整吧
             const data = this.request.body.data ? JSON.parse(this.request.body.data) : null;
-            console.log(data);
             const accountId = data && data.comefrom && data.comefrom === 'schedule' ? stage.user_id : this.session.sessionUser.accountId,
                 auditorIds = _.map(stage.auditors, 'aid'),
                 shareIds = [];

+ 3 - 3
app/public/js/schedule_stage_gcl.js

@@ -37,7 +37,7 @@ $(function () {
         {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
         {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
         {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
     ];
 
     const ledgerSpreadSetting = {
@@ -60,9 +60,9 @@ $(function () {
             if (sm.stage_gcl_used === 1) {
                 const yearmonth = sm.yearmonth.split('-')[0] + '年' + parseInt(sm.yearmonth.split('-')[1]) + '月';
                 const cols = {title: yearmonth + '|计划工程量', colSpan: '4|1', rowSpan: '1|1', field: sm.yearmonth+'_plan_gcl', hAlign: 2, width: 90, type: 'Number', readOnly: true};
-                const cols2 = {title: '|计划金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_plan_tp', hAlign: 2, width: 90, type: 'Number', readOnly: true};
+                const cols2 = {title: '|计划金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_plan_tp', hAlign: 2, width: 90, type: 'Number', readOnly: true};
                 const cols3 = {title: '|计量工程量', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_sj_gcl', hAlign: 2, width: 90, type: 'Number', readOnly: 'readOnly.gcl'};
-                const cols4 = {title: '|计量金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_sj_tp', hAlign: 2, width: 90, type: 'Number', readOnly : true};
+                const cols4 = {title: '|计量金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_sj_tp', hAlign: 2, width: 90, type: 'Number', readOnly : true};
                 monthsCols.push(cols);
                 monthsCols.push(cols2);
                 monthsCols.push(cols3);

+ 8 - 8
app/public/js/schedule_stage_tp.js

@@ -35,21 +35,21 @@ $(function () {
         {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
         {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
         {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '自开工至本月计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'end_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'end_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'end_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '截止本期完成计量|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '本年计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'year_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'year_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '本年累计完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_contract_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'year_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'year_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '本月计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '本期完成计量|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
         {title: '下月计划|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'next_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
-        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'next_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'next_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
     ];
 
     const ledgerSpreadSetting = {

+ 1 - 1
app/view/schedule/ledger.ejs

@@ -15,7 +15,7 @@
                 <div class="d-inline-block">
                     <a class="btn btn-sm btn-light">
                         <div class="custom-control custom-checkbox">
-                            <input type="checkbox" class="custom-control-input" id="select_other_siblings">
+                            <input type="checkbox" class="custom-control-input" id="select_other_siblings" checked>
                             <label class="custom-control-label text-primary" for="select_other_siblings">跨级选择同级项</label>
                         </div>
                     </a>