feat(example): 新增机台工艺参数配置功能
This commit is contained in:
parent
d4d14c987e
commit
3d5ff4a36f
@ -0,0 +1,8 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.model.machine.MachineParamEntity;
|
||||
|
||||
public interface MachineParamMapper extends BaseMapper<MachineParamEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package jnpf.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import jnpf.model.proc.ProcParamEntity;
|
||||
|
||||
public interface ProcParamMapper extends BaseMapper<ProcParamEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.model.machine.MachineParamEntity;
|
||||
import jnpf.model.machine.MachineParamForm;
|
||||
import jnpf.model.machine.MachineParamPagination;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MachineParamService extends IService<MachineParamEntity> {
|
||||
|
||||
List<MachineParamEntity> getList(MachineParamPagination machineParamPagination);
|
||||
|
||||
MachineParamEntity getInfo(String id);
|
||||
|
||||
void delete(MachineParamEntity entity);
|
||||
|
||||
void create(MachineParamEntity entity);
|
||||
|
||||
boolean update(String id, MachineParamEntity entity);
|
||||
|
||||
String checkForm(MachineParamForm form, int type);
|
||||
|
||||
void saveOrUpdate(MachineParamForm machineParamForm, String id, boolean isSave) throws Exception;
|
||||
|
||||
List<MachineParamEntity> getSelectList(String selectKey);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package jnpf.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.model.proc.ProcParamEntity;
|
||||
import jnpf.model.proc.ProcParamForm;
|
||||
import jnpf.model.proc.ProcParamPagination;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProcParamService extends IService<ProcParamEntity> {
|
||||
|
||||
List<ProcParamEntity> getList(ProcParamPagination procParamPagination);
|
||||
|
||||
ProcParamEntity getInfo(String id);
|
||||
|
||||
void delete(ProcParamEntity entity);
|
||||
|
||||
void create(ProcParamEntity entity);
|
||||
|
||||
boolean update(String id, ProcParamEntity entity);
|
||||
|
||||
String checkForm(ProcParamForm form, int type);
|
||||
|
||||
void saveOrUpdate(ProcParamForm procParamForm, String id, boolean isSave) throws Exception;
|
||||
|
||||
List<ProcParamEntity> getSelectList(String selectKey);
|
||||
}
|
||||
@ -0,0 +1,155 @@
|
||||
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.mapper.MachineParamMapper;
|
||||
import jnpf.model.machine.MachineParamEntity;
|
||||
import jnpf.model.machine.MachineParamForm;
|
||||
import jnpf.model.machine.MachineParamPagination;
|
||||
import jnpf.service.MachineParamService;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MachineParamServiceImpl extends ServiceImpl<MachineParamMapper, MachineParamEntity> implements MachineParamService {
|
||||
|
||||
@Resource
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Resource
|
||||
private MachineParamService self;
|
||||
|
||||
@Override
|
||||
public List<MachineParamEntity> getList(MachineParamPagination machineParamPagination) {
|
||||
LambdaQueryWrapper<MachineParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getProcCd())) {
|
||||
wrapper.like(MachineParamEntity::getProcCd, machineParamPagination.getProcCd());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getProcName())) {
|
||||
wrapper.like(MachineParamEntity::getProcName, machineParamPagination.getProcName());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getMatCode())) {
|
||||
wrapper.like(MachineParamEntity::getMatCode, machineParamPagination.getMatCode());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getMatName())) {
|
||||
wrapper.like(MachineParamEntity::getMatName, machineParamPagination.getMatName());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getMachineCd())) {
|
||||
wrapper.like(MachineParamEntity::getMachineCd, machineParamPagination.getMachineCd());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(machineParamPagination.getMachineName())) {
|
||||
wrapper.like(MachineParamEntity::getMachineName, machineParamPagination.getMachineName());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(machineParamPagination.getEnabledStatus())) {
|
||||
wrapper.eq(MachineParamEntity::getEnabledStatus, machineParamPagination.getEnabledStatus());
|
||||
}
|
||||
|
||||
wrapper.eq(MachineParamEntity::getDeleteMark, 0);
|
||||
wrapper.orderByDesc(MachineParamEntity::getCreatorTime);
|
||||
|
||||
if ("0".equals(machineParamPagination.getDataType())) {
|
||||
Page<MachineParamEntity> page = new Page<>(machineParamPagination.getCurrentPage(), machineParamPagination.getPageSize());
|
||||
IPage<MachineParamEntity> result = this.page(page, wrapper);
|
||||
return machineParamPagination.setData(result.getRecords(), result.getTotal());
|
||||
} else {
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MachineParamEntity getInfo(String id) {
|
||||
QueryWrapper<MachineParamEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(MachineParamEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(MachineParamEntity entity) {
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(String id, MachineParamEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(MachineParamEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkForm(MachineParamForm form, int type) {
|
||||
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||
String id = "";
|
||||
String countRecover = "";
|
||||
if (isUp) {
|
||||
id = form.getId();
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(form.getProcCd()) && ObjectUtil.isNotEmpty(form.getMatCode())
|
||||
&& ObjectUtil.isNotEmpty(form.getMachineCd())) {
|
||||
LambdaQueryWrapper<MachineParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MachineParamEntity::getProcCd, form.getProcCd());
|
||||
wrapper.eq(MachineParamEntity::getMatCode, form.getMatCode());
|
||||
wrapper.eq(MachineParamEntity::getMachineCd, form.getMachineCd());
|
||||
if (isUp) {
|
||||
wrapper.ne(MachineParamEntity::getId, id);
|
||||
}
|
||||
long count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
countRecover += "该工序、物料、机台的配置已存在,请重新选择!";
|
||||
}
|
||||
}
|
||||
|
||||
return countRecover;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(MachineParamForm machineParamForm, String id, boolean isSave) throws Exception {
|
||||
if (isSave) {
|
||||
MachineParamEntity entity = new MachineParamEntity();
|
||||
BeanUtils.copyProperties(machineParamForm, entity);
|
||||
entity.setId(null);
|
||||
this.save(entity);
|
||||
} else {
|
||||
MachineParamEntity entity = getInfo(id);
|
||||
if (entity == null) {
|
||||
throw new Exception("数据不存在");
|
||||
} else {
|
||||
BeanUtils.copyProperties(machineParamForm, entity);
|
||||
this.updateById(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MachineParamEntity> getSelectList(String selectKey) {
|
||||
LambdaQueryWrapper<MachineParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MachineParamEntity::getDeleteMark, 0);
|
||||
wrapper.eq(MachineParamEntity::getEnabledStatus, 1);
|
||||
|
||||
if (StringUtil.isNotEmpty(selectKey)) {
|
||||
wrapper.and(w -> w.like(MachineParamEntity::getMachineCd, selectKey)
|
||||
.or()
|
||||
.like(MachineParamEntity::getMachineName, selectKey));
|
||||
}
|
||||
|
||||
wrapper.orderByDesc(MachineParamEntity::getCreatorTime);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
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.mapper.ProcParamMapper;
|
||||
import jnpf.model.proc.ProcParamEntity;
|
||||
import jnpf.model.proc.ProcParamForm;
|
||||
import jnpf.model.proc.ProcParamPagination;
|
||||
import jnpf.service.ProcParamService;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.util.UserProvider;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProcParamServiceImpl extends ServiceImpl<ProcParamMapper, ProcParamEntity> implements ProcParamService {
|
||||
|
||||
@Resource
|
||||
private UserProvider userProvider;
|
||||
|
||||
@Resource
|
||||
private ProcParamService self;
|
||||
|
||||
@Override
|
||||
public List<ProcParamEntity> getList(ProcParamPagination procParamPagination) {
|
||||
LambdaQueryWrapper<ProcParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (StringUtil.isNotEmpty(procParamPagination.getProcCd())) {
|
||||
wrapper.like(ProcParamEntity::getProcCd, procParamPagination.getProcCd());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(procParamPagination.getProcName())) {
|
||||
wrapper.like(ProcParamEntity::getProcName, procParamPagination.getProcName());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(procParamPagination.getProcParamName())) {
|
||||
wrapper.like(ProcParamEntity::getProcParamName, procParamPagination.getProcParamName());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(procParamPagination.getProcParamType())) {
|
||||
wrapper.eq(ProcParamEntity::getProcParamType, procParamPagination.getProcParamType());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(procParamPagination.getEnabledStatus())) {
|
||||
wrapper.eq(ProcParamEntity::getEnabledStatus, procParamPagination.getEnabledStatus());
|
||||
}
|
||||
|
||||
wrapper.eq(ProcParamEntity::getDeleteMark, 0);
|
||||
wrapper.orderByDesc(ProcParamEntity::getCreatorTime);
|
||||
|
||||
if ("0".equals(procParamPagination.getDataType())) {
|
||||
Page<ProcParamEntity> page = new Page<>(procParamPagination.getCurrentPage(), procParamPagination.getPageSize());
|
||||
IPage<ProcParamEntity> result = this.page(page, wrapper);
|
||||
return procParamPagination.setData(result.getRecords(), result.getTotal());
|
||||
} else {
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcParamEntity getInfo(String id) {
|
||||
QueryWrapper<ProcParamEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProcParamEntity::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(ProcParamEntity entity) {
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(String id, ProcParamEntity entity) {
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(ProcParamEntity entity) {
|
||||
if (entity != null) {
|
||||
this.removeById(entity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkForm(ProcParamForm form, int type) {
|
||||
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||
String id = "";
|
||||
String countRecover = "";
|
||||
if (isUp) {
|
||||
id = form.getId();
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(form.getProcCd()) && ObjectUtil.isNotEmpty(form.getProcParamName())) {
|
||||
LambdaQueryWrapper<ProcParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProcParamEntity::getProcCd, form.getProcCd());
|
||||
wrapper.eq(ProcParamEntity::getProcParamName, form.getProcParamName());
|
||||
if (isUp) {
|
||||
wrapper.ne(ProcParamEntity::getId, id);
|
||||
}
|
||||
long count = this.count(wrapper);
|
||||
if (count > 0) {
|
||||
countRecover += "工序(" + form.getProcName() + ")+参数名称(" + form.getProcParamName() + ")已存在,请确认!";
|
||||
}
|
||||
}
|
||||
|
||||
return countRecover;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(ProcParamForm procParamForm, String id, boolean isSave) throws Exception {
|
||||
if (isSave) {
|
||||
ProcParamEntity entity = new ProcParamEntity();
|
||||
BeanUtils.copyProperties(procParamForm, entity);
|
||||
entity.setId(null);
|
||||
this.save(entity);
|
||||
} else {
|
||||
ProcParamEntity entity = getInfo(id);
|
||||
if (entity == null) {
|
||||
throw new Exception("数据不存在");
|
||||
} else {
|
||||
BeanUtils.copyProperties(procParamForm, entity);
|
||||
this.updateById(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcParamEntity> getSelectList(String selectKey) {
|
||||
LambdaQueryWrapper<ProcParamEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProcParamEntity::getDeleteMark, 0);
|
||||
wrapper.eq(ProcParamEntity::getEnabledStatus, 1);
|
||||
|
||||
if (StringUtil.isNotEmpty(selectKey)) {
|
||||
wrapper.and(w -> w.like(ProcParamEntity::getProcParamName, selectKey)
|
||||
.or()
|
||||
.like(ProcParamEntity::getProcCd, selectKey));
|
||||
}
|
||||
|
||||
wrapper.orderByDesc(ProcParamEntity::getCreatorTime);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
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.machine.MachineParamEntity;
|
||||
import jnpf.model.machine.MachineParamForm;
|
||||
import jnpf.model.machine.MachineParamPagination;
|
||||
import jnpf.permission.entity.UserEntity;
|
||||
import jnpf.permission.service.UserService;
|
||||
import jnpf.service.MachineParamService;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "机台工艺参数配置", description = "MachineParam")
|
||||
@RestController
|
||||
@RequestMapping("/api/example/machineparam")
|
||||
public class MachineParamController {
|
||||
|
||||
@Autowired
|
||||
private MachineParamService machineParamService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Operation(summary = "获取机台工艺参数列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult getList(@RequestBody MachineParamPagination machineParamPagination) {
|
||||
List<MachineParamEntity> list = machineParamService.getList(machineParamPagination);
|
||||
list.forEach(item -> {
|
||||
UserEntity userEntity = userService.getById(item.getCreatorUserId());
|
||||
if (userEntity != null) {
|
||||
item.setCreateUserName(userEntity.getRealName());
|
||||
}
|
||||
});
|
||||
List<Map<String, Object>> realList = list.stream()
|
||||
.map(JsonUtil::entityToMap)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(machineParamPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取机台工艺参数详情")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id) {
|
||||
MachineParamEntity entity = machineParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
return ActionResult.success(JsonUtil.entityToMap(entity));
|
||||
}
|
||||
return ActionResult.fail("数据不存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "新建机台工艺参数")
|
||||
@PostMapping
|
||||
public ActionResult create(@RequestBody @Valid MachineParamForm machineParamForm) {
|
||||
String b = machineParamService.checkForm(machineParamForm, 0);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
try {
|
||||
machineParamService.saveOrUpdate(machineParamForm, "", 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 MachineParamForm machineParamForm) {
|
||||
machineParamForm.setId(id);
|
||||
String b = machineParamService.checkForm(machineParamForm, 1);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
MachineParamEntity entity = machineParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
try {
|
||||
machineParamService.saveOrUpdate(machineParamForm, 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) {
|
||||
MachineParamEntity entity = machineParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
machineParamService.delete(entity);
|
||||
return ActionResult.success("删除成功");
|
||||
}
|
||||
return ActionResult.fail("数据不存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "获取机台工艺参数下拉框")
|
||||
@GetMapping("/getSelect")
|
||||
public ActionResult getSelect(@RequestParam(value = "selectKey", required = false) String selectKey) {
|
||||
List<MachineParamEntity> list = machineParamService.getSelectList(selectKey);
|
||||
List<Map<String, Object>> result = list.stream()
|
||||
.map(entity -> {
|
||||
Map<String, Object> map = new HashMap<>(3);
|
||||
map.put("id", entity.getId());
|
||||
map.put("code", entity.getMachineCd());
|
||||
map.put("name", entity.getMachineName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return ActionResult.success(result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
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.proc.ProcParamEntity;
|
||||
import jnpf.model.proc.ProcParamForm;
|
||||
import jnpf.model.proc.ProcParamPagination;
|
||||
import jnpf.permission.entity.UserEntity;
|
||||
import jnpf.permission.service.UserService;
|
||||
import jnpf.service.ProcParamService;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Tag(name = "工序工艺参数配置", description = "ProcParam")
|
||||
@RestController
|
||||
@RequestMapping("/api/example/procparam")
|
||||
public class ProcParamController {
|
||||
|
||||
@Autowired
|
||||
private ProcParamService procParamService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Operation(summary = "获取工序工艺参数列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult getList(@RequestBody ProcParamPagination procParamPagination) {
|
||||
List<ProcParamEntity> list = procParamService.getList(procParamPagination);
|
||||
list.forEach(item -> {
|
||||
UserEntity userEntity = userService.getById(item.getCreatorUserId());
|
||||
if (userEntity != null) {
|
||||
item.setCreateUserName(userEntity.getRealName());
|
||||
}
|
||||
});
|
||||
List<Map<String, Object>> realList = list.stream()
|
||||
.map(JsonUtil::entityToMap)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(procParamPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取工序工艺参数详情")
|
||||
@GetMapping("/{id}")
|
||||
public ActionResult info(@PathVariable("id") String id) {
|
||||
ProcParamEntity entity = procParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
return ActionResult.success(JsonUtil.entityToMap(entity));
|
||||
}
|
||||
return ActionResult.fail("数据不存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "新建工序工艺参数")
|
||||
@PostMapping
|
||||
public ActionResult create(@RequestBody @Valid ProcParamForm procParamForm) {
|
||||
String b = procParamService.checkForm(procParamForm, 0);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
try {
|
||||
procParamService.saveOrUpdate(procParamForm, "", 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 ProcParamForm procParamForm) {
|
||||
procParamForm.setId(id);
|
||||
String b = procParamService.checkForm(procParamForm, 1);
|
||||
if (StringUtil.isNotEmpty(b)) {
|
||||
return ActionResult.fail(b);
|
||||
}
|
||||
ProcParamEntity entity = procParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
try {
|
||||
procParamService.saveOrUpdate(procParamForm, 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) {
|
||||
ProcParamEntity entity = procParamService.getInfo(id);
|
||||
if (entity != null) {
|
||||
procParamService.delete(entity);
|
||||
return ActionResult.success("删除成功");
|
||||
}
|
||||
return ActionResult.fail("数据不存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "获取工序工艺参数下拉框")
|
||||
@GetMapping("/getSelect")
|
||||
public ActionResult getSelect(@RequestParam(value = "selectKey", required = false) String selectKey) {
|
||||
List<ProcParamEntity> list = procParamService.getSelectList(selectKey);
|
||||
List<Map<String, Object>> result = list.stream()
|
||||
.map(entity -> {
|
||||
Map<String, Object> map = new HashMap<>(3);
|
||||
map.put("id", entity.getId());
|
||||
map.put("code", entity.getProcParamName());
|
||||
map.put("name", entity.getProcParamName());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return ActionResult.success(result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package jnpf.model.machine;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("tba_machine_param")
|
||||
public class MachineParamEntity {
|
||||
|
||||
@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", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowId;
|
||||
|
||||
@TableField(value = "f_flow_task_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowTaskId;
|
||||
|
||||
@TableField("proc_cd")
|
||||
private String procCd;
|
||||
|
||||
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String enabledStatus;
|
||||
|
||||
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String remark;
|
||||
|
||||
@TableField("proc_id")
|
||||
private Integer procId;
|
||||
|
||||
@TableField("proc_name")
|
||||
private String procName;
|
||||
|
||||
@TableField("mat_code")
|
||||
private String matCode;
|
||||
|
||||
@TableField("mat_name")
|
||||
private String matName;
|
||||
|
||||
@TableField("mate_id")
|
||||
private Integer mateId;
|
||||
|
||||
@TableField("spec")
|
||||
private String spec;
|
||||
|
||||
@TableField("machine_cd")
|
||||
private String machineCd;
|
||||
|
||||
@TableField("machine_name")
|
||||
private String machineName;
|
||||
|
||||
@TableField("machine_id")
|
||||
private Integer machineId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String createUserName;
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package jnpf.model.machine;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class MachineParamForm {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "工序编码不能为空")
|
||||
@Schema(description = "工序编码")
|
||||
private String procCd;
|
||||
|
||||
@Schema(description = "状态(1启用 2 未启用)")
|
||||
private String enabledStatus;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "工序id")
|
||||
private Integer procId;
|
||||
|
||||
@Schema(description = "工序名称")
|
||||
private String procName;
|
||||
|
||||
@NotBlank(message = "物料编码不能为空")
|
||||
@Schema(description = "物料编码")
|
||||
private String matCode;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
private String matName;
|
||||
|
||||
@Schema(description = "物料id")
|
||||
private Integer mateId;
|
||||
|
||||
@Schema(description = "规格型号")
|
||||
private String spec;
|
||||
|
||||
@NotBlank(message = "机台编码不能为空")
|
||||
@Schema(description = "机台编码")
|
||||
private String machineCd;
|
||||
|
||||
@Schema(description = "机台名称")
|
||||
private String machineName;
|
||||
|
||||
@Schema(description = "机台id")
|
||||
private Integer machineId;
|
||||
|
||||
@Schema(description = "流程ID")
|
||||
private String flowId;
|
||||
|
||||
@Schema(description = "流程任务ID")
|
||||
private String flowTaskId;
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package jnpf.model.machine;
|
||||
|
||||
import jnpf.base.Pagination;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MachineParamPagination extends Pagination {
|
||||
|
||||
@Schema(description = "selectKey")
|
||||
private String selectKey;
|
||||
|
||||
@Schema(description = "json")
|
||||
private String json;
|
||||
|
||||
@Schema(description = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "特殊查询json")
|
||||
private String superQueryJson;
|
||||
|
||||
@Schema(description = "模块id")
|
||||
private String moduleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
|
||||
@Schema(description = "工序编码")
|
||||
private String procCd;
|
||||
|
||||
@Schema(description = "工序名称")
|
||||
private String procName;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String matCode;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
private String matName;
|
||||
|
||||
@Schema(description = "机台编码")
|
||||
private String machineCd;
|
||||
|
||||
@Schema(description = "机台名称")
|
||||
private String machineName;
|
||||
|
||||
@Schema(description = "状态(1启用 2 未启用)")
|
||||
private String enabledStatus;
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package jnpf.model.proc;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("tba_proc_param")
|
||||
public class ProcParamEntity {
|
||||
|
||||
@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", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowId;
|
||||
|
||||
@TableField(value = "f_flow_task_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String flowTaskId;
|
||||
|
||||
@TableField("proc_cd")
|
||||
private String procCd;
|
||||
|
||||
@TableField("proc_name")
|
||||
private String procName;
|
||||
|
||||
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String enabledStatus;
|
||||
|
||||
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String remark;
|
||||
|
||||
@TableField("proc_id")
|
||||
private Integer procId;
|
||||
|
||||
@TableField("proc_param_name")
|
||||
private String procParamName;
|
||||
|
||||
@TableField("proc_param_unit")
|
||||
private String procParamUnit;
|
||||
|
||||
@TableField("proc_param_type")
|
||||
private String procParamType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String createUserName;
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package jnpf.model.proc;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class ProcParamForm {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@NotBlank(message = "工序编码不能为空")
|
||||
@Schema(description = "工序编码")
|
||||
private String procCd;
|
||||
|
||||
@Schema(description = "工序名称")
|
||||
private String procName;
|
||||
|
||||
@Schema(description = "状态(1启用 2 未启用)")
|
||||
private String enabledStatus;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "工序id")
|
||||
private Integer procId;
|
||||
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
@Schema(description = "参数名称")
|
||||
private String procParamName;
|
||||
|
||||
@Schema(description = "参数单位")
|
||||
private String procParamUnit;
|
||||
|
||||
@Schema(description = "参数类别(1 温度 2压力 3 时间 4速度)")
|
||||
private String procParamType;
|
||||
|
||||
@Schema(description = "流程ID")
|
||||
private String flowId;
|
||||
|
||||
@Schema(description = "流程任务ID")
|
||||
private String flowTaskId;
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
package jnpf.model.proc;
|
||||
|
||||
import jnpf.base.Pagination;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProcParamPagination extends Pagination {
|
||||
|
||||
@Schema(description = "selectKey")
|
||||
private String selectKey;
|
||||
|
||||
@Schema(description = "json")
|
||||
private String json;
|
||||
|
||||
@Schema(description = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "特殊查询json")
|
||||
private String superQueryJson;
|
||||
|
||||
@Schema(description = "模块id")
|
||||
private String moduleId;
|
||||
|
||||
@Schema(description = "菜单id")
|
||||
private String menuId;
|
||||
|
||||
@Schema(description = "工序编码")
|
||||
private String procCd;
|
||||
|
||||
@Schema(description = "工序名称")
|
||||
private String procName;
|
||||
|
||||
@Schema(description = "参数名称")
|
||||
private String procParamName;
|
||||
|
||||
@Schema(description = "参数类别(1 温度 2压力 3 时间 4速度)")
|
||||
private String procParamType;
|
||||
|
||||
@Schema(description = "状态(1启用 2 未启用)")
|
||||
private String enabledStatus;
|
||||
}
|
||||
@ -6,17 +6,32 @@ export const dictMaps = {
|
||||
proStatus: { '0': '正常', '1': '部分转生产', '2': '全部转生产' },
|
||||
// 行状态
|
||||
orderItemStatus: { '0': '正常', '1': '部分转产', '2': '全部转产', '9': '关闭' },
|
||||
// 参数类别
|
||||
paramType: { '1': '温度', '2': '压力', '3': '时间', '4': '速度' },
|
||||
// 启用状态
|
||||
enabledStatus: { '1': '启用', '2': '未启用' },
|
||||
};
|
||||
|
||||
// 根据映射自动生成下拉选项
|
||||
// 根据映射自动生成下拉选项(使用id和fullName字段)
|
||||
export const dictOptions = {};
|
||||
export const dictProps = { label: "fullName", value: "id" };
|
||||
|
||||
for (const key in dictMaps) {
|
||||
const map = dictMaps[key];
|
||||
dictOptions[key] = Object.entries(map).map(([enCode, fullName]) => ({ enCode, fullName }));
|
||||
// id保持为字符串类型,与字典映射的键类型保持一致
|
||||
dictOptions[key] = Object.entries(map).map(([id, fullName]) => ({ id, fullName }));
|
||||
}
|
||||
|
||||
// 获取显示名称
|
||||
export function getLabel(type, value) {
|
||||
const map = dictMaps[type];
|
||||
return map ? (map[value] || value) : value;
|
||||
if (!map) return value;
|
||||
// 确保value是字符串类型,以便正确匹配字典映射
|
||||
return map[String(value)] || value;
|
||||
}
|
||||
|
||||
// 快捷导出常用选项
|
||||
export const paramTypeOptions = dictOptions.paramType;
|
||||
export const enabledStatusOptions = dictOptions.enabledStatus;
|
||||
|
||||
|
||||
|
||||
265
jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue
Normal file
265
jnpf-java-boot/jnpf-web/src/views/example/machineparam/form.vue
Normal file
@ -0,0 +1,265 @@
|
||||
<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="procCd">
|
||||
<JnpfSelect v-model="dataForm.procCd" placeholder="请选择工序" :options="procOptions" :props="procProps" clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="matCode">
|
||||
<JnpfSelect v-model="dataForm.matCode" placeholder="请选择物料" :options="materialOptions" :props="materialProps" clearable :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="spec">
|
||||
<JnpfInput v-model="dataForm.spec" placeholder="请输入规格型号" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
<el-form-item label="机台编码" prop="machineCd">
|
||||
<JnpfSelect v-model="dataForm.machineCd" placeholder="请选择机台" :options="machineOptions" :props="machineProps" clearable :disabled="!!dataForm.id" :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: 'formRef',
|
||||
eventType: '',
|
||||
dataForm: {
|
||||
id: '',
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procId: undefined,
|
||||
matCode: undefined,
|
||||
matName: undefined,
|
||||
mateId: undefined,
|
||||
spec: undefined,
|
||||
machineCd: undefined,
|
||||
machineName: undefined,
|
||||
machineId: undefined,
|
||||
enabledStatus: 1,
|
||||
remark: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
procCd: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择工序',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
matCode: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择物料',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
machineCd: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择机台',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
enabledStatus: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择状态',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
},
|
||||
enabledStatusOptions: [
|
||||
{ fullName: "启用", id: 1 },
|
||||
{ fullName: "未启用", id: 2 },
|
||||
],
|
||||
enabledStatusProps: { label: "fullName", value: "id" },
|
||||
procList: [],
|
||||
materialList: [],
|
||||
machineList: [],
|
||||
procOptions: [],
|
||||
materialOptions: [],
|
||||
machineOptions: [],
|
||||
procProps: { label: "label", value: "value" },
|
||||
materialProps: { label: "label", value: "value" },
|
||||
machineProps: { label: "label", value: "value" },
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
},
|
||||
created() {
|
||||
this.loadBaseData();
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
this.dialogVisible = true;
|
||||
this.loading = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.formRef) {
|
||||
this.$refs.formRef.resetFields();
|
||||
}
|
||||
|
||||
if (this.dataForm.id) {
|
||||
request({
|
||||
url: `/api/example/machineparam/${this.dataForm.id}`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataForm = res.data;
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.resetFormData();
|
||||
}
|
||||
});
|
||||
},
|
||||
resetFormData() {
|
||||
this.dataForm = {
|
||||
id: '',
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procId: undefined,
|
||||
matCode: undefined,
|
||||
matName: undefined,
|
||||
mateId: undefined,
|
||||
spec: undefined,
|
||||
machineCd: undefined,
|
||||
machineName: undefined,
|
||||
machineId: undefined,
|
||||
enabledStatus: 1,
|
||||
remark: undefined,
|
||||
};
|
||||
},
|
||||
loadBaseData() {
|
||||
this.loadProcList();
|
||||
this.loadMaterialList();
|
||||
this.loadMachineList();
|
||||
},
|
||||
loadProcList() {
|
||||
request({
|
||||
url: `/api/example/proc/getProcList`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.procList = res.data || [];
|
||||
this.procOptions = this.procList.map(item => ({
|
||||
label: `${item.procCd} - ${item.procName}`,
|
||||
value: item.procCd,
|
||||
procName: item.procName,
|
||||
id: item.id
|
||||
}));
|
||||
});
|
||||
},
|
||||
loadMaterialList() {
|
||||
request({
|
||||
url: `/api/example/material/getMaterialList`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.materialList = res.data || [];
|
||||
this.materialOptions = this.materialList.map(item => ({
|
||||
label: `${item.matCode} - ${item.matName}`,
|
||||
value: item.matCode,
|
||||
matName: item.matName,
|
||||
id: item.id,
|
||||
spec: item.spec
|
||||
}));
|
||||
});
|
||||
},
|
||||
loadMachineList() {
|
||||
request({
|
||||
url: `/api/example/machine/getMachineList`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.machineList = res.data || [];
|
||||
this.machineOptions = this.machineList.map(item => ({
|
||||
label: `${item.machineCd} - ${item.machineName}`,
|
||||
value: item.machineCd,
|
||||
machineName: item.machineName,
|
||||
id: item.id
|
||||
}));
|
||||
});
|
||||
},
|
||||
dataFormSubmit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.btnLoading = true;
|
||||
const isEdit = !!this.dataForm.id;
|
||||
const url = isEdit ? `/api/example/machineparam/${this.dataForm.id}` : '/api/example/machineparam';
|
||||
const method = isEdit ? 'put' : 'post';
|
||||
|
||||
const proc = this.procOptions.find(item => item.value === this.dataForm.procCd);
|
||||
const material = this.materialOptions.find(item => item.value === this.dataForm.matCode);
|
||||
const machine = this.machineOptions.find(item => item.value === this.dataForm.machineCd);
|
||||
|
||||
const submitData = {
|
||||
...this.dataForm,
|
||||
procName: proc ? proc.procName : undefined,
|
||||
procId: proc ? proc.id : undefined,
|
||||
matName: material ? material.matName : undefined,
|
||||
mateId: material ? material.id : undefined,
|
||||
machineName: machine ? machine.machineName : undefined,
|
||||
machineId: machine ? machine.id : undefined,
|
||||
};
|
||||
|
||||
request({
|
||||
url: url,
|
||||
method: method,
|
||||
data: submitData
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.btnLoading = false;
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh', false)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
196
jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue
Normal file
196
jnpf-java-boot/jnpf-web/src/views/example/machineparam/index.vue
Normal file
@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div class="JNPF-common-layout machineparam_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.machineName" 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.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="machineName" label="机台名称" align="center"/>
|
||||
<el-table-column prop="matName" label="产品名称" align="center"/>
|
||||
<el-table-column prop="spec" label="规格型号" align="center"/>
|
||||
<el-table-column prop="procName" 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="createUserName" label="创建人" align="center"/>
|
||||
<el-table-column prop="creatorTime" label="创建时间" align="center" :formatter="jnpf.tableDateFormat1"/>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="handleDetail(scope.row.id)">详情</el-button>
|
||||
<el-button type="text" @click="handleDelete(scope.row.id)" style="color: #f56c6c;">删除</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" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import { mapGetters } from "vuex";
|
||||
import JNPFForm from "./form";
|
||||
import jnpf from "@/utils/jnpf";
|
||||
|
||||
export default {
|
||||
name: "machineparam",
|
||||
components: {
|
||||
JNPFForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
query: {
|
||||
machineName: undefined,
|
||||
matName: undefined,
|
||||
spec: undefined,
|
||||
enabledStatus: undefined,
|
||||
},
|
||||
defListQuery: {
|
||||
sort: "desc",
|
||||
sidx: "",
|
||||
},
|
||||
list: [],
|
||||
listLoading: false,
|
||||
multipleSelection: [],
|
||||
total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "",
|
||||
sidx: "",
|
||||
},
|
||||
formVisible: false,
|
||||
enabledStatusOptions: [
|
||||
{ fullName: "启用", id: 1 },
|
||||
{ fullName: "未启用", id: 2 },
|
||||
],
|
||||
enabledStatusProps: { label: "fullName", value: "id" },
|
||||
specOptions: [],
|
||||
specProps: { label: "spec", value: "spec" },
|
||||
};
|
||||
},
|
||||
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,
|
||||
};
|
||||
request({
|
||||
url: `/api/example/machineparam/getList`,
|
||||
method: "post",
|
||||
data: _query,
|
||||
}).then((res) => {
|
||||
this.list = res.data.list || [];
|
||||
this.total = res.data.pagination.total;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
addOrUpdateHandle(id) {
|
||||
this.formVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id);
|
||||
});
|
||||
},
|
||||
handleDetail(id) {
|
||||
this.formVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id, 'detail');
|
||||
});
|
||||
},
|
||||
handleDelete(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/example/machineparam/${id}`,
|
||||
method: 'delete'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.initData();
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
search() {
|
||||
this.listQuery.currentPage = 1;
|
||||
this.listQuery.pageSize = 20;
|
||||
this.initData();
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false;
|
||||
if (isrRefresh) this.search();
|
||||
},
|
||||
reset() {
|
||||
this.query = {
|
||||
machineName: undefined,
|
||||
matName: undefined,
|
||||
spec: undefined,
|
||||
enabledStatus: undefined,
|
||||
};
|
||||
this.search();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
231
jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue
Normal file
231
jnpf-java-boot/jnpf-web/src/views/example/procparam/form.vue
Normal file
@ -0,0 +1,231 @@
|
||||
NEW_FILE_CODE
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新建' : '编辑'"
|
||||
:visible.sync="dialogVisible"
|
||||
width="700px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px" label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工序" prop="procCd">
|
||||
<el-select v-model="dataForm.procCd" placeholder="请选择工序" filterable @change="handleProcChange" :disabled="!!dataForm.id" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in procList"
|
||||
:key="item.procCd"
|
||||
:label="`${item.procCd} - ${item.procName}`"
|
||||
:value="item.procCd">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数类别" prop="procParamType">
|
||||
<JnpfSelect v-model="dataForm.procParamType" placeholder="请选择参数类别" :options="paramTypeOptions" :props="paramTypeProps" :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数名称" prop="procParamName">
|
||||
<el-input v-model="dataForm.procParamName" placeholder="请输入参数名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数单位" prop="procParamUnit">
|
||||
<JnpfInput v-model="dataForm.procParamUnit" placeholder="请输入参数单位" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="启用状态" prop="enabledStatus">
|
||||
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择状态" :options="enabledStatusOptions" :props="enabledStatusProps" :style="{ width: '100%' }">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { paramTypeOptions, enabledStatusOptions, dictProps } from '../common/dict'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: 'formRef',
|
||||
eventType: '',
|
||||
dataForm: {
|
||||
id: '',
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procParamName: undefined,
|
||||
procParamUnit: undefined,
|
||||
procParamType: undefined,
|
||||
enabledStatus: '1',
|
||||
remark: undefined,
|
||||
procId: undefined,
|
||||
},
|
||||
dataRule: {
|
||||
procCd: [
|
||||
{
|
||||
required: true,
|
||||
message: '工序编码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
procParamName: [
|
||||
{
|
||||
required: true,
|
||||
message: '参数名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
procParamType: [
|
||||
{
|
||||
required: true,
|
||||
message: '参数类别不能为空',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
enabledStatus: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择状态',
|
||||
trigger: 'change',
|
||||
},
|
||||
],
|
||||
},
|
||||
paramTypeOptions: paramTypeOptions,
|
||||
paramTypeProps: dictProps,
|
||||
enabledStatusOptions: enabledStatusOptions,
|
||||
enabledStatusProps: dictProps,
|
||||
procList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
},
|
||||
created() {
|
||||
this.loadProcList();
|
||||
},
|
||||
methods: {
|
||||
loadProcList() {
|
||||
request({
|
||||
url: `/api/example/proc/getProcList`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.procList = res.data || [];
|
||||
});
|
||||
},
|
||||
handleProcChange(val) {
|
||||
const proc = this.procList.find(item => item.procCd === val);
|
||||
if (proc) {
|
||||
this.dataForm.procName = proc.procName;
|
||||
this.dataForm.procId = proc.id;
|
||||
}
|
||||
},
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
this.dialogVisible = true;
|
||||
this.loading = true;
|
||||
|
||||
if (this.$refs.formRef) {
|
||||
this.$refs.formRef.resetFields();
|
||||
}
|
||||
|
||||
if (this.dataForm.id) {
|
||||
request({
|
||||
url: `/api/example/procparam/${this.dataForm.id}`,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataForm = res.data;
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.resetFormData();
|
||||
}
|
||||
},
|
||||
resetFormData() {
|
||||
this.dataForm = {
|
||||
id: '',
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procParamName: undefined,
|
||||
procParamUnit: undefined,
|
||||
procParamType: undefined,
|
||||
enabledStatus: '1',
|
||||
remark: undefined,
|
||||
procId: undefined,
|
||||
};
|
||||
},
|
||||
dataFormSubmit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.doSubmit();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
doSubmit() {
|
||||
this.btnLoading = true;
|
||||
const isEdit = !!this.dataForm.id;
|
||||
const url = isEdit ? `/api/example/procparam/${this.dataForm.id}` : '/api/example/procparam';
|
||||
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.dialogVisible = false;
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogVisible = false;
|
||||
this.$emit('refresh', false)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
203
jnpf-java-boot/jnpf-web/src/views/example/procparam/index.vue
Normal file
203
jnpf-java-boot/jnpf-web/src/views/example/procparam/index.vue
Normal file
@ -0,0 +1,203 @@
|
||||
NEW_FILE_CODE
|
||||
<template>
|
||||
<div class="JNPF-common-layout procparam_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.procName" placeholder="请输入" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="参数类别">
|
||||
<JnpfSelect v-model="query.procParamType" placeholder="请选择" clearable :options="paramTypeOptions"
|
||||
:props="paramTypeProps">
|
||||
</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 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="procCd" label="工序编码" align="center"/>
|
||||
<el-table-column prop="procName" label="工序名称" align="center"/>
|
||||
<el-table-column prop="procParamName" label="参数名称" align="center"/>
|
||||
<el-table-column prop="procParamUnit" label="参数单位" align="center"/>
|
||||
<el-table-column prop="procParamType" label="参数类别" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ getParamTypeName(scope.row.procParamType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="enabledStatus" label="状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="String(scope.row.enabledStatus) === '1' ? 'success' : 'info'" size="small">
|
||||
{{ getLabel('enabledStatus', scope.row.enabledStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" align="center"/>
|
||||
<el-table-column prop="createUserName" label="创建人" align="center"/>
|
||||
<el-table-column prop="creatorTime" label="创建时间" align="center" :formatter="jnpf.tableDateFormat1"/>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
|
||||
<!-- <el-button type="text" @click="handleDelete(scope.row.id)" style="color: #f56c6c;">删除</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" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import { mapGetters } from "vuex";
|
||||
import JNPFForm from "./form";
|
||||
import jnpf from "@/utils/jnpf";
|
||||
import { paramTypeOptions, enabledStatusOptions, dictProps, getLabel as getDictLabel } from "../common/dict";
|
||||
|
||||
export default {
|
||||
name: "procparam",
|
||||
components: {
|
||||
JNPFForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
query: {
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procParamName: undefined,
|
||||
procParamType: undefined,
|
||||
enabledStatus: undefined,
|
||||
},
|
||||
defListQuery: {
|
||||
sort: "desc",
|
||||
sidx: "",
|
||||
},
|
||||
list: [],
|
||||
listLoading: false,
|
||||
multipleSelection: [],
|
||||
total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "",
|
||||
sidx: "",
|
||||
},
|
||||
formVisible: false,
|
||||
paramTypeOptions: paramTypeOptions,
|
||||
paramTypeProps: dictProps,
|
||||
enabledStatusOptions: enabledStatusOptions,
|
||||
enabledStatusProps: dictProps,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
jnpf() {
|
||||
return jnpf
|
||||
},
|
||||
...mapGetters(["userInfo"]),
|
||||
menuId() {
|
||||
return this.$route.meta.modelId || "";
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
getParamTypeName(type) {
|
||||
return getDictLabel('paramType', type);
|
||||
},
|
||||
getLabel(type, value) {
|
||||
return getDictLabel(type, value);
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true;
|
||||
let _query = {
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
dataType: 0,
|
||||
};
|
||||
request({
|
||||
url: `/api/example/procparam/getList`,
|
||||
method: "post",
|
||||
data: _query,
|
||||
}).then((res) => {
|
||||
this.list = res.data.list || [];
|
||||
this.total = res.data.pagination.total;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
addOrUpdateHandle(id) {
|
||||
this.formVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id);
|
||||
});
|
||||
},
|
||||
handleDelete(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/example/procparam/${id}`,
|
||||
method: 'delete'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.initData();
|
||||
}
|
||||
});
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
search() {
|
||||
this.listQuery.currentPage = 1;
|
||||
this.listQuery.pageSize = 20;
|
||||
this.initData();
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false;
|
||||
if (isrRefresh) this.search();
|
||||
},
|
||||
reset() {
|
||||
this.query = {
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
procParamName: undefined,
|
||||
procParamType: undefined,
|
||||
enabledStatus: undefined,
|
||||
};
|
||||
this.search();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user