Browse Source

数据处理

Luolei 5 năm trước cách đây
mục cha
commit
6479869fca

+ 1 - 0
src/common/Input.vue

@@ -47,6 +47,7 @@
       border-radius: 0;
       outline-color: invert;
       padding-left: 0.1rem;
+      box-sizing: border-box;
     }
     .change{
       border-color:  #4F50FF;

+ 1 - 0
src/common/Label.vue

@@ -108,4 +108,5 @@ import Toast from '../common/Toast.vue';
       padding-right: 0.57rem;
     }
   }
+  
 </style>

+ 11 - 3
src/common/MultiLineInput.vue

@@ -3,7 +3,7 @@
     <span class="prefix" v-if="content.prefix">{{content.prefix}}</span>
     <div class="sticP" :style="{paddingRight:content.suffix?'1rem':'0'}">
         <div class="iptWrap">
-          <input class="contentVal" :type="content.type" :placeholder="content.placeholder" v-model="val" @input="changeVal">
+          <input class="contentVal" :type="content.type" :placeholder="content.placeholder" v-model="txt" @input="changeVal" @blur="blur">
         </div>
     </div>
     <span class="suffix" v-if="content.suffix">{{content.suffix}}</span>
@@ -17,12 +17,16 @@ export default {
     msg:{
       default:'',
       type:String
-    }
+    },
+    part:{
+      type:Object,
+      require: true
+    },
   },
   data(){
     return {
       content:{},
-      val:''
+      txt:this.part.value || '' //回读用
     }
   },
   mounted(){
@@ -31,6 +35,10 @@ export default {
   methods:{
     changeVal(){
       this.$emit('changeMultipVal',this.val)
+    },
+    blur(){
+      const newData = Object.assign({},this.part,{value:this.txt,controlType:3});
+      this.$emit("updata",newData);
     }
   }
 }

+ 42 - 11
src/components/AddContent.vue

@@ -4,9 +4,14 @@
       <ul class="addPart">
         <li v-for="(item,idx) in dataTrd">
           <p class="question">{{idx+1 + '. ' +item.name}}</p>
+          <Radio v-if="item.controlType==1" 
+            :item="item"
+            :key="item.id"
+            @updata="updataData"/>
           <ComTextArea
             v-if="item.controlType == 5"
             :item="item"
+            @updata="updataData"
             @changeAreaVal="changeAreaVal($event,idx)"
           ></ComTextArea>
           <Input v-if="item.controlType==6 || item.controlType==7"
@@ -20,8 +25,10 @@
           >
             <MultiLineInput
               v-if="item.controlType == 3"
-              @changeMultipVal="changeMultipVal($event,idx)"
               :msg="part.name"
+              :part="part"
+              @updata="updataData($event,index,item)"
+              @changeMultipVal="changeMultipVal($event,idx)"
             ></MultiLineInput>
           </template>
         </li>
@@ -42,6 +49,7 @@
 import ComTextArea from '../common/ComTextArea.vue';
 import MultiLineInput from '../common/MultiLineInput.vue';
 import Input from '../common/Input.vue';
+import Radio from '../common/Radio.vue';
 
 export default {
   name: 'AddContent',
@@ -54,7 +62,8 @@ export default {
     }
   },
   mounted() {
-    this.dataTrd = this.allMoudles && this.allMoudles.moduleDetailDTOList
+    // this.dataTrd = this.allMoudles && this.allMoudles.moduleDetailDTOList
+    this.dataTrd = this.allMoudles && this.allMoudles.moduleDetailDTOList[0].questionMapping[1].questionMapping
   },
   methods: {
     back() {
@@ -65,25 +74,43 @@ export default {
       this.val = value
     },
     changeMultipVal(value, idx) {
-      console.log(value, idx)
+      // console.log(value, idx)
     },
     next(){
       this.$emit('next','preview')
     },
-    updataData(data){
-      // const origMapping = this.datas.questionMapping;
-      // let mapping = this.checkDatas.questionMapping;
-      // for(let i in origMapping){
-      //   if(origMapping[i].id==data.id){
-      //     mapping.splice(i,1,data)
-      //   }
-      // }
+    setDetail(obj){
+      this.labelDetail = obj.detail;
+      this.ppId = obj.ppId;
+      this.show = true;
+    },
+    updateOrig(){
+      let origin = this.$store.state.diagnose.origin;
+      // this.dtoList = origin;console.log("更新:",origin)
+    },
+    updataData(data,idx,item){
+      let mapping = this.dataTrd;
+      if(data.controlType == 3){
+        let tmpLis = item.questionDetailList
+        tmpLis.splice(idx,1,data)
+        // this.$store.commit('setDatas',{data:this.checkDatas,pId:this.checkDatas.id,type:this.type,ppId:this.ppId});
+        // this.$store.commit('setText',{text:msg,pId:this.checkDatas.id,type:this.type,flag:true});
+        return;
+      }
+      for(let i in mapping){
+        if(mapping[i].id==data.id){
+          mapping.splice(i,1,data)
+        }
+      }
+      this.$store.commit('setDataAll',data);
+      console.log(this.allMoudles)
     },
   },
   components: {
     ComTextArea,
     MultiLineInput,
     Input,
+    Radio,
   }
 }
 </script>
@@ -91,6 +118,7 @@ export default {
 @import "../less/base.less";
 .symp-wrap {
   font-size: 0.3rem;
+  padding-right: .3rem;
   h3 {
     color: #000;
     margin-bottom: 0.36rem;
@@ -118,4 +146,7 @@ export default {
   text-align: justify;
   line-height: .48rem /* 48/100 */;
 }
+.label{
+  .label;
+}
 </style>

+ 1 - 1
src/components/Others.vue

@@ -10,7 +10,7 @@
               :ppId="it.id" 
               :moduleType="datas.type" 
               @setDetail="setDetail"
-              @updateOrig="updateOrig"/>
+              @updateOrig=""/>
         <!-- 输入框 -->
         <Input v-if="it.controlType==6 || it.controlType==7"
             :item="it"

+ 3 - 2
src/components/TabPage.vue

@@ -35,7 +35,7 @@
       />
       <AddContent
         v-show="flag == 4&&moduleShow"
-        :allMoudles="modlues[3]"
+        :allMoudles="modlues[1]"
         :preName="modlues[2]&&modlues[2].name"
         @toggleModule="toggleModule"
         @next="toNext"
@@ -92,7 +92,8 @@ export default {
       let flag = parseInt(this.flag);
       if (this.modlues[flag]) {
         const type = this.modlues[flag].type;
-        this.flag = type;
+        // this.flag = type;
+        this.flag = 4;
         this.finish[type] = true;
       }
     },

+ 11 - 1
src/store.js

@@ -33,8 +33,18 @@ const store = new Vuex.Store({
       imgFile:[],
       imgSrc:{}
     },
+    addContent:{
+      origin:{},
+      text:[],
+    }
   },
   mutations:{
+    setDataAll(state,data){
+      let res = state.allMoudles
+      res[1].moduleDetailDTOList[0].questionMapping[1].questionMapping = data
+      state.allMoudles = res
+      console.log(data,res,5555555)
+    },
     savePathInfo(state,param){
       state.pathInfo = param;
     },
@@ -85,7 +95,7 @@ const store = new Vuex.Store({
           }
           break;
         case 4:
-
+          
           break;
         default:
           break;