Pārlūkot izejas kodu

组合字段维护

zhangxc 5 gadi atpakaļ
vecāks
revīzija
c73fd8eae5

+ 1 - 0
src/api/config.js

@@ -289,6 +289,7 @@ export default {
       'saveRecord':'/api/mrman/arRechome/saveBABLContent',  //保存病例
       'getTypes':'/api/mrman/getMrEnumsData',//枚举类型
       'getFieldList':"/api/mrman/qc/qcQuestionInfo/page",    //获取字段映射列表
+      'getFieldDetail':'/api/mrman/qc/qcQuestionInfo/getById',//获取标签详情
       'addFieldMatch':"/api/mrman/qc/qcQuestionInfo/saveOrUpdate",    //添加字段映射
       'getQcTypes':"/api/mrman/qc/dictionaryInfo/getList",    //添加字段映射
       'delFieldMatch':"/api/mrman/qc/qcQuestionInfo/delete",    //删除字段映射  

+ 3 - 0
src/api/qualityControl.js

@@ -32,6 +32,9 @@ export default {
   },
   getQcFlawList(param){
     return axios.post(urls.getQcFlawList,param);
+  },
+  getFieldDetail(param){ //获取标签详情
+    return axios.post(urls.getFieldDetail,param);
   }
 
 }

+ 67 - 20
src/components/qualityControl/AddCombineFeild.vue

@@ -46,7 +46,7 @@
                                         :title="searchItem.name"
                                         @click="selectSearchFiled(searchItem,index)"
                                     >
-                                        {{searchItem.name}}
+                                        {{searchItem.tagName}}
                                     </li>
                                 </ul>
                             </div>
@@ -58,7 +58,7 @@
                                             <span  class="el-icon-arrow-down order" @click="downFiled(index)"></span> 
                                         </div>
                                     <div class="selectFiled" v-for="(it,ii) in item.selectFiled">
-                                        <span class="filedName" :class="{activeFiledName: item.activeIndex == ii}" @click="setActiveIndex(index,ii)">{{it.name}}
+                                        <span class="filedName" :class="{activeFiledName: item.activeIndex == ii}" @click="setActiveIndex(index,ii)">{{it.tagName}}
                                             <span class="el-icon-circle-close delFiled" @click="delSelected(ii,index)"></span>
                                         </span>
                                     
@@ -84,12 +84,23 @@
         list:[],
         labelPosition:'left',
         isFirst:true,
+        isEdit: true,
         title:'组合字段维护-添加组合字段',
         form:{
           modeId:"",
           hospitalId:"",
           name:'',
-          remark:'',
+          tagType:4,        //固定
+          controlType: 0,
+          name:'',
+          val:'',
+          tagName:'',
+          addLine:0,
+          bold:0,
+          position:0,
+          retract:0,
+          casesEntryIds:'',
+          questionMappings:[]
         },
         id:null,
         rules:{
@@ -110,15 +121,7 @@
                     searchResult:[
                     ],
                     selectFiled:[
-                        {
-                            name: "4姓名"
-                        },
-                        {
-                            name: "5职业"
-                        },
-                        {
-                            name: "6年龄"
-                        }
+                       
                     ]
                 }
             ]
@@ -126,17 +129,26 @@
     },
     created(){
       this.getAllTypes();
-      let info = this.$route.params.info;
-      if(info){
+      let {isEdit,data} = this.$route.params;
+      if(isEdit){
         this.title='组合字段维护-修改组合字段';
-        this.form = Object.assign({},info);
+        this.id = data.id
+        this.isEdit = isEdit
+        this.form = Object.assign({},data);
+        let questionMappings = this.form.questionMapping ||[]
+        let selectFiled = []
+        for(let i = 0;  i < questionMappings.length; i++){
+          selectFiled.push(questionMappings[i])
+        }
+        this.combineInfoList[0].selectFiled = selectFiled
+        this.form.questionMapping = []
       }
     },
     methods:{
       getAllTypes(){
         if(localStorage.getItem("qcModuleTypes")){
           this.hisTypes = JSON.parse(localStorage.getItem("qcHospitalTypes"));
-          this.fieldTypes = JSON.parse(localStorage.getItem("qcModuleTypes"));console.log()
+          this.fieldTypes = JSON.parse(localStorage.getItem("qcModuleTypes"));
           return ;
         }
         //获取枚举信息
@@ -157,6 +169,14 @@
           if(!searchName){
               return
           }
+          if(this.form.hospitalId === ''){
+            this.warning("请选择所属医院")
+            return
+          }
+          if(this.form.modeId === ''){
+            this.warning("请选择所属模块")
+            return
+          }
           const param = {
               tagName: searchName,
               hospitalId: this.form.hospitalId,
@@ -222,10 +242,25 @@
         }*/
         this.$refs[form].validate((valid) => {
           if (valid) {
+            let questionMappings = []
+            const combineInfoList = this.combineInfoList
+            for(let i = 0; i < combineInfoList.length; i++){
+              const selectFiledList = combineInfoList[i].selectFiled
+              for(let j = 0; j < selectFiledList.length; j++){
+                questionMappings.push({
+                  sonQuestion: selectFiledList[j].id
+                })
+              }
+            }
+            if(questionMappings.length === 0){
+              this.warning('请添加组合内容')
+              return
+            }
+            this.form = Object.assign({}, this.form,{questionMappings: questionMappings})
             if(this.id && !this.copy){//修改
               const param = Object.assign({},this.form,{id:this.id})
               this.saveDisable = true  //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
-              api.updateFieldMatch(param).then((res)=>{
+              api.addFieldMatch({questionWrapper:param}).then((res)=>{
                 if(res.data.code==0){
                   this.$message({
                     message:"修改成功",
@@ -233,7 +268,7 @@
                   });
                   //返回带搜索条件的首页
                   this.$router.push({
-                    name: 'VersionInfo',
+                    name: 'CombineFeild',
                     params: Object.assign({}, this.$route.params, {currentPage: 1})
                   });
                 }else{
@@ -247,13 +282,13 @@
             }else{//添加
               const params = Object.assign({},this.form);
               this.saveDisable = true;  //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
-              api.addFieldMatch(params).then((res)=>{
+              api.addFieldMatch({questionWrapper:params}).then((res)=>{
                 if(res.data.code==0){
                   this.$message({
                     message:"添加成功",
                     type:'success'
                   })
-                  this.$router.push({name: 'BaseField'});
+                  this.$router.push({name: 'CombineFeild'});
                 }else{
                   this.$message({
                     message:res.data.msg,
@@ -268,6 +303,14 @@
           }
         });
       },
+      warning(msg, type,time) {
+          this.$message({
+              showClose: true,
+              message: msg,
+              type: type || 'warning',
+              duration:time || '3000'
+          })
+      },
     }
   }
 </script>
@@ -282,6 +325,10 @@
     .el-form-item{
         width: 600px;
     }
+    /deep/.el-input__inner {
+      height: 30px;
+      line-height: 30px;
+    }
     .moduleInfoItem{
       width: 500px;
       min-height: 200px;

+ 2 - 2
src/components/qualityControl/AddQualityControlTemp.vue

@@ -30,7 +30,7 @@
                                         :title="searchItem.name"
                                         @click="selectSearchFiled(searchItem,index)"
                                     >
-                                        {{searchItem.name}}
+                                        {{searchItem.tagName}}
                                     </li>
                                 </ul>
                             </div>
@@ -42,7 +42,7 @@
                                             <span  class="el-icon-arrow-down order" @click="downFiled(index)"></span> 
                                         </div>
                                     <div class="selectFiled" v-for="(it,ii) in item.selectFiled">
-                                        <span class="filedName" :class="{activeFiledName: item.activeIndex == ii}" @click="setActiveIndex(index,ii)">{{it.name}}
+                                        <span class="filedName" :class="{activeFiledName: item.activeIndex == ii}" @click="setActiveIndex(index,ii)">{{it.tagName}}
                                             <span class="el-icon-circle-close delFiled" @click="delSelected(ii,index)"></span>
                                         </span>
                                     

+ 29 - 7
src/components/qualityControl/CombineFeildList.vue

@@ -60,7 +60,7 @@
                 <el-table-column
                         label="操作" width="100">
                     <template slot-scope="scope">
-                        <el-button type="text" size="small" @click="toEditField(scope.row)">修改</el-button>
+                        <el-button type="text" size="small" @click="toEditField(scope.row, 'modify')">修改</el-button>
                         <span style="margin:0 3px;">|</span>
                         <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
                     </template>
@@ -83,7 +83,7 @@
   import api from '@api/qualityControl.js';
 
   export default {
-    name: 'BaseField',
+    name: 'CombineFeild',
     data: function () {
       return {
         list: [],
@@ -132,11 +132,33 @@
           }
         });
       },
-      toEditField(row){
-        this.$router.push({
-          name:'AddCombineFeild',
-          params: {info:row}
-        })
+      toEditField(row,type){
+        api.getFieldDetail({id:row.id}).then((res)=>{
+          const {code,data,msg} = res.data;
+          if(code=='0'){
+            const item = Object.assign({},row,data);
+            const pam = this.searched ? {
+              currentPage: this.currentPage,
+              filter: this.filter
+            } : {currentPage: this.currentPage};
+            if(type == 'modify') {
+              this.$router.push({name: 'AddCombineFeild', params: Object.assign(pam, {isEdit: true, data: item})});
+            } else if( type == 'copy') {
+              this.$router.push({name: 'AddCombineFeild', params: Object.assign(pam, {isCopy: true, data: item})});
+            } else {
+                return
+            }
+          }else{
+            this.$message({
+              message: msg,
+              type: 'warning'
+            });
+          }
+        });
+        // this.$router.push({
+        //   name:'AddCombineFeild',
+        //   params: {info:row}
+        // })
       },
       filterDatas(){
         this.currentPage = 1;