Browse Source

症状推送及其修改(未完成)

zhangxc 6 năm trước cách đây
mục cha
commit
f61ed45412

+ 3 - 0
src/api/utils.js

@@ -142,6 +142,9 @@ export default {
           mapping.sonQuestion = dataArr[i].id
           tmpArr.push(mapping)
         }
+      } else if(type == 11) {    //推送症状类型(添加症状)
+        mapping.sonQuestion = dataArr[i].id
+        tmpArr.push(mapping)
       }
     }
     return tmpArr;

+ 2 - 1
src/components/icss/BloodPressTagGroup.vue

@@ -106,6 +106,7 @@ export default {
             }
         }
         this.rightTagsList2 = newArr
+        this.$emit('changeActionData',this.rightTagsList2, false);
         this.searchTagList()
         // this.leftTagsList = this.pool
         // console.log('TAGPOOL', this.pool)
@@ -248,7 +249,7 @@ export default {
             let param = {
                 "tagName": this.searchVal,
                 "tagType": [1, 2],
-                "controlType": [],
+                "controlType": [1,2,6,7],
                 "type": this.type || '',
                 "notIds": notIds,
                 "sexType": this.sexType,

+ 1 - 0
src/components/icss/LabelGroup.vue

@@ -152,6 +152,7 @@ export default {
                 const {code,data,msg} = res.data;
                 if(code=='0'){
                     const item = Object.assign({},row,data);
+                    console.log('item', item)
                     this.$router.push({name:'AddLabelGroup',params:{isEdit:true,data:item}});
                 }else{
                     this.$message({

+ 7 - 1
src/components/icss/NoiseTemplate.vue

@@ -55,6 +55,11 @@
       </BloodPressTagGroup>
       <SymptomPush
         v-if="dataPub.region2 == 11" 
+        :pool="dataPub.tagPool" 
+        :type="dataPub.region1"
+        :sexType="dataPub.region7"
+        :options="editData.questionMapping"
+         @changeActionData="changeActionData"
       >
       </SymptomPush>
       <el-form
@@ -159,7 +164,8 @@ export default {
     },
     validatePass() {      //验证成功回调,调取接口
       //仍需验证标签明细是否选择
-      if (JSON.stringify(this.sendIds) == '[[],[],[],[],[],[]]' && this.dataPub.region2 != 6 && this.dataPub.region2 != 7 && this.dataPub.region2 != 8) {
+      console.log('.sendIds',this.sendIds)
+      if (JSON.stringify(this.sendIds) == '[[],[],[],[],[],[]]' && this.dataPub.region1 != 6 && this.dataPub.region1 != 7 && this.dataPub.region1 != 8) {
         this.$message({
           message: '请选择标签明细',
           type: 'warning'

+ 148 - 219
src/components/icss/SymptomPush.vue

@@ -1,9 +1,8 @@
-// 症状推送类型(添加症状)
 <template>
-    <div class="symptomTagGroupWrapper clearfix">
-    <div class="bottomPartLeft">
-      <p class="poolTitle">标签池</p>
-      <div class="pool">
+    <div class="symptomPushWrapper clearfix">
+    <div class="symptomPushBottomPartLeft">
+      <p class="symptomPushPoolTitle">标签池</p>
+      <div class="symptomPushPool">
         <el-input
           placeholder="请输入搜索内容"
           v-model="searchVal"
@@ -13,56 +12,44 @@
                 class="el-input__icon el-icon-search"
             ></i>
         </el-input>
-        <ul class="tagList tagPool">
+        <ul class="symptomPushTagList symptomPushTagPool">
             <li v-for="(item, index) in leftTagsList"
-                class = "tagItem"
+                class = "symptomPushTagItem"
                 :key='item.id'
                 :title="'[ '+item.tagName+' ]'"
                 :style="getStyle(item)?styles:null"
                 @click='selectLeftTag(item, index, $event)'
             >
-                <p class="tagName ellipsis" >{{item.tagName}} </p>
+                <p class="symptomPushTagName ellipsis" >{{item.tagName}} </p>
             </li>
         </ul>
       </div>
     </div>
-    <div class="bottomPartMid fl">
+    <div class="symptomPushBottomPartMid fl">
         <p><span class="el-icon-arrow-right" @click="toRightList"></span></p>
         <p><span class="el-icon-arrow-left" @click="toLeftList"></span></p>
     </div>
-    <div class="bottomPartRight ">
-      <p class="poolTitle">操作界面:</p>
-      <ul class="tagList operationPool">
-            <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 v-if="item.tagName" class="tagName">{{item.tagName}} </p>
-                <div class="attributeBox">
-                    <p v-if="item.symptomType === 1" class="tagAttribute" @click.stop>跟主症状 <span @click="closeTagAttribute(item)" class="closeTagAttribute"><i class="el-icon-error"></i></span></p>
-                    <p v-if="item.symptomType === 2" class="tagAttribute" @click.stop>跟伴随症状<span  @click="closeTagAttribute(item)" class="closeTagAttribute"><i class="el-icon-error"></i></span></p>
-                </div>
+    <div class="symptomPushBottomPartRight ">
+      <p class="symptomPushPoolTitle">操作界面:</p>
+      <ul v-for="(item, index) in rightTagsList" 
+            :key="index"    
+            class="symptomPushTagList symptomPushOperationPool"
+            :class="index === 1 ? 'symptomPushOperationPoolPush':'' "
+            :style="currentSelectIndex === index?styles:null"
+            @click="SelectList(index)"
+      >
+             
+            <li v-if="index===1" class = "symptomPushTagItemPushBox">   
+                <p class = "symptomPushTagItemPush" v-if="index===1">此处放置推送模块</p>
+            </li>
+            <li 
+                v-for="(it) in item.questionDetailList"
+                :key = "it.id"
+                class = "symptomPushTagItem">   
+                {{it.name}}
             </li>
         </ul>
     </div>
-    <div class="buttonBox">
-        <div class="mainButton">
-            <el-button type="primary" @click="mainSymptom">跟主症状</el-button>
-        </div>
-        <div class="followButton">
-            <el-button type="primary" @click="followSymptom">跟伴随症状</el-button>
-        </div>
-    </div>
   </div>
 </template>
 <script>
@@ -70,7 +57,7 @@ import api from '@api/icss.js';
 import utils from '@api/utils.js';
 
 export default {
-    name: "SymptomTagGroup",
+    name: "SymptomPush",
     props: {
         pool: {
             default: () => [],
@@ -92,10 +79,9 @@ export default {
     data() {
         return {
             leftTagsList: [],
-            selectLeftTagsList: [],
-            rightTagsList: [],
-            rightTagsList2: [],
-            selectRightTagsList: [],
+            selectLeftTagId: '',
+            rightTagsList: [{}, {}],
+            currentSelectIndex: -1,
             searchVal: '',
             styles:{
                 background:'#eae7e7'
@@ -103,22 +89,27 @@ export default {
         }
     },
     mounted() {
-        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+',,,'})
-            } 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.rightTagsList = 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+',,,'})
+        //     } 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 = newArr
+        console.log('this.options',this.options)
+        if(this.options.length) {
+            this.rightTagsList = this.options
+            this.$emit('changeActionData',this.rightTagsList, false);
         }
-        this.rightTagsList2 = newArr
         this.searchTagList()
         // this.leftTagsList = this.pool
         // console.log('TAGPOOL', this.pool)
@@ -137,129 +128,74 @@ export default {
             }
         },
         sexType(newVal, preVal) {
-            if (newVal != preVal) {
-                if (JSON.stringify(newVal) != JSON.stringify(preVal)) {
-                    this.leftTagsList = [];
-                    this.selectLeftTagsList = [];
-                    this.rightTagsList = [];
-                    this.rightTagsList2 = [];
-                    this.selectRightTagsList = [];
-                    this.searchVal = '';
-                     this.searchTagList();
-                }
-            }
+           
         },
 
         
     },
     methods: {
         selectLeftTag(tag, index, e) {
-            const hasTag = this.isHasTag(tag, this.selectLeftTagsList)
-            if (hasTag) {
-                this.selectLeftTagsList = this.selectLeftTagsList.filter(item => item.id !== tag.id)
-            } else {
-                this.selectLeftTagsList.push(tag);
-            }
-        },
-        selectRightTag(tag) {
-            const hasTag = this.isHasTag(tag, this.selectRightTagsList)
-            if (hasTag) {
-                this.selectRightTagsList = this.selectRightTagsList.filter(item => item.id !== tag.id)
-            } else {
-                this.selectRightTagsList.push(tag);
-            }
-            
-        },
-        isHasTag(item, arr) {
-            for ( let i = 0; i <arr.length; i++) {
-                if(arr[i].id === item.id) {
-                    return true;
+            let isFull = true
+            for(let i = 0; i < this.rightTagsList.length; i++) {
+                if(Object.keys(this.rightTagsList[i]).length === 0) {
+                    isFull = false
+                    break;
                 }
             }
-            return false;
+            if (isFull && this.currentSelectIndex === -1) {
+                return
+            }
+           this.selectLeftTagId = tag
+           console.log(this.selectLeftTagId)
         },
+        
         getStyle(item){       //左侧选中状态
-            // console.log('selected',utils.filterArr(this.leftTagsList,item,2))
-            // return utils.filterArr(this.selectLeftTagsList,item,2)
-            return this.isHasTag(item, this.selectLeftTagsList)
-        },
-        getStyle2(item) {
-            // return utils.filterArr(this.selectRightTagsList,item,2)
-            return this.isHasTag(item, this.selectRightTagsList)
+            return item.id == this.selectLeftTagId.id
         },
+        
         toLeftList() {
-            // if(!this.searchVal) {
-            //     this.leftTagsList = this.searchTagList()
-            // }
-            
-            for (let i = 0; i < this.selectRightTagsList.length; i++) {
-                this.rightTagsList = this.rightTagsList.filter(item => item.id !== this.selectRightTagsList[i].id)
+            if(this.currentSelectIndex === -1) {
+                return
             }
-            for (let i = 0; i < this.selectRightTagsList.length; i++) {//每次往回移时同时删掉下面输入框
-                if (this.selectRightTagsList[i].type !== 'input') {
-                    for (let j = 0; j < this.rightTagsList2.length; j++) {
-                        if(this.selectRightTagsList[i].id === this.rightTagsList2[j].id) {
-                            if(this.rightTagsList2.length === 3) {
-                                this.rightTagsList2 = []
-                            } else {
-                                this.rightTagsList2.splice(j, 2)
-                            }
-                        }
-                    }
-                }
-            }
-
-            // this.rightTagsList2 = [];
-            // let textItem = { text: ','  }
-            // for (let i = 0; i < this.rightTagsList.length; i++) {
-            //     if(this.rightTagsList2.length === 0) {
-            //         this.rightTagsList2.push(JSON.parse(JSON.stringify(textItem)))
-            //     }
-            //     this.rightTagsList2.push(this.rightTagsList[i]);
-            //     this.rightTagsList2.push(JSON.parse(JSON.stringify(textItem)))
-            // }
-            // for (let i = 0; i < this.rightTagsList.length; i++) {
-            //     this.leftTagsList = this.leftTagsList.filter(item => item.id !== this.rightTagsList[i].id)
-            // }
-            this.selectLeftTagsList = []
-            this.selectRightTagsList = []
+            this.rightTagsList.splice(this.currentSelectIndex, 1, { })
+            this.selectLeftTagId = {}
             this.searchTagList()
-            this.$emit('changeActionData',this.rightTagsList2, false);
+            this.$emit('changeActionData',this.rightTagsList, false);
         },
         toRightList() {
-            this.rightTagsList.push(...this.selectLeftTagsList);
-            let textItem = { text: ',' ,type:'input' }
-            for (let i = 0; i < this.selectLeftTagsList.length; i++) { //选中标签每个加入输入框,默认为逗号
-                if(this.rightTagsList2.length === 0) {
-                    let textItem1 = JSON.parse(JSON.stringify(textItem))
-                    textItem1.id = this.selectLeftTagsList[i].id + ',,'
-                    this.rightTagsList2.push(textItem1)
+            
+            if(this.currentSelectIndex === -1) {
+                let fillIndex = -1
+                for(let i = 0; i < this.rightTagsList.length; i++) {
+                    if(Object.keys(this.rightTagsList[i]).length === 0) {
+                        fillIndex = i
+                        break
+                     }
+                
+                }
+                if(fillIndex === 0) {
+                    this.getRighDetailsTag(fillIndex)
+                } else if (fillIndex === 1) {
+                    this.getRighDetailsTag(fillIndex)
                 }
-                this.rightTagsList2.push(this.selectLeftTagsList[i]);
-                let textItem2 = JSON.parse(JSON.stringify(textItem))
-                    textItem2.id = this.selectLeftTagsList[i].id + ','
-                this.rightTagsList2.push(JSON.parse(JSON.stringify(textItem2)))
+                
             }
             
-            for (let i = 0; i < this.rightTagsList.length; i++) {
-                this.leftTagsList = this.leftTagsList.filter(item => item.id !== this.rightTagsList[i].id)
-            }
-            this.selectLeftTagsList = []
-            this.selectRightTagsList = []
-            this.$emit('changeActionData',this.rightTagsList2, false);
+            
+           
         },
         searchTagList() {
             let notIds = []
-            for (let i = 0; i < this.rightTagsList2.length; i++) {
-                if(this.rightTagsList2[i].id) {
-                    notIds.push(this.rightTagsList2[i].id)
+            for (let i = 0; i < this.rightTagsList.length; i++) {
+                if(this.rightTagsList[i].id) {
+                    notIds.push(this.rightTagsList[i].id)
                 }
                 
             }
             let param = {
                 "tagName": this.searchVal,
-                "tagType": [1, 2],
-                "controlType": [],
+                "tagType": [1],
+                "controlType": [1,2,99],
                 "type": this.type || '',
                 "notIds": notIds,
                 "sexType": this.sexType,
@@ -268,103 +204,100 @@ export default {
             api.searchTagList(param).then((res) => {
                 if (res.data.code === '0') {
                     this.leftTagsList = res.data.data
-                    this.selectLeftTagsList = []
-                    this.selectRightTagsList = []
                 }
             })
            
         },
-        mainSymptom() {
-            for(let i = 0; i < this.selectRightTagsList.length; i++) {
-                this.rightTagsList2 = this.rightTagsList2.filter((item) =>{
-                    if(item.id === this.selectRightTagsList[i].id) {
-                        item.symptomType = 1
-                    }
-                    return item
-                })
-            }
-            
-            this.selectRightTagsList = []
-        },
-        followSymptom() {
-            for(let i = 0; i < this.selectRightTagsList.length; i++) {
-                this.rightTagsList2 = this.rightTagsList2.filter((item) =>{
-                    if(item.id === this.selectRightTagsList[i].id) {
-                        item.symptomType = 2
-                    }
-                    return item
-                })
+        getRighDetailsTag(fillIndex) {
+            let param = {
+                // "age": 0,
+                "id":  this.selectLeftTagId.id,
+                // "sexType": 3
             }
-            this.selectRightTagsList = []
+             api.detailsTag(param).then((res) =>{
+                //  if (res.data.code === '0') {
+                //      this.selectLeftTagId = res.data.data
+                //      if(this.currentSelectIndex !== -1) {
+                //         console.log('this.selectLeftTagId',this.selectLeftTagId)
+                //         //    this.rightTagsList[this.currentSelectIndex] = this.selectLeftTagId;
+                //         this.rightTagsList.splice(this.currentSelectIndex, 1, this.selectLeftTagId)
+                //     } else {
+                //         console.log(55656,this.selectLeftTagId)
+                //         for(let i = 0; i < this.rightTagsList.length; i++) {
+                //             if(Object.keys(this.rightTagsList[i]).length === 0) {
+                //                 this.rightTagsList.splice(i, 1, this.selectLeftTagId)
+                //                 break;
+                //             }
+                //         }
+                //     }
+                //     this.searchTagList()
+                //     console.log('this.rightTagsList',this.rightTagsList)
+                //     this.$emit('changeActionData',this.rightTagsList, false);
+                //  }
+             })
         },
-        closeTagAttribute(tag) {
-            this.rightTagsList2 = this.rightTagsList2.filter((item) =>{
-                    if(item.id === tag.id) {
-                        item.symptomType = 3
-                    }
-                    return item
-                })
+        SelectList(index) {
+            
+            this.currentSelectIndex = this.currentSelectIndex === index ? -1 : index;
         }
-
     }
 }
 </script>
 
 <style lang="less" >
 @import '../../less/common.less';
-.symptomTagGroupWrapper {
-    .bottomPartLeft {
+.symptomPushWrapper {
+    .symptomPushBottomPartLeft {
         width: 30%;
         box-sizing: border-box;
         float: left;
     }
-    .poolTitle {
+    .symptomPushPoolTitle {
         // border-bottom: 1px solid @icssBorder;
         box-sizing: border-box;
         margin-bottom: 20px;
     }
-    .pool {
+    .symptomPushPool {
         // border:1px solid @icssBorder;
     
     }
-    .search {
+    .symptomPushSearch {
         width: 100%;
         border-bottom: 1px solid @icssBorder;
         box-sizing: border-box;
         height: 30px;
     }
-    .tagList {
+    .symptomPushTagList {
         border: 1px solid @icssBorder;
     }
-    .tagPool {
+    .symptomPushTagPool {
         height: 300px;
         overflow-y: auto;
 
     }
-    .attributeBox {
-        position: absolute;
-        right: -100px;
-        top: 2px;
+    .symptomPushOperationPoolPush {
+        border: 1px dashed @icssBorder;
     }
-    .tagItem {
+    .symptomPushTagItem {
         position: relative;
         line-height: 30px;
         cursor: pointer;
         padding: 0 10px;
     }
-    .operationPool {
+    .symptomPushOperationPool {
         position: relative;
-        width: 60%;
+        width: 30%;
         min-height: 300px;
         padding: 10px 0;
+        float: left;
     }
-    .tagName:before {
+    .symptomPushTagName:before {
         content: '['
     }
-    .tagName::after {
+    .symptomPushTagName::after {
         content: ']'
     }
-    .bottomPartMid {
+    .symptomPushBottomPartMid {
         width: 8%;
         margin-top: 60px;
         p {
@@ -383,25 +316,18 @@ export default {
         }
         }
     }
-    .bottomPartRight {
+    .symptomPushBottomPartRight {
         float: left;
-        width: 40%;
+        width: 60%;
     }
-    .buttonBox {
+    .symptomPushButtonBox {
         width: 10%;
         float: left;
     }
-    .followButton {
+    .symptomPushFollowButton {
         margin-top: 20px;
     }
-    .tagAttribute {
-       border: 1px solid @icssBorder;
-       height: 17px;
-       line-height: 17px;
-       padding: 3px 5px;
-       border-radius: 10px;
-    }
-    .inputBox {
+    .symptomPushInputBox {
         width: 120px;
         .el-input {
             .el-input__inner {
@@ -410,11 +336,14 @@ export default {
             }
         }
     }
-    .closeTagAttribute {
-        position: absolute;
-        top: -5px;
-        right: -5px;
+    .symptomPushTagItemPushBox {
+        text-align: center
     }
+    .symptomPushTagItemPush {
+        display: inline-block;
+        padding: 5px 10px;
+    }
+
     .active {
         color: #aBcdef;
     }

+ 7 - 3
src/components/icss/SymptomTagGroup.vue

@@ -118,14 +118,18 @@ export default {
             }
         }
         this.rightTagsList2 = newArr
+        this.$emit('changeActionData',this.rightTagsList2, false);
         this.searchTagList()
         // this.leftTagsList = this.pool
         // console.log('TAGPOOL', this.pool)
     },
     watch: {
         pool(newVal, preVal) {
+             this.leftTagsList = newVal
+            console.log('sdsadasdasdasdas11111111', newVal,'asds',preVal)
             if (JSON.stringify(newVal) != JSON.stringify(preVal)) {
-                this.leftTagsList = newVal
+                console.log('sdsadasdasdasdas')
+                //  this.leftTagsList = newVal
             }
         },
         searchVal(newVal, preVal){
@@ -144,7 +148,7 @@ export default {
                     this.rightTagsList2 = [];
                     this.selectRightTagsList = [];
                     this.searchVal = '';
-                     this.searchTagList();
+                    //  this.searchTagList();
                 }
             }
         },
@@ -257,7 +261,7 @@ export default {
             let param = {
                 "tagName": this.searchVal,
                 "tagType": [1, 2],
-                "controlType": [],
+                "controlType": [1,2,6,7],
                 "type": this.type || '',
                 "notIds": notIds,
                 "sexType": this.sexType,