feat(customer): 新增客户管理功能并优化字典数据接口
This commit is contained in:
parent
01a7131f9f
commit
ff966f5a49
@ -0,0 +1,16 @@
|
|||||||
|
package jnpf.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import jnpf.entity.MaterialEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据 Mapper
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-09
|
||||||
|
*/
|
||||||
|
public interface MaterialMapper extends BaseMapper<MaterialEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package jnpf.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import jnpf.entity.TbaCustomerEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据 Mapper
|
||||||
|
*/
|
||||||
|
public interface TabCustomerMapper extends BaseMapper<TbaCustomerEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package jnpf.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jnpf.entity.MaterialEntity;
|
||||||
|
import jnpf.model.material.MaterialForm;
|
||||||
|
import jnpf.model.material.MaterialPagination;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据 Service
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-09
|
||||||
|
*/
|
||||||
|
public interface MaterialService extends IService<MaterialEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
List<MaterialEntity> getList(MaterialPagination materialPagination);
|
||||||
|
MaterialEntity getInfo(String id);
|
||||||
|
|
||||||
|
void delete(MaterialEntity entity);
|
||||||
|
|
||||||
|
void create(MaterialEntity entity);
|
||||||
|
|
||||||
|
boolean update(String id, MaterialEntity entity);
|
||||||
|
String checkForm(MaterialForm form, int i);
|
||||||
|
void saveOrUpdate(MaterialForm materialForm, String id, boolean isSave) throws Exception;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package jnpf.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jnpf.entity.TbaCustomerEntity;
|
||||||
|
import jnpf.model.customer.CustomerForm;
|
||||||
|
import jnpf.model.customer.CustomerPagination;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据 Service
|
||||||
|
*/
|
||||||
|
public interface TbaCustomerService extends IService<TbaCustomerEntity> {
|
||||||
|
|
||||||
|
List<TbaCustomerEntity> getList(CustomerPagination customerPagination);
|
||||||
|
TbaCustomerEntity getInfo(String id);
|
||||||
|
void delete(TbaCustomerEntity entity);
|
||||||
|
void create(TbaCustomerEntity entity);
|
||||||
|
boolean update(String id, TbaCustomerEntity entity);
|
||||||
|
String checkForm(CustomerForm form, int i);
|
||||||
|
void saveOrUpdate(CustomerForm customerForm, String id, boolean isSave) throws Exception;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,149 @@
|
|||||||
|
package jnpf.service.impl;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jnpf.base.UserInfo;
|
||||||
|
import jnpf.entity.MaterialEntity;
|
||||||
|
import jnpf.mapper.MaterialMapper;
|
||||||
|
import jnpf.model.material.MaterialForm;
|
||||||
|
import jnpf.model.material.MaterialPagination;
|
||||||
|
import jnpf.service.MaterialService;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import jnpf.util.UserProvider;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据 ServiceImpl
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-09
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEntity> implements MaterialService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserProvider userProvider;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaterialEntity> getList(MaterialPagination materialPagination) {
|
||||||
|
LambdaQueryWrapper<MaterialEntity> materialWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getMatCode())) {
|
||||||
|
materialWrapper.like(MaterialEntity::getMatCode, materialPagination.getMatCode());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getMatName())) {
|
||||||
|
materialWrapper.like(MaterialEntity::getMatName, materialPagination.getMatName());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getParentId())) {
|
||||||
|
materialWrapper.eq(MaterialEntity::getParentId, materialPagination.getParentId());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getMatType())) {
|
||||||
|
materialWrapper.eq(MaterialEntity::getMatType, materialPagination.getMatType());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getEnabledStatus())) {
|
||||||
|
materialWrapper.eq(MaterialEntity::getEnabledStatus, materialPagination.getEnabledStatus());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getBrand())) {
|
||||||
|
materialWrapper.like(MaterialEntity::getBrand, materialPagination.getBrand());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(materialPagination.getSpec())) {
|
||||||
|
materialWrapper.like(MaterialEntity::getSpec, materialPagination.getSpec());
|
||||||
|
}
|
||||||
|
materialWrapper.isNull(MaterialEntity::getDeleteMark);
|
||||||
|
materialWrapper.orderByDesc(MaterialEntity::getCreatorTime);
|
||||||
|
if ("0".equals(materialPagination.getDataType())) {
|
||||||
|
Page<MaterialEntity> page = new Page<>(materialPagination.getCurrentPage(), materialPagination.getPageSize());
|
||||||
|
IPage<MaterialEntity> userIPage = this.page(page, materialWrapper);
|
||||||
|
List<MaterialEntity> records = userIPage.getRecords();
|
||||||
|
return materialPagination.setData(records, userIPage.getTotal());
|
||||||
|
} else {
|
||||||
|
return this.list(materialWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialEntity getInfo(String id) {
|
||||||
|
QueryWrapper<MaterialEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(MaterialEntity::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(MaterialEntity entity) {
|
||||||
|
this.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(String id, MaterialEntity entity) {
|
||||||
|
return this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(MaterialEntity entity) {
|
||||||
|
if (entity != null) {
|
||||||
|
this.removeById(entity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证表单唯一字段,正则,非空 i-0新增-1修改
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String checkForm(MaterialForm form, int i) {
|
||||||
|
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||||
|
String id = "";
|
||||||
|
String countRecover = "";
|
||||||
|
if (isUp) {
|
||||||
|
id = form.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 物料编码唯一性验证
|
||||||
|
if (ObjectUtil.isNotEmpty(form.getMatCode())) {
|
||||||
|
LambdaQueryWrapper<MaterialEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MaterialEntity::getMatCode, form.getMatCode());
|
||||||
|
if (isUp) {
|
||||||
|
wrapper.ne(MaterialEntity::getId, id);
|
||||||
|
}
|
||||||
|
long count = this.count(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
countRecover += "物料编码已存在,请重新输入!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return countRecover;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增修改数据(事务回滚)
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param materialForm
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void saveOrUpdate(MaterialForm materialForm, String id, boolean isSave) throws Exception {
|
||||||
|
UserInfo userInfo = userProvider.get();
|
||||||
|
MaterialEntity entity = JsonUtil.getJsonToBean(materialForm, MaterialEntity.class);
|
||||||
|
|
||||||
|
if (!isSave) {
|
||||||
|
// 更新时设置ID
|
||||||
|
if (StringUtil.isNotEmpty(id)) {
|
||||||
|
entity.setId(Integer.valueOf(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 新增时ID由数据库自动生成,不需要设置
|
||||||
|
this.saveOrUpdate(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
package jnpf.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jnpf.base.UserInfo;
|
||||||
|
import jnpf.entity.TbaCustomerEntity;
|
||||||
|
import jnpf.mapper.TabCustomerMapper;
|
||||||
|
import jnpf.model.customer.CustomerForm;
|
||||||
|
import jnpf.model.customer.CustomerPagination;
|
||||||
|
import jnpf.service.TbaCustomerService;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import jnpf.util.UserProvider;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据 ServiceImpl
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TbaCustomerServiceImpl extends ServiceImpl<TabCustomerMapper, TbaCustomerEntity> implements TbaCustomerService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserProvider userProvider;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TbaCustomerEntity> getList(CustomerPagination customerPagination) {
|
||||||
|
LambdaQueryWrapper<TbaCustomerEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getCustNo())) {
|
||||||
|
wrapper.like(TbaCustomerEntity::getCustNo, customerPagination.getCustNo());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getCustName())) {
|
||||||
|
wrapper.like(TbaCustomerEntity::getCustName, customerPagination.getCustName());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getCustSimName())) {
|
||||||
|
wrapper.like(TbaCustomerEntity::getCustSimName, customerPagination.getCustSimName());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getIndustryClass())) {
|
||||||
|
wrapper.eq(TbaCustomerEntity::getIndustryClass, customerPagination.getIndustryClass());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getCoopStatus())) {
|
||||||
|
wrapper.eq(TbaCustomerEntity::getCoopStatus, customerPagination.getCoopStatus());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getEnterpriseType())) {
|
||||||
|
wrapper.eq(TbaCustomerEntity::getEnterpriseType, customerPagination.getEnterpriseType());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getCustReg())) {
|
||||||
|
wrapper.eq(TbaCustomerEntity::getCustReg, customerPagination.getCustReg());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(customerPagination.getEnabledStatus())) {
|
||||||
|
wrapper.eq(TbaCustomerEntity::getEnabledStatus, customerPagination.getEnabledStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.isNull(TbaCustomerEntity::getDeleteMark);
|
||||||
|
wrapper.orderByDesc(TbaCustomerEntity::getCreatorTime);
|
||||||
|
|
||||||
|
if ("0".equals(customerPagination.getDataType())) {
|
||||||
|
Page<TbaCustomerEntity> page = new Page<>(customerPagination.getCurrentPage(), customerPagination.getPageSize());
|
||||||
|
IPage<TbaCustomerEntity> result = this.page(page, wrapper);
|
||||||
|
return customerPagination.setData(result.getRecords(), result.getTotal());
|
||||||
|
} else {
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TbaCustomerEntity getInfo(String id) {
|
||||||
|
QueryWrapper<TbaCustomerEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(TbaCustomerEntity::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(TbaCustomerEntity entity) {
|
||||||
|
this.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(String id, TbaCustomerEntity entity) {
|
||||||
|
return this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(TbaCustomerEntity entity) {
|
||||||
|
if (entity != null) {
|
||||||
|
this.removeById(entity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkForm(CustomerForm form, int i) {
|
||||||
|
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||||
|
String id = "";
|
||||||
|
String countRecover = "";
|
||||||
|
if (isUp) {
|
||||||
|
id = form.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(form.getCustNo())) {
|
||||||
|
LambdaQueryWrapper<TbaCustomerEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(TbaCustomerEntity::getCustNo, form.getCustNo());
|
||||||
|
if (isUp) {
|
||||||
|
wrapper.ne(TbaCustomerEntity::getId, Integer.valueOf(id));
|
||||||
|
}
|
||||||
|
long count = this.count(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
countRecover += "客户编码已存在,请重新输入!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return countRecover;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void saveOrUpdate(CustomerForm customerForm, String id, boolean isSave) throws Exception {
|
||||||
|
UserInfo userInfo = userProvider.get();
|
||||||
|
TbaCustomerEntity entity = JsonUtil.getJsonToBean(customerForm, TbaCustomerEntity.class);
|
||||||
|
|
||||||
|
if (!isSave) {
|
||||||
|
if (StringUtil.isNotEmpty(id)) {
|
||||||
|
entity.setId(Integer.valueOf(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.saveOrUpdate(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,165 @@
|
|||||||
|
package jnpf.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jnpf.base.ActionResult;
|
||||||
|
import jnpf.base.vo.PageListVO;
|
||||||
|
import jnpf.base.vo.PaginationVO;
|
||||||
|
import jnpf.entity.MaterialEntity;
|
||||||
|
import jnpf.model.material.MaterialForm;
|
||||||
|
import jnpf.model.material.MaterialPagination;
|
||||||
|
import jnpf.service.MaterialService;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据 控制类
|
||||||
|
*/
|
||||||
|
@Tag(name = "物料主数据", description = "Material")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/example/material")
|
||||||
|
public class MaterialController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MaterialService materialService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param materialPagination 分页查询对象
|
||||||
|
* @return 列表结果集
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取物料列表")
|
||||||
|
@PostMapping("/getList")
|
||||||
|
public ActionResult getList(@RequestBody MaterialPagination materialPagination) {
|
||||||
|
List<MaterialEntity> list = materialService.getList(materialPagination);
|
||||||
|
List<Map<String, Object>> realList = list.stream()
|
||||||
|
.map(JsonUtil::entityToMap)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
//返回对象
|
||||||
|
PageListVO vo = new PageListVO();
|
||||||
|
vo.setList(realList);
|
||||||
|
PaginationVO page = JsonUtil.getJsonToBean(materialPagination, PaginationVO.class);
|
||||||
|
vo.setPagination(page);
|
||||||
|
return ActionResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
* @param id 主键
|
||||||
|
* @return 详情结果集
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取物料详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ActionResult info(@PathVariable("id") String id) {
|
||||||
|
MaterialEntity entity = materialService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
return ActionResult.success(JsonUtil.entityToMap(entity));
|
||||||
|
}
|
||||||
|
return ActionResult.fail("数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
* @param materialForm 表单对象
|
||||||
|
* @return 新建结果
|
||||||
|
*/
|
||||||
|
@Operation(summary = "新建物料")
|
||||||
|
@PostMapping
|
||||||
|
public ActionResult create(@RequestBody @Valid MaterialForm materialForm) {
|
||||||
|
String b = materialService.checkForm(materialForm, 0);
|
||||||
|
if (StringUtil.isNotEmpty(b)) {
|
||||||
|
return ActionResult.fail(b);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
materialService.saveOrUpdate(materialForm, "", true);
|
||||||
|
return ActionResult.success("新建成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("新建数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param id 主键
|
||||||
|
* @param materialForm 表单对象
|
||||||
|
* @return 编辑结果
|
||||||
|
*/
|
||||||
|
@Operation(summary = "更新物料")
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid MaterialForm materialForm) {
|
||||||
|
materialForm.setId(id);
|
||||||
|
String b = materialService.checkForm(materialForm, 1);
|
||||||
|
if (StringUtil.isNotEmpty(b)) {
|
||||||
|
return ActionResult.fail(b);
|
||||||
|
}
|
||||||
|
MaterialEntity entity = materialService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
try {
|
||||||
|
materialService.saveOrUpdate(materialForm, id, false);
|
||||||
|
return ActionResult.success("更新成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("更新数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ActionResult.fail("更新失败,数据不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param id 主键
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@Operation(summary = "删除物料")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ActionResult delete(@PathVariable("id") String id) {
|
||||||
|
MaterialEntity entity = materialService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
try {
|
||||||
|
materialService.delete(entity);
|
||||||
|
return ActionResult.success("删除成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("删除失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ActionResult.fail("删除失败,数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取物料类型字典
|
||||||
|
* @return 物料类型列表
|
||||||
|
*/
|
||||||
|
@Operation(summary = "获取物料类型字典")
|
||||||
|
@GetMapping("/getMatTypeDict")
|
||||||
|
public ActionResult getMatTypeDict() {
|
||||||
|
List<Map<String, Object>> dictList = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<String, Object> type1 = new HashMap<>();
|
||||||
|
type1.put("id", "1");
|
||||||
|
type1.put("name", "原材料");
|
||||||
|
dictList.add(type1);
|
||||||
|
|
||||||
|
Map<String, Object> type2 = new HashMap<>();
|
||||||
|
type2.put("id", "2");
|
||||||
|
type2.put("name", "半成品");
|
||||||
|
dictList.add(type2);
|
||||||
|
|
||||||
|
Map<String, Object> type3 = new HashMap<>();
|
||||||
|
type3.put("id", "3");
|
||||||
|
type3.put("name", "成品");
|
||||||
|
dictList.add(type3);
|
||||||
|
|
||||||
|
return ActionResult.success(dictList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
package jnpf.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jnpf.base.ActionResult;
|
||||||
|
import jnpf.base.vo.PageListVO;
|
||||||
|
import jnpf.base.vo.PaginationVO;
|
||||||
|
import jnpf.entity.TbaCustomerEntity;
|
||||||
|
import jnpf.model.customer.CustomerForm;
|
||||||
|
import jnpf.model.customer.CustomerPagination;
|
||||||
|
import jnpf.service.TbaCustomerService;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据 控制类
|
||||||
|
*/
|
||||||
|
@Tag(name = "客户主数据", description = "Customer1")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/example/tbaCustomer")
|
||||||
|
public class TbaCustomerController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbaCustomerService tbaCustomerService;
|
||||||
|
|
||||||
|
@Operation(summary = "获取客户列表")
|
||||||
|
@PostMapping("/getList")
|
||||||
|
public ActionResult getList(@RequestBody CustomerPagination customerPagination) {
|
||||||
|
List<TbaCustomerEntity> list = tbaCustomerService.getList(customerPagination);
|
||||||
|
List<Map<String, Object>> realList = list.stream()
|
||||||
|
.map(JsonUtil::entityToMap)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
PageListVO vo = new PageListVO();
|
||||||
|
vo.setList(realList);
|
||||||
|
PaginationVO page = JsonUtil.getJsonToBean(customerPagination, PaginationVO.class);
|
||||||
|
vo.setPagination(page);
|
||||||
|
return ActionResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取客户详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ActionResult info(@PathVariable("id") String id) {
|
||||||
|
TbaCustomerEntity entity = tbaCustomerService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
return ActionResult.success(JsonUtil.entityToMap(entity));
|
||||||
|
}
|
||||||
|
return ActionResult.fail("数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新建客户")
|
||||||
|
@PostMapping
|
||||||
|
public ActionResult create(@RequestBody @Valid CustomerForm customerForm) {
|
||||||
|
String b = tbaCustomerService.checkForm(customerForm, 0);
|
||||||
|
if (StringUtil.isNotEmpty(b)) {
|
||||||
|
return ActionResult.fail(b);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
tbaCustomerService.saveOrUpdate(customerForm, "", true);
|
||||||
|
return ActionResult.success("新建成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("新建数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新客户")
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid CustomerForm customerForm) {
|
||||||
|
customerForm.setId(id);
|
||||||
|
String b = tbaCustomerService.checkForm(customerForm, 1);
|
||||||
|
if (StringUtil.isNotEmpty(b)) {
|
||||||
|
return ActionResult.fail(b);
|
||||||
|
}
|
||||||
|
TbaCustomerEntity entity = tbaCustomerService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
try {
|
||||||
|
tbaCustomerService.saveOrUpdate(customerForm, id, false);
|
||||||
|
return ActionResult.success("更新成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("更新数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ActionResult.fail("更新失败,数据不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除客户")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ActionResult delete(@PathVariable("id") String id) {
|
||||||
|
TbaCustomerEntity entity = tbaCustomerService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
try {
|
||||||
|
tbaCustomerService.delete(entity);
|
||||||
|
return ActionResult.success("删除成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("删除失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ActionResult.fail("删除失败,数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package jnpf.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("tba_material")
|
||||||
|
public class MaterialEntity {
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_id")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_task_id")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@TableField("mat_code")
|
||||||
|
private String matCode;
|
||||||
|
|
||||||
|
@TableField("mat_name")
|
||||||
|
private String matName;
|
||||||
|
|
||||||
|
@TableField(value = "parent_id", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@TableField("mat_type")
|
||||||
|
private String matType;
|
||||||
|
|
||||||
|
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@TableField("unit")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@TableField("brand")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@TableField("spec")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@TableField(value = "safe_stock", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private BigDecimal safeStock;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String parentName;
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
package jnpf.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("tba_customer")
|
||||||
|
public class TbaCustomerEntity {
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField("cust_no")
|
||||||
|
private String custNo;
|
||||||
|
|
||||||
|
@TableField("cust_name")
|
||||||
|
private String custName;
|
||||||
|
|
||||||
|
@TableField("cust_sim_name")
|
||||||
|
private String custSimName;
|
||||||
|
|
||||||
|
@TableField("industry_class")
|
||||||
|
private String industryClass;
|
||||||
|
|
||||||
|
@TableField("coop_status")
|
||||||
|
private String coopStatus;
|
||||||
|
|
||||||
|
@TableField("enterprise_type")
|
||||||
|
private String enterpriseType;
|
||||||
|
|
||||||
|
@TableField("cust_reg")
|
||||||
|
private String custReg;
|
||||||
|
|
||||||
|
@TableField("credit_rate")
|
||||||
|
private String creditRate;
|
||||||
|
|
||||||
|
@TableField("contact1")
|
||||||
|
private String contact1;
|
||||||
|
|
||||||
|
@TableField("con_phone1")
|
||||||
|
private String conPhone1;
|
||||||
|
|
||||||
|
@TableField("con_address1")
|
||||||
|
private String conAddress1;
|
||||||
|
|
||||||
|
@TableField("contact2")
|
||||||
|
private String contact2;
|
||||||
|
|
||||||
|
@TableField("con_phone2")
|
||||||
|
private String conPhone2;
|
||||||
|
|
||||||
|
@TableField("con_address2")
|
||||||
|
private String conAddress2;
|
||||||
|
|
||||||
|
@TableField("com_tax_number")
|
||||||
|
private String comTaxNumber;
|
||||||
|
|
||||||
|
@TableField("account_region")
|
||||||
|
private String accountRegion;
|
||||||
|
|
||||||
|
@TableField("account_bank")
|
||||||
|
private String accountBank;
|
||||||
|
|
||||||
|
@TableField("account_no")
|
||||||
|
private String accountNo;
|
||||||
|
|
||||||
|
@TableField("pay_meth")
|
||||||
|
private String payMeth;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_id")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_task_id")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@TableField("enabled_status")
|
||||||
|
private String enabledStatus;
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package jnpf.model.customer;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据 Form
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerForm {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "客户编码")
|
||||||
|
private String custNo;
|
||||||
|
|
||||||
|
@Schema(description = "客户全称")
|
||||||
|
private String custName;
|
||||||
|
|
||||||
|
@Schema(description = "客户简称")
|
||||||
|
private String custSimName;
|
||||||
|
|
||||||
|
@Schema(description = "所属行业(1钢铁 2 电力 3 化工)")
|
||||||
|
private String industryClass;
|
||||||
|
|
||||||
|
@Schema(description = "合作状态(1 潜在 2意向 3正式 4暂停 5终止)")
|
||||||
|
private String coopStatus;
|
||||||
|
|
||||||
|
@Schema(description = "企业性质 (1 国有企业 2 民营企业 3 外资企业)")
|
||||||
|
private String enterpriseType;
|
||||||
|
|
||||||
|
@Schema(description = "客户等级(1 核心 2重点 3一般)")
|
||||||
|
private String custReg;
|
||||||
|
|
||||||
|
@Schema(description = "信用等级(1优 2良 3中 4差)")
|
||||||
|
private String creditRate;
|
||||||
|
|
||||||
|
@Schema(description = "联系人1")
|
||||||
|
private String contact1;
|
||||||
|
|
||||||
|
@Schema(description = "联系电话1")
|
||||||
|
private String conPhone1;
|
||||||
|
|
||||||
|
@Schema(description = "联系地址1")
|
||||||
|
private String conAddress1;
|
||||||
|
|
||||||
|
@Schema(description = "联系人2")
|
||||||
|
private String contact2;
|
||||||
|
|
||||||
|
@Schema(description = "联系电话2")
|
||||||
|
private String conPhone2;
|
||||||
|
|
||||||
|
@Schema(description = "联系地址2")
|
||||||
|
private String conAddress2;
|
||||||
|
|
||||||
|
@Schema(description = "公司税号")
|
||||||
|
private String comTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "开户地区")
|
||||||
|
private String accountRegion;
|
||||||
|
|
||||||
|
@Schema(description = "开户银行")
|
||||||
|
private String accountBank;
|
||||||
|
|
||||||
|
@Schema(description = "开户账号")
|
||||||
|
private String accountNo;
|
||||||
|
|
||||||
|
@Schema(description = "付款方式(1 预付 2 月付 3承兑)")
|
||||||
|
private String payMeth;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "启用状态(1:启用2:未启用)")
|
||||||
|
private String enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建用户ID")
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@Schema(description = "最后修改时间")
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@Schema(description = "最后修改用户ID")
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@Schema(description = "删除时间")
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@Schema(description = "删除用户ID")
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@Schema(description = "删除标记")
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@Schema(description = "流程ID")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@Schema(description = "流程任务ID")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
package jnpf.model.customer;
|
||||||
|
|
||||||
|
import jnpf.base.Pagination;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户主数据分页查询
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerPagination extends Pagination {
|
||||||
|
private String[] selectKey;
|
||||||
|
private String json;
|
||||||
|
private String dataType;
|
||||||
|
private String superQueryJson;
|
||||||
|
private String moduleId;
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
@Schema(description = "客户编码")
|
||||||
|
private String custNo;
|
||||||
|
|
||||||
|
@Schema(description = "客户全称")
|
||||||
|
private String custName;
|
||||||
|
|
||||||
|
@Schema(description = "客户简称")
|
||||||
|
private String custSimName;
|
||||||
|
|
||||||
|
@Schema(description = "所属行业")
|
||||||
|
private String industryClass;
|
||||||
|
|
||||||
|
@Schema(description = "合作状态")
|
||||||
|
private String coopStatus;
|
||||||
|
|
||||||
|
@Schema(description = "企业性质")
|
||||||
|
private String enterpriseType;
|
||||||
|
|
||||||
|
@Schema(description = "客户等级")
|
||||||
|
private String custReg;
|
||||||
|
|
||||||
|
@Schema(description = "启用状态")
|
||||||
|
private String enabledStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package jnpf.model.material;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据 Form
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MaterialForm {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String matCode;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称")
|
||||||
|
private String matName;
|
||||||
|
|
||||||
|
@Schema(description = "父分类id")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Schema(description = "物料类型(1 原材料 2 半成品 3 成品 )")
|
||||||
|
private String matType;
|
||||||
|
|
||||||
|
@Schema(description = "状态(1启用 2 未启用)")
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "品牌")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@Schema(description = "规格型号")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "安全库存")
|
||||||
|
private BigDecimal safeStock;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建用户ID")
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@Schema(description = "最后修改时间")
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@Schema(description = "最后修改用户ID")
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@Schema(description = "删除时间")
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@Schema(description = "删除用户ID")
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@Schema(description = "删除标记")
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@Schema(description = "流程ID")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@Schema(description = "流程任务ID")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package jnpf.model.material;
|
||||||
|
|
||||||
|
import jnpf.base.Pagination;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料主数据分页查询
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MaterialPagination extends Pagination {
|
||||||
|
/** 查询key */
|
||||||
|
private String[] selectKey;
|
||||||
|
/** json */
|
||||||
|
private String json;
|
||||||
|
/** 数据类型 0-当前页,1-全部数据 */
|
||||||
|
private String dataType;
|
||||||
|
/** 高级查询 */
|
||||||
|
private String superQueryJson;
|
||||||
|
/** 功能id */
|
||||||
|
private String moduleId;
|
||||||
|
/** 菜单id */
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String matCode;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称")
|
||||||
|
private String matName;
|
||||||
|
|
||||||
|
@Schema(description = "父分类id")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Schema(description = "物料类型(1 原材料 2 半成品 3 成品 )")
|
||||||
|
private String matType;
|
||||||
|
|
||||||
|
@Schema(description = "状态(1启用 2 未启用)")
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "品牌")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@Schema(description = "规格型号")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,10 +1,9 @@
|
|||||||
package jnpf.controller;
|
package jnpf.controller;
|
||||||
|
|
||||||
import jnpf.base.controller.SuperController;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jnpf.base.ActionResult;
|
import jnpf.base.ActionResult;
|
||||||
import jnpf.base.Pagination;
|
import jnpf.base.Pagination;
|
||||||
import jnpf.base.controller.SuperController;
|
import jnpf.base.controller.SuperController;
|
||||||
@ -17,10 +16,8 @@ import jnpf.model.customer.CustomerListVO;
|
|||||||
import jnpf.model.customer.CustomerUpForm;
|
import jnpf.model.customer.CustomerUpForm;
|
||||||
import jnpf.service.CustomerService;
|
import jnpf.service.CustomerService;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import jnpf.util.RandomUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
package jnpf.base.service.impl;
|
package jnpf.base.service.impl;
|
||||||
|
|
||||||
import jnpf.base.service.SuperServiceImpl;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import jnpf.base.entity.DictionaryDataEntity;
|
import jnpf.base.entity.DictionaryDataEntity;
|
||||||
import jnpf.base.entity.DictionaryTypeEntity;
|
import jnpf.base.entity.DictionaryTypeEntity;
|
||||||
import jnpf.base.mapper.DictionaryDataMapper;
|
import jnpf.base.mapper.DictionaryDataMapper;
|
||||||
@ -10,15 +9,14 @@ import jnpf.base.model.dictionarydata.DictionaryDataExportModel;
|
|||||||
import jnpf.base.model.dictionarytype.DictionaryExportModel;
|
import jnpf.base.model.dictionarytype.DictionaryExportModel;
|
||||||
import jnpf.base.service.DictionaryDataService;
|
import jnpf.base.service.DictionaryDataService;
|
||||||
import jnpf.base.service.DictionaryTypeService;
|
import jnpf.base.service.DictionaryTypeService;
|
||||||
|
import jnpf.base.service.SuperServiceImpl;
|
||||||
import jnpf.base.vo.DownloadVO;
|
import jnpf.base.vo.DownloadVO;
|
||||||
import jnpf.config.ConfigValueUtil;
|
import jnpf.config.ConfigValueUtil;
|
||||||
|
import jnpf.emnus.ModuleTypeEnum;
|
||||||
import jnpf.exception.DataException;
|
import jnpf.exception.DataException;
|
||||||
import jnpf.util.*;
|
import jnpf.util.*;
|
||||||
import jnpf.emnus.ModuleTypeEnum;
|
|
||||||
import jnpf.util.FileExport;
|
|
||||||
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 com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@ -1,30 +1,29 @@
|
|||||||
package jnpf.base.controller;
|
package jnpf.base.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import jnpf.base.controller.SuperController;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import jnpf.base.ActionResult;
|
import jnpf.base.ActionResult;
|
||||||
|
import jnpf.base.entity.DictionaryDataEntity;
|
||||||
|
import jnpf.base.entity.DictionaryTypeEntity;
|
||||||
|
import jnpf.base.model.dictionarydata.*;
|
||||||
import jnpf.base.model.dictionarytype.DictionaryExportModel;
|
import jnpf.base.model.dictionarytype.DictionaryExportModel;
|
||||||
|
import jnpf.base.model.dictionarytype.DictionaryTypeSelectModel;
|
||||||
|
import jnpf.base.model.dictionarytype.DictionaryTypeSelectVO;
|
||||||
import jnpf.base.service.DictionaryDataService;
|
import jnpf.base.service.DictionaryDataService;
|
||||||
import jnpf.base.service.DictionaryTypeService;
|
import jnpf.base.service.DictionaryTypeService;
|
||||||
import jnpf.base.vo.DownloadVO;
|
import jnpf.base.vo.DownloadVO;
|
||||||
import jnpf.base.vo.ListVO;
|
import jnpf.base.vo.ListVO;
|
||||||
import jnpf.base.entity.DictionaryDataEntity;
|
|
||||||
import jnpf.base.entity.DictionaryTypeEntity;
|
|
||||||
import jnpf.config.ConfigValueUtil;
|
import jnpf.config.ConfigValueUtil;
|
||||||
import jnpf.constant.MsgCode;
|
import jnpf.constant.MsgCode;
|
||||||
|
import jnpf.emnus.ModuleTypeEnum;
|
||||||
import jnpf.exception.DataException;
|
import jnpf.exception.DataException;
|
||||||
import jnpf.base.model.dictionarydata.*;
|
|
||||||
import jnpf.base.model.dictionarytype.DictionaryTypeSelectModel;
|
|
||||||
import jnpf.base.model.dictionarytype.DictionaryTypeSelectVO;
|
|
||||||
import jnpf.util.FileUtil;
|
import jnpf.util.FileUtil;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import jnpf.util.JsonUtilEx;
|
import jnpf.util.JsonUtilEx;
|
||||||
import jnpf.util.StringUtil;
|
import jnpf.util.StringUtil;
|
||||||
import jnpf.emnus.ModuleTypeEnum;
|
|
||||||
import jnpf.util.treeutil.ListToTreeUtil;
|
import jnpf.util.treeutil.ListToTreeUtil;
|
||||||
import jnpf.util.treeutil.SumTree;
|
import jnpf.util.treeutil.SumTree;
|
||||||
import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
|
import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
|
||||||
@ -34,7 +33,10 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -220,6 +222,30 @@ public class DictionaryDataController extends SuperController<DictionaryDataServ
|
|||||||
return ActionResult.success(vo);
|
return ActionResult.success(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取某个字典数据下拉框列表")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "enCode", description = "数据分类id", required = true)
|
||||||
|
})
|
||||||
|
@GetMapping("/{enCode}/Data/SelectorByEnCode")
|
||||||
|
public ActionResult<ListVO<DictionaryTypeSelectVO>> selectorOneTreeViewByEnCode(@PathVariable("enCode") String enCode) {
|
||||||
|
|
||||||
|
DictionaryTypeEntity typeEntity = dictionaryTypeService.getInfoByEnCode(enCode);
|
||||||
|
if (typeEntity == null) {
|
||||||
|
return ActionResult.success(new ListVO<>());
|
||||||
|
}
|
||||||
|
List<DictionaryDataEntity> data = dictionaryDataService.getList(typeEntity.getId(), true);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
data = dictionaryDataService.getList(typeEntity.getId(), true);
|
||||||
|
}
|
||||||
|
List<DictionaryTypeSelectModel> voListVO = JsonUtil.getJsonToList(data, DictionaryTypeSelectModel.class);
|
||||||
|
List<SumTree<DictionaryTypeSelectModel>> sumTrees = TreeDotUtils.convertListToTreeDot(voListVO);
|
||||||
|
List<DictionaryTypeSelectVO> list = JsonUtil.getJsonToList(sumTrees, DictionaryTypeSelectVO.class);
|
||||||
|
ListVO<DictionaryTypeSelectVO> vo = new ListVO<>();
|
||||||
|
vo.setList(list);
|
||||||
|
return ActionResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据字典信息
|
* 获取数据字典信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -84,6 +84,14 @@ export function getDictionaryDataSelector(dictionaryTypeId) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取字典数据下拉框列表
|
||||||
|
export function getDictionaryDataSelectorByEnCode(enCode) {
|
||||||
|
return request({
|
||||||
|
url: `/api/system/DictionaryData/${enCode}/Data/SelectorByEnCode`,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 添加数据字典
|
// 添加数据字典
|
||||||
export function createDictionaryData(data) {
|
export function createDictionaryData(data) {
|
||||||
return request({
|
return request({
|
||||||
@ -133,3 +141,19 @@ export function exportData(id) {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cache = new Map();
|
||||||
|
|
||||||
|
export async function getDict(enCode) {
|
||||||
|
if (!cache.has(enCode)) {
|
||||||
|
const res = await getDictionaryDataSelectorByEnCode(enCode);
|
||||||
|
cache.set(enCode, res.data.list || []);
|
||||||
|
}
|
||||||
|
return cache.get(enCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLabel(options, value) {
|
||||||
|
const item = options?.find(i => i.id === value);
|
||||||
|
return item ? item.fullName : (value || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
243
jnpf-java-boot/jnpf-web/src/views/example/customer/detail.vue
Normal file
243
jnpf-java-boot/jnpf-web/src/views/example/customer/detail.vue
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
<template>
|
||||||
|
<transition name="el-zoom-in-center">
|
||||||
|
<div class="JNPF-preview-main">
|
||||||
|
<div class="JNPF-common-page-header">
|
||||||
|
<el-page-header @back="goBack" content="详情"/>
|
||||||
|
<!-- <div class="options">-->
|
||||||
|
<!-- <el-button @click="goBack">关 闭</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '1200px' }">
|
||||||
|
<el-form ref="formRef" :model="dataForm" size="small" label-width="120px" label-position="right" disabled>
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-divider content-position="left">基础信息</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户编码" prop="custNo">
|
||||||
|
<JnpfInput v-model="dataForm.custNo"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户简称" prop="custSimName">
|
||||||
|
<JnpfInput v-model="dataForm.custSimName"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户全称" prop="custName">
|
||||||
|
<JnpfInput v-model="dataForm.custName"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="所属行业" prop="industryClass">
|
||||||
|
<JnpfInput :value="getIndustryClassName(dataForm.industryClass)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="合作状态" prop="coopStatus">
|
||||||
|
<JnpfInput :value="getCoopStatusName(dataForm.coopStatus)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="企业性质" prop="enterpriseType">
|
||||||
|
<JnpfInput :value="getEnterpriseTypeName(dataForm.enterpriseType)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户等级" prop="custReg">
|
||||||
|
<JnpfInput :value="getCustRegName(dataForm.custReg)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="信用等级" prop="creditRate">
|
||||||
|
<JnpfInput :value="getCreditRateName(dataForm.creditRate)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="启用状态" prop="enabledStatus">
|
||||||
|
<JnpfInput :value="dataForm.enabledStatus == '1' ? '启用' : '未启用'"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="24">
|
||||||
|
<jnpf-form-tip-item label="备注" prop="remark">
|
||||||
|
<JnpfTextarea v-model="dataForm.remark" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea"></JnpfTextarea>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">联系方式</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系人1" prop="contact1">
|
||||||
|
<JnpfInput v-model="dataForm.contact1"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系电话1" prop="conPhone1">
|
||||||
|
<JnpfInput v-model="dataForm.conPhone1"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系地址1" prop="conAddress1">
|
||||||
|
<JnpfInput v-model="dataForm.conAddress1"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系人2" prop="contact2">
|
||||||
|
<JnpfInput v-model="dataForm.contact2"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系电话2" prop="conPhone2">
|
||||||
|
<JnpfInput v-model="dataForm.conPhone2"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系地址2" prop="conAddress2">
|
||||||
|
<JnpfInput v-model="dataForm.conAddress2"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">开票信息</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="公司税号" prop="comTaxNumber">
|
||||||
|
<JnpfInput v-model="dataForm.comTaxNumber"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户地区" prop="accountRegion">
|
||||||
|
<JnpfInput v-model="dataForm.accountRegion"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户银行" prop="accountBank">
|
||||||
|
<JnpfInput v-model="dataForm.accountBank"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户账号" prop="accountNo">
|
||||||
|
<JnpfInput v-model="dataForm.accountNo"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="付款方式" prop="payMeth">
|
||||||
|
<JnpfInput :value="getPayMethName(dataForm.payMeth)"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
<el-row :gutter="15" style="text-align: right; padding-top: 20px; padding-bottom: 20px;">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-button @click="goBack">取 消 </el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
custNo: undefined,
|
||||||
|
custName: undefined,
|
||||||
|
custSimName: undefined,
|
||||||
|
industryClass: undefined,
|
||||||
|
coopStatus: undefined,
|
||||||
|
enterpriseType: undefined,
|
||||||
|
custReg: undefined,
|
||||||
|
creditRate: undefined,
|
||||||
|
contact1: undefined,
|
||||||
|
conPhone1: undefined,
|
||||||
|
conAddress1: undefined,
|
||||||
|
contact2: undefined,
|
||||||
|
conPhone2: undefined,
|
||||||
|
conAddress2: undefined,
|
||||||
|
comTaxNumber: undefined,
|
||||||
|
accountRegion: undefined,
|
||||||
|
accountBank: undefined,
|
||||||
|
accountNo: undefined,
|
||||||
|
payMeth: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
},
|
||||||
|
industryClassOptions: [],
|
||||||
|
coopStatusOptions: [],
|
||||||
|
enterpriseTypeOptions: [],
|
||||||
|
custRegOptions: [],
|
||||||
|
creditRateOptions: [],
|
||||||
|
payMethOptions: [],
|
||||||
|
enabledStatusOptions: [],
|
||||||
|
dictProps: {label: "fullName", value: "enCode"},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getIndustryClassName(val) {
|
||||||
|
|
||||||
|
const map = {'1': '钢铁', '2': '电力', '3': '化工'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getCoopStatusName(val) {
|
||||||
|
const map = {'1': '潜在', '2': '意向', '3': '正式', '4': '暂停', '5': '终止'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getEnterpriseTypeName(val) {
|
||||||
|
const map = {'1': '国有企业', '2': '民营企业', '3': '外资企业'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getCustRegName(val) {
|
||||||
|
const map = {'1': '核心', '2': '重点', '3': '一般'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getCreditRateName(val) {
|
||||||
|
const map = {'1': '优', '2': '良', '3': '中', '4': '差'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getPayMethName(val) {
|
||||||
|
const map = {'1': '预付', '2': '月付', '3': '承兑'};
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || '';
|
||||||
|
this.loading = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.formRef.resetFields();
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: `/api/example/tbaCustomer/${this.dataForm.id}`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataForm = res.data.data || res.data
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
270
jnpf-java-boot/jnpf-web/src/views/example/customer/form.vue
Normal file
270
jnpf-java-boot/jnpf-web/src/views/example/customer/form.vue
Normal file
@ -0,0 +1,270 @@
|
|||||||
|
<template>
|
||||||
|
<transition name="el-zoom-in-center">
|
||||||
|
<div class="JNPF-preview-main">
|
||||||
|
<div class="JNPF-common-page-header">
|
||||||
|
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'"/>
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '1200px' }">
|
||||||
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px" label-position="right">
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-divider content-position="left">基础信息</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户编码" prop="custNo">
|
||||||
|
<JnpfInput v-model="dataForm.custNo" placeholder="请输入客户编码" clearable :disabled="!!dataForm.id"></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户简称" prop="custSimName">
|
||||||
|
<JnpfInput v-model="dataForm.custSimName" placeholder="请输入客户简称" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户全称" prop="custName">
|
||||||
|
<JnpfInput v-model="dataForm.custName" placeholder="请输入客户全称" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="所属行业" prop="industryClass">
|
||||||
|
<JnpfSelect v-model="dataForm.industryClass" placeholder="请选择" :options="industryClassOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="合作状态" prop="coopStatus">
|
||||||
|
<JnpfSelect v-model="dataForm.coopStatus" placeholder="请选择" :options="coopStatusOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="企业性质" prop="enterpriseType">
|
||||||
|
<JnpfSelect v-model="dataForm.enterpriseType" placeholder="请选择" :options="enterpriseTypeOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="客户等级" prop="custReg">
|
||||||
|
<JnpfSelect v-model="dataForm.custReg" placeholder="请选择" :options="custRegOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="信用等级" prop="creditRate">
|
||||||
|
<JnpfSelect v-model="dataForm.creditRate" placeholder="请选择" :options="creditRateOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="启用状态" prop="enabledStatus">
|
||||||
|
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择" :options="enabledStatusOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="24">
|
||||||
|
<jnpf-form-tip-item label="备注" prop="remark">
|
||||||
|
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea"></JnpfTextarea>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">联系方式</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系人1" prop="contact1">
|
||||||
|
<JnpfInput v-model="dataForm.contact1" placeholder="请输入联系人" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系电话1" prop="conPhone1">
|
||||||
|
<JnpfInput v-model="dataForm.conPhone1" placeholder="请输入联系电话" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系地址1" prop="conAddress1">
|
||||||
|
<JnpfInput v-model="dataForm.conAddress1" placeholder="请输入联系地址" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系人2" prop="contact2">
|
||||||
|
<JnpfInput v-model="dataForm.contact2" placeholder="请输入联系人" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系电话2" prop="conPhone2">
|
||||||
|
<JnpfInput v-model="dataForm.conPhone2" placeholder="请输入联系电话" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="联系地址2" prop="conAddress2">
|
||||||
|
<JnpfInput v-model="dataForm.conAddress2" placeholder="请输入联系地址" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-divider content-position="left">开票信息</el-divider>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="公司税号" prop="comTaxNumber">
|
||||||
|
<JnpfInput v-model="dataForm.comTaxNumber" placeholder="请输入公司税号" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户地区" prop="accountRegion">
|
||||||
|
<JnpfInput v-model="dataForm.accountRegion" placeholder="请输入开户地区" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户银行" prop="accountBank">
|
||||||
|
<JnpfInput v-model="dataForm.accountBank" placeholder="请输入开户银行" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="开户账号" prop="accountNo">
|
||||||
|
<JnpfInput v-model="dataForm.accountNo" placeholder="请输入开户账号" clearable></JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<jnpf-form-tip-item label="付款方式" prop="payMeth">
|
||||||
|
<JnpfSelect v-model="dataForm.payMeth" placeholder="请选择" :options="payMethOptions" :props="dictProps" clearable></JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-col :span="24" style="text-align: right; padding-top: 20px;">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="goBack">取 消</el-button>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import {getDict} from "@/api/systemData/dictionary";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
btnLoading: false,
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
custNo: undefined,
|
||||||
|
custName: undefined,
|
||||||
|
custSimName: undefined,
|
||||||
|
industryClass: undefined,
|
||||||
|
coopStatus: undefined,
|
||||||
|
enterpriseType: undefined,
|
||||||
|
custReg: undefined,
|
||||||
|
creditRate: undefined,
|
||||||
|
contact1: undefined,
|
||||||
|
conPhone1: undefined,
|
||||||
|
conAddress1: undefined,
|
||||||
|
contact2: undefined,
|
||||||
|
conPhone2: undefined,
|
||||||
|
conAddress2: undefined,
|
||||||
|
comTaxNumber: undefined,
|
||||||
|
accountRegion: undefined,
|
||||||
|
accountBank: undefined,
|
||||||
|
accountNo: undefined,
|
||||||
|
payMeth: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
enabledStatus: '1',
|
||||||
|
},
|
||||||
|
dataRule: {
|
||||||
|
custNo: [{required: true, message: '请输入客户编码', trigger: 'blur'}],
|
||||||
|
custName: [{required: true, message: '请输入客户全称', trigger: 'blur'}],
|
||||||
|
custSimName: [{required: true, message: '请输入客户简称', trigger: 'blur'}],
|
||||||
|
enabledStatus: [{required: true, message: '请选择状态', trigger: 'change'}],
|
||||||
|
},
|
||||||
|
industryClassOptions: [],
|
||||||
|
coopStatusOptions: [],
|
||||||
|
enterpriseTypeOptions: [],
|
||||||
|
custRegOptions: [],
|
||||||
|
creditRateOptions: [],
|
||||||
|
payMethOptions: [],
|
||||||
|
enabledStatusOptions: [],
|
||||||
|
dictProps: {label: "fullName", value: "enCode"},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
|
const [industryClass, coopStatus, enterpriseType, custReg, creditRate, payMeth, enabledStatus] = await Promise.all([
|
||||||
|
getDict("industryClass"),
|
||||||
|
getDict("coopStatus"),
|
||||||
|
getDict("enterpriseType"),
|
||||||
|
getDict("custReg"),
|
||||||
|
getDict("creditRate"),
|
||||||
|
getDict("payMeth"),
|
||||||
|
getDict("enabledStatus"),
|
||||||
|
]);
|
||||||
|
|
||||||
|
this.industryClassOptions = industryClass;
|
||||||
|
this.coopStatusOptions = coopStatus;
|
||||||
|
this.enterpriseTypeOptions = enterpriseType;
|
||||||
|
this.custRegOptions = custReg;
|
||||||
|
this.creditRateOptions = creditRate;
|
||||||
|
this.payMethOptions = payMeth;
|
||||||
|
this.enabledStatusOptions = enabledStatus;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || '';
|
||||||
|
this.loading = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.formRef.resetFields();
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: `/api/example/tbaCustomer/${this.dataForm.id}`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataForm = res.data
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs.formRef.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.btnLoading = true;
|
||||||
|
const isEdit = !!this.dataForm.id;
|
||||||
|
const url = isEdit ? `/api/example/tbaCustomer/${this.dataForm.id}` : '/api/example/tbaCustomer';
|
||||||
|
const method = isEdit ? 'put' : 'post';
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: url,
|
||||||
|
method: method,
|
||||||
|
data: this.dataForm
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.btnLoading = false;
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.btnLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$emit('refresh')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
259
jnpf-java-boot/jnpf-web/src/views/example/customer/index.vue
Normal file
259
jnpf-java-boot/jnpf-web/src/views/example/customer/index.vue
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
<template>
|
||||||
|
<div class="JNPF-common-layout customer_data">
|
||||||
|
<div class="JNPF-common-layout-center">
|
||||||
|
<el-row class="JNPF-common-search-box" :gutter="14">
|
||||||
|
<el-form @submit.native.prevent>
|
||||||
|
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="客户编码">
|
||||||
|
<el-input v-model="query.custNo" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="客户名称">
|
||||||
|
<el-input v-model="query.custName" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" clearable :options="enabledStatusOptions" :props="enabledStatusProps"></JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item class="btn">
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||||
|
<div class="JNPF-common-head">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新建</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="JNPF-common-head-right"></div>
|
||||||
|
</div>
|
||||||
|
<JNPF-table v-loading="listLoading" :data="list">
|
||||||
|
<el-table-column prop="custNo" label="客户编码" align="center"/>
|
||||||
|
<el-table-column prop="custName" label="客户名称" align="center"/>
|
||||||
|
<el-table-column prop="custSimName" label="客户简称" align="center"/>
|
||||||
|
<el-table-column prop="industryClass" label="所属行业" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getIndustryClassName(scope.row.industryClass) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column prop="enterpriseType" label="企业性质" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getEnterpriseTypeName(scope.row.enterpriseType) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="coopStatus" label="合作状态" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getCoopStatusName(scope.row.coopStatus) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="custReg" label="客户等级" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getCustRegName(scope.row.custReg) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="contact1" label="联系人1" align="center"/>
|
||||||
|
<el-table-column prop="conPhone1" label="联系电话1" align="center"/>
|
||||||
|
<el-table-column prop="enabledStatus" label="状态" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.enabledStatus == '1' ? 'success' : 'info'" size="small">
|
||||||
|
{{ scope.row.enabledStatus == '1' ? '启用' : '未启用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
|
||||||
|
<el-button type="text" @click="detailHandle(scope.row)">详情</el-button>
|
||||||
|
<el-button type="text" style="color: #f56c6c" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</JNPF-table>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
|
||||||
|
<JNPF-Detail v-if="detailVisible" ref="JNPFDetail" @close="closeDetail" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from "@/utils/request";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import JNPFForm from "./form";
|
||||||
|
import JNPFDetail from "./detail";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "customer_list",
|
||||||
|
components: {
|
||||||
|
JNPFForm,
|
||||||
|
JNPFDetail,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
query: {
|
||||||
|
custNo: undefined,
|
||||||
|
custName: undefined,
|
||||||
|
custSimName: undefined,
|
||||||
|
industryClass: undefined,
|
||||||
|
coopStatus: undefined,
|
||||||
|
enterpriseType: undefined,
|
||||||
|
custReg: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
listLoading: false,
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
},
|
||||||
|
formVisible: false,
|
||||||
|
detailVisible: false,
|
||||||
|
industryClassOptions: [
|
||||||
|
{ fullName: "钢铁", id: "1" },
|
||||||
|
{ fullName: "电力", id: "2" },
|
||||||
|
{ fullName: "化工", id: "3" },
|
||||||
|
],
|
||||||
|
industryClassProps: { label: "fullName", value: "id" },
|
||||||
|
coopStatusOptions: [
|
||||||
|
{ fullName: "潜在", id: "1" },
|
||||||
|
{ fullName: "意向", id: "2" },
|
||||||
|
{ fullName: "正式", id: "3" },
|
||||||
|
{ fullName: "暂停", id: "4" },
|
||||||
|
{ fullName: "终止", id: "5" },
|
||||||
|
],
|
||||||
|
coopStatusProps: { label: "fullName", value: "id" },
|
||||||
|
enterpriseTypeOptions: [
|
||||||
|
{ fullName: "国有企业", id: "1" },
|
||||||
|
{ fullName: "民营企业", id: "2" },
|
||||||
|
{ fullName: "外资企业", id: "3" },
|
||||||
|
],
|
||||||
|
enterpriseTypeProps: { label: "fullName", value: "id" },
|
||||||
|
custRegOptions: [
|
||||||
|
{ fullName: "核心", id: "1" },
|
||||||
|
{ fullName: "重点", id: "2" },
|
||||||
|
{ fullName: "一般", id: "3" },
|
||||||
|
],
|
||||||
|
custRegProps: { label: "fullName", value: "id" },
|
||||||
|
enabledStatusOptions: [
|
||||||
|
{ fullName: "启用", id: "1" },
|
||||||
|
{ fullName: "未启用", id: "2" },
|
||||||
|
],
|
||||||
|
enabledStatusProps: { label: "fullName", value: "id" },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["userInfo"]),
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getIndustryClassName(val) {
|
||||||
|
const map = { '1': '钢铁', '2': '电力', '3': '化工' };
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getCoopStatusName(val) {
|
||||||
|
const map = { '1': '潜在', '2': '意向', '3': '正式', '4': '暂停', '5': '终止' };
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getEnterpriseTypeName(val) {
|
||||||
|
const map = { '1': '国有企业', '2': '民营企业', '3': '外资企业' };
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
getCustRegName(val) {
|
||||||
|
const map = { '1': '核心', '2': '重点', '3': '一般' };
|
||||||
|
return map[val] || val;
|
||||||
|
},
|
||||||
|
initData() {
|
||||||
|
this.listLoading = true;
|
||||||
|
let _query = {
|
||||||
|
...this.listQuery,
|
||||||
|
...this.query,
|
||||||
|
dataType: 0,
|
||||||
|
};
|
||||||
|
Object.keys(_query).forEach(key => {
|
||||||
|
if (_query[key] === undefined || _query[key] === null || _query[key] === '') {
|
||||||
|
delete _query[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: `/api/example/tbaCustomer/getList`,
|
||||||
|
method: "post",
|
||||||
|
data: _query,
|
||||||
|
}).then((res) => {
|
||||||
|
this.list = res.data.list;
|
||||||
|
this.total = res.data.pagination.total;
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addOrUpdateHandle(row) {
|
||||||
|
let id = row ? row.id : "";
|
||||||
|
this.formVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFForm.init(id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
detailHandle(row) {
|
||||||
|
this.detailVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFDetail.init(row.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeDetail() {
|
||||||
|
this.detailVisible = false;
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
request({
|
||||||
|
url: `/api/example/tbaCustomer/${row.id}`,
|
||||||
|
method: 'delete'
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.initData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.listQuery.currentPage = 1;
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
refresh(isRefresh) {
|
||||||
|
this.formVisible = false;
|
||||||
|
if (isRefresh) this.search();
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.query = {
|
||||||
|
custNo: undefined,
|
||||||
|
custName: undefined,
|
||||||
|
custSimName: undefined,
|
||||||
|
industryClass: undefined,
|
||||||
|
coopStatus: undefined,
|
||||||
|
enterpriseType: undefined,
|
||||||
|
custReg: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
};
|
||||||
|
this.search();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -3,12 +3,12 @@
|
|||||||
<div class="JNPF-preview-main">
|
<div class="JNPF-preview-main">
|
||||||
<div class="JNPF-common-page-header">
|
<div class="JNPF-common-page-header">
|
||||||
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||||
<div class="options">
|
<!-- <div class="options">-->
|
||||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
<!-- <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>-->
|
||||||
<el-button @click="goBack">取 消</el-button>
|
<!-- <el-button @click="goBack">取 消</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '1200px' }">
|
||||||
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
|
|
||||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||||
label-position="right">
|
label-position="right">
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
@ -65,6 +65,10 @@
|
|||||||
</JnpfTextarea>
|
</JnpfTextarea>
|
||||||
</jnpf-form-tip-item>
|
</jnpf-form-tip-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="24" style="text-align: right; padding-top: 20px;">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="goBack">取 消</el-button>
|
||||||
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
190
jnpf-java-boot/jnpf-web/src/views/example/material/detail.vue
Normal file
190
jnpf-java-boot/jnpf-web/src/views/example/material/detail.vue
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
NEW_FILE_CODE
|
||||||
|
<template>
|
||||||
|
<transition name="el-zoom-in-center">
|
||||||
|
<div class="JNPF-preview-main">
|
||||||
|
<div class="JNPF-common-page-header">
|
||||||
|
<el-page-header @back="goBack" content="详情" />
|
||||||
|
<div class="options">
|
||||||
|
<el-button @click="goBack">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
|
||||||
|
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px"
|
||||||
|
label-position="right" disabled>
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="物料编码">
|
||||||
|
<JnpfInput v-model="dataForm.matCode" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="物料名称">
|
||||||
|
<JnpfInput v-model="dataForm.matName" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="父分类ID">
|
||||||
|
<JnpfInput v-model="dataForm.parentId" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="物料类型">
|
||||||
|
<JnpfInput :value="matTypeName" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="单位">
|
||||||
|
<JnpfInput v-model="dataForm.unit" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="品牌">
|
||||||
|
<JnpfInput v-model="dataForm.brand" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="规格型号">
|
||||||
|
<JnpfInput v-model="dataForm.spec" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="安全库存">
|
||||||
|
<JnpfInput v-model="dataForm.safeStock" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<JnpfInput :value="enabledStatusName" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<JnpfTextarea v-model="dataForm.remark" :style="{ width: '100%' }"
|
||||||
|
:autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
||||||
|
</JnpfTextarea>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="创建人">
|
||||||
|
<JnpfInput v-model="dataForm.creatorUserId" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<JnpfInput :value="formatDate(dataForm.creatorTime)" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="修改人">
|
||||||
|
<JnpfInput v-model="dataForm.lastModifyUserId" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" :sm="24" :md="12" :xl="12" :xs="24">
|
||||||
|
<el-form-item label="修改时间">
|
||||||
|
<JnpfInput :value="formatDate(dataForm.lastModifyTime)" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
matCode: undefined,
|
||||||
|
matName: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
matType: undefined,
|
||||||
|
unit: undefined,
|
||||||
|
brand: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
safeStock: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
creatorUserId: undefined,
|
||||||
|
creatorTime: undefined,
|
||||||
|
lastModifyUserId: undefined,
|
||||||
|
lastModifyTime: undefined,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['userInfo']),
|
||||||
|
matTypeName() {
|
||||||
|
const typeMap = {
|
||||||
|
'1': '原材料',
|
||||||
|
'2': '半成品',
|
||||||
|
'3': '成品'
|
||||||
|
}
|
||||||
|
return typeMap[this.dataForm.matType] || this.dataForm.matType
|
||||||
|
},
|
||||||
|
enabledStatusName() {
|
||||||
|
const statusMap = {
|
||||||
|
1: '启用',
|
||||||
|
2: '未启用'
|
||||||
|
}
|
||||||
|
return statusMap[this.dataForm.enabledStatus] || this.dataForm.enabledStatus
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || '';
|
||||||
|
this.visible = true;
|
||||||
|
this.loading = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: `/api/example/material/${this.dataForm.id}`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataForm = res.data
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$emit('close')
|
||||||
|
},
|
||||||
|
formatDate(date) {
|
||||||
|
if (!date) return ''
|
||||||
|
const d = new Date(date)
|
||||||
|
const year = d.getFullYear()
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(d.getDate()).padStart(2, '0')
|
||||||
|
const hours = String(d.getHours()).padStart(2, '0')
|
||||||
|
const minutes = String(d.getMinutes()).padStart(2, '0')
|
||||||
|
const seconds = String(d.getSeconds()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
223
jnpf-java-boot/jnpf-web/src/views/example/material/form.vue
Normal file
223
jnpf-java-boot/jnpf-web/src/views/example/material/form.vue
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
<template>
|
||||||
|
<transition name="el-zoom-in-center">
|
||||||
|
<div class="JNPF-preview-main">
|
||||||
|
<div class="JNPF-common-page-header">
|
||||||
|
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||||
|
<!-- <div class="options">-->
|
||||||
|
<!-- <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>-->
|
||||||
|
<!-- <el-button @click="goBack">取 消</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '600px' }">
|
||||||
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||||
|
label-position="right">
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="物料类型" prop="matType">
|
||||||
|
<JnpfSelect v-model="dataForm.matType" @change="changeData('matType', -1)"
|
||||||
|
placeholder="请选择物料类型" :options="matTypeOptions" :props="matTypeProps" clearable
|
||||||
|
:style="{ width: '100%' }">
|
||||||
|
</JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="物料编码" prop="matCode">
|
||||||
|
<JnpfInput v-model="dataForm.matCode" @change="changeData('matCode', -1)" placeholder="请输入物料编码"
|
||||||
|
clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="物料名称" prop="matName">
|
||||||
|
<JnpfInput v-model="dataForm.matName" @change="changeData('matName', -1)" placeholder="请输入物料名称"
|
||||||
|
clearable :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="单位" prop="unit">
|
||||||
|
<JnpfInput v-model="dataForm.unit" @change="changeData('unit', -1)" placeholder="请输入单位"
|
||||||
|
clearable :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="品牌" prop="brand">
|
||||||
|
<JnpfInput v-model="dataForm.brand" @change="changeData('brand', -1)" placeholder="请输入品牌"
|
||||||
|
clearable :style="{ width: '100%' }">
|
||||||
|
</JnpfInput>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">-->
|
||||||
|
<!-- <jnpf-form-tip-item label="规格型号" prop="spec">-->
|
||||||
|
<!-- <JnpfInput v-model="dataForm.spec" @change="changeData('spec', -1)" placeholder="请输入规格型号"-->
|
||||||
|
<!-- clearable :style="{ width: '100%' }">-->
|
||||||
|
<!-- </JnpfInput>-->
|
||||||
|
<!-- </jnpf-form-tip-item>-->
|
||||||
|
<!-- </el-col>-->
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="安全库存" prop="safeStock">
|
||||||
|
<JnpfInputNumber v-model="dataForm.safeStock" @change="changeData('safeStock', -1)" placeholder="请输入安全库存"
|
||||||
|
:precision="2" :controls="false" :style="{ width: '100%' }">
|
||||||
|
</JnpfInputNumber>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="状态" prop="enabledStatus">
|
||||||
|
<JnpfSelect v-model="dataForm.enabledStatus" @change="changeData('enabledStatus', -1)"
|
||||||
|
placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" clearable
|
||||||
|
:style="{ width: '100%' }">
|
||||||
|
</JnpfSelect>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" :sm="24" :md="24" :xl="24" :xs="24">
|
||||||
|
<jnpf-form-tip-item label="备注" prop="remark">
|
||||||
|
<JnpfTextarea v-model="dataForm.remark" @change="changeData('remark', -1)" placeholder="请输入备注"
|
||||||
|
:style="{ width: '100%' }" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
||||||
|
</JnpfTextarea>
|
||||||
|
</jnpf-form-tip-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" style="text-align: right; padding-top: 20px;">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="goBack">取 消</el-button>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from '@/utils/request'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
btnLoading: false,
|
||||||
|
formRef: 'formRef',
|
||||||
|
eventType: '',
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
matCode: undefined,
|
||||||
|
matName: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
matType: undefined,
|
||||||
|
unit: undefined,
|
||||||
|
brand: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
safeStock: undefined,
|
||||||
|
enabledStatus: 1,
|
||||||
|
remark: undefined,
|
||||||
|
},
|
||||||
|
dataRule: {
|
||||||
|
matCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入物料编码',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
matName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入物料名称',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
matType: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择物料类型',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
enabledStatus: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择状态',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
matTypeOptions: [
|
||||||
|
{ fullName: "原材料", id: "1" },
|
||||||
|
{ fullName: "半成品", id: "2" },
|
||||||
|
{ fullName: "成品", id: "3" },
|
||||||
|
],
|
||||||
|
matTypeProps: { label: "fullName", value: "id" },
|
||||||
|
enabledStatusOptions: [
|
||||||
|
{ fullName: "启用", id: 1 },
|
||||||
|
{ fullName: "未启用", id: 2 },
|
||||||
|
],
|
||||||
|
enabledStatusProps: { label: "fullName", value: "id" },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['userInfo']),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id || '';
|
||||||
|
this.visible = true;
|
||||||
|
this.loading = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.formRef.resetFields();
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
request({
|
||||||
|
url: `/api/example/material/${this.dataForm.id}`,
|
||||||
|
method: 'get'
|
||||||
|
}).then(res => {
|
||||||
|
this.dataForm = res.data
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs.formRef.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.btnLoading = true;
|
||||||
|
const isEdit = !!this.dataForm.id;
|
||||||
|
const url = isEdit ? `/api/example/material/${this.dataForm.id}` : '/api/example/material';
|
||||||
|
const method = isEdit ? 'put' : 'post';
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: url,
|
||||||
|
method: method,
|
||||||
|
data: this.dataForm
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.btnLoading = false;
|
||||||
|
this.$emit('refresh', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.btnLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$emit('refresh')
|
||||||
|
},
|
||||||
|
changeData(model, index) {
|
||||||
|
this.isEdit = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
255
jnpf-java-boot/jnpf-web/src/views/example/material/index.vue
Normal file
255
jnpf-java-boot/jnpf-web/src/views/example/material/index.vue
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
NEW_FILE_CODE
|
||||||
|
<template>
|
||||||
|
<div class="JNPF-common-layout material_data">
|
||||||
|
<div class="JNPF-common-layout-center">
|
||||||
|
<el-row class="JNPF-common-search-box" :gutter="14">
|
||||||
|
<el-form @submit.native.prevent>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="物料编码">
|
||||||
|
<el-input v-model="query.matCode" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="物料名称">
|
||||||
|
<el-input v-model="query.matName" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="物料类型">
|
||||||
|
<JnpfSelect v-model="query.matType" placeholder="请选择" clearable :options="matTypeOptions"
|
||||||
|
:props="matTypeProps">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" clearable :options="enabledStatusOptions"
|
||||||
|
:props="enabledStatusProps">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="品牌">
|
||||||
|
<el-input v-model="query.brand" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="规格型号">
|
||||||
|
<el-input v-model="query.spec" placeholder="请输入" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item class="btn">
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||||
|
<div class="JNPF-common-head">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新建</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="JNPF-common-head-right"></div>
|
||||||
|
</div>
|
||||||
|
<JNPF-table v-loading="listLoading" :data="list">
|
||||||
|
<el-table-column prop="matCode" label="物料编码" align="center"/>
|
||||||
|
<el-table-column prop="matName" label="物料名称" align="center"/>
|
||||||
|
<el-table-column prop="parentName" label="父分类" align="center"/>
|
||||||
|
<el-table-column prop="matType" label="物料类型" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.matType == '1' ? '原材料' : scope.row.matType == '2' ? '半成品' : scope.row.matType == '3' ? '成品' : scope.row.matType }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="unit" label="单位" align="center"/>
|
||||||
|
<el-table-column prop="brand" label="品牌" align="center"/>
|
||||||
|
<el-table-column prop="spec" label="规格型号" align="center"/>
|
||||||
|
<el-table-column prop="safeStock" label="安全库存" align="center"/>
|
||||||
|
<el-table-column prop="enabledStatus" label="状态" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.enabledStatus == 1 ? 'success' : 'info'" size="small">
|
||||||
|
{{ scope.row.enabledStatus == 1 ? '启用' : scope.row.enabledStatus == 2 ? '未启用' : scope.row.enabledStatus }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" align="center"/>
|
||||||
|
<el-table-column prop="creatorTime" label="创建时间" align="center" :formatter="jnpf.tableDateFormat1"/>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
|
||||||
|
<el-button type="text" @click="detailHandle(scope.row)">详情</el-button>
|
||||||
|
<el-button type="text" style="color: #f56c6c" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</JNPF-table>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
||||||
|
@pagination="initData" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
|
||||||
|
<JNPF-Detail v-if="detailVisible" ref="JNFPDetail" @close="closeDetail" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import request from "@/utils/request";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import JNPFForm from "./form";
|
||||||
|
import JNFPDetail from "./detail";
|
||||||
|
import jnpf from "@/utils/jnpf";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "material_list",
|
||||||
|
components: {
|
||||||
|
JNPFForm,
|
||||||
|
JNFPDetail,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
keyword: "",
|
||||||
|
query: {
|
||||||
|
matCode: undefined,
|
||||||
|
matName: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
matType: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
brand: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
},
|
||||||
|
defListQuery: {
|
||||||
|
sort: "desc",
|
||||||
|
sidx: "",
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
listLoading: false,
|
||||||
|
multipleSelection: [],
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "",
|
||||||
|
sidx: "",
|
||||||
|
},
|
||||||
|
formVisible: false,
|
||||||
|
detailVisible: false,
|
||||||
|
matTypeOptions: [
|
||||||
|
{ fullName: "原材料", id: "1" },
|
||||||
|
{ fullName: "半成品", id: "2" },
|
||||||
|
{ fullName: "成品", id: "3" },
|
||||||
|
],
|
||||||
|
matTypeProps: { label: "fullName", value: "id" },
|
||||||
|
enabledStatusOptions: [
|
||||||
|
{ fullName: "启用", id: 1 },
|
||||||
|
{ fullName: "未启用", id: 2 },
|
||||||
|
],
|
||||||
|
enabledStatusProps: { label: "fullName", value: "id" },
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
jnpf() {
|
||||||
|
return jnpf
|
||||||
|
},
|
||||||
|
...mapGetters(["userInfo"]),
|
||||||
|
menuId() {
|
||||||
|
return this.$route.meta.modelId || "";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initData() {
|
||||||
|
this.listLoading = true;
|
||||||
|
let _query = {
|
||||||
|
...this.listQuery,
|
||||||
|
...this.query,
|
||||||
|
dataType: 0,
|
||||||
|
};
|
||||||
|
Object.keys(_query).forEach(key => {
|
||||||
|
if (_query[key] === undefined || _query[key] === null || _query[key] === '') {
|
||||||
|
delete _query[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
request({
|
||||||
|
url: `/api/example/material/getList`,
|
||||||
|
method: "post",
|
||||||
|
data: _query,
|
||||||
|
}).then((res) => {
|
||||||
|
var _list = [];
|
||||||
|
for (let i = 0; i < res.data.list.length; i++) {
|
||||||
|
let _data = res.data.list[i];
|
||||||
|
_list.push(_data);
|
||||||
|
}
|
||||||
|
this.list = _list;
|
||||||
|
this.total = res.data.pagination.total;
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addOrUpdateHandle(row) {
|
||||||
|
let id = row ? row.id : "";
|
||||||
|
this.formVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFForm.init(id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
detailHandle(row) {
|
||||||
|
this.detailVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNFPDetail.init(row.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeDetail() {
|
||||||
|
this.detailVisible = false;
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
request({
|
||||||
|
url: `/api/example/material/${row.id}`,
|
||||||
|
method: 'delete'
|
||||||
|
}).then(res => {
|
||||||
|
this.$message({
|
||||||
|
message: res.msg,
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.initData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.listQuery.currentPage = 1;
|
||||||
|
this.listQuery.pageSize = 20;
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
refresh(isrRefresh) {
|
||||||
|
this.formVisible = false;
|
||||||
|
if (isrRefresh) this.search();
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.query = {
|
||||||
|
matCode: undefined,
|
||||||
|
matName: undefined,
|
||||||
|
parentId: undefined,
|
||||||
|
matType: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
brand: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
};
|
||||||
|
this.search();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -3,12 +3,12 @@
|
|||||||
<div class="JNPF-preview-main">
|
<div class="JNPF-preview-main">
|
||||||
<div class="JNPF-common-page-header">
|
<div class="JNPF-common-page-header">
|
||||||
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||||
<div class="options">
|
<!-- <div class="options">-->
|
||||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
<!-- <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>-->
|
||||||
<el-button @click="goBack">取 消</el-button>
|
<!-- <el-button @click="goBack">取 消</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '1200px' }">
|
||||||
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
|
|
||||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||||
label-position="right">
|
label-position="right">
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
@ -41,6 +41,10 @@
|
|||||||
</JnpfTextarea>
|
</JnpfTextarea>
|
||||||
</jnpf-form-tip-item>
|
</jnpf-form-tip-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="24" style="text-align: right; padding-top: 20px;">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="goBack">取 消</el-button>
|
||||||
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
@ -3,12 +3,12 @@
|
|||||||
<div class="JNPF-preview-main">
|
<div class="JNPF-preview-main">
|
||||||
<div class="JNPF-common-page-header">
|
<div class="JNPF-common-page-header">
|
||||||
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||||
<div class="options">
|
<!-- <div class="options">-->
|
||||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
<!-- <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>-->
|
||||||
<el-button @click="goBack">取 消</el-button>
|
<!-- <el-button @click="goBack">取 消</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '1200px' }">
|
||||||
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
|
|
||||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||||
label-position="right">
|
label-position="right">
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
@ -41,6 +41,10 @@
|
|||||||
</JnpfTextarea>
|
</JnpfTextarea>
|
||||||
</jnpf-form-tip-item>
|
</jnpf-form-tip-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="24" style="text-align: right; padding-top: 20px;">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="goBack">取 消</el-button>
|
||||||
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user