|
@@ -1,217 +1,248 @@
|
|
|
import React from 'react';
|
|
|
-import { ItemBox,ConfirmModal } from '@commonComp';
|
|
|
+import { ItemBox, ConfirmModal, WrapModalContainer } from '@commonComp';
|
|
|
import AddInspect from '../AddInspect';
|
|
|
import styles from './index.less';
|
|
|
import { getExcelList } from '@store/actions/inspect';
|
|
|
import Notify from '@commonComp/Notify';
|
|
|
import store from '@store';
|
|
|
import $ from 'jquery';
|
|
|
-import { host,prefix } from '@utils/config.js';
|
|
|
-import {isIE,getUrlArgObject} from '@utils/tools.js';
|
|
|
+import { host, prefix } from '@utils/config.js';
|
|
|
+import { isIE, getUrlArgObject } from '@utils/tools.js';
|
|
|
+import {dragBox} from '@utils/drag';
|
|
|
+import WrapModalBody from '../WrapModalBody';
|
|
|
|
|
|
|
|
|
(function ($) {
|
|
|
- var FileAPI = {
|
|
|
- // @default: "./dist/"
|
|
|
- staticPath: './dists/',
|
|
|
+ var FileAPI = {
|
|
|
+ // @default: "./dist/"
|
|
|
+ staticPath: './dists/',
|
|
|
|
|
|
- // @default: FileAPI.staticPath + "FileAPI.flash.swf"
|
|
|
- flashUrl: './dists/FileAPI.flash.swf',
|
|
|
+ // @default: FileAPI.staticPath + "FileAPI.flash.swf"
|
|
|
+ flashUrl: './dists/FileAPI.flash.swf',
|
|
|
|
|
|
- // @default: FileAPI.staticPath + "FileAPI.flash.image.swf"
|
|
|
- flashImageUrl: './dists/FileAPI.flash.image.swf'
|
|
|
- };
|
|
|
- return FileAPI
|
|
|
+ // @default: FileAPI.staticPath + "FileAPI.flash.image.swf"
|
|
|
+ flashImageUrl: './dists/FileAPI.flash.image.swf'
|
|
|
+ };
|
|
|
+ return FileAPI
|
|
|
})($)
|
|
|
|
|
|
import "./dists/FileAPI.js";
|
|
|
|
|
|
-const isLocal = window.location.hostname.indexOf('localhost')!=-1;
|
|
|
-const qhost = isLocal?host+prefix:prefix;
|
|
|
+const isLocal = window.location.hostname.indexOf('localhost') != -1;
|
|
|
+const qhost = isLocal ? host + prefix : prefix;
|
|
|
const api = {
|
|
|
- upload: qhost+'/lisExcelRes/lisExcelAnalysis'
|
|
|
+ upload: qhost + '/lisExcelRes/lisExcelAnalysis'
|
|
|
};
|
|
|
|
|
|
class Inspect extends React.Component {
|
|
|
- constructor(props) {
|
|
|
- super(props);
|
|
|
- this.state = {
|
|
|
- val: '',
|
|
|
- visible:false,
|
|
|
- dom:[],
|
|
|
- isIE:isIE(),
|
|
|
- ieVersion:null,
|
|
|
- height:'-1'
|
|
|
- }
|
|
|
- this.handleImportExcel = this.handleImportExcel.bind(this)
|
|
|
- this.cancel = this.cancel.bind(this)
|
|
|
- this.getWarings = this.getWarings.bind(this)
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = {
|
|
|
+ val: '',
|
|
|
+ visible: false,
|
|
|
+ dom: [],
|
|
|
+ isIE: isIE(),
|
|
|
+ ieVersion: null,
|
|
|
+ height: '-1',
|
|
|
+ hide: true
|
|
|
}
|
|
|
- componentDidMount(){
|
|
|
- var ua = navigator.userAgent;
|
|
|
- var _isIE = ua.indexOf("MSIE")>-1;
|
|
|
- if(_isIE){
|
|
|
- let version = ua.match(/MSIE ([\d.]+)/)[1];
|
|
|
- this.setState({
|
|
|
- ieVersion:version
|
|
|
- })
|
|
|
- }
|
|
|
- $('iframe').bind( 'load', function(){} )
|
|
|
- const {fetchPushInfos} = this.props;
|
|
|
- // FileAPI.debug = true
|
|
|
- $.support.cors = true;
|
|
|
- const that = this;
|
|
|
- var choose = document.getElementById('choose');
|
|
|
- FileAPI.event.on(choose, 'change', function (evt){
|
|
|
- var files = FileAPI.getFiles(evt);
|
|
|
- var baseData = store.getState().patInfo.message;
|
|
|
- FileAPI.filterFiles(files, function (file, info){
|
|
|
- let name = file.name;
|
|
|
- // if( name.split('.')[1] == 'xlsx' || name.split('.')[1] == 'xls' ){
|
|
|
- // Notify.error('请选择正确的excel表格')
|
|
|
- // return;
|
|
|
- // }else{
|
|
|
- // alert(9)
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- return true;
|
|
|
- },
|
|
|
- function (files, rejected){
|
|
|
- if( files.length ){
|
|
|
- //console.log(files[0])
|
|
|
- const securityCode = getUrlArgObject("code");
|
|
|
- const appKeyId = getUrlArgObject("appI");
|
|
|
- const appKeySecret = getUrlArgObject("appS");
|
|
|
- FileAPI.upload({
|
|
|
- // url: '/api/icss/lisExcelRes/lisExcelAnalysis',
|
|
|
- url: api.upload,
|
|
|
- data:{ hospitalCode:baseData == '{}'? '' : baseData.hospitalCode },
|
|
|
- files: { uploadfile: files[0] },
|
|
|
- headers:{
|
|
|
- appKeyId:appKeyId,
|
|
|
- appKeySecret:appKeySecret,
|
|
|
- securityCode:securityCode
|
|
|
- // 'Content-Type':'Content-Type: multipart/form-data'
|
|
|
- // 'Content-Type':'application/json;charset=UTF-8'
|
|
|
- // 'Content-type': "text/plain"
|
|
|
- // "Content-Type": 'multipart/form-data',
|
|
|
- // 'Accept':'application/json'
|
|
|
- },
|
|
|
- complete: function (err, xhr){
|
|
|
- if( !err ){
|
|
|
- let res = JSON.parse(xhr.response);
|
|
|
- let message = res.data.messages;
|
|
|
- store.dispatch(getExcelList(res.data));
|
|
|
- fetchPushInfos&&fetchPushInfos();
|
|
|
- if (message&&message.length != 0) {
|
|
|
- that.setState({
|
|
|
- visible:true,
|
|
|
- dom:message,
|
|
|
- height:message.length
|
|
|
- })
|
|
|
- }
|
|
|
- $("#choose").val("");
|
|
|
- }else{
|
|
|
- let res = JSON.parse(xhr.response);
|
|
|
- Notify.error(res.msg)
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ this.handleImportExcel = this.handleImportExcel.bind(this)
|
|
|
+ this.cancel = this.cancel.bind(this)
|
|
|
+ this.getWarings = this.getWarings.bind(this)
|
|
|
+ this.checkSystemIpt = this.checkSystemIpt.bind(this)
|
|
|
+ this.onClose = this.onClose.bind(this)
|
|
|
+ }
|
|
|
+ componentDidMount() {
|
|
|
+ var ua = navigator.userAgent;
|
|
|
+ var _isIE = ua.indexOf("MSIE") > -1;
|
|
|
+ if (_isIE) {
|
|
|
+ let version = ua.match(/MSIE ([\d.]+)/)[1];
|
|
|
+ this.setState({
|
|
|
+ ieVersion: version
|
|
|
+ })
|
|
|
+ }
|
|
|
+ $('iframe').bind('load', function () { })
|
|
|
+ const { fetchPushInfos } = this.props;
|
|
|
+ // FileAPI.debug = true
|
|
|
+ $.support.cors = true;
|
|
|
+ const that = this;
|
|
|
+ var choose = document.getElementById('choose');
|
|
|
+ FileAPI.event.on(choose, 'change', function (evt) {
|
|
|
+ var files = FileAPI.getFiles(evt);
|
|
|
+ var baseData = store.getState().patInfo.message;
|
|
|
+ FileAPI.filterFiles(files, function (file, info) {
|
|
|
+ let name = file.name;
|
|
|
+ // if( name.split('.')[1] == 'xlsx' || name.split('.')[1] == 'xls' ){
|
|
|
+ // Notify.error('请选择正确的excel表格')
|
|
|
+ // return;
|
|
|
+ // }else{
|
|
|
+ // alert(9)
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ function (files, rejected) {
|
|
|
+ if (files.length) {
|
|
|
+ //console.log(files[0])
|
|
|
+ const securityCode = getUrlArgObject("code");
|
|
|
+ const appKeyId = getUrlArgObject("appI");
|
|
|
+ const appKeySecret = getUrlArgObject("appS");
|
|
|
+ FileAPI.upload({
|
|
|
+ // url: '/api/icss/lisExcelRes/lisExcelAnalysis',
|
|
|
+ url: api.upload,
|
|
|
+ data: { hospitalCode: baseData == '{}' ? '' : baseData.hospitalCode },
|
|
|
+ files: { uploadfile: files[0] },
|
|
|
+ headers: {
|
|
|
+ appKeyId: appKeyId,
|
|
|
+ appKeySecret: appKeySecret,
|
|
|
+ securityCode: securityCode
|
|
|
+ // 'Content-Type':'Content-Type: multipart/form-data'
|
|
|
+ // 'Content-Type':'application/json;charset=UTF-8'
|
|
|
+ // 'Content-type': "text/plain"
|
|
|
+ // "Content-Type": 'multipart/form-data',
|
|
|
+ // 'Accept':'application/json'
|
|
|
+ },
|
|
|
+ complete: function (err, xhr) {
|
|
|
+ if (!err) {
|
|
|
+ let res = JSON.parse(xhr.response);
|
|
|
+ let message = res.data.messages;
|
|
|
+ store.dispatch(getExcelList(res.data));
|
|
|
+ fetchPushInfos && fetchPushInfos();
|
|
|
+ if (message && message.length != 0) {
|
|
|
+ that.setState({
|
|
|
+ visible: true,
|
|
|
+ dom: message,
|
|
|
+ height: message.length
|
|
|
+ })
|
|
|
+ }
|
|
|
+ $("#choose").val("");
|
|
|
+ } else {
|
|
|
+ let res = JSON.parse(xhr.response);
|
|
|
+ Notify.error(res.msg)
|
|
|
}
|
|
|
+ }
|
|
|
});
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
+ }
|
|
|
+ handleImportExcel() {
|
|
|
+ this.inputRef.click();
|
|
|
+ }
|
|
|
+ cancel() {
|
|
|
+ this.setState({ visible: false })
|
|
|
+ }
|
|
|
+ getStyle() {
|
|
|
+ const { ieVersion } = this.state;
|
|
|
+ if (ieVersion && ieVersion <= 9) {
|
|
|
+ return styles.disabledBtn;
|
|
|
+ } else {
|
|
|
+ return styles.button;
|
|
|
}
|
|
|
- handleImportExcel() {
|
|
|
- this.inputRef.click();
|
|
|
- }
|
|
|
- cancel(){
|
|
|
- this.setState({visible:false})
|
|
|
- }
|
|
|
- getStyle(){
|
|
|
- const {ieVersion} = this.state;
|
|
|
- if(ieVersion&&ieVersion<=9){
|
|
|
- return styles.disabledBtn;
|
|
|
- }else{
|
|
|
- return styles.button;
|
|
|
- }
|
|
|
}
|
|
|
- getWarings(lis){
|
|
|
- <ul>
|
|
|
+ getWarings(lis) {
|
|
|
+ <ul>
|
|
|
+ {
|
|
|
+ lis.length > 0 && lis.map((val) => {
|
|
|
+ return <li>
|
|
|
+ {val}
|
|
|
+ </li>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </ul>
|
|
|
+ }
|
|
|
+ checkSystemIpt() {
|
|
|
+ this.setState({
|
|
|
+ hide: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ onClose(){
|
|
|
+ console.log(9999)
|
|
|
+ this.setState({
|
|
|
+ hide: false
|
|
|
+ })
|
|
|
+ dragBox('previewWrapper','previewStatic','del')
|
|
|
+ }
|
|
|
+ render() {
|
|
|
+ const { fetchPushInfos, getInfomation, inspectVal, windowHeight, handleCloseExcel, handleChangeValue, labelListActive, list, handleSign, labelList, handleLabelSub, handleClear, handleConfirm, fillActive, changeActivePart, getExcelDataList, delPartItem, inspectList } = this.props;
|
|
|
+ const { ieVersion, isIE, hide } = this.state;
|
|
|
+ const { checkSystemIpt,onClose } = this;
|
|
|
+ return (
|
|
|
+ <div className={styles.wrapper} >
|
|
|
+ {/* 导入功能插件,ie8/9权限问题暂未解决,先隐藏 */}
|
|
|
+ <div className={styles.top}>
|
|
|
+ <span id="inspectResultData">化验结果数据</span>
|
|
|
+ {/* <div className={this.getStyle()} onClick={ieVersion&&ieVersion<=9?null:this.handleImportExcel}> */}
|
|
|
+ <div className={this.getStyle()}>
|
|
|
+ {/* <button disabled={ieVersion&&ieVersion>9?true:false}>导入化验结果</button>*/}
|
|
|
+ <div className={styles.pushButton}>导入化验结果</div>
|
|
|
+ <ul className={styles.importSelect}>
|
|
|
+ <li className={styles.excelIpt}>
|
|
|
+ <div onClick={ieVersion && ieVersion <= 9 ? null : this.handleImportExcel}>本地导入</div>
|
|
|
+ <input type="file" name="uploadfile" id="choose" style={{ display: 'none' }} ref={(DOM) => this.inputRef = DOM} />
|
|
|
+ </li>
|
|
|
+ <li className={`${styles.excelIpt} ${styles.systemIpt}`} onClick={checkSystemIpt}>检查系统导入</li>
|
|
|
+ </ul>
|
|
|
{
|
|
|
- lis.length>0 && lis.map((val)=>{
|
|
|
- return <li>
|
|
|
- {val}
|
|
|
- </li>
|
|
|
- })
|
|
|
+ hide ? <WrapModalContainer title={'导入化验数据'} width={1000} onClose={onClose}>
|
|
|
+ <WrapModalBody></WrapModalBody>
|
|
|
+ </WrapModalContainer> : null
|
|
|
}
|
|
|
- </ul>
|
|
|
- }
|
|
|
- render() {
|
|
|
- const {fetchPushInfos,getInfomation,inspectVal,windowHeight, handleCloseExcel, handleChangeValue, labelListActive, list, handleSign, labelList, handleLabelSub, handleClear, handleConfirm, fillActive, changeActivePart, getExcelDataList,delPartItem,inspectList } = this.props;
|
|
|
- const {ieVersion,isIE} = this.state;
|
|
|
- return (
|
|
|
- <div className={styles.wrapper} >
|
|
|
- {/* 导入功能插件,ie8/9权限问题暂未解决,先隐藏 */}
|
|
|
- <div className={styles.top}>
|
|
|
- <span id="inspectResultData">化验结果数据</span>
|
|
|
- <div className={this.getStyle()} onClick={ieVersion&&ieVersion<=9?null:this.handleImportExcel}>
|
|
|
- {/* <button disabled={ieVersion&&ieVersion>9?true:false}>导入化验结果</button>*/}
|
|
|
- <div className={styles.pushButton}>导入化验结果</div>
|
|
|
- <input type="file" name="uploadfile" id="choose" style={{ display: 'none' }} ref={(DOM) => this.inputRef = DOM} />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <ItemBox
|
|
|
- className={styles.title}
|
|
|
- title={'化验'}
|
|
|
- editable={false}
|
|
|
- border={true}
|
|
|
- marginTop={'20px'}
|
|
|
- >
|
|
|
- <div style={{ padding: '10px', boxSizing: 'border-box' }} >
|
|
|
- <AddInspect
|
|
|
- handleSign={handleSign}
|
|
|
- handleChangeValue={handleChangeValue}
|
|
|
- list={list}
|
|
|
- handlePush={fetchPushInfos}
|
|
|
- labelList={labelList}
|
|
|
- handleLabelSub={handleLabelSub}
|
|
|
- fillActive={fillActive}
|
|
|
- handleClear={handleClear}
|
|
|
- handleConfirm={handleConfirm}
|
|
|
- changeActivePart={changeActivePart}
|
|
|
- getExcelDataList={getExcelDataList}
|
|
|
- handleCloseExcel={handleCloseExcel}
|
|
|
- labelListActive={labelListActive}
|
|
|
- delPartItem={delPartItem}
|
|
|
- inspectList={inspectList}
|
|
|
- getInfomation={getInfomation}
|
|
|
- inspectVal={inspectVal}
|
|
|
- windowHeight={windowHeight}
|
|
|
- >
|
|
|
- </AddInspect>
|
|
|
- </div>
|
|
|
- </ItemBox>
|
|
|
- <ConfirmModal visible={this.state.visible}
|
|
|
- okText='删除'
|
|
|
- cancelText='确定'
|
|
|
- width="450"
|
|
|
- height={(this.state.height > 2 && this.state.height < 8)?((this.state.height * 30 + 120)+'px') : this.state.height > 8 ? '350px' : '200px'}
|
|
|
- noFooter= {true}
|
|
|
- close={this.cancel}>
|
|
|
- <ul className={styles.excelList}>
|
|
|
- {
|
|
|
- this.state.dom.length>0 && this.state.dom.map((val)=>{
|
|
|
- return <li className={styles.excelListWaring}>
|
|
|
- {val}
|
|
|
- </li>
|
|
|
- })
|
|
|
- }
|
|
|
- </ul>
|
|
|
- <div onClick={this.cancel} className={styles.confirmBtn}>确定</div>
|
|
|
- </ConfirmModal>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }
|
|
|
+ {/* <input type="file" name="uploadfile" id="choose" style={{ display: 'none' }} ref={(DOM) => this.inputRef = DOM} /> */}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ItemBox
|
|
|
+ className={styles.title}
|
|
|
+ title={'化验'}
|
|
|
+ editable={false}
|
|
|
+ border={true}
|
|
|
+ marginTop={'20px'}
|
|
|
+ >
|
|
|
+ <div style={{ padding: '10px', boxSizing: 'border-box' }} >
|
|
|
+ <AddInspect
|
|
|
+ handleSign={handleSign}
|
|
|
+ handleChangeValue={handleChangeValue}
|
|
|
+ list={list}
|
|
|
+ handlePush={fetchPushInfos}
|
|
|
+ labelList={labelList}
|
|
|
+ handleLabelSub={handleLabelSub}
|
|
|
+ fillActive={fillActive}
|
|
|
+ handleClear={handleClear}
|
|
|
+ handleConfirm={handleConfirm}
|
|
|
+ changeActivePart={changeActivePart}
|
|
|
+ getExcelDataList={getExcelDataList}
|
|
|
+ handleCloseExcel={handleCloseExcel}
|
|
|
+ labelListActive={labelListActive}
|
|
|
+ delPartItem={delPartItem}
|
|
|
+ inspectList={inspectList}
|
|
|
+ getInfomation={getInfomation}
|
|
|
+ inspectVal={inspectVal}
|
|
|
+ windowHeight={windowHeight}
|
|
|
+ >
|
|
|
+ </AddInspect>
|
|
|
+ </div>
|
|
|
+ </ItemBox>
|
|
|
+ <ConfirmModal visible={this.state.visible}
|
|
|
+ okText='删除'
|
|
|
+ cancelText='确定'
|
|
|
+ width="450"
|
|
|
+ height={(this.state.height > 2 && this.state.height < 8) ? ((this.state.height * 30 + 120) + 'px') : this.state.height > 8 ? '350px' : '200px'}
|
|
|
+ noFooter={true}
|
|
|
+ close={this.cancel}>
|
|
|
+ <ul className={styles.excelList}>
|
|
|
+ {
|
|
|
+ this.state.dom.length > 0 && this.state.dom.map((val) => {
|
|
|
+ return <li className={styles.excelListWaring}>
|
|
|
+ {val}
|
|
|
+ </li>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </ul>
|
|
|
+ <div onClick={this.cancel} className={styles.confirmBtn}>确定</div>
|
|
|
+ </ConfirmModal>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export default Inspect;
|