wenlele
12 months ago
8 changed files with 1450 additions and 555 deletions
File diff suppressed because it is too large
@ -0,0 +1,11 @@ |
|||||
|
alter table road_spot_check_preview |
||||
|
add abstract_finish boolean; |
||||
|
|
||||
|
comment on column road_spot_check_preview.abstract_finish is '是否全部抽取完'; |
||||
|
|
||||
|
|
||||
|
alter table road_spot_check_preview |
||||
|
add next_abstract jsonb; |
||||
|
|
||||
|
comment on column road_spot_check_preview.next_abstract is '下次必抽道路'; |
||||
|
|
@ -0,0 +1,315 @@ |
|||||
|
import { connect } from 'react-redux' |
||||
|
import React, { useEffect, useState } from 'react' |
||||
|
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Descriptions, Table } from 'antd' |
||||
|
import { roadSpotPrepare, getTown } from '../actions/spotCheck' |
||||
|
|
||||
|
import moment from 'moment' |
||||
|
import '../components/maintenanceTable.less' |
||||
|
|
||||
|
|
||||
|
|
||||
|
const SpotCheck = ({ dispatch, user, loading, reportDetail, editData, onCancel, road, onOk, town = [], viewDetails }) => { |
||||
|
|
||||
|
|
||||
|
const [countyRoadTime, setCountyRoadTime] = useState(true) |
||||
|
const [currentValue, setCurrentValue] = useState({}) |
||||
|
const [townDisabled, setTownDisabled] = useState({}) |
||||
|
const [dataList, setDataList] = useState([]) |
||||
|
|
||||
|
|
||||
|
|
||||
|
const [form] = Form.useForm() |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
useEffect(() => { |
||||
|
if (!viewDetails) { |
||||
|
|
||||
|
if (editData?.id) { |
||||
|
exhibition(editData) |
||||
|
setCurrentValue(editData) |
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
|
||||
|
let gather = [editData.gather['countyRoad']] |
||||
|
town.forEach(d => { |
||||
|
if (d.code != '360121205000') { |
||||
|
gather.push(editData.gather[d.code] || {}) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
setDataList(gather) |
||||
|
} |
||||
|
|
||||
|
}, []) |
||||
|
|
||||
|
|
||||
|
const exhibition = (show) => { |
||||
|
form.setFieldsValue({ |
||||
|
'countyPercentage': show?.countyPercentage, |
||||
|
'townPercentage': show?.countyPercentage == 50 ? 25 : 50, |
||||
|
'villagePercentage': show?.countyPercentage == 50 ? 10 : 20, |
||||
|
}) |
||||
|
|
||||
|
let disabled = {} |
||||
|
|
||||
|
for (let code in show.gather) { |
||||
|
if (code == 'countyRoad') { |
||||
|
setCountyRoadTime(false) |
||||
|
form.setFieldsValue({ |
||||
|
'countyPresent': show.gather[code]?.countyPresent?.toFixed(4) || 0, |
||||
|
'countyDifferenceValue': show.gather[code]?.countyDifferenceValue?.toFixed(4) || 0, |
||||
|
'drawPeople': show.gather[code]?.drawPeople, |
||||
|
'abstractTime': moment(show.gather[code]?.abstractTime), |
||||
|
}) |
||||
|
} else { |
||||
|
form.setFieldsValue({ |
||||
|
[code + 'townshipPresent']: show.gather[code]?.townshipPresent?.toFixed(4) || 0, |
||||
|
[code + 'townshipDifferenceValue']: show.gather[code]?.townshipDifferenceValue?.toFixed(4) || 0, |
||||
|
[code + 'villagePresent']: show.gather[code]?.villagePresent?.toFixed(4) || 0, |
||||
|
[code + 'villageDifferenceValue']: show.gather[code]?.villageDifferenceValue?.toFixed(4) || 0, |
||||
|
[code + 'drawPeople']: show.gather[code]?.drawPeople, |
||||
|
[code + 'abstractTime']: moment(show.gather[code]?.abstractTime), |
||||
|
}) |
||||
|
disabled[code] = true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
setTownDisabled(disabled) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
return ( |
||||
|
<Modal |
||||
|
visible={true} |
||||
|
title={viewDetails ? "抽查详情" : '养护抽查'} |
||||
|
width={1274} |
||||
|
footer={null} |
||||
|
onCancel={() => { |
||||
|
onCancel() |
||||
|
}} |
||||
|
onOk={() => { |
||||
|
|
||||
|
|
||||
|
}}> |
||||
|
{viewDetails ? <div style={{ width: "100%" }}> |
||||
|
<div style={{ textAlign: 'center', fontSize: 16 }}>南昌县农村公路养护管理暨用地范围内环境整治提升工程 考核汇总表</div> |
||||
|
<Table |
||||
|
// sticky
|
||||
|
scroll={{ |
||||
|
x: 2534, y: 600 |
||||
|
}} |
||||
|
pagination={false} |
||||
|
columns={[{ title: '责任单位', dataIndex: 'name', key: 'name', fixed: 'left', }, |
||||
|
{ |
||||
|
title: '县道', |
||||
|
children: [ |
||||
|
{ title: '总里程', dataIndex: 'county', key: 'county', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '纳入考核里程', dataIndex: 'countyParticipate', key: 'countyParticipate', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '本次考核里程', dataIndex: 'countyPresent', key: 'countyPresent', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '实际抽取比原计划多', dataIndex: 'countyDifferenceValue', key: 'countyDifferenceValue', render: (t, r) => t?.toFixed(4) }, |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
title: '乡道', |
||||
|
children: [ |
||||
|
{ title: '总里程', dataIndex: 'township', key: 'township', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '纳入考核里程', dataIndex: 'townshipParticipate', key: 'townshipParticipate', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '本次考核里程', dataIndex: 'townshipPresent', key: 'townshipPresent', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '实际抽取比原计划多', dataIndex: 'townshipDifferenceValue', key: 'townshipDifferenceValue', render: (t, r) => t?.toFixed(4) }, |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
title: '村道', |
||||
|
children: [ |
||||
|
{ title: '总里程', dataIndex: 'village', key: 'village', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '纳入考核里程', dataIndex: 'villageParticipate', key: 'villageParticipate', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '本次考核里程', dataIndex: 'villagePresent', key: 'villagePresent', render: (t, r) => t?.toFixed(4) }, |
||||
|
{ title: '实际抽取比原计划多', dataIndex: 'villageDifferenceValue', key: 'villageDifferenceValue', render: (t, r) => t?.toFixed(4) }, |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
title: '', |
||||
|
children: [ |
||||
|
{ title: '抽查人', dataIndex: 'drawPeople', key: 'drawPeople', }, |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
title: '', |
||||
|
children: [ |
||||
|
{ title: '抽查时间', dataIndex: 'abstractTime', key: 'abstractTime', width: 160, render: (t, r) => moment(t).format('YYYY-MM-DD HH:mm:ss') }, |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
title: '', |
||||
|
children: [ |
||||
|
{ |
||||
|
title: '操作', dataIndex: 'action', key: 'action', fixed: 'right', |
||||
|
render: (t, r) => { |
||||
|
let roadId = [] |
||||
|
if (r.name == '南昌县交通运输局') { |
||||
|
roadId = r.countyRoadId || [] |
||||
|
} else { |
||||
|
roadId = [...r.townRoadId, ...r.villageRoadId] |
||||
|
} |
||||
|
return <a href={`/_api/road/spot/export?token=${user?.token}&previewId=${editData.id}&roadId=${roadId.join()}`}> 导出</a> |
||||
|
} |
||||
|
}, |
||||
|
] |
||||
|
},]} |
||||
|
dataSource={dataList} |
||||
|
/> |
||||
|
</div> |
||||
|
: <Form |
||||
|
form={form} |
||||
|
onValuesChange={(changedValues, allValues) => { |
||||
|
|
||||
|
|
||||
|
|
||||
|
}}> |
||||
|
<div style={{ display: "flex" }} > |
||||
|
<Form.Item |
||||
|
label={'抽取县道比例(%)'} |
||||
|
name="countyPercentage" |
||||
|
rules={[ |
||||
|
{ required: true, message: '请选择抽取比例' }, |
||||
|
// {
|
||||
|
// pattern: /^(100|\d{1,2})(\.\d{1,2})?$/,
|
||||
|
// message: '请输入有效的比例',
|
||||
|
// },
|
||||
|
]} |
||||
|
> |
||||
|
<Select style={{ width: 150, marginRight: 20 }} placeholder="请选择抽取比例" options={[{ value: 50, label: '50%', }, { value: 75, label: '75%', }]} |
||||
|
onChange={v => { |
||||
|
// setShow(v)
|
||||
|
form.setFieldsValue({ |
||||
|
'townPercentage': v == 75 ? 50 : 25, |
||||
|
'villagePercentage': v == 75 ? 20 : 10, |
||||
|
}) |
||||
|
}} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label='抽查人' name='drawPeople' rules={[{ required: true, message: '请输入抽查人' },]}> |
||||
|
<Input placeholder="抽查人" style={{ width: 100, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item > |
||||
|
<Button disabled={!countyRoadTime} style={{ marginRight: 20 }} type='primary' onClick={() => { |
||||
|
form.validateFields(['countyPercentage', 'drawPeople']).then((values) => { |
||||
|
console.log(111, values); |
||||
|
dispatch(roadSpotPrepare({ |
||||
|
countyPercentage: values.countyPercentage, drawPeople: values.drawPeople, level: '县' |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
exhibition(res?.payload.data || {}) |
||||
|
setCurrentValue(res?.payload.data || {}) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}}>开始抽取</Button> |
||||
|
</Form.Item> |
||||
|
<Form.Item > |
||||
|
<Button disabled={countyRoadTime} style={{}} type='primary' > |
||||
|
<a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&roadId=${currentValue?.gather && currentValue?.gather['countyRoad']?.countyRoadId?.join()}`}> 导出</a> |
||||
|
</Button> |
||||
|
</Form.Item> |
||||
|
</div> |
||||
|
<div style={{ display: "flex" }}> |
||||
|
<Form.Item label='县道实际抽取(公里)' name='countyPresent'> |
||||
|
<Input disabled style={{ width: 100, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label='县道比计划多(公里)' name='countyDifferenceValue'> |
||||
|
<Input disabled style={{ width: 100, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name="abstractTime" label='抽取时间' > |
||||
|
<DatePicker disabled showTime format="YYYY-MM-DD HH:mm:ss" placeholder="" style={{ width: 174, }} /> |
||||
|
</Form.Item> |
||||
|
</div> |
||||
|
<div style={{ display: "flex", marginTop: 30, paddingLeft: 30 }}> |
||||
|
<Form.Item label={'抽取乡道比例(%)'} name="townPercentage" rules={[{ required: true, message: '请选择抽取比例' }]} |
||||
|
> |
||||
|
<Select disabled style={{ width: 150, marginRight: 20 }} placeholder="" options={[{ value: 25, label: '25%', }, { value: 50, label: '50%', }]} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item label={'抽取村道比例(%)'} name="villagePercentage" rules={[{ required: true, message: '请选择抽取比例' }]} |
||||
|
> |
||||
|
<Select disabled style={{ width: 150, marginRight: 20 }} placeholder="" options={[{ value: 10, label: '10%', }, { value: 20, label: '20%', }]} /> |
||||
|
</Form.Item> |
||||
|
</div> |
||||
|
<div style={{ display: "flex", marginBottom: 10 }}> |
||||
|
<div style={{ width: 66, marginLeft: 34 }}>责任单位</div> |
||||
|
<div style={{ width: 150 }}>乡道实际抽取(公里)</div> |
||||
|
<div style={{ width: 150 }}>乡道比计划多(公里)</div> |
||||
|
<div style={{ width: 150 }}>村道实际抽取(公里)</div> |
||||
|
<div style={{ width: 150 }}>村道比计划多(公里)</div> |
||||
|
<div style={{ width: 120 }}>抽查人</div> |
||||
|
<div style={{ width: 196 }}>抽查时间</div> |
||||
|
<div style={{ width: 100 }}>操作</div> |
||||
|
</div> |
||||
|
{town?.map(d => { |
||||
|
return <div style={{ display: "flex" }} > |
||||
|
<div style={{ width: 200, }}> |
||||
|
<Form.Item label={d.name} name={d.code + 'townshipPresent'} labelCol={{ span: 12, }} > |
||||
|
<Input disabled style={{ width: 130, }} /> |
||||
|
</Form.Item> |
||||
|
</div> |
||||
|
<Form.Item name={d.code + 'townshipDifferenceValue'}> |
||||
|
<Input disabled style={{ width: 130, marginRight: 20, marginLeft: 50 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name={d.code + 'villagePresent'}> |
||||
|
<Input disabled style={{ width: 130, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name={d.code + 'villageDifferenceValue'}> |
||||
|
<Input disabled style={{ width: 130, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name={d.code + 'drawPeople'} rules={[{ required: true, message: '请填写抽查人' }]}> |
||||
|
<Input placeholder="抽查人" style={{ width: 100, marginRight: 20 }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item name={d.code + 'abstractTime'} > |
||||
|
<DatePicker disabled showTime format="YYYY-MM-DD HH:mm:ss" placeholder="" style={{ width: 174, marginRight: 20, }} /> |
||||
|
</Form.Item> |
||||
|
<Form.Item > |
||||
|
<Button disabled={countyRoadTime ? true : townDisabled[d.code] ? true : false} style={{ marginRight: 20 }} type='primary' onClick={() => { |
||||
|
form.validateFields([d.code + 'drawPeople', 'countyPercentage']).then((values) => { |
||||
|
console.log(111, values); |
||||
|
dispatch(roadSpotPrepare({ |
||||
|
countyPercentage: values.countyPercentage, drawPeople: values[d.code + 'drawPeople'], code: d.code |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
exhibition(res?.payload.data || {}) |
||||
|
setCurrentValue(res?.payload.data || {}) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}}>开始抽取</Button> |
||||
|
</Form.Item> |
||||
|
<Form.Item > |
||||
|
<Button disabled={townDisabled[d.code] ? false : true} style={{}} type='primary'> |
||||
|
<a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&roadId=${currentValue?.gather |
||||
|
&& [...(currentValue?.gather[d.code]?.townRoadId || []), ...(currentValue?.gather[d.code]?.villageRoadId |
||||
|
|| [])].join()}`}> 导出</a>
|
||||
|
</Button> |
||||
|
</Form.Item> |
||||
|
</div> |
||||
|
}) |
||||
|
} |
||||
|
</Form> |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
</Modal > |
||||
|
|
||||
|
) |
||||
|
} |
||||
|
function mapStateToProps (state) { |
||||
|
const { auth, road, } = state |
||||
|
|
||||
|
return { |
||||
|
user: auth.user, |
||||
|
road: road?.data || [], |
||||
|
// town: town?.data || [],
|
||||
|
} |
||||
|
} |
||||
|
export default connect(mapStateToProps)(SpotCheck) |
Loading…
Reference in new issue