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