This commit is contained in:
xd 2024-03-26 15:56:53 +08:00
parent a49d85b57a
commit 665d37a32f
15 changed files with 747 additions and 224 deletions

View File

@ -81,6 +81,18 @@
<version>0.9.1.2</version> <version>0.9.1.2</version>
</dependency> </dependency>
<!-- json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<!-- httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -1,7 +1,18 @@
package com.ruoyi.web.controller.customer; package com.ruoyi.web.controller.customer;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.customer.domain.qcc.FuzzySearch;
import com.ruoyi.customer.domain.qcc.QccFuzzySearchJsonResult;
import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.qcc.HttpHelper;
import com.ruoyi.web.utils.qcc.QiChaChaUtil;
import org.apache.http.client.methods.HttpHead;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -29,8 +40,15 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/customer/customer") @RequestMapping("/customer/customer")
@PropertySource("classpath:/common.yml")
public class CustomerController extends BaseController public class CustomerController extends BaseController
{ {
@Value("${qichacha.key}")
private String Qcc_Key;
// 接口请求Key
@Value("${qichacha.secretKey}")
private String Qcc_SecretKey;
@Autowired @Autowired
private ICustomerService customerService; private ICustomerService customerService;
@ -77,6 +95,7 @@ public class CustomerController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Customer customer) public AjaxResult add(@RequestBody Customer customer)
{ {
customer.setCusCode(IdUtils.createNo("KH_",3));
return toAjax(customerService.insertCustomer(customer)); return toAjax(customerService.insertCustomer(customer));
} }
@ -101,4 +120,33 @@ public class CustomerController extends BaseController
{ {
return toAjax(customerService.deleteCustomerByCusIds(cusIds)); return toAjax(customerService.deleteCustomerByCusIds(cusIds));
} }
/***********************************************企查查模块************************************/
/**
* 查询企查查客户列表
*/
@PreAuthorize("@ss.hasPermi('customer:customer:qcclist')")
@GetMapping("/qccListCustomer")
public TableDataInfo qccListCustomer(FuzzySearch qcc)
{
String customerName = qcc.getName();
String reqInterNme = "https://api.qichacha.com/FuzzySearch/GetList";
List<FuzzySearch> result = new ArrayList<FuzzySearch>();
try {
if(!StringUtils.isEmpty(customerName)){
HttpHead reqHeader = new HttpHead();
String[] autherHeader = QiChaChaUtil.RandomAuthentHeader(Qcc_Key, Qcc_SecretKey);
reqHeader.setHeader("Token", autherHeader[0]);
reqHeader.setHeader("Timespan", autherHeader[1]);
String reqUri = reqInterNme.concat("?key=").concat(Qcc_Key).concat("&").concat("searchKey=").concat(customerName);
String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders());
System.out.println(String.format("==========================>this is response:{%s}", tokenJson));
QccFuzzySearchJsonResult obj = JSON.parseObject(tokenJson, QccFuzzySearchJsonResult.class);
result = obj.getResult();
}
} catch (Exception e1) {
e1.printStackTrace();
}
return getDataTable(result);
}
} }

View File

@ -10,7 +10,7 @@ public class IdUtils {
* @param size 订单号中随机的大写字母个数 * @param size 订单号中随机的大写字母个数
* @return * @return
*/ */
public static String createOrderNo(String startLetter,int size){ public static String createNo(String startLetter,int size){
String orderNo = null; String orderNo = null;
@ -68,6 +68,6 @@ public class IdUtils {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(createOrderNo("PO_",2)); System.out.println(createNo("PO_",2));
} }
} }

View File

@ -0,0 +1,129 @@
package com.ruoyi.web.utils.qcc;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
public class HttpHelper {
// get 请求
public static String httpGet(String url, Header[] headers) throws Exception {
HttpUriRequest uriRequest = new HttpGet(url);
if (null != headers)
uriRequest.setHeaders(headers);
CloseableHttpClient httpClient = null;
try {
httpClient = declareHttpClientSSL(url);
CloseableHttpResponse httpresponse = httpClient.execute(uriRequest);
HttpEntity httpEntity = httpresponse.getEntity();
String result = EntityUtils.toString(httpEntity, REQ_ENCODEING_UTF8);
return result;
} catch (ClientProtocolException e) {
System.out.println(String.format("http请求失败uri{%s},exception{%s}", new Object[]{url, e}));
} catch (IOException e) {
System.out.println(String.format("IO Exceptionuri{%s},exception{%s}", new Object[]{url, e}));
} finally {
if (null != httpClient)
httpClient.close();
}
return null;
}
// post 请求
public static String httpPost(String url, String params) throws Exception {
HttpPost post = new HttpPost(url);
post.addHeader("Content-Type", "application/json;charset=" + REQ_ENCODEING_UTF8);
// 设置传输编码格式
StringEntity stringEntity = new StringEntity(params, REQ_ENCODEING_UTF8);
stringEntity.setContentEncoding(REQ_ENCODEING_UTF8);
post.setEntity(stringEntity);
HttpResponse httpresponse = null;
CloseableHttpClient httpClient = null;
try {
httpClient = declareHttpClientSSL(url);
httpresponse = httpClient.execute(post);
HttpEntity httpEntity = httpresponse.getEntity();
String result = EntityUtils.toString(httpEntity, REQ_ENCODEING_UTF8);
return result;
} catch (ClientProtocolException e) {
System.out.println(String.format("http请求失败uri{%s},exception{%s}", new Object[]{url, e}));
} catch (IOException e) {
System.out.println(String.format("IO Exceptionuri{%s},exception{%s}", new Object[]{url, e}));
} finally {
if (null != httpClient)
httpClient.close();
}
return null;
}
private static CloseableHttpClient declareHttpClientSSL(String url) {
if (url.startsWith("https://")) {
return sslClient();
} else {
return HttpClientBuilder.create().setConnectionManager(httpClientConnectionManager).build();
}
}
/**
* 设置SSL请求处理
*/
private static CloseableHttpClient sslClient() {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[]{tm}, null);
SSLConnectionSocketFactory sslConnectionSocketFactory = SSLConnectionSocketFactory.getSocketFactory();
return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (KeyManagementException e) {
throw new RuntimeException(e);
}
}
// this is config
private static final String REQ_ENCODEING_UTF8 = "utf-8";
private static PoolingHttpClientConnectionManager httpClientConnectionManager;
public HttpHelper() {
httpClientConnectionManager = new PoolingHttpClientConnectionManager();
httpClientConnectionManager.setMaxTotal(100);
httpClientConnectionManager.setDefaultMaxPerRoute(20);
}
// get 请求
public static String httpGet(String url) throws Exception {
return httpGet(url, null);
}
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.web.utils.qcc;
import java.io.IOException;
import java.util.regex.Pattern;
import org.apache.commons.codec.digest.DigestUtils;
import org.json.JSONException;
import org.json.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class QiChaChaUtil {
// 获取返回码 Res Code
public static class HttpCodeRegex {
private static final String ABNORMAL_REGIX = "(101)|(102)";
private static final Pattern pattern = Pattern.compile(ABNORMAL_REGIX);
public static boolean isAbnornalRequest(final String status) {
return pattern.matcher(status).matches();
}
}
// 获取Auth Code
public static final String[] RandomAuthentHeader(String appkey,String seckey) {
String timeSpan = String.valueOf(System.currentTimeMillis() / 1000);
String[] authentHeaders = new String[] { DigestUtils.md5Hex(appkey.concat(timeSpan).concat(seckey)).toUpperCase(), timeSpan };
return authentHeaders;
}
// 解析JSON
public static String FormartJson(String jsonString, String key) throws JSONException {
JSONObject jObject = new JSONObject(jsonString);
return (String) jObject.get(key);
}
// pretty print 返回值
public static void PrettyPrintJson(String jsonString) throws JSONException {
try {
ObjectMapper mapper = new ObjectMapper();
Object obj = mapper.readValue(jsonString, Object.class);
String indented = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
System.out.println(indented);
} catch (JsonProcessingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -6,3 +6,6 @@ order.commitDateEndPm: 20:00:00
sapWebservice.host: poprd sapWebservice.host: poprd
sapWebservice.user: PO_USER sapWebservice.user: PO_USER
sapWebservice.psw: QAZ54321 sapWebservice.psw: QAZ54321
qichacha.key: 824936f8e78c4f4788978da38b26d488
qichacha.secretKey: 8B9EB102FD17E0CF2EDEC0FB507DEC1E

View File

@ -1,104 +0,0 @@
package com.ruoyi.contract.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 合同管理对象 Contract
*
* @author ruoyi
* @date 2024-01-23
*/
public class Contract extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 日期 */
@Excel(name = "日期")
private String contractDate;
private String[] contractDateRange;
/** 合同号 */
@Excel(name = "合同号")
private String contractNo;
/** 业务员编码 */
@Excel(name = "业务员编码")
private String contractSalesmanNo;
/** 业务员 */
@Excel(name = "业务员")
private String contractSalesman;
/** 客户*/
@Excel(name = "客户")
private String contractCustom;
/** 合同金额 */
@Excel(name = "合同金额")
private String contractJine;
/** 备注 */
@Excel(name = "备注")
private String contractRemark;
public String getContractDate() {
return contractDate;
}
public void setContractDate(String contractDate) {
this.contractDate = contractDate;
}
public String getContractNo() {
return contractNo;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public String getContractSalesman() {
return contractSalesman;
}
public void setContractSalesman(String contractSalesman) {
this.contractSalesman = contractSalesman;
}
public String getContractCustom() {
return contractCustom;
}
public void setContractCustom(String contractCustom) {
this.contractCustom = contractCustom;
}
public String getContractJine() {
return contractJine;
}
public void setContractJine(String contractJine) {
this.contractJine = contractJine;
}
public String getContractRemark() {
return contractRemark;
}
public void setContractRemark(String contractRemark) {
this.contractRemark = contractRemark;
}
public String getContractSalesmanNo() {
return contractSalesmanNo;
}
public void setContractSalesmanNo(String contractSalesmanNo) {
this.contractSalesmanNo = contractSalesmanNo;
}
public String[] getContractDateRange() {return contractDateRange;}
public void setContractDateRange(String[] contractDateRange) {this.contractDateRange = contractDateRange;}
}

View File

@ -0,0 +1,76 @@
package com.ruoyi.customer.domain.qcc;
public class FuzzySearch {
private String KeyNo;
private String Name;
private String CreditCode;
private String StartDate;
private String OperName;
private String Status;
private String No;
private String Address;
public String getKeyNo() {
return KeyNo;
}
public void setKeyNo(String keyNo) {
KeyNo = keyNo;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getCreditCode() {
return CreditCode;
}
public void setCreditCode(String creditCode) {
CreditCode = creditCode;
}
public String getStartDate() {
return StartDate;
}
public void setStartDate(String startDate) {
StartDate = startDate;
}
public String getOperName() {
return OperName;
}
public void setOperName(String operName) {
OperName = operName;
}
public String getStatus() {
return Status;
}
public void setStatus(String status) {
Status = status;
}
public String getNo() {
return No;
}
public void setNo(String no) {
No = no;
}
public String getAddress() {
return Address;
}
public void setAddress(String address) {
Address = address;
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.customer.domain.qcc;
public class Qcc {
private String qccCustomerName;
private String qccLegalPerson;
private String qccRegistrationTime;
private String qccVatNO;
public String getQccCustomerName() {
return qccCustomerName;
}
public void setQccCustomerName(String qccCustomerName) {
this.qccCustomerName = qccCustomerName;
}
public String getQccLegalPerson() {
return qccLegalPerson;
}
public void setQccLegalPerson(String qccLegalPerson) {
this.qccLegalPerson = qccLegalPerson;
}
public String getQccRegistrationTime() {
return qccRegistrationTime;
}
public void setQccRegistrationTime(String qccRegistrationTime) {
this.qccRegistrationTime = qccRegistrationTime;
}
public String getQccVatNO() {
return qccVatNO;
}
public void setQccVatNO(String qccVatNO) {
this.qccVatNO = qccVatNO;
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.customer.domain.qcc;
import java.util.List;
public class QccFuzzySearchJsonResult {
private List<FuzzySearch> Result;
public List<FuzzySearch> getResult() {
return Result;
}
public void setResult(List<FuzzySearch> result) {
Result = result;
}
}

View File

@ -7,6 +7,7 @@ import com.ruoyi.storageLocation.mapper.StorageLocationMapper;
import com.ruoyi.storageLocation.service.StorageLocationService; import com.ruoyi.storageLocation.service.StorageLocationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@ -45,6 +46,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* @param storageLocation * @param storageLocation
* @return * @return
*/ */
@Transactional
@Override @Override
public int addStorageLocation(StorageLocation storageLocation) { public int addStorageLocation(StorageLocation storageLocation) {
return storageLocationMapper.addStorageLocation(storageLocation); return storageLocationMapper.addStorageLocation(storageLocation);
@ -54,6 +56,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* 确认完成认领 * 确认完成认领
* @param materialBhArr * @param materialBhArr
*/ */
@Transactional
@Override @Override
public void confirmStorageLocation(List<String> materialBhArr) { public void confirmStorageLocation(List<String> materialBhArr) {
storageLocationMapper.confirmStorageLocation(materialBhArr); storageLocationMapper.confirmStorageLocation(materialBhArr);
@ -73,6 +76,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* 保存至已选库位表 * 保存至已选库位表
* @param materialBh * @param materialBh
*/ */
@Transactional
@Override @Override
public void saveStorageLocation(String userName,String materialBh) { public void saveStorageLocation(String userName,String materialBh) {
storageLocationMapper.saveStorageLocation(userName,materialBh); storageLocationMapper.saveStorageLocation(userName,materialBh);
@ -83,6 +87,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* @param userName * @param userName
* @param materialBh * @param materialBh
*/ */
@Transactional
@Override @Override
public void deleteStorageLocation(String userName, String materialBh) { public void deleteStorageLocation(String userName, String materialBh) {
storageLocationMapper.deleteStorageLocation(userName,materialBh); storageLocationMapper.deleteStorageLocation(userName,materialBh);
@ -120,6 +125,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* @param userName * @param userName
* @param materialBhList * @param materialBhList
*/ */
@Transactional
@Override @Override
public void deleteBatchStorageLocation(String userName, List<String> materialBhList) { public void deleteBatchStorageLocation(String userName, List<String> materialBhList) {
storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList); storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList);
@ -129,6 +135,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* 插入操作记录表 * 插入操作记录表
* @param operlog * @param operlog
*/ */
@Transactional
@Override @Override
public void addOperlog(Operlog operlog) { public void addOperlog(Operlog operlog) {
storageLocationMapper.addOperlog(operlog); storageLocationMapper.addOperlog(operlog);
@ -149,6 +156,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
* 批量插入操作记录表 * 批量插入操作记录表
* @param operlogList * @param operlogList
*/ */
@Transactional
@Override @Override
public void addBatchOperlog(List<Operlog> operlogList) { public void addBatchOperlog(List<Operlog> operlogList) {
storageLocationMapper.addBatchOperlog(operlogList); storageLocationMapper.addBatchOperlog(operlogList);

View File

@ -62,10 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.cus_id = #{cusId} where a.cus_id = #{cusId}
</select> </select>
<insert id="insertCustomer" parameterType="Customer"> <insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="cusId">
insert into customer insert into customer
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cusId != null">cus_id,</if>
<if test="cusCode != null">cus_code,</if> <if test="cusCode != null">cus_code,</if>
<if test="cusName != null and cusName != ''">cus_name,</if> <if test="cusName != null and cusName != ''">cus_name,</if>
<if test="cusSapCode != null">cus_sap_code,</if> <if test="cusSapCode != null">cus_sap_code,</if>
@ -88,7 +87,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cusApprovalStatus != null">cus_approval_status,</if> <if test="cusApprovalStatus != null">cus_approval_status,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cusId != null">#{cusId},</if>
<if test="cusCode != null">#{cusCode},</if> <if test="cusCode != null">#{cusCode},</if>
<if test="cusName != null and cusName != ''">#{cusName},</if> <if test="cusName != null and cusName != ''">#{cusName},</if>
<if test="cusSapCode != null">#{cusSapCode},</if> <if test="cusSapCode != null">#{cusSapCode},</if>
@ -162,9 +160,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<insert id="batchBank"> <insert id="batchBank">
insert into bank( bank_id, bank_name, bank_account, cus_id) values insert into bank(bank_name, bank_account, cus_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.bankId}, #{item.bankName}, #{item.bankAccount}, #{item.cusId}) ( #{item.bankName}, #{item.bankAccount}, #{item.cusId})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

View File

@ -42,3 +42,13 @@ export function delCustomer(cusId) {
method: 'delete' method: 'delete'
}) })
} }
/******************************企查查模块***********************************/
// 查询企查查客户列表
export function qccListCustomer(query) {
return request({
url: '/customer/customer/qccListCustomer',
method: 'get',
params: query
})
}

View File

@ -1,6 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="客户编码" prop="cusCode">
<el-input
v-model="queryParams.cusCode"
placeholder="请输入客户编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="cusName"> <el-form-item label="客户名称" prop="cusName">
<el-input <el-input
v-model="queryParams.cusName" v-model="queryParams.cusName"
@ -17,7 +25,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="客户禁用状态" prop="cusState"> <el-form-item label="状态" prop="cusState">
<el-select v-model="queryParams.cusState" placeholder="请选择客户禁用状态" clearable> <el-select v-model="queryParams.cusState" placeholder="请选择客户禁用状态" clearable>
<el-option <el-option
v-for="dict in dict.type.common_state" v-for="dict in dict.type.common_state"
@ -27,7 +35,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户审批状态" prop="cusApprovalStatus"> <el-form-item label="审批状态" prop="cusApprovalStatus">
<el-select v-model="queryParams.cusApprovalStatus" placeholder="请选择客户审批状态" clearable> <el-select v-model="queryParams.cusApprovalStatus" placeholder="请选择客户审批状态" clearable>
<el-option <el-option
v-for="dict in dict.type.cus_approval_status" v-for="dict in dict.type.cus_approval_status"
@ -91,7 +99,7 @@
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户ID" align="center" prop="cusId" /> <el-table-column label="客户ID" align="center" prop="cusId" v-if="false"/>
<el-table-column label="客户编码" align="center" prop="cusCode" /> <el-table-column label="客户编码" align="center" prop="cusCode" />
<el-table-column label="客户名称" align="center" prop="cusName" /> <el-table-column label="客户名称" align="center" prop="cusName" />
<el-table-column label="SAP客户编码" align="center" prop="cusSapCode" /> <el-table-column label="SAP客户编码" align="center" prop="cusSapCode" />
@ -105,7 +113,7 @@
<dict-tag :options="dict.type.cus_approval_status" :value="scope.row.cusApprovalStatus"/> <dict-tag :options="dict.type.cus_approval_status" :value="scope.row.cusApprovalStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -134,81 +142,150 @@
/> />
<!-- 添加或修改客户管理对话框 --> <!-- 添加或修改客户管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="1050px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="客户编码" prop="cusCode"> <el-row :gutter="8">
<el-input v-model="form.cusCode" type="textarea" placeholder="请输入内容" /> <el-col :span="8">
</el-form-item> <el-form-item label="客户编码" prop="cusCode">
<el-form-item label="客户名称" prop="cusName"> <el-input v-model="form.cusCode" placeholder="系统自动生成" :disabled="true"/>
<el-input v-model="form.cusName" placeholder="请输入客户名称" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="SAP客户编码" prop="cusSapCode"> <el-col :span="8">
<el-input v-model="form.cusSapCode" placeholder="请输入SAP客户编码" /> <el-form-item label="客户名称" prop="cusName">
</el-form-item> <el-input v-model="form.cusName" placeholder="企查查查询" :disabled="true">
<el-form-item label="街道/门牌号" prop="cusStreet"> <el-button slot="append" icon="el-icon-search" @click="openQcc"></el-button>
<el-input v-model="form.cusStreet" placeholder="请输入街道/门牌号" /> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="付款条件" prop="cusPaymentTerms"> </el-col>
<el-input v-model="form.cusPaymentTerms" placeholder="请输入付款条件" /> <el-col :span="8">
</el-form-item> <el-form-item label="SAP客户编码" prop="cusSapCode">
<el-form-item label="电话号码" prop="cusPhoneNumber"> <el-input v-model="form.cusSapCode" placeholder="审批通过自动生成" :disabled="true"/>
<el-input v-model="form.cusPhoneNumber" placeholder="请输入电话号码" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="行业代码" prop="cusIndustryCode"> </el-row>
<el-input v-model="form.cusIndustryCode" placeholder="请输入行业代码" /> <el-row :gutter="8">
</el-form-item> <el-col :span="8">
<el-form-item label="客户组类别" prop="cusGroup"> <el-form-item label="街道/门牌号" prop="cusStreet">
<el-input v-model="form.cusGroup" placeholder="请输入客户组类别" /> <el-input v-model="form.cusStreet" placeholder="请输入街道/门牌号" />
</el-form-item> </el-form-item>
<el-form-item label="增值税号" prop="cusVatNo"> </el-col>
<el-input v-model="form.cusVatNo" placeholder="请输入增值税号" /> <el-col :span="8">
</el-form-item> <el-form-item label="付款条件" prop="cusPaymentTerms">
<el-form-item label="国家" prop="cusCountry"> <el-select v-model="form.cusPaymentTerms" placeholder="请选择付款条件" style="width: 100%;">
<el-input v-model="form.cusCountry" placeholder="请输入国家" /> <el-option
</el-form-item> v-for="dict in dict.type.cus_payment_terms"
<el-form-item label="语言" prop="cusLanguage"> :key="dict.value"
<el-input v-model="form.cusLanguage" placeholder="请输入语言" /> :label="dict.label"
</el-form-item> :value="dict.value"
<el-form-item label="客户标签" prop="cusLabel"> ></el-option>
<el-input v-model="form.cusLabel" placeholder="请输入客户标签" /> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="客户分类" prop="cusClassification"> </el-col>
<el-input v-model="form.cusClassification" placeholder="请输入客户分类" /> <el-col :span="8">
</el-form-item> <el-form-item label="电话号码" prop="cusPhoneNumber">
<el-form-item label="电子发票接收邮箱" prop="cusReceivingEmail"> <el-input v-model="form.cusPhoneNumber" placeholder="请输入电话号码" />
<el-input v-model="form.cusReceivingEmail" placeholder="请输入电子发票接收邮箱" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="收件人" prop="cusRecipient"> </el-row>
<el-input v-model="form.cusRecipient" placeholder="请输入收件人" /> <el-row :gutter="8">
</el-form-item> <el-col :span="8">
<el-form-item label="收件人电话" prop="cusRecipientPhone"> <el-form-item label="行业代码" prop="cusIndustryCode">
<el-input v-model="form.cusRecipientPhone" placeholder="请输入收件人电话" /> <el-input v-model="form.cusIndustryCode" placeholder="请输入行业代码" />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="cusRemark"> </el-col>
<el-input v-model="form.cusRemark" placeholder="请输入备注" /> <el-col :span="8">
</el-form-item> <el-form-item label="客户组类别" prop="cusGroup">
<el-form-item label="客户禁用状态" prop="cusState"> <el-select v-model="form.cusGroup" placeholder="请选择客户组类别" style="width: 100%;">
<el-select v-model="form.cusState" placeholder="请选择客户禁用状态"> <el-option
<el-option v-for="dict in dict.type.cus_group"
v-for="dict in dict.type.common_state" :key="dict.value"
:key="dict.value" :label="dict.label"
:label="dict.label" :value="dict.value"
:value="dict.value" ></el-option>
></el-option> </el-select>
</el-select> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="客户审批状态" prop="cusApprovalStatus"> <el-col :span="8">
<el-select v-model="form.cusApprovalStatus" placeholder="请选择客户审批状态"> <el-form-item label="增值税号" prop="cusVatNo">
<el-option <el-input v-model="form.cusVatNo" placeholder="请输入增值税号" />
v-for="dict in dict.type.cus_approval_status" </el-form-item>
:key="dict.value" </el-col>
:label="dict.label" </el-row>
:value="dict.value" <el-row :gutter="8">
></el-option> <el-col :span="8">
</el-select> <el-form-item label="客户类型" prop="cusType">
</el-form-item> <el-select v-model="form.cusType" placeholder="请选择客户类型" style="width: 100%;">
<el-option
v-for="dict in dict.type.cus_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="国家" prop="cusCountry">
<el-select v-model="form.cusCountry" placeholder="请选择国家" style="width: 100%;">
<el-option
v-for="dict in dict.type.cus_country"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="语言" prop="cusLanguage">
<el-select v-model="form.cusLanguage" placeholder="请选择语言" style="width: 100%;">
<el-option
v-for="dict in dict.type.cus_language"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="8">
<el-form-item label="客户标签" prop="cusLabel">
<el-input v-model="form.cusLabel" placeholder="请输入客户标签" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="客户分类" prop="cusClassification">
<el-input v-model="form.cusClassification" placeholder="请输入客户分类" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="电子发票邮箱" prop="cusReceivingEmail">
<el-input v-model="form.cusReceivingEmail" placeholder="请输入电子发票接收邮箱" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="8">
<el-form-item label="收件人" prop="cusRecipient">
<el-input v-model="form.cusRecipient" placeholder="请输入收件人" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="收件人电话" prop="cusRecipientPhone">
<el-input v-model="form.cusRecipientPhone" placeholder="请输入收件人电话" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="cusRemark">
<el-input v-model="form.cusRemark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
<el-divider content-position="center">银行信息</el-divider> <el-divider content-position="center">银行信息</el-divider>
<el-row :gutter="10" class="mb8"> <el-row :gutter="8" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddBank">添加</el-button> <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddBank">添加</el-button>
</el-col> </el-col>
@ -219,12 +296,12 @@
<el-table :data="bankList" :row-class-name="rowBankIndex" @selection-change="handleBankSelectionChange" ref="bank"> <el-table :data="bankList" :row-class-name="rowBankIndex" @selection-change="handleBankSelectionChange" ref="bank">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/> <el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="银行名称" prop="bankName" width="150"> <el-table-column label="银行名称" prop="bankName">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.bankName" placeholder="请输入银行名称" /> <el-input v-model="scope.row.bankName" placeholder="请输入银行名称" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="银行账户" prop="bankAccount" width="150"> <el-table-column label="银行账户" prop="bankAccount">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.bankAccount" placeholder="请输入银行账户" /> <el-input v-model="scope.row.bankAccount" placeholder="请输入银行账户" />
</template> </template>
@ -232,19 +309,64 @@
</el-table> </el-table>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button @click="saveForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button type="primary" plain @click="commitForm"> </el-button>
</div>
</el-dialog>
<!-- 企查查 客户查询 对话框 -->
<el-dialog :title="qccTitle" :visible.sync="qccOpen" width="800px" :show-close="false" append-to-body>
<el-form :model="queryQccParams" ref="queryQccForm" size="small" :inline="true" label-width="100px">
<el-form-item label="公司名称" prop="Name">
<el-input
v-model="queryQccParams.Name"
placeholder="请输入公司名称"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQccQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table v-loading="qccLoading" ref="qccTable" :data="qccCustomerList" @selection-change="handleSelectionQccChange" height="300">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="公司名" align="center" prop="name" />
<el-table-column label="法人" align="center" prop="operName" />
<el-table-column label="注册时间" align="center" prop="startDate" />
<el-table-column label="增值税号" align="center" prop="creditCode" />
</el-table>
<!--<pagination
v-show="qccTotal>0"
:total="qccTotal"
:page.sync="qccCurrentPage"
:limit.sync="qccPageSize"
@size-change="handleQccSizeChange"
@current-change="handleQccCurrentChange"
/>-->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="qccConfirm" :disabled="qccSingle"> </el-button>
<el-button @click="qccCancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<style>
.el-dialog__body {
padding: 10px 10px;
color: #606266;
font-size: 14px;
word-break: break-all;
}
/* .el-dialog__footer {
text-align: center;
}*/
</style>
<script> <script>
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer } from "@/api/customer/customer"; import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, qccListCustomer } from "@/api/customer/customer";
export default { export default {
name: "Customer", name: "Customer",
dicts: ['cus_approval_status', 'common_state'], dicts: ['cus_country', 'cus_payment_terms', 'cus_group', 'cus_approval_status', 'cus_language', 'cus_type', 'common_state'],
data() { data() {
return { return {
// //
@ -290,7 +412,7 @@ export default {
{ required: true, message: "街道/门牌号不能为空", trigger: "blur" } { required: true, message: "街道/门牌号不能为空", trigger: "blur" }
], ],
cusPaymentTerms: [ cusPaymentTerms: [
{ required: true, message: "付款条件不能为空", trigger: "blur" } { required: true, message: "付款条件不能为空", trigger: "change" }
], ],
cusPhoneNumber: [ cusPhoneNumber: [
{ required: true, message: "电话号码不能为空", trigger: "blur" } { required: true, message: "电话号码不能为空", trigger: "blur" }
@ -299,18 +421,42 @@ export default {
{ required: true, message: "行业代码不能为空", trigger: "blur" } { required: true, message: "行业代码不能为空", trigger: "blur" }
], ],
cusGroup: [ cusGroup: [
{ required: true, message: "客户组类别不能为空", trigger: "blur" } { required: true, message: "客户组类别不能为空", trigger: "change" }
], ],
cusVatNo: [ cusVatNo: [
{ required: true, message: "增值税号不能为空", trigger: "blur" } { required: true, message: "增值税号不能为空", trigger: "blur" }
], ],
cusCountry: [ cusCountry: [
{ required: true, message: "国家不能为空", trigger: "blur" } { required: true, message: "国家不能为空", trigger: "change" }
], ],
cusLanguage: [ cusLanguage: [
{ required: true, message: "语言不能为空", trigger: "blur" } { required: true, message: "语言不能为空", trigger: "change" }
], ],
},
/*****************************企查查查询模块*************************************/
//
qccLoading: false,
//
qccTitle: "",
//
qccOpen: false,
//
/*qccCurrentPage: 1,
qccPageSize: 10,
qccTotal: 0,*/
qccCustomerList: [], //
//
qccSingle: true,
//
qccMultiple: true,
queryQccParams:{
Name: null
} }
/*****************************企查查查询模块*************************************/
}; };
}, },
created() { created() {
@ -379,7 +525,12 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加客户管理"; this.title = "添加客户信息";
//
this.form.cusGroup = 'Z001';
this.form.cusCountry = 'CN';
this.form.cusLanguage = 'ZH';
this.form.cusType = 'saleCus';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -389,11 +540,11 @@ export default {
this.form = response.data; this.form = response.data;
this.bankList = response.data.bankList; this.bankList = response.data.bankList;
this.open = true; this.open = true;
this.title = "修改客户管理"; this.title = "修改客户信息";
}); });
}, },
/** 提交按钮 */ /** 保存按钮 */
submitForm() { saveForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.bankList = this.bankList; this.form.bankList = this.bankList;
@ -413,6 +564,26 @@ export default {
} }
}); });
}, },
commitForm() {
/*this.$refs["form"].validate(valid => {
if (valid) {
this.form.bankList = this.bankList;
if (this.form.cusId != null) {
commitCustomer(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
commitCustomer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});*/
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const cusIds = row.cusId || this.ids; const cusIds = row.cusId || this.ids;
@ -455,7 +626,75 @@ export default {
this.download('customer/customer/export', { this.download('customer/customer/export', {
...this.queryParams ...this.queryParams
}, `customer_${new Date().getTime()}.xlsx`) }, `customer_${new Date().getTime()}.xlsx`)
},
/*****************************企查查查询模块*************************************/
/** 企查查客户弹出框 */
openQcc(){
this.qccOpen = true;
this.qccTitle = "企查查客户信息";
},
/** 切换每页显示条数 */
/*handleQccSizeChange(val) {
this.qccPageSize = val;
this.qccCurrentPage = 1;
},*/
/** 页码选择 */
/*handleQccCurrentChange(val) {
this.qccCurrentPage = val;
},*/
/** 企查查客户查询 */
handleQccQuery(){
if(!this.queryQccParams.Name){
this.$message.warning("请输入公司名称!");
return;
}
this.qccLoading = true;
qccListCustomer(this.queryQccParams).then(response => {
this.qccCustomerList = response.rows;
this.qccTotal = response.total;
//this.qccCurrentPage = 1;
this.qccLoading = false;
});
},
//
handleSelectionQccChange(selection) {
this.qccSingle = selection.length!==1
this.qccMultiple = !selection.length
},
//
qccConfirm(){
const qccTable = this.$refs.qccTable;
const selectedData = qccTable.selection;
this.form.cusName = selectedData[0].name;
this.form.cusVatNo = selectedData[0].creditCode;
this.qccOpen = false;
},
//
qccCancel() {
this.qccOpen = false;
this.resetQccQuery();
},
/** 重置按钮操作 */
resetQccQuery() {
this.qccCustomerList = [];
this.qccTotal = 0;
this.resetForm("queryQccForm");
} }
} /*****************************企查查查询模块*************************************/
},
/* computed: {
//
qccPagedData() {
const startIndex = (this.qccCurrentPage - 1) * this.qccPageSize;
const endIndex = startIndex + this.qccPageSize;
return this.qccCustomerList.slice(startIndex, endIndex);
},
},*/
}; };
</script> </script>