diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDeviceService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDeviceService.java index ddb65f5..a8d663c 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDeviceService.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDeviceService.java @@ -31,7 +31,7 @@ public interface YysDeviceService extends IService { //副表数据方法 String checkForm(YysDeviceForm form, int i); - void saveOrUpdate(YysDeviceForm yysDeviceForm, String id, boolean isSave) throws Exception; + String saveOrUpdate(YysDeviceForm yysDeviceForm, String id, boolean isSave); /** * 根据设备code查询设备名称 diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java index cb4cbfd..05c3610 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDeviceServiceImpl.java @@ -22,6 +22,7 @@ import jnpf.service.YysDeviceMaterialService; import jnpf.service.YysDeviceService; import jnpf.service.YysDeviceUpkeepService; import jnpf.util.*; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -309,7 +310,7 @@ public class YysDeviceServiceImpl extends ServiceImpl wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(YysDeviceMaterialEntity::getDeviceCode, entity.getDeviceCode()); + if (CollectionUtils.isNotEmpty(yysDeviceMaterialService.list(wrapper1))) { + return "不可以重复创建"; + } String mainId = RandomUtil.uuId(); entity.setCreatorTime(DateUtil.getNowDate()); entity.setCreatorUserId(userInfo.getUserId()); @@ -335,6 +341,7 @@ public class YysDeviceServiceImpl extends ServiceImpl - + - + - + 取 消 - 确 定 + 确 定 - + @@ -302,6 +227,9 @@ export default { }; }, computed: { + isDisabled() { + return !this.dataForm.id; + }, ...mapGetters(["userInfo"]) }, watch: {}, @@ -310,8 +238,9 @@ export default { this.initDefaultData(); this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)); }, - mounted() {}, + mounted() { }, methods: { + fnMaterialListDialog() { this.$nextTick(() => { this.$refs.materialListDialog.init(this.dataForm.data); @@ -425,7 +354,7 @@ export default { } } }, - dataAll() {}, + dataAll() { }, clearData() { this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)); }, @@ -465,7 +394,7 @@ export default { this.$store.commit("generator/UPDATE_RELATION_DATA", {}); }, //初始化默认数据 - initDefaultData() {}, + initDefaultData() { }, // 表单提交 dataFormSubmit(type) { this.dataFormSubmitType = type ? type : 0;