@ -1,21 +1,30 @@
import React , { useEffect , useState } from 'react' ;
import React , { useEffect , useState , useRef } from 'react' ;
import { connect } from 'react-redux' ;
import { connect } from 'react-redux' ;
import { Spin , Button , Popconfirm , Col , Input , Row } from 'antd' ;
import { Spin , Button , Popconfirm , Col , Input , Row } from 'antd' ;
import ProTable from '@ant-design/pro-table' ;
import ProTable from '@ant-design/pro-table' ;
import './protable.less'
import './protable.less'
import moment from 'moment' ;
import moment from 'moment' ;
import { getReportStatistic } from "../actions/infor"
import { getPurchase , delPurchase } from "../actions/infor"
import UserModal from './infor/details' ;
import UserModal from './infor/details' ;
const InForTable = ( props ) => {
const InForTable = ( props ) => {
const { dispatch , user , depData , depMessage , depLoading } = props
const { dispatch , user , depData , depMessage , depLoading } = props
const [ rowSelected , setRowSelected ] = useState ( [ ] )
const [ rowSelected , setRowSelected ] = useState ( [ ] )
const [ counts , setCounts ] = useState ( ) //shuju
const [ counts , setCounts ] = useState ( ) //shuju
const [ modalVisible , setModalVisible ] = useState ( false ) ;
const [ modalVisible , setModalVisible ] = useState ( false ) ;
const [ modalRecord , setModalRecord ] = useState ( ) ;
const [ modalRecord , setModalRecord ] = useState ( ) ;
const [ typecard , setTypecard ] = useState ( ) ;
const [ typecard , setTypecard ] = useState ( ) ;
const [ recortd , setRecortd ] = useState ( )
const [ monitor , setMonitor ] = useState ( )
const [ delet , setDelet ] = useState ( )
const [ nameOfInspectionPoint , setNameOfInspectionPoint ] = useState ( ) //检测点名称
const [ licensePlate , setLicensePlate ] = useState ( ) //车牌号
const [ numberOfAxles , setNumberOfAxles ] = useState ( ) //车轴数
const [ overrunRateUpper , setOverrunRateUpper ] = useState ( ) //超限率上限
const [ overrunRateFloor , setOverrunRateFloor ] = useState ( ) //超限率下限
const [ testTime , setTestTime ] = useState ( ) //超限率下限
const ref = useRef ( )
useEffect ( ( ) => { ref . current . reload ( ) } , [ monitor , delet , modalVisible ] )
//打开弹窗
//打开弹窗
const openModal = ( type , record ) => {
const openModal = ( type , record ) => {
setModalVisible ( true ) ;
setModalVisible ( true ) ;
@ -45,31 +54,52 @@ const InForTable = (props) => {
const columns =
const columns =
[
[
{
{
title : '检测点名称 ' ,
title : '区/县 ' ,
dataIndex : 'placeName' ,
dataIndex : 'placeName' ,
fixed : 'left' ,
fixed : 'left' ,
width : 120 ,
width : 120 ,
options : 1 ,
options : 1 ,
search : false ,
backgroundColor : "#ffffff" ,
backgroundColor : "#ffffff" ,
fieldProps : {
fieldProps : {
onChange : ( value , cs ) => {
setSitename ( value . currentTarget . value )
} ,
placeholder : '请输入检测点名称进行搜索' ,
placeholder : '请输入检测点名称进行搜索' ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
} ,
} ,
render : ( dom , record ) => {
return record . districtcounty
} ,
} ,
} ,
{
{
title : '车牌号' ,
title : '检测点名称 ' ,
// search: false,
// search: false,
dataIndex : 'containers1' ,
dataIndex : 'containers1' ,
fixed : 'left' ,
fixed : 'left' ,
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . nameOfInspectionPoint
} ,
fieldProps : {
onChange : ( value , cs ) => {
setNameOfInspectionPoint ( value . currentTarget . value )
} ,
placeholder : '请输入车牌号进行搜索' ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
}
} , {
title : '车牌号码' ,
// search: false,
dataIndex : 'containers444' ,
fixed : 'left' ,
width : 120 ,
render : ( dom , record ) => {
return record . licensePlate
} ,
} ,
fieldProps : {
fieldProps : {
onChange : ( value , cs ) => {
setLicensePlate ( value . currentTarget . value )
} ,
placeholder : '请输入车牌号进行搜索' ,
placeholder : '请输入车牌号进行搜索' ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
}
}
@ -80,9 +110,12 @@ const InForTable = (props) => {
dataIndex : 'containers2' ,
dataIndex : 'containers2' ,
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . addres s
return record . numberOfAxle s
} ,
} ,
fieldProps : {
fieldProps : {
onChange : ( value , cs ) => {
setNumberOfAxles ( value . currentTarget . value )
} ,
placeholder : '请输入车轴数进行搜索' ,
placeholder : '请输入车轴数进行搜索' ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
}
}
@ -95,20 +128,28 @@ const InForTable = (props) => {
//
//
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . overrunRate
} ,
fieldProps : {
placeholder : '请输入超限率进行搜索' ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
} ,
} ,
// fieldProps: {
// placeholder: '请输入超限率进行搜索',
// getPopupContainer: (triggerNode) => triggerNode.parentNode,
// },
renderFormItem : ( item , { type , defaultRender , formItemProps , fieldProps , ... rest } , form ) => {
renderFormItem : ( item , { type , defaultRender , formItemProps , fieldProps , ... rest } , form ) => {
return < Input . Group >
return < Input . Group >
< Row gutter = { 8 } >
< Row gutter = { 8 } >
< Col span = { 8 } >
< Col span = { 8 } >
< Input placeholder = '输入超限率' / >
< Input
onChange = { ( value ) => {
setOverrunRateUpper ( value . currentTarget . value )
} }
placeholder = '输入超限率上限' / >
< / C o l >
< / C o l >
< Col span = { 8 } >
< Col span = { 8 } >
< Input placeholder = '输入超限率' / >
< Input
onChange = { ( value ) => {
setOverrunRateFloor ( value . currentTarget . value )
} }
placeholder = '输入超限率下限' / >
< / C o l >
< / C o l >
< / R o w >
< / R o w >
< / I n p u t . G r o u p >
< / I n p u t . G r o u p >
@ -123,7 +164,7 @@ const InForTable = (props) => {
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . overrunWeight
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -137,7 +178,7 @@ const InForTable = (props) => {
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . grossVehicleWeight
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -151,7 +192,7 @@ const InForTable = (props) => {
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . vehicleCargoWeightLimit
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -164,9 +205,12 @@ const InForTable = (props) => {
valueType : 'dateTime' ,
valueType : 'dateTime' ,
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . testTime
} ,
} ,
fieldProps : {
fieldProps : {
onChange : ( value , cs ) => {
setTestTime ( cs )
} ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
}
}
} , {
} , {
@ -178,7 +222,7 @@ const InForTable = (props) => {
width : 120 ,
width : 120 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . nameOfBusinessOwner
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -193,7 +237,7 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . a ddress
return record . businessA ddress
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -208,7 +252,7 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . notifier
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -223,7 +267,7 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . notificationMethod
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -235,10 +279,10 @@ const InForTable = (props) => {
valueType : 'dateRange' ,
valueType : 'dateRange' ,
width : 1 40,
width : 2 40,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . addres s
return record . notificationResult s
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -253,7 +297,7 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . processingTime
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -268,7 +312,7 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . addres s
return record . deductPoint s
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -283,7 +327,23 @@ const InForTable = (props) => {
width : 140 ,
width : 140 ,
render : ( dom , record ) => {
render : ( dom , record ) => {
return record . address
return record . fine
} ,
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
}
} ,
{
title : '备注' ,
search : false ,
dataIndex : 'containers14' ,
valueType : 'dateRange' ,
width : 140 ,
render : ( dom , record ) => {
return record . remarks
} ,
} ,
fieldProps : {
fieldProps : {
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
getPopupContainer : ( triggerNode ) => triggerNode . parentNode ,
@ -301,9 +361,18 @@ const InForTable = (props) => {
onClick = { ( ) => {
onClick = { ( ) => {
openModal ( 'edit' , record )
openModal ( 'edit' , record )
setTypecard ( '111' )
setTypecard ( '111' )
setRecortd ( record )
} }
} }
> 编辑 < / B u t t o n > < B u t t o n t y p e = " l i n k " > 删 除 < / B u t t o n > < / d i v >
> 编辑 < / B u t t o n > < B u t t o n t y p e = " l i n k "
onClick = { ( ) => {
const query = {
overspeedId : record . id
}
dispatch ( delPurchase ( query ) ) . then ( ( res ) => {
setDelet ( res )
} )
} }
> 删除 < / B u t t o n > < / d i v >
}
}
} ,
} ,
@ -342,6 +411,7 @@ const InForTable = (props) => {
< Spin spinning = { false } >
< Spin spinning = { false } >
< div className = 'protable-transpor' >
< div className = 'protable-transpor' >
< ProTable
< ProTable
actionRef = { ref }
scroll = { { x : 800 } }
scroll = { { x : 800 } }
options = { false }
options = { false }
ref = { c => { finishedProductTable = c ; } }
ref = { c => { finishedProductTable = c ; } }
@ -355,20 +425,26 @@ const InForTable = (props) => {
} ,
} ,
} }
} }
columns = { columns }
columns = { columns }
dataSource = { counts || [ ] }
dataSource = { ( counts || { } ) . rows || [ ] }
onReset = { ( v ) => {
setNameOfInspectionPoint ( '' )
setLicensePlate ( '' )
setNumberOfAxles ( '' )
setOverrunRateUpper ( '' )
setOverrunRateFloor ( '' )
setTestTime ( '' )
} }
request = { async ( params ) => {
request = { async ( params ) => {
const query = {
const query = {
startDate : day [ 0 ] ,
nameOfInspectionPoint : nameOfInspectionPoint ,
endDate : day [ 1 ] ,
licensePlate : licensePlate ,
placeType : placeType ,
numberOfAxles : numberOfAxles ,
regionId : regionId ,
overrunRateUpper : overrunRateUpper ,
placeName : sitename ,
overrunRateFloor : overrunRateFloor ,
limit : params . pageSize ,
testTime : testTime
offset : ( ( params . current ? params . current : 1 ) - 1 ) * params . pageSize
}
}
setRowSelected ( [ ] ) ;
setRowSelected ( [ ] ) ;
const res = await dispatch ( getReportStatistic ( query ) ) ;
const res = await dispatch ( getPurchase ( query ) ) ;
setCounts ( res . payload . data )
setCounts ( res . payload . data )
return {
return {
... res ,
... res ,
@ -390,15 +466,41 @@ const InForTable = (props) => {
>
>
< / P r o T a b l e > < / d i v >
< / P r o T a b l e > < / d i v >
< UserModal
{ modalVisible ? < UserModal
visible = { modalVisible }
visible = { modalVisible }
onVisibleChange = { setModalVisible }
onVisibleChange = { setModalVisible }
modalRecord = { modalRecord }
modalRecord = { modalRecord }
typecard = { typecard }
typecard = { typecard }
/ >
rewkeys = { 'zhichao' }
data = { data }
recortd = { recortd }
setMonitor = { setMonitor }
// sitename={sitename}
setRecortd = { setRecortd }
/ > : ' ' }
< / S p i n >
< / S p i n >
)
)
}
}
const data = {
"districtcounty" : "区/县" ,
"nameOfInspectionPoint" : "检测点名称" ,
"licensePlate" : "车牌号码" ,
"numberOfAxles" : "车轴数" ,
"overrunRate" : "超限率" ,
"overrunWeight" : "超限重量" ,
"grossVehicleWeight" : "车货总重" ,
"vehicleCargoWeightLimit" : "车货限重" ,
"testTime" : "检测时间" ,
"nameOfBusinessOwner" : "经营业户名称" ,
"businessAddress" : "经营业户地址" ,
"notifier" : "通知人" ,
"notificationMethod" : "通知方式" ,
"notificationResults" : "通知结果" ,
"processingTime" : "处理时间" ,
"deductPoints" : "扣分" ,
"fine" : "罚款" ,
"remarks" : "备注"
}
function mapStateToProps ( state ) {
function mapStateToProps ( state ) {
const { auth , depMessage } = state ;
const { auth , depMessage } = state ;
const pakData = ( dep ) => {
const pakData = ( dep ) => {