فهرست منبع

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

Conflicts:
	sql/update.sql
TonyKang 5 سال پیش
والد
کامیت
ad833ec090

+ 2 - 2
app/controller/stage_extra_controller.js

@@ -49,7 +49,7 @@ module.exports = app => {
          */
         async loadJgcl (ctx) {
             try {
-                const data = await ctx.service.stageJgcl.getStageData(ctx.stage.id);
+                const data = await ctx.service.stageJgcl.getStageData(ctx.stage);
                 const preData = await ctx.service.stageJgcl.getPreStageData(ctx.stage.order);
                 for (const d of data) {
                     const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
@@ -165,7 +165,7 @@ module.exports = app => {
          */
         async loadOther (ctx) {
             try {
-                const data = await ctx.service.stageOther.getStageData(ctx.stage.id);
+                const data = await ctx.service.stageOther.getStageData(ctx.stage);
                 const preData = await ctx.service.stageOther.getPreStageData(ctx.stage.order);
                 for (const d of data) {
                     const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});

+ 1 - 0
app/middleware/tender_check.js

@@ -74,6 +74,7 @@ module.exports = options => {
             tender.ledgerReadOnly = this.session.sessionUser.accountId !== tender.data.user_id ||
                 tender.data.ledger_status === auditConst.status.checking || tender.data.ledger_status === auditConst.status.checked;
             this.tender = tender;
+            this.session.sessionProject.page_show = yield this.service.project.getPageshow(this.session.sessionProject.id);
             yield next;
         } catch (err) {
             // 输出错误到日志

+ 2 - 2
app/service/material_audit.js

@@ -583,14 +583,14 @@ module.exports = app => {
                 case auditConst.status.checkNoPre :
                     sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`mid`, la.`aid`, la.`order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`mid` = ? and la.`status` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`mid` = ? and la.`status` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, materialId, status];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;
                 case auditConst.status.checkNo :
                     sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`mid`, la.`aid`, la.`order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`mid` = ? and la.`status` = ? and la.`times` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`mid` = ? and la.`status` = ? and la.`times` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, materialId, auditConst.status.checkNo, parseInt(times) - 1];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;

+ 5 - 0
app/service/project.js

@@ -130,6 +130,11 @@ module.exports = app => {
             return result;
         }
 
+        async getPageshow(id) {
+            const projectData = await this.db.get(this.tableName, { id });
+            return projectData.page_show ? JSON.parse(projectData.page_show) : null;
+        }
+
     }
 
     return Project;

+ 2 - 0
app/service/project_account.js

@@ -128,6 +128,7 @@ module.exports = app => {
                         name: projectData.name,
                         userAccount: projectData.user_account,
                         custom: projectData.custom,
+                        page_show: projectData.page_show ? JSON.parse(projectData.page_show) : null,
                     };
 
                     // 查找对应数据
@@ -171,6 +172,7 @@ module.exports = app => {
                         name: projectData.name,
                         userAccount: projectData.user_account,
                         custom: projectData.custom,
+                        page_show: projectData.page_show ? JSON.parse(projectData.page_show) : null,
                     };
 
                     // 查找对应数据

+ 2 - 2
app/service/revise_audit.js

@@ -426,14 +426,14 @@ module.exports = app => {
                 case auditConst.status.checkNoPre :
                     sql = 'SELECT la.`audit_id`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`rid`, la.`audit_order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`rid` = ? and la.`status` = ? and la.`audit_id` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`rid` = ? and la.`status` = ? and la.`audit_id` = pa.`id` order by la.`times` desc, la.`audit_order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, rid, status];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;
                 case auditConst.status.checkNo :
                     sql = 'SELECT la.`audit_id`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`rid`, la.`audit_order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`rid` = ? and la.`status` = ? and la.`times` = ? and la.`audit_id` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`rid` = ? and la.`status` = ? and la.`times` = ? and la.`audit_id` = pa.`id` order by la.`times` desc, la.`audit_order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, rid, auditConst.status.checkNo, parseInt(times) - 1];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;

+ 2 - 2
app/service/stage_audit.js

@@ -872,14 +872,14 @@ module.exports = app => {
                 case auditConst.status.checkNoPre :
                     sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`sid` = ? and la.`status` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`sid` = ? and la.`status` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, status];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;
                 case auditConst.status.checkNo :
                     sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`order` ' +
                         'FROM ?? AS la, ?? AS pa ' +
-                        'WHERE la.`sid` = ? and la.`status` = ? and la.`times` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`id` desc';
+                        'WHERE la.`sid` = ? and la.`status` = ? and la.`times` = ? and la.`aid` = pa.`id` order by la.`times` desc, la.`order` desc';
                     sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, stageId, auditConst.status.checkNo, parseInt(times) - 1];
                     auditor = await this.db.queryOne(sql, sqlParam);
                     break;

+ 5 - 4
app/service/stage_jgcl.js

@@ -22,13 +22,13 @@ module.exports = app => {
             this.tableName = 'stage_jgcl';
         }
 
-        async getStageData(sid) {
-            const data = await this.getAllDataByCondition({where: { sid: sid }});
-            if (this.ctx.stage && this.ctx.stage.readOnly && this.ctx.stage.status !== auditConst.status.checked) {
+        async getStageData(stage) {
+            const data = await this.getAllDataByCondition({where: { sid: stage.id }});
+            if (stage && stage.readOnly && stage.status !== auditConst.status.checked) {
                 for (const d of data) {
                     const his = d.shistory ? JSON.parse(d.shistory) : [];
                     const h = this.ctx.helper._.find(his, {
-                        stimes: this.ctx.stage.curTimes, sorder: this.ctx.stage.curOrder
+                        stimes: stage.curTimes, sorder: stage.curOrder
                     });
                     if (h) {
                         d.arrive_qty = h.arrive_qty ? h.arrive_qty : h.arraive_qty;
@@ -221,6 +221,7 @@ module.exports = app => {
                     delete pd.deduct_qty;
                     delete pd.deduct_tp;
                     pd.sid = stage.id;
+                    delete pd.shistory;
                 }
                 const result = await transaction.insert(this.tableName, preDatas);
                 return result.affectedRows === preDatas.length;

+ 5 - 4
app/service/stage_other.js

@@ -22,13 +22,13 @@ module.exports = app => {
             this.tableName = 'stage_other';
         }
 
-        async getStageData(sid) {
-            const data = await this.getAllDataByCondition({where: { sid: sid }});
-            if (this.ctx.stage && this.ctx.stage.readOnly && this.ctx.stage.status !== auditConst.status.checked) {
+        async getStageData(stage) {
+            const data = await this.getAllDataByCondition({where: { sid: stage.id }});
+            if (stage && stage.readOnly && stage.status !== auditConst.status.checked) {
                 for (const d of data) {
                     const his = d.shistory ? JSON.parse(d.shistory) : [];
                     const h = this.ctx.helper._.find(his, {
-                        stimes: this.ctx.stage.curTimes, sorder: this.ctx.stage.curOrder
+                        stimes: stage.curTimes, sorder: stage.curOrder
                     });
                     d.tp = h ? h.tp : null;
                 }
@@ -188,6 +188,7 @@ module.exports = app => {
                     delete pd.tp;
                     pd.sid = stage.id;
                     pd.sorder = stage.order;
+                    delete pd.shistory;
                 }
                 const result = await transaction.insert(this.tableName, preDatas);
                 return result.affectedRows === preDatas.length;

+ 2 - 0
app/view/stage/stage_sub_menu.ejs

@@ -31,6 +31,7 @@
                 </li>
             </ul>
         </div>
+        <% if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.bwtz) === 1) { %>
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li class="<% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order + '/bwtz') { %>active<% } %>">
@@ -38,6 +39,7 @@
                 </li>
             </ul>
         </div>
+        <% } %>
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li class="<% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order + '/change') { %>active<% } %>">

+ 3 - 1
app/view/stage/stage_sub_mini_menu.ejs

@@ -31,6 +31,7 @@
                 </li>
             </ul>
         </div>
+        <% if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.bwtz) === 1) { %>
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li class="<% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order + '/bwtz') { %>active<% } %>">
@@ -38,6 +39,7 @@
                 </li>
             </ul>
         </div>
+        <% } %>
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li class="<% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order + '/change') { %>active<% } %>">
@@ -69,4 +71,4 @@
         <% include ./audit_btn.ejs %>
         <div class="side-fold"><a href="javascript: void(0);" data-toggle="tooltip" data-placement="top" data-original-title="展开侧栏" id="to-menu"><i class="fa fa-upload fa-rotate-90"></i></a></div>
     </div>
-</div>
+</div>

+ 1 - 1
app/view/tender/tender_sub_menu.ejs

@@ -17,7 +17,7 @@
                 <% if (ctx.tender.data.ledger_status !== ctx.tender.auditLedgerConst.status.uncheck) { %>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/audit') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/audit"><span>台帐审批</span></a></li>
                 <% } %>
-                <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/bwtz') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/bwtz"><span>部位台帐</span></a></li>
+                <% if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.bwtz) === 1) { %><li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/bwtz') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/bwtz"><span>部位台帐</span></a></li><% } %>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/gather') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/gather"><span>清单对比</span></a></li>
                 <li <% if (ctx.url.indexOf('/tender/' + ctx.tender.id + '/revise') >= 0) { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/revise"><span>台帐修订</span></a></li>
             </ul>

+ 2 - 0
app/view/tender/tender_sub_mini_menu.ejs

@@ -17,7 +17,9 @@
                 <% if (ctx.tender.data.ledger_status !== ctx.tender.auditLedgerConst.status.uncheck) { %>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/audit') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/audit"><span>台帐审批</span></a></li>
                 <% } %>
+                <% if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.bwtz) === 1) { %>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/bwtz') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/bwtz"><span>部位台帐</span></a></li>
+                <% } %>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/ledger/gather') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/ledger/gather"><span>清单对比</span></a></li>
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/revise') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/revise"><span>台帐修订</span></a></li>
             </ul>

+ 9 - 0
sql/update.sql

@@ -50,6 +50,7 @@ ADD COLUMN `contract_expr`  varchar(255) CHARACTER SET ascii COLLATE ascii_gener
 
 ALTER TABLE `zh_project_account` ADD `backdoor_password` VARCHAR(255) NULL DEFAULT NULL COMMENT '副密码' AFTER `password`;
 
+<<<<<<< HEAD
 CREATE TABLE `calculation`.`zh_rpt_tree_node_cust` (
   `id` INT NOT NULL AUTO_INCREMENT,
   `cust_acc_id` VARCHAR(50) NULL COMMENT '用户的SSO account id',
@@ -57,3 +58,11 @@ CREATE TABLE `calculation`.`zh_rpt_tree_node_cust` (
   PRIMARY KEY (`id`),
   INDEX `cust_acc` (`cust_acc_id` ASC))
 COMMENT = '报表模板节点的用户定制化显示';
+=======
+ALTER TABLE `zh_project` ADD `page_show` VARCHAR(5000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '前台页面或功能展示与隐藏' AFTER `secret`;
+
+ALTER TABLE `zh_project` CHANGE `creator` `creator` INT(11) NOT NULL COMMENT '创建者';
+
+INSERT INTO `zh_permission`(`id`, `name`, `controller`, `action`, `pid`, `icon_class`, `create_time`, `isshow`) VALUES (71,'页面显示','project','pageshow',38,'',NULL,1)
+
+>>>>>>> 8a639d20203b267d6b190da092a44493b979926b