index.jsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, { Component } from "react";
  2. import { getAllDataList, getAllDataStringList } from '@utils/tools';
  3. import style from "./index.less";
  4. import PreviewBody from "../PreviewBody";
  5. import store from '@store';
  6. import Notify from '@commonComp/Notify';
  7. import close from '../../common/images/icon_close.png';
  8. class PrintPreview extends Component {
  9. constructor(props) {
  10. super(props)
  11. }
  12. surePrint(jsonStr){
  13. if(JSON.parse(jsonStr.chief).length == 1 && JSON.parse(jsonStr.chief)[0].trim() ==''){
  14. Notify.info('主诉不能为空');
  15. return false;
  16. }else if(jsonStr.chief && JSON.parse(jsonStr.chief).length < 1){
  17. Notify.info('主诉不能为空');
  18. return false;
  19. }else if(!jsonStr.diag || jsonStr.diag.trim().length < 1){
  20. Notify.info('诊断不能为空');
  21. return false;
  22. }else{
  23. this.onPrint();
  24. this.props.save(true)
  25. }
  26. }
  27. render() {
  28. const { onClose, visible, preInfo } = this.props;
  29. let baseList = store.getState();
  30. const dataJson = getAllDataList(baseList);
  31. const dataStr = getAllDataStringList(baseList);
  32. return <div className={style['container']} style={visible ? { display: 'block' } : { display: 'none' }}>
  33. <div className={style['shade']}></div>
  34. <div className={style['modal']}>
  35. <div className={style['close']}>打印<img src={close} onClick={onClose} /></div>
  36. {/* <div id="content"> */}
  37. <PreviewBody
  38. preInfo={preInfo}
  39. dataJson={dataJson}
  40. dataStr={dataStr}
  41. show={true}
  42. onClose={onClose}
  43. ></PreviewBody>
  44. {/* </div> */}
  45. </div>
  46. </div>
  47. }
  48. }
  49. export default PrintPreview;