Browse Source

计量用户权限设置(暂停)

laiguoran 6 years ago
parent
commit
b7eacb7c5a

+ 48 - 0
app/const/account_permission.js

@@ -0,0 +1,48 @@
+'use strict';
+
+/**
+ * 用户权限相关常量
+ *
+ * @author Ellisran
+ * @date 2019/3/26
+ * @version
+ */
+const create_tender = {
+    tzfj: 0,
+    cjtzxd: 1,
+    cjjlq: 2,
+    cjgcbg: 3,
+};
+const create_tender_group = [];
+create_tender_group[create_tender.tzfj] = '台账分解';
+create_tender_group[create_tender.cjtzxd] = '创建台账修订';
+create_tender_group[create_tender.cjjlq] = '创建计量期';
+create_tender_group[create_tender.cjgcbg] = '创建工程变更';
+
+// 权限管理页
+const permission = {
+    tender: {
+        class: 'fa fa-list-ul',
+        title: '标段管理',
+        type: 'checkbox',
+        children: [
+            { title: '创建标段', value: 1 },
+            { title: '查阅所有标段', value: 2 },
+        ],
+    },
+    cooperation: {
+        class: '',
+        title: '协作办公',
+        type: 'radio',
+        children: [
+            { title: '启用', value: 1 },
+            { title: '关闭', value: 0 },
+        ],
+    },
+};
+
+module.exports = {
+    tenderPermission: create_tender,
+    tenderPermissionList: create_tender_group,
+    permission,
+};

+ 36 - 1
app/controller/setting_controller.js

@@ -12,6 +12,7 @@ const officeList = require('../const/cld_office').list;
 const settingConst = require('../const/setting.js');
 const settingConst = require('../const/setting.js');
 const settingMenu = require('../../config/menu').settingMenu;
 const settingMenu = require('../../config/menu').settingMenu;
 const accountGroup = require('../const/account_group').group;
 const accountGroup = require('../const/account_group').group;
+const permission = require('../const/account_permission').permission;
 
 
 module.exports = app => {
 module.exports = app => {
 
 
@@ -97,13 +98,14 @@ module.exports = app => {
                 // 获取项目用户列表
                 // 获取项目用户列表
                 const accountData = await ctx.service.projectAccount.getAllDataByCondition({
                 const accountData = await ctx.service.projectAccount.getAllDataByCondition({
                     where: { project_id: projectId },
                     where: { project_id: projectId },
-                    columns: ['id', 'account', 'name', 'company', 'role', 'mobile', 'telephone', 'enable', 'is_admin', 'account_group'],
+                    columns: ['id', 'account', 'name', 'company', 'role', 'mobile', 'telephone', 'enable', 'is_admin', 'account_group', 'permission', 'cooperation'],
                 });
                 });
 
 
                 const renderData = {
                 const renderData = {
                     projectData,
                     projectData,
                     accountData,
                     accountData,
                     accountGroup,
                     accountGroup,
+                    permission,
                     // rule: JSON.stringify(frontRule),
                     // rule: JSON.stringify(frontRule),
                 };
                 };
                 await this.layout('setting/user.ejs', renderData, 'setting/user_modal.ejs');
                 await this.layout('setting/user.ejs', renderData, 'setting/user_modal.ejs');
@@ -242,6 +244,39 @@ module.exports = app => {
         }
         }
 
 
         /**
         /**
+         * 项目设置 -- 账号权限编辑(Post)
+         * @param ctx
+         * @return {Promise<void>}
+         */
+        async permission(ctx) {
+            const projectData = ctx.session.sessionProject;
+            try {
+                // 验证数据
+                if (projectData.id === undefined) {
+                    throw '不存在对应的项目数据';
+                }
+
+                const accountId = parseInt(ctx.request.body.id);
+                const accountInfo = await ctx.service.projectAccount.getDataById(accountId);
+                if (accountInfo === null) {
+                    throw '不存在该客户';
+                }
+
+                const result = await ctx.service.projectAccount.permissionSave(accountId, ctx.request.body);
+                if (!result) {
+                    throw '修改权限失败!';
+                }
+
+                this.setMessage('保存账号数据成功', this.messageType.SUCCESS);
+                ctx.redirect('/' + ctx.controllerName + '/user');
+            } catch (error) {
+                console.log(error);
+                this.setMessage(error.toString(), this.messageType.ERROR);
+                ctx.redirect(ctx.request.headers.referer);
+            }
+        }
+
+        /**
          * 项目设置 -- 自定义标段分类(Get)
          * 项目设置 -- 自定义标段分类(Get)
          *
          *
          * @param ctx
          * @param ctx

+ 50 - 2
app/controller/tender_controller.js

@@ -13,6 +13,7 @@ const codeRuleConst = require('../const/code_rule');
 const settingConst = require('../const/setting.js');
 const settingConst = require('../const/setting.js');
 const tenderMenu = require('../../config/menu').tenderMenu;
 const tenderMenu = require('../../config/menu').tenderMenu;
 const auditConst = require('../const/audit').flow;
 const auditConst = require('../const/audit').flow;
+const accountPermission = require('../const/account_permission');
 
 
 module.exports = app => {
 module.exports = app => {
 
 
@@ -34,7 +35,6 @@ module.exports = app => {
             try {
             try {
                 const tenderList = await this.ctx.service.tender.getList();
                 const tenderList = await this.ctx.service.tender.getList();
                 const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
                 const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
-
                 const renderData = {
                 const renderData = {
                     tenderList,
                     tenderList,
                     tenderConst,
                     tenderConst,
@@ -44,6 +44,7 @@ module.exports = app => {
                     measureType: tenderConst.measureType,
                     measureType: tenderConst.measureType,
                     jsFiles: this.app.jsFiles.common.concat(this.jsFiles),
                     jsFiles: this.app.jsFiles.common.concat(this.jsFiles),
                     auditConst,
                     auditConst,
+                    userPermission: this.ctx.session.sessionUser.permission !== '' ? JSON.parse(this.ctx.session.sessionUser.permission) : null,
                 };
                 };
                 await this.layout(view, renderData, modal);
                 await this.layout(view, renderData, modal);
             } catch (err) {
             } catch (err) {
@@ -96,7 +97,10 @@ module.exports = app => {
                 const responseData = {
                 const responseData = {
                     err: 0, msg: '', data: null,
                     err: 0, msg: '', data: null,
                 };
                 };
-
+                const userPermission = ctx.session.sessionUser.permission !== '' ? JSON.parse(ctx.session.sessionUser.permission) : null;
+                if (userPermission === null || userPermission.tender === undefined || userPermission.tender.indexOf('1') === -1) {
+                    throw '当前用户没有创建标段的权限';
+                }
                 const data = JSON.parse(ctx.request.body.data);
                 const data = JSON.parse(ctx.request.body.data);
                 if (!data.name || data.name === '') {
                 if (!data.name || data.name === '') {
                     throw '标段信息不完整';
                     throw '标段信息不完整';
@@ -176,6 +180,7 @@ module.exports = app => {
                     tenderInfo: ctx.tender.info,
                     tenderInfo: ctx.tender.info,
                     tenderMenu: this.menu.tenderMenu,
                     tenderMenu: this.menu.tenderMenu,
                     preUrl: '/tender/' + ctx.tender.id,
                     preUrl: '/tender/' + ctx.tender.id,
+                    cooperation: ctx.session.sessionUser.cooperation,
                 };
                 };
                 await this.layout('tender/detail.ejs', renderData);
                 await this.layout('tender/detail.ejs', renderData);
             } catch (error) {
             } catch (error) {
@@ -232,6 +237,49 @@ module.exports = app => {
         }
         }
 
 
         /**
         /**
+         * 标段协作办公
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        async tenderCooperation(ctx) {
+            const tenderId = ctx.params.id;
+            try {
+                if (!ctx.session.sessionUser.cooperation) {
+                    throw '权限不足';
+                }
+                const tender = await ctx.service.tender.getDataById(tenderId);
+                const user = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
+                // 获取已参与协作用户列表
+                const cooperationArray = [];
+                if (tender.cooperation !== null && tender.cooperation !== '') {
+                    const cooperationList = JSON.parse(tender.cooperation);
+                    for (const cl in cooperationList) {
+                        const clArray = [];
+                        for (const audit of cooperationList[cl]) {
+                            const userInfo = await ctx.service.projectAccount.getDataById(audit);
+                            clArray.push(userInfo);
+                        }
+                        cooperationArray[cl] = clArray;
+                    }
+                }
+
+                const renderData = {
+                    user,
+                    tender,
+                    tenderMenu: this.menu.tenderMenu,
+                    preUrl: '/tender/' + tenderId,
+                    tenderPermissionList: accountPermission.tenderPermissionList,
+                    cooperationArray,
+                };
+                await this.layout('tender/cooperation.ejs', renderData, 'tender/cooperationModal.ejs');
+            } catch (error) {
+                this.log(error);
+                this.ctx.redirect('/tender/' + tenderId);
+            }
+        }
+
+        /**
          * 添加标段操作
          * 添加标段操作
          *
          *
          * @param {Object} ctx - egg全局变量
          * @param {Object} ctx - egg全局变量

+ 25 - 0
app/public/js/setting.js

@@ -104,6 +104,31 @@ $(document).ready(() => {
             self.removeClass('is-invalid');
             self.removeClass('is-invalid');
         }
         }
     });
     });
+
+    // 选中创建标段才可以选择协作办公
+    $('a[data-target="#edit-user2"]').on('click', function () {
+        $('#edit-user2 input:radio').prop('checked', false);
+        $('#edit-user2 input:checkbox').prop('checked', false);
+        const account = $(this).data('account');
+        $('#edit-user2 input[name="id"]').val(account.id);
+        // 权限赋值
+        if (account.permission !== '') {
+            const permission = JSON.parse(account.permission);
+            for (const pm in permission) {
+                if (pm === 'tender' && permission[pm].indexOf('1') !== -1) {
+                    $('#edit-user2 input[name="cooperation"]').attr('disabled', false);
+                } else {
+                    $('#edit-user2 input[name="cooperation"]').attr('disabled', true);
+                }
+                for (const index of permission[pm]) {
+
+                    $('#edit-user2 input:checkbox[id="' + pm + '_' + index + '"]').prop('checked', true);
+                }
+            }
+        }
+        // 协作赋值
+        $('#edit-user2 input:radio[value="' + account.cooperation + '"]').prop('checked', true);
+    });
 });
 });
 
 
 
 

+ 3 - 0
app/router.js

@@ -37,6 +37,7 @@ module.exports = app => {
     app.post('/setting/user/switch', sessionAuth, 'settingController.userSwitch');
     app.post('/setting/user/switch', sessionAuth, 'settingController.userSwitch');
     app.post('/setting/user/add', sessionAuth, 'settingController.addUser');
     app.post('/setting/user/add', sessionAuth, 'settingController.addUser');
     app.post('/setting/user/update', sessionAuth, 'settingController.updateUser');
     app.post('/setting/user/update', sessionAuth, 'settingController.updateUser');
+    app.post('/setting/user/permission', sessionAuth, 'settingController.permission');
     app.post('/setting/user/reset/password', sessionAuth, 'settingController.resetUserPassword');
     app.post('/setting/user/reset/password', sessionAuth, 'settingController.resetUserPassword');
     app.post('/setting/user/exist', sessionAuth, 'settingController.accountExist');
     app.post('/setting/user/exist', sessionAuth, 'settingController.accountExist');
 
 
@@ -74,6 +75,8 @@ module.exports = app => {
     app.get('/tender/:id/type', sessionAuth, 'tenderController.tenderType');
     app.get('/tender/:id/type', sessionAuth, 'tenderController.tenderType');
     app.post('/tender/:id/save', sessionAuth, tenderCheck, 'tenderController.saveTenderInfo');
     app.post('/tender/:id/save', sessionAuth, tenderCheck, 'tenderController.saveTenderInfo');
     app.post('/tender/rule', sessionAuth, 'tenderController.rule');
     app.post('/tender/rule', sessionAuth, 'tenderController.rule');
+    // 标段协作办公
+    app.get('/tender/:id/cooperation', sessionAuth, tenderCheck, 'tenderController.tenderCooperation');
 
 
 
 
     // 台账管理相关
     // 台账管理相关

+ 29 - 2
app/service/project_account.js

@@ -116,6 +116,7 @@ module.exports = app => {
                 let projectInfo = {};
                 let projectInfo = {};
                 let projectList = [];
                 let projectList = [];
                 let permission = '';
                 let permission = '';
+                let cooperation = 0;
                 if (loginType === 2) {
                 if (loginType === 2) {
                     // 查找项目数据
                     // 查找项目数据
                     const projectData = await this.ctx.service.project.getProjectByCode(data.project.toString());
                     const projectData = await this.ctx.service.project.getProjectByCode(data.project.toString());
@@ -140,19 +141,19 @@ module.exports = app => {
                     }
                     }
 
 
                     projectList = await this.getProjectInfoByAccount(data.account);
                     projectList = await this.getProjectInfoByAccount(data.account);
+                    permission = accountData.permission;
+                    cooperation = accountData.cooperation;
 
 
                     // 判断密码
                     // 判断密码
                     if (accountData.is_admin === 1) {
                     if (accountData.is_admin === 1) {
                         // 管理员则用sso通道判断
                         // 管理员则用sso通道判断
                         const sso = new SSO(this.ctx);
                         const sso = new SSO(this.ctx);
                         result = await sso.loginValid(data.account, data.project_password.toString());
                         result = await sso.loginValid(data.account, data.project_password.toString());
-                        permission = 'all';
                     } else {
                     } else {
                         // 加密密码
                         // 加密密码
                         const encryptPassword = crypto.createHmac('sha1', data.account).update(data.project_password)
                         const encryptPassword = crypto.createHmac('sha1', data.account).update(data.project_password)
                             .digest().toString('base64');
                             .digest().toString('base64');
                         result = encryptPassword === accountData.password;
                         result = encryptPassword === accountData.password;
-                        permission = accountData.permission;
                     }
                     }
                 } else {
                 } else {
                     // sso登录(演示版)
                     // sso登录(演示版)
@@ -185,6 +186,7 @@ module.exports = app => {
                         sessionToken,
                         sessionToken,
                         loginType,
                         loginType,
                         permission,
                         permission,
+                        cooperation,
                     };
                     };
                     this.ctx.session.sessionProject = projectInfo;
                     this.ctx.session.sessionProject = projectInfo;
                     this.ctx.session.sessionProjectList = projectList;
                     this.ctx.session.sessionProjectList = projectList;
@@ -474,6 +476,31 @@ module.exports = app => {
             const accountData = await this.db.get(this.tableName, { account, project_id: projectId });
             const accountData = await this.db.get(this.tableName, { account, project_id: projectId });
             return accountData;
             return accountData;
         }
         }
+
+        /**
+         * 保存用户权限数据
+         *
+         * @param {Object} data - post过来的数据
+         * @return {Boolean} - 返回权限修改结果
+         */
+        async permissionSave(id, data) {
+            if (data._csrf !== undefined) {
+                delete data._csrf;
+            }
+            const updateData = {
+                id,
+                cooperation: data.cooperation,
+            };
+            delete data.cooperation;
+            delete data.id;
+            updateData.permission = JSON.stringify(data);
+
+            const operate = await this.db.update(this.tableName, updateData);
+
+            const result = operate.affectedRows > 0;
+
+            return result;
+        }
     }
     }
 
 
     return ProjectAccount;
     return ProjectAccount;

+ 2 - 1
app/view/change/modal.ejs

@@ -172,6 +172,7 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
+<% } %>
 <script>
 <script>
     const ruleType = <%- ruleType %>;
     const ruleType = <%- ruleType %>;
     const ruleConst = JSON.parse('<%- JSON.stringify(ruleConst) %>');
     const ruleConst = JSON.parse('<%- JSON.stringify(ruleConst) %>');
@@ -179,4 +180,4 @@
     let connectorRule = '<%- tender.c_connector %>';
     let connectorRule = '<%- tender.c_connector %>';
 </script>
 </script>
 <script src="/public/js/moment/moment.min.js"></script>
 <script src="/public/js/moment/moment.min.js"></script>
-<% } %>
+

+ 15 - 9
app/view/ledger/audit_modal.ejs

@@ -112,7 +112,7 @@
                                         <li class="list-group-item">
                                         <li class="list-group-item">
                                             <span class="text-success pull-right"><% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
                                             <span class="text-success pull-right"><% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
                                             <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
                                             <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
-                                            <p class="card-text"><%- ah[iA].begin_time.toLocaleDateString() %></p>
+                                            <p class="card-text"><small class="text-muted"><%- ah[iA].begin_time.toLocaleDateString() %></small></p>
                                         </li>
                                         </li>
                                         <li class="list-group-item">
                                         <li class="list-group-item">
                                             <% if (ah[iA].status !== auditConst.status.uncheck) { %>
                                             <% if (ah[iA].status !== auditConst.status.uncheck) { %>
@@ -120,7 +120,8 @@
                                             <% } %>
                                             <% } %>
                                             <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                            <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                            <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                            <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                             <% } %>
                                             <% } %>
                                         </li>
                                         </li>
                                     <% } else if (iA === ah.length - 1) { %>
                                     <% } else if (iA === ah.length - 1) { %>
@@ -130,7 +131,8 @@
                                             <% } %>
                                             <% } %>
                                             <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                            <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                            <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                            <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                             <% } %>
                                             <% } %>
                                         </li>
                                         </li>
                                     <% } else { %>
                                     <% } else { %>
@@ -140,7 +142,8 @@
                                             <% } %>
                                             <% } %>
                                             <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                             <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                            <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                            <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                            <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                             <% } %>
                                             <% } %>
                                         </li>
                                         </li>
                                     <% } %>
                                     <% } %>
@@ -156,7 +159,7 @@
                                     <li class="list-group-item">
                                     <li class="list-group-item">
                                         <span class="text-success pull-right"><% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
                                         <span class="text-success pull-right"><% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
                                         <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
                                         <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
-                                        <p class="card-text"><%- auditors[iA].begin_time.toLocaleDateString() %></p>
+                                        <p class="card-text"><small class="text-muted"><%- auditors[iA].begin_time.toLocaleDateString() %></small></p>
                                     </li>
                                     </li>
                                     <li class="list-group-item">
                                     <li class="list-group-item">
                                         <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
                                         <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
@@ -164,7 +167,8 @@
                                         <% } %>
                                         <% } %>
                                         <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                        <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                        <p class="card-text mb-1"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                        <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                         <% } %>
                                         <% } %>
                                     </li>
                                     </li>
                                     <% } else if (iA === auditors.length - 1) { %>
                                     <% } else if (iA === auditors.length - 1) { %>
@@ -174,7 +178,8 @@
                                         <% } %>
                                         <% } %>
                                         <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                        <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                        <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                        <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                         <% } %>
                                         <% } %>
                                     </li>
                                     </li>
                                     <% } else { %>
                                     <% } else { %>
@@ -184,7 +189,8 @@
                                         <% } %>
                                         <% } %>
                                         <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                         <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                        <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                        <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                        <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                         <% } %>
                                         <% } %>
                                     </li>
                                     </li>
                                     <% } %>
                                     <% } %>
@@ -201,4 +207,4 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
-<% } %>
+<% } %>

+ 19 - 10
app/view/ledger/explode_modal.ejs

@@ -153,7 +153,10 @@
                             <span class="<%- auditConst.statusClass[auditors[i].status] %> pull-right"><%- auditConst.statusString[auditors[i].status] %></span>
                             <span class="<%- auditConst.statusClass[auditors[i].status] %> pull-right"><%- auditConst.statusString[auditors[i].status] %></span>
                             <% } %>
                             <% } %>
                             <h5 class="card-title"><%- auditors[i].audit_order %> <%- auditors[i].name %> <small class="text-muted"><%- auditors[i].role %></small></h5>
                             <h5 class="card-title"><%- auditors[i].audit_order %> <%- auditors[i].name %> <small class="text-muted"><%- auditors[i].role %></small></h5>
-                            <p class="card-text"><%- auditors[i].opinion %> <%- auditors[i].end_time ? auditors[i].end_time.toLocaleString() : '' %></p>
+                            <p class="card-text mb-1"><%- auditors[i].opinion %></p>
+                            <% if (auditors[i].end_time) { %>
+                            <p class="card-text"><small class="text-muted"><%- auditors[i].end_time.toLocaleString() %></small></p>
+                            <% } %>
                         </li>
                         </li>
                         <% } %>
                         <% } %>
                     </ul>
                     </ul>
@@ -205,7 +208,7 @@
                                 <li class="list-group-item">
                                 <li class="list-group-item">
                                     <span class="text-success pull-right"><% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
                                     <span class="text-success pull-right"><% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
                                     <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
-                                    <p class="card-text"><%- ah[iA].begin_time.toLocaleDateString() %></p>
+                                    <p class="card-text"><small class="text-muted"><%- ah[iA].begin_time.toLocaleDateString() %></small></p>
                                 </li>
                                 </li>
                                 <li class="list-group-item">
                                 <li class="list-group-item">
                                     <% if (ah[iA].status !== auditConst.status.uncheck) { %>
                                     <% if (ah[iA].status !== auditConst.status.uncheck) { %>
@@ -213,7 +216,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } else if (iA === ah.length - 1) { %>
                                 <% } else if (iA === ah.length - 1) { %>
@@ -223,7 +227,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } else { %>
                                 <% } else { %>
@@ -233,7 +238,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
                                     <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。<%- ah[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[ah[iA].status]%>,<%- ah[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } %>
                                 <% } %>
@@ -249,7 +255,7 @@
                                 <li class="list-group-item">
                                 <li class="list-group-item">
                                     <span class="text-success pull-right"><% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
                                     <span class="text-success pull-right"><% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
                                     <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
-                                    <p class="card-text"><%- auditors[iA].begin_time.toLocaleDateString() %></p>
+                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].begin_time.toLocaleDateString() %></small></p>
                                 </li>
                                 </li>
                                 <li class="list-group-item">
                                 <li class="list-group-item">
                                     <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
                                     <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
@@ -257,7 +263,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } else if (iA === auditors.length - 1) { %>
                                 <% } else if (iA === auditors.length - 1) { %>
@@ -267,7 +274,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } else { %>
                                 <% } else { %>
@@ -277,7 +285,8 @@
                                     <% } %>
                                     <% } %>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
                                     <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
-                                    <p class="card-text"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。<%- auditors[iA].end_time.toLocaleDateString() %></p>
+                                    <p class="card-text mb-1"><%- auditConst.statusString[auditors[iA].status]%>,<%- auditors[iA].opinion %>。</p>
+                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
                                     <% } %>
                                     <% } %>
                                 </li>
                                 </li>
                                 <% } %>
                                 <% } %>
@@ -294,4 +303,4 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
-<% } %>
+<% } %>

+ 17 - 12
app/view/setting/user.ejs

@@ -61,23 +61,28 @@
                             <th>姓名</th>
                             <th>姓名</th>
                             <th>单位</th>
                             <th>单位</th>
                             <th>职位</th>
                             <th>职位</th>
+                            <th>协作办公</th>
                             <th>权限</th>
                             <th>权限</th>
                         </thead>
                         </thead>
                         <tbody>
                         <tbody>
+                        <% for (const account of accountData) { %>
                         <tr>
                         <tr>
-                            <td>chente</td>
-                            <td>陈特</td>
-                            <td>珠海纵横创新软件有限公司</td>
-                            <td>产品经理</td>
-                            <td>标段管理(创建标段)<a href="#edit-user2" data-toggle="modal" data-target="#edit-user2" class="btn btn-sm">编辑</a></td>
-                        </tr>
-                        <tr>
-                            <td>chente</td>
-                            <td>陈特</td>
-                            <td>珠海纵横创新软件有限公司</td>
-                            <td>产品经理</td>
-                            <td><a href="#edit-user2" data-toggle="modal" data-target="#edit-user2" class="btn btn-sm">编辑</a></td>
+                            <td><%= account.account %><% if (account.is_admin === 1) { %> <span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="管理员"><i class="fa fa-user-circle-o"></i></span><% } %></td>
+                            <td><%= account.name %></td>
+                            <td><%= account.company %></td>
+                            <td><%= account.role %></td>
+                            <td><% if (account.cooperation === 1) { %>启用<% } %></td>
+                            <td><% if (account.permission !== '' && JSON.parse(account.permission).tender !== undefined) { %>
+                                <% const tenderPermission = JSON.parse(account.permission).tender; %>
+                                    <% for (const tc in permission.tender.children) { %>
+                                        <% if (tenderPermission.indexOf(permission.tender.children[tc].value.toString()) !== -1) { %>
+                                            <%= permission.tender.children[tc].title %>
+                                        <% } %>
+                                    <% } %>
+                                <% } %>
+                                    <a href="#edit-user2" data-account="<%= JSON.stringify(account) %>" data-toggle="modal" data-target="#edit-user2" class="btn btn-sm">编辑</a></td>
                         </tr>
                         </tr>
+                        <% } %>
                         </tbody>
                         </tbody>
                     </table>
                     </table>
                 </div>
                 </div>

+ 14 - 51
app/view/setting/user_modal.ejs

@@ -137,69 +137,32 @@
             <div class="modal-header">
             <div class="modal-header">
                 <h5 class="modal-title">编辑权限</h5>
                 <h5 class="modal-title">编辑权限</h5>
             </div>
             </div>
+            <form method="post" action="/setting/user/permission?_csrf=<%= ctx.csrf %>">
             <div class="modal-body">
             <div class="modal-body">
+                <% for (const pm in permission) { %>
                 <div class="form-group">
                 <div class="form-group">
-                    <label><i class="fa fa-list-ul"></i> 标段管理</label>
+                    <label><i <% if (permission[pm].class !== '') { %>class="<%= permission[pm].class %>"<% } %>></i> <%= permission[pm].title %></label>
                     <div>
                     <div>
+                        <% for (const ip of permission[pm].children) { %>
                         <div class="form-check form-check-inline">
                         <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox1">创建标段</label>
-                        </div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
-                            <label class="form-check-label" for="inlineCheckbox2">查看项目下所有标段</label>
-                        </div>
-                    </div>
-                </div>
-                <div class="form-group">
-                    <label><i class="fa fa-list-alt"></i> 0号台帐</label>
-                    <div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox4" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox4">编制台帐</label>
-                        </div>
-                    </div>
-                </div>
-                <div class="form-group">
-                    <label><i class="fa fa-list-alt"></i> 计量台帐(台帐管理)</label>
-                    <div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox8" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox8">查看</label>
-                        </div>
-                    </div>
-                </div>
-                <div class="form-group">
-                    <label><i class="fa fa-calendar-check-o"></i> 计量台帐</label>
-                    <div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox9" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox9">编制计量台帐</label>
-                        </div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox11" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox11">查阅标段下所有中间计量</label>
+                            <input class="form-check-input" type="<%= permission[pm].type %>" id="<%= pm %>_<%= ip.value %>" name="<%= pm %><% if (permission[pm].type === 'checkbox') { %>[]<% } %>" value="<%= ip.value %>">
+                            <label class="form-check-label" for="<%= pm %>_<%= ip.value %>"><%= ip.title %></label>
                         </div>
                         </div>
+                        <% } %>
                     </div>
                     </div>
                 </div>
                 </div>
-                <div class="form-group">
-                    <label><i class="fa fa-calendar-check-o"></i> 变更令</label>
-                    <div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox12" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox12">编制期计量</label>
-                        </div>
-                        <div class="form-check form-check-inline">
-                            <input class="form-check-input" type="checkbox" id="inlineCheckbox14" value="option1">
-                            <label class="form-check-label" for="inlineCheckbox14">查阅标段下所有期计量</label>
-                        </div>
-                    </div>
+                <% } %>
+                <!--需要勾选  创建标段 ,协作办公才能勾选-->
+                <div class="alert alert-secondary">
+                    “创建标段”用户默认具有标段下“创建标段”“台帐分解”“创建台帐修订”“创建计量期”“创建工程变更”的权限,如标段创建者需要把以上权限分配给其他用户,可启用 用户设置协作办公 。
                 </div>
                 </div>
             </div>
             </div>
             <div class="modal-footer">
             <div class="modal-footer">
+                <input type="hidden" name="id" value="">
                 <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
-                <button type="button" class="btn btn-primary">提交修改</button>
+                <button type="submit" class="btn btn-primary">提交修改</button>
             </div>
             </div>
+            </form>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>

+ 23 - 0
app/view/tender/cooperation.ejs

@@ -0,0 +1,23 @@
+<% include ./tender_sub_menu.ejs %>
+<div class="panel-content">
+    <div class="panel-title">
+        <div class="title-main  d-flex justify-content-between">
+            <h2>设置协作办公</h2>
+        </div>
+    </div>
+    <div class="content-wrap">
+        <div class="c-body">
+            <% for (const tp of tenderPermissionList) { %>
+            <div class="form-group">
+                <label><%= tp %></label>
+                <div class="form-group form-check">
+                    <h5 class="d-inline-block"><span class="badge badge-secondary"><%= user.name %>-<%= user.role %></span></h5>
+                    <h5 class="d-inline-block"><span class="badge badge-secondary">王五-监理 <a href="#" class="btn-danger px-1" title="移除"><i class="fa fa-remove"></i></a></span> </h5>
+                    <a href="#add" data-toggle="modal" data-target="#add" class="ml-3">添加协作人</a>
+                </div>
+            </div>
+            <% } %>
+        </div>
+    </div>
+</div>
+<script type="text/javascript" src="/public/js/tender.js"></script>

+ 34 - 0
app/view/tender/cooperationModal.ejs

@@ -0,0 +1,34 @@
+<!--上报审批-->
+<div class="modal fade" id="add" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">添加协作人</h5>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>搜索</label>
+                    <div class="input-group">
+                        <input class="form-control" placeholder="请输入姓名进行检索" type="text">
+                        <div class="input-group-append">
+                            <button class="btn btn-outline-secondary" type="button"><i class="fa fa-search"></i></button>
+                        </div>
+                    </div>
+                </div>
+                <div class="card border-primary">
+                    <div class="card-body">
+                        <h5 class="card-title">
+                            <a href="#" class="btn btn-primary btn-sm pull-right">添加</a>张三
+                        </h5>
+                        <h6 class="card-subtitle mb-2 text-muted">监理</h6>
+                        <p class="card-text">XXXXX公司</p>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-primary">确认上报</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 4 - 2
app/view/tender/detail.ejs

@@ -3,9 +3,11 @@
     <div class="panel-title">
     <div class="panel-title">
         <div class="title-main  d-flex justify-content-between">
         <div class="title-main  d-flex justify-content-between">
             <h2>进行至 第7期<small class="text-warning">(审批中)</small></h2>
             <h2>进行至 第7期<small class="text-warning">(审批中)</small></h2>
+            <% if (cooperation) { %>
             <div>
             <div>
-                <a href="biaoduan-xiezuo.html" class="btn btn-sm btn-light" ><i class="fa fa-users"></i> 协作办公</a>
+                <a href="/tender/<%= tender.id %>/cooperation" class="btn btn-sm btn-light" ><i class="fa fa-users"></i> 协作办公</a>
             </div>
             </div>
+            <% } %>
         </div>
         </div>
     </div>
     </div>
     <div class="content-wrap">
     <div class="content-wrap">
@@ -842,4 +844,4 @@
 <script>
 <script>
     let property = JSON.parse('<%- JSON.stringify(tenderInfo) %>');
     let property = JSON.parse('<%- JSON.stringify(tenderInfo) %>');
 </script>
 </script>
-<script type="text/javascript" src="/public/js/tender.js"></script>
+<script type="text/javascript" src="/public/js/tender.js"></script>

+ 3 - 1
app/view/tender/sub_menu.ejs

@@ -23,8 +23,10 @@
                 </div>
                 </div>
             </div>
             </div>
         </div>
         </div>
+        <% if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) { %>
         <div>
         <div>
             <a href="#add-bd" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
             <a href="#add-bd" data-toggle="modal" data-target="#add-bd" class="btn btn-sm btn-primary pull-right">新建标段</a>
         </div>
         </div>
+        <% } %>
     </div>
     </div>
-</div>
+</div>