ソースを参照

Merge remote-tracking branch 'origin/master'

蔡德晨 5 年 前
コミット
ae55121a4e

+ 0 - 11
src/main/java/com/jeeplus/modules/workclientinfo/web/WorkClientInfoController.java

@@ -3,7 +3,6 @@
  */
 package com.jeeplus.modules.workclientinfo.web;
 
-import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.jeeplus.common.beanvalidator.BeanValidators;
@@ -18,7 +17,6 @@ import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
-import com.jeeplus.modules.sys.entity.Role;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.sysimportinfo.entity.SysImportInfo;
@@ -29,10 +27,8 @@ import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
 import com.jeeplus.modules.workreimbursement.utils.VarStr;
-import io.swagger.annotations.Api;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -40,19 +36,12 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-import redis.clients.jedis.Protocol;
 
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
 import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
 import java.net.URLDecoder;
-import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;

+ 52 - 12
src/main/webapp/webpage/modules/workclientinfo/workClientInfoForm.jsp

@@ -151,18 +151,10 @@
             var arr="${workClientInfo.clientType}".split(',');
             $('#clientType').selectpicker('val',arr);
 
-            $("#name").on("blur",function () {
+            //模糊查询
+            $("#name").on("keyup",function () {
                 var keyword = $(this).val();
-                if (keyword != null && keyword != "") {
-                    $.getJSON(
-                        "${ctx}/workclientinfo/workClientInfo/enterpriseSearchByName",
-                        {"keyword": keyword},
-                        function (data) {
-                            console.log(data);
-                        }
-                    );
-                }
-
+                fuzzyQuery(keyword);
             });
         });
 		function testOurBank(value){
@@ -277,6 +269,51 @@
             }
         }
 
+        // 模糊查询下拉框
+        function fuzzyQuery(keyword){
+            if (!(keyword != null && "" !== keyword)) {
+                $("#fuzzyQuerySelect").hide();
+            } else {
+                $.post(
+                    "${ctx}/workclientinfo/workClientInfo/enterpriseSearchByName",
+                    {"keyword": keyword},
+                    function (result) {
+                        var json = eval(result.data.items);
+                        var html = "<ul>";
+                        // var html = "<table border='0' width='410px'>";
+                        for (var i = 0; i < json.length; i++) {
+                            html += "<li value=" + json[i].id + ">" + json[i].entname + "</li>";
+                        }
+                        html += "</ul>";
+                        $("#fuzzyQuerySelect").show().html(html);
+
+                        //鼠标移动到某行上改变颜色
+                        $("li").bind("mouseover", function () {
+                            $(this).css("background-color", "grey");
+                        });
+                        $("li").bind("mouseout", function () {
+                            $(this).css("background-color", "white");
+                        });
+                        //单击某行
+                        $("li").bind("click", function () {
+                            $("#fuzzyQuerySelect").hide();
+                            var id = $(this).val();
+                            $.getJSON(
+                                "${ctx}/workclientinfo/workClientInfo/enterpriseTicketInfo",
+                                {"id": id},
+                                function (data) {
+                                   console.log(data);
+                                   $("#name").val(data.ENTNAME);
+                                   $("#uscCode").val(data.UNCID);
+                                }
+                            );
+
+                        });
+                    }, "json");
+            }
+
+        }
+
 
 	</script>
 
@@ -291,11 +328,14 @@
             <form:hidden path="id"/>
             <div class="form-group layui-row first">
                 <div class="form-group-label"><h2>基本信息</h2></div>
-                <div class="layui-item layui-col-sm6 lw7">
+                <div class="layui-item layui-col-sm6 lw7" id="search">
                     <label class="layui-form-label"><span class="require-item">*</span>客户名称:</label>
                     <div class="layui-input-block">
                         <form:input path="name" htmlEscape="false" class="form-control required layui-input"/>
                     </div>
+                    <div id="fuzzyQuerySelect"
+                         style="display:none;background-color:white; position: relative; width:333px;left:120px; border: 1px solid gray;">
+                    </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
                     <label class="layui-form-label double-line"><span class="require-item">*</span>拥有统一社会信用代码:</label>