|
|
@ -1,10 +1,10 @@ |
|
|
|
import React, { useState, useEffect } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
|
|
|
import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng'; |
|
|
|
import { getRoadadministration, addRoadadministration, delRoadadministration, modifyRoadadministration } from '../actions/luzheng'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
|
import AssessModal from '../components/luzhengmodel'; |
|
|
|
import { Form, Space, DatePicker, Button, Select, Popconfirm ,Image} from 'antd' |
|
|
|
import { Form, Space, DatePicker, Button, Select, Popconfirm, Image, Tooltip } from 'antd' |
|
|
|
import moment from 'moment'; |
|
|
|
import { values } from 'lodash'; |
|
|
|
|
|
|
@ -35,10 +35,10 @@ function Assess(props) { |
|
|
|
const [query, setQuery] = useState({ page: 1, pageSize: 10 }) |
|
|
|
const [loading, setLoading] = useState(false); |
|
|
|
const [isCheck, setIsCheck] = useState(false) |
|
|
|
const [datasource,setdatasource] = useState([]) |
|
|
|
const [datasource, setdatasource] = useState([]) |
|
|
|
const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31']); |
|
|
|
const { RangePicker } = DatePicker |
|
|
|
const [total,settotal]= useState(0) |
|
|
|
const [total, settotal] = useState(0) |
|
|
|
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
@ -51,9 +51,9 @@ function Assess(props) { |
|
|
|
|
|
|
|
const getData = () => { |
|
|
|
setLoading(true) |
|
|
|
console.log(query,'query') |
|
|
|
dispatch(getRoadadministration({...query})).then(res => { |
|
|
|
if(res?.success){ |
|
|
|
console.log(query, 'query') |
|
|
|
dispatch(getRoadadministration({ ...query })).then(res => { |
|
|
|
if (res?.success) { |
|
|
|
setdatasource(res?.payload?.data?.rows) |
|
|
|
settotal(res?.payload?.data?.count) |
|
|
|
setLoading(false) |
|
|
@ -66,13 +66,15 @@ function Assess(props) { |
|
|
|
<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}> |
|
|
|
<Form layout="inline" onFinish={(v) => { |
|
|
|
|
|
|
|
setQuery({ ...query, page:1,unit: v.unit,startTime : v?.time && moment(v?.time[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
endTime : v?.time && moment(v?.time[1]).add(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss') }) |
|
|
|
setQuery({ |
|
|
|
...query, page: 1, unit: v.unit, startTime: v?.time && moment(v?.time[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
endTime: v?.time && moment(v?.time[1]).add(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|
|
|
}) |
|
|
|
}}> |
|
|
|
|
|
|
|
|
|
|
|
<Form.Item name="time" label="执行日期"> |
|
|
|
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> |
|
|
|
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
<Form.Item> |
|
|
@ -90,34 +92,44 @@ function Assess(props) { |
|
|
|
title: '执法日期', |
|
|
|
dataIndex: 'enforcementdate', |
|
|
|
key: 'enforcementdate', |
|
|
|
render:(t,r)=>{ |
|
|
|
return r?.enforcementdate?moment(r?.enforcementdate).format('YYYY-MM-DD'):'--' |
|
|
|
render: (t, r) => { |
|
|
|
return r?.enforcementdate ? moment(r?.enforcementdate).format('YYYY-MM-DD') : '--' |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '执法道路', |
|
|
|
dataIndex: 'roadname', |
|
|
|
key: 'roadname' |
|
|
|
key: 'roadname', |
|
|
|
render: (t, r) => { |
|
|
|
return <Tooltip title={r?.roadname}> |
|
|
|
<span className='shenglve'>{r?.roadname && r?.roadname?.length > 20 ? r?.roadname?.substr(0, 20) + '...' : r?.roadname}</span> |
|
|
|
</Tooltip> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '执法成果', |
|
|
|
dataIndex: 'enforcementreslt', |
|
|
|
key: 'enforcementreslt', |
|
|
|
render: (t, r) => { |
|
|
|
return <Tooltip title={r?.enforcementreslt}> |
|
|
|
<span className='shenglve'>{r?.enforcementreslt && r?.enforcementreslt?.length > 20 ? r?.enforcementreslt?.substr(0, 20) + '...' : r?.enforcementreslt}</span> |
|
|
|
</Tooltip> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '执法图片', |
|
|
|
dataIndex: 'picfile', |
|
|
|
key: 'picfile', |
|
|
|
render:(t,r)=>{ |
|
|
|
if(r?.picfile && r?.picfile?.length!==0){ |
|
|
|
return r?.picfile?.map(i=>{ |
|
|
|
return <span style={{marginRight:10}}> |
|
|
|
<Image src={i?.url} width={80}/> |
|
|
|
</span> |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
return '--' |
|
|
|
} |
|
|
|
render: (t, r) => { |
|
|
|
if (r?.picfile && r?.picfile?.length !== 0) { |
|
|
|
return r?.picfile?.map(i => { |
|
|
|
return <span style={{ marginRight: 10 }}> |
|
|
|
<Image src={i?.url} width={80} /> |
|
|
|
</span> |
|
|
|
}) |
|
|
|
} else { |
|
|
|
return '--' |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -140,7 +152,7 @@ function Assess(props) { |
|
|
|
setAssessModalVisible(true) |
|
|
|
setEditData(record) |
|
|
|
|
|
|
|
}} disabled = { editAble }>编辑</Button> |
|
|
|
}} disabled={editAble}>编辑</Button> |
|
|
|
<Popconfirm |
|
|
|
title="确定删除此条数据吗?" |
|
|
|
onConfirm={() => { |
|
|
@ -148,8 +160,8 @@ function Assess(props) { |
|
|
|
dispatch(delRoadadministration(record.id)).then(res => { |
|
|
|
setLoading(false) |
|
|
|
if (res.success) { |
|
|
|
setQuery({...query, page: 1, pageSize: 10, limit: 10}) |
|
|
|
// getData(page)
|
|
|
|
setQuery({ ...query, page: 1, pageSize: 10, limit: 10 }) |
|
|
|
// getData(page)
|
|
|
|
} |
|
|
|
}) |
|
|
|
}} |
|
|
@ -167,7 +179,7 @@ function Assess(props) { |
|
|
|
defaultPageSize: 10, |
|
|
|
showSizeChanger: false, |
|
|
|
onChange: (page, pageSize) => { |
|
|
|
console.log(page,'page') |
|
|
|
console.log(page, 'page') |
|
|
|
setQuery({ |
|
|
|
...query, |
|
|
|
page, limit: pageSize |
|
|
@ -179,7 +191,7 @@ function Assess(props) { |
|
|
|
search={false} |
|
|
|
/> |
|
|
|
{ |
|
|
|
assessModalVisible ? <AssessModal check={isCheck} visible={assessModalVisible} editData={editData} onCancel={() => { |
|
|
|
assessModalVisible ? <AssessModal check={isCheck} visible={assessModalVisible} editData={editData} onCancel={() => { |
|
|
|
getData() |
|
|
|
setIsCheck(false) |
|
|
|
setEditData(null) |
|
|
|