From a49b7a0b1d7289da46d06eb30bac30bba18d3d75 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 17:31:57 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E6=94=BF?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fillion/components/luzhengmodel.js | 14 +- .../sections/fillion/components/uploads.js | 328 ++++++++++++++++++ .../sections/fillion/containers/luzheng.js | 21 +- 3 files changed, 349 insertions(+), 14 deletions(-) create mode 100644 web/client/src/sections/fillion/components/uploads.js diff --git a/web/client/src/sections/fillion/components/luzhengmodel.js b/web/client/src/sections/fillion/components/luzhengmodel.js index 57d96842..eaf98008 100644 --- a/web/client/src/sections/fillion/components/luzhengmodel.js +++ b/web/client/src/sections/fillion/components/luzhengmodel.js @@ -6,13 +6,13 @@ 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 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') return ( { - + - + diff --git a/web/client/src/sections/fillion/components/uploads.js b/web/client/src/sections/fillion/components/uploads.js new file mode 100644 index 00000000..09226232 --- /dev/null +++ b/web/client/src/sections/fillion/components/uploads.js @@ -0,0 +1,328 @@ +'use strict'; + +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import { Spin, Upload, message, Modal, Card, Button } from 'antd'; +import moment from 'moment'; +import { PlusOutlined, UploadOutlined, CloseOutlined } from '@ant-design/icons'; + +class Uploads extends Component { + constructor(props) { + super(props); + this.ApiRoot = localStorage.getItem('tyApiRoot') + this.state = { + fileUploading: false, + fileList: [], + curPreviewPic: '', + delPicIng: false, + removeFilesList: [] + }; + } + + dealName = (uploaded) => { + console.log(uploaded) + let realName = uploaded.split('/')[2] + let x1 = realName.split('.') + let x2 = x1[0].split('_') + let showName = `${x2[0]}.${x1[1]}` + return showName + } + + setFileList = (value) => { + console.log(value,'value') + let defaultFileList = []; + defaultFileList = value.map((u, index) => { + let fileUrl = `${u.url}`; + return { + uid: -index - 1, + name: this.dealName(u.url), + status: 'done', + storageUrl: u.url, + url: fileUrl + }; + }); + // onChange(defaultFileList) + this.setState({ + fileList: defaultFileList + }); + }; + + componentDidMount () { + const { value } = this.props; + if (value) { + this.setFileList(value); + } + } + + componentWillReceiveProps (np) { + const { dispatch, value: thisEditData, onChange } = this.props; + const { value: nextEditData, clearFileList } = np; + console.log(np,'npp') + const setFileList = () => { + let defaultFileList = []; + defaultFileList = nextEditData.map((u, index) => { + let fileUrl = `${u.storageUrl}`; + return { + uid: -index - 1, + name: this.dealName(u.storageUrl), + status: 'done', + storageUrl: u.storageUrl, + url: fileUrl, + size: u.size || -1 + }; + }); + this.setState({ + fileList: defaultFileList + }); + }; + + if (nextEditData && nextEditData.length) { + if (!thisEditData || !this.state.fileList.length) { + setFileList(); + } else if (nextEditData.length != thisEditData.length) { + setFileList(); + } else { + let repeat = true; + for (let i = 0; i < thisEditData.length; i++) { + if (thisEditData[i] != nextEditData[i]) { + repeat = false; + break; + } + } + if (!repeat) { + setFileList(); + } + } + } + + + if (clearFileList) { + this.setState({ + fileList: [] + }); + } + + + // else{ + // this.setState({ + // fileList:[], + // }) + // } + } + + render () { + const UploadPath = { + project: ['txt', 'dwg', 'doc', 'docx', 'xls', 'xlsx', 'pdf', 'png', 'jpg', 'rar', 'zip'], + report: ['doc', 'docx', 'xls', 'xlsx', 'pdf'], + data: ['txt', 'xls', 'xlsx'], + image: ['png', 'jpg', 'svg', 'jpeg'], + three: ['js'], + video: ['mp4'] + }; + /** + * uploadType 【string】 主要区别文件上传路径 以及类型 以 web/routes/attachment/index.js 中 UploadPath 的 key 值为准;默认 project; + * disabled 【boolean】 上传是否可用 + * maxFilesNum 【number】 最大上传数量 + * fileTypes 【array[string]】 可允许上传的文件类型; + * maxFileSize 【number】 单个文件最大大小 M + * listType 【antd】 upload 组件的属性 + * onChange 【function】 文件数量变化时候回调 返回文件 + * value 【array[obj]】 编辑数据 [{url:'xxx', [size:999]}] + * onStateChange 【function】 文件状态改变回调函数 上传中 return { uploading:true/false } + */ + const { + uploadType, + disabled, + maxFilesNum, + fileTypes, + maxFileSize, + listType, + onChange, + value, + showUploadList, + onStateChange + } = this.props; + const { fileList, curPreviewPic, delPicIng, removeFilesList } = this.state; + const that = this; + let uploadType_ = uploadType || 'project'; + let maxFilesNum_ = maxFilesNum || 1; + let defaultFileTypes = fileTypes || UploadPath[uploadType_]; + const uploadProps = { + name: 'checkFile_', + multiple: false, + showUploadList: showUploadList || true, + action: `attachments/${uploadType_}`, + listType: listType || 'text', + disabled: disabled, + beforeUpload: (file) => { + if (fileList.length >= maxFilesNum_) { + message.warning(`最多选择${maxFilesNum_}个文件上传`); + return false; + } + if (file.name.length > 60) { + message.warning(`文件名过长(大于60字符),请修改后上传`); + return false; + } + const extNames = file.name.split('.'); + var reg = /^[\.\s\u4e00-\u9fa5a-zA-Z0-9_-]{0,}$/; + if (!reg.exec(file.name)) { + message.warning(`文件名包含除字母、汉字、数字、中划线、下划线之外的字符,请修改后上传`); + return false; + } + let isDAE = false; + if (extNames.length > 0) { + let fileType = extNames[extNames.length - 1].toLowerCase(); + isDAE = defaultFileTypes.some((f) => f == fileType); + } + if (!isDAE) { + message.error(`只能上传 ${defaultFileTypes.join()} 格式的文件!`); + return false; + } + const isLt = file.size / 1024 / 1024 < (maxFileSize || 3); + if (!isLt) { + message.error(`文件必须小于${maxFileSize || 3}MB!`); + return false; + } + this.setState({ + fileUploading: true + }); + if (onStateChange) { + onStateChange({ uploading: true }); + } + }, + onChange (info) { + const status = info.file.status; + if (status === 'uploading') { + that.setState({ + fileList: info.fileList + }); + } + if (status === 'done') { + let { uploaded, url } = info.file.response; + let size = info.file.size; + let nextFileList = fileList; + nextFileList[nextFileList.length - 1] = { + uid: -moment().unix(), + name: that.dealName(uploaded), + status: 'done', + storageUrl: uploaded, + url: url, + size: size + }; + onChange(nextFileList); + that.setState({ + fileUploading: false, + fileList: nextFileList + }); + if (onStateChange) { + onStateChange({ uploading: false }); + } + } else if (status === 'error') { + that.setState({ + fileUploading: false + }); + message.error(`${info.file.name} 上传失败,请重试`); + if (onStateChange) { + onStateChange({ uploading: false }); + } + } + }, + onRemove (file) { + let nextFileList = []; + fileList.map((f, i) => { + if (f.uid != file.uid) { + nextFileList.push(f); + } + }); + let nextRemoveFiles = removeFilesList.concat([file.storageUrl]); + if (curPreviewPic == file.url) { + that.setState({ + curPreviewPic: '' + }); + } + onChange(nextFileList); + that.setState({ + fileList: nextFileList, + removeFilesList: nextRemoveFiles + }); + }, + onPreview (file) { + console.log(file,'file') + let filePostfix = file.url.split('.').pop(); + filePostfix = filePostfix.toLowerCase(); + if (UploadPath.image.some((img) => img == filePostfix)) { + that.setState({ + curPreviewPic: file.url + }); + } else { + message.warn('仅支持图片预览'); + } + } + }; + + let fileList_ = fileList + // .map(f => { + // if (f.storageUrl) { + // let realName = f.storageUrl.split('/').pop() + // if (f.name != realName) { + // f.name = realName + // } + // } + // return f + // }) + console.log('fileList_:', fileList_); + return ( +
+ + + { + disabled ? ( + '' + ) : + listType == 'picture-card' ? + ( + fileList.length >= maxFilesNum_ ? null : ( +
+ +
上传图片
+
+ ) + ) : ( + + ) + } +
+ { + curPreviewPic ? ( + +
+ 文件预览 + { this.setState({ curPreviewPic: '' }); }} + > + + +
+ +
+ ) : '' + } +
+
+ ); + } +} + +function mapStateToProps (state) { + const { auth } = state + return { + user: auth.user + }; +} + +export default connect(mapStateToProps)(Uploads); diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index 584d558a..f158e243 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -106,12 +106,17 @@ function Assess(props) { dataIndex: 'picfile', key: 'picfile', render:(t,r)=>{ - return r?.picfile?.map(i=>{ - return + + + return r?.picfile?.map(i=>{ + return + + }) + + + + } }, @@ -128,8 +133,8 @@ function Assess(props) { + + }} disabled = { editAble }>编辑 { @@ -166,7 +171,7 @@ function Assess(props) { search={false} /> { - assessModalVisible ? { + assessModalVisible && editData ? { getData() setIsCheck(false) setEditData(null) From 00dd0ed88f8bcc1cb3263921b007fd40080c7962 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 17:33:40 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E6=94=BF?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/components/luzhengmodel.js | 1 - web/client/src/sections/fillion/components/uploads.js | 1 + web/client/src/sections/fillion/containers/luzheng.js | 2 -- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/web/client/src/sections/fillion/components/luzhengmodel.js b/web/client/src/sections/fillion/components/luzhengmodel.js index eaf98008..72cabb2b 100644 --- a/web/client/src/sections/fillion/components/luzhengmodel.js +++ b/web/client/src/sections/fillion/components/luzhengmodel.js @@ -82,7 +82,6 @@ const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { - { // if (f.storageUrl) { // let realName = f.storageUrl.split('/').pop() diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index f158e243..780b1257 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -106,8 +106,6 @@ function Assess(props) { dataIndex: 'picfile', key: 'picfile', render:(t,r)=>{ - - return r?.picfile?.map(i=>{ return From 3597e00fed80ac376c0e27c68b4efbf26c2da22a Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 17:36:38 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/containers/luzheng.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index 780b1257..7faf9b13 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -169,7 +169,7 @@ function Assess(props) { search={false} /> { - assessModalVisible && editData ? { + assessModalVisible ? { getData() setIsCheck(false) setEditData(null) From e0b36b3436f22f891c841d3b2527ef5f5784336f Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 17:44:00 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/fillion/components/luzhengmodel.js | 1 + web/client/src/sections/fillion/components/uploads.js | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/web/client/src/sections/fillion/components/luzhengmodel.js b/web/client/src/sections/fillion/components/luzhengmodel.js index 72cabb2b..292e87a2 100644 --- a/web/client/src/sections/fillion/components/luzhengmodel.js +++ b/web/client/src/sections/fillion/components/luzhengmodel.js @@ -89,6 +89,7 @@ const LuzhengModel = ({ editData, check, visible, onCancel, dispatch }) => { maxFileSize={200} fileList={editData?.picfile} listType ={'picture-card'} + isedit={editData?true:false} /> diff --git a/web/client/src/sections/fillion/components/uploads.js b/web/client/src/sections/fillion/components/uploads.js index 50686cf4..782fc311 100644 --- a/web/client/src/sections/fillion/components/uploads.js +++ b/web/client/src/sections/fillion/components/uploads.js @@ -18,7 +18,7 @@ class Uploads extends Component { removeFilesList: [] }; } - + dealName = (uploaded) => { console.log(uploaded) let realName = uploaded.split('/')[2] @@ -29,7 +29,6 @@ class Uploads extends Component { } setFileList = (value) => { - console.log(value,'value') let defaultFileList = []; defaultFileList = value.map((u, index) => { let fileUrl = `${u.url}`; @@ -57,11 +56,11 @@ class Uploads extends Component { componentWillReceiveProps (np) { const { dispatch, value: thisEditData, onChange } = this.props; const { value: nextEditData, clearFileList } = np; - console.log(np,'npp') + const setFileList = () => { let defaultFileList = []; defaultFileList = nextEditData.map((u, index) => { - let fileUrl = `${u.storageUrl}`; + let fileUrl = `${this.ApiRoot}/${u.storageUrl}`; return { uid: -index - 1, name: this.dealName(u.storageUrl), @@ -151,7 +150,7 @@ class Uploads extends Component { name: 'checkFile_', multiple: false, showUploadList: showUploadList || true, - action: `attachments/${uploadType_}`, + action: `${this.ApiRoot}/attachments/${uploadType_}`, listType: listType || 'text', disabled: disabled, beforeUpload: (file) => { @@ -247,7 +246,6 @@ class Uploads extends Component { }); }, onPreview (file) { - console.log(file,'file') let filePostfix = file.url.split('.').pop(); filePostfix = filePostfix.toLowerCase(); if (UploadPath.image.some((img) => img == filePostfix)) { @@ -261,7 +259,6 @@ class Uploads extends Component { }; let fileList_ = fileList - // .map(f => { // if (f.storageUrl) { // let realName = f.storageUrl.split('/').pop() From 51cfccbaf8d5a4f3f08177281783293b26d62459 Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 17:50:42 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/fillion/containers/luzheng.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index 7faf9b13..5158c3e7 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -106,11 +106,16 @@ function Assess(props) { dataIndex: 'picfile', key: 'picfile', render:(t,r)=>{ - return r?.picfile?.map(i=>{ - return - - - }) + if(r?.picfile){ + return r?.picfile?.map(i=>{ + return + + + }) + }else{ + return '--' + } + From cd731a579a7edbb0cf040182d2e1f5269d39545a Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 18:00:30 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=B7=AF=E6=94=BF?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/containers/luzheng.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index 5158c3e7..b2153fac 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -38,6 +38,7 @@ function Assess(props) { const [datasource,setdatasource] = useState([]) const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31']); const { RangePicker } = DatePicker + const [total,settotal]= useState(0) const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') useEffect(() => { @@ -53,6 +54,7 @@ function Assess(props) { dispatch(getRoadadministration(query)).then(res => { if(res?.success){ setdatasource(res?.payload?.data?.rows) + settotal(res?.payload?.data?.count) setLoading(false) } }) @@ -63,8 +65,8 @@ function Assess(props) {
{ - 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') }) + 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') }) }}> @@ -158,7 +160,7 @@ function Assess(props) { dataSource={datasource || []} loading={loading} pagination={{ - total: assess?.count || 0, + total: total || 0, pageSize: 10, defaultPageSize: 10, showSizeChanger: false, From d5cbc15662852a59d137f03eb53e47cd2932435c Mon Sep 17 00:00:00 2001 From: dengyinhuan Date: Fri, 4 Aug 2023 18:03:09 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E5=B1=95=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/fillion/containers/luzheng.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/fillion/containers/luzheng.js b/web/client/src/sections/fillion/containers/luzheng.js index b2153fac..57cba564 100644 --- a/web/client/src/sections/fillion/containers/luzheng.js +++ b/web/client/src/sections/fillion/containers/luzheng.js @@ -108,7 +108,7 @@ function Assess(props) { dataIndex: 'picfile', key: 'picfile', render:(t,r)=>{ - if(r?.picfile){ + if(r?.picfile && r?.picfile?.length!==0){ return r?.picfile?.map(i=>{ return From 55c778674bf7389d9124e5a910216f0e19bdc754 Mon Sep 17 00:00:00 2001 From: wenlele Date: Fri, 4 Aug 2023 19:25:34 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E9=81=93=E8=B7=AF=E9=9A=90=E6=82=A3?= =?UTF-8?q?=E6=8E=92=E6=9F=A5=E6=B2=BB=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/.vscode/launch.json | 3 +- .../quanju/containers/footer/guanli/index.js | 102 ++++++++++++------ 2 files changed, 72 insertions(+), 33 deletions(-) diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 45edb9a6..118cef79 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,7 +15,8 @@ "args": [ "-p 13400", "-f http://localhost:13400", - "-g postgres://FashionAdmin:123456@10.8.16.184:5432/sihaogonglu", + // "-g postgres://FashionAdmin:123456@10.8.16.184:5432/sihaogonglu", + "-g postgres://postgres:123@10.8.30.32:5432/highways4good", // "-g postgres://FashionAdmin:123456@10.8.30.156:5432/highway4goodn0728", "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", "--qnsk yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa", diff --git a/web/client/src/sections/quanju/containers/footer/guanli/index.js b/web/client/src/sections/quanju/containers/footer/guanli/index.js index 35507d0c..3e42faf5 100644 --- a/web/client/src/sections/quanju/containers/footer/guanli/index.js +++ b/web/client/src/sections/quanju/containers/footer/guanli/index.js @@ -1,18 +1,20 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Carousel, Tooltip } from 'antd' +import { Carousel, Tooltip, Image } from 'antd' import AutoRollComponent from '../build/AutoRollComponent' import VideoMonitor from '../build/videoMonitor' import Module from '../../public/module' +import moment from 'moment' import LeftItem from './LeftItem' import { getjiandmanage, getjiandetail } from '../../../actions/example' +import { getRoadadministration } from '../../../../fillion/actions/luzheng' import './style.less' import NoData from '../../public/noData'; const Guanli = (props) => { const { dispatch } = props const [leftDatas, setleftDatas] = useState([]) const [rightDatas, setrightDatas] = useState([]) - const [rightitemlist, setrightitemlist] = useState() + const [rightitemlist, setrightitemlist] = useState([]) const requestleftDatas = async () => { const res = await dispatch(getjiandmanage()) res.payload.data?.sort((a, b) => { @@ -50,48 +52,80 @@ const Guanli = (props) => { // console.log(d2,'完美') // console.log(res.payload.data,'嘿嘿嘿') } + + const roadManagement = async () => { + await dispatch(getRoadadministration({})).then(res => { + if (res.success) { + setrightitemlist(res.payload.data?.rows || []) + } + }) + + + + } + + + useEffect(() => { requestleftDatas(); - requestRightDatas() + // requestRightDatas() + roadManagement() }, []) - // let datalist = newArry(30) - // datalist.fill({licensePlate:"赣A44454",overrunRate:"30%",fine:"200元",processingTime:"2020年4月1日"}) - // const content = ( - // ); const renderContent = () => { - // console.log(rightitemlist); + return
- {rightitemlist && rightitemlist.length !== 0 ? rightitemlist?.map(({ id, licensePlate, overrunRate, fine, processingTime, deductPoints, nameOfInspectionPoint }, index) => { + {rightitemlist && rightitemlist.length !== 0 ? rightitemlist?.map(({ enforcementdate, enforcementreslt, roadname, picfile }, index) => { if (index < 120) { return
-
+
- {/* */} -
- -

{overrunRate ? overrunRate.toFixed(2) : 0}%{/* {item.overrunRate ? item.overrunRate + "%" : "--"} */}

-

超限

-
-
-

车牌号{licensePlate}{/* {item.licensePlate} */}

-

检测点{nameOfInspectionPoint}

-

处罚{deductPoints ? `-${deductPoints}分` : ""}和-{fine}{fine ? "元" : ""}{/* {item.deductPoints ? "-" + item.deductPoints + "分" : ""}{item.deductPoints && item.fine ? "和" : ""}{item.fine ? "-" + item.fine + "元" : ""}{item.deductPoints || item.fine ? "" : "--"} */}

-

日期{processingTime}{/* {item.processingTime ? item.processingTime : "--"} */}

+ {picfile?.length > 0 ? + {picfile?.map(v => )} + + : + } + + +
+

+ 执法日期: + {enforcementdate && moment(enforcementdate).format("YYYY-MM-DD") || "--"} +

+

+ 执法道路: + {roadname} +

+

+ 执法成果: + {enforcementreslt}

+
} placement="leftTop" - overlayStyle={{ minWidth: 400, minHeight: 212, padding: 0, margin: 0, backgroundImage: `url(../../../../../assets/images/leadership/beijinglan.png)` }} + overlayStyle={{ minWidth: 500, minHeight: 200, paddingTop: 10, margin: 0, backgroundImage: `url(../../../../../assets/images/leadership/beijinglan.png)` }} overlayClassName='popover' > -
- {licensePlate} - {overrunRate}% - {deductPoints ? `-${deductPoints}分` : ""}和-{fine}{fine ? "元" : ""} - {processingTime} +
+
{enforcementdate && moment(enforcementdate).format("YYYY-MM-DD") || "--"}
+
{enforcementreslt}
@@ -121,22 +155,26 @@ const Guanli = (props) => {
- -
+ + {/*
已处理 {rightDatas?.processed || 0} -
-
+
*/} + {/*
车牌号 超限 处罚 处理日期 +
*/} + o
+
执法日期
+
执法成果
{rightitemlist && rightitemlist.length !== 0 ? : } + divHeight={"100%"} divId={"chart-overview-deviceList"} /> : }
From 3a21f200178ad3763658d2a6bf9b168c48965c76 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 4 Aug 2023 19:25:37 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F-=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 21 +-- api/app/lib/models/report.js | 12 +- scripts/1.3.1/schema/4.update_report.sql | 6 + weapp/src/packages/patrol/index.jsx | 217 ++++++++++++++++++----- weapp/src/packages/patrol/index.scss | 18 ++ weapp/src/packages/patrolView/index.jsx | 9 +- weapp/src/services/api.js | 10 ++ 7 files changed, 231 insertions(+), 62 deletions(-) create mode 100644 scripts/1.3.1/schema/4.update_report.sql diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index c79b692d..1c2f4732 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -2,7 +2,7 @@ const { QueryTypes } = require('sequelize'); const moment = require('moment'); -async function reportList (ctx) { +async function reportList(ctx) { try { const models = ctx.fs.dc.models; const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '', codeRoad } = ctx.query @@ -95,7 +95,8 @@ async function reportList (ctx) { findOption.where.performerId = { $in: performerIds } } if (handleState) { - findOption.where.handleState = handleState + let handleStates = handleState.split(',') + findOption.where.handleState = { $in: handleStates } } if (codeRoad) { findOption.where.codeRoad = codeRoad @@ -146,7 +147,7 @@ async function reportList (ctx) { } } -async function reportPosition (ctx) { +async function reportPosition(ctx) { try { const models = ctx.fs.dc.models; const { startTime, endTime, userId, reportType } = ctx.query @@ -196,7 +197,7 @@ async function reportPosition (ctx) { } } -async function reportDetail (ctx) { +async function reportDetail(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params @@ -218,7 +219,7 @@ async function reportDetail (ctx) { } } -async function reportHandle (ctx) { +async function reportHandle(ctx) { try { const { models } = ctx.fs.dc; @@ -248,7 +249,7 @@ async function reportHandle (ctx) { } } -async function createReport (ctx) { +async function createReport(ctx) { try { const { userId } = ctx.fs.api const models = ctx.fs.dc.models; @@ -270,7 +271,7 @@ async function createReport (ctx) { } } -async function deleteReport (ctx) { +async function deleteReport(ctx) { try { const models = ctx.fs.dc.models; const { reportId } = ctx.params; @@ -293,7 +294,7 @@ async function deleteReport (ctx) { // TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回 -async function spotPrepare (ctx) { +async function spotPrepare(ctx) { try { const { models } = ctx.fs.dc; const sequelize = ctx.fs.dc.orm; @@ -365,7 +366,7 @@ async function spotPrepare (ctx) { } } -async function spotCheck (ctx) { +async function spotCheck(ctx) { const transaction = await ctx.fs.dc.orm.transaction(); try { const { models } = ctx.fs.dc; @@ -447,7 +448,7 @@ async function spotCheck (ctx) { } } } -async function spotCheckDetail (ctx) { +async function spotCheckDetail(ctx) { const { models } = ctx.fs.dc console.log('txc1', ctx.query) const { startTime, endTime } = ctx.query diff --git a/api/app/lib/models/report.js b/api/app/lib/models/report.js index 0e6b827d..adb7d806 100644 --- a/api/app/lib/models/report.js +++ b/api/app/lib/models/report.js @@ -447,7 +447,17 @@ module.exports = dc => { primaryKey: false, field: "handle_opinions", autoIncrement: false - } + }, + handleAdvice: { + index: 6, + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: '管理员处理意见', + primaryKey: false, + field: "handle_advice", + autoIncrement: false + }, }, { tableName: "report", comment: "", diff --git a/scripts/1.3.1/schema/4.update_report.sql b/scripts/1.3.1/schema/4.update_report.sql new file mode 100644 index 00000000..eefe3537 --- /dev/null +++ b/scripts/1.3.1/schema/4.update_report.sql @@ -0,0 +1,6 @@ +ALTER TABLE "public"."report" + ADD COLUMN "handle_advice" varchar(1024); + +COMMENT ON COLUMN "public"."report"."handle_state" IS '待处理 / 已指派 / 已处理 / 不处理'; + +COMMENT ON COLUMN "public"."report"."handle_advice" IS '管理员处理意见'; \ No newline at end of file diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 44276273..1cfbe228 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -8,7 +8,7 @@ import VideoUpload from '../../components/uploads' import request from '@/services/request'; import environment from '../../config'; import { getState } from '../../store/globalState'; -import { postReport, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle } from '@/services/api'; +import { postReport, getReportList, getReportDetail, delReport, getRoadSection, postImage, getProject, postHandle, getAllDepUsers, getUsers } from '@/services/api'; import './index.scss'; import arrowIcon from '../../static/img/patrol/arrow-down.svg'; import dayjs from 'dayjs'; @@ -25,6 +25,7 @@ const Index = () => { const isPatrol = kind === 'patrol' || kind == 'conserve' ? true : false const isRoad = kind === 'road' ? true : false const isAnomaly = kind === 'anomaly' ? true : false + const noDel = wait === 'wait' || handle === 'handle' const [reportType, setReportType] = useState(kind || 'patrol') // 上报类型 const [projectType, setProjectType] = useState('') // 工程类型 @@ -60,7 +61,7 @@ const Index = () => { const [handleId, setHandleId] = useState([]) const [video, setVideo] = useState('') const [videoqn, setVideoqn] = useState([]) - const [handleType, setHandleType] = useState('') + const [handleState, setHandleState] = useState('') const [roadCodeHead, setRoadCodeHead] = useState('X') const [roadCodeEnd, setRoadCodeEnd] = useState('') @@ -201,6 +202,12 @@ const Index = () => { const [otherDescription, setOtherDescription] = useState('') // 其他养护内容 const [isBeforeReport, setIsBeforeReport] = useState(false) // V1.1.0上报内容修改,查看时根据时间判断展示逻辑) + const [isAppoint, setIsAppoint] = useState(true) // 指派 / 不处理 + const [allDepUsers, setAllDepUsers] = useState([]) // 所有部门用户列表 + const [userList, setUserList] = useState([]) // 所有用户列表 + const [appointUser, setAppointUser] = useState(null) // 责任人在userList的index + const [handleAdvice, setHandleAdvice] = useState('') // 处理意见 + const prjType = isAnomaly ? [ @@ -282,7 +289,7 @@ const Index = () => { setRoadSectionEnd(data.roadSectionEnd) setAddress(data.address) setContent(data.content) - setHandleType(data.handleState) + setHandleState(data.handleState) setScenePic(data.scenePic ? data.scenePic.map(item => ({ url: imgUrl + item })) : []) setHandlePic(data.handlePic ? data.handlePic.map(item => ({ url: imgUrl + item })) : []) setConserveBeforePic(data.conserveBeforePic ? data.conserveBeforePic.map(item => ({ url: imgUrl + item })) : []) @@ -314,6 +321,9 @@ const Index = () => { }) setConserveContent(nextContent) setOtherDescription(data.otherDescription) + } else if (data.reportType === 'anomaly') { + setAppointUser(data.performerId) + setHandleAdvice(data.handleAdvice) } if (data.handleContent) { setHandleCenter(data.handleContent) @@ -401,6 +411,19 @@ const Index = () => { } }) } + if (isSuperAdmin && kind === 'anomaly') { + request.get(getAllDepUsers()).then(res => { + if (res.statusCode === 200) { + setAllDepUsers(res.data) + } + }) + request.get(getUsers()).then(res => { + if (res.statusCode === 200) { + const users = res.data.filter(u => u.phone !== 'SuperAdmin' && u.isAdmin) + setUserList(users) + } + }) + } }, []) useEffect(() => { @@ -829,19 +852,36 @@ const Index = () => { function handleOk() { if (!canReport) { return } let str = handleCenter.trim() - if (!str) { - Taro.showToast({ title: '请完善处理内容', icon: 'none' }) - return - } - if (str.length > 50) { - Taro.showToast({ title: '内容字数不能超过50', icon: 'none' }) - return + if (!isSuperAdmin) { + if (!str) { + Taro.showToast({ title: '请完善处理内容', icon: 'none' }) + return + } + if (str.length > 50) { + Taro.showToast({ title: '内容字数不能超过50', icon: 'none' }) + return + } + } else { + if (isAppoint && appointUser === null) { + Taro.showToast({ title: '请选择责任人', icon: 'none' }) + return + } } - let data = { - handleContent: str, - handlePic: handlePicPn, - handleState: '已处理' + let data = {} + if (isSuperAdmin) { + data = { + handleState: isAppoint ? '已指派' : '不处理', + performerId: userList[appointUser].id, + handleAdvice, + } + } else { + data = { + handleContent: str, + handlePic: handlePicPn, + handleState: '已处理' + } } + Taro.showModal({ title: '提示', content: '您要进行处理提交吗?', @@ -1399,43 +1439,122 @@ const Index = () => { } { - isView ? - isSuperAdmin && - 删除 - : - 上报 + !isPatrol && (handleState == '已处理' || wait == 'wait' || handle == 'handle') ? <> + { + isSuperAdmin && (wait === 'wait' || kind === 'handle') && + { + handleState === '待处理' ? // 管理员指派 + <> + { + setIsAppoint(e.detail.value === '指派' ? true : false) + }}> + 指派 + 不处理 + + { + isAppoint && <> + + 责任人:{appointUser !== null ? userList[appointUser]?.name : ''} + setAppointUser(Number(e.detail.value))} + > + + + +