// 物资库存查询
import React from 'react';
import { Row, Col, Input, Select, Button, DatePicker, Switch, Icon, Table, Checkbox, Card, Modal, message, Tooltip } from 'antd';
import store from '../../../store';
import PubilcTablePagination from '../../common/PubilcTablePagination.jsx';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CommonPagination from 'components/pagination/index';
import './style/index.less';
import { $http } from 'containers/config/https';
import Moment from 'moment';

let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
const { Option } = Select;

export default class StockSearch extends React.Component {
	constructor() {
		super();
		this.state = {
			total: 0,
			mainData: [],
			rowId: '', // 选中行id
			visible: false,
			checkMainValue: false,
			checkDetailValue: false,
			drugNames: undefined, // 药品名称
			selectData: {}, // 下拉框数据
			locID: user && user.locID ? user.locID : undefined, // 科室
			stockID: undefined, // 药品
			endDate: undefined, // 日期
			stkCatID: undefined, // 库存分类
			poisonID: undefined, // 管制分类
			busTypeID: undefined, // 类型
			formID: undefined, // 剂型
			onlyUse: undefined, // 仅在用药品
			onlyNotUse: undefined, // 仅不可用药品
			mainPageSize: 10,
			mainPage: 1,
			rowData: {}, // 选中行数据
			detailData: [], // 批次信息表格数据
			detailPageSize: 10,
			detailPage: 1,
			detailTotal: 0,
			transitVisible: false, // 在途数列表是否显示
			transitSelectedRowKeys: [],
			transitRowData: [],
			transitRowId: '',
			rowDataModal: {}, // 点击清除在途数，所在行数据
			transitTableData: [], // 在途数表格数据
			transitPageSize: 10,
			transitPage: 1,
			transitTotal: 0,
			transitValue: undefined, // 开单科室
			flag: '', // 在途数点击的是库存信息(main)还是批次信息(detail)
			alias: undefined,
			publicLoading: false,
			detailColumnsWidth: '',
			columns: [],
			columnsWidth: '',
			detailColumns: [],
			ChineseEnglishSize: {},
			transitColumns: [],
			transitColumnsWidth: '',
			parameterCode: '',
			language: JSON.parse(window.sessionStorage.userData),
			serialNo: undefined, // 晶体序列号
		};
		this.columns = [
			{
				title: '加锁', dataIndex: 'lockFlag', key: '16', width: '150px', align: "center",
				render: (text, record) => (
					<Switch checkedChildren="是" unCheckedChildren="否" checked={record.lockFlag} onChange={(e, event) => this.handleMainSwitch(record, e, event)}></Switch>
				)
			},
			{ title: '代码', dataIndex: 'stockCode', key: '1', width: '150px', align: "center" },
			{ title: '药品名称', dataIndex: 'stockDesc', key: '2', width: '400px', align: "center" },
			{ title: '规格', dataIndex: 'stockSpec', key: '3', width: '150px', align: "center" },
			{
				title: '在途数', dataIndex: 'resQty', key: '10', width: '150px', align: "center",
				render: (text, record) => (
					<Tooltip title="点击在途数可进行相关操纵" placement="topLeft">
						<span className="table-operation">
							<a href="javascript:;" onClick={(e) => this.handleMunuItemOne(record, 'main', e)}>
								{record.resQty}
							</a>
						</span>
					</Tooltip>
				)
			},
			{ title: '基本单位库存', dataIndex: 'locBQty', key: '6', width: '150px', align: "center" },
			{ title: '入库单位库存', dataIndex: 'locPQty', key: '8', width: '150px', align: "center" },
			{ title: '占用数', dataIndex: 'dirQty', key: '9', width: '150px', align: "center" },
			{ title: '剂型', dataIndex: 'stockForm', key: '4', width: '150px', align: "center" },
			{ title: '货位码', dataIndex: 'stkLocBin', key: '5', width: '150px', align: "center" },
			{ title: '进价', dataIndex: 'rp', key: '11', width: '100px', align: "center" },
			{ title: '进价金额', dataIndex: 'rpAmt', key: '12', width: '100px', align: "center" },
			{ title: '售价', dataIndex: 'sp', key: '13', width: '100px', align: "center" },
			{ title: '售价金额', dataIndex: 'spAmt', key: '14', width: '100px', align: "center" },
		];
		this.detailColumns = [
			{
				title: '医嘱激活', dataIndex: 'ordActive', key: '1', width: '150px', align: "center",
				render: (text, record) => (
					<Switch checkedChildren="是" unCheckedChildren="否" checked={record.ordActive === 1 ? true : false} onChange={(e) => this.handleChange(record, 'ordActive', e)}></Switch>
				)
			},
			{
				title: '库存激活', dataIndex: 'stkActive', key: '2', width: '150px', align: "center",
				render: (text, record) => (
					<Switch checkedChildren="是" unCheckedChildren="否" checked={record.stkActive === 1 ? true : false} onChange={(e) => this.handleChange(record, 'stkActive', e)}></Switch>
				)
			},
			{
				title: '柱镜度数', dataIndex: 'clyDegreeDesc', key: '15', width: '150px', align: "center",
				render: (text, record) => (
					<Select
						showSearch
						allowClear
						placeholder="请选择"
						style={{ width: '90%' }}
						optionFilterProp="seachprop"
						value={record?.clyDegreesID || undefined}
						onChange={(e) => this.handleChange(record, 'clyDegreesID', e, 'Select')}
					></Select>
				)
			},
			{ title: '批号', dataIndex: 'batNo', key: '3', width: '150px', align: "center" },
			{ title: '有效期', dataIndex: 'expDate', key: '4', width: '150px', align: "center" },
			{ title: '生产日期', dataIndex: 'produceDate', key: '5', width: '150px', align: "center" },
			{ title: '库存数', dataIndex: 'batQty', key: '6', width: '150px', align: "center" },
			{
				title: '在途数', dataIndex: 'batResQty', key: '8', width: '150px', align: "center",
				render: (text, record) => (
					<Tooltip title="点击在途数可进行相关操纵" placement="topLeft">
						<span className="table-operation">
							<a href="javascript:;" onClick={(e) => this.handleMunuItemOne(record, 'detail', e)}>
								{record.batResQty}
							</a>
						</span>
					</Tooltip>
				)
			},
			{ title: '占用数', dataIndex: 'dirQty', key: '7', width: '150px', align: "center" },
			{ title: '进价(基本单位)', dataIndex: 'baseRp', key: '9', width: '150px', align: "center" },
			{ title: '售价(基本单位)', dataIndex: 'baseSp', key: '10', width: '150px', align: "center" },
			{ title: '进价(售价单位)', dataIndex: 'purRp', key: '11', width: '150px', align: "center" },
			{ title: '售价(售价单位)', dataIndex: 'purSp', key: '12', width: '150px', align: "center" },
			{ title: '生产厂家', dataIndex: 'manfDesc', key: '13', width: '200px', align: "center" },
			{ title: '供应商', dataIndex: 'vendorDesc', key: '14', width: '200px', align: "center" },
		];
		this.transitColumns = [
			{ title: '开单科室', dataIndex: 'ordLocDesc', key: '1', width: '150px', align: "center" },
			{ title: '病人ID', dataIndex: 'patNo', key: '2', width: '100px', align: "center" },
			{ title: '病人姓名', dataIndex: 'patName', key: '3', width: '100px', align: "center" },
			{ title: '数量', dataIndex: 'qty', key: '4', width: '100px', align: "center" },
			{ title: '单位', dataIndex: 'baseUnitDesc', key: '5', width: '100px', align: "center" },
			{ title: '批号', dataIndex: 'batNo', key: '6', width: '150px', align: "center" },
			{ title: '有效期', dataIndex: 'expDate', key: '7', width: '100px', align: "center" },
			{ title: '生产厂家', dataIndex: 'manfDesc', key: '8', width: '200px', align: "center" },
			{ title: '供应商', dataIndex: 'vendorDesc', key: '9', width: '200px', align: "center" },
			{ title: '日期', dataIndex: 'createDate', key: '10', width: '100px', align: "center" },
			{ title: '时间', dataIndex: 'createTime', key: '11', width: '100px', align: "center" },
		]
		this.myRef1 = React.createRef();
		this.myRef2 = React.createRef();
		this.myRef3 = React.createRef();
		this.myRef4 = React.createRef();
		this.myRef5 = React.createRef();
		this.myRef6 = React.createRef();
		this.myRef7 = React.createRef();
		this.myRef8 = React.createRef();
		this.myRef9 = React.createRef();
	}

	componentDidMount() {
		this.handleQuery();
		this.getSelectData();
		this.getTransitSelectData();
		this.getColumnsTable1();
		this.getColumnsTable3();
	}

	componentWillUnmount() {
		// 组件销毁前将静止让setState修改state的状态
		this.setState = (state, callback) => { return; }
	}

	// 获取明系列表头数据
	getColumnsTable1 = () => {
		let { language } = this.state;
		let data = {
			params: [{
				reactCode: ['MaterialInventoryInquiry'],
				compontName: 'MaterialInventoryInquiry',
				type: 'C',
			}]
		}
		$http.post('urlS', this, {
			code: '01040073',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
						return {
							...item,
							key: index + 1,
							title: <div onDoubleClick={() => {
								this.setState({ parameterCode: 'MaterialInventoryInquiry' }, () => {
									this.columnRef.onOpenModel();
								})
							}}>{language.language == 'EN' ? item.enDescripts : item.title}</div>,
							render: (text, record) => {
								if (item.code === 'lockFlag') {
									return <Switch checkedChildren={language.language == 'EN' ? 'YES' : "是"} unCheckedChildren={language.language == 'EN' ? 'NO' : "否"} checked={record.lockFlag} onChange={(e, event) => this.handleMainSwitch(record, e, event)}></Switch>
								} else if (item.code === 'resQty') {
									return <Tooltip title={language.language == 'EN' ? 'Click on the number of paths to perform related operations' : "点击在途数可进行相关操纵"} placement="topLeft">
										<span className="table-operation">
											<a href="javascript:;" onClick={(e) => this.handleMunuItemOne(record, 'main', e)}>
												{record.resQty}
											</a>
										</span>
									</Tooltip>
								} else {
									return text
								}

							}
						}
					}) : '';
					let filterArr = arr.filter(function (item) { return item.display === 'Y' });
					this.setState({ columns: filterArr, columnsWidth: res.totalWidth, ChineseEnglishSize: language.language == 'EN' ? res.result.language.EN : res.result.language.CN })
				}
			}
		});
	}

	// 页面中英文翻译
	getColumnsTable2 = () => {
		let { language, selectData } = this.state;
		let data = {
			params: [{
				compontName: 'InventoryBatchInformation',
				type: 'C',
			}]
		}
		$http.post('urlS', this, {
			code: '01040073',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
						return {
							...item,
							key: index + 1,
							title: <div onDoubleClick={() => {
								this.setState({ parameterCode: 'InventoryBatchInformation' }, () => {
									this.columnRef.onOpenModel();
								})
							}}>{language.language == 'EN' ? item.enDescripts : item.title}</div>,
							render: (text, record) => {
								if (item.code === 'ordActive') {
									return <Switch checkedChildren={language.language == 'EN' ? 'YES' : "是"} unCheckedChildren={language.language == 'EN' ? 'NO' : "否"} checked={record.ordActive === 1 ? true : false} onChange={(e) => this.handleChange(record, 'ordActive', e)}></Switch>
								} else if (item.code === 'stkActive') {
									return <Switch checkedChildren={language.language == 'EN' ? 'YES' : "是"} unCheckedChildren={language.language == 'EN' ? 'NO' : "否"} checked={record.stkActive === 1 ? true : false} onChange={(e) => this.handleChange(record, 'stkActive', e)}></Switch>
								} else if (item.code === 'batResQty') {
									return <Tooltip title={language.language == 'EN' ? 'Click on the number of paths to perform related operations' : "点击在途数可进行相关操纵"} placement="topLeft">
										<span className="table-operation">
											<a href="javascript:;" onClick={(e) => this.handleMunuItemOne(record, 'detail', e)}>{record.batResQty}</a>
										</span>
									</Tooltip>
								} else if (item.code === 'axial') {
									return (
										<Input
											placeholder="请输入"
											style={{ width: '90%' }}
											value={record?.axial || undefined}
											onChange={(e) => this.handleChange(record, 'axial', e.target.value, 'Input')}
											onBlur={(e) => this.updateStatus(record, 'Input')}
										/>
									)
								} else if (item.code === 'clyDegreeDesc') {
									return (
										<Select
											showSearch
											allowClear
											placeholder="请选择"
											style={{ width: '90%' }}
											optionFilterProp="seachprop"
											value={record?.clyDegreesID || undefined}
											onChange={(e) => this.handleChange(record, 'clyDegreesID', e, 'Select')}
										>
											{React.$SelectOptions(selectData?.clyDegree || [])}
										</Select>
									)
								} else {
									return text
								}

							}
						}
					}) : '';
					let filterArr = arr.filter(function (item) { return item.display === 'Y' });
					this.setState({ detailColumns: filterArr, detailColumnsWidth: res.totalWidth })
				}
			}
		})
	}

	// 页面中英文翻译
	getColumnsTable3 = () => {
		let { language } = this.state;
		let data = {
			params: [{
				compontName: 'MaterialInventoryQueryExport',
				type: 'C',
			}]
		}
		$http.post('urlS', this, {
			code: '01040073',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
						return {
							...item,
							key: index + 1,
							title: <div onDoubleClick={() => {
								this.setState({ parameterCode: 'MaterialInventoryQueryExport' }, () => {
									this.columnRef.onOpenModel();
								})
							}}>{language.language == 'EN' ? item.enDescripts : item.title}</div>
						}
					}) : '';
					let filterArr = arr.filter(function (item) { return item.display === 'Y' });
					this.setState({ transitColumns: filterArr, transitColumnsWidth: res.totalWidth })
				}
			}
		})
	}

	handleMainSwitch = (record, e, event) => {
		event.stopPropagation();
		let obj = record;
		obj['lockFlag'] = e;
		this.updateMainStatus(obj);
		const newData = [...this.state.mainData];
		const index = newData.findIndex(item => obj.stkLocID === item.stkLocID);
		const item = newData[index];
		newData.splice(index, 1, {
			...item,
			...obj,
		});
		this.setState({ mainData: newData });
	}

	handleChange = (record, flag, e, typeCode) => {
		let obj = record;
		obj[flag] = (typeCode === 'Select' || typeCode === 'Input') ? e : (e === true ? 1 : 0);
		obj.modifyFlag = 'Y';
		// console.log(obj)
		typeCode !== 'Input' && this.updateStatus(obj)
		const newData = [...this.state.detailData];
		const index = newData.findIndex(item => obj.stkLocBatID === item.stkLocBatID);
		const item = newData[index];
		newData.splice(index, 1, {
			...item,
			...obj,
		});
		this.setState({ detailData: newData });
	}

	// 下拉框数据查询
	getSelectData() {
		let data = {
			params: [{}]
		}
		$http.post('urlS', this, {
			code: "02060113",
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					this.setState({ selectData: res.result }, () => {
						this.getColumnsTable2();
					})
				} else {
					this.setState({ selectData: {} })
				}
			}
		})
	}

	handleMunuItemOne = (record, flag, e) => {
		// 阻止事件冒泡
		e.stopPropagation();
		if (record === this.state.rowDataModal) {
			this.setState({ transitVisible: true, flag })
		} else {
			this.setState({ transitVisible: true, flag, rowDataModal: record }, () => {
				this.getTransitQuery()
			})
		}
	}

	// 调用子组件的连接事件
	onRef = (ref) => {
		this.child = ref
	}

	// 显示分页总条数
	showTotal(total) {
		return `共 ${total} 条`;
	}

	// 导出excel
	downloadExl = () => {
		this.setState({ visible: true })
	}

	// 请求列表数据
	getTableData(locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, alias) {
		this.setState({ publicLoading: true });
		let { mainPageSize, mainPage, serialNo } = this.state;
		let data = {}
		data = {
			params: [{
				locID: locID, // 科室ID
				stockID: stockID, // 药品ID
				endDate: endDate ? Moment(endDate).format('YYYY-MM-DD') : undefined, // 日期
				stkCatID: stkCatID, // 库存大类ID
				poisonID: poisonID, // 管制分类ID
				busTypeID: busTypeID, // 类型
				formID: formID, // 剂型ID
				onlyUse: onlyUse, // 仅在用药品
				onlyNotUse: onlyNotUse, // 仅不可用药品
				alias: alias, // 药品别名
				serialNo, // 晶体序列号
			}],
			pagination: [{
				pageSize: mainPageSize,
				currentPage: mainPage,
				sort: '',
				dir: 'Asc'
			}]
		}
		$http.post('urlS', this, {
			code: '02060114',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0 && res.result) {
					let mainData = res.result && res.result.rows && res.result.rows.length > 0 ? res.result.rows : [];
					for (var i = 0; i < mainData.length; i++) {
						mainData[i].key = 'main' + i;
					}
					let rowData = mainData && mainData.length > 0 ? mainData[0] : {};
					this.setState({ mainData, total: res.result.total, publicLoading: false, rowId: rowData && rowData.key ? rowData.key : "", rowData }, () => {
						// 数据加载成功关闭loading
						this.child.handleLoading()
						if (this.state.rowId) {
							this.getDetailTableData()
						}
					})
				} else {
					this.setState({ mainData: [], total: 0, publicLoading: false }, () => {
						// 数据加载成功关闭loading
						this.child.handleLoading();
					})
				}
			},
			error: function () {
				this.setState({ mainData: [], total: 0, publicLoading: false }, () => {
					// 数据加载成功关闭loading
					this.child.handleLoading();
				})
			}
		})
	}

	// 查询库存信息
	handleQuery = () => {
		this.setState({ mainPage: 1, mainPageSize: 10, rowId: '', rowData: {}, detailData: [] }, () => {
			let { locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, alias } = this.state;
			this.getTableData(locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, alias);
		})
	}

	// 提供修改page和pageSize的回调函数
	compilePage(page, pageSize) {
		// 修改page，或者pageSize
		this.setState({ mainPage: page, mainPageSize: pageSize }, () => {
			// 重新调用查询方法
			let { locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, alias } = this.state;
			this.getTableData(locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, alias);
		})
	}

	// 请求列表数据
	getDetailTableData() {
		this.setState({ loading: true });
		let { detailPageSize, detailPage, rowData, serialNo } = this.state;
		let data = {
			params: [{
				stkLocID: rowData.stkLocID, // 科室药品ID
				endDate: rowData.stockID ? Moment(rowData.stockID).format('YYYY-MM-DD') : undefined, // 日期
				serialNo, // 晶体序列号
			}],
			pagination: [{
				pageSize: detailPageSize,
				currentPage: detailPage,
				sort: '',
				dir: 'Asc'
			}]
		}
		$http.post('urlS', this, {
			code: '02060115',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0 && res.result) {
					for (var i = 0; i < res.result.rows.length; i++) {
						res.result.rows[i].key = i
					}
					this.setState({ detailData: res.result.rows, detailTotal: res.result.total, loading: false })
				}
			}
		})
	}

	// 查询批次信息
	handleQueryDetail = () => {
		this.setState({ detailPage: 1, detailPageSize: 10 }, () => {
			this.getDetailTableData();
		})
	}

	// 修改分页
	onChange = (page, pageSize) => {
		// 修改page，或者pageSize
		this.setState({ detailPage: page, detailPageSize: this.state.detailPageSize }, () => {
			// 重新调用查询方法
			this.getDetailTableData();
		})
	}

	// 修改条数
	onShowSizeChange = (current, size) => {
		// 修改page，或者pageSize
		this.setState({ detailPage: 1, detailPageSize: size }, () => {
			// 重新调用查询方法
			this.getDetailTableData();
		})
	}

	updateMainStatus(row) {
		let data = {
			params: [
				{
					stkLocID: row.stkLocID,
					lockFlag: row.lockFlag,
				}
			]
		}
		$http.post('urlS', this, {
			code: '02060117',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success(res.errorMessage)
				} else {
					message.error(res.errorMessage)
				}
			}
		})
	}

	/**
	* @ByShizi: 增加柱镜度数下拉选择
	* Create 2021-09-29
	* */
	updateStatus = (row) => {
		if (row?.modifyFlag !== 'Y') {
			return;
		}
		let data = {
			params: [
				{
					stkLocBatID: row.stkLocBatID,
					ordActive: +row.ordActive === 1 ? true : false,
					stkActive: +row.stkActive === 1 ? true : false,
					clyDegreesID: row?.clyDegreesID || '',
					axial: row?.axial || '', // 轴位
				}
			]
		}
		$http.post('urlS', this, {
			code: '02060116',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					row.modifyFlag = 'N';
					this.setState({});
					message.success(res.errorMessage)
				} else {
					message.error(res.errorMessage)
				}
			}
		})
	}

	// 操作行
	onClickRowPublic = (record) => {
		return {
			// 单击行选中
			onClick: () => {
				if (this.state.rowId === '') {
					// 保存行数据以及ID
					this.setState({ rowId: record.key, rowData: record }, () => {
						this.getDetailTableData()
					})
				} else {
					if (this.state.rowId !== record.key) {
						this.setState({ rowId: record.key, rowData: record }, () => {
							this.getDetailTableData()
						})
					} else {
						this.setState({ rowId: '', rowData: {}, detailData: [] })
					}
				}
			}
		}
	}

	// 选中行操作
	setRowClassNamePublic = (record) => {
		return record.key === this.state.rowId ? 'clickRowStyle' : '';
	}

	// 关闭弹窗
	onCancel = () => {
		this.setState({ visible: false })
	}

	// 导出库存信息表
	exportInventoryInformation() {
		let { locID, stockID, endDate, stkCatID, poisonID, busTypeID, formID, onlyUse, onlyNotUse, ChineseEnglishSize } = this.state;
		let data = {}
		data = {
			params: [{
				locID: locID, // 科室ID
				stockID: stockID, // 药品ID
				endDate: endDate ? Moment(endDate).format('YYYY-MM-DD') : undefined, // 日期
				stkCatID: stkCatID, // 库存大类ID
				poisonID: poisonID, // 管制分类ID
				busTypeID: busTypeID, // 类型
				formID: formID, // 剂型ID
				onlyUse: onlyUse, // 仅在用药品
				onlyNotUse: onlyNotUse, // 仅不可用药品
			}],
			pagination: [{
				pageSize: 10000,
				currentPage: 1,
				sort: '',
				dir: 'Asc'
			}]
		}
		$http.post('urlS', this, {
			code: '02060203',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0 && res.result) {
					// let arr = res.result.rows ? res.result.rows : [];
					// for(var i = 0; i < arr.length; i++) {
					// 	arr[i].key = i
					// 	if (arr[i].lockFlag === true) {
					// 		arr[i].lockFlag = '是'
					// 	} else {
					// 		arr[i].lockFlag = '否'
					// 	}
					// }
					// handleExcel.exportExcel(this.columns, arr, ChineseEnglishSize.MaterialInventoryInquiryinventoryInfoTable ? ChineseEnglishSize.MaterialInventoryInquiryinventoryInfoTable.descripts:'库存信息表')
					document.getElementById('iframe').src = window.location.protocol + '//' + window.location.host + res.result.filePath;
					message.success(ChineseEnglishSize.MaterialInventoryInquiryexInventoryTableSuc ? ChineseEnglishSize.MaterialInventoryInquiryexInventoryTableSuc.descripts : '导出库存信息表成功');
					this.setState({ visible: false });
				}
			}
		})
	}

	// 导出批次信息表
	exportBatchInformation() {
		let { rowData, ChineseEnglishSize, locID } = this.state;
		let data = {
			params: [{
				stkLocID: locID, // 科室药品ID
				endDate: rowData.stockID ? Moment(rowData.stockID).format('YYYY-MM-DD') : undefined, // 日期
			}],
			pagination: [{
				pageSize: 10000,
				currentPage: 1,
				sort: '',
				dir: 'Asc'
			}]
		}
		$http.post('urlS', this, {
			code: '02060204',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0 && res.result) {
					// let arr = res.result.rows ? res.result.rows : [];
					// for(var i = 0; i < arr.length; i++) {
					// 	if (+arr[i].stkActive === 1) {
					// 		arr[i].stkActive = '是'
					// 	} else {
					// 		arr[i].stkActive = '否'
					// 	}
					// 	if (+arr[i].ordActive === 1) {
					// 		arr[i].ordActive = '是'
					// 	} else {
					// 		arr[i].ordActive = '否'
					// 	}
					// }
					// handleExcel.exportExcel(this.detailColumns, arr, ChineseEnglishSize.MaterialInventoryInquirybatchInfoTable ? ChineseEnglishSize.MaterialInventoryInquirybatchInfoTable.descripts:'批次信息表');
					document.getElementById('iframe').src = window.location.protocol + '//' + window.location.host + res.result.filePath;
					message.success(ChineseEnglishSize.MaterialInventoryInquiryexbatchTableSuc ? ChineseEnglishSize.MaterialInventoryInquiryexbatchTableSuc.descripts : '导出批次信息表成功');
					this.setState({ visible: false });
				}
			}
		})
	}

	// 确定
	onOk = () => {
		let { checkMainValue, checkDetailValue, ChineseEnglishSize } = this.state;
		if (checkMainValue && checkDetailValue) {// 同时导出两张表
			this.exportInventoryInformation()
			this.exportBatchInformation()
		} else if (checkMainValue) {// 导出库存信息表
			this.exportInventoryInformation()
		} else if (checkDetailValue) {// 导出批次信息表
			this.exportBatchInformation()
		} else {
			message.info(ChineseEnglishSize.MaterialInventoryInquiryselectExportData ? ChineseEnglishSize.MaterialInventoryInquiryselectExportData.descripts : '请选择需要导出的表格')
		}

	}

	// 操作库存信息Checkbox
	checkedMain = (e) => {
		this.setState({ checkMainValue: e.target.checked })
	}

	// 操作批次信息Checkbox
	checkedDetails = (e) => {
		this.setState({ checkDetailValue: e.target.checked })
	}

	// 查询条件 --- 科室
	onChangelocID = (e) => {
		this.setState({ locID: e });
	}

	// 查询条件 --- 日期
	onChangeDate = (e) => {
		this.setState({ endDate: e }, () => {
			this.handleOnSelect(2)
		});
	}

	// 查询条件 --- 类型
	onChangebusTypeID = (e) => {
		this.setState({ busTypeID: e });
	}

	// 查询条件 --- 药品名称
	onChangestockID = (e) => {
		this.setState({
			stockID: e.target.value
		});
	}

	// 查询条件 --- 药品别名
	onChangealias = (e) => {
		this.setState({
			alias: e.target.value
		});
	}

	// 查询条件 --- 库存大类
	onChangestkCatID = (e) => {
		this.setState({ stkCatID: e });
	}

	// 查询条件 --- 管制分类
	onChangepoisonID = (e) => {
		this.setState({ poisonID: e });
	}

	// 查询条件 --- 剂型
	onChangeformID = (e) => {
		this.setState({ formID: e });
	}

	// 查询条件 --- 仅在用药品
	onChangeOnlyUse = (e) => {
		this.setState({ onlyUse: e }, () => {
			this.handleOnSelect(8)
		});
	}

	// 查询条件 --- 仅不可用药品
	onChangeOnlyNotUse = (e) => {
		this.setState({ onlyNotUse: e }, () => {
			this.handleOnSelect(9)
		});
	}

	// 开单科室
	handleTransitOnChange = (e) => {
		this.setState({ transitValue: e });
	}

	// 重置
	resetFields = () => {
		this.setState({
			locID: user && user.locID ? user.locID : undefined, // 科室
			stockID: undefined, // 药品
			endDate: undefined, // 日期
			stkCatID: undefined, // 库存分类
			poisonID: undefined, // 管制分类
			busTypeID: undefined, // 类型
			formID: undefined, // 剂型
			onlyUse: undefined, // 仅在用药品
			onlyNotUse: undefined, // 仅不可用药品
			alias: undefined, //药品别名
		})
	}

	// 下拉框选中事件
	handleOnSelect = (num) => {
		switch (num) {
			case 1:
				setTimeout(() => {
					this.myRef2.current.focus();
				}, 300)
				break;
			case 2:
				setTimeout(() => {
					this.myRef3.current.focus();
				}, 300)
				break;
			case 3:
				setTimeout(() => {
					this.myRef4.current.focus();
				}, 300)
				break;
			case 4:
				this.handleQuery();
				setTimeout(() => {
					// this.myRef5.current.focus();  //别名回车焦点不变
				}, 300)
				break;
			case 5:
				setTimeout(() => {
					this.myRef6.current.focus();
				}, 300)
				break;
			case 6:
				setTimeout(() => {
					this.myRef7.current.focus();
				}, 300)
				break;
			case 7:
				setTimeout(() => {
					this.myRef8.current.focus();
				}, 300)
				break;
			case 8:
				setTimeout(() => {
					this.myRef9.current.focus();
				}, 300)
				break;
			default:
				setTimeout(() => {
					this.myRef1.current.focus();
				}, 300)
		}
	}

	// 关闭在途数窗口
	transitOnCancel = () => {
		this.setState({ transitVisible: false })
	}

	// 选择行数据 -- 在途数弹窗
	transitOnClickRow = (record) => {
		return {
			onClick: () => {
				let { transitSelectedRowKeys, transitRowData } = this.state;
				let findFlag = false;
				let start = 0;
				if (transitSelectedRowKeys) {
					transitSelectedRowKeys.find(function (value, key) {
						if (value === record.key) {
							//遍历找到选中的数据，并记录下选中数据在数组中的key
							findFlag = true;
							start = key;
						}
					})
				}
				if (findFlag) {
					//再次点击移除选中
					transitSelectedRowKeys.splice(start, 1);
					transitRowData.splice(start, 1);
				} else {
					//将点击的行添加到选中
					transitSelectedRowKeys.push(record.key);
					transitRowData.push(record);
				}
				if (this.state.transitRowId === '') {
					this.setState({
						transitRowId: record.key,
						transitSelectedRowKeys,
						transitRowData
					});
				} else {
					if (this.state.transitRowId !== record.key) {
						this.setState({
							transitRowId: record.key,
							transitSelectedRowKeys,
							transitRowData
						});
					} else {
						this.setState({
							transitRowId: '',
							transitSelectedRowKeys,
							transitRowData
						});
					}
				}
			}
		}
	}
	//组件权限编辑器
	onColumnRef = (ref) => {
		this.columnRef = ref;
	};
	// 选中行class名 -- 在途数弹窗
	transitSetRowClassName = (record) => {
		return (('^' + this.state.transitSelectedRowKeys.join('^') + '^').indexOf('^' + record.key + '^') > -1) ? 'clickRowStyle' : '';
	}

	// 3.1.2.2.1.开单科室下拉框数据集
	getTransitSelectData = () => {
		let data = {
			params: []
		}
		$http.post('urlS', this, {
			code: '02020119',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					this.setState({ transitSelectData: res.result })
				}
			}
		})
	}

	// 请求列表数据
	getTransitTableData(transitValue) {
		this.setState({ detailsLoading: true })
		let { rowDataModal, transitPageSize, transitPage } = this.state;
		let data = {
			params: [{
				stkLocID: this.state.flag === 'main' ? rowDataModal.stkLocID : undefined, // 科室库存项ID
				ordLocID: transitValue, // 开单科室ID
				stkLocBatID: this.state.flag === 'detail' ? rowDataModal.stkLocBatID : undefined
			}],
			pagination: [{
				pageSize: transitPageSize,
				currentPage: transitPage,
				sort: '',
				dir: 'Asc'
			}]
		}
		$http.post('urlS', this, {
			code: '02060195',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					let arr = res.result[0] && res.result[0].rows ? res.result[0].rows : [];
					for (var i = 0; i < arr.length; i++) {
						arr[i].key = i + 1
					}
					this.setState({ transitTableData: arr, transitTotal: res.result[0] && res.result[0].total, transitSelectedRowKeys: [], transitRowId: '', transitRowData: [], detailsLoading: false })
				} else {
					this.setState({ transitTableData: [], transitTotal: 0, transitSelectedRowKeys: [], transitRowData: [], transitRowId: '' })
				}
			}
		})
	}

	// 3.1.2.2.2.获取在途数明细
	getTransitQuery = () => {
		this.setState({ transitPage: 1, transitPageSize: 10 }, () => {
			let { transitValue } = this.state;
			this.getTransitTableData(transitValue);
		})
	}

	handleTransitPagination = (page, pageSize) => {
		this.setState({ transitPage: page, transitPageSize: this.state.transitPageSize }, () => {
			let { transitValue } = this.state;
			this.getTransitTableData(transitValue)
		})
	}

	handleTransitOnShowSizeChange = (page, pageSize) => {
		this.setState({ transitPage: 1, transitPageSize: pageSize }, () => {
			let { transitValue } = this.state;
			this.getTransitTableData(transitValue)
		})
	}

	// 清除
	transitOnOk = () => {
		let { ChineseEnglishSize } = this.state;
		let arr = this.state.transitRowData && JSON.parse(JSON.stringify(this.state.transitRowData)).map(item => {
			return {
				reswayID: item.reswayID
			}
		})
		let data = {
			params: arr
		}
		$http.post('urlS', this, {
			code: '02060196',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success(ChineseEnglishSize.MaterialInventoryInquiryclearSucc ? ChineseEnglishSize.MaterialInventoryInquiryclearSucc.descripts : '清除成功');
					this.setState({ transitSelectedRowKeys: [], transitRowData: [], transitRowId: '' }, () => {
						this.handleQuery();
						this.transitOnCancel();
					})
				}
			}
		})
	}

	// 晶体序列号
	handleSerialNoChange = e => {
		this.setState({ serialNo: e.target.value })
	}

	render() {
		let { detailColumns, ChineseEnglishSize, columns, transitColumns, language } = this.state;
		// 组件所需参数
		const param = {
			// 表头配置
			columns: columns.length > 0 ? columns : this.columns,
			// 表格数据
			data: this.state.mainData,
			// 数据总条数
			total: this.state.total,
			// 当前页数
			page: this.state.mainPage,
			// 表格的宽度
			x: this.state.columnsWidth,
			y: store.getState().tableHeight.y / 2 - 25,
			height: store.getState().tableHeight.y / 2 + 20 + 'px',
			isOnRow: true,
			rowClassName: true,
			loading: this.state.publicLoading
		}
		// 科室
		let departmentOption = this.state.selectData.loc && this.state.selectData.loc.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})
		// 类型
		let typeOption = this.state.selectData.busType && this.state.selectData.busType.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})
		// 库存大类
		let stkCatOption = this.state.selectData.stkCat && this.state.selectData.stkCat.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})
		// 管制分类
		let poisonOption = this.state.selectData.poison && this.state.selectData.poison.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} titseatchprople={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})
		// 剂型
		let formOption = this.state.selectData.form && this.state.selectData.form.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})

		// 开单科室
		let transitOption = this.state.transitSelectData && this.state.transitSelectData.map((item, index) => {
			return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
		})

		const rowSelection = {
			selectedRowKeys: this.state.transitSelectedRowKeys,
			selectedRows: this.state.transitRowData,
			onChange: (selectedRowKeys, selectedRows) => {
				// console.log(selectedRowKeys, selectedRows)
				let rowId = '';
				if (selectedRowKeys.length !== 0) {
					rowId = selectedRowKeys[selectedRowKeys.length - 1];
				}
				this.setState({ transitSelectedRowKeys: selectedRowKeys, transitRowData: selectedRows, transitRowId: rowId })
			}
		};
		return (
			<div className="stock-search">
				<Row>
					<iframe id="iframe" style={{ display: 'none' }}></iframe>
					<Col xs={12} sm={12} md={10} lg={8} xl={6} xxl={4}>
						<Card
							size="small"
							title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.MaterialInventoryInquirybuttonOperation ? ChineseEnglishSize.MaterialInventoryInquirybuttonOperation.descripts : '按钮操作'}</div>}
							// extra={<a href="#">More</a>}
							className="card-body-padding"
						>
							<div style={{ textAlign: 'center' }}>
								<Button type="primary" onClick={this.handleQuery} style={{ marginTop: '12px' }}>{ChineseEnglishSize.MaterialInventoryInquirysearch ? ChineseEnglishSize.MaterialInventoryInquirysearch.descripts : '查询'}</Button>
								<Button style={{ margin: '0 8px' }} onClick={this.resetFields}>{ChineseEnglishSize.MaterialInventoryInquiryReset ? ChineseEnglishSize.MaterialInventoryInquiryReset.descripts : '重置'}</Button>
								<Button onClick={this.downloadExl} type="dashed" style={{ margin: '12px 0' }}>
									<Icon type="export" />{ChineseEnglishSize.MaterialInventoryInquiryexport ? ChineseEnglishSize.MaterialInventoryInquiryexport.descripts : '导出'}
								</Button>
							</div>
						</Card>
						<div style={{ height: '6px', background: 'rgba(240, 242, 245, 1)', width: '100%' }}></div>
						<Card
							size="small"
							title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.MaterialInventoryInquirySearchTitle ? ChineseEnglishSize.MaterialInventoryInquirySearchTitle.descripts : '查询条件'}</div>}
							style={{ borderBottom: 0 }}
						>
							<div>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquiryloc ? ChineseEnglishSize.MaterialInventoryInquiryloc.descripts : '科室：'}
									</Col>
									<Col span={16}>
										<Select showSearch optionFilterProp="seatchprop" placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'} style={{ width: '150px' }} value={this.state.locID} onChange={this.onChangelocID} ref={this.myRef1} onSelect={() => this.handleOnSelect(1)}>
											{departmentOption}
										</Select>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquirydate ? ChineseEnglishSize.MaterialInventoryInquirydate.descripts : '日期：'}
									</Col>
									<Col span={16}>
										<DatePicker placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'} style={{ width: '150px' }} value={this.state.endDate} onChange={this.onChangeDate} ref={this.myRef2} />
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquirytype ? ChineseEnglishSize.MaterialInventoryInquirytype.descripts : '类型：'}
									</Col>
									<Col span={16}>
										<Select showSearch optionFilterProp="seatchprop" allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'} style={{ width: '150px' }} value={this.state.busTypeID} onChange={this.onChangebusTypeID} ref={this.myRef3} onSelect={() => this.handleOnSelect(3)}>
											{typeOption}
										</Select>
									</Col>
								</Row>
								{/* 晶体序列号 */}
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquiryserialNo ? ChineseEnglishSize.MaterialInventoryInquiryserialNo.descripts : '晶体序列号：'}
									</Col>
									<Col span={16}>
										<Input allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseEntry ? ChineseEnglishSize.MaterialInventoryInquirypleaseEntry.descripts : '请输入'}
											style={{ width: '150px' }} value={this.state.serialNo} onChange={this.handleSerialNoChange}
											ref={this.myRef4} onPressEnter={() => this.handleOnSelect(4)}
										/>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquirydrugAlias ? ChineseEnglishSize.MaterialInventoryInquirydrugAlias.descripts : '药品别名：'}
									</Col>
									<Col span={16}>
										<Input allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseEntry ? ChineseEnglishSize.MaterialInventoryInquirypleaseEntry.descripts : '请输入'}
											style={{ width: '150px' }} value={this.state.alias} onChange={this.onChangealias}
											ref={this.myRef4} onPressEnter={() => this.handleOnSelect(4)}
										/>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquirystkCatID ? ChineseEnglishSize.MaterialInventoryInquirystkCatID.descripts : '库存大类：'}
									</Col>
									<Col span={16}>
										<Select showSearch optionFilterProp="seatchprop" allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'}
											style={{ width: '150px' }} value={this.state.stkCatID} onChange={this.onChangestkCatID} ref={this.myRef5}
											onSelect={() => this.handleOnSelect(5)}
										>
											{stkCatOption}
										</Select>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquirypoisonID ? ChineseEnglishSize.MaterialInventoryInquirypoisonID.descripts : '管制分类：'}
									</Col>
									<Col span={16}>
										<Select showSearch optionFilterProp="seatchprop" allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'}
											style={{ width: '150px' }} value={this.state.poisonID} onChange={this.onChangepoisonID} ref={this.myRef6} onSelect={() => this.handleOnSelect(6)}
										>
											{poisonOption}
										</Select>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={8} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquiryformID ? ChineseEnglishSize.MaterialInventoryInquiryformID.descripts : '剂型：'}
									</Col>
									<Col span={16}>
										<Select showSearch optionFilterProp="seatchprop" allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'}
											style={{ width: '150px' }} value={this.state.formID} onChange={this.onChangeformID} ref={this.myRef7} onSelect={() => this.handleOnSelect(7)}
										>
											{formOption}
										</Select>
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={12} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquiryinUseDrug ? ChineseEnglishSize.MaterialInventoryInquiryinUseDrug.descripts : '仅在用药品：'}
									</Col>
									<Col span={12}>
										{language.language == 'EN' ? <Switch checkedChildren="Yes" unCheckedChildren="No" checked={this.state.onlyUse} onChange={this.onChangeOnlyUse} ref={this.myRef8} /> : <Switch checkedChildren="是" unCheckedChildren="否" checked={this.state.onlyUse} onChange={this.onChangeOnlyUse} ref={this.myRef8} />}
									</Col>
								</Row>
								<Row style={{ marginBottom: '12px', display: "flex", alignItems: "center" }}>
									<Col span={12} style={{ textAlign: 'right' }}>
										{ChineseEnglishSize.MaterialInventoryInquiryunavailableDrug ? ChineseEnglishSize.MaterialInventoryInquiryunavailableDrug.descripts : '仅不可用药品：'}
									</Col>
									<Col span={12}>
										{language.language == 'EN' ? <Switch checkedChildren="Yes" unCheckedChildren="No" checked={this.state.onlyNotUse} onChange={this.onChangeOnlyNotUse} ref={this.myRef9} /> : <Switch checkedChildren="是" unCheckedChildren="否" checked={this.state.onlyNotUse} onChange={this.onChangeOnlyNotUse} ref={this.myRef9} />}
									</Col>
								</Row>
							</div>
						</Card>
					</Col>
					<Col xs={12} sm={12} md={14} lg={16} xl={18} xxl={20}>
						<div style={{ paddingLeft: '6px', position: 'relative' }}>
							<Card
								size="small"
								title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.MaterialInventoryInquiryinventoryInfo ? ChineseEnglishSize.MaterialInventoryInquiryinventoryInfo.descripts : '库存信息'}</div>}
							// extra={<a href="#">More</a>}
							>
								<PubilcTablePagination param={param} handelThis={this} onRef={this.onRef} onClickRowPublic={this.onClickRowPublic} setRowClassNamePublic={this.setRowClassNamePublic} columns={columns} />
							</Card>
							<div style={{ height: '6px', background: 'rgba(240, 242, 245, 1)', width: '100%' }}></div>
							<Card
								size="small"
								title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.MaterialInventoryInquirybatchInfo ? ChineseEnglishSize.MaterialInventoryInquirybatchInfo.descripts : '批次信息'}</div>}
							// extra={<a href="#">More</a>}
							>
								{/* style={{height: store.getState().tableHeight.y / 2 + 55 + 'px'}} */}
								<div className="batch-information">
									<Table
										style={{ height: store.getState().tableHeight.y / 2 + 15 + 'px' }}
										columns={detailColumns.length > 0 ? detailColumns : this.detailColumns}
										dataSource={this.state.detailData}
										pagination={false}
										bordered
										scroll={{ x: this.state.detailColumnsWidth, y: store.getState().tableHeight.y / 2 - 30 }}
									/>
									<CommonPagination size='small' current={this.state.detailPage} total={this.state.detailTotal} search='search'
										onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={this.state.detailData}
										loading={this.state.loading} onChange={this.onChange.bind(this)} />
								</div>
							</Card>
							<div style={{ width: '6px', background: 'rgba(240, 242, 245, 1)', position: 'absolute', top: 0, left: 0, height: '100%' }}></div>
						</div>
					</Col>
				</Row>
				<Modal
					visible={this.state.visible}
					title={ChineseEnglishSize.MaterialInventoryInquiryexportExcel ? ChineseEnglishSize.MaterialInventoryInquiryexportExcel.descripts : '导出Excel表格'}
					okText={ChineseEnglishSize.MaterialInventoryInquirydetermine ? ChineseEnglishSize.MaterialInventoryInquirydetermine.descripts : '确定'}
					onCancel={this.onCancel}
					onOk={this.onOk}
				>
					<Row style={{ textAlign: 'center', margin: '12px 0' }}>
						<Col>
							<Col span={12}>
								{ChineseEnglishSize.MaterialInventoryInquiryexInventoryTable ? ChineseEnglishSize.MaterialInventoryInquiryexInventoryTable.descripts : '导出库存信息表：'}<Checkbox checked={this.state.checkMainValue} onChange={this.checkedMain} disabled={this.state.mainData.length < 1} />
							</Col>
							<Col span={12}>
								{ChineseEnglishSize.MaterialInventoryInquiryexbatchTable ? ChineseEnglishSize.MaterialInventoryInquiryexbatchTable.descripts : '导出批次信息表：'}<Checkbox checked={this.state.checkDetailValue} onChange={this.checkedDetails} disabled={this.state.detailData.length < 1} />
							</Col>
						</Col>
					</Row>
					<div style={{ position: 'absolute', bottom: '10px', left: '16px', height: '32px', lineHeight: '32px', opacity: '0.5' }}>{ChineseEnglishSize.MaterialInventoryInquiryexportTips ? ChineseEnglishSize.MaterialInventoryInquiryexportTips.descripts : '提示：当表格存在数据时才支持导出功能。'}</div>
				</Modal>
				<Modal
					visible={this.state.transitVisible}
					title={ChineseEnglishSize.MaterialInventoryInquirytransitDetail ? ChineseEnglishSize.MaterialInventoryInquirytransitDetail.descripts : '在途数明细'}
					okText={ChineseEnglishSize.MaterialInventoryInquiryremove ? ChineseEnglishSize.MaterialInventoryInquiryremove.descripts : '清除'}
					onCancel={this.transitOnCancel}
					onOk={this.transitOnOk}
					width={900}
				>
					<div style={{ minHeight: '480px' }}>
						<Row style={{ marginBottom: '15px' }}>
							{ChineseEnglishSize.MaterialInventoryInquirydeptOfMakePreForm ? ChineseEnglishSize.MaterialInventoryInquirydeptOfMakePreForm.descripts : '开单科室：'}<Select value={this.state.transitValue} onChange={this.handleTransitOnChange} showSearch optionFilterProp="seatchprop" allowClear placeholder={ChineseEnglishSize.MaterialInventoryInquirypleaseChoose ? ChineseEnglishSize.MaterialInventoryInquirypleaseChoose.descripts : '请选择'} style={{ width: '150px' }}>
								{transitOption}
							</Select>
							<Button style={{ marginLeft: '15px' }} onClick={this.getTransitQuery}>{ChineseEnglishSize.MaterialInventoryInquirysearch ? ChineseEnglishSize.MaterialInventoryInquirysearch.descripts : '查询'}</Button>
						</Row>
						<div className="transit-table">
							<Table
								bordered
								rowSelection={rowSelection}
								columns={transitColumns.length > 0 ? transitColumns : this.transitColumns}
								dataSource={this.state.transitTableData}
								pagination={false}
								onRow={this.transitOnClickRow}
								rowClassName={this.transitSetRowClassName}
								style={{ height: '400px' }}
								scroll={{ x: 1460, y: 350 }}
								className="clearBackground"
							/>
							<CommonPagination size='small' current={this.state.transitPage} total={this.state.transitTotal} search='search'
								onShowSizeChange={this.handleTransitOnShowSizeChange.bind(this)} complete={true} dataSource={this.state.transitTableData}
								loading={this.state.detailsLoading} onChange={this.handleTransitPagination.bind(this)} />
						</div>
					</div>
				</Modal>
				<ColumnAuthoritysModel
					clientWidth='800px'
					compontName={this.state.parameterCode}
					configType="C"
					onRef={this.onColumnRef}
					reloadData={() => {
						if (this.state.parameterCode == 'MaterialInventoryInquiry') {
							this.getColumnsTable1()
						} else if (this.state.parameterCode == 'InventoryBatchInformation') {
							this.getColumnsTable2()
						} else if (this.state.parameterCode == 'MaterialInventoryQueryExport') {
							this.getColumnsTable3()
						}
					}
					}
				/>
			</div>
		)
	}
};