From 4d93d90500295a34217ae731b5d95a7a24d6078d Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 14:29:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=8C=AA=E4=BD=8D?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schema/2.roadadministration.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{1.3.0/schema/6.roadadministration.sql => 1.3.1/schema/2.roadadministration.sql} (100%) diff --git a/scripts/1.3.0/schema/6.roadadministration.sql b/scripts/1.3.1/schema/2.roadadministration.sql similarity index 100% rename from scripts/1.3.0/schema/6.roadadministration.sql rename to scripts/1.3.1/schema/2.roadadministration.sql From 2b3c6215ada94fa6f4107792b6f8a8104373849a Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 15:52:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E6=94=BF?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/luzheng/index.js | 3 +- .../fillion/components/luzhengmodel.js | 41 ++++++++++------ .../sections/fillion/containers/luzheng.js | 47 ++++++++++++------- 3 files changed, 58 insertions(+), 33 deletions(-) diff --git a/api/app/lib/controllers/luzheng/index.js b/api/app/lib/controllers/luzheng/index.js index 6299fffe..3d2e6090 100644 --- a/api/app/lib/controllers/luzheng/index.js +++ b/api/app/lib/controllers/luzheng/index.js @@ -1,5 +1,6 @@ 'use strict' //查询路政 +const moment = require('moment'); async function getRoadadministration(ctx, next) { try { @@ -10,7 +11,7 @@ async function getRoadadministration(ctx, next) { if(startTime && endTime){ 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')] } } diff --git a/web/client/src/sections/fillion/components/luzhengmodel.js b/web/client/src/sections/fillion/components/luzhengmodel.js index 991c3d6c..57d96842 100644 --- a/web/client/src/sections/fillion/components/luzhengmodel.js +++ b/web/client/src/sections/fillion/components/luzhengmodel.js @@ -6,9 +6,11 @@ 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' + const { Option } = Select; -const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { +const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { const [form] = Form.useForm(); return ( @@ -24,15 +26,24 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { return onCancel() } form.validateFields().then(values => { - dispatch(editAssess({ - ...values, - month: moment(values.month).format('YYYY-MM-DD'), - assessId: editData ? editData.id : undefined - })).then(res => { - if (res.success) { - onCancel() - } - }) + if(editData){ + dispatch(modifyRoadadministration(editData?.id,{ + ...values + })).then(res => { + if (res.success) { + onCancel() + } + }) + }else{ + dispatch(addRoadadministration({ + ...values, + })).then(res => { + if (res.success) { + onCancel() + } + }) + } + }) }} onCancel={() => { @@ -43,7 +54,7 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { form={form} initialValues={editData ? { ...editData, - month: moment(editData.month), + enforcementdate: moment(editData.enforcementdate) } : {}} disabled={check} labelCol={{ @@ -73,11 +84,11 @@ const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { - {/* */} + /> @@ -91,4 +102,4 @@ function mapStateToProps (state) { assess: assess.data || [] } } -export default connect(mapStateToProps)(AssessModal); +export default connect(mapStateToProps)(LuzhengModel); diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index 918da324..584d558a 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/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 ProTable from '@ant-design/pro-table'; 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 { values } from 'lodash'; export const unitList = [ '县道', @@ -34,9 +35,12 @@ 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 [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 : '') useEffect(() => { - dispatch(getRoadadministration()).then(res=>{console.log(res,'res')}) + return () => { }; }, []); @@ -47,7 +51,10 @@ function Assess(props) { const getData = () => { setLoading(true) dispatch(getRoadadministration(query)).then(res => { - setLoading(false) + if(res?.success){ + setdatasource(res?.payload?.data?.rows) + setLoading(false) + } }) } @@ -55,20 +62,14 @@ function Assess(props) {
{ - 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') }) }}> - - - + - - + + { setDateRange(dateString) }} style={{ marginRight: '50px' }} /> @@ -86,6 +87,9 @@ function Assess(props) { title: '执法日期', dataIndex: 'enforcementdate', key: 'enforcementdate', + render:(t,r)=>{ + return r?.enforcementdate?moment(r?.enforcementdate).format('YYYY-MM-DD'):'--' + } }, { title: '执法道路', @@ -101,6 +105,15 @@ function Assess(props) { title: '执法图片', dataIndex: 'picfile', key: 'picfile', + render:(t,r)=>{ + return r?.picfile?.map(i=>{ + return + }) + + } }, { title: '操作', @@ -121,7 +134,7 @@ function Assess(props) { title="确定删除此条数据吗?" onConfirm={() => { setLoading(true) - dispatch(delAssess({ id: record.id })).then(res => { + dispatch(delRoadadministration(record.id)).then(res => { setLoading(false) if (res.success) { getData() @@ -134,7 +147,7 @@ function Assess(props) { ), },]} - dataSource={assess.rows || []} + dataSource={datasource || []} loading={loading} pagination={{ total: assess?.count || 0,