123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531 |
- <template>
- <div class="addConceptRelationBox" @click="close">
- <crumbs
- :title="'医学术语关联维护-'+titleText"
- class="topBack"
- :param="$route.params"
- linkTo="ConceptRelation"
- ></crumbs>
- <el-form :model="form" ref="ruleForm" class="addDepartForm">
- <p class="assayTitle">选择医学标准术语</p>
- <el-form-item v-if="!isEdit" label="术语搜索:" prop="department">
- <input class="searchInput" @focus="focuInput" type="text" v-model = "searchDiagVal">
- <span class="searchName" @click="searchDiag">搜索</span>
- <!-- <ul class="itemList conceptList" ref="conceptList"> -->
- <ul class="itemList" v-show="conceptList.length>0">
- <li
- v-for="item in conceptList"
- class="diagItem ellipsis"
- :title="item.conceptNameType"
- @click="selectDiag(item)"
- :key="item.conceptId">
- {{item.conceptNameType||item.conceptName}}
- </li>
- </ul>
- </el-form-item>
- <el-form-item class="isRequired" label="已选择术语:" prop="type">
- {{form.conceptNameType}}
- </el-form-item>
- </el-form>
- <div class="symptomList">
- <div class="bottomPartLeft fl">
- <p class="assayTitle">关联标准术语</p>
- <p class="symptomPoolTitle">术语搜索</p>
- <!-- <el-form>
- <el-form-item label="类型:">
- <el-select v-model="type" placeholder="请选择" size="small">
- <el-option
- v-for="item in typeList"
- :key="item.key"
- :label="item.name"
- :value="item.key">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form> -->
- <div class="symptomPool">
- <el-input
- placeholder="请输入搜索内容"
- v-model="searchTagVal">
- <i slot="prefix" class="el-input__icon el-icon-search"></i>
- </el-input>
- <ul class="tagList tagPool">
- <li v-for="(item, index) in leftTagsList"
- class = "tagItem"
- :key='item.conceptId'
- :title="item.conceptNameType"
- :style="getStyle(item)?styles:null"
- @click='selectLeftTag(item, index)'
- >
- <!-- <p class="tagName ellipsis" >{{item.conceptName}} </p> -->
- <p class="ellipsis" >{{item.conceptNameType}} </p>
- </li>
- </ul>
- </div>
- </div>
- <div class="bottomPartMid 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 fl">
- <p class="symptomPoolTitle">已选内容:</p>
- <ul class="tagList operationPool">
- <li class = "tagItem"
- v-for="(item,index) in rightTagsList"
- :key='item.conceptId'
- :style="index === selectRightTagIndex?styles:null"
- @click='selectRightTag(index)'
- >
- <!-- <p v-if="item.conceptName" class="tagName ellipsis" :title="'[ '+item.conceptName+' ]'">{{item.conceptName}} </p> -->
- <p v-if="item.conceptName" class="ellipsis" :title="item.conceptNameType">{{item.conceptNameType}} </p>
- </li>
- </ul>
- </div>
- <div class="bottomPartMid fl" >
- <p><span class="el-icon-arrow-up" @click="toUp"></span></p>
- <p><span class="el-icon-arrow-down" @click="toDown"></span></p>
- </div>
- </div>
- <div class="btn">
- <el-button
- type="primary"
- :disabled = 'saveDisable'
- @click="submitForm('ruleForm')"
- >确 定</el-button>
- </div>
- </div>
- </template>
- <script>
- import api from '@api/icss.js';
- export default {
- name: 'AddConceptRelation',
- data() {
- return{
- form: {
- conceptId: '',
- conceptName:'',
- conceptNameType:''
- },
- titleText: '添加',
- conceptList: [],
- searchDiagVal: '',
- searchTagVal: '',
- isEdit: false,
- leftTagsList:[],
- rightTagsList:[], //右侧已选的左侧不能再搜出--去重处理
- selectLeftTagsList: [],
- selectRightTagIndex: -1,
- styles:{
- background:'#eae7e7'
- },
- type:null,
- typeList:[],
- nodeList:[],
- saveDisable: false, //保存按钮禁止点击
- conceptType:'',
- searchType:''
- }
- },
- created(){
- const { isEdit, data , filter} = this.$route.params;
- const typeL = filter.type.toString().split('101');
- this.conceptType = typeL[0];
- this.searchType = typeL[1];
- if(isEdit) {
- this.titleText = '修改';
- this.isEdit = isEdit;
- this.rightTagsList = data.nodeList;
- this.form.conceptId =data.conceptId;
- this.form.conceptName =data.conceptName;
- this.form.conceptNameType =data.conceptNameType;
- }
- let typeList = JSON.parse(localStorage.getItem("knowledgeEnumsData"));
- // this.typeList = typeList.lexiconTypeEnum;
- this.typeList = typeList.concatLexiconTypeEnum; //7-8 RGB
- this.getTagList();//获取标签池内容
- },
- watch: {
- searchTagVal(newVal, preVal) {
- if(newVal.trim() != preVal.trim()){
- this.getTagList(false)
- }
- },
- type(newVal,preVal){
- if(newVal != preVal){
- this.getTagList(true)
- }
- }
- },
- methods: {
- close() {
- this.conceptList =[];
- },
- back(){
- this.$router.go(-1);
- },
- searchDiag() {
- const param = {
- "name": this.searchDiagVal,
- "relationId": 17,
- "relationPosition": 1,
- "typeId":this.conceptType,
- "relationTypeId":this.searchType //9-19新增
- }
- api.getConceptInfoAssay(param).then((res)=>{
- if(res.data.code === '0') {
- this.conceptList = res.data.data
- }
- })
- },
- selectDiag(item) {
- this.form.conceptId = item.conceptId;
- this.form.conceptName = item.conceptName;
- this.form.conceptNameType = item.conceptNameType;
- this.searchDiagVal = '';
- this.conceptList=[];
- },
- focuInput() {
- },
- getTagList(flag) {
- const notIds = this.selectedTags();
- //2019-8-15 需求修改:搜索结果与类型关联bug2045
- let param = {
- "name": this.searchTagVal,
- "relationId": 17,
- "relationPosition": 2,
- // "typeId": this.type, //选中类型的id
- "typeId": this.searchType, //选中类型的id
- "relationConceptId":this.form.conceptId,
- "excludedConceptIds":notIds
- }
- // let param;
- /*if(flag){
- param = {
- "name": this.searchTagVal,
- "relationId": 17,
- "relationPosition": 2,
- "typeId": this.type, //选中类型的id
- "relationConceptId":this.form.conceptId,
- "excludedConceptIds":notIds
- }
- }else{// 单独搜索时不带类型限制
- param = {
- "name": this.searchTagVal,
- "relationId": 17,
- "relationPosition": 2,
- "relationConceptId":this.form.conceptId,
- "excludedConceptIds":notIds
- }
- }*/
- api.getConceptInfoAssay(param).then((res)=>{
- if(res.data.code === '0') {
- this.leftTagsList = res.data.data
- }
- })
- },
- selectedTags() {//右侧选项ids
- let selectedTags = []
- for (let i =0; i < this.rightTagsList.length; i++) {
- selectedTags.push(this.rightTagsList[i].conceptId)
- }
- return selectedTags
- },
- selectLeftTag(tag, index, e) {
- const hasTag = this.isHasTag(tag, this.selectLeftTagsList)
- if (hasTag) {
- this.selectLeftTagsList = this.selectLeftTagsList.filter(item => item.conceptId !== tag.conceptId)
- } else {
- this.selectLeftTagsList.push(tag);
- }
- },
- selectRightTag(index) {
- this.selectRightTagIndex = this.selectRightTagIndex === index ? -1 : index
- },
- toRightList(){
- if(this.selectLeftTagsList.length==0){
- return
- }
- this.rightTagsList.push(...this.selectLeftTagsList);
- this.selectLeftTagsList = [];
- this.selectRightTagIndex = -1;
- if(this.searchTagVal.trim()){
- this.getTagList(false);
- }else{
- this.getTagList(true)
- }
- },
- toLeftList(){
- if(this.selectRightTagIndex == -1) {
- return
- }
- this.rightTagsList.splice(this.selectRightTagIndex, 1)
- this.selectLeftTagsList = [];
- this.selectRightTagIndex -= 1;
- if(this.searchTagVal.trim()){
- this.getTagList(false);
- }else{
- this.getTagList(true)
- }
- },
- toUp(){
- if(this.selectRightTagIndex === 0 || this.selectRightTagIndex === -1) {
- return
- }
- const tempItem = this.rightTagsList[this.selectRightTagIndex]
- this.rightTagsList.splice(this.selectRightTagIndex, 1)
- this.rightTagsList.splice(this.selectRightTagIndex-1, 0,tempItem)
- this.selectRightTagIndex -= 1
- },
- toDown(){
- if(this.selectRightTagIndex === this.rightTagsList.length-1 || this.selectRightTagIndex === -1) {
- return
- }
- const tempItem = this.rightTagsList[this.selectRightTagIndex]
- this.rightTagsList.splice(this.selectRightTagIndex, 1)
- this.rightTagsList.splice(this.selectRightTagIndex+1, 0,tempItem)
- this.selectRightTagIndex += 1
- },
- isHasTag(item, arr) {
- for ( let i = 0; i <arr.length; i++) {
- if(arr[i].conceptId === item.conceptId) {
- return true;
- }
- }
- return false;
- },
- getStyle(item){ //左侧选中状态
- return this.isHasTag(item, this.selectLeftTagsList)
- },
- getStyle2(item) {
- return this.isHasTag(item, this.selectRightTagsList)
- },
- submitForm(formName) {
- if(!this.form.conceptId) {
- this.warning('请选择术语')
- return
- }
- if(this.rightTagsList.length === 0) {
- this.warning('请添加关联术语')
- return
- }
- this.showDelDialog()
- },
- showDelDialog() {
- const rightTagsList = this.rightTagsList;
- for (let i = 0; i < rightTagsList.length; i++) {
- let item = {};
- item.conceptId = rightTagsList[i].conceptId;
- item.relationId = 17;
- this.nodeList.push(item);
- }
- const param ={
- "conceptId": this.form.conceptId,
- "nodeList": this.nodeList,
- "sonRelationId": 17,
- "sonTypeId":this.searchType //9-20新增
- }
- this.showConfirmDialog('是否建立该关联?', () => {
- this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
- api.addConceptRelation(param).then((res) => {
- if (res.data.code === '0') {
- this.warning(res.data.msg || '关联成功', 'success','1000')
- setTimeout(() => {
- //返回带搜索条件的首页
- this.$router.push({
- name:'ConceptRelation',
- params: Object.assign({}, this.$route.params, {currentPage: 1})
- })
- }, 1000);
- } else {
- this.warning(res.data.msg)
- }
- this.saveDisable = false
- }).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>
- <style lang="less">
- @import '../../less/common.less';
- .addConceptRelationBox {
- color: #606266;
- font-size: 14px;
- .topBack {
- top: 0;
- }
- .groupTitle {
- background-color: #fff;
- height: 40px;
- line-height: 40px;
- padding-left: 20px;
- }
- .searchInput, .searchName {
- display: inline-block;
- height: 32px;
- line-height: 32px;
- border: 1px solid #a9a9a9;
- margin: 0px 0 0 0;
- padding: 0 5px;
- float: left;
- }
- .isRequired .el-form-item__label::before {
- content: '*';
- color: red;
- }
- .searchName {
- border-left: none;
- cursor: pointer;
- padding: 0 12px;
- font-size: 16px;
- }
- .itemList {
- position: absolute;
- background: #fff;
- width: 162px;
- max-height: 150px;
- border: 1px solid #a9a9a9;
- left: 82px;
- top: 33px;
- z-index: 2;
- overflow-y: auto;
- }
- .diagItem {
- padding: 0 5px;
- height: 30px;
- line-height: 30px;
- font-size: 14px;
- cursor: pointer;
- }
- .diagItem:hover {
- background: #f5f7fa;
- }
- .addDepartForm {
- background-color: #fff;
- // padding: 20px;
- padding: 20px 20px 0 20px;
- margin: 70px 20px 0px 20px;
- border-bottom: 1px solid #a9a9a9;
- }
- .symptomList {
- background-color: #fff;
- padding: 20px;
- margin: 0px 20px 0px 20px;
- height: 500px;
- }
- .bottomPartLeft {
- width: 32%;
- }
- .symptomPoolTitle {
- height: 40px;
- line-height: 40px;
- }
- .symptomPool {
- width: 100%;
- .el-input__inner {
- border-radius: 0;
- }
- }
- .tagList {
- width: 100%;
- height: 300px;
- border: 1px solid @icssBorder;
- box-sizing: border-box;
- // border-top: none;
- }
- /* .tagList {
- border: 1px solid @icssBorder;
- } */
- .tagPool {
- height: 300px;
- overflow-y: auto;
- border-top: none;
- }
- .tagItem {
- position: relative;
- line-height: 30px;
- cursor: pointer;
- padding: 0 10px;
- }
- .tagName:before {
- content: '['
- }
- .tagName::after {
- content: ']'
- }
- .bottomPartMid {
- width: 8%;
- margin-top: 220px;
- 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: 32%;
- margin-top: 101px;
- }
- .operationPool {
- position: relative;
- width: 100%;
- height: 340px;
- padding: 10px 0;
- overflow-y: auto;
- }
- .btn {
- position: relative;
- background-color: #fff;
- margin: 0px 20px;
- padding: 20px;
- .el-button {
- position: absolute;
- right: 20px;
- top: -20px;
- }
- }
- .assayTitle{
- font-weight: bold;
- margin-bottom: 20px;
- }
- }
-
- </style>
|