feat(biz): 优化机台和工序参数配置功能
This commit is contained in:
parent
d8f645e00a
commit
a7e9b2dab3
@ -1,5 +1,6 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
@ -14,6 +15,8 @@ import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparam.MachineP
|
|||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparamdetail.MachineParamDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparamdetail.MachineParamDetailDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.service.machineparam.MachineParamService;
|
import com.ningxia.yunxi.chemmes.module.biz.service.machineparam.MachineParamService;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.service.machineparamdetail.MachineParamDetailService;
|
import com.ningxia.yunxi.chemmes.module.biz.service.machineparamdetail.MachineParamDetailService;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.system.service.user.AdminUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -42,6 +45,9 @@ public class MachineParamController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MachineParamDetailService machineParamDetailService;
|
private MachineParamDetailService machineParamDetailService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService userService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建机台工艺参数配置")
|
@Operation(summary = "创建机台工艺参数配置")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:machine-param:create')")
|
@PreAuthorize("@ss.hasPermission('biz:machine-param:create')")
|
||||||
@ -83,7 +89,17 @@ public class MachineParamController {
|
|||||||
@PreAuthorize("@ss.hasPermission('biz:machine-param:query')")
|
@PreAuthorize("@ss.hasPermission('biz:machine-param:query')")
|
||||||
public CommonResult<PageResult<MachineParamRespVO>> getMachineParamPage(@Valid MachineParamPageReqVO pageReqVO) {
|
public CommonResult<PageResult<MachineParamRespVO>> getMachineParamPage(@Valid MachineParamPageReqVO pageReqVO) {
|
||||||
PageResult<MachineParamDO> pageResult = machineParamService.getMachineParamPage(pageReqVO);
|
PageResult<MachineParamDO> pageResult = machineParamService.getMachineParamPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, MachineParamRespVO.class));
|
PageResult<MachineParamRespVO> voPageResult = BeanUtils.toBean(pageResult, MachineParamRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(voPageResult.getList())) {
|
||||||
|
voPageResult.getList().forEach(item -> {
|
||||||
|
AdminUserDO userEntity = userService.getUser(Long.valueOf(item.getCreator()));
|
||||||
|
if (userEntity != null) {
|
||||||
|
item.setCreator(userEntity.getUsername());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(voPageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@ -76,4 +76,6 @@ public class MachineParamRespVO {
|
|||||||
@Schema(description = "工艺参数明细列表")
|
@Schema(description = "工艺参数明细列表")
|
||||||
private List<MachineParamDetailRespVO> details;
|
private List<MachineParamDetailRespVO> details;
|
||||||
|
|
||||||
|
private String creator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
@ -11,6 +12,8 @@ import com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam.vo.ProcPa
|
|||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam.vo.ProcParamSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam.vo.ProcParamSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.procparam.ProcParamDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.procparam.ProcParamDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.service.procparam.ProcParamService;
|
import com.ningxia.yunxi.chemmes.module.biz.service.procparam.ProcParamService;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.system.service.user.AdminUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -36,6 +39,10 @@ public class ProcParamController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ProcParamService procParamService;
|
private ProcParamService procParamService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService userService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建工序工艺参数配置")
|
@Operation(summary = "创建工序工艺参数配置")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:proc-param:create')")
|
@PreAuthorize("@ss.hasPermission('biz:proc-param:create')")
|
||||||
@ -74,7 +81,16 @@ public class ProcParamController {
|
|||||||
@PreAuthorize("@ss.hasPermission('biz:proc-param:query')")
|
@PreAuthorize("@ss.hasPermission('biz:proc-param:query')")
|
||||||
public CommonResult<PageResult<ProcParamRespVO>> getProcParamPage(@Valid ProcParamPageReqVO pageReqVO) {
|
public CommonResult<PageResult<ProcParamRespVO>> getProcParamPage(@Valid ProcParamPageReqVO pageReqVO) {
|
||||||
PageResult<ProcParamDO> pageResult = procParamService.getProcParamPage(pageReqVO);
|
PageResult<ProcParamDO> pageResult = procParamService.getProcParamPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ProcParamRespVO.class));
|
PageResult<ProcParamRespVO> voPageResult = BeanUtils.toBean(pageResult, ProcParamRespVO.class);
|
||||||
|
if (CollUtil.isNotEmpty(voPageResult.getList())) {
|
||||||
|
voPageResult.getList().forEach(item -> {
|
||||||
|
AdminUserDO userEntity = userService.getUser(Long.valueOf(item.getCreator()));
|
||||||
|
if (userEntity != null) {
|
||||||
|
item.setCreator(userEntity.getUsername());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return success(voPageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam.vo;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.procparam.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import lombok.*;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import java.util.*;
|
|
||||||
import java.util.*;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.alibaba.excel.annotation.*;
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.excel.core.annotations.DictFormat;
|
import com.ningxia.yunxi.chemmes.framework.excel.core.annotations.DictFormat;
|
||||||
import com.ningxia.yunxi.chemmes.framework.excel.core.convert.DictConvert;
|
import com.ningxia.yunxi.chemmes.framework.excel.core.convert.DictConvert;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 工序工艺参数配置 Response VO")
|
@Schema(description = "管理后台 - 工序工艺参数配置 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ -54,7 +53,9 @@ public class ProcParamRespVO {
|
|||||||
|
|
||||||
@Schema(description = "参数类别(1 温度 2压力 3 时间 4速度)", example = "1")
|
@Schema(description = "参数类别(1 温度 2压力 3 时间 4速度)", example = "1")
|
||||||
@ExcelProperty(value = "参数类别(1 温度 2压力 3 时间 4速度)", converter = DictConvert.class)
|
@ExcelProperty(value = "参数类别(1 温度 2压力 3 时间 4速度)", converter = DictConvert.class)
|
||||||
@DictFormat("param_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
@DictFormat("param_type")
|
||||||
private String procParamType;
|
private String procParamType;
|
||||||
|
|
||||||
}
|
private String creator;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.procparam;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.procparam;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@ -36,4 +37,11 @@ public interface ProcParamMapper extends BaseMapperX<ProcParamDO> {
|
|||||||
.like(ProcParamDO::getProcCd, keyWord))
|
.like(ProcParamDO::getProcCd, keyWord))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default ProcParamDO selectByProcIdAndParamTypeAndParamName(Integer procId, String procParamType, String procParamName) {
|
||||||
|
return selectOne(new LambdaQueryWrapper<ProcParamDO>()
|
||||||
|
.eq(ProcParamDO::getProcId, procId)
|
||||||
|
.eq(ProcParamDO::getProcParamType, procParamType)
|
||||||
|
.eq(ProcParamDO::getProcParamName, procParamName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,11 +51,13 @@ public class MachineParamServiceImpl implements MachineParamService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public void deleteMachineParam(Integer id) {
|
public void deleteMachineParam(Integer id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateMachineParamExists(id);
|
validateMachineParamExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
machineParamMapper.deleteById(id);
|
machineParamMapper.deleteById(id);
|
||||||
|
machineParamDetailService.deleteByMachineParamId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateMachineParamExists(Integer id) {
|
private void validateMachineParamExists(Integer id) {
|
||||||
|
|||||||
@ -56,4 +56,6 @@ public interface MachineParamDetailService {
|
|||||||
void saveMachineParamDetails(Integer id, List<MachineParamDetailSaveReqVO> details);
|
void saveMachineParamDetails(Integer id, List<MachineParamDetailSaveReqVO> details);
|
||||||
|
|
||||||
List<MachineParamDetailDO> getListByMachineParamId(Integer id);
|
List<MachineParamDetailDO> getListByMachineParamId(Integer id);
|
||||||
|
|
||||||
|
void deleteByMachineParamId(Integer machineParamId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,5 +81,10 @@ public class MachineParamDetailServiceImpl implements MachineParamDetailService
|
|||||||
public List<MachineParamDetailDO> getListByMachineParamId(Integer machineParamId) {
|
public List<MachineParamDetailDO> getListByMachineParamId(Integer machineParamId) {
|
||||||
return machineParamDetailMapper.selectListByMachineParamId(machineParamId);
|
return machineParamDetailMapper.selectListByMachineParamId(machineParamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByMachineParamId(Integer machineParamId) {
|
||||||
|
machineParamDetailMapper.deleteByMachineParamId(machineParamId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工序工艺参数配置 Service 实现类
|
* 工序工艺参数配置 Service 实现类
|
||||||
*
|
*
|
||||||
@ -27,6 +29,7 @@ public class ProcParamServiceImpl implements ProcParamService {
|
|||||||
@Override
|
@Override
|
||||||
public Integer createProcParam(ProcParamSaveReqVO createReqVO) {
|
public Integer createProcParam(ProcParamSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
|
validateProcParamUnique(createReqVO);
|
||||||
ProcParamDO procParam = BeanUtils.toBean(createReqVO, ProcParamDO.class);
|
ProcParamDO procParam = BeanUtils.toBean(createReqVO, ProcParamDO.class);
|
||||||
procParamMapper.insert(procParam);
|
procParamMapper.insert(procParam);
|
||||||
// 返回
|
// 返回
|
||||||
@ -37,6 +40,7 @@ public class ProcParamServiceImpl implements ProcParamService {
|
|||||||
public void updateProcParam(ProcParamSaveReqVO updateReqVO) {
|
public void updateProcParam(ProcParamSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateProcParamExists(updateReqVO.getId());
|
validateProcParamExists(updateReqVO.getId());
|
||||||
|
validateProcParamUnique(updateReqVO);
|
||||||
// 更新
|
// 更新
|
||||||
ProcParamDO updateObj = BeanUtils.toBean(updateReqVO, ProcParamDO.class);
|
ProcParamDO updateObj = BeanUtils.toBean(updateReqVO, ProcParamDO.class);
|
||||||
procParamMapper.updateById(updateObj);
|
procParamMapper.updateById(updateObj);
|
||||||
@ -52,7 +56,18 @@ public class ProcParamServiceImpl implements ProcParamService {
|
|||||||
|
|
||||||
private void validateProcParamExists(Integer id) {
|
private void validateProcParamExists(Integer id) {
|
||||||
if (procParamMapper.selectById(id) == null) {
|
if (procParamMapper.selectById(id) == null) {
|
||||||
// throw exception(PROC_PARAM_NOT_EXISTS);
|
throw exception("参数不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateProcParamUnique(ProcParamSaveReqVO saveReqVO) {
|
||||||
|
ProcParamDO existParam = procParamMapper.selectByProcIdAndParamTypeAndParamName(
|
||||||
|
saveReqVO.getProcId(),
|
||||||
|
saveReqVO.getProcParamType(),
|
||||||
|
saveReqVO.getProcParamName());
|
||||||
|
|
||||||
|
if (existParam != null && !existParam.getId().equals(saveReqVO.getId())) {
|
||||||
|
throw exception("同一工序下同一参数类别的参数名称不能重复");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,8 @@
|
|||||||
<el-table-column label="序号" width="60px" align="center" type="index" />
|
<el-table-column label="序号" width="60px" align="center" type="index" />
|
||||||
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
||||||
<el-table-column label="机台名称" align="center" prop="machineName" />
|
<el-table-column label="机台名称" align="center" prop="machineName" />
|
||||||
<el-table-column label="创建人" align="center" prop="createBy" />
|
<el-table-column label="创建人" align="center" prop="creator" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter2" />
|
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="confirmSelection" type="primary">确 定</el-button>
|
<el-button @click="confirmSelection" type="primary">确 定</el-button>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, nextTick } from 'vue'
|
import { ref, reactive, nextTick } from 'vue'
|
||||||
import { dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as MachineApi from '@/api/biz/machine'
|
import * as MachineApi from '@/api/biz/machine'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|||||||
@ -109,32 +109,44 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="standardValue" label="标准值(*)" >
|
<el-table-column prop="standardValue" label="标准值(*)" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model.number="scope.row.standardValue" placeholder="标准值" size="small" />
|
<el-input
|
||||||
|
v-model="scope.row.standardValue"
|
||||||
|
size="small"
|
||||||
|
@input="(val) => handleNumberInput(val, scope.row, 'standardValue')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="lowerLimit" label="下限(*)" >
|
<el-table-column prop="lowerLimit" label="下限(*)" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model.number="scope.row.lowerLimit" placeholder="下限" size="small" />
|
<el-input
|
||||||
|
v-model="scope.row.lowerLimit"
|
||||||
|
size="small"
|
||||||
|
@input="(val) => handleNumberInput(val, scope.row, 'lowerLimit')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="upperLimit" label="上限(*)">
|
<el-table-column prop="upperLimit" label="上限(*)" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model.number="scope.row.upperLimit" placeholder="上限" size="small" />
|
<el-input
|
||||||
|
v-model="scope.row.upperLimit"
|
||||||
|
size="small"
|
||||||
|
@input="(val) => handleNumberInput(val, scope.row, 'upperLimit')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="dev" label="偏差">
|
<el-table-column prop="dev" label="偏差" width="90" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model="scope.row.dev" placeholder="偏差" size="small" />
|
<el-input v-model="scope.row.dev" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="procParamUnit" label="单位(*)">
|
<el-table-column prop="procParamUnit" label="单位(*)" width="80" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model="scope.row.procParamUnit" placeholder="单位" size="small" />
|
<el-input v-model="scope.row.procParamUnit" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="isAlert" label="预警(*)">
|
<el-table-column prop="isAlert" label="预警(*)" width="80" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-select v-model="scope.row.isAlert" placeholder="选择" size="small">
|
<el-select v-model="scope.row.isAlert" placeholder="选择" size="small">
|
||||||
<el-option label="是" value="0" />
|
<el-option label="是" value="0" />
|
||||||
@ -142,14 +154,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="remark" label="备注">
|
<el-table-column prop="remark" label="备注" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input v-model="scope.row.remark" placeholder="备注" size="small" />
|
<el-input v-model="scope.row.remark" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="60">
|
<el-table-column label="操作" width="60" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="text" size="small" @click="removeParamRow(scope.$index)">删除</el-button>
|
<div style="display: flex; justify-content: center; align-items: center; width: 100%; height: 100%;">
|
||||||
|
<el-button type="text" size="small" @click="removeParamRow(scope.$index)">删除</el-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -182,9 +196,9 @@ interface ParamDetail {
|
|||||||
procParamName: string
|
procParamName: string
|
||||||
procParamUnit: string
|
procParamUnit: string
|
||||||
procParamId?: number
|
procParamId?: number
|
||||||
standardValue: number
|
standardValue: string | number
|
||||||
upperLimit: number
|
upperLimit: string | number
|
||||||
lowerLimit: number
|
lowerLimit: string | number
|
||||||
dev: string
|
dev: string
|
||||||
isAlert: string
|
isAlert: string
|
||||||
remark: string
|
remark: string
|
||||||
@ -336,15 +350,40 @@ const addParamRow = () => {
|
|||||||
paramDetailList.value.push({
|
paramDetailList.value.push({
|
||||||
procParamName: '',
|
procParamName: '',
|
||||||
procParamUnit: '',
|
procParamUnit: '',
|
||||||
standardValue: 0,
|
standardValue: undefined,
|
||||||
upperLimit: 0,
|
upperLimit: undefined,
|
||||||
lowerLimit: 0,
|
lowerLimit: undefined,
|
||||||
dev: '',
|
dev: '',
|
||||||
isAlert: '1',
|
isAlert: '1',
|
||||||
remark: ''
|
remark: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 数值输入限制,支持负数,小数点后最多两位 */
|
||||||
|
const handleNumberInput = (val: string, row: ParamDetail, field: 'standardValue' | 'lowerLimit' | 'upperLimit') => {
|
||||||
|
// 保留负号(只能在开头)、数字和小数点
|
||||||
|
let filtered = val.replace(/[^\d.\-]/g, '')
|
||||||
|
// 负号只能在开头,且只能有一个
|
||||||
|
if (filtered.includes('-')) {
|
||||||
|
filtered = '-' + filtered.replace(/-/g, '')
|
||||||
|
}
|
||||||
|
// 小数点只能有一个
|
||||||
|
filtered = filtered.replace(/\.{2,}/g, '.').replace(/^(\d*\.)\./g, '$1')
|
||||||
|
// 处理开头为小数点的情况,自动补0
|
||||||
|
let result = filtered.startsWith('.') ? '0' + filtered : filtered
|
||||||
|
// 处理负号后直接跟小数点的情况
|
||||||
|
if (result.startsWith('-') && result.charAt(1) === '.') {
|
||||||
|
result = '-0' + result.substring(1)
|
||||||
|
}
|
||||||
|
// 最多保留2位小数
|
||||||
|
const parts = result.split('.')
|
||||||
|
if (parts.length > 1 && parts[1].length > 2) {
|
||||||
|
row[field] = parts[0] + '.' + parts[1].substring(0, 2)
|
||||||
|
} else {
|
||||||
|
row[field] = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除工艺参数行 */
|
/** 删除工艺参数行 */
|
||||||
const removeParamRow = (index: number) => {
|
const removeParamRow = (index: number) => {
|
||||||
paramDetailList.value.splice(index, 1)
|
paramDetailList.value.splice(index, 1)
|
||||||
@ -357,6 +396,12 @@ const handleProcChange = (val: number) => {
|
|||||||
formData.procCd = proc.procCd
|
formData.procCd = proc.procCd
|
||||||
formData.procName = proc.procName
|
formData.procName = proc.procName
|
||||||
}
|
}
|
||||||
|
// 清空机台选择
|
||||||
|
formData.machineId = undefined
|
||||||
|
formData.machineCd = ''
|
||||||
|
formData.machineName = ''
|
||||||
|
// 清空工艺参数详情列表
|
||||||
|
paramDetailList.value = []
|
||||||
// 根据工序加载机台下拉选项
|
// 根据工序加载机台下拉选项
|
||||||
loadMachineOptions(val)
|
loadMachineOptions(val)
|
||||||
loadProcParamOptions(val)
|
loadProcParamOptions(val)
|
||||||
@ -389,7 +434,7 @@ const handleProcParamChange = (val: number, row: ParamDetail) => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (isDuplicate) {
|
if (isDuplicate) {
|
||||||
message.warning('该工艺参数已被选择,请选择其他参数')
|
message.warning('工艺参数名称不能重复')
|
||||||
row.procParamId = undefined
|
row.procParamId = undefined
|
||||||
row.procParamName = ''
|
row.procParamName = ''
|
||||||
row.procParamUnit = ''
|
row.procParamUnit = ''
|
||||||
@ -416,29 +461,32 @@ const submitForm = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const param of paramDetailList.value) {
|
for (let i = 0; i < paramDetailList.value.length; i++) {
|
||||||
|
const param = paramDetailList.value[i]
|
||||||
|
const rowNum = i + 1
|
||||||
|
|
||||||
if (!param.procParamId) {
|
if (!param.procParamId) {
|
||||||
message.warning('请选择工艺参数')
|
message.warning(`第 ${rowNum} 行工艺参数名称不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (param.standardValue === undefined || param.standardValue === null) {
|
if (!param.standardValue && param.standardValue !== 0) {
|
||||||
message.warning('请填写标准值')
|
message.warning(`第 ${rowNum} 行标准值不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (param.lowerLimit === undefined || param.lowerLimit === null) {
|
if (!param.lowerLimit && param.lowerLimit !== 0) {
|
||||||
message.warning('请填写下限值')
|
message.warning(`第 ${rowNum} 行下限值不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (param.upperLimit === undefined || param.upperLimit === null) {
|
if (!param.upperLimit && param.upperLimit !== 0) {
|
||||||
message.warning('请填写上限值')
|
message.warning(`第 ${rowNum} 行上限值不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!param.procParamUnit) {
|
if (!param.procParamUnit) {
|
||||||
message.warning('请填写单位')
|
message.warning(`第 ${rowNum} 行单位不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!param.isAlert) {
|
if (!param.isAlert) {
|
||||||
message.warning('请选择是否预警')
|
message.warning(`第 ${rowNum} 行是否预警不能为空`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -447,7 +495,7 @@ const submitForm = async () => {
|
|||||||
const paramIds = paramDetailList.value.map(item => item.procParamId).filter(id => id)
|
const paramIds = paramDetailList.value.map(item => item.procParamId).filter(id => id)
|
||||||
const uniqueIds = [...new Set(paramIds)]
|
const uniqueIds = [...new Set(paramIds)]
|
||||||
if (paramIds.length !== uniqueIds.length) {
|
if (paramIds.length !== uniqueIds.length) {
|
||||||
message.warning('存在重复选择的工艺参数,请确保每个参数只选择一次')
|
message.warning('工艺参数名称不能重复')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,13 +557,14 @@ onMounted(() => {
|
|||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
margin-right: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,25 @@
|
|||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="状态" prop="enabledStatus">
|
<el-form-item label="机台名称" prop="machineName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.machineName"
|
||||||
|
placeholder="请输入机台名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品名称" prop="matName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.matName"
|
||||||
|
placeholder="请输入产品名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="enabledStatus">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.enabledStatus"
|
v-model="queryParams.enabledStatus"
|
||||||
placeholder="请选择状态"
|
placeholder="请选择状态"
|
||||||
@ -23,24 +41,6 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="物料名称" prop="matName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.matName"
|
|
||||||
placeholder="请输入物料名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="机台名称" prop="machineName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.machineName"
|
|
||||||
placeholder="请输入机台名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-240px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
@ -88,14 +88,14 @@
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<!-- <el-button
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
v-hasPermi="['biz:machine-param:delete']"
|
v-hasPermi="['biz:machine-param:delete']"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<MachineParamForm ref="formRef" @success="getList" />
|
<MachineParamForm ref="formRef" @success="getList" @close="handleQuery"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
@ -7,77 +7,137 @@
|
|||||||
label-width="100px"
|
label-width="100px"
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
>
|
>
|
||||||
<el-form-item label="工序编码" prop="procCd">
|
<el-row :gutter="20">
|
||||||
<el-input v-model="formData.procCd" placeholder="请输入工序编码" />
|
<el-col :span="12">
|
||||||
</el-form-item>
|
<el-form-item label="工序" prop="procId" :disabled="formType === 'update'">
|
||||||
<el-form-item label="工序名称" prop="procName">
|
<el-select
|
||||||
<el-input v-model="formData.procName" placeholder="请输入工序名称" />
|
v-model="formData.procId"
|
||||||
</el-form-item>
|
placeholder="请选择工序"
|
||||||
<el-form-item label="状态" prop="enabledStatus">
|
filterable
|
||||||
<el-radio-group v-model="formData.enabledStatus">
|
@change="handleProcChange"
|
||||||
<el-radio
|
>
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="item in procOptions"
|
||||||
:label="dict.value"
|
:key="item.id"
|
||||||
>
|
:label="item.procName"
|
||||||
{{ dict.label }}
|
:value="item.id"
|
||||||
</el-radio>
|
/>
|
||||||
</el-radio-group>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="参数类别" prop="procParamType" >
|
||||||
|
<el-select v-model="formData.procParamType" placeholder="请选择参数类别">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.PARAM_TYPE)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="参数名称" prop="procParamName" >
|
||||||
|
<el-input v-model="formData.procParamName" placeholder="请输入参数名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="参数单位" prop="procParamUnit" >
|
||||||
|
<el-input v-model="formData.procParamUnit" placeholder="请输入参数单位" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="启用状态" prop="enabledStatus" >
|
||||||
|
<el-select v-model="formData.enabledStatus" placeholder="请选择状态">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
<el-input
|
||||||
</el-form-item>
|
v-model="formData.remark"
|
||||||
<el-form-item label="工序id" prop="procId">
|
placeholder="请输入备注"
|
||||||
<el-input v-model="formData.procId" placeholder="请输入工序id" />
|
type="textarea"
|
||||||
</el-form-item>
|
:rows="3"
|
||||||
<el-form-item label="参数名称" prop="procParamName">
|
/>
|
||||||
<el-input v-model="formData.procParamName" placeholder="请输入参数名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="参数单位" prop="procParamUnit">
|
|
||||||
<el-input v-model="formData.procParamUnit" placeholder="请输入参数单位" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="参数类别" prop="procParamType">
|
|
||||||
<el-select v-model="formData.procParamType" placeholder="请选择参数类别">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getStrDictOptions(DICT_TYPE.PARAM_TYPE)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">保存</el-button>
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import * as ProcParamApi from '@/api/biz/procparam'
|
import * as ProcParamApi from '@/api/biz/procparam'
|
||||||
|
import * as ProcApi from '@/api/biz/proc'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
import type { ProcVO } from '@/api/biz/proc'
|
||||||
const message = useMessage() // 消息弹窗
|
import { watch } from 'vue'
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const { t } = useI18n()
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const message = useMessage()
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const dialogVisible = ref(false)
|
||||||
const formData = ref({
|
const dialogTitle = ref('')
|
||||||
id: undefined,
|
const formLoading = ref(false)
|
||||||
procCd: undefined,
|
const formType = ref('')
|
||||||
procName: undefined,
|
|
||||||
enabledStatus: undefined,
|
// 工序下拉选项
|
||||||
remark: undefined,
|
const procOptions = ref<ProcVO[]>([])
|
||||||
procId: undefined,
|
|
||||||
procParamName: undefined,
|
const formData = reactive({
|
||||||
procParamUnit: undefined,
|
id: undefined as number | undefined,
|
||||||
procParamType: undefined,
|
procId: undefined as number | undefined,
|
||||||
|
procCd: '',
|
||||||
|
procName: '',
|
||||||
|
procParamName: '',
|
||||||
|
procParamUnit: '',
|
||||||
|
procParamType: '',
|
||||||
|
enabledStatus: 0,
|
||||||
|
remark: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
|
procId: [
|
||||||
|
{ required: true, message: '请选择工序', trigger: 'change' }
|
||||||
|
],
|
||||||
|
procParamType: [
|
||||||
|
{ required: true, message: '请选择参数类别', trigger: 'change' }
|
||||||
|
],
|
||||||
|
procParamName: [
|
||||||
|
{ required: true, message: '请输入参数名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
enabledStatus: [
|
||||||
|
{ required: true, message: '请选择启用状态', trigger: 'change' }
|
||||||
|
]
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
|
||||||
|
const formRef = ref()
|
||||||
|
|
||||||
|
/** 初始化下拉选项 */
|
||||||
|
const initOptions = async () => {
|
||||||
|
const procs = await ProcApi.getProcDropdown({})
|
||||||
|
procOptions.value = procs || []
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 工序选择变化 */
|
||||||
|
const handleProcChange = (val: number) => {
|
||||||
|
const proc = procOptions.value.find(p => p.id === val)
|
||||||
|
if (proc) {
|
||||||
|
formData.procCd = proc.procCd
|
||||||
|
formData.procName = proc.procName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (type: string, id?: number) => {
|
const open = async (type: string, id?: number) => {
|
||||||
@ -85,27 +145,48 @@ const open = async (type: string, id?: number) => {
|
|||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
resetForm()
|
resetForm()
|
||||||
|
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
formData.value = await ProcParamApi.getProcParam(id)
|
const data = await ProcParamApi.getProcParam(id)
|
||||||
|
formData.id = data.id
|
||||||
|
formData.procId = data.procId
|
||||||
|
formData.procCd = data.procCd || ''
|
||||||
|
formData.procName = data.procName || ''
|
||||||
|
formData.procParamName = data.procParamName || ''
|
||||||
|
formData.procParamUnit = data.procParamUnit || ''
|
||||||
|
formData.procParamType = data.procParamType || ''
|
||||||
|
formData.enabledStatus = data.enabledStatus || 0
|
||||||
|
formData.remark = data.remark || ''
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success', 'close'])
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
// 校验表单
|
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
// 提交请求
|
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = formData.value as unknown as ProcParamApi.ProcParamVO
|
const data = {
|
||||||
|
id: formData.id,
|
||||||
|
procId: formData.procId,
|
||||||
|
procCd: formData.procCd,
|
||||||
|
procName: formData.procName,
|
||||||
|
procParamName: formData.procParamName,
|
||||||
|
procParamUnit: formData.procParamUnit,
|
||||||
|
procParamType: formData.procParamType,
|
||||||
|
enabledStatus: formData.enabledStatus,
|
||||||
|
remark: formData.remark
|
||||||
|
}
|
||||||
|
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await ProcParamApi.createProcParam(data)
|
await ProcParamApi.createProcParam(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
@ -113,8 +194,8 @@ const submitForm = async () => {
|
|||||||
await ProcParamApi.updateProcParam(data)
|
await ProcParamApi.updateProcParam(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 发送操作成功的事件
|
|
||||||
emit('success')
|
emit('success')
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
@ -123,17 +204,27 @@ const submitForm = async () => {
|
|||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.id = undefined
|
||||||
id: undefined,
|
formData.procId = undefined
|
||||||
procCd: undefined,
|
formData.procCd = ''
|
||||||
procName: undefined,
|
formData.procName = ''
|
||||||
enabledStatus: undefined,
|
formData.procParamName = ''
|
||||||
remark: undefined,
|
formData.procParamUnit = ''
|
||||||
procId: undefined,
|
formData.procParamType = ''
|
||||||
procParamName: undefined,
|
formData.enabledStatus = 0
|
||||||
procParamUnit: undefined,
|
formData.remark = ''
|
||||||
procParamType: undefined,
|
|
||||||
}
|
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
/** 弹窗关闭时通知父组件 */
|
||||||
|
watch(dialogVisible, (val) => {
|
||||||
|
if (!val) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 组件挂载时初始化 */
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
onMounted(() => {
|
||||||
|
initOptions()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -17,21 +17,7 @@
|
|||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="enabledStatus">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.enabledStatus"
|
|
||||||
placeholder="请选择状态"
|
|
||||||
clearable
|
|
||||||
class="!w-240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="参数类别" prop="procParamType">
|
<el-form-item label="参数类别" prop="procParamType">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.procParamType"
|
v-model="queryParams.procParamType"
|
||||||
@ -46,6 +32,21 @@
|
|||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="enabledStatus">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.enabledStatus"
|
||||||
|
placeholder="请选择状态"
|
||||||
|
clearable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
@ -65,23 +66,9 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||||
<el-table-column label="自增字段" align="center" prop="id" />
|
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
align="center"
|
|
||||||
prop="createTime"
|
|
||||||
:formatter="dateFormatter"
|
|
||||||
width="180px"
|
|
||||||
/>
|
|
||||||
<el-table-column label="工序编码" align="center" prop="procCd" />
|
<el-table-column label="工序编码" align="center" prop="procCd" />
|
||||||
<el-table-column label="工序名称" align="center" prop="procName" />
|
<el-table-column label="工序名称" align="center" prop="procName" />
|
||||||
<el-table-column label="状态" align="center" prop="enabledStatus">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<el-table-column label="工序id" align="center" prop="procId" />
|
|
||||||
<el-table-column label="参数名称" align="center" prop="procParamName" />
|
<el-table-column label="参数名称" align="center" prop="procParamName" />
|
||||||
<el-table-column label="参数单位" align="center" prop="procParamUnit" />
|
<el-table-column label="参数单位" align="center" prop="procParamUnit" />
|
||||||
<el-table-column label="参数类别" align="center" prop="procParamType">
|
<el-table-column label="参数类别" align="center" prop="procParamType">
|
||||||
@ -89,6 +76,20 @@
|
|||||||
<dict-tag :type="DICT_TYPE.PARAM_TYPE" :value="scope.row.procParamType" />
|
<dict-tag :type="DICT_TYPE.PARAM_TYPE" :value="scope.row.procParamType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="enabledStatus">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="创建人" align="center" prop="creator" />
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -99,14 +100,14 @@
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<!-- <el-button
|
||||||
link
|
link
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope.row.id)"
|
@click="handleDelete(scope.row.id)"
|
||||||
v-hasPermi="['biz:proc-param:delete']"
|
v-hasPermi="['biz:proc-param:delete']"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -118,9 +119,9 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<ProcParamForm ref="formRef" @success="getList" />
|
<ProcParamForm ref="formRef" @success="getList" @close="handleQuery"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
@ -62,7 +62,7 @@
|
|||||||
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
||||||
<el-table-column label="机台名称" align="center" prop="machineName" />
|
<el-table-column label="机台名称" align="center" prop="machineName" />
|
||||||
<el-table-column label="创建人" align="center" prop="creator" />
|
<el-table-column label="创建人" align="center" prop="creator" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter2" />
|
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" />
|
||||||
<el-table-column label="操作" align="center" width="80px">
|
<el-table-column label="操作" align="center" width="80px">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="danger" size="small" @click="removeMachine(scope.$index)">删除</el-button>
|
<el-button link type="danger" size="small" @click="removeMachine(scope.$index)">删除</el-button>
|
||||||
@ -87,7 +87,7 @@ import { Icon } from '@/components/Icon'
|
|||||||
import * as UserMachineApi from '@/api/biz/usermachine'
|
import * as UserMachineApi from '@/api/biz/usermachine'
|
||||||
import * as SystemUserApi from '@/api/system/user'
|
import * as SystemUserApi from '@/api/system/user'
|
||||||
import MachineSelect from '@/views/biz/machine/MachineSelect.vue'
|
import MachineSelect from '@/views/biz/machine/MachineSelect.vue'
|
||||||
import { dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="创建人" align="center" prop="creator" />
|
<el-table-column label="创建人" align="center" prop="creator" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter2" width="180px"
|
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
||||||
<el-table-column label="机台名称" align="center" prop="machineName" />
|
<el-table-column label="机台名称" align="center" prop="machineName" />
|
||||||
<el-table-column label="创建人" align="center" prop="creator" />
|
<el-table-column label="创建人" align="center" prop="creator" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter2" />
|
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
@ -131,7 +131,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as UserMachineApi from '@/api/biz/usermachine'
|
import * as UserMachineApi from '@/api/biz/usermachine'
|
||||||
import UserMachineForm from './UserMachineForm.vue'
|
import UserMachineForm from './UserMachineForm.vue'
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user