浏览代码

添加常用科室症状

zhangxc 6 年之前
父节点
当前提交
3869532cff
共有 4 个文件被更改,包括 218 次插入29 次删除
  1. 3 0
      src/api/config.js
  2. 9 0
      src/api/icss.js
  3. 204 26
      src/components/icss/AddCommonSymptom.vue
  4. 2 3
      src/components/icss/CommonSymptom.vue

+ 3 - 0
src/api/config.js

@@ -108,6 +108,9 @@ export default {
     'uploadFile': 'api/icssman/retrieval/retrievalExcelIm', //别名维护-导入
     'commonSymptomList': 'api/icssman/questionUsual/getDeptInfos', //常见症状维护-常见症状列表
     'getDepartmentList':'api/icssman/questionUsual/getDeptName', //常见症状维护-科室列表
+    'getSymptomList':'api/icssman/questionUsual/getQuestionInfo', //常见科室症状维护--获取症状列表
+    'addCommonSymptom': 'api/icssman/questionUsual/addQuestionUsual',  //常见科室症状维护--添加修改科室症状
+    'delCommonSymptom': 'api/icssman/questionUsual/deleteQuestionUsual'  //常见科室症状维护--添加修改科室症状
 	},
 	menuIconList: { //菜单对应图标
 		'YH-KZT': 'el-icon-menu',

+ 9 - 0
src/api/icss.js

@@ -98,5 +98,14 @@ export default {
     },
     getDepartmentList() {   //常见症状维护-获取科室列表
         return axios.post(urls.getDepartmentList)
+    },
+    getSymptomList(param) {
+        return axios.post(urls.getSymptomList, param)
+    },
+    addCommonSymptom(param) {
+        return axios.post(urls.addCommonSymptom, param)
+    },
+    delCommonSymptom(param) {
+        return axios.post(urls.delCommonSymptom, param)
     }
 }

+ 204 - 26
src/components/icss/AddCommonSymptom.vue

@@ -5,12 +5,17 @@
             class="el-icon-back"
             @click="back"
         ></i> 常见症状维护系统--添加科室常见症状</div>
-        <el-form v-model="form" :rules="rules" class="addDepartForm">
+        <el-form :model="form" ref="ruleForm" :rules="rules" class="addDepartForm">
             <el-form-item label="选择科室" prop="department">
                 <el-select v-model="form.department" placeholder="请添加科室" class="selectDepart">
                     <el-option v-for="item in departList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                 </el-select>
             </el-form-item>
+             <el-form-item label="选择类型" prop="type">
+                <el-select v-model="form.department" placeholder="请选择类型" class="selectDepart">
+                    <el-option v-for="item in departList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+                </el-select>
+            </el-form-item>
         </el-form>
         <div class="symptomList">
             <div class="bottomPartLeft fl">
@@ -32,7 +37,7 @@
                             :key='item.id'
                             :title="'[ '+item.tagName+' ]'"
                             :style="getStyle(item)?styles:null"
-                            @click='selectLeftTag(item, index, $event)'
+                            @click='selectLeftTag(item, index)'
                         >
                             <p class="tagName ellipsis" >{{item.tagName}} </p>
                         </li>
@@ -48,28 +53,23 @@
                 <p class="symptomPoolTitle">常见症状:</p>
                 <ul class="tagList operationPool">
                         <li class = "tagItem"
-                            v-for="(item) in rightTagsList2" 
+                            v-for="(item) in rightTagsList" 
                             :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  ellipsis" :title="'[ '+item.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>
                         </li>
                     </ul>
 
             </div>
+            
+        </div>
+        <div class="btn">
+            <el-button
+            type="primary"
+            @click="submitForm('ruleForm')"
+            >确 定</el-button>
         </div>
     </div>
     
@@ -82,24 +82,34 @@
     data() {
         return{
             rules: {
-                department:[{required: true, message: '请选择科室', trigger: 'blur'}]
+                department:[{required: true, message: '请选择科室', trigger: ['blur']}],
+                type:[{required: true, message: '请选择科室', trigger: ['blur']}]
             },
             form: {
                 department: '',
+                type:''
             },
             departList: [],
-            searchVal: ''
+            searchVal: '',
+            leftTagsList:[],
+            rightTagsList:[],
+            selectLeftTagsList: [],
+            selectRightTagsList: [],
+            styles:{
+                background:'#eae7e7'
+            },
         }
     },
     created(){
         this.getDepartmentList()
+        this.getSymptomList()
     },
     watch: {
         searchVal(newVal, preVal) {
             if(newVal.trim() == ''){
-                this.searchTagList()
+                this.getSymptomList()
             }else if(newVal.trim() != preVal.trim()){
-                this.searchTagList()
+                this.getSymptomList()
             }
         }
     },
@@ -110,15 +120,130 @@
         getDepartmentList() {
             api.getDepartmentList().then((res)=>{
                if(res.data.code === '0') {
-                   console.log('ressss', res)
                    this.departList = res.data.data
-                   console.log( ' this.departList',this.departList)
+                   
+                }
+            })
+        },
+        getSymptomList() {
+            let noIds = []
+            for (let i =0; i < this.rightTagsList.length; i++) {
+                noIds.push(this.rightTagsList[i].id)
+            }
+            const param = {
+                "deptId": this.form.department,
+                "tagName": this.searchVal,
+                "noIds": noIds
+            }
+            api.getSymptomList(param).then((res)=>{
+               if(res.data.code === '0') {
+                   this.leftTagsList = res.data.data
                 }
             })
         },
-        searchTagList() {
+        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);
+            }
+        },
+        toRightList(){
+            this.rightTagsList.push(...this.selectLeftTagsList);
+            this.selectLeftTagsList = [];
+            this.selectRightTagsList = [];
+            this.getSymptomList()
+        },
+        toLeftList(){
+            for(let i = 0; i < this.selectRightTagsList.length; i++) {
+                this.rightTagsList = this.rightTagsList.filter(item => item.id !== this.selectRightTagsList[i].id)
+            }
+            this.selectLeftTagsList = [];
+            this.selectRightTagsList = [];
+            this.getSymptomList()
 
-        }
+        },
+        isHasTag(item, arr) {
+            for ( let i = 0; i <arr.length; i++) {
+                if(arr[i].id === item.id) {
+                    return true;
+                }
+            }
+            return false;
+        },
+        getStyle(item){       //左侧选中状态
+            return this.isHasTag(item, this.selectLeftTagsList)
+        },
+        getStyle2(item) {
+            return this.isHasTag(item, this.selectRightTagsList)
+        },
+        submitForm(formName) {
+           
+            this.$refs[formName].validate((valid) => {
+                if (valid) {
+                    return
+                } else {
+                    console.log('error submit!!');
+                    return false;
+                }
+            });
+             if(!this.form.department) {
+                return 
+            }
+            this.showDelDialog()
+        },
+        showDelDialog() {
+            let questionId = []
+            for (let i =0; i < this.rightTagsList.length; i++) {
+                questionId.push(this.rightTagsList[i].id)
+            }
+            const param ={
+                "deptId": this.form.department,
+                "questionId": questionId
+   
+            }
+            this.showConfirmDialog('是否保存该标签组?', () => {
+                api.addCommonSymptom(param).then((res) => {
+                if (res.data.code  === '0') {
+                    this.warning(res.data.msg || '保存成功', 'success','1000')
+                    setTimeout(() => {
+                    this.$router.push({
+                        path:'/admin/LT-YXSJWH-CJZZWH'
+                    })
+                    }, 1000);
+                } else {
+                    this.warning(res.data.msg)
+                }
+                }).catch((err) => {
+                    this.warning(err);
+                })
+            });
+        },
+        showConfirmDialog(msg, resolve) {
+            this.$alert(msg, '提示', {
+                confirmButtonText: '确定',
+                type: 'warning'
+            }).then(() => {
+                resolve();
+            }).catch(() => {});
+        },
+        warning(msg, type,time) {
+            this.$message({
+                showClose: true,
+                message: msg,
+                type: type || 'warning',
+                duration:time || '3000'
+            })
+        },
     }
   }
 </script>
@@ -144,14 +269,14 @@
              height: 500px;
         }
         .bottomPartLeft {
-            width: 40%;
+            width: 32%;
         }
         .symptomPoolTitle {
             height: 40px;
             line-height: 40px;
         }
         .symptomPool {
-            width: 80%;
+            width: 100%;
         }
         .tagList {
             width: 100%;
@@ -159,8 +284,50 @@
             border: 1px solid @icssBorder;
             box-sizing: border-box;
         }
+        .tagList {
+        border: 1px solid @icssBorder;
+        }
+        .tagPool {
+            height: 300px;
+            overflow-y: auto;
+
+        }
+        .tagItem {
+            position: relative;
+            line-height: 30px;
+            cursor: pointer;
+            padding: 0 10px;
+        }
+        .operationPool {
+            position: relative;
+            width: 60%;
+            min-height: 300px;
+            padding: 10px 0;
+        }
+        .tagName:before {
+            content: '['
+        }
+        .tagName::after {
+            content: ']'
+        }
         .bottomPartMid {
-            width: 10%;
+            width: 8%;
+            margin-top: 60px;
+            p {
+            width: 100%;
+            text-align: center;
+            span {
+                cursor: pointer;
+                display: inline-block;
+                width: 30px;
+                height: 40px;
+                line-height: 40px;
+                margin: 0 auto;
+                border: 1px solid @icssBorder;
+                margin-bottom: 15px;
+                font-size: 18px;
+            }
+            }
         }
         .bottomPartRight {
             width: 50%;
@@ -169,6 +336,17 @@
             width: 60%;
             height: 340px;
         }
+        .btn {
+            position: relative;
+            background-color: #fff;
+            margin: 0px 20px;
+            padding: 20px;
+            .el-button {
+                position: absolute;
+                right: 20px;
+                top: -20px;
+            }
+        }
         .selectDepart {
             
         }

+ 2 - 3
src/components/icss/CommonSymptom.vue

@@ -110,7 +110,6 @@
             console.log('commonSymptomList', res)
             const data = res.data.data;
             this.list = data.records;
-            this.cacheData[param.current] = data.records;
             this.total = data.total;
           }
         }).catch((error) => {
@@ -171,8 +170,8 @@
         }).catch(() => {});
       },
       showDelDialog(id){
-        this.showConfirmDialog('是否删除该科室?',()=>{
-          api.deleteDeptInfo({id}).then((res)=>{
+        this.showConfirmDialog('是否删除该科室症状?',()=>{
+          api.delCommonSymptom({'deptId':id}).then((res)=>{
             if(res.data.code=='0'){
               this.warning(res.data.msg||'操作成功','success');
               this.getDataList();