Browse Source

模块不能重复添加1814

zhouna 6 years atrás
parent
commit
d37a2b299f
3 changed files with 28 additions and 3 deletions
  1. 1 1
      src/api/config.js
  2. 4 1
      src/api/preTreat.js
  3. 23 1
      src/components/preTreat/AddQuestionModules.vue

+ 1 - 1
src/api/config.js

@@ -227,7 +227,7 @@ export default {
     'delModule':'/api/precman/moduleInfo_prec/delete',        //模板删除
     'moduleDetail':'/api/precman/moduleInfo_prec/getModuleInfoOne',    //模板详情
     'deptList':'/api/precman/moduleInfo_prec/getAllDeptAndDisInfo',    //模板-科室列表
-
+    'getPrecModuleType':'/api/precman/moduleInfo_prec/getModuleType',     //获取未创建的模板类型
   },
 	menuIconList: { //菜单对应图标
 		'YH-KZT': 'el-icon-menu',

+ 4 - 1
src/api/preTreat.js

@@ -40,6 +40,9 @@ export default {
     return axios.post(urls.delModule, param);
   },
   getDeptList(param){
-    return axios.post(urls.deptList, param)
+    return axios.post(urls.deptList, param);
+  },
+  getModuleType(param){
+    return axios.post(urls.getPrecModuleType, param);
   }
 }

+ 23 - 1
src/components/preTreat/AddQuestionModules.vue

@@ -36,6 +36,7 @@
                 <span class="changeTips">改变类型后,填写单明细将会恢复到默认状态</span>
                 <el-select
                         v-model="form.relationId"
+                        :disabled="!!editData.id"
                         placeholder="请选择科室"
                 >
                     <el-option
@@ -54,7 +55,7 @@
                 <el-select
                         v-model="form.type"
                         :clearable="false"
-                        :disabled="!!editData.id"
+                        :disabled="!!editData.id||!form.moduleType||(form.moduleType==1&&!form.relationId)"
                         placeholder="请选择模板归属"
                         @change="changeType(0)"
                 >
@@ -161,13 +162,34 @@
       const {isEdit,data} = this.$route.params;
       this.getDropDatas();
       if(isEdit){
+        //this.getAvailibleType();
         this.txt = '模板维护-修改模板';
         this.form = Object.assign({},this.form,this.transFormData(data));
         this.editData = data;
       }
     },
+    watch:{
+      'form.moduleType':function(newVal,oldVal){
+        if(+newVal!==1){
+          this.form.relationId = '';
+        }
+        this.getAvailibleType();
+      },
+      'form.relationId':function(newVal,oldVal){
+        this.getAvailibleType();
+      }
+    },
     methods: {
       back() { this.$router.go(-1) },
+      getAvailibleType(){
+        api.getModuleType({moduleType:this.form.moduleType,relationId:this.form.relationId}).then((res) =>{
+          if(res.data.code === '0') {
+            this.typeList = res.data.data;
+          }else{
+            this.warning(res.data.msg);
+          }
+        });
+      },
       transFormData(org){
         const maps = {
           'moduleType':'moduleType',