From 3e3ad5f00e8cc8c646dd6c62c6c276a38033b0d7 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 4 Aug 2023 23:43:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E6=94=BF=E7=AE=A1=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B8=AE=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fillion/components/luzhengmodel.js | 101 ++++++++++++------ .../sections/fillion/containers/luzheng.js | 88 ++++++++------- 2 files changed, 116 insertions(+), 73 deletions(-) diff --git a/web/client/src/sections/fillion/components/luzhengmodel.js b/web/client/src/sections/fillion/components/luzhengmodel.js index 651c605e..d2410739 100644 --- a/web/client/src/sections/fillion/components/luzhengmodel.js +++ b/web/client/src/sections/fillion/components/luzhengmodel.js @@ -4,47 +4,78 @@ import { Form, Input, Select, DatePicker, InputNumber, Button, Modal } from 'ant import { unitList } from '../containers/assess' import { getAssess, delAssess, editAssess } from '../actions/assess'; import moment from 'moment'; -import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng'; -// import Uploads from "../../../../components/Upload/index" -// import Uploads from '../../../components/Upload/index' +import { getRoadadministration, addRoadadministration, delRoadadministration, modifyRoadadministration } from '../actions/luzheng'; +// import Uploads from "../../../../components/Upload/index" +// import Uploads from '../../../components/Upload/index' import Uploads from './uploads' const { Option } = Select; const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { const [form] = Form.useForm(); - console.log(editData,'editData') + // console.log(editData,'editData') return ( { + if (check) { + return onCancel() + } + form.validateFields().then(values => { + if (editData) { + dispatch(modifyRoadadministration(editData?.id, { + ...values + })).then(res => { + if (res.success) { + onCancel() + } + }) + } else { + dispatch(addRoadadministration({ + ...values, + })).then(res => { + if (res.success) { + onCancel() + } + }) + } + + }) + }}> + 确定 + , + + ] : null} onOk={() => { if (check) { return onCancel() } form.validateFields().then(values => { - if(editData){ - dispatch(modifyRoadadministration(editData?.id,{ + if (editData) { + dispatch(modifyRoadadministration(editData?.id, { ...values })).then(res => { if (res.success) { onCancel() } }) - }else{ + } else { dispatch(addRoadadministration({ ...values, })).then(res => { if (res.success) { onCancel() } - }) + }) } - + }) }} onCancel={() => { @@ -66,43 +97,43 @@ const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { }} > - {/* */} - + {/*  */} + - - + + - - + + - + ); }; -function mapStateToProps (state) { +function mapStateToProps(state) { const { auth, assess } = state return { user: auth.user, assess: assess.data || [] } } -export default connect(mapStateToProps)(LuzhengModel); +export default connect(mapStateToProps)(LuzhengModel); \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index d09f3825..b2ccd93a 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -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,13 +35,13 @@ 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(() => { - + return () => { }; }, []); @@ -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) @@ -65,14 +65,16 @@ function Assess(props) {
{ - - 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') + }) }}> - + - { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> + { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> @@ -90,40 +92,50 @@ 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 + {r?.roadname && r?.roadname?.length > 20 ? r?.roadname?.substr(0, 20) + '...' : r?.roadname} + + } }, { title: '执法成果', dataIndex: 'enforcementreslt', key: 'enforcementreslt', + render: (t, r) => { + return + {r?.enforcementreslt && r?.enforcementreslt?.length > 20 ? r?.enforcementreslt?.substr(0, 20) + '...' : r?.enforcementreslt} + + } }, { title: '执法图片', dataIndex: 'picfile', key: 'picfile', - render:(t,r)=>{ - if(r?.picfile && r?.picfile?.length!==0){ - return r?.picfile?.map(i=>{ - return - - - }) - }else{ - return '--' - } - - - - - - + render: (t, r) => { + if (r?.picfile && r?.picfile?.length !== 0) { + return r?.picfile?.map(i => { + return + + + }) + } else { + return '--' + } + + + + + + } }, { @@ -139,8 +151,8 @@ function Assess(props) { + + }} disabled={editAble}>编辑 { @@ -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 ? { + assessModalVisible ? { getData() setIsCheck(false) setEditData(null)