feat(usermachine): 优化用户机台表单界面并添加重复配置校验

This commit is contained in:
zxy 2026-04-16 09:44:23 +08:00
parent c9ad6c5741
commit 1d0ea38706
2 changed files with 17 additions and 6 deletions

View File

@ -101,6 +101,13 @@ public class UserMachineServiceImpl extends ServiceImpl<UserMachineMapper, UserM
public void saveOrUpdate(UserMachineForm userMachineForm, String id, boolean isSave) throws Exception { public void saveOrUpdate(UserMachineForm userMachineForm, String id, boolean isSave) throws Exception {
UserMachineEntity entity; UserMachineEntity entity;
if (isSave) { if (isSave) {
// 根据userId 判断是否已经存在记录
UserMachineEntity existingEntity = this.getOne(new LambdaQueryWrapper<UserMachineEntity>()
.eq(UserMachineEntity::getUserId, userMachineForm.getUserId())
.eq(UserMachineEntity::getDeleteMark, 0));
if (existingEntity != null) {
throw new Exception("该人员已配置机台班组,不能重复配置");
}
entity = new UserMachineEntity(); entity = new UserMachineEntity();
BeanUtils.copyProperties(userMachineForm, entity); BeanUtils.copyProperties(userMachineForm, entity);
entity.setId(null); entity.setId(null);

View File

@ -11,12 +11,16 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="人员" prop="userId"> <el-form-item label="人员" prop="userId">
<template v-if="dataForm.id">
<el-input v-model="dataForm.userName" disabled style="width: 100%;" />
</template>
<template v-else>
<UserSelect <UserSelect
v-model="dataForm.userId" v-model="dataForm.userId"
@change="handleUserChange" @change="handleUserChange"
placeholder="请选择人员" placeholder="请选择人员"
:disabled="!!dataForm.id"
></UserSelect> ></UserSelect>
</template>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">