From 7f32530c7cd53e8d8f9459b6be23df123748e259 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 13 Sep 2024 09:36:45 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=8D=AE=E5=AE=A2=E6=88=B7=E5=90=8D=E7=A7=B0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E4=BF=AE=E6=94=B9=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=AE=A2=E6=88=B7id=E6=9F=A5=E8=AF=A2=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E7=9A=84js=E6=96=B9=E6=B3=95=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=AE=9E=E7=8E=B0=E5=AE=A2=E6=88=B7=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=8F=AF=E5=85=B3=E9=94=AE=E8=AF=8D=E6=90=9C=E7=B4=A2=E8=BE=93?= =?UTF-8?q?=E5=85=A5=EF=BC=8C=E5=AE=A2=E6=88=B7ID=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=90=8D=E7=A7=B0=E8=87=AA=E5=8A=A8=E5=A1=AB?= =?UTF-8?q?=E5=85=85=EF=BC=8C=E4=B8=8D=E5=8F=AF=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=A1=B5=E9=9D=A2=E5=AE=A2=E6=88=B7=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=92=8C=E5=AE=A2=E6=88=B7id=E5=89=8D=E7=AB=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysCustomerController.java | 23 ++++++++++ .../system/service/ISysCustomerService.java | 4 ++ .../service/impl/SysCustomerServiceImpl.java | 8 ++++ .../mapper/system/SysCustomerMapper.xml | 2 +- .../templates/system/salesOrder/add.html | 43 ++++++++++--------- 5 files changed, 58 insertions(+), 22 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java index d2a0126d..ac0f692f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java @@ -339,6 +339,29 @@ public class SysCustomerController extends BaseController list.add(0,sysContacts1); return getDataTable(list); } + + /** + *根据客户名称查询客户信息 + */ + @PostMapping("/contactsList2") + @ResponseBody + public TableDataInfo list2(SysContacts sysContacts) + { + startPage(); + List list = sysContactsService.selectSysContactsList(sysContacts); + SysCustomer customer = sysCustomerService.selectSysCustomerByEnterpriseName(sysContacts.getEnterpriseName()); + SysContacts sysContacts1 = new SysContacts(); + sysContacts1.setEnterpriseCode(customer.getEnterpriseCode()); + sysContacts1.setCustomerName(customer.getCustomerContact()); + sysContacts1.setCustomerPosition(customer.getCustomerOffice()); + sysContacts1.setCellPhone(customer.getContactNumber()); + sysContacts1.setCommonEmail(customer.getCustomerEmail()); + sysContacts1.setCustomerFax(customer.getCustomerFax()); + list.add(0,sysContacts1); + return getDataTable(list); + } + + @PostMapping("/shippingList") @ResponseBody public TableDataInfo list(SysShippingAddress sysShippingAddress) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java index 4375acfa..cff3eb4f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java @@ -123,4 +123,8 @@ public interface ISysCustomerService * */ String convertName(SysCustomerVo sysCustomerVo); + /** + * 根据客户名称查询客户信息 + * */ + SysCustomer selectSysCustomerByEnterpriseName(String enterpriseName); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java index 8d300172..20d2742f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java @@ -165,6 +165,14 @@ public class SysCustomerServiceImpl implements ISysCustomerService } + /** + * 根据客户名称查询客户信息 + * */ + @Override + public SysCustomer selectSysCustomerByEnterpriseName(String enterpriseName) { + return sysCustomerMapper.selectSysCustomerByEnterpriseName(enterpriseName); + } + /** * 新增客户基本信息 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml index 69f8e240..f52be75b 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml @@ -376,7 +376,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html index 87196d44..15e0a6ef 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html @@ -72,18 +72,19 @@ +
- +
-
- +
- +
@@ -586,7 +587,7 @@ // minimumInputLength: 1 // } // }); - $("select[name='enterpriseCode']").select2({ + $("select[name='enterpriseName']").select2({ theme: "bootstrap", allowClear: true, placeholder: "请选择客户", @@ -605,8 +606,8 @@ // console.log(customerList); for(var i= 0, len=resultList.length;i 0) { + if ($("select[name='enterpriseName']").find("option[value='" + enterpriseName + "']").length > 0) { // 设置下拉框的值 - $("select[name='enterpriseCode']").val(enterpriseCode).trigger('change'); + $("select[name='enterpriseName']").val(enterpriseName).trigger('change'); } else { - console.error("尝试设置的值不存在于下拉框中:", enterpriseCode); + console.error("尝试设置的值不存在于下拉框中:", enterpriseName); } } else { // 清空下拉框的值 @@ -789,16 +790,16 @@ - $('#enterpriseCode').on('select2:select', function (e) { + $('#enterpriseName').on('select2:select', function (e) { var data = e.params.data; - $("input[name='enterpriseName']").val(data.enterpriseName); + $("input[name='enterpriseCode']").val(data.enterpriseCode); $("input[name='customerPurser']").val(data.customerPurser); $("select[name='customerContact']").select2({ theme: "bootstrap", allowClear: true, ajax:{ type: "post", - url:ctx + "system/customer/contactsList", + url:ctx + "system/customer/contactsList2", dataType:"json", delay:250, cache:true, @@ -815,8 +816,8 @@ var options = []; for(var i= 0, len=resultList.length;i