Bläddra i källkod

待办首页排版更改

laiguoran 5 år sedan
förälder
incheckning
346f22831e

+ 80 - 7
app/const/cld_office.js

@@ -1,22 +1,95 @@
 'use strict';
 
 /**
- * CLD办事处
+ * CLD办事处(和CLD里ID相对应)
  *
  * @author CaiAoLin
  * @date 2017/10/31
  * @version
  */
 const officeType = {
-    HEAD_OFFICE: 1,
-    GUANGDONG: 2,
-    CHONGQING: 3,
+    ANHUI: 2,
+    GANSU: 3,
+    GUANGDONG: 4,
+    GUANGXI: 5,
+    JIANGXI: 6,
+    SICHUAN: 7,
+    CHONGQING: 8,
+    NEIMENG: 9,
+    ZHEJIANG: 10,
+    SHANDONG: 11,
+    ZONGBU: 12,
+    YUNNAN: 13,
+    GUIZHOU: 14,
+    BEIJING: 15,
+    FUJIAN: 16,
+    HAINAN: 17,
+    HEBEI: 18,
+    HENAN: 19,
+    HEILONGJIANG: 20,
+    HUBEI: 21,
+    HUNAN: 22,
+    JILIN: 23,
+    JIANGSU: 24,
+    LIAONING: 25,
+    NINGXIA: 26,
+    YJZX: 27,
 };
 
 const office = [];
-office[officeType.HEAD_OFFICE] = '总部';
-office[officeType.GUANGDONG] = '广东办事处';
-office[officeType.CHONGQING] = '重庆办事处';
+office[officeType.ANHUI] = '安徽办';
+office[officeType.GANSU] = '甘肃办';
+office[officeType.GUANGDONG] = '广东办';
+office[officeType.GUANGXI] = '广西办';
+office[officeType.JIANGXI] = '江西办';
+office[officeType.SICHUAN] = '四川办';
+office[officeType.CHONGQING] = '重庆办';
+office[officeType.NEIMENG] = '内蒙办';
+office[officeType.ZHEJIANG] = '浙江办';
+office[officeType.SHANDONG] = '上海办';
+office[officeType.ZONGBU] = '总部';
+office[officeType.YUNNAN] = '云南办';
+office[officeType.GUIZHOU] = '贵州办';
+office[officeType.BEIJING] = '北京办';
+office[officeType.FUJIAN] = '福建办';
+office[officeType.HAINAN] = '海南办';
+office[officeType.HEBEI] = '河北办';
+office[officeType.HENAN] = '河南办';
+office[officeType.HEILONGJIANG] = '黑龙江办';
+office[officeType.HUBEI] = '湖北办';
+office[officeType.HUNAN] = '湖南办';
+office[officeType.JILIN] = '吉林办';
+office[officeType.JIANGSU] = '江苏办';
+office[officeType.LIAONING] = '辽宁办';
+office[officeType.NINGXIA] = '宁夏办';
+office[officeType.YJZX] = '总部-造价研究中心';
+// const office = [
+//     {id: officeType.ANHUI, name: '安徽办'},
+//     {id: officeType.GANSU, name: '甘肃办'},
+//     {id: officeType.GUANGDONG, name: '广东办'},
+//     {id: officeType.GUANGXI, name: '广西办'},
+//     {id: officeType.JIANGXI, name: '江西办'},
+//     {id: officeType.SICHUAN, name: '四川办'},
+//     {id: officeType.CHONGQING, name: '重庆办'},
+//     {id: officeType.NEIMENG, name: '内蒙办'},
+//     {id: officeType.ZHEJIANG, name: '浙江办'},
+//     {id: officeType.SHANDONG, name: '山东办'},
+//     {id: officeType.ZONGBU, name: '总部'},
+//     {id: officeType.YUNNAN, name: '云南办'},
+//     {id: officeType.GUIZHOU, name: '贵州办'},
+//     {id: officeType.BEIJING, name: '北京办'},
+//     {id: officeType.FUJIAN, name: '福建办'},
+//     {id: officeType.HAINAN, name: '海南办'},
+//     {id: officeType.HEBEI, name: '河北办'},
+//     {id: officeType.HENAN, name: '河南办'},
+//     {id: officeType.HEILONGJIANG, name: '黑龙江办'},
+//     {id: officeType.HUBEI, name: '湖北办'},
+//     {id: officeType.HUNAN, name: '湖南办'},
+//     {id: officeType.JILIN, name: '吉林办'},
+//     {id: officeType.JIANGSU, name: '江苏办'},
+//     {id: officeType.LIAONING, name: '辽宁办'},
+//     {id: officeType.NINGXIA, name: '宁夏办'}
+// ];
 
 module.exports = {
     type: officeType,

+ 10 - 2
app/controller/dashboard_controller.js

@@ -9,6 +9,7 @@
  */
 
 const auditConst = require('../const/audit');
+const officeList = require('../const/cld_office').list;
 
 module.exports = app => {
 
@@ -25,19 +26,23 @@ module.exports = app => {
             const auditStages = await ctx.service.stageAudit.getAuditStage(ctx.session.sessionUser.accountId);
             const auditChanges = await ctx.service.changeAudit.getAuditChange(ctx.session.sessionUser.accountId);
             const auditRevise = await ctx.service.reviseAudit.getAuditRevise(ctx.session.sessionUser.accountId);
-            const projectAccountInfo = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
             const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
             const lastNotice = pa.last_notice ? pa.last_notice : (pa.last_notice === 0 ? new Date() : new Date(pa.last_login * 1000));
             const noticeLedger = await ctx.service.ledgerAudit.getNoticeTender(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeStage = await ctx.service.stageAudit.getNoticeStage(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeChange = await ctx.service.changeAudit.getNoticeChange(ctx.session.sessionProject.id, pa.id, lastNotice);
             const noticeRevise = await ctx.service.reviseAudit.getNoticeRevise(ctx.session.sessionProject.id, pa.id, lastNotice);
+            const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
+            // 获取销售人员数据
+            const salesmanData = await ctx.service.manager.getDataById(projectData.manager_id);
+            const officeName = officeList[salesmanData.office];
             const renderData = {
                 auditTenders,
                 auditStages,
                 auditChanges,
                 auditRevise,
-                role: projectAccountInfo.role,
+                role: pa.role,
+                authMobile: pa.auth_mobile,
                 acLedger: auditConst.ledger,
                 acStage: auditConst.stage,
                 acChange: auditConst.flow,
@@ -46,6 +51,9 @@ module.exports = app => {
                 noticeStage,
                 noticeChange,
                 noticeRevise,
+                projectData,
+                salesmanData,
+                officeName,
             };
             await this.layout('dashboard/index.ejs', renderData);
             await ctx.service.projectAccount.defaultUpdate({

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

@@ -5,7 +5,14 @@
     <div class="content-wrap">
         <div class="sjs-height-0">
             <div class="row m-4">
-                <div class="col-6">
+                <% if (!authMobile) { %>
+                <div class="col-12">
+                    <div class="alert alert-danger" role="alert">
+                        <strong>您的账号未认证手机。</strong> 设置认证手机后,可以用于「找回密码」及接收「短信通知」。<a class="btn btn-sm btn-light" href="/profile/sms">点击设置</a>
+                    </div>
+                </div>
+                <% } %>
+                <div class="col-5">
                     <div class="card">
                         <div class="card-header">需要你处理</div>
                         <div class="card-body">
@@ -103,7 +110,7 @@
                         </div>
                     </div>
                 </div>
-                <div class="col-6">
+                <div class="col-5">
                     <div class="card">
                         <div class="card-header">需要你关注</div>
                         <div class="card-body">
@@ -169,6 +176,28 @@
                         </div>
                     </div>
                 </div>
+                <div class="col-2">
+                    <div class="card">
+                        <div class="card-body">
+                            <h4 class="card-title"><%= salesmanData.username %></h4>
+                            <h6 class="card-subtitle mb-2 text-muted"><%= officeName %></h6>
+                        </div>
+                        <ul class="list-group list-group-flush">
+                            <li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="腾讯QQ"><i class="fa fa-qq"></i> <%=salesmanData.qq%></li>
+                            <li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="手机号码"><i class="fa fa-tablet"></i> <%=salesmanData.telephone%></li>
+                            <li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="固定电话"><i class="fa fa-phone"></i> <%=salesmanData.fixedphone%></li>
+                            <% if (projectData.qrcode_json) { %>
+                            <li class="list-group-item container-fluid">
+                                <div class="row">
+                                    <% for (const qr of JSON.parse(projectData.qrcode_json)) { %>
+                                    <div class="col-sm text-center"><img src="/<%= qr.path %>" width="90"><div class="text-center"><%= qr.name %></div></div>
+                                    <% } %>
+                                </div>
+                            </li>
+                            <% } %>
+                        </ul>
+                    </div>
+                </div>
             </div>
         </div>
     </div>

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

@@ -30,7 +30,7 @@
                                 <div class="card w-50">
                                     <div class="card-body">
                                         <h4 class="card-title"><%= salesmanData.username %></h4>
-                                        <h6 class="card-subtitle mb-2 text-muted" ><%= officeName%></h6>
+                                        <h6 class="card-subtitle mb-2 text-muted" ><%= officeName %></h6>
                                     </div>
                                     <ul class="list-group list-group-flush">
                                         <li class="list-group-item" data-toggle="tooltip" data-placement="bottom" title="腾讯QQ"><i class="fa fa-qq"></i> <%=salesmanData.qq%></li>