index.jsx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import React from 'react';
  2. import { SearchOption, InspectCommon, Calendar, Notify, ConfirmModal, Add, DelToast } from '@commonComp';
  3. import SlidePic from './SlidePic';
  4. import { deepClone, getPageCoordinate, getStatusImg,getDomUpDown ,getCurrentDate,setPosition,getCalendarDate} from '@utils/tools';
  5. import styles from './index.less';
  6. import $ from 'jquery';
  7. class AddNewInspect extends React.Component {
  8. constructor(props) {
  9. super(props);
  10. this.state = {
  11. show: false,
  12. showFill: false,
  13. date: false,
  14. currentIdx: '',
  15. currentData: {},
  16. numPlus: 0, //判断是否所有的填写单都是空
  17. num: 0, //暂存数据,获取一次,不能每次都是新的数据
  18. type: null,
  19. time: null,
  20. pageTop: '',
  21. // tmpIds: [], //内层外层
  22. impId: null
  23. }
  24. this.getSearchList = this.getSearchList.bind(this)
  25. this.handleDelConfirm = this.handleDelConfirm.bind(this)
  26. this.handleSearchAdvice = this.handleSearchAdvice.bind(this)
  27. this.handleDelClick = this.handleDelClick.bind(this)
  28. }
  29. componentDidMount() {
  30. $(document).click((event) => {
  31. let searchWrap = document.getElementById("searchWrapAdvice"); // 搜索按钮
  32. let searchOption = document.getElementById("searchOption"); // 搜索列表
  33. let inspectFill = document.getElementById("inspectFill"); // 公共填写单
  34. const {refreshScroller} = this.props
  35. refreshScroller()&&refreshScroller().refresh(); //点开搜索弹窗更新滚动条,
  36. let _del = $('#delBox')[0]; // 删除弹窗
  37. let _impClose = $('#impClose')[0]; // 导入删除按钮
  38. let _addClose = $('#addClose')[0]; // 添加删除按钮
  39. let _closeTil = $('#delTit')[0]; // 弹窗标题
  40. if (searchOption&&!this.isBar) {//onMousedown的目标为滚动条时,添加弹窗不关闭
  41. if (searchOption != event.target && searchWrap != event.target && searchWrap != event.target.parentNode && !$.contains(searchOption, event.target)) { // Mark 1
  42. this.setState({ show: false },()=>{
  43. this.props.setHighter(80)
  44. setTimeout(function(){
  45. refreshScroller()&&refreshScroller().scrollBottom();
  46. },100);
  47. });
  48. }
  49. }
  50. if (inspectFill&&!this.isBar) {//onMousedown的目标为滚动条时,子项弹窗不关闭
  51. if ($(event.target).attr('id') != "getSureTime"&&event.target.getAttribute('data-flg') != 'current' && inspectFill != event.target && !$.contains(inspectFill, event.target)) { // Mark 1
  52. if(this.state.showFill){
  53. this.props.setHighter(80)
  54. }
  55. this.setState({ showFill: false, date: false });
  56. }
  57. }
  58. if (_del&&!this.isBar) {//onMousedown的目标为滚动条时,删除弹窗不关闭
  59. if (!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del) && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)) {
  60. this.setState({
  61. id: null,
  62. impId: null
  63. })
  64. }
  65. }
  66. });
  67. }
  68. handleDelConfirm() {//弹窗确定
  69. const { delPartItem, handleCloseExcel, handlePush } = this.props;
  70. const { type, id, impId } = this.state;
  71. if (type == 1) {
  72. delPartItem(id)
  73. } else if (type == 2) {
  74. handleCloseExcel(impId)
  75. }
  76. Notify.success("删除成功");
  77. handlePush && handlePush({mode:8}); //右侧推送
  78. }
  79. handleDelClick(type, time) {
  80. this.setState({
  81. type: type,
  82. time: time,
  83. impId: null
  84. })
  85. }
  86. handleSearchAdvice(e) {
  87. let tmpShow = this.state.show;
  88. const { handlePush } = this.props;
  89. this.setState({ show: !tmpShow, pageTop: getPageCoordinate(e).boxTop })
  90. // e.stopPropagation();
  91. if(tmpShow){
  92. this.props.setHighter(80)
  93. }else{
  94. this.props.detailClick(5)
  95. handlePush && handlePush({mode:8}); //右侧推送
  96. setPosition(e,"#searchOption",this.props.setHighter)
  97. }
  98. }
  99. handleSign(item,idx){
  100. const { handleSign,handlePush } = this.props;
  101. handleSign(item,idx)
  102. handlePush && handlePush({mode:8}); //右侧推送
  103. }
  104. getSearchList(list) {//搜索列表
  105. return <ul className={`${styles.searchLiUl} ${styles.searchIsp}`} style={{height:'205px',width:'302px',overflow:'auto'}}>
  106. {
  107. list && list.map((item, idx) => {
  108. return <li key={idx}
  109. className={styles.searchLi}
  110. title={item.uniqueName}
  111. onClick={() => {
  112. this.props.setHighter(80)
  113. this.handleSign(item, idx, 'search');
  114. this.setState({ show: false })
  115. }}
  116. >
  117. {item.uniqueName}
  118. </li>
  119. })
  120. }
  121. </ul>;
  122. }
  123. render() {
  124. const {labelListBlood,setHighter,refreshScroller,checkOnOff, getInfomation,setTipValue, handleChangeValue,labelListSmall,inspectList, inspectVal, list, labelListBig, windowHeight, windowWidth,detailClick, handleLabelSub, handleClear, handleConfirm, fillActive, getExcelDataList, handleCloseExcel, handlePush,handleDelConfirm } = this.props;
  125. const { tmpId, tmpIdx, time, pageTop, impId } = this.state;
  126. const contStyle={
  127. opacity:'0.4',
  128. right:'0',
  129. top:'1px',
  130. zIndex:'15',
  131. width:'14px',
  132. background:'#f1f1f1'};
  133. return (
  134. <div className={styles.wrapper}>
  135. <div className={styles.check}>
  136. <ul className={styles.labelWrap} >
  137. {
  138. labelListBig && labelListBig.map((item, idx) => {
  139. return <SlidePic
  140. item={item}
  141. checkOnOff={checkOnOff}
  142. time={time}
  143. handlePush={handlePush}
  144. handleDelClick={this.handleDelClick}
  145. setTipValue={setTipValue}
  146. handleDelConfirm={handleDelConfirm}
  147. ></SlidePic>
  148. })
  149. }
  150. {
  151. labelListSmall && labelListSmall.map((item, idx) => {
  152. return <SlidePic
  153. item={item}
  154. checkOnOff={checkOnOff}
  155. time={time}
  156. handlePush={handlePush}
  157. handleDelClick={this.handleDelClick}
  158. setTipValue={setTipValue}
  159. handleDelConfirm={handleDelConfirm}
  160. ></SlidePic>
  161. })
  162. }
  163. {
  164. labelListBlood && labelListBlood.map((item, idx) => {
  165. return <SlidePic
  166. item={item}
  167. checkOnOff={checkOnOff}
  168. time={time}
  169. handlePush={handlePush}
  170. handleDelClick={this.handleDelClick}
  171. setTipValue={setTipValue}
  172. handleDelConfirm={handleDelConfirm}
  173. ></SlidePic>
  174. })
  175. }
  176. </ul>
  177. </div>
  178. <div style={{ position: "relative", clear: "both", top: "-2px" }}>
  179. <Add showText="添加医嘱" handleClick={(e) => this.handleSearchAdvice(e)} id="searchWrapAdvice" />
  180. {this.state.show ? <SearchOption searchType="2" detailClick={detailClick} windowHeight={windowHeight} height={280} refreshScroller={refreshScroller} pageTop={pageTop} handleChangeValue={handleChangeValue} visible={true}>
  181. {list && list.length > 0 ? this.getSearchList(list) : (inspectVal == '' ? '' : <p style={{ padding: '5px 136px', color: '#bfbfbf' }}>暂无筛选项</p>)}
  182. </SearchOption> : ''}
  183. </div>
  184. </div>
  185. )
  186. }
  187. }
  188. export default AddNewInspect;