|
|
@ -1,6 +1,6 @@ |
|
|
|
import React, { useState, useRef, useEffect } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Button, Tabs, Popconfirm, Tooltip } from 'antd'; |
|
|
|
import { Button, Tabs, Popconfirm, Tooltip,Spin } from 'antd'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
|
import { getPatrolReport } from '../actions/report'; |
|
|
|
import { getProjectList } from '../actions/plan'; |
|
|
@ -21,6 +21,7 @@ function patrolReport(props) { |
|
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }) |
|
|
|
const [typeList, setTypeList] = useState([{ value: 1, label: '周报表' }, { value: 2, label: '月报表' }]) |
|
|
|
const [modalData, setModalData] = useState(null) |
|
|
|
const [loading,setLoading]=useState(false) |
|
|
|
//报表配置
|
|
|
|
// const getReportConfig = (query) => {
|
|
|
|
// const { limit, page, name } = query
|
|
|
@ -72,6 +73,7 @@ function patrolReport(props) { |
|
|
|
}) |
|
|
|
} |
|
|
|
const generateReport=(record)=>{ |
|
|
|
setLoading(true) |
|
|
|
let data={ |
|
|
|
reportName:record?.name, |
|
|
|
startTime:moment(record?.startTime).format('YYYY-MM-DD HH:mm:ss'), |
|
|
@ -83,6 +85,9 @@ function patrolReport(props) { |
|
|
|
images:record?.reportpic.map(item=>qnDomain+'/'+item)||[] |
|
|
|
} |
|
|
|
dispatch(patrolManage.postGenerateReport(data)).then(res => { |
|
|
|
if(res.success){ |
|
|
|
setLoading(false) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const columns = [{ |
|
|
@ -101,7 +106,7 @@ function patrolReport(props) { |
|
|
|
{ |
|
|
|
const rslt=structAll?.filter(p => record.structure?.some(q => q == p.id)) |
|
|
|
return <> |
|
|
|
<div>{record?.project?.name || record.structure.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}> |
|
|
|
<div>{record?.project?record?.project?.name: record.structure?.length > 1 ? <Tooltip title={rslt?.map(item => item.name)?.join(',')}> |
|
|
|
<span>{rslt&&rslt.length?rslt[0].name+'...':''}</span> |
|
|
|
</Tooltip> : rslt?.map(item => item.name)?.join(',') |
|
|
|
}</div> |
|
|
@ -290,6 +295,7 @@ function patrolReport(props) { |
|
|
|
label: `报表配置`, |
|
|
|
key: '2', |
|
|
|
children: <> |
|
|
|
<Spin spinning={loading}> |
|
|
|
<ProTable |
|
|
|
|
|
|
|
actionRef={tableRef2} |
|
|
@ -323,6 +329,7 @@ function patrolReport(props) { |
|
|
|
rowKey="key" |
|
|
|
search={true} |
|
|
|
/> |
|
|
|
</Spin> |
|
|
|
<AddReportRulesModal structAll={structAll} typeList={typeList} modalData={modalData} onOk={onOk} visible={modalVis} cancelHandle={cancelHandle}> |
|
|
|
|
|
|
|
</AddReportRulesModal> |
|
|
|