Sfoglia il codice sorgente

6825 6828 bug修复

morphone1995 4 anni fa
parent
commit
0a426a9468
3 ha cambiato i file con 87 aggiunte e 34 eliminazioni
  1. 3 0
      src/api/cdss.js
  2. 1 0
      src/api/config.js
  3. 83 34
      src/components/cdssManage/knowledge/AddKnowledge.vue

+ 3 - 0
src/api/cdss.js

@@ -424,4 +424,7 @@ export default {
   getEntitymanById(param) {
     return request({ method: 'post', url: urls.getEntitymanById, data: param });
   },
+  dataEntityVerify(param) {
+    return request({ method: 'post', url: urls.dataEntityVerify, data: param });
+  },
 };

+ 1 - 0
src/api/config.js

@@ -459,6 +459,7 @@ export default {
     'isEntitymanExistCDSS': '/entityman/isExist',   //知识图谱-唯一校验
     'saveEntity': '/entityman/saveEntity',   //知识图谱
     'getEntitymanById': '/entityman/getById',   //查看实体对象
+    'dataEntityVerify': '/entityman/dataVerify',   //术语关联校验(静态知识、术语关联、开单合理性规则)
 
     'getVersionInfoAllsCDSS': '/api/cdssman/versionInfo/getVersionInfoAlls',   //获取版本信息
     'saveVersionInfoAllsCDSS': '/api/cdssman/versionInfo/saveVersionInfoAlls',   //保存版本信息

+ 83 - 34
src/components/cdssManage/knowledge/AddKnowledge.vue

@@ -146,10 +146,10 @@ export default {
     CommonForm
   },
   data() {
-    let reg = /^[a-zA-Z0-9:.,?!@/();,)(-]{0,10000}[#$^]?$/;
+    let reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
     let checkFrequency = (rule, value, callback) => {
       let pycode = this.$refs.pycode.value;
-      if (!reg.test(pycode && pycode.trim())) {
+      if (reg.test(pycode && pycode.trim())) {
         callback('术语拼音仅支持字母、数字和标点符号');
       } else {
         callback();
@@ -370,7 +370,6 @@ export default {
         min_prod_unit, //最小制剂单位(药品代码通用名属性)
         stand_reg_JiXin //标准注册剂型(药品代码通用名属性)
       };
-      console.log(params.min_pack_num, 'min_pack_num');
       if (this.isEdit) {
         params = { ...params, id: this.id };
       }
@@ -423,7 +422,7 @@ export default {
             }
           });
       }
-      this.$refs.form.validate(valid => {
+      this.$refs.form.validate(async valid => {
         if (valid) {
           if (!goOn) return;
           this.saveDisable = true;
@@ -432,37 +431,87 @@ export default {
             this.saveDisable = false;
             return;
           }
-          api.saveEntity(params).then(res => {
-            if (res.data.code === '0') {
-              this.$message({
-                showClose: true,
-                message: '保存成功',
-                type: 'success',
-                duration: 1000
+          let res = await api.dataEntityVerify(params);
+          if (!res.data.data) {
+            this.$alert(`${res.data.msg}`, '提示', {
+              confirmButtonText: '确定',
+              type: 'warning'
+            })
+              .then(() => {
+                api.saveEntity(params).then(res => {
+                  if (res.data.code === '0') {
+                    this.$message({
+                      showClose: true,
+                      message: '保存成功',
+                      type: 'success',
+                      duration: 1000
+                    });
+                    this.$router.push({
+                      name: 'KnowledgeManage',
+                      params: Object.assign({}, this.$route.params, {
+                        currentPage: numberpage
+                      })
+                    });
+                  } else if (res.data.code === '00020007') {
+                    this.$message({
+                      showClose: true,
+                      message: res.data.msg,
+                      type: 'error',
+                      duration: 1000
+                    });
+                  } else {
+                    this.$message({
+                      showClose: true,
+                      message: res.data.msg,
+                      type: 'error',
+                      duration: 1000
+                    });
+                  }
+                  this.saveDisable = false;
+                });
+              })
+              .catch(() => {
+                this.saveDisable = false;
+                this.$message({
+                  showClose: true,
+                  message: '保存失败',
+                  type: 'error',
+                  duration: 1000
+                });
               });
-              this.$router.push({
-                name: 'KnowledgeManage',
-                params: Object.assign({}, this.$route.params, {
-                  currentPage: numberpage
-                })
-              });
-            } else if (res.data.code === '00020007') {
-              this.$message({
-                showClose: true,
-                message: res.data.msg,
-                type: 'error',
-                duration: 1000
-              });
-            } else {
-              this.$message({
-                showClose: true,
-                message: res.data.msg,
-                type: 'error',
-                duration: 1000
-              });
-            }
-            this.saveDisable = false;
-          });
+          } else if (res.data.data) {
+            api.saveEntity(params).then(res => {
+              if (res.data.code === '0') {
+                this.$message({
+                  showClose: true,
+                  message: '保存成功',
+                  type: 'success',
+                  duration: 1000
+                });
+                this.$router.push({
+                  name: 'KnowledgeManage',
+                  params: Object.assign({}, this.$route.params, {
+                    currentPage: numberpage
+                  })
+                });
+              } else if (res.data.code === '00020007') {
+                this.$message({
+                  showClose: true,
+                  message: res.data.msg,
+                  type: 'error',
+                  duration: 1000
+                });
+              } else {
+                this.$message({
+                  showClose: true,
+                  message: res.data.msg,
+                  type: 'error',
+                  duration: 1000
+                });
+              }
+              this.saveDisable = false;
+            });
+          }
         } else {
           goOn = false;
         }