Преглед изворни кода

refactor: 计量台账清单ui调整

lanjianrong пре 5 година
родитељ
комит
7c3d70a1e1
2 измењених фајлова са 26 додато и 13 уклоњено
  1. 7 7
      app/public/js/change_set.js
  2. 19 6
      app/view/change/info_modal.ejs

+ 7 - 7
app/public/js/change_set.js

@@ -75,12 +75,12 @@ $(document).ready(() => {
             gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
             const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
             listHtml += '<tr data-lid="' + lid + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
-                '<td>' + list_index + '</td>' +
+                '<td class="text-center">' + list_index + '</td>' +
                 '<td>' + gcl.code + '</td>' +
-                '<td>' + gcl.name + '</td>' +
-                '<td>' + unit + '</td>' +
-                '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
-                '<td>' + quantity + '</td>' +
+                '<td class="text-left">' + gcl.name + '</td>' +
+                '<td class="text-center">' + unit + '</td>' +
+                '<td class="text-right">' + roundnum(unit_price, unitPriceUnit) + '</td>' +
+                '<td class="text-right">' + quantity + '</td>' +
                 '</tr>';
             list_index++;
         }
@@ -362,8 +362,8 @@ $(document).ready(() => {
                 '<td>' + (leaf.fbgc ? leaf.fbgc : '') + '</td>' +
                 '<td>' + (leaf.fxgc ? leaf.fxgc : '') + '</td>' +
                 '<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
-                    '<td>' + roundnum(quantity, findDecimal(gcl.unit)) + '</td>' +
-                    '<td><input type="checkbox"' + isChecked +
+                    '<td class="text-right">' + roundnum(quantity, findDecimal(gcl.unit)) + '</td>' +
+                    '<td class="text-center"><input type="checkbox"' + isChecked +
                     '></td></tr>';
             }
         } else if (!isDeal && isCheck) {

+ 19 - 6
app/view/change/info_modal.ejs

@@ -115,7 +115,7 @@
                         </div>
                         <div style="overflow-y:auto" class="sjs-biangeng-height">
                             <table class="table table-striped table-bordered table-hover table-sm fixed_headers">
-                                <thead><tr><th width="40">序号</th><th>清单编号</th><th>名称</th><th width="50">单位</th><th width="100">单价</th><th width="100">数量</th></tr></thead>
+                                <thead><tr class="text-center"><th width="40">序号</th><th>清单编号</th><th>名称</th><th width="50">单位</th><th width="100">单价</th><th width="100">数量</th></tr></thead>
                                 <tbody id="table-list-select">
                                 </tbody>
                             </table>
@@ -129,7 +129,7 @@
                         <div style="overflow-y:auto" class="sjs-biangeng-height">
                             <table class="table table-striped table-bordered table-hover table-sm fixed_headers2">
                                 <thead>
-                                <tr><th width="100">项目节编号</th><th>细目</th><th>单位工程</th><th>分部工程</th><th>分项工程</th><th>计量单元</th><th width="70">数量</th><th width="40">选择</th></tr>
+                                <tr class="text-center"><th width="100">项目节编号</th><th>细目</th><th>单位工程</th><th>分部工程</th><th>分项工程</th><th>计量单元</th><th width="70">数量</th><th width="40">选择</th></tr>
                                 </thead>
                                 <tbody id="code-list" data-index="">
                                 </tbody>
@@ -731,13 +731,26 @@
 
 <script>
     $('.modal').on('shown.bs.modal', function () {
-        const height = $(this)[0].scrollHeight
-        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]')
+        const height = $(this)[0].scrollHeight;
+        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
         // 450是modal没有滚动条时的最大高度,超过则出现滚动条,需要自动下拉到底部
-        if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
-            scrollBox.scrollTop(height);
+        // if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
+        //     scrollBox.scrollTop(height);
+        // }
+        scrollBox.scrollTop(0);
+        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+        const hdheight = hdiv ? hdiv.parents('.list-group-item').offset().top : null;
+        if (hdiv && scrollBox.length &&  scrollBox[0].scrollHeight > 450 && hdheight - bdiv > 450) {
+            scrollBox.scrollTop(hdheight - bdiv);
         }
     });
+    function divSearch(div) {
+        if (div.length > 0) {
+            return true;
+        }
+        return false;
+    }
     $('#led-warning').click(function () {
         $('#warning-ledger').modal('hide');
     });