|
@@ -2,7 +2,7 @@ import React,{Component} from 'react';
|
|
import classNames from 'classnames';
|
|
import classNames from 'classnames';
|
|
import config from '@config/index.js';
|
|
import config from '@config/index.js';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
-import {setPosition,deepClone,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate} from '@utils/tools.js';
|
|
|
|
|
|
+import {setPosition,deepClone,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate,setFontColorSize} from '@utils/tools.js';
|
|
import {Notify} from '@commonComp';
|
|
import {Notify} from '@commonComp';
|
|
import ListItems from '@components/ListItems';
|
|
import ListItems from '@components/ListItems';
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
@@ -171,8 +171,7 @@ class SpreadDrop extends Component{
|
|
getInitExclu(){
|
|
getInitExclu(){
|
|
const {defaulted,data,value} = this.props;
|
|
const {defaulted,data,value} = this.props;
|
|
let excluId = '',excName='';
|
|
let excluId = '',excName='';
|
|
- let showDefaulted = this.ifDefault();
|
|
|
|
- if(showDefaulted&&defaulted&&value===undefined){
|
|
|
|
|
|
+ if(defaulted&&value===undefined){
|
|
const it = data[0];
|
|
const it = data[0];
|
|
excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
|
|
excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
|
|
excName = it.exclusionType===1?it.questionDetailList[0].name:'';
|
|
excName = it.exclusionType===1?it.questionDetailList[0].name:'';
|
|
@@ -202,6 +201,8 @@ class SpreadDrop extends Component{
|
|
this.setState({
|
|
this.setState({
|
|
nones:'',
|
|
nones:'',
|
|
exists:[],
|
|
exists:[],
|
|
|
|
+ //existsName:{},
|
|
|
|
+ //withsName:{},
|
|
withs:[],
|
|
withs:[],
|
|
noneIds:[],
|
|
noneIds:[],
|
|
noneOn:false,
|
|
noneOn:false,
|
|
@@ -281,8 +282,11 @@ class SpreadDrop extends Component{
|
|
if(+item.code===1){ //操作“伴”类型
|
|
if(+item.code===1){ //操作“伴”类型
|
|
this.setState({
|
|
this.setState({
|
|
withOn:!withOn,
|
|
withOn:!withOn,
|
|
|
|
+ // withs:withOn?[]:[...withs,id], //取消“伴”选中,伴随症状全部取消选中
|
|
|
|
+ // withs:withOn?[]:[...withs,{id:item.id,name:name}],
|
|
withs:withOn?[]:withs,
|
|
withs:withOn?[]:withs,
|
|
ban:withOn?{}:{id:id,name:name,value:name},
|
|
ban:withOn?{}:{id:id,name:name,value:name},
|
|
|
|
+ //withsName:withOn?"":withsName+name, //取消“伴”选中,伴随症状全部取消选中
|
|
nowOn:withOn?(noneOn?'none':''):'with'
|
|
nowOn:withOn?(noneOn?'none':''):'with'
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
@@ -325,8 +329,10 @@ class SpreadDrop extends Component{
|
|
nones += name+'、';
|
|
nones += name+'、';
|
|
noneIds.push(id);
|
|
noneIds.push(id);
|
|
}else if(nowOn=='with'){
|
|
}else if(nowOn=='with'){
|
|
|
|
+ // withs.push({id:id,name:name,questionId:item.questionId});
|
|
withs.push({id:id,name:name,questionId:item.questionId,conceptId:item.conceptId});
|
|
withs.push({id:id,name:name,questionId:item.questionId,conceptId:item.conceptId});
|
|
}else{
|
|
}else{
|
|
|
|
+ // exists.push({id:id,name:name,listIndex,questionId:item.questionId});
|
|
exists.push({id:id,name:name,listIndex,questionId:item.questionId,conceptId:item.conceptId});
|
|
exists.push({id:id,name:name,listIndex,questionId:item.questionId,conceptId:item.conceptId});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -341,26 +347,23 @@ class SpreadDrop extends Component{
|
|
});
|
|
});
|
|
}
|
|
}
|
|
getClass(){
|
|
getClass(){
|
|
- const {isImports,show,value,isExtBlue,defaulted} = this.props;
|
|
|
|
|
|
+ const {isImports,show,value,isExtBlue} = this.props;
|
|
const blueBorder = this.state.editable?style['blue-border']:'';
|
|
const blueBorder = this.state.editable?style['blue-border']:'';
|
|
const orgBorder = isImports&&!value?style['orange-border']:'';
|
|
const orgBorder = isImports&&!value?style['orange-border']:'';
|
|
const ext = isExtBlue?style['ext']:'';
|
|
const ext = isExtBlue?style['ext']:'';
|
|
- let showDefaulted = this.ifDefault();
|
|
|
|
if(show){
|
|
if(show){
|
|
$(this.$div.current).addClass(style['borderd']);
|
|
$(this.$div.current).addClass(style['borderd']);
|
|
}else{
|
|
}else{
|
|
$(this.$div.current).removeClass(style['borderd']);
|
|
$(this.$div.current).removeClass(style['borderd']);
|
|
}
|
|
}
|
|
- if(value||(showDefaulted&&value===undefined&&defaulted)){
|
|
|
|
- return classNames(style['selected-tag'],blueBorder);
|
|
|
|
|
|
+ if(value){
|
|
|
|
+ return classNames(style['selected-tag'],blueBorder,setFontColorSize());
|
|
|
|
+ }else{
|
|
|
|
+
|
|
}
|
|
}
|
|
- return classNames(style['tag'],orgBorder,ext);
|
|
|
|
- }
|
|
|
|
- ifDefault(){
|
|
|
|
- const {type,otherDefault,curDefault} = this.props;
|
|
|
|
- const showDefaulted = (type=='2'&&curDefault)||(type=='3'&&otherDefault);
|
|
|
|
- return showDefaulted;
|
|
|
|
|
|
+ return classNames(style['tag'],orgBorder,ext,setFontColorSize(1));
|
|
}
|
|
}
|
|
|
|
+
|
|
componentDidMount(){
|
|
componentDidMount(){
|
|
if(isIE()){
|
|
if(isIE()){
|
|
$(this.$div.current).onIe8Input(function(e){
|
|
$(this.$div.current).onIe8Input(function(e){
|
|
@@ -368,11 +371,16 @@ class SpreadDrop extends Component{
|
|
},this);
|
|
},this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ /*componentWillReceiveProps(nextProps){
|
|
|
|
+ const {setHighter} = this.props;
|
|
|
|
+ if(!nextProps.show){console.log(22)
|
|
|
|
+ setHighter&&setHighter(48);
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
render(){
|
|
render(){
|
|
- const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal} = this.props;
|
|
|
|
|
|
+ const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted} = this.props;
|
|
const {tmpDom,left} = this.state;
|
|
const {tmpDom,left} = this.state;
|
|
- let showDefaulted = this.ifDefault();
|
|
|
|
- let showV = showDefaulted&&value===undefined?showVal:value; //未选中过值时展示默认选中
|
|
|
|
|
|
+ const clickIndx = ikey.split('-')[1];//展开下拉的index
|
|
if(!show&&tmpDom){
|
|
if(!show&&tmpDom){
|
|
$(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
$(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
}
|
|
}
|
|
@@ -390,8 +398,8 @@ class SpreadDrop extends Component{
|
|
onBlur={this.handleBlur}
|
|
onBlur={this.handleBlur}
|
|
onInput={this.onChange}
|
|
onInput={this.onChange}
|
|
onkeydown={handleEnter}
|
|
onkeydown={handleEnter}
|
|
- >{showV||placeholder}</div>
|
|
|
|
- <ListItems parDiv={this.$list} defaulted={showDefaulted&&defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
|
|
|
|
|
|
+ >{value||placeholder}</div>
|
|
|
|
+ <ListItems parDiv={this.$list} defaulted={defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
|
|
show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
|
|
show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|