瀏覽代碼

导入excel,导入项目特征

MaiXinRong 3 月之前
父節點
當前提交
b76c7ac800

+ 1 - 1
app/controller/file_controller.js

@@ -62,7 +62,7 @@ module.exports = app => {
                 renderData.canFiling = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.filing.value) >= 0;
                 renderData.canUpload = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.upload.value) >= 0;
                 renderData.canDelete = ctx.subProject.permission.file_permission.indexOf(ctx.service.subProjPermission.PermissionConst.file.delete.value) >= 0;
-                renderData.fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject);
+                renderData.fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject, ctx.service.subProject.FileReferenceType.file);
                 await this.layout('file/file.ejs', renderData, 'file/file_modal.ejs');
             } catch (err) {
                 ctx.log(err);

+ 2 - 0
app/controller/sub_proj_controller.js

@@ -247,8 +247,10 @@ module.exports = app => {
 
         async progress(ctx) {
             try {
+                const fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject, ctx.service.subProject.FileReferenceType.file);
                 const renderData = {
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.subProject.progress),
+                    fileReferenceList,
                 };
                 await this.layout('sub_proj/progress.ejs', renderData, 'sub_proj/progress_modal.ejs');
             } catch (err) {

+ 3 - 3
app/controller/tender_controller.js

@@ -636,7 +636,7 @@ module.exports = app => {
                 await this.layout('tender/detail.ejs', renderData, 'tender/detail_modal.ejs');
             } catch (error) {
                 this.log(error);
-                this.ctx.redirect('/list');
+                ctx.redirect(`/sp/${ctx.subProject.id}/list`);
             }
         }
 
@@ -744,7 +744,7 @@ module.exports = app => {
             } catch (error) {
                 ctx.helper.log(error);
                 this.postError(error, '设置标段类型错误');
-                ctx.redirect('/list');
+                ctx.redirect(`/sp/${ctx.subProject.id}/list`);
             }
         }
 
@@ -960,7 +960,7 @@ module.exports = app => {
 
         async shenpiSet(ctx) {
             if (ctx.session.sessionUser.is_admin === 0) {
-                ctx.request.headers.referer ? ctx.redirect(ctx.request.headers.referer) : ctx.redirect('/list');
+                ctx.request.headers.referer ? ctx.redirect(ctx.request.headers.referer) : ctx.redirect(`/sp/${ctx.subProject.id}/list`);
             }
             // 获取所有项目参与者
             const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject);

+ 4 - 0
app/lib/analysis_excel.js

@@ -251,6 +251,7 @@ class ImportBaseTree {
         if (!temp.unit_price) temp.unit_price = node.unit_price;
         if (!temp.drawing_code) temp.drawing_code = node.drawing_code;
         if (!temp.memo) temp.memo = node.memo;
+        if (!temp.features) temp.features = node.features;
         if (!temp.total_price) temp.total_price = node.total_price;
     }
 
@@ -545,6 +546,7 @@ class AnalysisExcelTree {
             total_price: {value: ['金额', '合价'], type: colDefineType.match},
             drawing_code: {value: ['图号', '图册号'], type: colDefineType.match},
             memo: {value: ['备注'], type: colDefineType.match},
+            features: {value: ['项目特征'], type: colDefineType.match},
         };
         this.needCols = needCols || ['code', 'b_code', 'pos'];
     }
@@ -578,6 +580,7 @@ class AnalysisExcelTree {
             node.total_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.total_price]), this.decimal.tp);
             node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
             node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
+            node.features = row[this.colsDef.features];
             this.ctx.helper.checkDgnQtyPrecision(node);
             return this.cacheTree.addXmjNode(node);
         } catch (error) {
@@ -613,6 +616,7 @@ class AnalysisExcelTree {
         node.unit_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.unit_price]), this.decimal.up);
         node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
+        node.features = row[this.colsDef.features];
         node.deal_tp = node.deal_qty && node.unit_price ? this.ctx.helper.mul(node.deal_qty, node.unit_price, this.decimal.tp) : 0;
         if (node.quantity && node.unit_price) {
             node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.decimal.tp);

+ 1 - 1
app/middleware/material_check.js

@@ -170,7 +170,7 @@ module.exports = options => {
             }
             // 重定向值标段管理
             if (err === '您无权查看该数据') {
-                this.tender ? this.redirect('/tender/' + this.tender.id + '/measure/material') : this.redirect('/list');
+                this.tender ? this.redirect('/tender/' + this.tender.id + '/measure/material') : this.redirect(`/sp/${ctx.subProject.id}/list`);
             }
             this.redirect(this.request.headers.referer);
         }

+ 1 - 1
app/middleware/revise_check.js

@@ -64,7 +64,7 @@ module.exports = options => {
                 if (this.helper.isWap(this.request)) {
                     this.redirect('/wap/list');
                 } else {
-                    err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect('/list');
+                    err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect(`/sp/${ctx.subProject.id}/list`);
                 }
             }
         }

+ 1 - 1
app/middleware/schedule_check.js

@@ -36,7 +36,7 @@ module.exports = options => {
             if (this.helper.isWap(this.request)) {
                 this.redirect('/wap/list');
             } else {
-                err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect('/list');
+                err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect(`/sp/${ctx.subProject.id}/list`);
             }
         }
     };

+ 3 - 1
app/middleware/tender_check.js

@@ -154,7 +154,9 @@ module.exports = options => {
                 if (this.helper.isWap(this.request)) {
                     this.redirect('/wap/list');
                 } else {
-                    err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect('/list');
+                    err === '您无权查看该内容'
+                        ? this.redirect(this.request.headers.referer)
+                        : (this.tender && this.tender.spid ? this.redirect(`/sp/${this.tender.spid}/list`) : this.redirect('/subproj'));
                 }
             }
         }

+ 1 - 1
app/middleware/uncheck_tender_check.js

@@ -57,7 +57,7 @@ module.exports = options => {
                 if (this.helper.isWap(this.request)) {
                     this.redirect('/wap/list');
                 } else {
-                    err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect('/list');
+                    err === '您无权查看该内容' ? this.redirect(this.request.headers.referer) : this.redirect(`/sp/${ctx.subProject.id}/list`);
                 }
             }
         }

+ 1 - 0
app/service/ledger.js

@@ -692,6 +692,7 @@ module.exports = app => {
                         dgn_qty1: node.dgn_qty1,
                         dgn_qty2: node.dgn_qty2,
                         memo: node.memo,
+                        features: node.features || '',
                         drawing_code: node.drawing_code,
                         node_type: node.node_type,
                         // 项目节不导入金额

+ 8 - 2
app/service/sub_project.js

@@ -36,6 +36,8 @@ module.exports = app => {
         constructor(ctx) {
             super(ctx);
             this.tableName = 'sub_project';
+            // const fileType = [{ key: 'file', value: 1, name: '资料归集'}, { key: 'info_progress', value: 2, name: '项目概况-阶段进度'}]
+            this.FileReferenceType = { file: 1, info_progress: 2};
         }
 
         /**
@@ -548,8 +550,12 @@ module.exports = app => {
             return this._filterEmptyFolder(result);
         }
 
-        async getFileReference(subProject) {
-            return await this.db.query(`SELECT id, name FROM zh_file_reference_list`);
+        async getFileReference(subProject, file_type) {
+            if (file_type) {
+                return await this.db.query(`SELECT id, name FROM zh_file_reference_list WHERE file_type = ?`, [file_type]);
+            } else {
+                return await this.db.query(`SELECT id, name FROM zh_file_reference_list`);
+            }
         };
 
         getPageShow(page_show) {

+ 4 - 0
sql/update.sql

@@ -39,6 +39,10 @@ ADD COLUMN `fund_pay_permission` varchar(255) NOT NULL DEFAULT '' COMMENT '资
 ADD COLUMN `contract_permission` varchar(255) NOT NULL DEFAULT '' COMMENT '合同管理,权限id列表(\',\'分隔)' AFTER `fund_pay_permission`,
 ADD COLUMN `datacollect_permission` varchar(255) NOT NULL DEFAULT '' COMMENT '决策大屏,权限id列表(\',\'分隔)' AFTER `contract_permission`;
 
+ALTER TABLE `calculation`.`zh_file_reference_list`
+ADD COLUMN `file_type` tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '文件类型' AFTER `remark`,
+ADD COLUMN `file_type_str` varchar(50) NOT NULL DEFAULT '资料归集' COMMENT '文件类型-文本' AFTER `file_type`;
+
 ------------------------------------
 -- 表数据
 ------------------------------------