feat(usermachine): 优化用户机台表单界面并添加重复配置校验
This commit is contained in:
parent
c9ad6c5741
commit
1d0ea38706
@ -101,6 +101,13 @@ public class UserMachineServiceImpl extends ServiceImpl<UserMachineMapper, UserM
|
||||
public void saveOrUpdate(UserMachineForm userMachineForm, String id, boolean isSave) throws Exception {
|
||||
UserMachineEntity entity;
|
||||
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();
|
||||
BeanUtils.copyProperties(userMachineForm, entity);
|
||||
entity.setId(null);
|
||||
|
||||
@ -11,12 +11,16 @@
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<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
|
||||
v-model="dataForm.userId"
|
||||
@change="handleUserChange"
|
||||
placeholder="请选择人员"
|
||||
:disabled="!!dataForm.id"
|
||||
></UserSelect>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user