You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
import React, { useEffect, useState } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import '../style.less';
|
|
import BuildingTable from '../components/buildingTable';
|
|
const superagent = require('superagent');
|
|
const building = (props) => {
|
|
const { dispatch, user } = props
|
|
const [data, setData] = useState()
|
|
useEffect(() => {
|
|
// dispatch(getDepMessage())
|
|
|
|
setData(props)
|
|
}, []);
|
|
const exports = (ids, differentiate) => {
|
|
//console.log('sssss1', ids, differentiate)
|
|
let idas = ids.toString()
|
|
if (differentiate == 'bridge') {
|
|
window.open(
|
|
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`)
|
|
} if (differentiate == 'project') {
|
|
window.open(
|
|
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`)
|
|
}
|
|
|
|
|
|
}
|
|
return (
|
|
<> <BuildingTable data={data} exports={exports} />
|
|
</>
|
|
)
|
|
}
|
|
function mapStateToProps(state) {
|
|
const { auth } = state
|
|
return {
|
|
user: auth.user,
|
|
}
|
|
}
|
|
export default connect(mapStateToProps)(building);
|