mirror of
https://github.com/kerwincui/FastBee.git
synced 2025-10-06 16:48:18 +08:00
验证设备的唯一性和设备字段添加验证
This commit is contained in:
@@ -199,7 +199,7 @@ public class DeviceEditFragment extends BaseFragment {
|
||||
et_device_remark.setText(device.getRemark());
|
||||
txt_device_num.setText(device.getDeviceNum());
|
||||
txt_device_category.setText(device.getCategoryName());
|
||||
txt_firmware_version.setText("v"+device.getFirmwareVersion());
|
||||
txt_firmware_version.setText("v"+(device.getFirmwareVersion()==null || device.getFirmwareVersion().length()==0? "1.0" : device.getFirmwareVersion()));
|
||||
txt_create_time.setText(device.getCreateTime());
|
||||
sp_device_temperature.setText(device.getDeviceTemp()==null?0+"℃":device.getDeviceTemp()+"℃");
|
||||
}
|
||||
|
@@ -115,7 +115,10 @@ public class IotDeviceController extends BaseController
|
||||
{
|
||||
LoginUser user=(LoginUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
iotDevice.setOwnerId(user.getUser().getUserId().toString());
|
||||
iotDevice.setDeviceTemp(BigDecimal.valueOf(0));
|
||||
IotDevice device=iotDeviceService.selectIotDeviceByNum(iotDevice.getDeviceNum());
|
||||
if(device!=null){
|
||||
return AjaxResult.error("设备编号已存在,请重新填写");
|
||||
}
|
||||
return toAjax(iotDeviceService.insertIotDevice(iotDevice));
|
||||
}
|
||||
|
||||
|
@@ -285,7 +285,7 @@
|
||||
<el-form-item label="编号" prop="deviceNum">
|
||||
<el-input
|
||||
v-model="form.deviceNum"
|
||||
placeholder="请输入编号"
|
||||
placeholder="请输入编号,必须唯一"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="categoryId">
|
||||
@@ -303,7 +303,7 @@
|
||||
<el-form-item label="固件版本" prop="firmwareVersion">
|
||||
<el-input
|
||||
v-model="form.firmwareVersion"
|
||||
placeholder="请输入固件版本"
|
||||
placeholder="请输入固件版本,例如1.0"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="deviceName">
|
||||
@@ -733,7 +733,13 @@ export default {
|
||||
],
|
||||
deviceName: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
]
|
||||
],
|
||||
categoryId: [
|
||||
{required:true,message:"设备分类不能为空",trigger: "blur"}
|
||||
],
|
||||
firmwareVersion: [
|
||||
{required:true,message:"版本号不能为空", trigger: "blur"}
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
|
Reference in New Issue
Block a user