Просмотр исходного кода

Merge branch 'dev' of http://git.izouma.com/licailing/zhirongip into dev

panhui 4 лет назад
Родитель
Сommit
9614b1cdf0

+ 11 - 0
src/main/java/com/izouma/zhirongip/service/resource/IntellectualPropertyService.java

@@ -9,6 +9,7 @@ import com.izouma.zhirongip.domain.Setting;
 import com.izouma.zhirongip.domain.resource.IntellectualProperty;
 import com.izouma.zhirongip.dto.IntellectualPropertyDTO;
 import com.izouma.zhirongip.dto.PageQuery;
+import com.izouma.zhirongip.exception.BusinessException;
 import com.izouma.zhirongip.repo.SettingRepo;
 import com.izouma.zhirongip.repo.resource.IntellectualPropertyRepo;
 import com.izouma.zhirongip.utils.JpaUtils;
@@ -64,6 +65,16 @@ public class IntellectualPropertyService {
         });
     }
 
+    public IntellectualProperty get(Long id) {
+        IntellectualProperty property = intellectualPropertyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        Map<Long, String> stringMap = settingRepo.findAllById(CollUtil.newArrayList(property.getLawStatusId(), property.getLawStatusId()))
+                .stream()
+                .collect(Collectors.toMap(Setting::getId, Setting::getName));
+        property.setType(stringMap.get(property.getTypeId()));
+        property.setLawStatus(stringMap.get(property.getLawStatusId()));
+        return property;
+    }
+
     public List<IntellectualPropertyDTO> export(List<IntellectualProperty> properties) {
         Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.newArrayList(13, 27, 28))
                 .stream()

+ 1 - 1
src/main/java/com/izouma/zhirongip/web/resource/IntellectualPropertyController.java

@@ -50,7 +50,7 @@ public class IntellectualPropertyController extends BaseController {
 
     @GetMapping("/get/{id}")
     public IntellectualProperty get(@PathVariable Long id) {
-        return intellectualPropertyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        return intellectualPropertyService.get(id);
     }
 
     @PostMapping("/del/{id}")

+ 38 - 13
src/main/vue/src/views/resource/IntellectualPropertyEdit.vue

@@ -19,14 +19,14 @@
                     style="max-width: 700px;"
                 >
                     <el-form-item prop="type" label="专利区分">
-                        <el-radio-group v-model="formData.type">
+                        <el-radio-group v-model="formData.typeId">
                             <el-radio v-for="item in typeOptions" :key="item.value" :label="item.value">
                                 {{ item.label }}
                             </el-radio>
                         </el-radio-group>
                     </el-form-item>
                     <el-form-item prop="lawStatus" label="法律状态">
-                        <el-radio-group v-model="formData.lawStatus">
+                        <el-radio-group v-model="formData.lawStatusId">
                             <el-radio v-for="item in lawStatusOptions" :key="item.value" :label="item.value">
                                 {{ item.label }}
                             </el-radio>
@@ -201,6 +201,38 @@ export default {
                 console.log(e);
                 this.$message.error(e.error);
             });
+        this.$http
+            .post('/setting/byFlag', { flag: 27 })
+            .then(res => {
+                if (res.length > 0) {
+                    res.forEach(item => {
+                        this.lawStatusOptions.push({
+                            label: item.name,
+                            value: item.id
+                        });
+                    });
+                }
+            })
+            .catch(e => {
+                console.log(e);
+                this.$message.error(e.error);
+            });
+        this.$http
+            .post('/setting/byFlag', { flag: 28 })
+            .then(res => {
+                if (res.length > 0) {
+                    res.forEach(item => {
+                        this.typeOptions.push({
+                            label: item.name,
+                            value: item.id
+                        });
+                    });
+                }
+            })
+            .catch(e => {
+                console.log(e);
+                this.$message.error(e.error);
+            });
     },
     data() {
         return {
@@ -210,8 +242,8 @@ export default {
             },
             rules: {
                 name: [{ required: true, message: '请输入专利名称' }],
-                type: [{ required: true, message: '请选择专利区分' }],
-                lawStatus: [{ required: true, message: '请选择法律状态' }],
+                typeId: [{ required: true, message: '请选择专利区分' }],
+                lawStatusId: [{ required: true, message: '请选择法律状态' }],
                 agency: [{ required: true, message: '请输入代理人', trigger: 'blur' }],
                 applyMain: [{ required: true, message: '请输入申请主体' }],
                 applyName: [{ required: true, message: '请输入申请人' }],
@@ -231,15 +263,8 @@ export default {
                 pdfUrl: [{ required: true, message: '请上传PDF', trigger: 'blur' }],
                 authTime: [{ required: true, message: '请选择公开日' }]
             },
-            typeOptions: [
-                { label: '脱密国防专利', value: 'DECLASSIFICATION' },
-                { label: '军转民专利', value: 'MILITARY_TO_CIVILIAN' }
-            ],
-            lawStatusOptions: [
-                { label: '有效', value: 'EFFECTIVE' },
-                { label: '失效', value: 'FAILURE' },
-                { label: '未知', value: 'UNKNOWN' }
-            ],
+            typeOptions: [],
+            lawStatusOptions: [],
             industryClassOptions: [],
             inputValue: '',
             inputValue1: ''