Browse Source

组合填写单编辑接口对接

zhouna 6 years ago
parent
commit
431b65cbc3

+ 16 - 37
src/components/preTreat/AddCombinQuestion.vue

@@ -18,7 +18,7 @@
             <p class="title">
                 填写单明细:
             </p>
-            <QuestionTagGroup :ascription="dataPub.region1" :sexType="dataPub.region7" :type="dataPub.region2" @pushValues="pushValues" :options="editData.questionDetailList"></QuestionTagGroup>
+            <QuestionTagGroup :ascription="dataPub.region1" :sexType="dataPub.region7" :type="dataPub.region2" @changeActionData="pushValues" :options="editData.questionMapping"></QuestionTagGroup>
             <div class="btn">
                 <el-button
                         type="primary"
@@ -52,8 +52,8 @@
     beforeMount:function(){
       const {isEdit,data} = this.$route.params;
       if(isEdit){
-        this.txt = '独立填写单维护-修改独立填写单';
-        this.editData = data;
+        this.txt = '组合填写单维护-修改组合填写单';
+        this.editData = data;console.log(data)
       }
     },
     methods: {
@@ -70,41 +70,20 @@
         this.options = [];
       },
       pushValues(its){
-        this.options = its;
+        const arr = its.map((it,i)=>{
+          return {
+            sonQuestion:it.id,
+            orderNo:+i+1,
+            exclusionType:0
+          }
+        });
+        this.options = arr;
       },
       submitForm() {      // 调用子组件的方法验证公用部分
         this.$refs.submitForm.submitForm('groups');
       },
       validatePass() {      //验证成功回调,调取接口
         //仍需验证填写单明细是否选择
-        let isNull = true;
-        let options2 = [];
-        const opts = this.options;
-        for (let i = 0; i < this.options.length; i++) {
-          if(this.options[i].name.trim() != '') {
-            isNull = false
-            options2.push(this.options[i])
-          }
-        }
-        this.options = options2;
-        if(this.itemsTypes.includes(+this.dataPub.region2)&&isNull) {
-          this.warning('至少填一个选项')
-          return;
-        }
-        let flag=true;
-        if(opts[0] && opts[0].code){
-          flag=opts.findIndex((it)=>{
-            return !it.code;
-          })==-1;
-        }else{
-          flag=opts.findIndex((it)=>{
-            return it.code;
-          })==-1;
-        }
-        if(!flag){
-          this.warning('所有选项必须都有或者都没有同“伴”/“无”标记')
-          return;
-        }
         if(parseFloat(this.dataPub.region8) >= parseFloat(this.dataPub.region9)) {
           this.warning('最小年龄不能大于或等于最大年龄');
           return;
@@ -116,10 +95,10 @@
         const {isEdit,data} = this.$route.params;
         let param = {
           "questionWrapper": {
-            "controlType": this.dataPub.region2,                            //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
+            //"controlType": this.dataPub.region2,                            //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
             "id": isEdit?data.id:'',                                    //新增id置空
             "type": this.dataPub.region1,                //填写单归属
-            "tagType": 1,             //独立填写单类型
+            "tagType": this.dataPub.region2,             //组合填写单类型
             "tagName": this.dataPub.region3,             //系统名称
             "name": this.dataPub.region4,                //医生界面名称
             "description":this.dataPub.region5,
@@ -128,8 +107,8 @@
             "ageEnd": this.dataPub.region9,              //最大年龄
             "itemType" :this.dataPub.region12,           //是否为主要内容
             "url":this.dataPub.region13,                  //上传图片
-            "questionDetails": this.options,                //明细项
-            //"questionMappings": [],      //映射关系,
+            //"questionDetails": this.options,                //明细项
+            "questionMappings": this.options,      //映射关系,
           }
         };
         this.showSaveDialog(param);
@@ -139,7 +118,7 @@
           api.questionAdd(param).then((res) => {
             if (res.data.code === '0') {
               this.warning(res.data.msg || '保存成功', 'success');
-              this.$router.push("/admin/LT-YWZSJWH-DLTXDWH");
+              this.$router.push("/admin/LT-YWZSJWH-ZHTXDWH");
             } else {
               this.warning(res.data.msg)
             }

+ 14 - 65
src/components/preTreat/QuestionTagGroup.vue

@@ -31,21 +31,13 @@
     </div>
     <div class="bottomPartRight ">
       <p class="poolTitle">操作界面:</p>
-      <ul class="tagList operationPool" :class="(type == 1 && isSymp == 0)?'':'operationPools'">
+      <ul class="tagList operationPool operationPools">
             <li class = "tagItem"
                 v-for="(item) in rightTagsList2" 
                 :key='item.id'
                 :style="getStyle2(item)?styles:null"
                 @click='selectRightTag(item)'
-            >   
-                <div class="inputBox">
-                    <el-input
-                        v-if="item.type === 'input'"
-                        placeholder=""
-                        v-model="item.text"
-                    >
-                    </el-input>
-                </div>
+            >
                 <p class="tagName  ellipsis" :title="'[ '+item.tagName+' ]'">{{item.tagName}} </p>
             </li>
         </ul>
@@ -65,28 +57,7 @@ import { constants } from 'fs';
 
 export default {
     name: "QuestionTagGroup",
-    props: {
-        pool: {
-            default: () => [],
-            type: Array
-        },
-        type: {
-            default: '',
-            type: String
-        },
-        isSymp: {
-            default: '',
-            type: String
-        },
-        sexType: {
-            default: '',
-            type: String
-        },
-        options: {
-            default: () => [],
-            type: Array
-        }
-    },
+    props: ['ascription','type','sexType','options'],
     data() {
         return {
             leftTagsList: [],
@@ -101,44 +72,25 @@ export default {
         }
     },
     mounted() {
-      this.$nextTick(()=>{
         let tagList = this.options;
-        if(tagList.length > 0){
-          /*this.rightTagsList2 = this.options
-          let newArr = []
-          for (let i = 0; i < this.rightTagsList2.length; i++) {
-              if(this.rightTagsList2[i].tagType == 8) {
-                  newArr.push({ text: this.rightTagsList2[i].tagName ,type:'input' ,id: i+',,,', symptomType: this.rightTagsList2[i].symptomType})
-              } else {
-                  if(i === 0 ) {
-                      newArr.push({ text: '' ,type:'input' ,id: i+',,,'})
-                  }
-                  newArr.push(this.rightTagsList2[i])
-                  if(!this.rightTagsList2[i+1] || this.rightTagsList2[i+1]&&this.rightTagsList2[i+1].tagType != 8) {
-                      newArr.push({ text: '' ,type:'input' ,id: i+',,,,'})
-                  }
-              }
-          }*/
-          this.rightTagsList2 = tagList;
-          this.$emit('changeActionData',this.rightTagsList2, false);
+        if(tagList&&tagList.length > 0){
+          this.rightTagsList2 = tagList;console.log(this.options,this.rightTagsList2)
+          this.$emit('changeActionData',this.rightTagsList2);
           this.searchTagList();
         }
-      })
-        
-        // this.leftTagsList = this.pool
-        // console.log('TAGPOOL', this.pool)
     },
     watch: {
-        pool(newVal, preVal) {
-             this.leftTagsList = newVal
-        },
+        /*rightTagsList2(newVal, preVal) {
+             //this.pushValues(newVal);
+            this.$emit('pushValues', newVal);
+        },*/
         searchVal(newVal, preVal){
             if(newVal.trim() == ''){
                 this.searchTagList()
             }else if(newVal.trim() != preVal.trim()){
                 this.searchTagList()
             }
-        },
+        },/*
         sexType(newVal, preVal) {
             if (newVal != preVal) {
                 if (JSON.stringify(newVal) != JSON.stringify(preVal)) {
@@ -151,13 +103,11 @@ export default {
                     //  this.searchTagList();
                 }
             }
-        },
-
-        
+        },*/
     },
     methods: {
         selectLeftTag(tag, index, e) {
-            const hasTag = this.isHasTag(tag, this.selectLeftTagsList)
+            const hasTag = this.isHasTag(tag, this.selectLeftTagsList);
             if (hasTag) {
                 this.selectLeftTagsList = this.selectLeftTagsList.filter(item => item.id !== tag.id)
             } else {
@@ -278,10 +228,9 @@ export default {
                 }
                 
             }
-            
             let param = {
                 "tagName": this.searchVal,
-                "type": this.type || '',
+                "type": '',
                 "notIds": notIds,
                 "sexType": this.sexType,
             };