Browse Source

merge from 'dev'

zhangxc 6 years ago
parent
commit
003f6be0e9

+ 1 - 1
src/api/config.js

@@ -86,6 +86,7 @@ export default {
     'getDropList': 'api/icssman/dictionaryInfo/getList', //下来选项列表(标签类型、标签归属等)
     'getTagList': 'api/icssman/questionInfo/list', //标签列表
     'searchTagList': 'api/icssman/questionInfo/index', //标签池检索
+    'detailsTagList': 'api/icssman/questionInfo/getByIds', //根据多个标签ID返回标签内容
 	},
 	menuIconList: { //菜单对应图标
 		'YH-KZT': 'el-icon-menu',
@@ -98,6 +99,5 @@ export default {
 		'LT-GRZX': 'el-icon-news'
   },
   controlType:{
-    
   }
 }

+ 3 - 0
src/api/icss.js

@@ -15,4 +15,7 @@ export default {
     validateSystomName(param) {
         return axios.post(urls.searchTagList, param)
     },
+    detailsTagList(param) {
+        return axios.post(urls.detailsTagList, param)
+    },
 }

+ 22 - 0
src/api/utils.js

@@ -52,5 +52,27 @@ export default {
       return '目前只能导出30天内数据,请重新筛选时间';
     }
     return true;
+  },
+  /**
+   * 
+   * @param {arr} 被操作的数组 
+   * @param {val} 需要剔除或者判断的值 
+   * @param {type} 是剔除(1)还是判断(2)是否存在,不存在返回[]
+   */
+  filterArr(arr,val,type,des){  //数组剔除指定元素 
+    if(type == 1){
+      if(des){
+        return arr.filter(item => item.id != val)
+      }else{
+        return arr.filter(item => item != val)
+      }
+    }else{
+      let tmp = arr.filter(item => JSON.stringify(item) == JSON.stringify(val))
+      if(JSON.stringify(tmp) == '[]'){
+        return false;
+      }else{
+        return true;
+      }
+    }
   }
 }

+ 31 - 21
src/components/icss/NoiseTemplate.vue

@@ -4,13 +4,22 @@
         class="el-icon-back"
         @click="back"
       ></i> 标签组维护--添加标签组</div>
-    <PubTagGroup @changeVal="changeVal" @validatePass="validatePass" ref="submitForm"></PubTagGroup>
+    <PubTagGroup
+      @changeVal="changeVal"
+      @changeSex="changeSex"
+      @changeType="changeType"
+      @validatePass="validatePass"
+      ref="submitForm"
+    ></PubTagGroup>
     <div class="main">
       <p class="title"> <i>*</i> 标签明细:</p>
-      <PubTagPartDetail v-show="dataPub.region2 == 2"></PubTagPartDetail>
+      <PubTagPartDetail :pool="dataPub.tagPool" :type="dataPub.region1" :sign="dataPub.region2" v-show="dataPub.region2 == 2"></PubTagPartDetail>
       <SymptomTagGroup v-if="dataPub.region2 == 4" :dataPub ="this.dataPub"></SymptomTagGroup>
       <div class="btn">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm"
+        >确 定</el-button>
       </div>
     </div>
   </div>
@@ -23,27 +32,33 @@ import PubTagGroup from './PubTagGroup';
 import PubTagPartDetail from './PubTagPartDetail';
 import SymptomTagGroup from './SymptomTagGroup';
 export default {
-  name:'NoiseTemplateWrapper',
-  data(){
+  name: 'NoiseTemplateWrapper',
+  data() {
     return {
-      dataPub:{},      //公用组件传的值都在这
+      dataPub: {},      //公用组件传的值都在这
     }
   },
-  methods:{
-    back() {this.$router.go(-1)},
-    changeVal(val){    //子组件数据改变传递到父组件
+  methods: {
+    back() { this.$router.go(-1) },
+    changeVal(val) {    //子组件数据改变传递到父组件
       this.dataPub = val
-      console.log('公用组件传的值都在这',val)
+      console.log('公用组件传的值都在这', val)
+    },
+    changeSex(sex) {       //性别改变,清空标签明细
+      console.log(sex)
+    },
+    changeType(type){        //填写单类型改变,标签明细左侧更新,右侧清空
+      console.log(type)
     },
     submitForm() {       // 调用子组件的方法验证公用部分
-      this.$refs.submitForm.submitForm('groups');  
+      this.$refs.submitForm.submitForm('groups');
     },
-    validatePass(){      //验证成功回调,调取接口
+    validatePass() {      //验证成功回调,调取接口
       //仍需验证标签明细是否选择
       
     },
   },
-  components:{
+  components: {
     PubTagGroup,
     PubTagPartDetail,
     SymptomTagGroup,
@@ -51,18 +66,13 @@ export default {
 }
 </script>
 <style lang="less">
-@import '../../less/common.less';
+@import "../../less/common.less";
 .NoiseTemplateWrapper {
   .groupTitle {
     background-color: #fff;
     height: 40px;
     line-height: 40px;
     padding-left: 20px;
-    // position: fixed;
-    // width: 100%;
-    // top: 60px;
-    // left: 384px;
-    // z-index: 33;
   }
   .main {
     background-color: #fff;
@@ -72,10 +82,10 @@ export default {
     box-sizing: border-box;
     font-size: 14px;
     color: #606266;
-    .title{
+    .title {
       margin-bottom: 20px;
       i {
-        color:#f56c6c;
+        color: #f56c6c;
       }
     }
   }

+ 21 - 8
src/components/icss/PubTagGroup.vue

@@ -31,7 +31,7 @@
         <el-select
           v-model="form.region2"
           placeholder="请选择填写单类型"
-          @change="sendData"
+          @change="changeType"
         >
           <el-option
             v-for="item in labelTypes"
@@ -237,6 +237,9 @@ export default {
     newType() {
       return this.form.region1;
     },
+    newSign() {
+      return this.form.region2;
+    },
   },
   mounted() {
     this.$emit('submitForm', 'groups', false);
@@ -248,8 +251,12 @@ export default {
     },
     newType(nextVal, prevVal) {
       if (nextVal != prevVal) {
-        this.searchTagList(nextVal)
-        this.type = nextVal
+        this.searchTagList()
+      }
+    },
+    newSign(nextVal, prevVal) {
+      if (nextVal != prevVal && JSON.stringify(this.form.tagPool) != '[]' ) {
+        this.searchTagList()
       }
     },
   },
@@ -262,11 +269,12 @@ export default {
         }
       })
     },
-    searchTagList(type) {
+    searchTagList() {
+      let region1 = this.form.region1,region2 = this.form.region2;
       let param = {
-        "type": type,
-        "tagType": type == 1?[1]:[],
-        "controlType":type == 1?[1,2]:[],
+        "type": region1,
+        "tagType": region2 == 2?[1]:[],
+        "controlType":region2 == 2?[1,2]:[],
       }
       api.searchTagList(param).then((res) => {
         if (res.data.code === '0') {
@@ -276,7 +284,7 @@ export default {
     },
     validateSystomName(name,callback) {
       if(this.form.region3.trim() == ''){ return }
-      let param = {"existName": this.form.region3,"type": this.type}
+      let param = {"existName": this.form.region3,"type": this.form.region1}
       api.validateSystomName(param).then((res) => {
         if (res.data.code === '0') {
           if(res.data.data && res.data.data.length != 0){
@@ -290,6 +298,10 @@ export default {
     sendData() {
       this.$emit('changeVal', this.form, false)
     },
+    changeType(type){
+      this.$emit('changeVal', this.form, false)
+      this.$emit('changeType', type, false)
+    },
     changeSex(sex) {   //改变性别清空数据
       this.form = {
         region1: '',
@@ -304,6 +316,7 @@ export default {
         tagPool:[]
       }
       this.$emit('changeVal', this.form, false)
+      this.$emit('changeSex', sex, false)
     },
     readyChangeSex(data) {
       let sex = data;

+ 343 - 29
src/components/icss/PubTagPartDetail.vue

@@ -1,71 +1,385 @@
 <template>
   <div class="bottomPart clearfix">
     <div class="bottomPartLeft fl">
-      <p class="poolTitle">标签池</p>
+      <p class="desTitle">标签池:</p>
       <div class="pool">
-        <div class="search">搜索</div>
-        <ul>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
-          <li>标签</li>
+        <el-input
+          placeholder="请输入搜索内容"
+          v-model="searchVal"
+        >
+          <i
+            slot="prefix"
+            class="el-input__icon el-icon-search"
+          ></i>
+        </el-input>
+        <ul class="pubList searchList">
+          <li class="pubLiStyle pubLiStyleWrap ellipsis"
+            v-for="val in currentPool"
+            :title="'[ '+val.tagName+' ]'"
+            :key="val.id"
+            :style="getStyle(val.id)?styles:null"
+            @click="detailsTagList(val.id)" 
+          >{{val.tagName}}</li>
         </ul>
       </div>
     </div>
     <div class="bottomPartMid fl">
-      <p><span class="el-icon-arrow-left"></span></p>
-      <p><span class="el-icon-arrow-right"></span></p>
+      <p><span class="el-icon-arrow-right" @click="toRightPool"></span></p>
+      <p><span class="el-icon-arrow-left" @click="toLeftPool"></span></p>
     </div>
-    <div class="bottomPartRight fr">
-      <span>操作界面</span>
+    <div class="bottomPartRight fl">
+      <p class="desTitle">操作界面:</p>
+      <div class="rightPool">
+        <div
+          class="onlyTop pubLiStyle"
+          :class="selectArr[0]?'activeBgc':null"
+          @click="selectPart(0)"
+        >
+          <template v-for="item in poolDetailList[0]">
+            <span class="hzx" v-for="part in item.questionDetailList" :key="part.id">{{part.name}}</span>
+          </template>
+        </div>
+        <div class="onlyBottom pubList">
+          <ul class="clearfix">
+            <li v-for="n in 5"
+              :key="n + 'part'"
+              class="onlyBottomPart"
+              :class="selectArr[n]?'activeBgc':null"
+              :style="{borderRight:n==5?'0':''}"
+              @click="selectPart(n)"
+            >
+              <ul>
+                <template v-for="item in poolDetailList[n]">
+                  <li class="partDetail" v-for="part in item.questionDetailList" :key="part.id">
+                    {{part.name}}
+                  </li>
+                </template>
+              </ul>
+            </li>
+          </ul>
+        </div>
+      </div>
+      <div class="partWaring">
+        <ul>
+          <li v-for="i in 5" :key="i">
+            <template v-for="item in poolDetailList[i]">
+              <p class="partDetail" v-show="item.controlType != 1" :key="item.id + '1'">
+                {{1}}
+              </p>
+              <p class="partDetail" v-show="item.controlType != 2" :key="item.id + '2'">
+                {{2}}
+              </p>
+            </template>
+          </li>
+         
+        </ul>
+      </div>
     </div>
+    <span class="mutex">互斥项</span>
   </div>
 </template>
 <script>
+import api from '@api/icss.js';
+import utils from '@api/utils.js';
+
 export default {
-  data(){
+  props: {
+    pool: {
+      default: () => [],
+      type: Array
+    },
+    type: {
+      default: '',
+      type: String
+    },
+    sign: {
+      default: '',
+      type: String
+    },
+    choose: {
+      default: 'single',      //multiple多选
+      type: String
+    },
+  },
+  data() {
     return {
-      msg:''
+      currentDetail: {},     //当前点击的标签对应的展开数据
+      poolDetailList: [     //默认6个部分
+        [], [], [], [], [], []
+      ],
+      poolDetailListAll:[],    //默认6个部分转化为一维数组
+      activePart: '-1',     //选中part第几个
+      selectArr: [false, false, false, false, false, false],   //右侧选中part状态
+      select: '',              //右侧选中的项
+      
+      styles:{
+        background:'#eae7e7'
+      },                       //选中单条样式
+      searchVal: '',           //搜索值
+      currentPool: [],         //标签池数据
+      currentLis:[],           //选中单条ID组合(多选)
+      notIds:[],               //去重IDs
     }
+  },
+  watch: {
+    pool(newVal, preVal) {
+      if (JSON.stringify(newVal) != JSON.stringify(preVal)) {
+        this.currentPool = newVal
+      }
+    },
+    searchVal(newVal, preVal){
+      if(newVal.trim() == ''){
+        this.searchTagList()
+      }else if(newVal.trim() != preVal.trim()){
+        this.searchTagList()
+      }
+    }
+  },
+  methods: {
+    toRightPool(){
+
+    },
+    toLeftPool(){
+
+    },
+    getStyle(id){       //左侧选中状态
+      return utils.filterArr(this.currentLis,id,2)
+    },
+    searchTagList() {
+      let ids = [];
+      this.poolDetailListAll.map((value)=>{
+        ids.push(value.id)
+        this.notIds = ids;
+      })
+      let param = {
+        "tagName": this.searchVal || '',
+        "type": this.type,
+        "notIds": this.notIds,
+        "tagType": this.sign == 2?[1]:[],
+        "controlType":this.sign == 2?[1,2]:[],
+      }
+      api.searchTagList(param).then((res) => {
+        if (res.data.code === '0') {
+          this.currentPool = res.data.data
+        }
+      })
+    },
+    selectPart(idx) {
+      let tmpFst1 = this.selectArr[0],
+        tmpFst2 = this.selectArr[1],
+        tmpFst3 = this.selectArr[2],
+        tmpFst4 = this.selectArr[3],
+        tmpFst5 = this.selectArr[4],
+        tmpFst6 = this.selectArr[5];
+      if (idx == 0) {
+        this.selectArr = [!tmpFst1, false, false, false, false, false];
+      } else if (idx == 1) {
+        this.selectArr = [false, !tmpFst2, false, false, false, false];
+      } else if (idx == 2) {
+        this.selectArr = [false, false, !tmpFst3, false, false, false];
+      } else if (idx == 3) {
+        this.selectArr = [false, false, false, !tmpFst4, false, false];
+      } else if (idx == 4) {
+        this.selectArr = [false, false, false, false, !tmpFst5, false];
+      } else if (idx == 5) {
+        this.selectArr = [false, false, false, false, false, !tmpFst6];
+      }
+      let tmpArr = this.selectArr;
+      let num = 0;
+      tmpArr.map((val, idx) => {
+        if (val) {
+          this.activePart = idx;
+        } else {
+          num = ++num
+          if (num == 6) { this.activePart = '-1' }
+        }
+      })
+    },
+    detailsTagList(id) {
+      let plus1 = 0,plus2 = 0;
+      for(let j = 0;j < this.selectArr.length;j++){        //判断右侧有没有选中
+        if(!this.selectArr[j]){
+          ++plus1;
+          if(plus1 == 6){       //右侧未选中
+            for(let k = 1;k < this.poolDetailList.length;k++){
+              if(JSON.stringify(this.poolDetailList[k]) != '[]'){
+                ++plus2
+                if(plus2 == 5){     //右侧数据填满了
+                  alert('请选择需要修改的模块')
+                  return;
+                }
+              }
+            }
+          }
+        }
+      }
+      if(this.choose == 'single'){           //单选
+        let tmpIds = [];
+        tmpIds.push(id);
+        this.currentLis = tmpIds;
+      }else{                                //多选
+        // let tmpIds = this.currentLis;
+        // if(utils.filterArr(tmpIds,id,2)){
+        //   return;
+        // }else{
+        //   tmpIds.push(id);
+        // }
+        // this.currentLis = tmpIds;
+      }
+
+      let param = {
+        // "age": 0,
+        "ids": id,
+        // "sexType": 3
+      }
+      api.detailsTagList(param).then((res) => {        //右侧展开内容
+        if (res.data.code === '0') {
+          const currentDetail = res.data.data[id];
+          this.currentDetail = currentDetail;
+          let num = 0;
+          if(this.choose == 'single'){              //判断是单选
+            this.selectArr.map((flg,idx)=>{         //判断右侧有没有选中
+              if(flg){    //有选中
+                let tmp = [],ids = [];
+                tmp.push(currentDetail);
+                this.poolDetailList[idx] = tmp;
+                this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);     //二维转一维
+                this.searchTagList();
+              }else{      //没选中,按順序第二个开始添加
+                ++num;
+                if(num == 6){
+                  for(let i = 1;i < this.poolDetailList.length;i++){
+                    let tmp = [],ids = [];
+                    if(this.poolDetailList[i].length == 0){      //判断part里面是不是有数据,没有直接添加
+                      tmp.push(currentDetail);
+                      this.poolDetailList[i] = tmp;
+                      this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);
+                      this.searchTagList();
+                      return;
+                    }
+                  }
+                }
+              }
+            })
+          }
+        }
+      })
+    },
   }
 }
 </script>
 <style lang="less">
-@import '../../less/common.less';
+@import "../../less/common.less";
 .bottomPart {
+  box-sizing: border-box;
+  padding-right: 100px;
+  position: relative;
+  padding-bottom: 500px;
+  .desTitle {
+    padding-bottom: 10px;
+  }
+  .pubList {
+    height: @icssHeight;
+    overflow: auto;
+  }
+  .pubLiStyle {
+    height: 30px;
+    line-height: 30px;
+    padding: 0 8px;
+  }
+  .pubLiStyleWrap:hover {
+    background-color: #f5f5f5;
+  }
+  .pubLiStyleWrap:before {
+    content: "[ ";
+  }
+  .pubLiStyleWrap:after {
+    content: " ]";
+  }
+  .mutex {
+    position: absolute;
+    right: 36px;
+    top: 36px;
+  }
   .bottomPartLeft {
     width: 30%;
-    border:1px solid @icssBorder;
-    box-sizing: border-box;
-    .poolTitle {
-      border-bottom: 1px solid @icssBorder;
-      box-sizing: border-box;
-    }
     .pool {
-      
+      border: 1px solid @icssBorder;
+      .el-input__prefix {
+        left: 5px;
+        right: auto;
+      }
+      .el-input__inner {
+        height: 31px;
+        line-height: 31px;
+      }
+      .el-input__icon {
+        line-height: 31px;
+      }
+      .el-input--prefix .el-input__inner {
+        border: 0 none;
+        border-bottom: 1px solid @icssBorder;
+        border-radius: 0;
+      }
+      .search {
+        border-bottom: 1px solid @icssBorder;
+      }
+      .searchList {
+        li {
+        }
+      }
     }
   }
   .bottomPartMid {
     width: 10%;
+    margin-top: 60px;
     p {
       width: 100%;
       text-align: center;
       span {
         display: inline-block;
-        width: 50px;
-        height: 30px;
-        line-height: 30px;
+        width: 30px;
+        height: 40px;
+        line-height: 40px;
         margin: 0 auto;
+        border: 1px solid @icssBorder;
+        margin-bottom: 15px;
+        font-size: 18px;
       }
     }
   }
   .bottomPartRight {
     width: 60%;
-    background-color: red;
+    .partWaring {
+      li {
+        float: left;
+        width: 20%;
+        padding: 5px;
+        box-sizing: border-box;
+      }
+    }
+    .rightPool {
+      border: 1px solid @icssBorder;
+    }
+    .onlyTop {
+      border-bottom: 1px solid @icssBorder;
+      .hzx{
+        padding: 0 30px 0 0;
+      }
+    }
+    .onlyBottom {
+      .onlyBottomPart {
+        float: left;
+        border-right: 1px solid @icssBorder;
+        box-sizing: border-box;
+        width: 20%;
+        height: @icssHeight;
+        overflow: auto;
+        .partDetail {
+          padding: 3px 5px;
+        }
+      }
+    }
   }
 }
 </style>

+ 14 - 0
src/components/icss/TagPool.vue

@@ -0,0 +1,14 @@
+<template>
+  
+</template>
+<script>
+export default {
+  data(){
+
+  }
+}
+</script>
+<style lang="less">
+
+</style>
+

+ 6 - 0
src/less/base.less

@@ -42,4 +42,10 @@ a {
 .fr {
   float: right;
 }
+.ellipsis {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 

+ 7 - 0
src/less/common.less

@@ -17,6 +17,7 @@
 /*朗通后台基本颜色*/
 @adminBase: #22ccc8;
 @icssBorder: #c0c4cc;
+@icssHeight:150px;
 
 /*用户后台基本颜色*/
 @userBase: #1774f0;
@@ -162,4 +163,10 @@
 
 .el-form-item__error {
   top: 34px;
+}
+
+
+/* 选中状态边框颜色改变 */
+.activeBgc {
+  background-color: #eae7e7;
 }