| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | 
							- 'use strict';
 
- /**
 
-  *
 
-  *
 
-  * @author Mai
 
-  * @date
 
-  * @version
 
-  */
 
- module.exports = options => {
 
-     /**
 
-      * 标段校验 中间件
 
-      * 1. 读取标段数据(包括属性)
 
-      * 2. 检验用户是否可见标段(不校验具体权限)
 
-      *
 
-      * @param {function} next - 中间件继续执行的方法
 
-      * @return {void}
 
-      */
 
-     return function* budgetCheck(next) {
 
-         try {
 
-             if (!this.subProject.page_show.openBudget) {
 
-                 throw '该功能已关闭或无法查看';
 
-             }
 
-             // 读取标段数据
 
-             this.budget = yield this.service.budget.getCurBudget(this.subProject.budget_id);
 
-             this.budget.name = this.subProject.name || '';
 
-             if (!this.budget) throw '未设置概预算标准';
 
-             if (this.budget.pid !== this.session.sessionProject.id) throw '您无权查看该项目';
 
-             this.budget.readOnly = this.subProject.permission.budget_permission.indexOf(this.service.subProjPermission.PermissionConst.budget.edit.value) < 0;
 
-             yield next;
 
-         } catch (err) {
 
-             this.log(err);
 
-             if (this.helper.isAjax(this.request)) {
 
-                 this.ajaxErrorBody(err, '概算投资项目未知错误');
 
-             } else {
 
-                 this.postError(err, '概算投资项目未知错误');
 
-                 err === '该功能已关闭或无法查看' ? this.redirect(`/sp/${this.subProject.id}/dashboard`) : this.redirect(this.request.headers.referer);
 
-             }
 
-         }
 
-     };
 
- };
 
 
  |