|  | @@ -424,10 +424,6 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  | -                const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
 | 
	
		
			
				|  |  | -                    ? JSON.parse(accountInfo.permission) : null;
 | 
	
		
			
				|  |  | -                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 工程变更类别读取
 | 
	
		
			
				|  |  |                  const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
 | 
	
	
		
			
				|  | @@ -436,6 +432,9 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取用户人验证手机号
 | 
	
		
			
				|  |  |                  const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  |                  const auth_mobile = pa.auth_mobile;
 | 
	
		
			
				|  |  | +                const userPermission = pa !== undefined && pa.permission !== ''
 | 
	
		
			
				|  |  | +                    ? JSON.parse(pa.permission) : null;
 | 
	
		
			
				|  |  | +                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |                  const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
 | 
	
		
			
				|  |  |                  const settleBills = ctx.change.readySettle ? await ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: ctx.change.readySettle.id } }) : [];
 | 
	
		
			
				|  |  |                  const settlePos = ctx.change.readySettle ? await ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: ctx.change.readySettle.id } }) : [];
 | 
	
	
		
			
				|  | @@ -555,6 +554,40 @@ module.exports = app => {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  | +         * 变更关联数据 - 操作 (Ajax)
 | 
	
		
			
				|  |  | +         * @param ctx
 | 
	
		
			
				|  |  | +         * @return {Promise<void>}
 | 
	
		
			
				|  |  | +         */
 | 
	
		
			
				|  |  | +        async relation(ctx) {
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                // await this._getChangeAuditViewData(ctx);
 | 
	
		
			
				|  |  | +                const tender = ctx.tender;
 | 
	
		
			
				|  |  | +                const change = ctx.change;
 | 
	
		
			
				|  |  | +                const renderData = {
 | 
	
		
			
				|  |  | +                    tender,
 | 
	
		
			
				|  |  | +                    change,
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                renderData.changePlanInfo = null;
 | 
	
		
			
				|  |  | +                renderData.changeApplyInfo = null;
 | 
	
		
			
				|  |  | +                renderData.changeProjectInfo = null;
 | 
	
		
			
				|  |  | +                if (change.plan_code) {
 | 
	
		
			
				|  |  | +                    renderData.changePlanInfo = await ctx.service.changePlan.getDataByCondition({ tid: tender.id, code: change.plan_code });
 | 
	
		
			
				|  |  | +                    if (renderData.changePlanInfo && renderData.changePlanInfo.apply_code) {
 | 
	
		
			
				|  |  | +                        renderData.changeApplyInfo = await ctx.service.changeApply.getDataByCondition({ tid: tender.id, code: renderData.changePlanInfo.apply_code });
 | 
	
		
			
				|  |  | +                        if (renderData.changeApplyInfo && renderData.changeApplyInfo.project_code) {
 | 
	
		
			
				|  |  | +                            renderData.changeProjectInfo = await ctx.service.changeProject.getDataByCondition({ tid: tender.id, code: renderData.changeApplyInfo.project_code });
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                await this.layout('change/relation.ejs', renderData);
 | 
	
		
			
				|  |  | +            } catch (err) {
 | 
	
		
			
				|  |  | +                this.log(err);
 | 
	
		
			
				|  |  | +                ctx.session.postError = err.toString();
 | 
	
		
			
				|  |  | +                ctx.redirect('/tender/' + ctx.params.id + '/change');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        /**
 | 
	
		
			
				|  |  |           * 变更清单 - 操作 (Ajax)
 | 
	
		
			
				|  |  |           * @param ctx
 | 
	
		
			
				|  |  |           * @return {Promise<void>}
 | 
	
	
		
			
				|  | @@ -2138,6 +2171,9 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取用户人验证手机号
 | 
	
		
			
				|  |  |                  const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  |                  const auth_mobile = pa.auth_mobile;
 | 
	
		
			
				|  |  | +                const userPermission = pa !== undefined && pa.permission !== ''
 | 
	
		
			
				|  |  | +                    ? JSON.parse(pa.permission) : null;
 | 
	
		
			
				|  |  | +                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |                  // 判断并更新
 | 
	
		
			
				|  |  |                  const renderData = {
 | 
	
		
			
				|  |  |                      tender: ctx.tender,
 | 
	
	
		
			
				|  | @@ -2148,6 +2184,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      fileList,
 | 
	
		
			
				|  |  |                      whiteList,
 | 
	
		
			
				|  |  |                      authMobile: auth_mobile,
 | 
	
		
			
				|  |  | +                    deleteFilePermission,
 | 
	
		
			
				|  |  |                      auditType,
 | 
	
		
			
				|  |  |                      shenpiConst,
 | 
	
		
			
				|  |  |                      returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/project') ? ctx.request.headers.referer : null,
 | 
	
	
		
			
				|  | @@ -2521,10 +2558,10 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      throw '数据错误';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
 | 
	
		
			
				|  |  | -                    throw '您无权上报该期数据';
 | 
	
		
			
				|  |  | +                    throw '您无权上报该变更立项数据';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
 | 
	
		
			
				|  |  | -                    throw '该材料调差期数据当前无法上报';
 | 
	
		
			
				|  |  | +                    throw '该变更立项数据当前无法上报';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  await ctx.service.changeProjectAudit.start(ctx.change.id, ctx.change.times);
 | 
	
	
		
			
				|  | @@ -2546,7 +2583,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  const auditConst = audit.changeProject;
 | 
	
		
			
				|  |  |                  if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
 | 
	
		
			
				|  |  | -                    throw '当前材料调差期数据有误';
 | 
	
		
			
				|  |  | +                    throw '当前变更立项数据有误';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.curAuditorIds.length === 0 || ctx.change.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) === -1) {
 | 
	
		
			
				|  |  |                      throw '您无权进行该操作';
 | 
	
	
		
			
				|  | @@ -2990,6 +3027,9 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取用户人验证手机号
 | 
	
		
			
				|  |  |                  const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  |                  const auth_mobile = pa.auth_mobile;
 | 
	
		
			
				|  |  | +                const userPermission = pa !== undefined && pa.permission !== ''
 | 
	
		
			
				|  |  | +                    ? JSON.parse(pa.permission) : null;
 | 
	
		
			
				|  |  | +                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |                  const renderData = {
 | 
	
		
			
				|  |  |                      tender,
 | 
	
		
			
				|  |  |                      change: ctx.change,
 | 
	
	
		
			
				|  | @@ -3001,6 +3041,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      fileList,
 | 
	
		
			
				|  |  |                      whiteList,
 | 
	
		
			
				|  |  |                      authMobile: auth_mobile,
 | 
	
		
			
				|  |  | +                    deleteFilePermission,
 | 
	
		
			
				|  |  |                      auditType,
 | 
	
		
			
				|  |  |                      shenpiConst,
 | 
	
		
			
				|  |  |                      tpUnit: ctx.change.decimal ? ctx.change.decimal.tp : ctx.tender.info.decimal.tp,
 | 
	
	
		
			
				|  | @@ -3042,6 +3083,10 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取附件列表
 | 
	
		
			
				|  |  |                  const fileList = await ctx.service.changeApplyAtt.getAllChangeApplyAtt(ctx.tender.id, ctx.change.id);
 | 
	
		
			
				|  |  |                  await this._getChangeApplyAuditViewData(ctx);
 | 
	
		
			
				|  |  | +                const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  | +                const userPermission = pa !== undefined && pa.permission !== ''
 | 
	
		
			
				|  |  | +                    ? JSON.parse(pa.permission) : null;
 | 
	
		
			
				|  |  | +                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |                  const renderData = {
 | 
	
		
			
				|  |  |                      tender,
 | 
	
		
			
				|  |  |                      change: ctx.change,
 | 
	
	
		
			
				|  | @@ -3051,6 +3096,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      returnUrl: this.app._.includes(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/apply') ? ctx.request.headers.referer : null,
 | 
	
		
			
				|  |  |                      jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.apply_information_notice),
 | 
	
		
			
				|  |  |                      preUrl: '/tender/' + ctx.tender.id + '/change/apply/' + ctx.change.id + '/information/notice',
 | 
	
		
			
				|  |  | +                    deleteFilePermission,
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  await this.layout('change/apply_information_notice.ejs', renderData, 'change/apply_information_notice_modal.ejs');
 | 
	
		
			
				|  |  |              } catch (err) {
 | 
	
	
		
			
				|  | @@ -3314,10 +3360,10 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      throw '数据错误';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
 | 
	
		
			
				|  |  | -                    throw '您无权上报该期数据';
 | 
	
		
			
				|  |  | +                    throw '您无权上报该变更申请数据';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
 | 
	
		
			
				|  |  | -                    throw '该材料调差期数据当前无法上报';
 | 
	
		
			
				|  |  | +                    throw '该变更申请数据当前无法上报';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  await ctx.service.changeApplyAudit.start(ctx.change.id, ctx.change.times);
 | 
	
	
		
			
				|  | @@ -3339,7 +3385,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  const auditConst = audit.changeApply;
 | 
	
		
			
				|  |  |                  if (!ctx.change || ctx.change.status !== auditConst.status.checking) {
 | 
	
		
			
				|  |  | -                    throw '当前材料调差期数据有误';
 | 
	
		
			
				|  |  | +                    throw '当前变更申请数据有误';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.curAuditorIds.length === 0 || ctx.change.curAuditorIds.indexOf(ctx.session.sessionUser.accountId) === -1) {
 | 
	
		
			
				|  |  |                      throw '您无权进行该操作';
 | 
	
	
		
			
				|  | @@ -3816,6 +3862,9 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                  // 获取用户人验证手机号
 | 
	
		
			
				|  |  |                  const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
 | 
	
		
			
				|  |  |                  const auth_mobile = pa.auth_mobile;
 | 
	
		
			
				|  |  | +                const userPermission = pa !== undefined && pa.permission !== ''
 | 
	
		
			
				|  |  | +                    ? JSON.parse(pa.permission) : null;
 | 
	
		
			
				|  |  | +                const deleteFilePermission = userPermission && userPermission.change !== undefined && userPermission.change.indexOf('2') !== -1;
 | 
	
		
			
				|  |  |                  const changeClass = await this._getOrUpdateClass(ctx, 'changePlan');
 | 
	
		
			
				|  |  |                  const renderData = {
 | 
	
		
			
				|  |  |                      tender,
 | 
	
	
		
			
				|  | @@ -3828,6 +3877,7 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      fileList,
 | 
	
		
			
				|  |  |                      whiteList,
 | 
	
		
			
				|  |  |                      authMobile: auth_mobile,
 | 
	
		
			
				|  |  | +                    deleteFilePermission,
 | 
	
		
			
				|  |  |                      auditType,
 | 
	
		
			
				|  |  |                      shenpiConst,
 | 
	
		
			
				|  |  |                      tpUnit: ctx.change.decimal ? ctx.change.decimal.tp : ctx.tender.info.decimal.tp,
 | 
	
	
		
			
				|  | @@ -4130,10 +4180,10 @@ module.exports = app => {
 | 
	
		
			
				|  |  |                      throw '数据错误';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.uid !== ctx.session.sessionUser.accountId) {
 | 
	
		
			
				|  |  | -                    throw '您无权上报该期数据';
 | 
	
		
			
				|  |  | +                    throw '您无权上报该变更方案数据';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  if (ctx.change.status === auditConst.status.checking || ctx.change.status === auditConst.status.checked) {
 | 
	
		
			
				|  |  | -                    throw '该材料调差期数据当前无法上报';
 | 
	
		
			
				|  |  | +                    throw '该变更方案数据当前无法上报';
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  await ctx.service.changePlanAudit.start(ctx.change.id, ctx.change.times);
 |