Просмотр исходного кода

决策大屏权限及页面控制

ellisran 2 месяцев назад
Родитель
Сommit
1f68f6ec26

+ 7 - 17
app/controller/datacollect_controller.js

@@ -51,29 +51,19 @@ module.exports = app => {
                     throw '该功能已关闭或无法查看';
                 }
                 // 获取标段审批信息
-                const tenderidList = [];
+                const dcTenders = await ctx.service.datacollectTender.getList(ctx.session.sessionProject.id, ctx.subProject.id);
+                const noTids = ctx.app._.map(dcTenders, 'tid');
+                let tenderList = await ctx.service.tender.getList('', null, 1);
+                tenderList = ctx.app._.filter(tenderList, function(item) {
+                    return ctx.app._.indexOf(noTids, item.id) === -1;
+                });
+                const tenderidList = ctx.helper._.map(tenderList, 'id');
                 const noticeList = await ctx.service.noticePush.getNoticeByDataCollect(ctx.session.sessionProject.id, tenderidList);
                 // 获取分类
                 const categoryData = await this.ctx.service.category.getListByCategoryLevel(ctx.subProject.id);
                 // 默认坐标,否则则取办事处坐标
                 const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);
                 ctx.subProject.data_collect_pages = ctx.subProject.data_collect_pages ? ctx.subProject.data_collect_pages.split(',') : [];
-                // let map_json = {
-                //     province: mapConst.map[0].province,
-                //     lng: mapConst.map[0].lng,
-                //     lat: mapConst.map[0].lat,
-                //     level: 15,
-                // };
-                // if (projectData.map_json) {
-                //     map_json = JSON.parse(projectData.map_json);
-                // } else {
-                //     const mapInfo = ctx.helper._.find(mapConst.map, { office: projectData.manager_office });
-                //     if (mapInfo) {
-                //         map_json.province = mapInfo.province;
-                //         map_json.lng = mapInfo.lng;
-                //         map_json.lat = mapInfo.lat;
-                //     }
-                // }
                 if (ctx.params.index) {
                     ctx.subProject.dataCollect = parseInt(ctx.params.index);
                 }

+ 3 - 0
app/service/notice_push.js

@@ -85,6 +85,9 @@ module.exports = app => {
          */
         async getNoticeByDataCollect(pid, tenderIds = []) {
             const wheres = { pid };
+            if (tenderIds.length > 0) {
+                wheres.tid = tenderIds;
+            }
             let notice = await this.db.select(this.tableName, {
                 where: wheres,
                 orders: [['create_time', 'desc']],

+ 1 - 1
app/view/datacollect/index4GY18Y.ejs

@@ -60,7 +60,7 @@
                 <div class="btn-group">
                     <button type="button" class="btn btn-sm btn-outline-dark text-white dropdown-toggle" data-toggle="dropdown" id="zhankai">决策大屏<span>6</span></button>
                     <div class="dropdown-menu" aria-labelledby="zhankai">
-                        <% for (const i of projectData.data_collect_pages) { %>
+                        <% for (const i of ctx.subProject.data_collect_pages) { %>
                             <a class="dropdown-item" href="/sp/<%- ctx.subProject.id %>/datacollect/index/<%- i %>">决策大屏<%- i %></a>
                         <% } %>
                     </div>