巴林闲侠 1 year ago
parent
commit
11c4e2d2e4
  1. 3
      api/app/lib/controllers/luzheng/index.js
  2. 41
      web/client/src/sections/fillion/components/luzhengmodel.js
  3. 15
      web/client/src/sections/fillion/components/patrolTable.js
  4. 47
      web/client/src/sections/fillion/containers/luzheng.js

3
api/app/lib/controllers/luzheng/index.js

@ -1,5 +1,6 @@
'use strict' 'use strict'
//查询路政 //查询路政
const moment = require('moment');
async function getRoadadministration(ctx, next) { async function getRoadadministration(ctx, next) {
try { try {
@ -10,7 +11,7 @@ async function getRoadadministration(ctx, next) {
if(startTime && endTime){ if(startTime && endTime){
where.enforcementdate = { where.enforcementdate = {
where: { enforcementdate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')]
} }
} }

41
web/client/src/sections/fillion/components/luzhengmodel.js

@ -6,9 +6,11 @@ import { getAssess, delAssess, editAssess } from '../actions/assess';
import moment from 'moment'; import moment from 'moment';
import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng'; import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng';
// import Uploads from "../../../../components/Upload/index" // import Uploads from "../../../../components/Upload/index"
import Uploads from '../../../components/Upload/index'
const { Option } = Select; const { Option } = Select;
const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
return ( return (
@ -24,15 +26,24 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => {
return onCancel() return onCancel()
} }
form.validateFields().then(values => { form.validateFields().then(values => {
dispatch(editAssess({ if(editData){
...values, dispatch(modifyRoadadministration(editData?.id,{
month: moment(values.month).format('YYYY-MM-DD'), ...values
assessId: editData ? editData.id : undefined })).then(res => {
})).then(res => { if (res.success) {
if (res.success) { onCancel()
onCancel() }
} })
}) }else{
dispatch(addRoadadministration({
...values,
})).then(res => {
if (res.success) {
onCancel()
}
})
}
}) })
}} }}
onCancel={() => { onCancel={() => {
@ -43,7 +54,7 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => {
form={form} form={form}
initialValues={editData ? { initialValues={editData ? {
...editData, ...editData,
month: moment(editData.month), enforcementdate: moment(editData.enforcementdate)
} : {}} } : {}}
disabled={check} disabled={check}
labelCol={{ labelCol={{
@ -73,11 +84,11 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => {
</Form.Item> </Form.Item>
<Form.Item name="picfile" label="执法图片"> <Form.Item name="picfile" label="执法图片">
{/* <Uploads <Uploads
maxFilesNum={1} maxFilesNum={1}
fileTypes={['mp4']} fileTypes={['png','jpg','jpeg']}
maxFileSize={200} maxFileSize={200}
/> */} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
@ -91,4 +102,4 @@ function mapStateToProps (state) {
assess: assess.data || [] assess: assess.data || []
} }
} }
export default connect(mapStateToProps)(AssessModal); export default connect(mapStateToProps)(LuzhengModel);

15
web/client/src/sections/fillion/components/patrolTable.js

@ -95,7 +95,6 @@ const DetailForm = (props) => {
]; ];
const changeBoolean = (bool) => { const changeBoolean = (bool) => {
//console.log('bool', bool)
return bool ? '无异常' : '有异常' return bool ? '无异常' : '有异常'
} }
const renderContent = (data) => { const renderContent = (data) => {
@ -616,7 +615,6 @@ const PatrolNameList = (props) => {
} }
} }
// console.log('selectedKeys', selectedKeys, selected, selectedNodes, node)
}; };
@ -816,14 +814,12 @@ const PatrolTable = (props) => {
} }
} }
useEffect(() => { useEffect(() => {
console.log(anspectionNotificationPhoneList, '数据');
let phoneList = [] let phoneList = []
if (anspectionNotificationPhoneList && anspectionNotificationPhoneList.length) { if (anspectionNotificationPhoneList && anspectionNotificationPhoneList.length) {
phoneList = anspectionNotificationPhoneList.map(e => { phoneList = anspectionNotificationPhoneList.map(e => {
return e.phone return e.phone
}) })
} }
console.log(phoneList, '789789789789');
setPhoneList(phoneList) setPhoneList(phoneList)
}, [anspectionNotificationPhoneList]) }, [anspectionNotificationPhoneList])
@ -834,7 +830,6 @@ const PatrolTable = (props) => {
const handleOk = () => { const handleOk = () => {
// setIsModalOpen(false); // setIsModalOpen(false);
form.validateFields().then(values => { form.validateFields().then(values => {
console.log(values, '----------');
dispatch(addAnspectionNotificationPhone(values)).then(res => { dispatch(addAnspectionNotificationPhone(values)).then(res => {
if (res.success) { if (res.success) {
setIsModalOpen(false); setIsModalOpen(false);
@ -864,7 +859,10 @@ const PatrolTable = (props) => {
sm: { span: 20, offset: 4 }, sm: { span: 20, offset: 4 },
}, },
}; };
let routerUrl = window.location.href
routerUrl = routerUrl.substring(routerUrl.length - 14)
console.log(routerUrl, '=========');
return ( return (
<div className='card-protable'> <div className='card-protable'>
<Card > <Card >
@ -910,7 +908,10 @@ const PatrolTable = (props) => {
: '' : ''
} }
<Button style={{ marginLeft: 20 }}>查询</Button> <Button style={{ marginLeft: 20 }}>查询</Button>
<Button onClick={() => { showModal() }} style={{ float: 'right', marginRight: 30 }}> 短信提醒</Button> {
routerUrl == 'patrol_anomaly' ? <Button onClick={() => { showModal() }} style={{ float: 'right', marginRight: 30 }}> 短信提醒</Button> : ''
}
{/* <Button style={{ marginLeft: 20 }} onClick={handleExport} >导出</Button> */} {/* <Button style={{ marginLeft: 20 }} onClick={handleExport} >导出</Button> */}
</div> : '' </div> : ''
@ -926,7 +927,7 @@ const PatrolTable = (props) => {
</Card> </Card>
<Modal title="短信提醒" maskClosable={false} destroyOnClose={true} visible={isModalOpen} onOk={handleOk} onCancel={handleCancel}> <Modal title="短信提醒" maskClosable={false} destroyOnClose={true} visible={isModalOpen} onOk={handleOk} onCancel={handleCancel}>
<Form form={form} name="dynamic_form_item" {...formItemLayoutWithOutLabel} > <Form form={form} name="dynamic_form_item" {...formItemLayoutWithOutLabel} >
<Form.List <Form.List
name="phone" name="phone"
initialValue={phoneList} initialValue={phoneList}
> >

47
web/client/src/sections/fillion/containers/luzheng.js

@ -4,8 +4,9 @@ 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 ProTable from '@ant-design/pro-table';
import AssessModal from '../components/luzhengmodel'; import AssessModal from '../components/luzhengmodel';
import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' import { Form, Space, DatePicker, Button, Select, Popconfirm ,Image} from 'antd'
import moment from 'moment'; import moment from 'moment';
import { values } from 'lodash';
export const unitList = [ export const unitList = [
'县道', '县道',
@ -34,9 +35,12 @@ function Assess(props) {
const [query, setQuery] = useState({ page: 1, pageSize: 10 }) const [query, setQuery] = useState({ page: 1, pageSize: 10 })
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [isCheck, setIsCheck] = useState(false) const [isCheck, setIsCheck] = useState(false)
const [datasource,setdatasource] = useState([])
const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31']);
const { RangePicker } = DatePicker
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '')
useEffect(() => { useEffect(() => {
dispatch(getRoadadministration()).then(res=>{console.log(res,'res')})
return () => { }; return () => { };
}, []); }, []);
@ -47,7 +51,10 @@ function Assess(props) {
const getData = () => { const getData = () => {
setLoading(true) setLoading(true)
dispatch(getRoadadministration(query)).then(res => { dispatch(getRoadadministration(query)).then(res => {
setLoading(false) if(res?.success){
setdatasource(res?.payload?.data?.rows)
setLoading(false)
}
}) })
} }
@ -55,20 +62,14 @@ function Assess(props) {
<div> <div>
<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}> <div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}>
<Form layout="inline" onFinish={(v) => { <Form layout="inline" onFinish={(v) => {
setQuery({ ...query, unit: v.unit, month: v.month ? moment(v.month).format() : undefined })
setQuery({ ...query, unit: v.unit,startTime : moment(v?.time[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
endTime :moment(v?.time[1]).add(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss') })
}}> }}>
<Form.Item name="unit" label="责任单位" >
<Select style={{ width: 200 }} placeholder="全部" allowClear>
{
unitList.map(item => (
<Option value={item} key={item} />
))
}
</Select>
</Form.Item>
<Form.Item name="month" label="考核月份"> <Form.Item name="time" label="执行日期">
<DatePicker picker="month" style={{ width: 200 }} /> <RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} style={{ marginRight: '50px' }} />
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
@ -86,6 +87,9 @@ function Assess(props) {
title: '执法日期', title: '执法日期',
dataIndex: 'enforcementdate', dataIndex: 'enforcementdate',
key: 'enforcementdate', key: 'enforcementdate',
render:(t,r)=>{
return r?.enforcementdate?moment(r?.enforcementdate).format('YYYY-MM-DD'):'--'
}
}, },
{ {
title: '执法道路', title: '执法道路',
@ -101,6 +105,15 @@ function Assess(props) {
title: '执法图片', title: '执法图片',
dataIndex: 'picfile', dataIndex: 'picfile',
key: 'picfile', key: 'picfile',
render:(t,r)=>{
return r?.picfile?.map(i=>{
return <Image
width={200}
src={i?.storageUrl}
/>
})
}
}, },
{ {
title: '操作', title: '操作',
@ -121,7 +134,7 @@ function Assess(props) {
title="确定删除此条数据吗?" title="确定删除此条数据吗?"
onConfirm={() => { onConfirm={() => {
setLoading(true) setLoading(true)
dispatch(delAssess({ id: record.id })).then(res => { dispatch(delRoadadministration(record.id)).then(res => {
setLoading(false) setLoading(false)
if (res.success) { if (res.success) {
getData() getData()
@ -134,7 +147,7 @@ function Assess(props) {
</span> </span>
), ),
},]} },]}
dataSource={assess.rows || []} dataSource={datasource || []}
loading={loading} loading={loading}
pagination={{ pagination={{
total: assess?.count || 0, total: assess?.count || 0,

Loading…
Cancel
Save