소스 검색

审批搜索

laiguoran 4 년 전
부모
커밋
65454eee7c
2개의 변경된 파일101개의 추가작업 그리고 7개의 파일을 삭제
  1. 92 6
      app/public/js/shenpi.js
  2. 9 1
      app/view/tender/shenpi_modal.ejs

+ 92 - 6
app/public/js/shenpi.js

@@ -116,15 +116,21 @@ function recursiveGetTenderNodeHtml (node, arr, pid, this_code, this_status, aid
     // html.push('<td>', sp_status_list[node.shenpiInfo[shenpi_type]].name, '</td>');
     html.push('<td>');
     if (!node.cid) {
+        if(cur_tenderid === node.id) {
+            html.push(sp_status_list[this_status].name);
+        } else {
+            html.push(sp_status_list[node.shenpiInfo[this_code]].name);
+        }
+    }
+    html.push('</td>');
+    html.push('<td>');
+    if (!node.cid) {
         let auditList = [];
         let tender_status = 1;
         if(cur_tenderid === node.id) {
-            html.push(sp_status_list[this_status].name);
             auditList = aidList;
             tender_status = this_status;
         } else {
-            console.log(node);
-            html.push(sp_status_list[node.shenpiInfo[this_code]].name);
             auditList = node.shenpiauditList[this_code];
             tender_status = node.shenpiInfo[this_code];
         }
@@ -136,8 +142,9 @@ function recursiveGetTenderNodeHtml (node, arr, pid, this_code, this_status, aid
                     nameList.push(user.name);
                 }
             }
-            html.push('<i class="fa fa-question-circle text-primary" data-container="body" data-toggle="tooltip" data-placement="bottom" ' +
-                'data-original-title="'+ (nameList.length > 0 ? nameList.join('-') : '') +'"></i>');
+            // html.push('<i class="fa fa-question-circle text-primary" data-container="body" data-toggle="tooltip" data-placement="bottom" ' +
+            //     'data-original-title="'+ (nameList.length > 0 ? nameList.join('-') : '') +'"></i>');
+            html.push(nameList.length > 0 ? nameList.join('-') : '');
         }
     }
     html.push('</td>');
@@ -161,7 +168,8 @@ function getTenderTreeHtml (this_code, this_status, aidList = []) {
         html.push('<table class="table table-hover table-bordered">');
         html.push('<thead>', '<tr>');
         html.push('<th>名称</th>');
-        html.push('<th width="100">审批流程</th>');
+        html.push('<th width="80">流程模式</th>');
+        html.push('<th>详细流程</th>');
         html.push('<th width="40">选择</th>');
         html.push('</tr>', '</thead>');
         parentId = 0;
@@ -510,6 +518,10 @@ $(document).ready(function () {
         $('#shenpi_status').val(this_status);
         $('#shenpi_auditors').val(aidList.join(','));
         $('#tender-list').html(html);
+        $('#search-audit').val('');
+        $('#search-result').text('0/0');
+        $('#up-search').attr('disabled', true);
+        $('#down-search').attr('disabled', true);
         setTimeout(function () { $("#tender-list [data-toggle='tooltip']").tooltip(); },800);
     });
 
@@ -1025,6 +1037,80 @@ $(document).ready(function () {
             autoFlashHeight();
         }
     });
+
+    let timer2 = null;
+    let oldSearchVal2 = null;
+    let searchUser = [];
+    $('body').on('input propertychange', '#batch input[name="audit-name"]', function(e) {
+        oldSearchVal2 = e.target.value;
+        timer2 && clearTimeout(timer2);
+        timer2 = setTimeout(() => {
+            const newVal = $(this).val();
+
+            const resultLength = $('#tender-list').find('.result').length;
+            if (resultLength > 0) {
+                let content = $('#tender-list').html();
+                const replaceStr = $('#tender-list').find('.result').eq(0).html();
+                const regExp2 = new RegExp('<span class="result" style="background:yellow;">' + replaceStr + '</span>', 'g');
+                content = content.replace(regExp2, replaceStr);
+                const regExp3 = new RegExp('<span class="result" style="background:orange;">' + replaceStr + '</span>', 'g');
+                content = content.replace(regExp3, replaceStr);
+                $('#tender-list').html(content);
+            }
+            searchUser= [];
+            $('#search-result').text('0/0');
+            $('#up-search').attr('disabled', true);
+            $('#down-search').attr('disabled', true);
+            if (newVal && newVal === oldSearchVal2) {
+                const regExp = new RegExp(newVal, 'i');
+                let resultLength = 0;
+                for (let i = 0; i < $('#tender-list tr').length; i++) {
+                    if (_.includes($('#tender-list tr').eq(i).children('td').eq(2).html(), newVal)) {
+                        if (resultLength === 0) {
+                            $('#tender-list tr').eq(i).children('td').eq(2).html($('#tender-list tr').eq(i).children('td').eq(2).html().replace(regExp, '<span class="result" style="background:orange;">' + newVal + '</span>'))
+                        } else {
+                            $('#tender-list tr').eq(i).children('td').eq(2).html($('#tender-list tr').eq(i).children('td').eq(2).html().replace(regExp, '<span class="result" style="background:yellow;">' + newVal + '</span>'))
+                        }
+                        resultLength++;
+                        searchUser.push(i);
+                    }
+                }
+                if (resultLength > 0) {
+                    $('#search-result').text('1/' + resultLength);
+                    $('#up-search').attr('disabled', false);
+                    $('#down-search').attr('disabled', false);
+                }
+                // content = content.replace(regExp, '<span class="result" style="background:yellow;">' + newVal + '</span>');
+            }
+            if($('#tender-list').find('.result').length > 0) {
+                const X = $('#tender-list').find('.result').eq(0).offset().top;
+                // const Y = $('#tender-list').find('.result').eq(0).offset().left;
+                $('#tender-list').scrollTop(X - $('#tender-list').offset().top + $('#tender-list').scrollTop());
+            }
+        }, 400);
+    });
+
+    $('#up-search').on('click', function () {
+        const cur = parseInt($('#search-result').text().split('/')[0]);
+        const total = parseInt($('#search-result').text().split('/')[1]);
+        const now = cur - 1 !== 0 ? cur - 1: total;
+        $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
+        $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
+        $('#search-result').text(now + '/' + total);
+        const X = $('#tender-list').find('.result').eq(now-1).offset().top;
+        $('#tender-list').scrollTop(X - $('#tender-list').offset().top + $('#tender-list').scrollTop());
+    });
+
+    $('#down-search').on('click', function () {
+        const cur = parseInt($('#search-result').text().split('/')[0]);
+        const total = parseInt($('#search-result').text().split('/')[1]);
+        const now = cur + 1 > total ? 1: cur + 1;
+        $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
+        $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
+        $('#search-result').text(now + '/' + total);
+        const X = $('#tender-list').find('.result').eq(now-1).offset().top;
+        $('#tender-list').scrollTop(X - $('#tender-list').offset().top + $('#tender-list').scrollTop());
+    });
 });
 
 function setRightData(datas, coolist) {

+ 9 - 1
app/view/tender/shenpi_modal.ejs

@@ -1,12 +1,20 @@
 <!--设置其他标段-->
 <div class="modal fade" id="batch" data-backdrop="static">
-    <div class="modal-dialog" role="document">
+    <div class="modal-dialog modal-lg" role="document">
         <div class="modal-content">
             <div class="modal-header">
                 <h5 class="modal-title">设置其他标段</h5>
             </div>
             <div class="modal-body">
                 <div class="alert alert-warning">将「<span id="shenpi-name"></span>」设置至其他标段</div>
+                <div class="input-group input-group-sm mb-2">
+                    <input class="form-control" placeholder="输入审批人名称搜索" type="text" name="audit-name" id="search-audit">
+                    <div class="input-group-append">
+                        <span class="input-group-text" id="search-result">0/0</span>
+                        <button class="btn btn-outline-secondary" id="up-search" disabled><i class="fa fa-arrow-up" aria-hidden="true"></i></button>
+                        <button class="btn btn-outline-secondary" id="down-search" disabled><i class="fa fa-arrow-down" aria-hidden="true"></i></button>
+                    </div>
+                </div>
                 <div class="modal-height-300" id="tender-list">
                 </div>
             </div>