瀏覽代碼

变更令清单选择界面修改

laiguoran 6 年之前
父節點
當前提交
793b1f87cd
共有 5 個文件被更改,包括 111 次插入32 次删除
  1. 6 0
      app/controller/change_controller.js
  2. 79 10
      app/public/js/change_set.js
  3. 5 0
      app/view/change/info.ejs
  4. 9 18
      app/view/change/info_modal.ejs
  5. 12 4
      app/view/login/login.ejs

+ 6 - 0
app/controller/change_controller.js

@@ -283,6 +283,12 @@ module.exports = app => {
                 if (auditStatus === 1 || auditStatus === 2) {
                     // 获取标准清单列表
                     const dealBillList = await ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: tenderid } });
+                    // 获取清单列表和台账清单列表
+                    const ledger = await ctx.service.ledger.getDataByTenderId(tenderid, -1);
+                    const pos = await ctx.service.pos.getPosData({ tid: tenderid });
+                    renderData.ledger = ledger;
+                    renderData.pos = pos;
+
                     renderData.dealBillList = dealBillList;
                     renderData.changeUnits = ctx.tender.info.precision;
                     // 根据清单获取提交数据和计算总金额

+ 79 - 10
app/public/js/change_set.js

@@ -9,6 +9,40 @@
  */
 
 $(document).ready(() => {
+
+    gclGatherModel.loadLedgerData(ledger);
+    gclGatherModel.loadPosData(pos);
+    const gclGatherData = gclGatherModel.gatherGclData();
+    // 先加载台账数据
+    let listHtml = '';
+    let list_index = 1;
+    for (const gcl of gclGatherData) {
+        listHtml += '<tr data-lid="' + list_index + '" data-gcl="' + (list_index-1) + '" data-index="' + list_index + '" data-detail="">' +
+            '<td>' + list_index + '</td>' +
+            '<td>' + gcl.b_code + '</td>' +
+            '<td>' + gcl.name + '</td>' +
+            '<td>' + gcl.unit + '</td>' +
+            '<td>' + roundnum(gcl.unit_price, totalPriceUnit) + '</td>' +
+            '<td>' + roundnum(gcl.quantity, gcl.unit) + '</td>' +
+            '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
+            '</tr>';
+        list_index++;
+    }
+    // 再加载签约清单
+    for (const db of dealBillList) {
+        listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-detail="">' +
+            '<td>' + list_index + '</td>' +
+            '<td>' + db.code + '</td>' +
+            '<td>' + db.name + '</td>' +
+            '<td>' + db.unit + '</td>' +
+            '<td>' + roundnum(db.unit_price, totalPriceUnit) + '</td>' +
+            '<td>' + roundnum(db.quantity, findDecimal(db.unit)) + '</td>' +
+            '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
+            '</tr>';
+        list_index++;
+    }
+    $('#table-list-select').html(listHtml);
+
     // 上报时按钮点击
     $('a[data-target="#sub-ap"]').on('click', function () {
         let category = $(this).data('category');
@@ -163,17 +197,53 @@ $(document).ready(() => {
     // 打开签约清单modal并删除之前的操作
     $('#open-list-modal').click(function () {
        $('#table-list-select tr').removeClass('table-success');
+       $('#code-list').html('');
     });
 
     // 清单选中和移除
-    $('#table-list-select tr').on('click', function () {
-       if ($(this).hasClass('table-success')) {
-           $(this).removeClass('table-success');
-           // 选中
-       } else {
-           $(this).addClass('table-success');
-           // 移除
-       }
+    $('body').on('click', '#table-list-select tr', function () {
+        const isCheck = $(this).hasClass('table-success') ? true : false;
+        const detail = $(this).attr('data-detail');
+        const isDeal = $(this).data('gcl') !== undefined ? true : false;
+        let codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox"></td></tr>';
+        if (isDeal) {
+            const gcl = gclGatherData[$(this).data('gcl')];
+            codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" ';
+            codeHtml += detail == 0 && isCheck ? 'checked' : '';
+            codeHtml += '></td></tr>';
+            for (const leaf of gcl.leafXmjs) {
+                const isChecked = detail == leaf.code + '_' + leaf.bwmx && isCheck ? 'checked' : '';
+                codeHtml += '<tr><td>' + leaf.code + '</td>' +
+                    '<td>' + leaf.jldy + '</td>' +
+                    '<td>' + leaf.bwmx + '</td>' +
+                    '<td><input type="checkbox"' + isChecked +
+                    '></td></tr>'
+            }
+        } else if (!isDeal && isCheck) {
+            codeHtml = '<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox" checked></td></tr>';
+        }
+        $('#code-list').attr('data-index', $(this).children('td').eq(0).text());
+        $('#code-list').html(codeHtml);
+    });
+
+    // 右边项目节选择
+    $('body').on('click', '#code-list input', function () {
+        let index = $('#code-list').attr('data-index');
+        if ($(this).is(':checked')) {
+            // 去除其它可能已选的checked
+            $('#code-list input').prop('checked', false);
+            $(this).prop('checked', true);
+            // 左边表单传值并添加class
+            $('#table-list-select tr[data-index="' + index + '"]').addClass('table-success');
+            // 判断是否选择了自行编辑变更详情
+            const tr = $(this).parents('tr');
+            const length = tr.children('td').length;
+            const detail = length === 4 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
+            $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', detail);
+        } else {
+            $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
+            $('#table-list-select tr[data-index="' + index + '"]').attr('data-detail', '');
+        }
     });
 
     // 添加空白清单or签约清单
@@ -238,7 +308,6 @@ $(document).ready(() => {
         const scnum = tr.children('td[data-site="7"]').children('input').val() != '-' ? tr.children('td[data-site="7"]').children('input').val() : '';
         const detail = $.trim(tr.children('td[data-site="2"]').children('input').val());
         const trlist = [code,name,unit,price,oamount,scnum,detail];
-        console.log(code);
         if (isWhite) {
             let changelist = $('#change-whitelist').val().split('^_^');
             trlist.push(0);
@@ -338,7 +407,7 @@ function maketablelist(status){
         let numdecimal = findDecimal(unit);
 
         let scnum = makedecimalzero(numdecimal);
-        let detail = '';
+        let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
         let lid = $(this).data('lid');
         let trlist = [code, name, unit, price, oamount, scnum, detail, lid];
         radionList.push(trlist.join(';'));

+ 5 - 0
app/view/change/info.ejs

@@ -747,7 +747,12 @@
             leftColumns: 5
         }
     }
+    const ledger = JSON.parse('<%- JSON.stringify(ledger) %>');
+    const pos = JSON.parse('<%- JSON.stringify(pos) %>');
+    const dealBillList = JSON.parse('<%- JSON.stringify(dealBillList) %>');
 </script>
+<script src="/public/js/path_tree.js"></script>
+<script src="/public/js/gcl_gather.js"></script>
 <script src="/public/js/change_set.js"></script>
 <% } else if (auditStatus === 3 || auditStatus === 4 || auditStatus === 5 || auditStatus === 7) { %>
 <script>

+ 9 - 18
app/view/change/info_modal.ejs

@@ -115,19 +115,6 @@
                             <table class="table table-striped table-bordered table-condensed">
                                 <thead><tr><th>序号</th><th>清单编号</th><th>名称</th><th>单位</th><th>单价</th><th>数量</th><th>金额</th></tr></thead>
                                 <tbody id="table-list-select">
-                                <% if (dealBillList !== undefined) { %>
-                                    <% for (const [index, db] of dealBillList.entries()) { %>
-                                        <tr data-lid="<%= db.id %>">
-                                            <td><%= index+1 %></td>
-                                            <td><%= db.code %></td>
-                                            <td><%= db.name %></td>
-                                            <td><%= db.unit %></td>
-                                            <td><%= ctx.helper.roundNum(db.unit_price, tpUnit) %></td>
-                                            <td><%= ctx.helper.roundNum(db.quantity,ctx.helper.findDecimal(db.unit)) %></td>
-                                            <td><%= ctx.helper.roundNum(ctx.helper.accMul(db.quantity, db.unit_price), tpUnit) %></td>
-                                        </tr>
-                                    <% } %>
-                                <% } %>
                                 </tbody>
                             </table>
                         </div>
@@ -135,12 +122,16 @@
                     <div class="col-5">
                         <div style="height:400px;overflow-y:auto">
                             <table class="table table-sm table-bordered">
+                                <thead>
                                 <tr><th>项目节编号</th><th>名称</th><th>部位明细</th><th>选择</th></tr>
-                                <tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox"></td></tr>
-                                <tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台1#桩</td><td><input type="checkbox"></td></tr>
-                                <tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台2#桩</td><td><input type="checkbox"></td></tr>
-                                <tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台3#桩</td><td><input type="checkbox"></td></tr>
-                                <tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台4#桩</td><td><input type="checkbox"></td></tr>
+                                </thead>
+                                <tbody id="code-list" data-index="">
+                                <!--<tr><td colspan="3">自行编辑变更详情</td><td><input type="checkbox"></td></tr>-->
+                                <!--<tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台1#桩</td><td><input type="checkbox"></td></tr>-->
+                                <!--<tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台2#桩</td><td><input type="checkbox"></td></tr>-->
+                                <!--<tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台3#桩</td><td><input type="checkbox"></td></tr>-->
+                                <!--<tr><td>1-4-5-1-1-1-1</td><td>桥台桩基础</td><td>0#桥台4#桩</td><td><input type="checkbox"></td></tr>-->
+                                </tbody>
                             </table>
                         </div>
                     </div>

+ 12 - 4
app/view/login/login.ejs

@@ -38,13 +38,11 @@
                     <input id="project-password" name="project_password" class="form-control" placeholder="输入密码" type="password" />
                 </div>
             </div>
-            <% if(errorMessage !== undefined && errorMessage !== null) { %>
             <div class="form-group">
-                <div class="alert alert-danger" role="alert">
-                    <strong>登录失败</strong> <%= errorMessage %>
+                <div class="alert alert-danger" <% if(errorMessage === undefined || errorMessage === null) { %>style="display: none"<% } %> role="alert" id="error-msg">
+                    <% if(errorMessage !== undefined && errorMessage !== null) { %><strong>登录失败</strong> <%= errorMessage %><% } %>
                 </div>
             </div>
-            <% } %>
         </div>
         <div class="form-group">
             <button class="btn btn-primary btn-block" type="submit">登录</button>
@@ -71,6 +69,16 @@ $(document).ready(function() {
         type = isNaN(type) || type <= 0 ? 1 : type;
         $("input[name='type']:hidden").val(type);
     });
+    $('#username').blur(function () {
+        let account = $(this).val();
+        // 判断输入的邮箱/手机是否格式正确
+        if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
+            $('#error-msg').hide();
+        } else {
+            $('#error-msg').show();
+            $('#error-msg').text('账号格式有误');
+        }
+    })
 });
 </script>
 </body>