|
@@ -9,6 +9,7 @@
|
|
|
*/
|
|
|
|
|
|
const moment = require('moment');
|
|
|
+const reviseStatus = require('../const/audit').revise.status;
|
|
|
const measureType = require('../const/tender').measureType;
|
|
|
const scheduleConst = require('../const/schedule');
|
|
|
const billsPosConvert = require('../lib/bills_pos_convert');
|
|
@@ -27,6 +28,17 @@ module.exports = app => {
|
|
|
return lastMonth && lastMonth[0] && lastMonth[0].yearmonth ? lastMonth[0].yearmonth : null;
|
|
|
}
|
|
|
|
|
|
+ async _getLastReviseStatus(ctx) {
|
|
|
+ const lastRevise = await ctx.service.ledgerRevise.getLastestRevise(ctx.tender.id);
|
|
|
+ return (lastRevise && lastRevise.status !== reviseStatus.checked) || false;
|
|
|
+ }
|
|
|
+
|
|
|
+ async _checkScheduleCanModify(ctx) {
|
|
|
+ if (await this._getLastReviseStatus(ctx)) {
|
|
|
+ throw '台账修订中,请勿修改提交进度数据';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async index(ctx) {
|
|
|
try {
|
|
|
const scheduleInfo = await ctx.service.schedule.getDataByCondition({ tid: ctx.tender.id });
|
|
@@ -39,6 +51,7 @@ module.exports = app => {
|
|
|
planMonth: await this._getLastPlanMonth(ctx),
|
|
|
scheduleLedgerList: await this._getSelectedLedgerList(ctx),
|
|
|
preUrl: '/tender/' + ctx.tender.id,
|
|
|
+ revising: await this._getLastReviseStatus(ctx),
|
|
|
};
|
|
|
await this.layout('schedule/index.ejs', renderData, 'schedule/modal.ejs');
|
|
|
} catch (err) {
|
|
@@ -70,6 +83,7 @@ module.exports = app => {
|
|
|
scheduleLedgerList,
|
|
|
hadDataLidList,
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.schedule.ledger),
|
|
|
+ revising: await this._getLastReviseStatus(ctx),
|
|
|
};
|
|
|
await this.layout('schedule/ledger.ejs', renderData);
|
|
|
}
|
|
@@ -88,6 +102,7 @@ module.exports = app => {
|
|
|
mode: scheduleConst.plan_mode,
|
|
|
scheduleLedgerList: await this._getSelectedLedgerList(ctx),
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.schedule.plan),
|
|
|
+ revising: await this._getLastReviseStatus(ctx),
|
|
|
};
|
|
|
await this.layout('schedule/plan.ejs', renderData, 'schedule/plan_modal.ejs');
|
|
|
}
|
|
@@ -150,6 +165,7 @@ module.exports = app => {
|
|
|
yearSlmList,
|
|
|
curYearStageData,
|
|
|
scheduleLedgerList: await this._getSelectedLedgerList(ctx),
|
|
|
+ revising: await this._getLastReviseStatus(ctx),
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.schedule.stageTp),
|
|
|
};
|
|
|
await this.layout('schedule/stage_tp.ejs', renderData, 'schedule/stage_tp_modal.ejs');
|
|
@@ -170,6 +186,7 @@ module.exports = app => {
|
|
|
scheduleStage,
|
|
|
curScheduleStage,
|
|
|
scheduleLedgerList: await this._getSelectedLedgerList(ctx),
|
|
|
+ revising: await this._getLastReviseStatus(ctx),
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.schedule.stageGcl),
|
|
|
};
|
|
|
await this.layout('schedule/stage_gcl.ejs', renderData, 'schedule/stage_gcl_modal.ejs');
|
|
@@ -266,6 +283,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async saveLedger(ctx) {
|
|
|
try {
|
|
|
+ await this._checkScheduleCanModify(ctx);
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
const result = await ctx.service.scheduleLedger.saveLedger(data);
|
|
|
ctx.body = { err: 0, msg: '', data: result };
|
|
@@ -283,6 +301,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async savePlan(ctx) {
|
|
|
try {
|
|
|
+ await this._checkScheduleCanModify(ctx);
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
const responseData = {
|
|
|
err: 0,
|
|
@@ -319,6 +338,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async saveStageTp(ctx) {
|
|
|
try {
|
|
|
+ await this._checkScheduleCanModify(ctx);
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
const responseData = {
|
|
|
err: 0,
|
|
@@ -352,6 +372,7 @@ module.exports = app => {
|
|
|
*/
|
|
|
async saveStageGcl(ctx) {
|
|
|
try {
|
|
|
+ await this._checkScheduleCanModify(ctx);
|
|
|
const data = JSON.parse(ctx.request.body.data);
|
|
|
const responseData = {
|
|
|
err: 0,
|