From 7283a28c54af2897a5bb5175959ff84ae2247723 Mon Sep 17 00:00:00 2001 From: zhaobing Date: Fri, 14 Jul 2023 15:16:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=BC=82=E5=B8=B8=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E7=9A=84=E6=9F=A5=E7=9C=8B=E6=B7=BB=E5=8A=A0=E4=B8=89=E4=B8=AA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 3 ++- .../fillion/components/patrolTable.js | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index c15235f5..1facea74 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -43,7 +43,8 @@ async function reportList(ctx) { where: { }, - attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType', 'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad'], + attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'performerId', 'roadSectionEnd', 'reportType', + 'content', 'longitude', 'latitude', 'projectName', 'handleState', 'codeRoad', 'handleContent', 'handlePic'], include: [{ model: models.User, attributes: ['name'] diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 93cd5f86..86790550 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -48,13 +48,14 @@ const DetailForm = (props) => { { key: '巡查内容', name: 'content' }, { key: '路线代码', name: 'codeRoad' }, { key: '现场照片', name: 'scenePic' }, - + { key: '处理详情', name: 'handleContent', skip: !isAnomaly }, + { key: '处理图片', name: 'handlePic', skip: !isAnomaly }, + { key: '处理人', name: 'performerName', skip: !isAnomaly } ]; const renderContent = (data) => { if (data) { // Object.keys(data).map(key => { - // }) return keyList.map(obj => { return ( @@ -73,7 +74,7 @@ const DetailForm = (props) => { : obj.name == 'projectType' ? reportTypeText(data[obj.name]) : - data[obj.name] + data[obj.name] || null } disabled /> @@ -593,7 +594,7 @@ const PatrolTable = (props) => { const [detailVisible, setDetailVisible] = useState(false) const [activeTabKey1, setActiveTabKey1] = useState('tab1'); const { RangePicker } = DatePicker; - + const [reportDetailCopy, setReportDetailCopy] = useState({})//匹配执行者的名字 const isRoad = pathname.includes('road') const isAnomaly = pathname.includes('anomaly') const isPatrol = !isRoad && !isAnomaly @@ -604,10 +605,10 @@ const PatrolTable = (props) => { }, []) useEffect(() => { - // if (userList && userList instanceof Array) { - // setRecord(userList[0]); - // } - }, [userList]) + if (userList && userList instanceof Array && reportDetail && reportDetail instanceof Object) { + setReportDetailCopy(Object.assign(reportDetail, { performerName: userList.find(item => item.id === reportDetail.performerId)?.name })) + } + }, [userList, reportDetail]) useEffect(() => { queryData(); @@ -752,7 +753,7 @@ const PatrolTable = (props) => {