Merge remote-tracking branch 'origin/master'

This commit is contained in:
z 2026-04-16 09:56:31 +08:00
commit e54b5b9f05
3 changed files with 19 additions and 8 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 {
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);

View File

@ -83,7 +83,7 @@ public class UserMachineController {
userMachineService.saveOrUpdate(userMachineForm, "", true);
return ActionResult.success("新建成功");
} catch (Exception e) {
return ActionResult.fail("新建数据失败:" + e.getMessage());
return ActionResult.fail(e.getMessage());
}
}

View File

@ -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">