|
@@ -35,10 +35,10 @@ class HistoryCaseContainer extends React.Component {
|
|
|
editVisible: false,
|
|
|
templateName: '', // 病历名称
|
|
|
historyCase: [],
|
|
|
- currentIndex:-1,
|
|
|
+ currentIndex:-1, // 显示编辑/删除图标
|
|
|
delId: '', //删除病历id
|
|
|
editId: '', //编辑病历id
|
|
|
- activeIndex: 0,
|
|
|
+ activeIndex: -1, //字体显示蓝色高亮index
|
|
|
showEditIcon: false,
|
|
|
showDelIcon: false,
|
|
|
desc: true // 正序/逆序
|
|
@@ -55,6 +55,8 @@ class HistoryCaseContainer extends React.Component {
|
|
|
this.makeSureEdit = this.makeSureEdit.bind(this);
|
|
|
this.handleChange = this.handleChange.bind(this);
|
|
|
this.handleSortClick = this.handleSortClick.bind(this);
|
|
|
+
|
|
|
+ this.$scrollRef = React.createRef();
|
|
|
}
|
|
|
componentDidMount(){
|
|
|
const {items} = this.props
|
|
@@ -67,8 +69,6 @@ class HistoryCaseContainer extends React.Component {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- componentWillReceiveProps(nextProps){
|
|
|
- }
|
|
|
|
|
|
// 操作后获取获取列表数据
|
|
|
getTemplatePageAlls(val) {
|
|
@@ -86,7 +86,6 @@ class HistoryCaseContainer extends React.Component {
|
|
|
|
|
|
// 点击当前的历史病历
|
|
|
handleCaseClick(idx,val) {
|
|
|
-
|
|
|
const { items } = this.props;
|
|
|
let tmpItems = []
|
|
|
$("#hislistLeft li").eq(idx).css({
|
|
@@ -102,8 +101,6 @@ class HistoryCaseContainer extends React.Component {
|
|
|
this.setState({
|
|
|
activeId: idx,
|
|
|
activeHis: tmpItems,
|
|
|
- // dataStr: tmpItems.preview || {},
|
|
|
- // dataJson:JSON.parse(tmpItems.dataJson)||{},
|
|
|
dataStr: JSON.parse(tmpItems.preview)||[],
|
|
|
activeIndex: idx
|
|
|
})
|
|
@@ -168,6 +165,10 @@ class HistoryCaseContainer extends React.Component {
|
|
|
// 确认编辑病历
|
|
|
makeSureEdit(){
|
|
|
const { editId, templateName} = this.state
|
|
|
+ if (templateName === '') {
|
|
|
+ Notify.info('请输入病历名称')
|
|
|
+ return
|
|
|
+ }
|
|
|
store.dispatch(asyncUpdateByIdUsNames(editId, templateName)).then(res=>{
|
|
|
if (res.data.code === '0'){
|
|
|
Notify.success('病历修改成功');
|
|
@@ -191,11 +192,12 @@ class HistoryCaseContainer extends React.Component {
|
|
|
}
|
|
|
// 显示编辑确认框
|
|
|
handleEditQuoteClick(e, val, idx) {
|
|
|
+ // console.log(val,'显示编辑确认框');
|
|
|
e.stopPropagation()
|
|
|
this.setState({
|
|
|
editVisible: true,
|
|
|
editId: val.id,
|
|
|
- templateName: ''
|
|
|
+ templateName: val.name
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -234,7 +236,9 @@ class HistoryCaseContainer extends React.Component {
|
|
|
// 处理鼠标移除
|
|
|
handleMouseLeaveLi(idx){
|
|
|
// console.log('处理鼠标移除li');
|
|
|
-
|
|
|
+ this.setState({
|
|
|
+ currentIndex : -1
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 处理鼠标移入编辑按钮
|
|
@@ -288,16 +292,14 @@ class HistoryCaseContainer extends React.Component {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- // const { items } = this.props;
|
|
|
- // let length = items && items.length
|
|
|
- // let index = length - this.state.currentIndex -1
|
|
|
- // this.props.handleSortClick()
|
|
|
- // this.setState({
|
|
|
- // currentIndex: index
|
|
|
- // })
|
|
|
- }
|
|
|
+ componentDidUpdate() { // 刷新组件
|
|
|
+ // console.log(this.$scrollRef.current.scrollTop);
|
|
|
+ // console.log(this.$scrollRef);
|
|
|
+ // this.$scrollRef.current.scrollTop = this.$scrollRef.current.scrollHeight;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
render(){
|
|
|
const { items,handleSortClick,showHistoryBox,preInfo } = this.props;
|
|
@@ -329,30 +331,28 @@ class HistoryCaseContainer extends React.Component {
|
|
|
<span className={styles.sort} onClick={this.handleSortClick}>排序 <img src={sort} alt="排序"/></span>
|
|
|
</div>
|
|
|
<div className={styles.lists}>
|
|
|
- <ul id="hislistLeft">
|
|
|
+ <ul id="hislistLeft" ref={this.$scrollRef}>
|
|
|
{(items && items.length > 0) ? items.map((val,idx)=>{
|
|
|
// return <li key={val.id} className={val.id == activeHistory.id?styles.bgc:''} onClick={(e)=>{this.handleCaseClick(e,idx)}}>
|
|
|
return <li key={val.id} onClick={() => { this.handleCaseClick(idx, val) }} onMouseEnter={() => this.handleMouseEnterLi(idx)} onMouseLeave={() => this.handleMouseLeaveLi(idx)}>
|
|
|
<div className={styles.itemLeft}>
|
|
|
<div className={styles.historyTop}>
|
|
|
- <span title={val.name} className={activeIndex === idx ? styles.itemNameActive :styles.itemName}>{val.name}</span>
|
|
|
- {currentIndex === idx && (<div className={styles.edit} onClick={(e) => { this.handleEditQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterEdit(idx)} onMouseLeave={() => this.handleMouseLeaveEdit(idx)}>
|
|
|
- <img src={ this.state.showEditIcon ? editHover :edit} />
|
|
|
+ <span title={val.name} className={activeIndex === idx ? styles.itemNameActive :styles.itemName}>{val.name}</span>
|
|
|
+ {currentIndex === idx && (
|
|
|
+ <div className={styles.edit} onClick={(e) => { this.handleEditQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterEdit(idx)} onMouseLeave={() => this.handleMouseLeaveEdit(idx)}>
|
|
|
+ <img src={ this.state.showEditIcon ? editHover :edit} />
|
|
|
</div>)}
|
|
|
- </div>
|
|
|
- <div className={activeIndex === idx ? styles.timeActive : styles.time}>{val.inquiryDate}</div>
|
|
|
+ </div>
|
|
|
+ <div className={activeIndex === idx ? styles.timeActive : styles.time}>{val.inquiryDate}</div>
|
|
|
|
|
|
</div>
|
|
|
<div className={styles.itemRight}>
|
|
|
|
|
|
- <button
|
|
|
- className={styles.quote}
|
|
|
- onClick={(e) => { this.handleQuoteClick(e, val, idx) }}
|
|
|
- >引 用</button>
|
|
|
+ <button className={styles.quote} onClick={(e) => { this.handleQuoteClick(e, val, idx) }}>引 用</button>
|
|
|
|
|
|
{currentIndex === idx && (
|
|
|
- <div className={styles.del} onClick={(e) => { this.handleDelQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterDel(idx)} onMouseLeave={() => this.handleMouseLeaveDel(idx)}>
|
|
|
- <img src={this.state.showDelIcon?delHover :del} />
|
|
|
+ <div className={styles.del} onClick={(e) => { this.handleDelQuoteClick(e, val, idx) }} onMouseEnter={() => this.handleMouseEnterDel(idx)} onMouseLeave={() => this.handleMouseLeaveDel(idx)}>
|
|
|
+ <img src={this.state.showDelIcon?delHover :del} />
|
|
|
</div>
|
|
|
)}
|
|
|
</div>
|