|
|
@ -1,37 +1,69 @@ |
|
|
|
import React, { useEffect, useState,useRef } from 'react'; |
|
|
|
import React, { useEffect, useState, useRef } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Spin, Button, Popconfirm, Badge } from 'antd'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
|
import './protable.less' |
|
|
|
import { getHighways } from "../actions/infor" |
|
|
|
import HightModal from './highways/highwaysdata'; |
|
|
|
import Guanli from './highways/guanli'; |
|
|
|
|
|
|
|
|
|
|
|
const HigwaysTable = (props) => { |
|
|
|
const { dispatch, user, } = props |
|
|
|
const [rowSelected, setRowSelected] = useState([]) |
|
|
|
const [modalVisible, setModalVisible] = useState(false); |
|
|
|
const [counts, setCounts] = useState()//shuju
|
|
|
|
const [modalVisibleyilan, setModalVisibleyilan] = useState(false); |
|
|
|
const [modalVisibleyilans, setModalVisibleyilans] = useState(false); |
|
|
|
const [modalRecord, setModalRecord] = useState(); |
|
|
|
const [typecard, setTypecard] = useState(); |
|
|
|
const [recortd, setRecortd] = useState() |
|
|
|
const [sitename, setSitename] = useState()//桥梁名称
|
|
|
|
const [delet, setDelet] = useState() |
|
|
|
const [activeKey, setActiveKey] = useState('tab1'); |
|
|
|
const [whichofits, setWhichofits] = useState('qiaoliang') |
|
|
|
const [differentiate, setDifferentiate] = useState('bridge') |
|
|
|
|
|
|
|
const ref = useRef() |
|
|
|
useEffect(() => { ref.current.reload() }, [ delet]) |
|
|
|
//打开弹窗
|
|
|
|
const hightModal = (type, record) => { |
|
|
|
setModalVisibleyilan(true); |
|
|
|
// setModalType(type);
|
|
|
|
if (type == 'edit') { |
|
|
|
setModalRecord(record); |
|
|
|
} else { |
|
|
|
setModalRecord(null); |
|
|
|
useEffect(() => { ref.current.reload() }, [delet]) |
|
|
|
//打开弹窗
|
|
|
|
const hightModal = (type, record) => { |
|
|
|
setModalVisibleyilan(true); |
|
|
|
// setModalType(type);
|
|
|
|
if (type == 'edit') { |
|
|
|
setModalRecord(record); |
|
|
|
} else { |
|
|
|
setModalRecord(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const columns = |
|
|
|
[ |
|
|
|
const deldatas = (id) => { // 工程
|
|
|
|
const query = { |
|
|
|
projectId: id |
|
|
|
} |
|
|
|
// dispatch(delProject(query)).then((res) => {
|
|
|
|
// setDelet(res)
|
|
|
|
// })
|
|
|
|
} |
|
|
|
const openModal = (type, record) => { |
|
|
|
setModalVisible(true); |
|
|
|
// setModalType(type);
|
|
|
|
if (type == 'edit') { |
|
|
|
setModalRecord(record); |
|
|
|
} else { |
|
|
|
setModalRecord(null); |
|
|
|
} |
|
|
|
} |
|
|
|
const yilanModal = (type, record) => { |
|
|
|
setModalVisibleyilans(true); |
|
|
|
// setModalType(type);
|
|
|
|
if (type == 'edit') { |
|
|
|
setModalRecord(record); |
|
|
|
} else { |
|
|
|
setModalRecord(null); |
|
|
|
} |
|
|
|
} |
|
|
|
const columns = { |
|
|
|
tab1: [ |
|
|
|
{ |
|
|
|
title: '类型', |
|
|
|
dataIndex: 'placeName', |
|
|
@ -45,7 +77,7 @@ const hightModal = (type, record) => { |
|
|
|
setSitename(value.currentTarget.value) |
|
|
|
}, |
|
|
|
placeholder: '请输入类型进行搜索', |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
|
|
|
|
}, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.name |
|
|
@ -74,32 +106,219 @@ const hightModal = (type, record) => { |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div><Button type="link" |
|
|
|
onClick={() => { |
|
|
|
hightModal('edit', record) |
|
|
|
setTypecard('compile') |
|
|
|
setRecortd(record) |
|
|
|
}} |
|
|
|
onClick={() => { |
|
|
|
hightModal('edit', record) |
|
|
|
setTypecard('compile') |
|
|
|
setRecortd(record) |
|
|
|
}} |
|
|
|
>编辑</Button></div> |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
], tab2: [ |
|
|
|
{ |
|
|
|
title: '管养责单位', |
|
|
|
dataIndex: 'placeName', |
|
|
|
fixed: 'left', |
|
|
|
width: 120, |
|
|
|
options: 1, |
|
|
|
backgroundColor: "#ffffff", |
|
|
|
fieldProps: { |
|
|
|
onChange: (value, cs) => { |
|
|
|
setSitename(value.currentTarget.value) |
|
|
|
}, |
|
|
|
placeholder: '请输入项目名称进行搜索', |
|
|
|
|
|
|
|
}, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.entryName |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '养护单位', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time1', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
// fixed: 'left',
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.projectMileage |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '管理人员(人)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time2', |
|
|
|
valueType: 'dateRange', |
|
|
|
// align: 'right',
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.investment |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '工人(人)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time3', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.buildUnit |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '公益岗位(人)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time4', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.constructionControlUnit |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '县道(km)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time5', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.designUnit |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '乡道(km)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time6', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.constructionUnit |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '村道(km)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time7', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.supervisorAndSupervisor |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '桥梁(座)', |
|
|
|
search: false, |
|
|
|
dataIndex: 'time8', |
|
|
|
valueType: 'dateRange', |
|
|
|
|
|
|
|
|
|
|
|
width: 120, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.projectProgress |
|
|
|
}, |
|
|
|
fieldProps: { |
|
|
|
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'creatTime', |
|
|
|
valueType: 'dateTimeRange', |
|
|
|
hideInSearch: true, |
|
|
|
width: 160, |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div><Button type="link" |
|
|
|
onClick={() => { |
|
|
|
yilanModal('edit', record) |
|
|
|
setTypecard('compile') |
|
|
|
setRecortd(record) |
|
|
|
}} |
|
|
|
>编辑</Button><Popconfirm title='是否确认删除' onConfirm={() => { deldatas(record.id) }}> |
|
|
|
<Button type="link">删除</Button> |
|
|
|
</Popconfirm></div> |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: "direction", |
|
|
|
hideInTable: true, |
|
|
|
dataIndex: "direction", |
|
|
|
order: 6, |
|
|
|
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|
|
|
return ( |
|
|
|
<div> <Button |
|
|
|
type="primary" |
|
|
|
style={{ width: "100px" }} |
|
|
|
onClick={() => { |
|
|
|
yilanModal('edit', record) |
|
|
|
setTypecard('') |
|
|
|
}} |
|
|
|
> |
|
|
|
新增 |
|
|
|
</Button> |
|
|
|
{/* <Button |
|
|
|
type="primary" |
|
|
|
style={{ width: "100px", marginLeft: 20 }} |
|
|
|
|
|
|
|
> |
|
|
|
导入 |
|
|
|
</Button> */} |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<Spin spinning={false}> |
|
|
|
<div className='protable-transpor'> |
|
|
|
{/* <div className='protable-transpor'> |
|
|
|
<ProTable |
|
|
|
actionRef={ref} |
|
|
|
scroll={{ x: 800 }} |
|
|
|
options={false} |
|
|
|
form={{ |
|
|
|
submitter:false |
|
|
|
submitter: false |
|
|
|
}} |
|
|
|
// ref={c => { finishedProductTable = c; }}
|
|
|
|
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|
|
|
rowKey='id' |
|
|
|
onReset={(v) => { |
|
|
|
setSitename('') |
|
|
|
setSitename('') |
|
|
|
}} |
|
|
|
// rowSelection={{
|
|
|
|
// selectedRowKeys: rowSelected,
|
|
|
@ -109,10 +328,10 @@ const hightModal = (type, record) => { |
|
|
|
// }}
|
|
|
|
columns={columns} |
|
|
|
|
|
|
|
dataSource={counts || []} |
|
|
|
dataSource={counts || []} |
|
|
|
request={async (params) => { |
|
|
|
const query = { |
|
|
|
name:sitename |
|
|
|
name: sitename |
|
|
|
} |
|
|
|
setRowSelected([]); |
|
|
|
const res = await dispatch(getHighways(query)); |
|
|
@ -123,8 +342,99 @@ const hightModal = (type, record) => { |
|
|
|
} |
|
|
|
}} |
|
|
|
> |
|
|
|
</ProTable></div> |
|
|
|
{modalVisibleyilan ? <HightModal |
|
|
|
</ProTable></div> */} |
|
|
|
<div className='protable-transpor'> |
|
|
|
<ProTable |
|
|
|
actionRef={ref} |
|
|
|
toolbar={{ |
|
|
|
multipleLine: true, |
|
|
|
|
|
|
|
menu: { |
|
|
|
activeKey, |
|
|
|
onChange: (key) => setActiveKey(key), |
|
|
|
items: [ |
|
|
|
{ |
|
|
|
key: 'tab1', |
|
|
|
label: <span onClick={() => { |
|
|
|
setWhichofits('qiaoliang') |
|
|
|
setDifferentiate('bridge') |
|
|
|
}}>设施统计{activeKey === 'tab1'}</span>, |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: 'tab2', |
|
|
|
label: <span onClick={() => { |
|
|
|
setWhichofits('gongcheng') |
|
|
|
setDifferentiate('project') |
|
|
|
}}>管理养护{activeKey === 'tab2'}</span>, |
|
|
|
}, |
|
|
|
|
|
|
|
], |
|
|
|
}, |
|
|
|
}} |
|
|
|
form={{ |
|
|
|
submitter: whichofits == "qiaoliang" ? false : true |
|
|
|
}} |
|
|
|
scroll={{ x: 800 }} |
|
|
|
options={false} |
|
|
|
ref={c => { finishedProductTable = c; }} |
|
|
|
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|
|
|
rowKey='id' |
|
|
|
onReset={(v) => { |
|
|
|
setSitename('') |
|
|
|
}} |
|
|
|
// rowSelection={{
|
|
|
|
// selectedRowKeys: rowSelected,
|
|
|
|
// onChange: (selectedRowKeys) => {
|
|
|
|
// setRowSelected(selectedRowKeys);
|
|
|
|
// },
|
|
|
|
// }}
|
|
|
|
columns={columns[activeKey]} |
|
|
|
|
|
|
|
dataSource={counts || []} |
|
|
|
request={async (params) => { |
|
|
|
if (whichofits == 'qiaoliang') { |
|
|
|
const query = { |
|
|
|
name: sitename |
|
|
|
} |
|
|
|
setRowSelected([]); |
|
|
|
const res = await dispatch(getHighways(query)); |
|
|
|
setCounts(res.payload.data) |
|
|
|
return { |
|
|
|
...res, |
|
|
|
total: res.payload.data ? res.payload.data.count : 0 |
|
|
|
} |
|
|
|
} if (whichofits == 'gongcheng') { |
|
|
|
const query = { |
|
|
|
type: 'bridge', |
|
|
|
entryName: sitename |
|
|
|
} |
|
|
|
setRowSelected([]); |
|
|
|
const res = await dispatch(getProject(query)); |
|
|
|
setCounts("") |
|
|
|
return { |
|
|
|
...res, |
|
|
|
// total: res.payload.data ? res.payload.data.count : 0
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}} |
|
|
|
search={{ |
|
|
|
defaultCollapsed: false, |
|
|
|
optionRender: (searchConfig, formProps, dom) => [ |
|
|
|
...dom.reverse(), |
|
|
|
// whichofits == "qiaoliang" ? "" : <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, differentiate) }}>
|
|
|
|
// <Button
|
|
|
|
// >
|
|
|
|
// 导出
|
|
|
|
// </Button>
|
|
|
|
// </Popconfirm>
|
|
|
|
], |
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
</ProTable> |
|
|
|
</div> |
|
|
|
{modalVisibleyilan ? <HightModal |
|
|
|
visible={modalVisibleyilan} |
|
|
|
onVisibleChange={setModalVisibleyilan} |
|
|
|
modalRecord={modalRecord} |
|
|
@ -134,9 +444,33 @@ const hightModal = (type, record) => { |
|
|
|
setRecortd={setRecortd} |
|
|
|
setDelet={setDelet} |
|
|
|
/> : ''} |
|
|
|
{modalVisibleyilans ? <Guanli |
|
|
|
visible={modalVisibleyilans} |
|
|
|
onVisibleChange={setModalVisibleyilans} |
|
|
|
modalRecord={modalRecord} |
|
|
|
typecard={typecard} |
|
|
|
rewkeys={'guanli'} |
|
|
|
recortd={recortd} |
|
|
|
setRecortd={setRecortd} |
|
|
|
setDelet={setDelet} |
|
|
|
/> : ''} |
|
|
|
</Spin > |
|
|
|
) |
|
|
|
} |
|
|
|
const date = { |
|
|
|
"bridgeCode": "桥梁代码", |
|
|
|
"bridgeName": "桥梁名称", |
|
|
|
"centralStation": "中心桩号", |
|
|
|
"crossingFigureType": "跨越地物类型", |
|
|
|
"crossingFigureName": "跨越地物名称", |
|
|
|
"natureOfCharges": "收费性质", |
|
|
|
"rampCode": "匝道编码", |
|
|
|
"sectionType": "路段类型", |
|
|
|
"crossingFigureType1": "跨越地物类型1", |
|
|
|
"crossingFigureName1": "跨越地物名称1", |
|
|
|
"originalBridgeCode": "原桥梁代码", |
|
|
|
"whetherWideRoadAndNarrowBridge": "是否宽路窄桥", |
|
|
|
} |
|
|
|
function mapStateToProps(state) { |
|
|
|
const { auth, depMessage } = state; |
|
|
|
const pakData = (dep) => { |
|
|
|