|
@@ -7,15 +7,15 @@ module.exports = app => {
|
|
|
class WeappDashboardController extends app.BaseController {
|
|
class WeappDashboardController extends app.BaseController {
|
|
|
async workspace(ctx) {
|
|
async workspace(ctx) {
|
|
|
try {
|
|
try {
|
|
|
- // const allAuditTenders = await ctx.service.ledgerAudit.getAuditTender(ctx.session.sessionUser.id);
|
|
|
|
|
|
|
+ const allAuditTenders = await ctx.service.ledgerAudit.getAuditTender(ctx.session.sessionUser.id);
|
|
|
const allAuditStages = await ctx.service.stageAudit.getAuditStage(ctx.session.sessionUser.id);
|
|
const allAuditStages = await ctx.service.stageAudit.getAuditStage(ctx.session.sessionUser.id);
|
|
|
- const allAuditChanges = await ctx.service.changeAudit.getAuditChange(ctx.session.sessionUser.id);
|
|
|
|
|
- // const allAuditRevise = await ctx.service.reviseAudit.getAuditRevise(ctx.session.sessionUser.id);
|
|
|
|
|
|
|
+ const allAuditRevise = await ctx.service.reviseAudit.getAuditRevise(ctx.session.sessionUser.id);
|
|
|
const allAuditMaterial = await ctx.service.materialAudit.getAuditMaterial(ctx.session.sessionUser.id);
|
|
const allAuditMaterial = await ctx.service.materialAudit.getAuditMaterial(ctx.session.sessionUser.id);
|
|
|
const allAuditAdvance = await ctx.service.advanceAudit.getAuditAdvance(ctx.session.sessionUser.id);
|
|
const allAuditAdvance = await ctx.service.advanceAudit.getAuditAdvance(ctx.session.sessionUser.id);
|
|
|
- const allAuditChangeProject = await ctx.service.changeProjectAudit.getAuditChangeProject(ctx.session.sessionUser.id);
|
|
|
|
|
- const allAuditChangeApply = await ctx.service.changeApplyAudit.getAuditChangeApply(ctx.session.sessionUser.id);
|
|
|
|
|
- const allAuditChangePlan = await ctx.service.changePlanAudit.getAuditChangePlan(ctx.session.sessionUser.id);
|
|
|
|
|
|
|
+ const allAuditChanges = await ctx.service.changeAudit.getAuditChangeByWeapp(ctx.session.sessionUser.id, '', true);
|
|
|
|
|
+ const allAuditChangeProject = await ctx.service.changeProjectAudit.getAuditChangeProject(ctx.session.sessionUser.id, '', true);
|
|
|
|
|
+ const allAuditChangeApply = await ctx.service.changeApplyAudit.getAuditChangeApply(ctx.session.sessionUser.id, '', true);
|
|
|
|
|
+ const allAuditChangePlan = await ctx.service.changePlanAudit.getAuditChangePlan(ctx.session.sessionUser.id, '', true);
|
|
|
// const allAuditPayments = await ctx.service.paymentDetailAudit.getAuditPayment(ctx.session.sessionUser.id);
|
|
// const allAuditPayments = await ctx.service.paymentDetailAudit.getAuditPayment(ctx.session.sessionUser.id);
|
|
|
// const allAuditStageAss = await ctx.service.stageAuditAss.getAuditStageAss(ctx.session.sessionUser.id);
|
|
// const allAuditStageAss = await ctx.service.stageAuditAss.getAuditStageAss(ctx.session.sessionUser.id);
|
|
|
// const allAuditFinancials = await ctx.service.financialPayAudit.getAuditFinancial(ctx.session.sessionUser.id);
|
|
// const allAuditFinancials = await ctx.service.financialPayAudit.getAuditFinancial(ctx.session.sessionUser.id);
|
|
@@ -53,24 +53,101 @@ module.exports = app => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const dashboardShenpis = [];
|
|
const dashboardShenpis = [];
|
|
|
- // const auditTenders = await DashboardStats.auditSet(ctx, allAuditTenders, subProjects, dashboardStatus, 'ledger');
|
|
|
|
|
- // dashboardShenpis.push(...auditTenders);
|
|
|
|
|
|
|
+ const auditTenders = await DashboardStats.auditSet(ctx, allAuditTenders, subProjects, dashboardStatus, 'ledger');
|
|
|
|
|
+ dashboardShenpis.push(...(auditTenders.map(item => ({ ...item, type: 'ledger', subType: 'ledger' }))));
|
|
|
const auditStages = await DashboardStats.auditSet(ctx, allAuditStages, subProjects, dashboardStatus, 'stage');
|
|
const auditStages = await DashboardStats.auditSet(ctx, allAuditStages, subProjects, dashboardStatus, 'stage');
|
|
|
dashboardShenpis.push(...(auditStages.map(item => ({ ...item, type: 'stage', subType: 'stage' }))));
|
|
dashboardShenpis.push(...(auditStages.map(item => ({ ...item, type: 'stage', subType: 'stage' }))));
|
|
|
const auditChanges = await DashboardStats.auditSet(ctx, allAuditChanges, subProjects, dashboardStatus, 'change');
|
|
const auditChanges = await DashboardStats.auditSet(ctx, allAuditChanges, subProjects, dashboardStatus, 'change');
|
|
|
- dashboardShenpis.push(...(auditChanges.map(item => ({ ...item, type: 'change', subType: 'change' }))));
|
|
|
|
|
- // const auditRevise = await DashboardStats.auditSet(ctx, allAuditRevise, subProjects, dashboardStatus, 'revise');
|
|
|
|
|
- // dashboardShenpis.push(...auditRevise);
|
|
|
|
|
|
|
+ for (const item of auditChanges) {
|
|
|
|
|
+ let sp = null;
|
|
|
|
|
+ if (item.spid) {
|
|
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: item.spid }) !== -1) {
|
|
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: item.spid });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp = await ctx.service.subProject.getDataById(item.spid);
|
|
|
|
|
+ subProjects.push(sp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (sp && sp.page_show) {
|
|
|
|
|
+ if (sp.page_show.openChangeProject) {
|
|
|
|
|
+ dashboardShenpis.push({ ...item, type: 'change', subType: 'change' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const auditRevise = await DashboardStats.auditSet(ctx, allAuditRevise, subProjects, dashboardStatus, 'revise');
|
|
|
|
|
+ dashboardShenpis.push(...(auditRevise.map(item => ({ ...item, type: 'revise', subType: 'revise' }))));
|
|
|
const auditMaterial = await DashboardStats.auditSet(ctx, allAuditMaterial, subProjects, dashboardStatus, 'material');
|
|
const auditMaterial = await DashboardStats.auditSet(ctx, allAuditMaterial, subProjects, dashboardStatus, 'material');
|
|
|
- dashboardShenpis.push(...(auditMaterial.map(item => ({ ...item, type: 'material', subType: 'material' }))));
|
|
|
|
|
|
|
+ for (const item of auditMaterial) {
|
|
|
|
|
+ let sp = null;
|
|
|
|
|
+ if (item.spid) {
|
|
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: item.spid }) !== -1) {
|
|
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: item.spid });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp = await ctx.service.subProject.getDataById(item.spid);
|
|
|
|
|
+ subProjects.push(sp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sp && sp.page_show) {
|
|
|
|
|
+ if (sp.page_show.openMaterial) {
|
|
|
|
|
+ dashboardShenpis.push({ ...item, type: 'material', subType: 'material' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
const auditAdvance = await DashboardStats.auditSet(ctx, allAuditAdvance, subProjects, dashboardStatus, 'advance');
|
|
const auditAdvance = await DashboardStats.auditSet(ctx, allAuditAdvance, subProjects, dashboardStatus, 'advance');
|
|
|
dashboardShenpis.push(...(auditAdvance.map(item => ({ ...item, type: 'advance', subType: 'advance' }))));
|
|
dashboardShenpis.push(...(auditAdvance.map(item => ({ ...item, type: 'advance', subType: 'advance' }))));
|
|
|
const auditChangeProject = await DashboardStats.auditSet(ctx, allAuditChangeProject, subProjects, dashboardStatus, 'changeProject');
|
|
const auditChangeProject = await DashboardStats.auditSet(ctx, allAuditChangeProject, subProjects, dashboardStatus, 'changeProject');
|
|
|
- dashboardShenpis.push(...(auditChangeProject.map(item => ({ ...item, type: 'change', subType: 'changeProject' }))));
|
|
|
|
|
|
|
+ for (const item of auditChangeProject) {
|
|
|
|
|
+ let sp = null;
|
|
|
|
|
+ if (item.spid) {
|
|
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: item.spid }) !== -1) {
|
|
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: item.spid });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp = await ctx.service.subProject.getDataById(item.spid);
|
|
|
|
|
+ subProjects.push(sp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sp && sp.page_show) {
|
|
|
|
|
+ if (sp.page_show.openChangeProject) {
|
|
|
|
|
+ dashboardShenpis.push({ ...item, type: 'change', subType: 'changeProject' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
const auditChangeApply = await DashboardStats.auditSet(ctx, allAuditChangeApply, subProjects, dashboardStatus, 'changeApply');
|
|
const auditChangeApply = await DashboardStats.auditSet(ctx, allAuditChangeApply, subProjects, dashboardStatus, 'changeApply');
|
|
|
- dashboardShenpis.push(...(auditChangeApply.map(item => ({ ...item, type: 'change', subType: 'changeApply' }))));
|
|
|
|
|
|
|
+ for (const item of auditChangeApply) {
|
|
|
|
|
+ let sp = null;
|
|
|
|
|
+ if (item.spid) {
|
|
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: item.spid }) !== -1) {
|
|
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: item.spid });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp = await ctx.service.subProject.getDataById(item.spid);
|
|
|
|
|
+ subProjects.push(sp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sp && sp.page_show) {
|
|
|
|
|
+ if (sp.page_show.openChangeApply) {
|
|
|
|
|
+ dashboardShenpis.push({ ...item, type: 'change', subType: 'changeApply' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
const auditChangePlan = await DashboardStats.auditSet(ctx, allAuditChangePlan, subProjects, dashboardStatus, 'changePlan');
|
|
const auditChangePlan = await DashboardStats.auditSet(ctx, allAuditChangePlan, subProjects, dashboardStatus, 'changePlan');
|
|
|
- dashboardShenpis.push(...(auditChangePlan.map(item => ({ ...item, type: 'change', subType: 'changePlan' }))));
|
|
|
|
|
|
|
+ for (const item of auditChangePlan) {
|
|
|
|
|
+ let sp = null;
|
|
|
|
|
+ if (item.spid) {
|
|
|
|
|
+ if (ctx.helper._.findIndex(subProjects, { id: item.spid }) !== -1) {
|
|
|
|
|
+ sp = ctx.helper._.find(subProjects, { id: item.spid });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sp = await ctx.service.subProject.getDataById(item.spid);
|
|
|
|
|
+ subProjects.push(sp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sp && sp.page_show) {
|
|
|
|
|
+ if (sp.page_show.openChangePlan) {
|
|
|
|
|
+ dashboardShenpis.push({ ...item, type: 'change', subType: 'changePlan' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// const auditPayments = await DashboardStats.auditSet(ctx, allAuditPayments, subProjects, dashboardStatus, 'payment');
|
|
// const auditPayments = await DashboardStats.auditSet(ctx, allAuditPayments, subProjects, dashboardStatus, 'payment');
|
|
|
// dashboardShenpis.push(...auditPayments);
|
|
// dashboardShenpis.push(...auditPayments);
|
|
|
// const auditStageAss = await DashboardStats.auditSet(ctx, allAuditStageAss, subProjects, dashboardStatus, 'stageAss');
|
|
// const auditStageAss = await DashboardStats.auditSet(ctx, allAuditStageAss, subProjects, dashboardStatus, 'stageAss');
|
|
@@ -79,10 +156,10 @@ module.exports = app => {
|
|
|
// dashboardShenpis.push(...auditFinancials);
|
|
// dashboardShenpis.push(...auditFinancials);
|
|
|
// const auditInspections = await DashboardStats.auditSet(ctx, allAuditInspections, subProjects, dashboardStatus, 'inspection');
|
|
// const auditInspections = await DashboardStats.auditSet(ctx, allAuditInspections, subProjects, dashboardStatus, 'inspection');
|
|
|
// dashboardShenpis.push(...auditInspections);
|
|
// dashboardShenpis.push(...auditInspections);
|
|
|
- const auditQualityInspections = await DashboardStats.auditSet(ctx, allAuditQualityInspections, subProjects, dashboardStatus, 'inspection');
|
|
|
|
|
- dashboardShenpis.push(...(auditQualityInspections.map(item => ({ ...item, type: 'qualityInspection', subType: 'qualityInspection' }))));
|
|
|
|
|
- const auditSafeInspections = await DashboardStats.auditSet(ctx, allAuditSafeInspections, subProjects, dashboardStatus, 'safeInspection');
|
|
|
|
|
- dashboardShenpis.push(...(auditSafeInspections.map(item => ({ ...item, type: 'safeInspection', subType: 'safeInspection' }))));
|
|
|
|
|
|
|
+ // const auditQualityInspections = await DashboardStats.auditSet(ctx, allAuditQualityInspections, subProjects, dashboardStatus, 'inspection');
|
|
|
|
|
+ // dashboardShenpis.push(...(auditQualityInspections.map(item => ({ ...item, type: 'qualityInspection', subType: 'qualityInspection' }))));
|
|
|
|
|
+ // const auditSafeInspections = await DashboardStats.auditSet(ctx, allAuditSafeInspections, subProjects, dashboardStatus, 'safeInspection');
|
|
|
|
|
+ // dashboardShenpis.push(...(auditSafeInspections.map(item => ({ ...item, type: 'safeInspection', subType: 'safeInspection' }))));
|
|
|
|
|
|
|
|
// const auditPhasePay = await DashboardStats.auditSet(ctx, allAuditPhasePay, subProjects, dashboardStatus, 'phasePay');
|
|
// const auditPhasePay = await DashboardStats.auditSet(ctx, allAuditPhasePay, subProjects, dashboardStatus, 'phasePay');
|
|
|
// dashboardShenpis.push(...auditPhasePay);
|
|
// dashboardShenpis.push(...auditPhasePay);
|