|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'; |
|
|
import './protable.less' |
|
|
import './protable.less' |
|
|
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover } from 'antd'; |
|
|
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover } from 'antd'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import { getReportList, getReportDetail } from '../actions/patrol'; |
|
|
import { getReportList, getReportDetail, handleReport } from '../actions/patrol'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import { httpDel } from '@peace/utils' |
|
|
import { httpDel } from '@peace/utils' |
|
|
import { PinyinHelper } from '@peace/utils'; |
|
|
import { PinyinHelper } from '@peace/utils'; |
|
@ -78,7 +78,7 @@ const DetailForm = (props) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const DetailList = (props) => { |
|
|
const DetailList = (props) => { |
|
|
const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol } = props; |
|
|
const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol, queryData } = props; |
|
|
const [visible, setVisible] = useState(false) |
|
|
const [visible, setVisible] = useState(false) |
|
|
const [selectRecord, setSelectRecord] = useState(); |
|
|
const [selectRecord, setSelectRecord] = useState(); |
|
|
const [noProcessingPopVisible, setNoProcessingPopVisible] = useState(false); |
|
|
const [noProcessingPopVisible, setNoProcessingPopVisible] = useState(false); |
|
@ -200,19 +200,25 @@ const DetailList = (props) => { |
|
|
<Button |
|
|
<Button |
|
|
onClick={() => { checkDetail(record); handleOpen(); }} |
|
|
onClick={() => { checkDetail(record); handleOpen(); }} |
|
|
style={{ marginRight: 10 }}>查看</Button>, |
|
|
style={{ marginRight: 10 }}>查看</Button>, |
|
|
isAnomaly ? <Button>指派</Button> : null, |
|
|
isAnomaly && record.handleState != '已处理' ? <Button>指派</Button> : null, |
|
|
isAnomaly ? |
|
|
isAnomaly && record.handleState != '已处理' ? |
|
|
<Popover |
|
|
<Popover |
|
|
content={[ |
|
|
content={[ |
|
|
<div style={{ width: '100%', height: 30 }}> |
|
|
<div style={{ width: '100%', height: 30 }}> |
|
|
<Button onClick={() => setNoProcessingPopVisible(false)} style={{ float: "right" }} >否</Button> |
|
|
<Button onClick={() => setNoProcessingPopVisible(false)} style={{ float: "right" }} >否</Button> |
|
|
<Button type="primary" onClick={() => handleRemove(record)} style={{ marginRight: 8, float: "right" }} >是</Button> |
|
|
<Button type="primary" onClick={() => dispatch(handleReport(record.id, { handleState: '已处理' })).then(res => { |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
setNoProcessingPopVisible(false) |
|
|
|
|
|
setNoProcessingSelectRecord(null) |
|
|
|
|
|
handelRefresh() |
|
|
|
|
|
} |
|
|
|
|
|
})} style={{ marginRight: 8, float: "right" }} >是</Button> |
|
|
</div> |
|
|
</div> |
|
|
]} |
|
|
]} |
|
|
visible={noProcessingSelectRecord == record.id && noProcessingPopVisible} |
|
|
visible={noProcessingSelectRecord == record.id && noProcessingPopVisible} |
|
|
trigger="click" |
|
|
trigger="click" |
|
|
onClick={() => setNoProcessingSelectRecord(record.id)} |
|
|
onClick={() => setNoProcessingSelectRecord(record.id)} |
|
|
title="是否删除该记录?" |
|
|
title="是否不处理该记录?" |
|
|
onVisibleChange={(newVisible) => setNoProcessingPopVisible(newVisible)} |
|
|
onVisibleChange={(newVisible) => setNoProcessingPopVisible(newVisible)} |
|
|
> |
|
|
> |
|
|
<Button>不处理</Button> |
|
|
<Button>不处理</Button> |
|
@ -322,7 +328,6 @@ const PatrolNameList = (props) => { |
|
|
return { |
|
|
return { |
|
|
onClick: () => { |
|
|
onClick: () => { |
|
|
if (record) { |
|
|
if (record) { |
|
|
// console.log('record:', record)
|
|
|
|
|
|
let id = record.id |
|
|
let id = record.id |
|
|
if (selectRoad == record.id) { |
|
|
if (selectRoad == record.id) { |
|
|
id = null |
|
|
id = null |
|
@ -353,7 +358,7 @@ const PatrolTable = (props) => { |
|
|
const isAnomaly = pathname.includes('anomaly') |
|
|
const isAnomaly = pathname.includes('anomaly') |
|
|
const isPatrol = !isRoad && !isAnomaly |
|
|
const isPatrol = !isRoad && !isAnomaly |
|
|
const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; |
|
|
const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; |
|
|
console.log(isRoad, pathname, isPatrol); |
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (userList && userList instanceof Array) { |
|
|
if (userList && userList instanceof Array) { |
|
|
setRecord(userList[0]); |
|
|
setRecord(userList[0]); |
|
@ -410,7 +415,7 @@ const PatrolTable = (props) => { |
|
|
<Card style={{ flex: 1 }}> |
|
|
<Card style={{ flex: 1 }}> |
|
|
<DetailList |
|
|
<DetailList |
|
|
reportList={reportList} record={record} loading={reportListLoading} dispatch={dispatch} handleOpen={handleOpen} handelRefresh={handelRefresh} |
|
|
reportList={reportList} record={record} loading={reportListLoading} dispatch={dispatch} handleOpen={handleOpen} handelRefresh={handelRefresh} |
|
|
isPatrol={isPatrol} isRoad={isRoad} isAnomaly={isAnomaly} |
|
|
isPatrol={isPatrol} isRoad={isRoad} isAnomaly={isAnomaly} queryData={queryData} |
|
|
/> |
|
|
/> |
|
|
</Card> |
|
|
</Card> |
|
|
</div> |
|
|
</div> |
|
@ -432,7 +437,7 @@ const PatrolTable = (props) => { |
|
|
const handleExport = () => { |
|
|
const handleExport = () => { |
|
|
if (reportList && reportList instanceof Array && reportList.length) { |
|
|
if (reportList && reportList instanceof Array && reportList.length) { |
|
|
let ids = reportList.map(item => item.id); |
|
|
let ids = reportList.map(item => item.id); |
|
|
exports(ids); |
|
|
exports(ids, reportType); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|