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

指标库,全局指标参数页面

MaiXinRong 7 лет назад
Родитель
Сommit
afc919cf19
5 измененных файлов с 65 добавлено и 23 удалено
  1. 2 2
      app/const/template_param.js
  2. 37 0
      app/controller/lib_controller.js
  3. 1 0
      app/router.js
  4. 0 1
      app/service/match.js
  5. 25 20
      app/view/lib/detail.ejs

+ 2 - 2
app/const/template_param.js

@@ -59,7 +59,7 @@ const defaultGlobalParams = [
         code: 'g_b',
         name: '建安费',
         match_type: matchType.fixed_id,
-        match_id: '1',
+        match_key: '1',
         match_num: matchNum.total_price,
     },{
         template_id: 1,
@@ -68,7 +68,7 @@ const defaultGlobalParams = [
         code: 'g_c',
         name: '工程建设其他费用',
         match_type: matchType.fixed_id,
-        match_id: '3',
+        match_key: '3',
         match_num: matchNum.total_price,
     },{
         template_id: 1,

+ 37 - 0
app/controller/lib_controller.js

@@ -100,6 +100,43 @@ module.exports = app => {
         }
 
         /**
+         * 指标源全局参数页面
+         *
+         * @param {object} ctx - egg全局context
+         * @return {void}
+         */
+        async global (ctx) {
+            let lid = ctx.params.id;
+            lid = parseInt(lid);
+
+            try{
+                if(isNaN(lid) || lid < 0){
+                    throw '参数有误';
+                }
+                //获取指标源数据
+                const libInfo = await ctx.service.quotaLib.getLibDataById(lid);
+
+                //获取全局指标参数
+                const condition = {
+                    where: {
+                        lib_id: lid,
+                        node_id: 0,
+                    }
+                }
+                const globalParams = await ctx.service.tenderParam.getAllDataByCondition(condition);
+                const renderData = {
+                    libInfo,
+                    libConst,
+                    globalParams,
+                };
+                await this.layout('lib/global.ejs', renderData);
+            } catch (error) {
+                console.log(error);
+                ctx.redirect('/lib');
+            }
+        }
+
+        /**
          * 指标源详细页面
          *
          * @param {object} ctx - egg全局context

+ 1 - 0
app/router.js

@@ -18,6 +18,7 @@ module.exports = app => {
     app.get('/lib', sessionAuth, 'libController.index');
     app.post('/lib/upload', sessionAuth, 'libController.upload');
     app.get('/lib/detail/:id', sessionAuth, 'libController.detail');
+    app.get('/lib/global/:id', sessionAuth, 'libController.global');
     app.post('/lib/delete', sessionAuth, 'libController.delete');
     app.post('/lib/enter', sessionAuth, 'libController.enter');
 

+ 0 - 1
app/service/match.js

@@ -212,7 +212,6 @@ module.exports = app => {
             if (!node) { return; }
 
             const matchedBills = this._filterBills(node);
-            console.log(matchedBills);
             for (const mb of matchedBills) {
                 const newNode = {
                     node_id: this.nodes.length + 1,

+ 25 - 20
app/view/lib/detail.ejs

@@ -9,12 +9,21 @@
         </div>
     </div>
     <div class="content-wrap">
-        <div class="c-header p-0 col-12"></div>
+        <div class="c-header p-0 col-12">
+            <ul class="nav nav-tabs">
+                <li class="nav-item">
+                    <a class="nav-link" href="/lib/global/<%= ctx.params.id %>">全局参数</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link active" href="/lib/detail/<%= ctx.params.id %>">项目节参数</a>
+                </li>
+            </ul>
+        </div>
         <div class="c-body">
             <div class="row">
                 <div class="col-5">
-                    <div class="sjs-height-1" id="">
-                        <table class="table table-bordered table-sm">
+                    <div class="sjs-height-1">
+                        <table class="table table-bordered table-sm table-hover">
                             <tr>
                                 <th></th>
                                 <th>项目节编号</th>
@@ -100,7 +109,7 @@
                 </div>
                 <div class="col-7">
                     <div class="sjs-height-3">
-                        <table class="table table-bordered table-sm">
+                        <table class="table table-bordered table-sm table-hover">
                             <tr>
                                 <th>指标编号</th>
                                 <th>项目或费用名称</th>
@@ -127,8 +136,8 @@
                                 <td>公路公里</td>
                                 <td></td>
                                 <td>合价/路线总长度</td>
-                                <td></td>
-                                <td></td>
+                                <td>10000/500</td>
+                                <td>20</td>
                             </tr>
                             <tr>
                                 <td>z1-a-2</td>
@@ -184,27 +193,23 @@
                     </div>
                     <div class="sjs-bottom-2">
                         <legend class="mt-3">填写参数</legend>
-                        <table class="table table-bordered table-sm">
-                            <tr><th colspan="4" class="text-center">全局参数</th></tr>
-                            <tr><th colspan="4" class="text-center"><b class="text-danger">*全局参数影响所有指标,谨慎修改</b></th></tr>
+                        <!--本节点参数-->
+                        <table class="table table-bordered table-sm table-hover">
+                            <tr><th colspan="4" class="text-center">1-1 项目节 参数</th></tr>
                             <tr>
-                                <th>总造价</th><td><input class="form-control form-control-sm"></td>
-                                <th>路线总长度</th><td><input class="form-control form-control-sm"></td>
+                                <th>参数名称</th><th>绑定分项节点</th><th>参数数值</th>
                             </tr>
                             <tr>
-                                <th>路基工程费用</th><td><input class="form-control form-control-sm"></td>
-                                <th>边沟圬工体积</th><td><input class="form-control form-control-sm"></td>
+                                <td>总造价</th><td></td><td><input class="form-control form-control-sm"></td>
+                            </tr>
+                            <tr>
+                                <td>路线总长度</td><td>1-1-2</td><td><input class="form-control form-control-sm" value="15123"></td>
                             </tr>
-                        </table>
-                        <table class="table table-bordered table-sm">
-                            <tr><th colspan="4" class="text-center">1-1 项目节 参数</th></tr>
                             <tr>
-                                <th>总造价</th><td><input class="form-control form-control-sm"></td>
-                                <th>路线总长度</th><td><input class="form-control form-control-sm"></td>
+                                <td>路基工程费用</td><td>1-4-1</td><td><input class="form-control form-control-sm" value="50410"></td>
                             </tr>
                             <tr>
-                                <th>路基工程费用</th><td><input class="form-control form-control-sm"></td>
-                                <th>边沟圬工体积</th><td><input class="form-control form-control-sm"></td>
+                                <td>边沟圬工体积</td><td></td><td><input class="form-control form-control-sm"></td>
                             </tr>
                         </table>
                     </div>