Browse Source

部分bug

MaiXinRong 3 days atrás
parent
commit
e5ccbe5b8c

+ 2 - 2
app/const/shenpi.js

@@ -34,7 +34,7 @@ const cost_sp_type = {
     cost_stage_ledger: 13,
     cost_stage_book: 14,
     cost_stage_analysis: 15,
-    cost_duty: 17,
+    cost_stage_duty: 17,
 };
 // const sp_name = [];
 // sp_name[sp_type.advance] = '预付款审批';
@@ -60,7 +60,7 @@ const sp_lc = [
     { code: 'contract', type: sp_type.contract, name: '标段合同审批' },
 ];
 const cost_sp_lc = [
-    { code: 'cost_stage_duty', type: cost_sp_type.cost_duty, name: '责任成本' },
+    { code: 'cost_stage_duty', type: cost_sp_type.cost_stage_duty, name: '责任成本' },
     { code: 'cost_stage_ledger', type: cost_sp_type.cost_stage_ledger, name: '成本报审' },
     { code: 'cost_stage_book', type: cost_sp_type.cost_stage_book, name: '财务账面' },
     { code: 'cost_stage_analysis', type: cost_sp_type.cost_stage_analysis, name: '成本分析' },

+ 12 - 0
app/controller/dashboard_controller.js

@@ -47,6 +47,7 @@ module.exports = app => {
             const allAuditCostStageLedger = await ctx.service.costStageAudit.getAuditStage('ledger', ctx.session.sessionUser.accountId);
             const allAuditCostStageBook = await ctx.service.costStageAudit.getAuditStage('book', ctx.session.sessionUser.accountId);
             const allAuditCostStageAnalysis = await ctx.service.costStageAudit.getAuditStage('analysis', ctx.session.sessionUser.accountId);
+            const allAuditCostStageDuty = await ctx.service.costStageAudit.getAuditStage('duty', ctx.session.sessionUser.accountId);
             const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
             const auditShenpiTenders = await ctx.service.ledgerAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
             const auditShenpiStages = await ctx.service.stageAudit.getDonesByAudit(ctx.session.sessionUser.accountId);
@@ -66,6 +67,7 @@ module.exports = app => {
             const auditShenpiCostStageLedger = await ctx.service.costStageAudit.getDonesByAudit('ledger', ctx.session.sessionUser.accountId);
             const auditShenpiCostStageBook = await ctx.service.costStageAudit.getDonesByAudit('book', ctx.session.sessionUser.accountId);
             const auditShenpiCostStageAnalysis = await ctx.service.costStageAudit.getDonesByAudit('analysis', ctx.session.sessionUser.accountId);
+            const auditShenpiCostStageDuty = await ctx.service.costStageAudit.getDonesByAudit('duty', ctx.session.sessionUser.accountId);
             const dashboardStatus = {
                 all: 0,
                 dashboard: 0,
@@ -90,6 +92,7 @@ module.exports = app => {
                     costStageLedger: 0,
                     costStageBook: 0,
                     costStageAnalysis: 0,
+                    costStageDuty: 0,
                 },
             };
             let noticeList = [];
@@ -133,6 +136,8 @@ module.exports = app => {
                 noticeList.push(...ctx.helper.addKeyValue4ObjArray(spCostStageBook, 'shenpi_type', 'costStageBook'));
                 const spCostStageAnalysis = subProject.page_show.cost ? ctx.helper._.filter(auditShenpiCostStageAnalysis, { spid: subProject.id }) : [];
                 noticeList.push(...ctx.helper.addKeyValue4ObjArray(spCostStageAnalysis, 'shenpi_type', 'costStageAnalysis'));
+                const spCostStageDuty = subProject.page_show.cost ? ctx.helper._.filter(auditShenpiCostStageDuty, { spid: subProject.id }) : [];
+                noticeList.push(...ctx.helper.addKeyValue4ObjArray(spCostStageDuty, 'shenpi_type', 'costStageDuty'));
             }
             const noticeDayList = [];
             noticeList = ctx.helper._.orderBy(noticeList, ['shenpi_time'], ['desc']);
@@ -180,6 +185,8 @@ module.exports = app => {
             dashboardShenpis.push(...auditCostStageBook);
             const auditCostStageAnalysis = await this.auditSet(ctx, allAuditCostStageAnalysis, subProjects, dashboardStatus, 'costStageAnalysis');
             dashboardShenpis.push(...auditCostStageAnalysis);
+            const auditCostStageDuty = await this.auditSet(ctx, allAuditCostStageDuty, subProjects, dashboardStatus, 'costStageDuty');
+            dashboardShenpis.push(...auditCostStageDuty);
             // console.log(ctx.helper._.orderBy(dashboardShenpis, ['start_audit', 'shenpi_time'], ['desc', 'desc']));
             const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
             // 获取销售人员数据
@@ -335,6 +342,7 @@ module.exports = app => {
                         case 'costStageLedger':
                         case 'costStageBook':
                         case 'costStageAnalysis':
+                        case 'costStageDuty':
                             if (!sp.page_show.cost) closeType = true;
                             calcTime = t.create_time;
                             break;
@@ -390,6 +398,7 @@ module.exports = app => {
             const auditCostStageLedger = ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getAuditStage('ledger', ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
             const auditCostStageBook = ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getAuditStage('book', ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
             const auditCostStageAnalysis = ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getAuditStage('analysis', ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
+            const auditCostStageDuty = ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getAuditStage('duty', ctx.session.sessionUser.accountId, ctx.subProject.id) : [];
             const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
             const noticeList = await ctx.service.noticePush.getNotice(ctx.session.sessionProject.id, pa.id, ctx.subProject.id);
             const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
@@ -427,6 +436,7 @@ module.exports = app => {
                 shenpi_count.push({ count: await ctx.service.costStageAudit.getCountByChecked('ledger', ctx.session.sessionUser.accountId, ctx.subProject.id), name: '成本报审' });
                 shenpi_count.push({ count: await ctx.service.costStageAudit.getCountByChecked('book', ctx.session.sessionUser.accountId, ctx.subProject.id), name: '财务账面' });
                 shenpi_count.push({ count: await ctx.service.costStageAudit.getCountByChecked('analysis', ctx.session.sessionUser.accountId, ctx.subProject.id), name: '成本分析' });
+                shenpi_count.push({ count: await ctx.service.costStageAudit.getCountByChecked('duty', ctx.session.sessionUser.accountId, ctx.subProject.id), name: '责任成本' });
             }
             // shenpi_count.push({ count: await ctx.service.advanceAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '预付款' });
             const total_count = ctx.app._.sumBy(shenpi_count, 'count');
@@ -448,6 +458,7 @@ module.exports = app => {
                 ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getLastEndTimeByChecked('ledger', ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
                 ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getLastEndTimeByChecked('book', ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
                 ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getLastEndTimeByChecked('analysis', ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
+                ctx.subProject.page_show.cost ? await ctx.service.costStageAudit.getLastEndTimeByChecked('duty', ctx.session.sessionUser.accountId, ctx.subProject.id) : null,
             ];
             const last_time = ctx.app._.max(shenpi_lastime);
             // console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
@@ -471,6 +482,7 @@ module.exports = app => {
                 auditCostStageLedger,
                 auditCostStageBook,
                 auditCostStageAnalysis,
+                auditCostStageDuty,
                 shenpi_count,
                 total_count,
                 last_day: ctx.helper.calcDayNum(last_time),

+ 1 - 1
app/public/js/cost_stage_book.js

@@ -829,7 +829,7 @@ $(document).ready(function() {
                 if (result.calc) {
                     const refreshNode = billsObj.tree.loadPostData({ update: result.bills });
                     billsObj.refreshTree(refreshNode);
-                    detailObj.data.updateDatas(result.detail);
+                    detailObj.data.updateDatas({ update: result.detail });
                     detailObj.reloadDetailData();
                 }
                 $('#cost-tp').attr('org', decimal.tp);

+ 1 - 1
app/public/js/cost_stage_ledger.js

@@ -1291,7 +1291,7 @@ $(document).ready(function() {
                 if (result.calc) {
                     const refreshNode = billsObj.tree.loadPostData({ update: result.bills });
                     billsObj.refreshTree(refreshNode);
-                    detailObj.data.updateDatas(result.detail);
+                    detailObj.data.updateDatas({ update: result.detail });
                     detailObj.reloadDetailData();
                 }
                 $('#cost-tp').attr('org', decimal.tp);

+ 4 - 4
app/service/cost_stage_book.js

@@ -216,9 +216,9 @@ module.exports = app => {
                 orgDetail = await this.ctx.service.costStageDetail.getAllDataByCondition({ where: { stage_id: this.ctx.costStage.relaStage.id }});
                 for (const cd of detailCalcData) {
                     const nd = { id: cd.id, ledger_id: cd.ledger_id, detail_id: cd.detail_id };
-                    const cl = orgLedger.find(x => { return x.id === cd.ledger_id });
+                    const od = orgDetail.find(x => { return x.id === cd.detail_id });
                     nd.in_tp = this.ctx.helper.round(cd.in_tp, decimal.tp);
-                    const divNum = cl.tax ? this.ctx.helper.add(1, this.ctx.helper.div(cl.tax, 100)) : 1;
+                    const divNum = od.tax ? this.ctx.helper.add(1, this.ctx.helper.div(od.tax, 100)) : 1;
                     nd.in_excl_tax_tp = this.ctx.helper.div(nd.in_tp !== undefined ? nd.in_tp : nd.in_tp, divNum, decimal.excl_tax_tp);
                     detailUpdateData.push(nd);
                 }
@@ -262,8 +262,8 @@ module.exports = app => {
             detailUpdateData.forEach(u => {
                 u.book_id = u.id;
                 delete u.id;
-                const cl = orgDetail.find(x => { return x.id === od.detail_id; });
-                i.id = cl.id;
+                const cl = orgDetail.find(x => { return x.id === u.detail_id; });
+                u.id = cl.id;
             });
             return { calc: calcTp, bills: updateData, detail: detailUpdateData };
         }

+ 2 - 0
app/view/cost/analysis_menu_list.ejs

@@ -1,4 +1,6 @@
 <nav-menu title="返回" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/analysis" tclass="text-primary" ml="1" icon="fa-chevron-left"></nav-menu>
 <nav-menu title="成本分析" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/analysis/<%- ctx.costStage.stage_order %>/stage" ml="3" active="<%= (ctx.url.indexOf('stage') >= 0 ? 1 : -1) %>"></nav-menu>
+<% if (ctx.app.config.is_debug) { %>
 <nav-menu title="审核比较" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/analysis/<%- ctx.costStage.stage_order %>/compare" ml="3" active="<%= (ctx.url.indexOf('compare') >= 0 ? 1 : -1) %>"></nav-menu>
+<% } %>
 <% include ./audit_btn.ejs %>

+ 2 - 0
app/view/cost/book_menu_list.ejs

@@ -1,4 +1,6 @@
 <nav-menu title="返回" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/book" tclass="text-primary" ml="1" icon="fa-chevron-left"></nav-menu>
 <nav-menu title="财务账面" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/book/<%- ctx.costStage.stage_order %>/stage" ml="3" active="<%= (ctx.url.indexOf('stage') >= 0 ? 1 : -1) %>"></nav-menu>
+<% if (ctx.app.config.is_debug) { %>
 <nav-menu title="审核比较" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/book/<%- ctx.costStage.stage_order %>/compare" ml="3" active="<%= (ctx.url.indexOf('compare') >= 0 ? 1 : -1) %>"></nav-menu>
+<% } %>
 <% include ./audit_btn.ejs %>

+ 2 - 0
app/view/cost/ledger_menu_list.ejs

@@ -1,4 +1,6 @@
 <nav-menu title="返回" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/ledger" tclass="text-primary" ml="1" icon="fa-chevron-left"></nav-menu>
 <nav-menu title="成本报审" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/ledger/<%- ctx.costStage.stage_order %>/stage" ml="3" active="<%= (ctx.url.indexOf('stage') >= 0 ? 1 : -1) %>"></nav-menu>
+<% if (ctx.app.config.is_debug) { %>
 <nav-menu title="审核比较" url="/sp/<%= ctx.subProject.id %>/cost/tender/<%- ctx.tender.id %>/ledger/<%- ctx.costStage.stage_order %>/compare" ml="3" active="<%= (ctx.url.indexOf('compare') >= 0 ? 1 : -1) %>"></nav-menu>
+<% } %>
 <% include ./audit_btn.ejs %>

+ 1 - 1
app/view/cost/stage_memu.ejs

@@ -1,6 +1,6 @@
 <div class="panel-sidebar" id="sub-menu">
     <div class="sidebar-title" data-toggle="tooltip" data-placement="right" data-original-title="<%- ctx.tender.data.name %>">
-        <%- `第${ctx.costStage.stage_order}期` %> -
+        <% if (ctx.costStage.stage_type !== 'duty') { %><%- `第${ctx.costStage.stage_order}期` %> - <% } %>
         <%- (ctx.tender.data.name.length > 11 ? ctx.tender.data.name.substring(0,11) + '...' : ctx.tender.data.name) %>
     </div>
     <div class="scrollbar-auto">

File diff suppressed because it is too large
+ 23 - 1
app/view/dashboard/index.ejs


+ 18 - 0
app/view/dashboard/workspace.ejs

@@ -154,6 +154,9 @@
                                             <% if (dashboardStatus.shenpi.costStageAnalysis !== 0) { %>
                                             <option value="costStageAnalysis">成本分析(<%- dashboardStatus.shenpi.costStageAnalysis %>)</option>
                                             <% } %>
+                                            <% if (dashboardStatus.shenpi.costStageDuty !== 0) { %>
+                                            <option value="costStageDuty">责任成本(<%- dashboardStatus.shenpi.costStageDuty %>)</option>
+                                            <% } %>
                                         </select>
                                     </div>
                                 </div>
@@ -514,6 +517,17 @@
                                                             <td><%- (am.begin_time ? ctx.moment(am.begin_time).format('YYYY/MM/DD HH:mm') : '') %></td>
                                                             <td><a href="/sp/<%- am.spid %>/cost/tender/<%- am.tid %>/analysis/<%- am.stage_order %>/stage" class="btn btn-sm btn-table <%- (am.audit_order === 0 ? 'btn-outline-warning text-warning' : 'btn-outline-primary') %>" role="button"><%- (am.audit_order === 0 ? '重新上报' : '审批')%></a></td>
                                                         </tr>
+                                                    <% } else if (db.shenpi_type === 'costStageDuty') { %>
+                                                        <% const am = db; %>
+                                                        <tr data-type="costStageDuty">
+                                                            <% if (am.start_audit === 2) { %><td class="text-center text-danger"><i class="fa fa-exclamation-triangle"></i></td><% } else if (am.start_audit === 1) { %><td class="text-center text-warning"><i class="fa fa-bell"></i></td><% } else { %><td></td><% } %>
+                                                            <td><span class="bg-new-coststage text-new-coststage badge text-width">责任成本</span></td>
+                                                            <td><a href="/sp/<%- am.spid %>/dashboard"><%- am.sp_name %></a></td>
+                                                            <td><a href="/sp/<%- am.spid %>/cost/tender/<%- am.tid %>/duty/1/stage"><%- am.name %></a></td>
+                                                            <td></td>
+                                                            <td><%- (am.begin_time ? ctx.moment(am.begin_time).format('YYYY/MM/DD HH:mm') : '') %></td>
+                                                            <td><a href="/sp/<%- am.spid %>/cost/tender/<%- am.tid %>/duty/1/stage" class="btn btn-sm btn-table <%- (am.audit_order === 0 ? 'btn-outline-warning text-warning' : 'btn-outline-primary') %>" role="button"><%- (am.audit_order === 0 ? '重新上报' : '审批')%></a></td>
+                                                        </tr>
                                                     <% } %>
                                                 <% } %>
                                                 </tbody>
@@ -969,6 +983,10 @@
                                         html.push(`<li class="list-group-item">
                                             <span class="${acCostStage.auditStringClass[n.audit_status]}">${acCostStage.auditString[n.audit_status]}</span> <a href="/sp/${n.spid}/cost/tender/${n.id}/analysis/${n.stage_order}/stage" target="_blank">${n.name}</a> 成本分析 ${n.name}<span class="float-right">${moment(new Date(n.shenpi_time)).format('HH:mm:ss')}</span></li>`);
                                         break;
+                                    case 'costStageDuty':
+                                        html.push(`<li class="list-group-item">
+                                            <span class="${acCostStage.auditStringClass[n.audit_status]}">${acCostStage.auditString[n.audit_status]}</span> <a href="/sp/${n.spid}/cost/tender/${n.id}/duty/1/stage" target="_blank">${n.name}</a> 责任成本 ${n.name}<span class="float-right">${moment(new Date(n.shenpi_time)).format('HH:mm:ss')}</span></li>`);
+                                        break;
                                     default: continue;
                                 }
                             }