Browse Source

feat:fix bugs

master
zhaobing’ 11 months ago
parent
commit
093a2c7b23
  1. 1
      web/client/src/components/Uploads/index.js
  2. 9
      web/client/src/sections/patrolManage/components/addReportRulesModal.js
  3. 11
      web/client/src/sections/patrolManage/containers/patrolReport.js

1
web/client/src/components/Uploads/index.js

@ -181,6 +181,7 @@ class Uploads extends Component {
message.warning(`最多选择${maxFilesNum_}个文件上传`);
return false;
}
if (file.name.length > 60) {
message.warning(`文件名过长(大于60字符),请修改后上传`);
return false;

9
web/client/src/sections/patrolManage/components/addReportRulesModal.js

@ -1,4 +1,4 @@
import { Button, Form, Input, Modal, Select, DatePicker } from 'antd'
import { Button, Form, Input, Modal, Select, DatePicker,message } from 'antd'
import React, { useState, useEffect } from 'react'
import { connect } from 'react-redux'
import Uploads from '$components/Uploads'
@ -60,7 +60,6 @@ const AddReportRulesModal = props => {
})
form.setFieldsValue({
structure: modalData?.structure,
pic: modalData?.reportpic,
name: modalData?.name,
type: modalData?.type,
system:modalData?.system,
@ -72,6 +71,10 @@ const AddReportRulesModal = props => {
form
.validateFields()
.then(values => {
if(values.pic?.length<4){
message.warning(`最少选择4张图片`)
return
}
const params = {
id: modalData?.id,
name: values.name,
@ -143,7 +146,6 @@ const AddReportRulesModal = props => {
}
return (
<>
<Modal
@ -241,7 +243,6 @@ const AddReportRulesModal = props => {
<Uploads
listType='picture-card'
uploadType='project'
maxFilesNum={4}
maxFileSize={10}
isQiniu={true}
// disabled={true}

11
web/client/src/sections/patrolManage/containers/patrolReport.js

@ -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>

Loading…
Cancel
Save