add:客户
This commit is contained in:
@@ -0,0 +1,96 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.base_manage.customer.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.TableDataInfo;
|
||||||
|
import org.nl.common.anno.Log;
|
||||||
|
import org.nl.common.domain.entity.PageQuery;
|
||||||
|
import org.nl.common.utils.RedissonUtils;
|
||||||
|
import org.nl.wms.base_manage.customer.service.IBmCustomerService;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.BmCustomer;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dto.CustomerQuery;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ldjun
|
||||||
|
* @date 2021-12-06
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/bmCustomer")
|
||||||
|
@Slf4j
|
||||||
|
public class BmCustomerController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBmCustomerService customerService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询客户基础表")
|
||||||
|
public ResponseEntity<Object> query(CustomerQuery query, PageQuery page) {
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(customerService.page(page.build(), query.build())), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增客户基础表")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject dto) {
|
||||||
|
customerService.create(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改客户基础表")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody JSONObject dto) {
|
||||||
|
customerService.update(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除客户基础表")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
if (ids.length > 0) {
|
||||||
|
customerService.removeByIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/excelImport")
|
||||||
|
@Log("excel导入")
|
||||||
|
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
RedissonUtils.lock(() -> {
|
||||||
|
customerService.excelImport(file, request, response);
|
||||||
|
}, "客户信息导入", null);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectList")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> getSelectList() {
|
||||||
|
List<Map> selectList = new ArrayList<>();
|
||||||
|
List<BmCustomer> list = customerService.list();
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
list.forEach(cus -> {
|
||||||
|
Map<String, String> item = new HashMap<>();
|
||||||
|
item.put("value", cus.getCust_code());
|
||||||
|
item.put("label", cus.getCust_name());
|
||||||
|
selectList.add(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(selectList), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.nl.wms.base_manage.customer.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.BmCustomer;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 客户基本信息表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-06-25
|
||||||
|
*/
|
||||||
|
public interface IBmCustomerService extends IService<BmCustomer> {
|
||||||
|
|
||||||
|
void create(JSONObject dto);
|
||||||
|
|
||||||
|
void update(JSONObject dto);
|
||||||
|
|
||||||
|
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
package org.nl.wms.base_manage.customer.service.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 客户基本信息表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-06-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("bm_customer")
|
||||||
|
public class BmCustomer implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户标识
|
||||||
|
*/
|
||||||
|
@TableId(value = "cust_id")
|
||||||
|
private String cust_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户编码
|
||||||
|
*/
|
||||||
|
private String cust_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String cust_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法人代表
|
||||||
|
*/
|
||||||
|
private String jurid_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 税务登记号
|
||||||
|
*/
|
||||||
|
private String tax_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工商注册号
|
||||||
|
*/
|
||||||
|
private String register_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经营许可证号
|
||||||
|
*/
|
||||||
|
private String manage_lice_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照
|
||||||
|
*/
|
||||||
|
private String busi_char_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划
|
||||||
|
*/
|
||||||
|
private Long area_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮政编码
|
||||||
|
*/
|
||||||
|
private String zip_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司电话
|
||||||
|
*/
|
||||||
|
private String corp_tele_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司地址
|
||||||
|
*/
|
||||||
|
private String corp_address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String create_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人姓名
|
||||||
|
*/
|
||||||
|
private String create_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String create_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private String update_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人姓名
|
||||||
|
*/
|
||||||
|
private String update_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String update_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用时间
|
||||||
|
*/
|
||||||
|
private String is_used_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private String is_used;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private String is_delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部标识
|
||||||
|
*/
|
||||||
|
private String ext_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类标识
|
||||||
|
*/
|
||||||
|
private String class_id;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.wms.base_manage.customer.service.dao.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.BmCustomer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 客户基本信息表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-06-25
|
||||||
|
*/
|
||||||
|
public interface BmCustomerMapper extends BaseMapper<BmCustomer> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.wms.base_manage.customer.service.dao.mapper.BmCustomerMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.nl.wms.base_manage.customer.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.nl.common.domain.entity.BaseQuery;
|
||||||
|
import org.nl.common.domain.entity.QParam;
|
||||||
|
import org.nl.common.enums.QueryTEnum;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.BmCustomer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2023/5/14 17:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerQuery extends BaseQuery<BmCustomer> {
|
||||||
|
|
||||||
|
private String search;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paramMapping() {
|
||||||
|
super.doP.put("search", QParam.builder().k(new String[]{"cust_code","cust_name"}).type(QueryTEnum.LK).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package org.nl.wms.base_manage.customer.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelReader;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.nl.common.domain.exception.BadRequestException;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.base_manage.customer.service.IBmCustomerService;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.BmCustomer;
|
||||||
|
import org.nl.wms.base_manage.customer.service.dao.mapper.BmCustomerMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 客户基本信息表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author generator
|
||||||
|
* @since 2023-06-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BmCustomerServiceImpl extends ServiceImpl<BmCustomerMapper, BmCustomer> implements IBmCustomerService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(JSONObject dto) {
|
||||||
|
Assert.notNull(dto, "请求参数不能为空");
|
||||||
|
String cust_code = dto.getString("cust_code");
|
||||||
|
BmCustomer custCode = this.getOne(new QueryWrapper<BmCustomer>().eq("cust_code", cust_code));
|
||||||
|
if (custCode != null) {
|
||||||
|
throw new BadRequestException("存在相同的客户编号");
|
||||||
|
}
|
||||||
|
BmCustomer entity = dto.toJavaObject(BmCustomer.class);
|
||||||
|
entity.setCust_id(IdUtil.getStringId());
|
||||||
|
entity.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
entity.setCreate_time(DateUtil.now());
|
||||||
|
this.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(JSONObject dto) {
|
||||||
|
|
||||||
|
BmCustomer entity = dto.toJavaObject(BmCustomer.class);
|
||||||
|
entity.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
entity.setUpdate_time(DateUtil.now());
|
||||||
|
this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
InputStream inputStream = file.getInputStream();
|
||||||
|
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||||
|
List<List<Object>> read = excelReader.read();
|
||||||
|
|
||||||
|
Map<String, String> errorMap = new HashMap();
|
||||||
|
for (int i = 1; i < read.size(); i++) {
|
||||||
|
List<Object> list = read.get(i);
|
||||||
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String cust_code = (String) list.get(0);
|
||||||
|
if (StrUtil.isEmpty(cust_code)) {
|
||||||
|
errorMap.put("第" + (i + 1) + "行:", "客户编码为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String cust_name = (String) list.get(1);
|
||||||
|
if (StrUtil.isEmpty(cust_name)) {
|
||||||
|
errorMap.put("第" + (i + 1) + "行:", "客户名称为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean need_update = false;
|
||||||
|
BmCustomer cust_jo = this.getOne(new QueryWrapper<BmCustomer>().eq("cust_code", cust_code));
|
||||||
|
if (ObjectUtil.isNotEmpty(cust_jo)){
|
||||||
|
need_update = true;
|
||||||
|
}else {
|
||||||
|
cust_jo = new BmCustomer();
|
||||||
|
}
|
||||||
|
if (need_update){
|
||||||
|
cust_jo.setCust_name(cust_name);
|
||||||
|
cust_jo.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
cust_jo.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
cust_jo.setUpdate_time(DateUtil.now());
|
||||||
|
this.updateById(cust_jo);
|
||||||
|
}else {
|
||||||
|
cust_jo.setCust_code(cust_code);
|
||||||
|
cust_jo.setCust_name(cust_name);
|
||||||
|
cust_jo.setCust_id(IdUtil.getStringId());
|
||||||
|
cust_jo.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
cust_jo.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
cust_jo.setCreate_time(DateUtil.now());
|
||||||
|
cust_jo.setIs_delete("0");
|
||||||
|
cust_jo.setIs_used("1");
|
||||||
|
this.save(cust_jo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
wms_pro/qd/src/api/wms/base_manage/customer/customer.js
Normal file
42
wms_pro/qd/src/api/wms/base_manage/customer/customer.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmCustomer',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmCustomer',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmCustomer',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function excelImport(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmCustomer/excelImport',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function selectList() {
|
||||||
|
return request({
|
||||||
|
url: 'api/bmCustomer/selectList',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, selectList, excelImport }
|
||||||
125
wms_pro/qd/src/views/wms/base_manage/customer/UploadDialog.vue
Normal file
125
wms_pro/qd/src/views/wms/base_manage/customer/UploadDialog.vue
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="导入Excel文件"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
destroy-on-close
|
||||||
|
width="400px"
|
||||||
|
:show-close="true"
|
||||||
|
@close="close"
|
||||||
|
@open="open"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
drag
|
||||||
|
:on-exceed="is_one"
|
||||||
|
:limit="1"
|
||||||
|
:auto-upload="false"
|
||||||
|
:multiple="false"
|
||||||
|
:show-file-list="true"
|
||||||
|
:on-change="uploadByJsqd"
|
||||||
|
:file-list="fileList"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
>
|
||||||
|
<i class="el-icon-upload" />
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或
|
||||||
|
<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||||
|
</el-upload>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudCustomerbase from '@/api/wms/basedata/master/customerbase'
|
||||||
|
import CRUD, { crud } from '@crud/crud'
|
||||||
|
import { download2 } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UploadDialog',
|
||||||
|
mixins: [crud()],
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
dialogShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
fileList: [],
|
||||||
|
file1: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogShow: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.dialogVisible = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.opendtlParam = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
},
|
||||||
|
is_one() {
|
||||||
|
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
},
|
||||||
|
// 文件校验方法
|
||||||
|
beforeAvatarUpload(file) {
|
||||||
|
// 不能导入大小超过2Mb的文件
|
||||||
|
if (file.size > 10 * 1024 * 1024) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
// 文件发生改变就会触发的事件
|
||||||
|
uploadByJsqd(file) {
|
||||||
|
this.file1 = file
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
if (this.beforeAvatarUpload(this.file1)) {
|
||||||
|
this.fileList.name = this.file1.name
|
||||||
|
this.fileList.url = ''
|
||||||
|
var formdata = new FormData()
|
||||||
|
formdata.append('file', this.file1.raw)
|
||||||
|
// excelImport:请求接口 formdata:传递参数
|
||||||
|
crudCustomerbase.excelImport(formdata).then((res) => {
|
||||||
|
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.$emit('tableChanged3', '')
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
}).catch(err => {
|
||||||
|
|
||||||
|
const list = err.response.data.message
|
||||||
|
download2('/api/produceWorkorder/download', list).then(result => {
|
||||||
|
downloadFile(result, '错误信息汇总', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
359
wms_pro/qd/src/views/wms/base_manage/customer/index.vue
Normal file
359
wms_pro/qd/src/views/wms/base_manage/customer/index.vue
Normal file
@@ -0,0 +1,359 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<el-input
|
||||||
|
v-model="query.search"
|
||||||
|
clearable
|
||||||
|
style="width: 300px"
|
||||||
|
size="mini"
|
||||||
|
placeholder="输入客户编码或客户名称"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
class="filter-item"
|
||||||
|
/>
|
||||||
|
<rrOperation />
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" >
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-upload2"
|
||||||
|
size="mini"
|
||||||
|
@click="uploadShow = true"
|
||||||
|
>
|
||||||
|
导入
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="1000px"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="客户编码" prop="cust_code">
|
||||||
|
<el-input v-model="form.cust_code" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="客户名称 " prop="cust_name">
|
||||||
|
<el-input v-model="form.cust_name" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="法人代表">
|
||||||
|
<el-input v-model="form.jurid_name" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="税务登记号">
|
||||||
|
<el-input v-model="form.tax_no" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="工商注册号">
|
||||||
|
<el-input v-model="form.register_no" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="经营许可证号">
|
||||||
|
<el-input v-model="form.manage_lice_no" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="营业执照">
|
||||||
|
<el-input v-model="form.busi_char_name" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="邮政编码">
|
||||||
|
<el-input v-model="form.zip_code" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="公司电话">
|
||||||
|
<el-input v-model="form.corp_tele_no" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="公司地址">
|
||||||
|
<el-input v-model="form.corp_address" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="外部标识">
|
||||||
|
<el-input v-model="form.ext_id" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否启用" prop="is_used">
|
||||||
|
<el-radio v-model="form.is_used" label="0">否</el-radio>
|
||||||
|
<el-radio v-model="form.is_used" label="1">是</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="基础分类" prop="class_id">
|
||||||
|
<treeselect
|
||||||
|
v-model="form.class_id"
|
||||||
|
:load-options="loadClass"
|
||||||
|
:options="classes"
|
||||||
|
style="width: 200px;"
|
||||||
|
placeholder="请选择"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form.remark" style="width: 600px;" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column prop="cust_code" label="客户编码" />
|
||||||
|
<el-table-column prop="cust_name" label="客户名称 " />
|
||||||
|
<el-table-column prop="corp_tele_no" label="公司电话" />
|
||||||
|
<el-table-column prop="corp_address" label="公司地址" />
|
||||||
|
<el-table-column prop="jurid_name" label="法人代表" />
|
||||||
|
<el-table-column prop="update_optname" label="修改者" />
|
||||||
|
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||||
|
<el-table-column label="启用" align="center" prop="is_used">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.is_used"
|
||||||
|
active-color="#409EFF"
|
||||||
|
inactive-color="#F56C6C"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
v-permission="['admin','customerbase:edit','customerbase:del']"
|
||||||
|
label="操作"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudCustomerbase from '@/api/wms/base_manage/customer/customer'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||||
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||||
|
import UploadDialog from '@/views/wms/base_manage/customer/UploadDialog'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
cust_id: null,
|
||||||
|
cust_code: null,
|
||||||
|
cust_name: null,
|
||||||
|
jurid_name: null,
|
||||||
|
tax_no: null,
|
||||||
|
register_no: null,
|
||||||
|
manage_lice_no: null,
|
||||||
|
busi_char_name: null,
|
||||||
|
area_id: null,
|
||||||
|
zip_code: null,
|
||||||
|
corp_tele_no: null,
|
||||||
|
corp_address: null,
|
||||||
|
create_id: null,
|
||||||
|
create_name: null,
|
||||||
|
create_time: null,
|
||||||
|
update_optid: null,
|
||||||
|
update_optname: null,
|
||||||
|
update_time: null,
|
||||||
|
is_used_time: null,
|
||||||
|
is_used: '1',
|
||||||
|
is_delete: null,
|
||||||
|
ext_id: null,
|
||||||
|
remark: null,
|
||||||
|
class_id: null
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'Customerbase',
|
||||||
|
dicts: ['is_used'],
|
||||||
|
components: {UploadDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect },
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '客户基础表',
|
||||||
|
url: 'api/customerbase',
|
||||||
|
optShow: {
|
||||||
|
add: true,
|
||||||
|
reset: true
|
||||||
|
},
|
||||||
|
idField: 'cust_id',
|
||||||
|
sort: 'cust_id,desc',
|
||||||
|
crudMethod: { ...crudCustomerbase }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
permission: {},
|
||||||
|
uploadShow: false,
|
||||||
|
classes: [],
|
||||||
|
rules: {
|
||||||
|
cust_id: [
|
||||||
|
{ required: true, message: '客户标识不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
cust_code: [
|
||||||
|
{ required: true, message: '客户编码不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
cust_name: [
|
||||||
|
{ required: true, message: '客户名称 不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
create_id: [
|
||||||
|
{ required: true, message: '创建人不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
create_name: [
|
||||||
|
{ required: true, message: '创建人不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
create_time: [
|
||||||
|
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
is_used: [
|
||||||
|
{ required: true, message: '是否启用不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
is_delete: [
|
||||||
|
{ required: true, message: '是否删除不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
class_id: [
|
||||||
|
{ required: true, message: '基础分类不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.afterToCU](crud, form) {
|
||||||
|
if (form.class_id != null) {
|
||||||
|
this.getSubTypes({'id':form.class_id,'parent_id':"1704039126057226240"})
|
||||||
|
} else {
|
||||||
|
this.getClass()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getSubTypes(id) {
|
||||||
|
crudClassstandard.getClassSuperior2(id).then(res => {
|
||||||
|
const date = res.content
|
||||||
|
this.buildClass(date)
|
||||||
|
this.classes = date
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildClass(classes) {
|
||||||
|
classes.forEach(data => {
|
||||||
|
if (data.children) {
|
||||||
|
this.buildClass(data.children)
|
||||||
|
}
|
||||||
|
if (data.hasChildren && !data.children) {
|
||||||
|
data.children = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getClass() {
|
||||||
|
//queryClassById?class_idStr=1528555443906023424
|
||||||
|
crudClassstandard.queryClassById({ enabled: true, 'class_idStr': '1704039126057226240' }).then(res => {
|
||||||
|
this.classes = res.content.map(function(obj) {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取弹窗内部门数据
|
||||||
|
loadClass({ action, parentNode, callback }) {
|
||||||
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
|
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||||
|
parentNode.children = res.content.map(function(obj) {
|
||||||
|
if (obj.hasChildren) {
|
||||||
|
obj.children = null
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
callback()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 改变状态
|
||||||
|
changeEnabled(data, val) {
|
||||||
|
this.$confirm('此操作将 "' + this.dict.label.is_used[val] + '" ' + data.cust_name + ', 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
crudCustomerbase.edit(data).then(res => {
|
||||||
|
this.crud.notify(this.dict.label.is_used[val] + '成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === '0') {
|
||||||
|
data.is_used = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === '1') {
|
||||||
|
data.is_used = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
if (data.is_used === '0') {
|
||||||
|
data.is_used = '1'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data.is_used === '1') {
|
||||||
|
data.is_used = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user