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) => {