Browse Source

待办页更新及调差bug修复

laiguoran 3 years ago
parent
commit
8135bc8107

+ 32 - 1
app/controller/dashboard_controller.js

@@ -11,6 +11,7 @@
 const auditConst = require('../const/audit');
 const officeList = require('../const/cld_office').list;
 const maintainConst = require('../const/maintain');
+const typeColMap = require('../const/advance').typeColMap;
 
 module.exports = app => {
 
@@ -45,9 +46,35 @@ module.exports = app => {
             const userPermission = pa !== undefined && pa.permission !== '' ? JSON.parse(pa.permission) : null;
             const userMsgPermission = userPermission !== null && userPermission.project_msg !== undefined && parseInt(userPermission.project_msg) === 1;
             // 获取系统通知
-            const sysMsgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, 2, 0, 2);
+            const sysMsgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, 1, 0, 2);
             // 获取系统维护信息
             const maintainData = await ctx.service.maintain.getDataById(1);
+            // 获取各个审批的次数及最后的审批时间
+            const shenpi_count = [
+                { count: await ctx.service.ledgerAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '台账审批' },
+                { count: await ctx.service.reviseAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '台账修订' },
+                { count: await ctx.service.stageAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '计量审批' },
+                { count: await ctx.service.changeAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更审批' },
+            ];
+            if (ctx.session.sessionProject.page_show.openChangeProject) shenpi_count.push({ count: await ctx.service.changeProjectAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更立项' });
+            if (ctx.session.sessionProject.page_show.openChangeApply) shenpi_count.push({ count: await ctx.service.changeApplyAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更申请' });
+            if (ctx.session.sessionProject.page_show.openChangePlan) shenpi_count.push({ count: await ctx.service.changePlanAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '变更方案' });
+            shenpi_count.push({ count: await ctx.service.materialAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '材料调差' });
+            shenpi_count.push({ count: await ctx.service.advanceAudit.getCountByChecked(ctx.session.sessionUser.accountId), name: '预付款' });
+            const total_count = ctx.app._.sumBy(shenpi_count, 'count');
+            const shenpi_lastime = [
+                await ctx.service.ledgerAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+                await ctx.service.reviseAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+                await ctx.service.stageAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+                await ctx.service.changeAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+                ctx.session.sessionProject.page_show.openChangeProject ? await ctx.service.changeProjectAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
+                ctx.session.sessionProject.page_show.openChangeApply ? await ctx.service.changeApplyAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
+                ctx.session.sessionProject.page_show.openChangePlan ? await ctx.service.changePlanAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId) : null,
+                await ctx.service.materialAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+                await ctx.service.advanceAudit.getLastEndTimeByChecked(ctx.session.sessionUser.accountId),
+            ];
+            const last_time = ctx.app._.max(shenpi_lastime);
+            console.log(ctx.app._.max(shenpi_lastime), ctx.helper.calcDayNum(last_time));
             const renderData = {
                 auditTenders,
                 auditStages,
@@ -58,6 +85,9 @@ module.exports = app => {
                 auditChangeProject,
                 auditChangeApply,
                 auditChangePlan,
+                shenpi_count,
+                total_count,
+                last_day: ctx.helper.calcDayNum(last_time),
                 role: pa.role,
                 authMobile: pa.auth_mobile,
                 acLedger: auditConst.ledger,
@@ -81,6 +111,7 @@ module.exports = app => {
                 uid: ctx.session.sessionUser.accountId,
                 maintainData,
                 maintainConst,
+                typeColMap,
             };
             await this.layout('dashboard/index.ejs', renderData, 'dashboard/modal.ejs');
             await ctx.service.projectAccount.defaultUpdate({

+ 1 - 1
app/controller/material_controller.js

@@ -723,7 +723,7 @@ module.exports = app => {
                     msg: '',
                     data: {},
                 };
-                if (ctx.session.sessionProject.page_show.openMaterialChecklist && ctx.app._.findIndex(['join', 'notjoin', 'self', 'noself', 'useOther'], data.type) === -1) {
+                if (ctx.session.sessionProject.page_show.openMaterialChecklist && ctx.app._.indexOf(['join', 'notjoin', 'self', 'noself', 'useOther'], data.type) === -1) {
                     throw '清单设置功能已启动,请前往清单设置页操作清单内容';
                 }
                 switch (data.type) {

+ 6 - 0
app/extend/helper.js

@@ -969,6 +969,12 @@ module.exports = {
         return moment(time).format('YYYY-MM-DD HH:mm:ss');
     },
 
+    calcDayNum(startTime, endTime = '') {
+        const dateStart = new Date(startTime);
+        const dateEnd = endTime ? new Date(endTime) : new Date();
+        return parseInt((dateEnd.getTime() - dateStart.getTime()) / (1000 * 60 * 60 * 24));
+    },
+
     // 预付款详情页时间线所需格式
     formatDate(date) {
         if (!date) return '';

BIN
app/public/css/about.png


BIN
app/public/css/bg_participate_blue.png


BIN
app/public/css/bg_participate_orange.png


+ 24 - 18
app/public/css/main.css

@@ -87,7 +87,7 @@ font-size: .875rem;
 }
 .custom-control-warning-input:checked ~ .custom-control-warning-label::before{
   border-color:#da9500 ;
-  background-color:#da9500 
+  background-color:#da9500
 }
 .custom-control-warning-label{
   color:#da9500;
@@ -195,23 +195,23 @@ input.nospin[type="number"]{-moz-appearance:textfield;}
 /*滚动条*/
 /* 滚动条 */
 /*水平滚动条的样式*/
-/*::-webkit-scrollbar-thumb:horizontal { 
+/*::-webkit-scrollbar-thumb:horizontal {
 	width: 5px;
 	background-color: #e9ecef;
 	-webkit-border-radius: 0;
 }*/
 /*滚动条的背景颜色,滚动条的圆角宽度*/
 /*::-webkit-scrollbar-track-piece {
-	background-color: #efefef; 
-	-webkit-border-radius: 0; 
+	background-color: #efefef;
+	-webkit-border-radius: 0;
 }*/
 /*滚动条的宽度,滚动条的高度*/
 /*::-webkit-scrollbar {
-	width: 14px; 
-	height: 14px; 
+	width: 14px;
+	height: 14px;
 }*/
 /*垂直滚动条的样式*/
-/*::-webkit-scrollbar-thumb:vertical { 
+/*::-webkit-scrollbar-thumb:vertical {
 	height: 50px;
 	background-color: #e9ecef;
 	-webkit-border-radius: 0;
@@ -220,7 +220,7 @@ input.nospin[type="number"]{-moz-appearance:textfield;}
 	border: 1px solid #ced4da;
 }*/
 /*滚动条的hover样式*/
-/*::-webkit-scrollbar-thumb:hover { 
+/*::-webkit-scrollbar-thumb:hover {
 	height: 50px;
 	background-color: #ced4da;
 	-webkit-border-radius: 0;
@@ -870,7 +870,7 @@ input.nospin[type="number"]{-moz-appearance:textfield;}
   font-size: 14px
 }
 .bd-toc {
-  
+
     position: sticky;
     top:3rem;
     height: calc(100vh - 10rem);
@@ -1028,7 +1028,7 @@ body{
   line-height: 30px;
 }
 .panel-title > .title-main .btn.pull-right {
-    margin: 5px 0 0 0 
+    margin: 5px 0 0 0
 }
 .panel-content{
   padding-top:35px;
@@ -1246,7 +1246,7 @@ a.maintain-icon .fa{
     }
 }
 
-a.maintain-icon:hover .fa{ 
+a.maintain-icon:hover .fa{
     animation-iteration-count:0
 }
 /*审批列表*/
@@ -1369,10 +1369,10 @@ overflow-y: auto;
   position: relative;
 }
 .circle{
-  width: 62px; 
+  width: 62px;
   height: 62px;
   border-radius: 50%;
-  background: none; 
+  background: none;
   border: 4px solid #D7B014;
 }
 .circle-num{
@@ -1837,6 +1837,9 @@ overflow-y: auto;
 .bg-new-blue{
   background: rgba(51, 119, 255, 0.08) !important;
 }
+.bg-new-purple{
+    background: rgba(114, 46, 209, 0.08) !important;
+}
 .text-new-red{
   color: rgba(241, 82, 91, 1) !important;
 }
@@ -1852,6 +1855,9 @@ overflow-y: auto;
 .text-new-blue{
   color: rgba(51, 119, 255, 1) !important;
 }
+.text-new-purple{
+    color: rgba(114, 46, 209, 1) !important;
+}
 .text-width{
   width: 66px;
   text-align: center;
@@ -1889,8 +1895,8 @@ overflow-y: auto;
   font-size: 36px;
 }
 .list-text-vertical{
-  overflow:hidden; 
-  text-overflow:ellipsis; 
+  overflow:hidden;
+  text-overflow:ellipsis;
   white-space:nowrap;
 }
 .about-text i{
@@ -1914,12 +1920,12 @@ overflow-y: auto;
 }
 /*@media (min-width: 768px){
   .weixin-erweima img{
-    width:90%; 
+    width:90%;
     height:auto;
   }
 }*/
 .weixin-erweima img{
-  width:75%; 
+  width:75%;
   height:auto;
 }
 .weixin-erweima span{
@@ -1958,4 +1964,4 @@ animation:shake 1s .2s ease both;}
 }
 .margin-inputbox .height-inputbox{
   height: 30px !important;
-}
+}

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

@@ -79,7 +79,7 @@ $(document).ready(function () {
 
     $('a[data-target="#sp-list" ]').on('click', function () {
         const id = $(this).data('vid')
-        postData(`${window.location.pathname.replace('/material', '')}/${id}/auditors`, {}, (res) => {
+        postData(`${window.location.pathname}/${id}/auditors`, {}, (res) => {
             const { auditHistory, auditors, user } = res
             let auditorsHTML = ''
             let historyHTML = ''

+ 26 - 2
app/service/advance_audit.js

@@ -494,7 +494,7 @@ module.exports = app => {
         async getNoticeContent(pid, tid, vid, uid, opinion = '') {
             const noticeSql =
                 'SELECT * FROM (SELECT ' +
-                '  t.`id` As `tid`, ad.`vid`, t.`name`, m.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
+                '  t.`id` As `tid`, ad.`vid`, ad.`type` As `ad_type`, t.`name`, m.`order`, pa.`name` As `su_name`, pa.role As `su_role`' +
                 '  FROM (SELECT * FROM ?? WHERE `id` = ? ) As t' +
                 '  LEFT JOIN ?? As m On t.`id` = m.`tid` AND m.`id` = ?' +
                 '  LEFT JOIN ?? As ad ON m.`id` = ad.`vid`' +
@@ -573,7 +573,7 @@ module.exports = app => {
          */
         async getAuditAdvance(auditorId) {
             const sql = 'SELECT ma.`audit_id`, ma.`times`, ma.`order`, ma.`create_time`, ma.`end_time`, ma.`tid`, ma.`vid`,' +
-                        '    m.`order` As `morder`, m.`status` As `mstatus`,' +
+                        '    m.`order` As `morder`, m.`status` As `mstatus`, m.`type` As `mtype`,' +
                         '    t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
                         '  FROM ?? AS ma, ?? AS m, ?? As t ' +
                         '  WHERE ((ma.`audit_id` = ? and ma.`status` = ?) OR (m.`uid` = ? and ma.`status` = ? and m.`status` = ? and ma.`times` = (m.`times`-1)))' +
@@ -582,6 +582,30 @@ module.exports = app => {
             return await this.db.query(sql, sqlParam);
         }
 
+        /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { audit_id: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo, auditConst.status.checkNoPre] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `audit_id` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
         async updateNewAuditList(advance, newIdList) {
             const transaction = await this.db.beginTransaction();
             try {

+ 25 - 0
app/service/change_apply_audit.js

@@ -307,6 +307,31 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `aid` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+
+        /**
          * 用于添加推送所需的content内容
          * @param {Number} pid 项目id
          * @param {Number} tid 台账id

+ 28 - 0
app/service/change_audit.js

@@ -312,6 +312,34 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            const sql = 'Select count(*) as count FROM ?? WHERE uid = ? AND usite != 0 AND status in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.back, auditConst.status.backnew]) +')';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result.count ? result.count : 0;
+            // return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `sin_time` FROM ?? WHERE `uid` = ? AND usite != 0 ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.back, auditConst.status.backnew]) + ') ORDER BY `sin_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.sin_time : null;
+        }
+
+        /**
          * 获取 某时间后 审批进度更新的 变更令
          * @param {Number} pid - 查询标段
          * @param {Number} uid - 查询人

+ 24 - 0
app/service/change_plan_audit.js

@@ -311,6 +311,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `aid` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 用于添加推送所需的content内容
          * @param {Number} pid 项目id
          * @param {Number} tid 台账id

+ 24 - 0
app/service/change_project_audit.js

@@ -308,6 +308,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.back, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `aid` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.back, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 用于添加推送所需的content内容
          * @param {Number} pid 项目id
          * @param {Number} tid 台账id

+ 24 - 0
app/service/ledger_audit.js

@@ -454,6 +454,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { audit_id: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `audit_id` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 获取 某时间后 审批进度 更新的台账
          * @param {Integer} pid - 项目id
          * @param {Integer} uid - 查询人id

+ 24 - 0
app/service/material_audit.js

@@ -753,6 +753,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo, auditConst.status.checkNoPre] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `aid` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 获取 某时间后 审批进度 更新的期
          * @param {Number} pid - 查询标段
          * @param {Number} uid - 查询人

+ 2 - 2
app/service/notice_push.js

@@ -42,8 +42,8 @@ module.exports = app => {
             let notice = await this.db.select(this.tableName, {
                 where: wheres,
                 orders: [['create_time', 'desc']],
-                limit: 10,
-                offset: 0
+                // limit: 10,
+                // offset: 0
             })
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)

+ 24 - 0
app/service/revise_audit.js

@@ -609,6 +609,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { audit_id: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `audit_id` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 获取 某时间后 审批进度 更新的台账
          * @param {Integer} pid - 项目id
          * @param {Integer} uid - 查询人id

+ 24 - 0
app/service/stage_audit.js

@@ -1049,6 +1049,30 @@ module.exports = app => {
         }
 
         /**
+         * 获取审核人审核的次数
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getCountByChecked(auditorId) {
+            return await this.db.count(this.tableName, { aid: auditorId, status: [auditConst.status.checked, auditConst.status.checkNo, auditConst.status.checkNoPre] });
+        }
+
+        /**
+         * 获取最近一次审批结束时间
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getLastEndTimeByChecked(auditorId) {
+            const sql = 'SELECT `end_time` FROM ?? WHERE `aid` = ? ' +
+                'AND `status` in (' + this.ctx.helper.getInArrStrSqlFilter([auditConst.status.checked, auditConst.status.checkNo, auditConst.status.checkNoPre]) + ') ORDER BY `end_time` DESC';
+            const sqlParam = [this.tableName, auditorId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result ? result.end_time : null;
+        }
+
+        /**
          * 获取 某时间后 审批进度 更新的期
          * @param {Number} pid - 查询标段
          * @param {Number} uid - 查询人

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