feat(material): 添加质检方案选择功能并重构相关实体
This commit is contained in:
parent
27720526f4
commit
b35aef5909
@ -0,0 +1,11 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.model.inspplan.InspPlanEntity;
|
||||
|
||||
/**
|
||||
* 质检方案表 Mapper
|
||||
*/
|
||||
public interface InspPlanMapper extends BaseMapper<InspPlanEntity> {
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.entity.MachineEntity;
|
||||
import jnpf.model.machine.MachineEntity;
|
||||
|
||||
/**
|
||||
* 机台主数据 Mapper
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.entity.MaterialEntity;
|
||||
import jnpf.model.material.MaterialEntity;
|
||||
|
||||
/**
|
||||
* 物料主数据 Mapper
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.entity.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
|
||||
/**
|
||||
* 产线主数据 Mapper
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.entity.ProcEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
|
||||
/**
|
||||
* 工序主数据 Mapper
|
||||
|
||||
@ -2,7 +2,7 @@ package jnpf.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.entity.TbaCustomerEntity;
|
||||
import jnpf.model.customer.TbaCustomerEntity;
|
||||
|
||||
/**
|
||||
* 客户主数据 Mapper
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.model.inspplan.InspPlanEntity;
|
||||
import jnpf.model.inspplan.InspPlanForm;
|
||||
import jnpf.model.inspplan.InspPlanPagination;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 质检方案表 Service
|
||||
*/
|
||||
public interface InspPlanService extends IService<InspPlanEntity> {
|
||||
|
||||
List<InspPlanEntity> getList(InspPlanPagination inspPlanPagination);
|
||||
|
||||
InspPlanEntity getInfo(String id);
|
||||
|
||||
void delete(InspPlanEntity entity);
|
||||
|
||||
void create(InspPlanEntity entity);
|
||||
|
||||
boolean update(String id, InspPlanEntity entity);
|
||||
|
||||
String checkForm(InspPlanForm form, int type);
|
||||
|
||||
void saveOrUpdate(InspPlanForm inspPlanForm, String id, boolean isSave) throws Exception;
|
||||
|
||||
List<InspPlanEntity> selectorList(String selectKey);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.entity.MachineEntity;
|
||||
import jnpf.model.machine.MachineEntity;
|
||||
import jnpf.model.machine.MachineForm;
|
||||
import jnpf.model.machine.MachinePagination;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.entity.MaterialEntity;
|
||||
import jnpf.model.material.MaterialEntity;
|
||||
import jnpf.model.material.MaterialForm;
|
||||
import jnpf.model.material.MaterialPagination;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.entity.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineForm;
|
||||
import jnpf.model.proline.ProLinePagination;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.entity.ProcEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
import jnpf.model.proc.ProcForm;
|
||||
import jnpf.model.proc.ProcPagination;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package jnpf.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.entity.TbaCustomerEntity;
|
||||
import jnpf.model.customer.TbaCustomerEntity;
|
||||
import jnpf.model.customer.CustomerForm;
|
||||
import jnpf.model.customer.CustomerPagination;
|
||||
|
||||
|
||||
@ -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.model.inspplan.InspPlanEntity;
|
||||
import jnpf.model.inspplan.InspPlanForm;
|
||||
import jnpf.mapper.InspPlanMapper;
|
||||
import jnpf.model.inspplan.InspPlanPagination;
|
||||
import jnpf.service.InspPlanService;
|
||||
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 InspPlanServiceImpl extends ServiceImpl<InspPlanMapper, InspPlanEntity> implements InspPlanService {
|
||||
|
||||
@Resource
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Override
|
||||
public List<InspPlanEntity> getList(InspPlanPagination inspPlanPagination) {
|
||||
LambdaQueryWrapper<InspPlanEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
// selectKey!=null 查询字段 schemeNo or schemeName
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getSelectKey())) {
|
||||
wrapper.like(InspPlanEntity::getSchemeNo, inspPlanPagination.getSelectKey()).or()
|
||||
.like(InspPlanEntity::getSchemeName, inspPlanPagination.getSelectKey());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getSchemeNo())) {
|
||||
wrapper.like(InspPlanEntity::getSchemeNo, inspPlanPagination.getSchemeNo());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getSchemeName())) {
|
||||
wrapper.like(InspPlanEntity::getSchemeName, inspPlanPagination.getSchemeName());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getSchemeType())) {
|
||||
wrapper.eq(InspPlanEntity::getSchemeType, inspPlanPagination.getSchemeType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getTiemClass())) {
|
||||
wrapper.eq(InspPlanEntity::getTiemClass, inspPlanPagination.getTiemClass());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getFormCode())) {
|
||||
wrapper.like(InspPlanEntity::getFormCode, inspPlanPagination.getFormCode());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(inspPlanPagination.getExecStandard())) {
|
||||
wrapper.like(InspPlanEntity::getExecStandard, inspPlanPagination.getExecStandard());
|
||||
}
|
||||
|
||||
wrapper.eq(InspPlanEntity::getDeleteMark, 0);
|
||||
wrapper.orderByDesc(InspPlanEntity::getId);
|
||||
|
||||
if ("0".equals(inspPlanPagination.getDataType())) {
|
||||
Page<InspPlanEntity> page = new Page<>(inspPlanPagination.getCurrentPage(), inspPlanPagination.getPageSize());
|
||||
IPage<InspPlanEntity> resultPage = this.page(page, wrapper);
|
||||
List<InspPlanEntity> records = resultPage.getRecords();
|
||||
return inspPlanPagination.setData(records, resultPage.getTotal());
|
||||
} else {
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspPlanEntity getInfo(String id) {
|
||||
QueryWrapper<InspPlanEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(InspPlanEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(InspPlanEntity entity) {
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(String id, InspPlanEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(InspPlanEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkForm(InspPlanForm form, int type) {
|
||||
boolean isUpdate = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||
String id = "";
|
||||
String countRecover = "";
|
||||
|
||||
if (isUpdate) {
|
||||
id = form.getId();
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(form.getSchemeNo())) {
|
||||
LambdaQueryWrapper<InspPlanEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspPlanEntity::getSchemeNo, form.getSchemeNo());
|
||||
if (isUpdate) {
|
||||
wrapper.ne(InspPlanEntity::getId, id);
|
||||
}
|
||||
long count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
countRecover += "质检方案编号已存在,请重新输入!";
|
||||
}
|
||||
}
|
||||
|
||||
return countRecover;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(InspPlanForm inspPlanForm, String id, boolean isSave) throws Exception {
|
||||
UserInfo userInfo = userProvider.get();
|
||||
InspPlanEntity entity = JsonUtil.getJsonToBean(inspPlanForm, InspPlanEntity.class);
|
||||
|
||||
if (!isSave) {
|
||||
if (StringUtil.isNotEmpty(id)) {
|
||||
entity.setId(id);
|
||||
}
|
||||
}
|
||||
this.saveOrUpdate(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InspPlanEntity> selectorList(String selectKey) {
|
||||
LambdaQueryWrapper<InspPlanEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
// selectKey!=null 查询字段 schemeNo or schemeName
|
||||
if (ObjectUtil.isNotEmpty(selectKey)) {
|
||||
wrapper.like(InspPlanEntity::getSchemeNo, selectKey).or()
|
||||
.like(InspPlanEntity::getSchemeName, selectKey);
|
||||
}
|
||||
wrapper.eq(InspPlanEntity::getDeleteMark, 0);
|
||||
wrapper.orderByDesc(InspPlanEntity::getId);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,9 @@ 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.MachineEntity;
|
||||
import jnpf.entity.ProLineEntity;
|
||||
import jnpf.entity.ProcEntity;
|
||||
import jnpf.model.machine.MachineEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
import jnpf.mapper.MachineMapper;
|
||||
import jnpf.model.machine.MachineForm;
|
||||
import jnpf.model.machine.MachinePagination;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
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;
|
||||
@ -6,14 +7,17 @@ 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.inspplan.InspPlanEntity;
|
||||
import jnpf.model.material.MaterialEntity;
|
||||
import jnpf.model.material.MaterialForm;
|
||||
import jnpf.model.material.MaterialPagination;
|
||||
import jnpf.service.InspPlanService;
|
||||
import jnpf.service.MaterialService;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -34,6 +38,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
||||
@Resource
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Autowired
|
||||
private InspPlanService inspPlanService;
|
||||
|
||||
@Override
|
||||
public List<MaterialEntity> getList(MaterialPagination materialPagination) {
|
||||
LambdaQueryWrapper<MaterialEntity> materialWrapper = new LambdaQueryWrapper<>();
|
||||
@ -59,7 +66,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
||||
if (ObjectUtil.isNotEmpty(materialPagination.getSpec())) {
|
||||
materialWrapper.like(MaterialEntity::getSpec, materialPagination.getSpec());
|
||||
}
|
||||
materialWrapper.eq(MaterialEntity::getDeleteMark,0);
|
||||
materialWrapper.eq(MaterialEntity::getDeleteMark, 0);
|
||||
materialWrapper.orderByDesc(MaterialEntity::getCreatorTime);
|
||||
if ("0".equals(materialPagination.getDataType())) {
|
||||
Page<MaterialEntity> page = new Page<>(materialPagination.getCurrentPage(), materialPagination.getPageSize());
|
||||
@ -75,7 +82,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
||||
public MaterialEntity getInfo(String id) {
|
||||
QueryWrapper<MaterialEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(MaterialEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
MaterialEntity materialEntity = this.getOne(queryWrapper);
|
||||
if (materialEntity != null) {
|
||||
InspPlanEntity planEntity = inspPlanService.getById(materialEntity.getSchemeId());
|
||||
if (planEntity != null) {
|
||||
materialEntity.setSchemeName(planEntity.getSchemeName());
|
||||
}
|
||||
}
|
||||
return materialEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,7 +130,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, MaterialEnt
|
||||
}
|
||||
long count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
countRecover += "物料编码已存在,请重新输入!";
|
||||
countRecover += "物料编码已存在,请确认!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ 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.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
import jnpf.mapper.ProLineMapper;
|
||||
import jnpf.model.proline.ProLineForm;
|
||||
import jnpf.model.proline.ProLinePagination;
|
||||
|
||||
@ -7,7 +7,7 @@ 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.ProcEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
import jnpf.mapper.ProcMapper;
|
||||
import jnpf.model.proc.ProcForm;
|
||||
import jnpf.model.proc.ProcPagination;
|
||||
|
||||
@ -7,7 +7,7 @@ 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.model.customer.TbaCustomerEntity;
|
||||
import jnpf.mapper.TabCustomerMapper;
|
||||
import jnpf.model.customer.CustomerForm;
|
||||
import jnpf.model.customer.CustomerPagination;
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
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.model.inspplan.InspPlanEntity;
|
||||
import jnpf.model.inspplan.InspPlanForm;
|
||||
import jnpf.model.inspplan.InspPlanPagination;
|
||||
import jnpf.service.InspPlanService;
|
||||
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 = "InspPlan")
|
||||
@RestController
|
||||
@RequestMapping("/api/example/inspplan")
|
||||
public class InspPlanController {
|
||||
|
||||
@Autowired
|
||||
private InspPlanService inspPlanService;
|
||||
|
||||
@Operation(summary = "获取质检方案列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult getList(@RequestBody InspPlanPagination inspPlanPagination) {
|
||||
List<InspPlanEntity> list = inspPlanService.getList(inspPlanPagination);
|
||||
List<Map<String, Object>> realList = list.stream()
|
||||
.map(JsonUtil::entityToMap)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(inspPlanPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取质检方案下拉列表")
|
||||
@GetMapping("/selector")
|
||||
public ActionResult<List<Map<String, Object>>> selectorList(String selectKey) {
|
||||
List<InspPlanEntity> list = inspPlanService.selectorList(selectKey);
|
||||
List<Map<String, Object>> realList = list.stream()
|
||||
.map(JsonUtil::entityToMap)
|
||||
.collect(Collectors.toList());
|
||||
return ActionResult.success(realList);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "获取质检方案详情")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id) {
|
||||
InspPlanEntity entity = inspPlanService.getInfo(id);
|
||||
if (entity != null) {
|
||||
return ActionResult.success(JsonUtil.entityToMap(entity));
|
||||
}
|
||||
return ActionResult.fail("数据不存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "新建质检方案")
|
||||
@PostMapping
|
||||
public ActionResult create(@RequestBody @Valid InspPlanForm inspPlanForm) {
|
||||
String b = inspPlanService.checkForm(inspPlanForm, 0);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
try {
|
||||
inspPlanService.saveOrUpdate(inspPlanForm, "", 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 InspPlanForm inspPlanForm) {
|
||||
inspPlanForm.setId(id);
|
||||
String b = inspPlanService.checkForm(inspPlanForm, 1);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
InspPlanEntity entity = inspPlanService.getInfo(id);
|
||||
if (entity != null) {
|
||||
try {
|
||||
inspPlanService.saveOrUpdate(inspPlanForm, 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) {
|
||||
InspPlanEntity entity = inspPlanService.getInfo(id);
|
||||
if (entity != null) {
|
||||
try {
|
||||
inspPlanService.delete(entity);
|
||||
return ActionResult.success("删除成功");
|
||||
} catch (Exception e) {
|
||||
return ActionResult.fail("删除失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
return ActionResult.fail("删除失败,数据不存在");
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,9 +6,9 @@ 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.MachineEntity;
|
||||
import jnpf.entity.ProcEntity;
|
||||
import jnpf.entity.ProLineEntity;
|
||||
import jnpf.model.machine.MachineEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
import jnpf.model.machine.MachineForm;
|
||||
import jnpf.model.machine.MachinePagination;
|
||||
import jnpf.service.MachineService;
|
||||
|
||||
@ -5,9 +5,10 @@ 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.MaterialEntity;
|
||||
import jnpf.model.material.MaterialForm;
|
||||
import jnpf.model.material.MaterialPagination;
|
||||
import jnpf.service.InspPlanService;
|
||||
import jnpf.service.MaterialService;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
@ -15,8 +16,6 @@ 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;
|
||||
@ -32,8 +31,12 @@ public class MaterialController {
|
||||
@Autowired
|
||||
private MaterialService materialService;
|
||||
|
||||
@Autowired
|
||||
private InspPlanService inspPlanService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param materialPagination 分页查询对象
|
||||
* @return 列表结果集
|
||||
*/
|
||||
@ -55,6 +58,7 @@ public class MaterialController {
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 详情结果集
|
||||
*/
|
||||
@ -70,6 +74,7 @@ public class MaterialController {
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*
|
||||
* @param materialForm 表单对象
|
||||
* @return 新建结果
|
||||
*/
|
||||
@ -90,7 +95,8 @@ public class MaterialController {
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param id 主键
|
||||
*
|
||||
* @param id 主键
|
||||
* @param materialForm 表单对象
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@ -117,6 +123,7 @@ public class MaterialController {
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ -135,31 +142,4 @@ public class MaterialController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ 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.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineEntity;
|
||||
import jnpf.model.proline.ProLineForm;
|
||||
import jnpf.model.proline.ProLinePagination;
|
||||
import jnpf.service.ProLineService;
|
||||
|
||||
@ -5,7 +5,7 @@ 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.ProcEntity;
|
||||
import jnpf.model.proc.ProcEntity;
|
||||
import jnpf.model.proc.ProcForm;
|
||||
import jnpf.model.proc.ProcPagination;
|
||||
import jnpf.service.ProcService;
|
||||
|
||||
@ -5,7 +5,7 @@ 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.TbaCustomerEntity;
|
||||
import jnpf.model.customer.CustomerForm;
|
||||
import jnpf.model.customer.CustomerPagination;
|
||||
import jnpf.service.TbaCustomerService;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
package jnpf.entity;
|
||||
package jnpf.model.customer;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@ -0,0 +1,75 @@
|
||||
|
||||
package jnpf.model.inspplan;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 质检方案表主表
|
||||
*/
|
||||
@Data
|
||||
@TableName("tba_insp_plan")
|
||||
public class InspPlanEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
@TableField("scheme_no")
|
||||
private String schemeNo;
|
||||
|
||||
@TableField("scheme_name")
|
||||
private String schemeName;
|
||||
|
||||
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String remark;
|
||||
|
||||
@TableField(value = "scheme_type", updateStrategy = FieldStrategy.IGNORED)
|
||||
private Integer schemeType;
|
||||
|
||||
@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", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowId;
|
||||
|
||||
@TableField(value = "f_flow_task_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowTaskId;
|
||||
|
||||
@TableField(value = "tiem_class", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String tiemClass;
|
||||
|
||||
@TableField(value = "form_code", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String formCode;
|
||||
|
||||
@TableField(value = "exec_standard", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String execStandard;
|
||||
|
||||
@TableField(value = "test_num", updateStrategy = FieldStrategy.IGNORED)
|
||||
private Integer testNum;
|
||||
|
||||
@TableField(value = "print_code", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String printCode;
|
||||
|
||||
@TableField(value = "print_name", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String printName;
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package jnpf.model.inspplan;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 质检方案表 Form
|
||||
*/
|
||||
@Data
|
||||
public class InspPlanForm {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "质检方案编号")
|
||||
private String schemeNo;
|
||||
|
||||
@NotBlank(message = "质检方案名称不能为空")
|
||||
@Schema(description = "质检方案名称")
|
||||
private String schemeName;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "适用类型,1表示原材料 2表示半成品 3表示成品")
|
||||
private Integer schemeType;
|
||||
|
||||
@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;
|
||||
|
||||
@Schema(description = "分类编码")
|
||||
private String tiemClass;
|
||||
|
||||
@Schema(description = "表单编号")
|
||||
private String formCode;
|
||||
|
||||
@Schema(description = "执行标准")
|
||||
private String execStandard;
|
||||
|
||||
@Schema(description = "检验值数量")
|
||||
private Integer testNum;
|
||||
|
||||
@Schema(description = "打印模板编码")
|
||||
private String printCode;
|
||||
|
||||
@Schema(description = "打印模板名称")
|
||||
private String printName;
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package jnpf.model.inspplan;
|
||||
|
||||
import jnpf.base.Pagination;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 质检方案表分页查询
|
||||
*/
|
||||
@Data
|
||||
public class InspPlanPagination extends Pagination {
|
||||
|
||||
private String selectKey;
|
||||
|
||||
private String json;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private String superQueryJson;
|
||||
|
||||
private String moduleId;
|
||||
|
||||
private String menuId;
|
||||
|
||||
@Schema(description = "质检方案编号")
|
||||
private String schemeNo;
|
||||
|
||||
@Schema(description = "质检方案名称")
|
||||
private String schemeName;
|
||||
|
||||
@Schema(description = "适用类型,1表示原材料 2表示半成品 3表示成品")
|
||||
private Integer schemeType;
|
||||
|
||||
@Schema(description = "分类编码")
|
||||
private String tiemClass;
|
||||
|
||||
@Schema(description = "表单编号")
|
||||
private String formCode;
|
||||
|
||||
@Schema(description = "执行标准")
|
||||
private String execStandard;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package jnpf.entity;
|
||||
package jnpf.model.machine;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package jnpf.entity;
|
||||
package jnpf.model.material;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@ -75,6 +75,9 @@ public class MaterialEntity {
|
||||
@TableField(value = "scheme_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private Long schemeId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String schemeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentName;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package jnpf.entity;
|
||||
package jnpf.model.proc;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package jnpf.entity;
|
||||
package jnpf.model.proline;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="选择质检方案"
|
||||
:visible.sync="dialogVisible"
|
||||
width="800px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="search-box">
|
||||
<el-form @submit.native.prevent>
|
||||
<el-form-item label="检索条件">
|
||||
<el-input v-model="query.selectKey" placeholder="请输入检索条件" clearable @keyup.enter.native="search"></el-input>
|
||||
</el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="reset()">重置</el-button>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table :data="list" v-loading="listLoading" highlight-current-row height="300">
|
||||
<el-table-column width="50" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-radio :label="scope.row.id" v-model="selectedId" @change="handleRadioChange(scope.row)"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
|
||||
<el-table-column prop="schemeNo" label="质检编号" align="center"></el-table-column>
|
||||
<el-table-column prop="schemeName" label="质检名称" align="center"></el-table-column>
|
||||
<el-table-column prop="remark" label="描述" align="center"></el-table-column>
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleConfirm()" :disabled="!currentRow">确 定</el-button>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
listLoading: false,
|
||||
list: [],
|
||||
query: {
|
||||
selectKey: undefined,
|
||||
},
|
||||
selectedId: null,
|
||||
currentRow: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show(schemeId, schemeName) {
|
||||
this.dialogVisible = true
|
||||
this.selectedId = schemeId || null
|
||||
this.currentRow = null
|
||||
|
||||
if (schemeName) {
|
||||
this.query.selectKey = schemeName
|
||||
this.initData().then(() => {
|
||||
const row = this.list.find(item => item.id === this.selectedId || item.schemeName === schemeName)
|
||||
if (row) {
|
||||
this.selectedId = row.id
|
||||
this.currentRow = row
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.query.selectKey = undefined
|
||||
this.list = []
|
||||
}
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true
|
||||
console.log('initData - this.query:', this.query)
|
||||
|
||||
const _query = {}
|
||||
if (this.query.selectKey) {
|
||||
_query.selectKey = this.query.selectKey
|
||||
}
|
||||
|
||||
console.log('initData - _query:', _query)
|
||||
|
||||
return request({
|
||||
url: '/api/example/inspplan/selector',
|
||||
method: 'get',
|
||||
data: _query,
|
||||
}).then(res => {
|
||||
this.list = res.data || []
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
search() {
|
||||
console.log('search 被调用')
|
||||
console.log('this.query:', this.query)
|
||||
console.log('this.query.selectKey:', this.query.selectKey)
|
||||
return this.initData().then(() => {
|
||||
if (this.selectedId) {
|
||||
const row = this.list.find(item => item.id === this.selectedId)
|
||||
if (row) {
|
||||
this.currentRow = row
|
||||
}
|
||||
} else if (this.query.selectKey) {
|
||||
const row = this.list.find(item => item.schemeName === this.query.selectKey)
|
||||
if (row) {
|
||||
this.selectedId = row.id
|
||||
this.currentRow = row
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.query.selectKey = undefined
|
||||
this.search()
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.selectedId = row.id
|
||||
this.currentRow = row
|
||||
},
|
||||
handleRadioChange(row) {
|
||||
this.currentRow = row
|
||||
},
|
||||
handleConfirm() {
|
||||
if (this.currentRow) {
|
||||
this.$emit('select', this.currentRow)
|
||||
this.dialogVisible = false
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.search-box {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.search-box .el-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.search-box .el-form-item {
|
||||
margin-bottom: 0;
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.search-box .el-form-item >>> .el-form-item__label {
|
||||
width: auto !important;
|
||||
line-height: 32px;
|
||||
}
|
||||
.search-box .el-input {
|
||||
width: 200px;
|
||||
}
|
||||
</style>
|
||||
@ -1,62 +1,70 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新建' : '编辑'"
|
||||
:visible.sync="dialogVisible"
|
||||
width="600px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-form-item label="物料类型" prop="matType">
|
||||
<JnpfSelect v-model="dataForm.matType" placeholder="请选择物料类型" :options="matTypeOptions" :props="matTypeProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="matCode">
|
||||
<JnpfInput v-model="dataForm.matCode" placeholder="请输入物料编码" clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="matName">
|
||||
<JnpfInput v-model="dataForm.matName" placeholder="请输入物料名称" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<JnpfSelect v-model="dataForm.unit" placeholder="请选择单位" :options="unitOptions" :props="unitProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="质检方案" prop="schemeId">
|
||||
<JnpfInput v-model="dataForm.schemeId" placeholder="请选择" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌" prop="brand">
|
||||
<JnpfInput v-model="dataForm.brand" placeholder="请输入品牌" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全库存" prop="safeStock">
|
||||
<JnpfInputNumber v-model="dataForm.safeStock" placeholder="请输入安全库存" :precision="2" :controls="false" :style="{ width: '100%' }">
|
||||
</JnpfInputNumber>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态" prop="enabledStatus">
|
||||
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :style="{ width: '100%' }" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
||||
</JnpfTextarea>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新建' : '编辑'"
|
||||
:visible.sync="dialogVisible"
|
||||
width="600px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-form-item label="物料类型" prop="matType">
|
||||
<JnpfSelect v-model="dataForm.matType" placeholder="请选择物料类型" :options="matTypeOptions" :props="matTypeProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="matCode">
|
||||
<JnpfInput v-model="dataForm.matCode" placeholder="请输入物料编码" clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称" prop="matName">
|
||||
<JnpfInput v-model="dataForm.matName" placeholder="请输入物料名称" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<JnpfSelect v-model="dataForm.unit" placeholder="请选择单位" :options="unitOptions" :props="unitProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="质检方案" prop="schemeId">
|
||||
<div @click="openInspPlanSelect" style="width: 100%; cursor: pointer;">
|
||||
<el-input v-model="dataForm.schemeName" placeholder="请选择质检方案" clearable :style="{ width: '100%' }" readonly></el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌" prop="brand">
|
||||
<JnpfInput v-model="dataForm.brand" placeholder="请输入品牌" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全库存" prop="safeStock">
|
||||
<JnpfInputNumber v-model="dataForm.safeStock" placeholder="请输入安全库存" :precision="2" :controls="false" :style="{ width: '100%' }">
|
||||
</JnpfInputNumber>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态" prop="enabledStatus">
|
||||
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :style="{ width: '100%' }" :autoSize="{ minRows: 4, maxRows: 4 }" type="textarea">
|
||||
</JnpfTextarea>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<InspPlanSelect ref="inspPlanSelect" @select="handleInspPlanSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import InspPlanSelect from '../inspplan/InspPlanSelect.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
InspPlanSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
@ -75,6 +83,7 @@ export default {
|
||||
enabledStatus: 1,
|
||||
remark: undefined,
|
||||
schemeId: undefined,
|
||||
schemeName: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
matCode: [
|
||||
@ -167,6 +176,13 @@ export default {
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh',true)
|
||||
},
|
||||
openInspPlanSelect() {
|
||||
this.$refs.inspPlanSelect.show(this.dataForm.schemeId, this.dataForm.schemeName)
|
||||
},
|
||||
handleInspPlanSelect(row) {
|
||||
this.$set(this.dataForm, 'schemeId', row.id)
|
||||
this.$set(this.dataForm, 'schemeName', row.schemeName)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="状态">
|
||||
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" clearable :options="enabledStatusOptions"
|
||||
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" :options="enabledStatusOptions"
|
||||
:props="enabledStatusProps">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
@ -100,7 +100,7 @@ export default {
|
||||
matName: undefined,
|
||||
parentId: undefined,
|
||||
matType: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 1,
|
||||
brand: undefined,
|
||||
spec: undefined,
|
||||
},
|
||||
@ -240,7 +240,7 @@ export default {
|
||||
matName: undefined,
|
||||
parentId: undefined,
|
||||
matType: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 1,
|
||||
brand: undefined,
|
||||
spec: undefined,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user