瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 2 月之前
父節點
當前提交
2bf775a987

+ 5 - 1
app/const/sp_page_show.js

@@ -30,7 +30,7 @@ const tenderPageControl = [
     { title: '投资进度', name: 'xxjd', value: pageStatus.show, type: 'checkbox' },
     { title: '材料调差', name: 'openMaterial', value: pageStatus.show, type: 'checkbox' },
     { title: '过程结算', name: 'openSettle', value: pageStatus.show, type: 'checkbox' },
-    { title: '施工日志', name: 'openTenderContract', value: pageStatus.show, type: 'checkbox' },
+    { title: '施工日志', name: 'openConstruction', value: pageStatus.show, type: 'checkbox' },
     { title: '合同管理', name: 'openTenderContract', value: pageStatus.show, type: 'checkbox' },
 ];
 // 报表相关开关
@@ -93,6 +93,10 @@ const defaultSetting = {
     openMaterialStageRepeat: 0,
     openContract: 1,
     openFinancial: 1,
+    openTenderContract: 1,
+    openStageAudit: 0,
+    stageAuditEarly: 3,
+    stageAuditWorry: 8,
 };
 
 module.exports = {

+ 15 - 15
app/controller/dashboard_controller.js

@@ -49,11 +49,11 @@ module.exports = app => {
             // 获取版本信息
             const versionList = await ctx.service.version.getAllDataByCondition({ orders: [['id', 'desc']], limit: 5, offset: 0 });
             // 获取项目通知
-            const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id);
+            const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, ctx.subProject.id);
             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, 1, 0, 2);
+            const sysMsgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, '', 1, 0, 2);
             // 获取系统维护信息
             const maintainData = await ctx.service.maintain.getDataById(1);
             // 获取各个审批的次数及最后的审批时间
@@ -144,7 +144,7 @@ module.exports = app => {
             try {
                 const page = ctx.page;
 
-                const msgId = parseInt(ctx.params.id) || 0;
+                const msgId = parseInt(ctx.params.mid) || 0;
 
                 let msgInfo = msgId ? await ctx.service.message.getDataById(msgId) : null;
 
@@ -159,19 +159,19 @@ module.exports = app => {
                 }
 
                 const total = type === 1 ?
-                    await ctx.service.message.count({ project_id: ctx.session.sessionProject.id, type }) :
+                    await ctx.service.message.count({ project_id: ctx.session.sessionProject.id, spid: [ctx.subProject.id, ''], type }) :
                     await ctx.service.message.count({ status: 1, type });
 
                 const limit = 5;
                 const offset = limit * (this.ctx.page - 1);
 
-                const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, limit, offset, type);
+                const msgList = await ctx.service.message.getMsgList(ctx.session.sessionProject.id, ctx.subProject.id, limit, offset, type);
 
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const userPermission = pa !== undefined && pa.permission !== '' ? JSON.parse(pa.permission) : null;
                 const userMsgPermission = userPermission !== null && userPermission.project_msg !== undefined && parseInt(userPermission.project_msg) === 1;
 
-                if (!msgId) {
+                if (!msgInfo) {
                     msgInfo = msgList[0];
                 }
                 // 分页相关
@@ -193,7 +193,7 @@ module.exports = app => {
                 console.log(error);
                 this.log(error);
                 ctx.session.postError = error.toString();
-                ctx.redirect('/dashboard');
+                ctx.redirect('/sp/' + ctx.subProject.id + '/dashboard');
             }
         }
 
@@ -204,7 +204,7 @@ module.exports = app => {
          * @return {void}
          */
         async msgAdd(ctx) {
-            let id = ctx.params.id;
+            let id = ctx.params.mid;
             id = parseInt(id);
             try {
                 if (isNaN(id) || id < 0) {
@@ -237,14 +237,14 @@ module.exports = app => {
          */
         async msgSet(ctx) {
             try {
-                let id = ctx.params.id;
+                let id = ctx.params.mid;
                 id = parseInt(id);
                 if (isNaN(id) || id < 0) {
                     throw '参数错误';
                 }
                 const rule = ctx.service.message.rule();
                 ctx.helper.validate(rule);
-                const result = await ctx.service.message.save(id, ctx.request.body, ctx.session.sessionUser, ctx.session.sessionProject.id);
+                const result = await ctx.service.message.save(id, ctx.request.body, ctx.session.sessionUser, ctx.session.sessionProject.id, ctx.subProject.id);
                 if (result) {
                     // 新增的项目通知会发送微信模版消息通知客户
                     if (id === 0) {
@@ -275,7 +275,7 @@ module.exports = app => {
                             }
                         }
                     }
-                    ctx.redirect('/dashboard/msg');
+                    ctx.redirect('/sp/' + ctx.subProject.id + '/dashboard/msg');
                 }
             } catch (error) {
                 console.log(error);
@@ -291,7 +291,7 @@ module.exports = app => {
          */
         async msgDelete(ctx) {
             try {
-                let id = ctx.params.id;
+                let id = ctx.params.mid;
                 id = parseInt(id);
                 if (isNaN(id) || id <= 0) {
                     throw '参数错误';
@@ -302,7 +302,7 @@ module.exports = app => {
                 }
                 const result = await ctx.service.message.deleteMsg(msgInfo.id);
                 if (result) {
-                    ctx.redirect('/dashboard/msg');
+                    ctx.redirect('/sp/' + ctx.subProject.id + '/dashboard/msg');
                 }
             } catch (error) {
                 console.log(error);
@@ -333,7 +333,7 @@ module.exports = app => {
             let stream;
             try {
                 const responseData = { err: 0, msg: '', data: {} };
-                const mid = ctx.params.id || 0;
+                const mid = ctx.params.mid || 0;
                 if (!mid) throw '参数有误';
                 const parts = this.ctx.multipart({
                     autoFields: true,
@@ -391,7 +391,7 @@ module.exports = app => {
          */
         async msgDeleteFile(ctx) {
             try {
-                const mid = ctx.params.id || 0;
+                const mid = ctx.params.mid || 0;
                 const responseData = { err: 0, msg: '', data: {} };
                 const data = JSON.parse(ctx.request.body.data);
                 const fileInfo = await ctx.service.messageAtt.getDataById(data.id);

+ 2 - 2
app/controller/payment_controller.js

@@ -254,7 +254,7 @@ module.exports = app => {
                         const modes = ctx.subProject.payment_setting ? JSON.parse(ctx.subProject.payment_setting) : ctx.helper._.cloneDeep(paymentConst.setting_modes);
                         const checked = data.checked;
                         if (modes[data.mode_type]) {
-                            const detailCount = await ctx.service.paymentDetail.getCountByPidType(ctx.session.sessionProject.id, modes[data.mode_type].value);
+                            const detailCount = await ctx.service.paymentDetail.getCountByPidType(ctx.subProject.id, modes[data.mode_type].value);
                             if (detailCount > 0 && !checked) {
                                 throw '已存在对应模块的详情,无法关闭该模块';
                             }
@@ -296,7 +296,7 @@ module.exports = app => {
                 }
                 const modes = ctx.subProject.payment_setting ? JSON.parse(ctx.subProject.payment_setting) : ctx.helper._.cloneDeep(paymentConst.setting_modes);
                 for (const m in modes) {
-                    const detailCount = await ctx.service.paymentDetail.getCountByPidType(ctx.session.sessionProject.id, modes[m].value);
+                    const detailCount = await ctx.service.paymentDetail.getCountByPidType(ctx.subProject.id, modes[m].value);
                     modes[m].can_check = !detailCount;
                 }
                 const renderData = {

+ 3 - 0
app/controller/sub_proj_setting_controller.js

@@ -392,6 +392,9 @@ module.exports = app => {
                 this.ctx.subProject.page_show.close1stStageCheckDealParam = data.close1stStageCheckDealParam ? 1 : 0;
                 this.ctx.subProject.page_show.openMultiStageCalc = data.openMultiStageCalc ? 1 : 0;
                 this.ctx.subProject.page_show.closeWapYfSf = data.closeWapYfSf ? 1 : 0;
+                this.ctx.subProject.page_show.openStageAudit = data.openStageAudit ? 1 : 0;
+                this.ctx.subProject.page_show.stageAuditEarly = data.stageAuditEarly || 0;
+                this.ctx.subProject.page_show.stageAuditWorry = data.stageAuditWorry || 0;
                 const result2 = await ctx.service.subProject.updatePageshow(ctx.subProject.id);
                 if (!result2) throw '保存数据失败';
                 if (data.addFunSet) {

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

@@ -36,7 +36,7 @@ $(document).ready(() => {
             $('#creator').html(msgInfo.creator);
             $('#view-msg .modal-title').text('项目通知');
             if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
-                const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
+                const permissionHtml = '<a href="/sp/' + spid +'/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
                 $('#user_permission').html(permissionHtml);
             }
         } else {

+ 9 - 0
app/public/js/file_detail.js

@@ -37,6 +37,10 @@ $(document).ready(function() {
                 }
             }
         }
+        refreshFileCountHint() {
+            const sum = _.sum(this.dragTree.children.map(x => { return x.file_count}));
+            $('#file-count').html(`文件总数:${sum}`);
+        }
         calcTotalFileCount() {
             this.dragTree.recursiveFun(this.dragTree.children, x => {
                 if (x.children && x.children.length > 0) {
@@ -89,6 +93,7 @@ $(document).ready(function() {
             this.dragTree.loadDatas(data);
             this.calcTotalFileCount();
             this.loadFiling();
+            this.refreshFileCountHint();
         }
         _getFileNameHtml(file) {
             const moveHtml = file.canEdit ? `<a href="javascript: void(0);" class="mr-1" name="move-file" fid="${file.id}"><i class="fa fa-exchange fa-fw"></i></a>` : '';
@@ -265,6 +270,7 @@ $(document).ready(function() {
                 filingObj.curFiling.source_node.files.unshift(...data.files);
                 filingObj.refreshPages();
                 filingObj.refreshFilesTable();
+                filingObj.refreshFileCountHint();
                 if (callback) callback();
             });
         }
@@ -285,6 +291,7 @@ $(document).ready(function() {
                     filingObj.updateFilingFileCount(filingObj.curFiling, result.filing.file_count);
                     filingObj.refreshPages();
                     filingObj.refreshFilesTable();
+                    filingObj.refreshFileCountHint();
                     if (callback) callback();
             });
 
@@ -303,6 +310,7 @@ $(document).ready(function() {
                 if (data.filing.id === filingObj.curFiling.source_node.id) {
                     filingObj.refreshPages();
                     filingObj.refreshFilesTable();
+                    filingObj.refreshFileCountHint();
                 }
                 if (callback) callback();
             });
@@ -327,6 +335,7 @@ $(document).ready(function() {
                 filingObj.curFiling.source_node.files.unshift(...data.files);
                 filingObj.updateFilingFileCount(filingObj.curFiling, data.filing.file_count);
                 filingObj.refreshFilesTable();
+                filingObj.refreshFileCountHint();
                 filingObj.refreshPages();
                 if (callback) callback();
             });

+ 2 - 2
app/public/js/payment_index.js

@@ -269,8 +269,8 @@ $(function () {
 
     $('body').on('click', '.show_del_btn', function () {
         const type = $(this).attr('data-type');
-        const id = parseInt($(this).attr('data-id'));
-        const info = type === 'tender' ? _.find(allTenders, { id }) : _.find(allFolders, { id });
+        const id = $(this).attr('data-id');
+        const info = type === 'tender' ? _.find(allTenders, { id: parseInt(id) }) : _.find(allFolders, { id });
         if (!info) {
             toastr.error('文件夹或标段不存在');
             return;

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

@@ -633,7 +633,7 @@ function postAttr () {
             },
         },
     };
-    const tenderId = window.location.pathname.split('/')[2];
+    const tenderId = window.location.pathname.split('/')[4];
     postData('/sp/' + spid + '/payment/info/save', { type: 'info', postData: { id: tenderId, info} }, function (data) {
         property.deal_info = info.deal_info;
         property.construction_unit = info.construction_unit;

+ 2 - 1
app/public/js/sub_menu.js

@@ -24,12 +24,13 @@
             setting.callback({mini: true});
         };
         const menuType = setting.key ? getLocalCache(setting.key) : null;
-        if (menuType && menuType === 'miniMenu') {
+        if (menuType && menuType === 'miniMenu' && setting.forceMini) {
             showMiniMenu();
         } else {
             showMenu();
         }
         toMenu.click(function () {
+            if (setting.forceMini) return;
             showMenu();
             if (setting.key) {
                 setLocalCache(setting.key, 'menu');

+ 7 - 7
app/router.js

@@ -222,13 +222,13 @@ module.exports = app => {
     // 项目列表跳转项目内部 todo 除标段内,均改为/sp/:id/xxx的链接形式
     // **控制面板
     app.get('/sp/:id/dashboard', sessionAuth, subProjectCheck, 'dashboardController.index');
-    app.get('/dashboard/msg', sessionAuth, 'dashboardController.msg');
-    app.get('/dashboard/msg/:id', sessionAuth, 'dashboardController.msg');
-    app.get('/dashboard/msg/add/:id', sessionAuth, 'dashboardController.msgAdd');
-    app.post('/dashboard/msg/set/:id', sessionAuth, datetimeFill, 'dashboardController.msgSet');
-    app.get('/dashboard/msg/del/:id', sessionAuth, 'dashboardController.msgDelete');
-    app.post('/dashboard/msg/:id/file/upload', sessionAuth, 'dashboardController.msgUploadFile');
-    app.post('/dashboard/msg/:id/file/del', sessionAuth, 'dashboardController.msgDeleteFile');
+    app.get('/sp/:id/dashboard/msg', sessionAuth, subProjectCheck, 'dashboardController.msg');
+    app.get('/sp/:id/dashboard/msg/:mid', sessionAuth, subProjectCheck, 'dashboardController.msg');
+    app.get('/sp/:id/dashboard/msg/add/:mid', sessionAuth, subProjectCheck, 'dashboardController.msgAdd');
+    app.post('/sp/:id/dashboard/msg/set/:mid', sessionAuth, subProjectCheck, datetimeFill, 'dashboardController.msgSet');
+    app.get('/sp/:id/dashboard/msg/del/:mid', sessionAuth, subProjectCheck, 'dashboardController.msgDelete');
+    app.post('/dashboard/msg/:mid/file/upload', sessionAuth, 'dashboardController.msgUploadFile');
+    app.post('/dashboard/msg/:mid/file/del', sessionAuth, 'dashboardController.msgDeleteFile');
     app.get('/wap/message/download/file/:fid', 'wapController.messageDownloadFile');
     // 推送相关
     // app.post('/dashboard/push', sessionAuth, 'dashboardController.pushSet');

+ 5 - 3
app/service/message.js

@@ -95,7 +95,7 @@ module.exports = app => {
          * @param {Object} data - post过来的数据
          * @return {Boolean} - 返回修改结果
          */
-        async save(id, data, user, projectId) {
+        async save(id, data, user, projectId, spid = '') {
             if (data._csrf_j !== undefined) {
                 delete data._csrf_j;
             }
@@ -110,6 +110,7 @@ module.exports = app => {
                 } else {
                     data.release_time = data.create_time;
                     data.project_id = projectId;
+                    data.spid = spid;
                     data.create_uid = user.accountId;
                     data.creator = user.name;
                     data.istop = parseInt(data.istop) === 1 ? data.create_time : 0;
@@ -146,9 +147,10 @@ module.exports = app => {
          * @param {Object} data - post过来的数据
          * @return {Boolean} - 返回修改结果
          */
-        async getMsgList(projectId, limit = 5, offset = 0, type = 1) {
+        async getMsgList(projectId, spid = '', limit = 5, offset = 0, type = 1) {
+            const sqSql = spid ? ' AND (`spid` = "' + spid + '" OR `spid` = "")' : ' AND `spid` = ""';
             if (type === 1) {
-                const sql = 'SELECT * FROM ?? WHERE `project_id` = ? AND `type` = ? ORDER BY CONCAT(`istop`,`release_time`) DESC LIMIT ?,?';
+                const sql = 'SELECT * FROM ?? WHERE `project_id` = ?' + sqSql + ' AND `type` = ? ORDER BY CONCAT(`istop`,`release_time`) DESC LIMIT ?,?';
                 const sqlParam = [this.tableName, projectId, type, offset, limit];
                 const result = await this.db.query(sql, sqlParam);
                 for (const r of result) {

+ 3 - 3
app/service/payment_detail.js

@@ -324,9 +324,9 @@ module.exports = app => {
             return this.count({ tender_id: tid });
         }
 
-        async getCountByPidType(pid, type = 1) {
-            const sql = 'SELECT count(pd.`id`) as count FROM ?? as pd LEFT JOIN ?? as pt ON pd.`tender_id` = pt.`id` WHERE pid = ? AND type = ?';
-            const params = [this.tableName, this.ctx.service.paymentTender.tableName, pid, type];
+        async getCountByPidType(spid, type = 1) {
+            const sql = 'SELECT count(pd.`id`) as count FROM ?? as pd LEFT JOIN ?? as pt ON pd.`tender_id` = pt.`id` WHERE pt.spid = ? AND pd.type = ?';
+            const params = [this.tableName, this.ctx.service.paymentTender.tableName, spid, type];
             const result = await this.db.queryOne(sql, params);
             return result ? result.count : 0;
         }

+ 5 - 3
app/service/payment_tender.js

@@ -79,8 +79,9 @@ module.exports = app => {
                 if (folderInfo.parent_path) {
                     const parentFolderIds = folderInfo.parent_path.split('-');
                     for (const pf of parentFolderIds) {
+                        const pfInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: parseInt(pf) });
                         updateData.push({
-                            id: parseInt(pf),
+                            id: pfInfo.id,
                             had_tender: 1,
                         });
                     }
@@ -124,10 +125,11 @@ module.exports = app => {
                         const parentFolderIds = folderInfo.parent_path.split('-').reverse();
                         for (const pfid of parentFolderIds) {
                             const parentFolderId = parseInt(pfid);
-                            const leafFolderCount = await transaction.count(this.ctx.service.paymentFolder.tableName, { parent_id: parentFolderId, had_tender: 1 });
+                            const leafFolderCount = await transaction.count(this.ctx.service.paymentFolder.tableName, { spid: this.ctx.subProject.id, parent_id: parentFolderId, had_tender: 1 });
                             if (leafFolderCount === 1) {
+                                const pfInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: parseInt(parentFolderId) });
                                 updateDatas.push({
-                                    id: parentFolderId,
+                                    id: pfInfo.id,
                                     had_tender: 0,
                                 });
                             } else {

+ 1 - 1
app/service/project_account.js

@@ -1081,7 +1081,7 @@ module.exports = app => {
             const filterSql = this._getFilterSql(filterInfo);
             const sql = `SELECT pa.*, spp.id AS permission_id, 
                     spp.file_permission, spp.budget_permission, spp.info_permission, spp.datacollect_permission, spp.fund_trans_permission, spp.fund_pay_permission, spp.contract_permission, spp.payment_permission
-                FROM ${this.ctx.service.subProjPermission.tableName} spp LEFT JOIN ${this.tableName} pa ON spp.uid = pa.id WHERE ` + filterSql + ' ORDER BY spp.create_time DESC';
+                FROM ${this.ctx.service.subProjPermission.tableName} spp LEFT JOIN ${this.tableName} pa ON spp.uid = pa.id WHERE ` + filterSql + ' ORDER BY pa.company ASC, spp.create_time DESC';
             const result = await this.db.query(sql);
             return result;
         }

+ 2 - 2
app/view/dashboard/index.ejs

@@ -351,7 +351,7 @@
                     <div class="card ml-3">
                         <div class="card-header card-white d-flex justify-content-between">
                             <div class="card-big-htext"><span class="card-icon mr-2"></span>项目通知</div>
-                            <div class="mt-1"><a class="text-secondary" href="/dashboard/msg">查看全部</a></div>
+                            <div class="mt-1"><a class="text-secondary" href="/sp/<%- ctx.subProject.id %>/dashboard/msg">查看全部</a></div>
                         </div>
                         <div class="card-body p-0">
                             <div class="contant-height-three">
@@ -373,7 +373,7 @@
                             </div>
                             <% if (userMsgPermission) { %>
                                 <!--发布通知-->
-                                <div class="mx-3 pb-3 addmsg-height"><a class="btn btn-outline-primary btn-block" href="/dashboard/msg/add/0">发布通知</a></div>
+                                <div class="mx-3 pb-3 addmsg-height"><a class="btn btn-outline-primary btn-block" href="/sp/<%- ctx.subProject.id %>/dashboard/msg/add/0">发布通知</a></div>
                             <% } %>
                         </div>
                     </div>

+ 3 - 3
app/view/dashboard/msg.ejs

@@ -10,8 +10,8 @@
                         <div class="card">
                             <div class="card-header">
                                 <div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
-                                    <a href="/dashboard/msg" <% if (type === 1 || (msgInfo && msgInfo.type === 1)) { %>class="btn btn-primary"<% } else { %>class="btn btn-outline-primary"<% } %>>项目通知</a>
-                                    <a href="/dashboard/msg?type=2" <% if (type === 2 || (msgInfo && msgInfo.type === 2)) { %>class="btn btn-primary"<% } else { %>class="btn btn-outline-primary"<% } %>>系统消息</a>
+                                    <a href="/sp/<%- ctx.subProject.id %>/dashboard/msg" <% if (type === 1 || (msgInfo && msgInfo.type === 1)) { %>class="btn btn-primary"<% } else { %>class="btn btn-outline-primary"<% } %>>项目通知</a>
+                                    <a href="/sp/<%- ctx.subProject.id %>/dashboard/msg?type=2" <% if (type === 2 || (msgInfo && msgInfo.type === 2)) { %>class="btn btn-primary"<% } else { %>class="btn btn-outline-primary"<% } %>>系统消息</a>
                                 </div>
                             </div>
                             <ul class="list-group list-group-flush msg-height-list">
@@ -34,7 +34,7 @@
                                     <span id="user_permission">
                                         <% if (uid === msgInfo.create_uid) { %>
                                             <!--有编辑权用户-->
-                                            <a href="/dashboard/msg/add/<%- msgInfo.id %>" class="btn btn-sm btn-outline-primary">编辑</a>
+                                            <a href="/sp/<%- ctx.subProject.id %>/dashboard/msg/add/<%- msgInfo.id %>" class="btn btn-sm btn-outline-primary">编辑</a>
                                         <% } %>
                                     </span>
                                 </p>

+ 1 - 1
app/view/dashboard/msg_add.ejs

@@ -5,7 +5,7 @@
     <div class="content-wrap">
         <div class="sjs-height-0">
             <div class="container py-5">
-                <form id="save-form" class="row" action="/dashboard/msg/set/<%= msgInfo.id === undefined ? 0 : msgInfo.id %>" method="post">
+                <form id="save-form" class="row" action="/sp/<%- ctx.subProject.id %>/dashboard/msg/set/<%= msgInfo.id === undefined ? 0 : msgInfo.id %>" method="post">
                     <div class="card col-9">
                         <div class="card-body">
                             <div class="msg-height-content">

+ 1 - 1
app/view/dashboard/msg_modal.ejs

@@ -10,7 +10,7 @@
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
-                <a href="/dashboard/msg/del/<%= msgInfo.id %>" class="btn btn-danger confirm">确认删除</a>
+                <a href="/sp/<%- ctx.subProject.id %>/dashboard/msg/del/<%= msgInfo.id %>" class="btn btn-danger confirm">确认删除</a>
             </div>
         </div>
     </div>

+ 1 - 1
app/view/file/file.ejs

@@ -1,7 +1,7 @@
 <div class="panel-content">
     <div class="panel-title fluid">
         <div class="title-main  d-flex justify-content-between">
-            <div>资料归集/<%- ctx.subProject.name %></div>
+            <div>资料归集/<%- ctx.subProject.name %><span class="ml-4" id="file-count"></span></div>
             <div class="ml-auto">
                 <% if (ctx.session.sessionUser.is_admin) { %>
                 <a href="/sp/<%- ctx.subProject.id %>/fm" class="btn btn-outline-primary btn-sm ml-1">管理分类</a>

+ 119 - 39
app/view/sp_setting/fun.ejs

@@ -111,55 +111,85 @@
                             <div class="col-6">
                                 <div class="card mb-3 ">
                                     <div class="card-header d-flex justify-content-between">
-                                        <div>计量期上报</div>
-                                        <div class="row m-0">
-                                            <div class="pull-right d-inline-block form-group form-check ml-auto">
-                                                <div class="custom-control custom-switch">
-                                                    <input type="checkbox" class="custom-control-input" id="openStageStart" <% if(ctx.subProject.page_show.openStageStart) { %>checked<% } %> onchange="updateSetting();">
-                                                    <label class="custom-control-label" for="openStageStart"></label>
-                                                </div>
-                                            </div>
-                                        </div>
+                                        <div>计量期上报/审批</div>
                                     </div>
                                     <div class="card-body pb-2">
                                         <div class="form-group mb-1">
-                                            <div>
-                                                <div class="input-group input-group-sm mb-2">
-                                                    <div class="input-group-prepend">
-                                                        <span class="input-group-text">开始日期:</span>
-                                                        <span class="input-group-text" style="width: 90px;padding-left: 12px;">每月</span>
+                                            <nav class="nav nav-tabs">
+                                                <a class="nav-link nav-item active" data-toggle="tab" name="stage-setting" type="audit" onclick="changeSettingTab(this);">审批</a>
+                                                <a class="nav-link nav-item" data-toggle="tab" name="stage-setting" type="start" onclick="changeSettingTab(this);">上报</a>
+                                                <div class="ml-auto">
+                                                    <div class="custom-control custom-switch" id="switch-stage-start" style="display: none;">
+                                                        <input type="checkbox" class="custom-control-input" id="openStageStart" <% if(ctx.subProject.page_show.openStageStart) { %>checked<% } %> onchange="updateSetting();">
+                                                        <label class="custom-control-label" for="openStageStart"></label>
+                                                    </div>
+                                                    <div class="custom-control custom-switch" id="switch-stage-audit">
+                                                        <input type="checkbox" class="custom-control-input" id="openStageAudit" <% if(ctx.subProject.page_show.openStageAudit) { %>checked<% } %> onchange="updateSetting();">
+                                                        <label class="custom-control-label" for="openStageAudit"></label>
                                                     </div>
-                                                    <select class="form-control form-control-sm" id="start_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
-                                                        <option value="0">请选择日</option>
-                                                        <% for (let i = 1; i <= 31;i++) { %>
-                                                            <option value="<%- i %>" <% if (funSet.stage_start.start_day === i) {%>selected<% } %>><%- i %></option>
-                                                        <% } %>
-                                                    </select>
-                                                    <span class="text-danger mx-2"></span>
                                                 </div>
-                                                <div class="input-group input-group-sm mb-2">
-                                                    <div class="input-group-prepend">
-                                                        <span class="input-group-text">截止日期:</span>
+                                            </nav>
+                                            <div class="tab-content my-2">
+                                                <div class="tab-pane fade active show" id="stage-audit-tab" role="tabpanel" aria-labelledby="home-tab">
+                                                    <div class="input-group input-group-sm mt-2 col-6">
+                                                        <div class="input-group-prepend">
+                                                            <span class="input-group-text">预警:</span>
+                                                        </div>
+                                                        <input type="number" class="form-control" value="<%- ctx.subProject.page_show.stageAuditEarly %>" <% if(!ctx.subProject.page_show.openStageAudit) { %>disabled<% } %> id="stage-audit-early" oninput="limitDecimal(this);" min="0" max="30" onchange="updateSetting();">
+                                                        <div class="input-group-append">
+                                                            <span class="input-group-text">天</span>
+                                                        </div>
+                                                    </div>
+                                                    <div class="text-muted ml-4 mt-2"><small>审批停留时长符合设置天数(包含节假日),审批流程提醒为预警</small></div>
+                                                    <div class="input-group input-group-sm mt-2 col-6">
+                                                        <div class="input-group-prepend">
+                                                            <span class="input-group-text">紧急:</span>
+                                                        </div>
+                                                        <input type="number" class="form-control" value="<%- ctx.subProject.page_show.stageAuditWorry %>" <% if(!ctx.subProject.page_show.openStageAudit) { %>disabled<% } %> id="stage-audit-worry" oninput="limitDecimal(this);" min="0" max="30" onchange="updateSetting();">
+                                                        <div class="input-group-append">
+                                                            <span class="input-group-text">天</span>
+                                                        </div>
                                                     </div>
-                                                    <select class="form-control form-control-sm" id="end_month" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
-                                                        <option value="0">请选择月</option>
-                                                        <% for (const i of endMonth) { %>
-                                                        <option value="<%- i.val %>" <% if (funSet.stage_start.end_month === i.val) {%>selected<% } %> ><%- i.name %></option>
-                                                        <% } %>
-                                                    </select>
-                                                    <select class="form-control form-control-sm" id="end_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
-                                                        <option value="0">请选择日</option>
-                                                        <% for (let i = 1; i <= 31;i++) { %>
+                                                    <div class="text-muted ml-4 mt-2"><small>审批停留时长符合设置天数(包含节假日),审批流程提醒为紧急</small></div>
+                                                </div>
+                                                <div class="tab-pane fade" id="stage-start-tab" role="tabpanel" aria-labelledby="profile-tab">
+                                                    <div class="input-group input-group-sm mb-2">
+                                                        <div class="input-group-prepend">
+                                                            <span class="input-group-text">开始日期:</span>
+                                                            <span class="input-group-text" style="width: 90px;padding-left: 12px;">每月</span>
+                                                        </div>
+                                                        <select class="form-control form-control-sm" id="start_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
+                                                            <option value="0">请选择日</option>
+                                                            <% for (let i = 1; i <= 31;i++) { %>
+                                                            <option value="<%- i %>" <% if (funSet.stage_start.start_day === i) {%>selected<% } %>><%- i %></option>
+                                                            <% } %>
+                                                        </select>
+                                                        <span class="text-danger mx-2"></span>
+                                                    </div>
+                                                    <div class="input-group input-group-sm mb-2">
+                                                        <div class="input-group-prepend">
+                                                            <span class="input-group-text">截止日期:</span>
+                                                        </div>
+                                                        <select class="form-control form-control-sm" id="end_month" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
+                                                            <option value="0">请选择月</option>
+                                                            <% for (const i of endMonth) { %>
+                                                            <option value="<%- i.val %>" <% if (funSet.stage_start.end_month === i.val) {%>selected<% } %> ><%- i.name %></option>
+                                                            <% } %>
+                                                        </select>
+                                                        <select class="form-control form-control-sm" id="end_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
+                                                            <option value="0">请选择日</option>
+                                                            <% for (let i = 1; i <= 31;i++) { %>
                                                             <option value="<%- i %>" <% if (funSet.stage_start.end_day === i) {%>selected<% } %>><%- i %></option>
-                                                        <% } %>
-                                                    </select>
-                                                    <span class="text-danger mx-2"></span>
+                                                            <% } %>
+                                                        </select>
+                                                        <span class="text-danger mx-2"></span>
+                                                    </div>
+                                                    <div class="mt-3">
+                                                        <label class="form-text alert alert-danger">开启选项后,超出范围内的日期,则不允许上报期计量。</label>
+                                                    </div>
                                                 </div>
                                             </div>
                                         </div>
-                                        <div class="mt-3">
-                                            <label class="form-text alert alert-danger">开启选项后,超出范围内的日期,则不允许上报期计量。</label>
-                                        </div>
                                     </div>
                                 </div>
                             </div>
@@ -316,6 +346,20 @@
 <script>
     let changeClass = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_class)) %>'));
     let changeState = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_state)) %>'));
+    const changeSettingTab = function(tab) {
+        const type = tab.getAttribute('type');
+        if (type === 'start') {
+            $('#switch-stage-start').show();
+            $('#switch-stage-audit').hide();
+            $('#stage-start-tab').addClass('active').addClass('show');
+            $('#stage-audit-tab').removeClass('active').removeClass('show');
+        } else if (type === 'audit') {
+            $('#switch-stage-start').hide();
+            $('#switch-stage-audit').show();
+            $('#stage-audit-tab').addClass('active').addClass('show');
+            $('#stage-start-tab').removeClass('active').removeClass('show');
+        }
+    }
     $(() => {
         autoFlashHeight();
         // 自定义变更类别
@@ -384,6 +428,32 @@
             }
         });
     });
+
+    // 根据Min Max限制Input输入
+    function limitInputMinMax (obj) {
+        if (obj.max && _.toNumber(obj.value) > _.toNumber(obj.max)) {
+            obj.value = obj.max;
+        }
+        if(obj.min && _.toNumber(obj.value) < _.toNumber(obj.min)) {
+            obj.value = obj.min;
+        }
+    }
+    // 根据Maxlength限制input输入
+    function limitMaxLength (obj) {
+        if (obj.maxLength >= 0 && obj.value.length > obj.maxLength) {
+            obj.value = obj.value.substr(0, obj.maxLength);
+        }
+    }
+    // 根据正则限制输入
+    function limitReg(obj, reg) {
+        obj.value = obj.value.replace(reg, '');
+    }
+    // 小数位数 input 输入限制
+    function limitDecimal(obj) {
+        limitReg(obj, /[^\d]/g);
+        limitMaxLength(obj);
+        limitInputMinMax(obj);
+    }
     const updateSetting = function (tab = false, set_type = 0) {
         if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 1) {
             $('#openChangeApply').prop('checked', true);
@@ -451,6 +521,13 @@
             $('#end_month').removeAttr('disabled');
             $('#end_day').removeAttr('disabled');
         }
+        if ($('#openStageAudit')[0].checked) {
+            $('#stage-audit-early').removeAttr('disabled');
+            $('#stage-audit-worry').removeAttr('disabled');
+        } else {
+            $('#stage-audit-early').attr('disabled', 'disabled');
+            $('#stage-audit-worry').attr('disabled', 'disabled');
+        }
         if (set_type === 1) {
             // 自定义变更类别
             const change_class = [];
@@ -544,6 +621,9 @@
             openMultiStageCalc: $('#openMultiStageCalc')[0].checked,
             closeWapYfSf: $('#closeWapYfSf')[0].checked,
             addFunSet: _.size(pushData) !== 0 ? pushData : null,
+            openStageAudit: $('#openStageAudit')[0].checked,
+            stageAuditEarly: parseInt($('#stage-audit-early').val()),
+            stageAuditWorry: parseInt($('#stage-audit-worry').val()),
         }, function (result) {
             if ($('#openChangeState').is(':checked')) {
                 $('#openBgStatus').removeClass('text-secondary');

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

@@ -1174,7 +1174,7 @@
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
         key: 'menu.1.0.0',
-        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
+        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1', forceMini: <%- !ctx.subProject.page_show.openTenderContract && !ctx.subProject.page_show.openConstruction %>,
         callback: function (info) {
             if (info.mini) {
                 $('.panel-title').addClass('fluid');

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

@@ -27,7 +27,7 @@
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
         key: 'list.menu.1.0.0',
-        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
+        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1', forceMini: <%- !ctx.subProject.page_show.openTenderContract && !ctx.subProject.page_show.openConstruction %>,
         callback: function (info) {
             if (info.mini) {
                 $('.panel-title').addClass('fluid');

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

@@ -27,7 +27,7 @@
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
         key: 'list.menu.1.0.0',
-        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
+        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1', forceMini: <%- !ctx.subProject.page_show.openTenderContract && !ctx.subProject.page_show.openConstruction %>,
         callback: function (info) {
             if (info.mini) {
                 $('.panel-title').addClass('fluid');

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

@@ -26,7 +26,7 @@
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
         key: 'list.menu.1.0.0',
-        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
+        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1', forceMini: <%- !ctx.subProject.page_show.openTenderContract && !ctx.subProject.page_show.openConstruction %>,
         callback: function (info) {
             if (info.mini) {
                 $('.panel-title').addClass('fluid');

+ 3 - 0
sql/update.sql

@@ -75,6 +75,9 @@ ALTER TABLE `zh_notice`
 ADD COLUMN `spid` varchar(36) NULL DEFAULT '' COMMENT '子项目id' AFTER `pid`,
 ADD COLUMN `tid` int(11) NULL DEFAULT NULL COMMENT '标段id' AFTER `spid`;
 
+ALTER TABLE `zh_message`
+ADD COLUMN `spid` varchar(36) NULL DEFAULT '' COMMENT '子项目id' AFTER `project_id`;
+
 ------------------------------------
 -- 表数据
 ------------------------------------