// 菜单授权
import React from 'react';
import { Row, Col, Tabs, Button, Table, Input, Popconfirm, message, Modal, Select, Icon, Checkbox } from 'antd';
import { $http } from 'containers/config/https';
import store from 'store';
import '../style/menuAuthorization.less';
import 'assets/css/system.css'
import MenuAuthorizationModel from './MenuAuthorzationModel'
import InterfaceLoading from 'pages/menuManagement/component/InterfaceLoading';
// import { Util, dayFormat } from 'tools/index';

const TabPane = Tabs.TabPane;
const Option = Select.Option;
//const Search = Input.Search;

class MenuAuthorization extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			windowHeight: window.innerHeight,
			id: '',
			visible: false,
			leftTabLoading: true,//加载中
			rightTabLoading: true,//加载中
			dataSource1: [],//获取科室表数据
			dataSource: [], // 左侧table数据
			dataSource2: [],//查出左侧select框里的数据
			dataSource3: [],//查出右侧select框里的数据
			AuthorizationList: [],//查询tab的数据
			activeKey: '1',
			checked: false,
			menuDetailDate: [],//菜单明细选中后当中的值
			selectData: [],//获取科室下拉数据
			data: [],//右侧table表格数据
			selectRow: "",//获取行
			selectLoc: "",//获取科室
			selectedRows: [],//增加菜单明细
			selectedRowKeys: [],//左边的勾选清除
			selectedRowKeys_right: [],//右边的勾选清除
			// 菜单选中后当中的值
			selectMenu: [],
			menuKey: '',
			title: '',
			roleId: ""
		};
		this.textInput = React.createRef();
	}

	componentWillReceiveProps(nextProps) {
		// 当修改选择的数据后刷新数据
		if (nextProps.roleId !== '') {
			this.getDetailData(nextProps.roleId)
			this.getAuthorizationList(nextProps.roleId);
			this.setState({ roleId: nextProps.roleId })
			this.setState({ selectRow: "", selectedRows: "" })
		} else {
			this.setState({ roleId: "" })
		}
	}

	componentDidMount() {
		if (this.props.roleId !== '') {
			this.getDetailData(this.props.roleId)
			this.setState({ selectRow: "", selectedRows: "" })
			this.getAuthorizationList(this.props.roleId);
			this.setState({ roleId: this.props.roleId })
		}
		// this.handleSelectChange();//下拉框科室查到表格数据
	}

	// 获取Checkbox操作后的值
	handleCheckbox = (e) => {
		this.setState({ checked: e.target.checked });
	}

	// 获取主菜单下拉
	getDetailData = (roleId) => {
		let data = {//获取角色菜单明细授权所用到的信息
			params: [{
				GroupDr: roleId,
				Type: this.state.activeKey,
			}]
		}
		$http.post('urlS', this, {
			code: "2606",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					this.setState({
						menuDate: res.result && res.result.MainMenu,
						dataSource: res.result && res.result.MenuDetail,
						dataSource2: res.result && res.result.MenuDetail,
						dataSource3: res.result && res.result.MenuDetail,
						selectMenu: res.result.GroupMainMenu,
						leftTabLoading: false
					})
				}
			},
			error: (error) => {
				message.error('失败：' + error);
			}
		})
	}

	// 下拉框主菜单 
	handleChange = (k) => {
		this.setState({ menuKey: k })
	}

	// 下拉框菜单明细科室的
	handleChangeS = (k) => {
		this.setState({ id: k })
	}

	// 下拉框主科室获取 
	handleChangeSelect = (k) => {
		this.setState({ selectLoc: k })
	}

	// 删除角色菜单明细授权信息服务
	handleDelete = () => {
		const selectedRowKeys_right = this.state.selectedRowKeys_right;
		// console.log(selectedRow_right)
		let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
		let data = {
			params: [{
				IDs: selectedRowKeys_right,
				UpdateUserDr: user.userID
			}]
		}
		$http.post('urlS', this, {
			code: '2604',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success('删除成功');
					this.setState({ selectedRowKeys_right: [] })
					this.getDetailData(this.props.roleId);
					this.getAuthorizationList(this.props.roleId);
				}
			},
			error: function (error) {
				message.error('删除失败：' + error);
			}
		})
	}

	//升级
	handleUpdate = () => {
		const { selectedRowKeys_right } = this.state;
		let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
		let arr = [];
		let object = {};

		for (var i = 0; i < selectedRowKeys_right.length; i++) {
			object = {}
			object.ID = selectedRowKeys_right[i],
				object.UpdateUserDr = user.userID,
				arr.push(object)
		}
		let data = {
			params: [{
				MenuSubs: arr
			}]
		}
		$http.post('urlS', this, {
			code: '2611',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success('成功');
					this.getAuthorizationList(this.props.roleId);
				}
			},
			error: function (error) {
				message.error('失败：' + error);
			}
		})
	}

	// 下拉框科室查到表格数据
	handleSelectChange = () => {
		let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
		let data = {
			params: [{
				hospID: user.hospDr,
			}]
		}
		$http.post('urlS', this, {
			code: "1008",
			data: data,
			success: (res) => {
				res.hbLoc.map((item, index) => {
					res.hbLoc[index].key = index;
					return res.hbLoc;
				})
				if (+res.errorCode === 0) {
					this.setState({
						selectData: res.hbLoc
					})
				}
			}
		})
	}

	//查询菜单授权查询科室权限信息
	handleSelectC = (id) => {
		let data = {
			params: [{
				MenuSubID: id
			}]
		}
		$http.post('urlS', this, {
			code: "2607",
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					res.result.Data.map((item, index) => {
						res.result.Data[index].key = index;
						return res.result.Data;
					})
					this.setState({ dataSource1: res.result.Data })
					this.setState({ selectRow: id })
				}
			}
		})
	}

	//查询菜单明细 
	handleQuery = () => {
		let data = {
			params: [{
				Code: "",
				Descripts: ""
			}]
		}
		$http.post('urlS', this, {
			code: "2301",
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					res.result.Data.map((item, index) => {
						res.result.Data[index].key = index;
						return res.result.Data;
					})
					this.setState({ dataSource: res.result.Data })
				} else {
					message.error('查询失败：' + res.errorMessage);
				}
			}
		})
	}

	mapDataToKey = arr => {
		const that = this
		return arr.map(item => {
			if (item.children && item.children.length > 0) {
				that.mapDataToKey(item.children)
			}
			return { ...item, key: item.ID }
		})
	}

	//查询授权菜单
	getAuthorizationList = (roleId, inpVal) => {
		// console.log(inpVal)
		let data = {
			params: [{
				GroupDr: roleId,
				Type: this.state.activeKey,
				Desc: inpVal,
			}]
		}

		$http.post('urlS', this, {
			code: "2601",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					res.result.Data.map((item, index) => {
						res.result.Data[index].key = index;
						return res.result.Data;
					})
					this.setState({
						data: this.mapDataToKey(res.result.Data),
						// data: res.result.Data,
						//  total: res.result.TotalCount,
						rightTabLoading: false
					})
				}
			}

		})
	}

	// 新增角色菜单授权科室权限信息
	handelSave = () => {
		let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
		let data = {
			params: [{
				LocDr: this.state.id,
				MenuSubID: this.state.selectRow,
				UpdateUserDr: user.userID
			}]
		}
		$http.post('urlS', this, {
			code: "2608",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					message.success('新增成功');
					this.handleSelectC(this.state.selectRow)
				}
			}
		})
	}

	// 新增菜单明细授权信息
	handelAdd = () => {
		//console.log('this.state.selectedRowKeys_right',this.state.selectedRowKeys_right)
		if (this.state.selectedRows.length > 0) {
			if (this.state.selectedRowKeys_right.length <= 1) {//已选菜单只能加一个
				let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
				let data = {
					params: [{
						GroupDr: this.state.roleId,
						Type: this.state.activeKey,
						MenuDetail: [],
					}]
				}
				this.state.selectedRows.map((item) => {
					return data.params[0].MenuDetail.push({
						MenuDetailDr: item.id,
						SeqNo: '',
						LocDr: '',
						PreMenuGroupDr: this.state.selectRow,
						UpdateUserDr: user.userID
					});
				})
				$http.post('urlS', this, {
					code: "2602",
					data: data,
					success: (res) => {
						if (+res.errorCode === 0) {
							message.success('新增成功');
							this.getAuthorizationList(this.props.roleId);
							this.getDetailData(this.props.roleId);
							this.setState({ selectedRowKeys: [], selectedRowKeys_right: [], selectRow: '', selectedRows: '' });
						}
					},
					error: (error) => {
						message.error('新增失败：' + error);
					}
				})
			} else {
				message.error("已选菜单只能选择一个");
			}
		} else {
			message.error("请勾选后再点击增加");
		}
	}

	//在行上获取子级
	onClickRow = (record) => {
		return {
			onRow: () => {
				let selectedRowKeys = this.state.selectedRowKeys_right;
				let findFlag = false;
				let start = 0;
				if (selectedRowKeys !== "") {
					selectedRowKeys.find(function (value, key) {
						if (value === record.ID) {
							//遍历找到选中的数据，并记录下选中数据在数组中的key
							findFlag = true;
							start = key;
						}
					})
				}
				if (findFlag) {
					//再次点击移除选中
					selectedRowKeys.splice(start, 1);
				} else {
					//将点击的行添加到选中
					selectedRowKeys.push(record.ID);
				}
				let btnStatus = 'active';
				if (selectedRowKeys.length === 0) {
					btnStatus = 'default';
				}
				if (this.state.selectRow === "") {
					this.setState({
						selectRow: record.ID,
						selectedRowKeys_right: selectedRowKeys,
						btnStatus: btnStatus,
					});
				} else {
					if (this.state.selectRow !== record.ID) {
						this.setState({
							selectRow: record.ID,
							selectedRowKeys_right: selectedRowKeys,
							btnStatus: btnStatus,
						});
					} else {
						this.setState({
							selectRow: "",
							selectedRowKeys_right: selectedRowKeys,
							btnStatus: btnStatus,
						});
					}
				}

			},
			onMouseEnter: () => {
				//debugger
			}
		}

	}

	setRowClassName = (record) => {
		return (("^" + this.state.selectedRowKeys_right.join("^") + "^").indexOf("^" + record.ID + "^") > -1) ? 'clickRowStyle' : '';
	}

	// 删除角色菜单授权科室权限信息
	handleDel(record) {
		let data = {
			params: [{
				ID: record.ID
			}]
		}
		$http.post('urlADS', this, {
			code: '2609',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success('删除成功');
					// 刷新列表数据
					this.handleSelectC(this.state.selectRow)
				}
			},
			error: function (error) {
				message.error('删除失败：' + error);
			}
		})
	}

	showModal = (id) => {
		this.handleSelectC(id);
		this.setState({
			visible: true
		}, () => {
			this.handleSelectChange();//下拉框科室查到表格数据
		});

	}

	//确认
	handleOk = (e) => {
		this.setState({
			visible: false,
		});
	}

	handleCancel = (e) => {
		this.setState({
			visible: false,
		});
	}

	//上移
	moveUp = (arr, index) => {
		if (index === 0) {
			message.error('已经到顶啦')
		} else {
			arr[index] = arr.splice(index - 1, 1, arr[index])[0]
		}
		return arr
	}

	//下移
	moveDown = (arr, index) => {
		if (index === arr.length - 1) {
			message.error('已经到底啦')
		} else {
			arr[index] = arr.splice(index + 1, 1, arr[index])[0]
		}
		//console.log(arr, index)
		return arr
	}

	handleMove = status => {
		const that = this
		let { data, selectedRowKeys_right } = this.state;
		function _mapData(arr) {
			for (let index = 0, len = arr.length; index < len; index++) {
				const item = arr[index]
				if (selectedRowKeys_right.some(ele => ele === item.key)) {
					if (status === 'up') {
						arr = that.moveUp(arr, index)
					} else if (status === 'down') {
						arr = that.moveDown(arr, index)
						index += 1
					}
				}
				if (item.children && item.children.length > 0) {
					_mapData(item.children)
				}
			}
		}
		_mapData(data)
		this.setState({
			data
		})
	}

	onChangeTabs = (k) => {//主菜单下拉
		this.setState({
			activeKey: k,
			selectedRowKeys: [],
			selectedRowKeys_right: [],
		}, () => {
			if (this.props.roleId !== '') {
				this.getAuthorizationList(this.props.roleId);
				this.getDetailData(this.props.roleId)
			}
		}
		)
	}

	//查询文本框
	handleSelectFilterItem = value => {
		this.setState({
			filterItem_select: value
		})
	}

	//查询文本框和下拉框
	filterDataSource = () => {
		const { dataSource2, filterItem_select } = this.state;
		let filterItem_input = this.textInput && this.textInput.current && this.textInput.current.state && this.textInput.current.state.value;
		const resData = dataSource2.filter(item => {
			if (filterItem_input && filterItem_input !== '' && filterItem_input !== ' ') {
				if (filterItem_select === 'isMenu') {
					return item.descripts && item.descripts.indexOf(filterItem_input) > -1 && item.MenuGroup === '是'
				} else if (filterItem_select === 'isFilterMenu') {
					return item.descripts && item.descripts.indexOf(filterItem_input) > -1 && item.MenuGroup === ''
				}
				return item.descripts.indexOf(filterItem_input) > -1
			} else if (filterItem_select === 'isMenu') {
				return item.MenuGroup === '是'
			} else if (filterItem_select === 'isFilterMenu') {
				return item.MenuGroup === ''
			}
			return item
		})
		this.setState({
			dataSource: resData
		})
	}

	//查出右侧搜索框的数据
	filterSelect = (e) => {
		let val = e.target.value;
		this.getAuthorizationList(this.props.roleId, val);
		//this.getDetailData(this.props.roleId);
	}

	SaveMenuSort = () => {
		let data = {
			params: [{
				data: this.state.data
			}]
		}
		$http.post('urlADS', this, {
			code: '01040042',
			data: data,
			success: function (res) {
				if (+res.errorCode === 0) {
					message.success('保存成功');
					this.getAuthorizationList(this.props.roleId);
					this.setState({ selectedRowKeys: [], selectedRow_right: [], selectRow: '', selectedRows: '' });
				}
			},
			error: function (error) {
				message.error('失败：' + error);
			}
		})
	}

	/**
	* @ByShizi: 查看界面轮廓
	* Create 2022-12-08
	* */
	handleLookUp = (record) => {
		let linkAddress = record?.linkAddress || '';
		let linkAddressSplit = linkAddress && linkAddress.indexOf('/') > -1 ? linkAddress.split('/') : [];
		let componentName = linkAddressSplit && linkAddressSplit.length > 0 ? linkAddressSplit[linkAddressSplit.length - 1] : '';
		let sessionKey = componentName && componentName.indexOf('.') > -1 ? componentName.split('.')[0] : componentName;
		React.$setSessionData(sessionKey, record.paras, false);
		this.setState({ lookUpSessionkey: sessionKey });
		linkAddress = linkAddress.indexOf('../') > -1 ? linkAddress.split('../')[1] : linkAddress;
		this.interfaceRef && this.interfaceRef.modifyVisible(true, linkAddress, record?.descripts || '', record?.paras || '');
	}

	// 清除查看数据
	clearLookUpSessionData = () => {
		const { lookUpSessionkey } = this.state;
		React.$removeSessionData(lookUpSessionkey);
	}

	renderPage = (key) => {
		// console.log("renderPage")
		const columns = [{
			title: '菜单名称',
			dataIndex: 'MenuDetailDrDesc',
			key: 'MenuDetailDrDesc',
			width: 100,
			align: 'left',
			render: (text, record, index) => {
				if (record.LocFlag === 1) {
					return (
						<span>{text}<font style={{ color: 'red' }}>{'(科室)'}</font></span>
					)
				} else {
					return text
				}
			}
		}, {
			title: '权限名称',
			dataIndex: '',
			key: 'x',
			width: 100,
			align: "center",
			render: (text, record, index) => (
				<div>
					<div>
						<span onClick={this.showModal.bind(this, record.ID)} className="span">设置</span>
					</div>

				</div>
			)
		}, {
			title: '菜单组',
			dataIndex: 'MenuGroup',
			width: 80,
			align: "center",
			key: "MenuGroup"
		}
		];

		const colColumns = [{
			title: '菜单名称',
			dataIndex: 'descripts',
			align: "center",
			width: 200,
			key: "descripts"
		}, {
			title: '菜单组',
			dataIndex: 'MenuGroup',
			width: 80,
			align: "center",
			key: "MenuGroup"
		}, {
			title: '操作',
			key: 3,
			align: 'center',
			width: 120,
			render: (text, record) => (
				<span>
					{record?.linkAddress ? (
						<span className='span' style={{ color: '#108EE9' }} onClick={() => this.handleLookUp(record)}>查看界面轮廓</span>
					) : ''}
				</span>
			),
		}]

		const { selectedRowKeys, selectedRow_right } = this.state;

		const rowSelection = {
			selectedRowKeys,
			onChange: (selectedRowKeys, selectedRows) => {
				this.setState({ selectedRows, selectedRowKeys });
			},
			onSelect: (record, selected, selectedRows) => {
				this.setState({ selectedRows });
			},
			onSelectAll: (selected, selectedRows, changeRows) => {
				this.setState({ selectedRows });
			}
		};

		const rowSelection_right = {
			selectedRowKeys: this.state.selectedRowKeys_right,
			onChange: (selectedRowKeys, selectedRows) => {
				let btnStatus = 'active';
				let selectRow = "";
				if (selectedRowKeys.length === 0) {
					btnStatus = 'default';
				} else {
					selectRow = selectedRowKeys[selectedRowKeys.length - 1];
				}
				this.setState({ btnStatus: btnStatus, selectRow: selectRow, selectedRow_right: selectedRows, selectedRowKeys_right: selectedRowKeys });
			},
			onSelectAll: (selected, selectedRows, changeRows) => {
				if (selectedRows.length > 0) {
					this.setState({
						btnStatus: 'active'
					})
				} else {
					this.setState({
						btnStatus: 'default'
					})
				}
				this.setState({ selectedRow_right: selectedRows });
			}
		};
		return (
			<div key={key} className="menu-authorization">
				<div className={"flexBox"}>
					<div className={"leftTable"}>
						<Row>
							<Col span={24}>
								<ul style={{ paddingLeft: '15px' }}>
									<li style={{ color: '#F7805D' }}><span style={{ color: 'green', fontSize: '16px' }}>待选菜单</span></li>
								</ul>

							</Col>
						</Row>
						<Row style={{ marginBottom: '1rem' }}>
							<Col span={9}>
								<Input placeholder="输入菜单名可回车查询" style={{ width: '100%' }} ref={this.textInput} onPressEnter={this.filterDataSource} />
								{/* <Input style={{ width: '100%' }} onChange={Util.commonInputChange.bind(this,'filterItem_input')}/> */}
							</Col>
							<Col span={9} offset={1}>
								<Select
									showSearch
									placeholder="请选择"
									optionFilterProp="children"
									style={{ width: '100%' }}
									onChange={this.handleSelectFilterItem}
									filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
								>
									<Option value="all">全部</Option>
									<Option value="isMenu">菜单组</Option>
									<Option value="isFilterMenu">非菜单组</Option>
								</Select>
							</Col>
							<Col span={4} offset={1}>
								<Button type="primary" onClick={this.filterDataSource}>查询</Button>
							</Col>
						</Row>
						<Row style={{ marginBottom: '1.3rem' }}>
							<Col span={12}>
								<Checkbox checked={this.state.checked} onChange={this.handleCheckbox}>仅显示生效</Checkbox>
							</Col>
						</Row>
						<Table
							// style={{ height: this.state.windowHeight - 380 + 'px' }}
							bordered
							loading={this.state.leftTabLoading}
							components={this.components}
							columns={colColumns}
							dataSource={this.state.dataSource}
							rowKey={(row) => {
								return row.id
							}}
							pagination={false}
							scroll={{ x: 240, y: this.state.windowHeight - 538 }}
							rowSelection={rowSelection}
							className="table-body-height"
						/>
					</div>
					<Icon type="right-circle" style={{ fontSize: '30px', display: 'flex', alignItems: 'center' }} size="small" onClick={this.handelAdd} />
					<div className={"rightTable"} style={{ overflow: 'hidden', padding: "0 20px 0 20px", margintop: '4px' }}>
						<Row>
							<Col span={24}>
								<ul style={{ paddingLeft: '15px' }}>
									<li style={{ color: '#42B983' }}><span style={{ color: 'green', margintop: '1rem', fontSize: '16px' }}>已选菜单</span></li>
								</ul>

							</Col>
						</Row>
						<Row style={{ marginBottom: '1rem' }}>
							<Col span={12}>
								<Input ref={input => this.input = input} onChange={(e) => this.filterSelect(e)} />
							</Col>
							<Col span={11} offset={1} >
								<span style={{ color: '#20A1FF', position: 'absolute', top: '4px', cursor: 'pointer' }} onClick={() => this.setState({ visible1: true })}>复制菜单授权</span>
							</Col>

						</Row>
						<Row style={{ marginBottom: '1rem' }}>
							<Button disabled={this.state.btnStatus !== 'active'} size="small" type="dashed" onClick={this.handleMove.bind(this, 'up')} style={{ marginRight: '10px' }}>上移</Button>
							<Button disabled={this.state.btnStatus !== 'active'} size="small" type="dashed" onClick={this.handleMove.bind(this, 'down')} style={{ marginRight: '10px' }}>下移</Button>
							<Button disabled={this.state.btnStatus !== 'active'} size="small" type="dashed" onClick={this.handleUpdate} style={{ marginRight: '10px' }}>升级</Button>
							<Button disabled={this.state.btnStatus !== 'active'} size="small" type="danger" onClick={this.handleDelete} style={{ marginRight: '10px' }}>删除</Button>
							<Button size="small" type="primary" onClick={this.SaveMenuSort} style={{ marginRight: '10px' }}>保存</Button>
						</Row>
						<Table
							style={{ marginTop: '1.18rem' }}
							columns={columns}
							bordered
							loading={this.state.rightTabLoading}
							indentSize={15}
							dataSource={this.state.data}
							rowKey={(row) => {
								return row.ID
							}}
							rowClassName={this.setRowClassName}
							onRow={this.onClickRow}
							pagination={false}
							rowSelection={rowSelection_right}
							scroll={{ x: 440, y: this.state.windowHeight - 538 }}
							className="table-body-height"
						/>
					</div>
				</div>
			</div>
		)
	}

	render() {
		let { activeKey } = this.state
		const columns = [{
			title: '科室',
			dataIndex: 'LocDrDesc',
			key: 'LocDrDesc',
			width: 150,
			align: "center"
		}, {
			title: '更新日期',
			dataIndex: 'UpdateDate',
			key: 'UpdateDate',
			width: 120,
			align: "center"
		}, {
			title: '时间',
			dataIndex: 'UpdateTime',
			key: 'UpdateTime',
			width: 120,
			align: "center"
		}, {
			title: '操作',
			dataIndex: '',
			key: 'y',
			width: 130,
			align: "center",
			render: (text, record) => (
				<div>
					<div>
						{
							<Popconfirm title="删除不可恢复，你确定要删除吗?" onConfirm={() => this.handleDel(record)} >
								<span className="span">删除</span>
							</Popconfirm>
						}
					</div>
				</div>
			)
		}];

		return (
			<div className='nav-container' style={{ height: store.getState().tableHeight.y + 22 + 'px', overflow: 'auto' }}>
				<Tabs onChange={this.onChangeTabs} activeKey={activeKey}>
					<TabPane tab="头菜单" key="1">
						{activeKey === "1" && this.renderPage(1)}
					</TabPane>
					<TabPane tab="侧菜单" key="2">
						{activeKey === "2" && this.renderPage(2)}
					</TabPane>
					<TabPane tab="Tab菜单" key="3">
						{activeKey === "3" && this.renderPage(3)}
					</TabPane>
				</Tabs>
				<Modal
					title="科室"
					visible={this.state.visible}
					onOk={this.handleOk}
					onCancel={this.handleCancel}
					width="50%"
					height="600px"
				>
					<Select showSearch allowClear placeholder="请输入" optionFilterProp="title" onSelect={this.handleChangeS} style={{ width: 330, marginBottom: '12px', display: 'inline-block' }} >
						{this.state.selectData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
					</Select>
					<Button type="primary" onClick={this.handelSave} style={{ marginBottom: '12px', marginLeft: '24px', display: 'inline-block' }}>增加</Button>
					<Table
						bordered
						style={{ height: '400px', maxHeight: '400px', overflow: 'scroll' }}
						columns={columns}
						dataSource={this.state.dataSource1}
						rowkey={row => row.key}
						onRow={this.onClickRow1}
						pagination={false}
					/>
				</Modal>
				<MenuAuthorizationModel
					visible={this.state.visible1}
					handleOk={() => this.setState({ visible1: false })}
					handleThis={this}
				/>

				{/* 查看界面轮廓 */}
				<InterfaceLoading onRef={ref => this.interfaceRef = ref} clearSessionData={this.clearLookUpSessionData} />
			</div>
		)
	}
};

export default MenuAuthorization;