💥 feat(模块): 添加了个很棒的功能
This commit is contained in:
parent
3dfe0c92c8
commit
03ba594601
51
src/components/KeepAliveOutlet/index.tsx
Normal file
51
src/components/KeepAliveOutlet/index.tsx
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { Outlet, useLocation, useOutlet, connect } from 'umi';
|
||||||
|
|
||||||
|
interface CacheItem {
|
||||||
|
outlet: React.ReactNode;
|
||||||
|
pathname: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建一个缓存路由组件,用于保持路由组件的状态
|
||||||
|
const KeepAliveOutlet: React.FC<{ global: any }> = (props) => {
|
||||||
|
const [cacheOutlets, setCacheOutlets] = useState<CacheItem[]>([]);
|
||||||
|
const location = useLocation();
|
||||||
|
const { pathname } = location;
|
||||||
|
const currentOutlet = useOutlet();
|
||||||
|
const { tabsRoutes = [] } = props.global || {};
|
||||||
|
|
||||||
|
// 获取当前打开的所有标签页路径
|
||||||
|
const activePaths = tabsRoutes.map((tab: any) => tab.path);
|
||||||
|
|
||||||
|
// 使用字符串比较来避免不必要的重渲染
|
||||||
|
const activePathsString = JSON.stringify(activePaths);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// 如果当前路径已经在缓存中,则不需要再次添加
|
||||||
|
if (!cacheOutlets.find(item => item.pathname === pathname)) {
|
||||||
|
setCacheOutlets(prev => [...prev, { outlet: currentOutlet, pathname }]);
|
||||||
|
}
|
||||||
|
}, [pathname, currentOutlet]);
|
||||||
|
|
||||||
|
// 单独处理缓存清理逻辑,避免不必要的重渲染
|
||||||
|
useEffect(() => {
|
||||||
|
// 清理已关闭标签页的缓存
|
||||||
|
if (cacheOutlets.length > 0) {
|
||||||
|
setCacheOutlets(prev => prev.filter(item => activePaths.includes(item.pathname)));
|
||||||
|
}
|
||||||
|
}, [activePathsString]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{cacheOutlets.map(item => (
|
||||||
|
<div key={item.pathname} style={{ display: pathname === item.pathname ? 'block' : 'none' }}>
|
||||||
|
{item.outlet}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(({ global }: { global: any }) => ({
|
||||||
|
global,
|
||||||
|
}))(KeepAliveOutlet);
|
||||||
@ -4,6 +4,7 @@ import { useState, useEffect } from 'react';
|
|||||||
import { Dropdown, Layout, Menu, Tabs, Tooltip } from 'antd';
|
import { Dropdown, Layout, Menu, Tabs, Tooltip } from 'antd';
|
||||||
import type { MenuProps } from 'antd';
|
import type { MenuProps } from 'antd';
|
||||||
import { Outlet, Link, useLocation, connect, history } from 'umi';
|
import { Outlet, Link, useLocation, connect, history } from 'umi';
|
||||||
|
import KeepAliveOutlet from '@/components/KeepAliveOutlet';
|
||||||
import PageAccess from '@/components/PageAccess';
|
import PageAccess from '@/components/PageAccess';
|
||||||
import type { UserConnectedProps, UserModelState } from '@/models/user';
|
import type { UserConnectedProps, UserModelState } from '@/models/user';
|
||||||
import LayoutWrapper from '@/components/LayoutWrapper';
|
import LayoutWrapper from '@/components/LayoutWrapper';
|
||||||
@ -367,6 +368,7 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc
|
|||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
size="small"
|
size="small"
|
||||||
className='main-tab'
|
className='main-tab'
|
||||||
|
destroyInactiveTabPane={false} // 不销毁不活动的标签页面板,保持状态
|
||||||
tabBarExtraContent={
|
tabBarExtraContent={
|
||||||
<Tooltip title="关闭选项卡" placement="topRight">
|
<Tooltip title="关闭选项卡" placement="topRight">
|
||||||
<Dropdown overlay={
|
<Dropdown overlay={
|
||||||
@ -412,13 +414,17 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc
|
|||||||
{tabsRoutes && tabsRoutes.map((item: any) =>
|
{tabsRoutes && tabsRoutes.map((item: any) =>
|
||||||
<TabPane
|
<TabPane
|
||||||
tab={item.title} key={item?.path}
|
tab={item.title} key={item?.path}
|
||||||
style={{ padding: 24, paddingTop: 0 }}>
|
style={{ padding: 24, paddingTop: 0 }}
|
||||||
|
forceRender={true} /* 强制渲染标签页内容,即使不可见也保持渲染状态 */
|
||||||
|
>
|
||||||
{
|
{
|
||||||
//统一对所有有效路由做页面鉴权的处理
|
//统一对所有有效路由做页面鉴权的处理
|
||||||
validMenuItem
|
validMenuItem
|
||||||
? (
|
? (
|
||||||
<PageAccess>
|
<PageAccess>
|
||||||
<Outlet />
|
<div key={item?.path} style={{ display: activeKey === item?.path ? 'block' : 'none' }}>
|
||||||
|
<KeepAliveOutlet />
|
||||||
|
</div>
|
||||||
</PageAccess>
|
</PageAccess>
|
||||||
)
|
)
|
||||||
: <Page404 />
|
: <Page404 />
|
||||||
|
|||||||
@ -260,14 +260,14 @@ const ErrorRecord: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<Popconfirm
|
{/* <Popconfirm
|
||||||
title={"确认删除?"}
|
title={"确认删除?"}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
deleteRecord(record?.id)
|
deleteRecord(record?.id)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm> */}
|
||||||
|
|
||||||
</Space >
|
</Space >
|
||||||
}
|
}
|
||||||
|
|||||||
@ -230,14 +230,14 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
setCurrentRow(record)
|
setCurrentRow(record)
|
||||||
handleShowDetail(true)
|
handleShowDetail(true)
|
||||||
}}>详情</a> */}
|
}}>详情</a> */}
|
||||||
<Popconfirm
|
{/* <Popconfirm
|
||||||
title={"确认删除?"}
|
title={"确认删除?"}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
deleteQuestion(record?.id)
|
deleteQuestion(record?.id)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm> */}
|
||||||
<a onClick={() => {
|
<a onClick={() => {
|
||||||
console.log('currentRow', record);
|
console.log('currentRow', record);
|
||||||
setCurrentRow(record)
|
setCurrentRow(record)
|
||||||
|
|||||||
@ -612,7 +612,7 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
request={async () => {
|
request={async () => {
|
||||||
const req = {
|
const req = {
|
||||||
SERVERPART_ID: formRes.serverPartId,
|
SERVERPART_ID: formRes.serverPartId,
|
||||||
PROVINCE_CODE: currentUser.provinceCode,
|
PROVINCE_CODE: currentUser.provinceCode || '510000',
|
||||||
}
|
}
|
||||||
const data = await handleGetDealerList(req)
|
const data = await handleGetDealerList(req)
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
@ -727,6 +727,8 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
</ProForm> : ""
|
</ProForm> : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
formRes && formRes.situation === 1 ?
|
||||||
<ProTable
|
<ProTable
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
formRef={tableFormRef}
|
formRef={tableFormRef}
|
||||||
@ -847,7 +849,10 @@ const RecordDetail = ({ parentRow, show, detailType, currentUser, onRef, showErr
|
|||||||
// console.log('table', res);
|
// console.log('table', res);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
/>
|
/> : ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* 移除打印设置弹窗 */}
|
{/* 移除打印设置弹窗 */}
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,43 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
return <span style={{ color: record.situation === 1 ? "red" : "" }}>{record.situation === 1 ? '异常' : record.situation === 0 ? '正常' : ''}</span>
|
return <span style={{ color: record.situation === 1 ? "red" : "" }}>{record.situation === 1 ? '异常' : record.situation === 0 ? '正常' : ''}</span>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: <div style={{ textAlign: 'center' }}>处理状态</div>,
|
||||||
|
dataIndex: "errorStatus",
|
||||||
|
hideInSearch: true,
|
||||||
|
width: 100,
|
||||||
|
ellipsis: true,
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record) => {
|
||||||
|
// let res: any = record.extend ? JSON.parse(record.extend) : "-"
|
||||||
|
return record?.situation !== 0 ? <span style={{ color: record.errorStatus === 0 ? "red" : record.errorStatus === 1 ? "#1677ff" : "" }}>{
|
||||||
|
record.errorStatus === 0
|
||||||
|
? "待处理"
|
||||||
|
: record.errorStatus === 1
|
||||||
|
? "处理中"
|
||||||
|
: record.errorStatus === 2
|
||||||
|
? "已处理"
|
||||||
|
: "-"
|
||||||
|
}</span> : ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <div style={{ textAlign: 'center' }}>现场图片</div>,
|
||||||
|
dataIndex: "placeName",
|
||||||
|
hideInSearch: true,
|
||||||
|
width: 150,
|
||||||
|
ellipsis: true,
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record) => {
|
||||||
|
// let extendObj = record?.extend ? JSON.parse(record?.extend) : ""
|
||||||
|
let imgList = record.imgsList
|
||||||
|
return imgList && imgList.length > 0 ?
|
||||||
|
<Button type="primary" onClick={() => {
|
||||||
|
setShowImgList(imgList)
|
||||||
|
setImagePreviewVisible(true)
|
||||||
|
}}>查看附件</Button> : "-"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>巡查内容</div>,
|
title: <div style={{ textAlign: 'center' }}>巡查内容</div>,
|
||||||
dataIndex: "uploadResult",
|
dataIndex: "uploadResult",
|
||||||
@ -182,43 +219,6 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: <div style={{ textAlign: 'center' }}>处理状态</div>,
|
|
||||||
dataIndex: "errorStatus",
|
|
||||||
hideInSearch: true,
|
|
||||||
width: 100,
|
|
||||||
ellipsis: true,
|
|
||||||
align: 'center',
|
|
||||||
render: (_, record) => {
|
|
||||||
// let res: any = record.extend ? JSON.parse(record.extend) : "-"
|
|
||||||
return record?.situation !== 0 ? <span style={{ color: record.errorStatus === 0 ? "red" : record.errorStatus === 1 ? "#1677ff" : "" }}>{
|
|
||||||
record.errorStatus === 0
|
|
||||||
? "待处理"
|
|
||||||
: record.errorStatus === 1
|
|
||||||
? "处理中"
|
|
||||||
: record.errorStatus === 2
|
|
||||||
? "已处理"
|
|
||||||
: "-"
|
|
||||||
}</span> : ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: <div style={{ textAlign: 'center' }}>现场图片</div>,
|
|
||||||
dataIndex: "placeName",
|
|
||||||
hideInSearch: true,
|
|
||||||
width: 150,
|
|
||||||
ellipsis: true,
|
|
||||||
align: 'center',
|
|
||||||
render: (_, record) => {
|
|
||||||
// let extendObj = record?.extend ? JSON.parse(record?.extend) : ""
|
|
||||||
let imgList = record.imgsList
|
|
||||||
return imgList && imgList.length > 0 ?
|
|
||||||
<Button type="primary" onClick={() => {
|
|
||||||
setShowImgList(imgList)
|
|
||||||
setImagePreviewVisible(true)
|
|
||||||
}}>查看附件</Button> : "-"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'option',
|
dataIndex: 'option',
|
||||||
@ -248,16 +248,14 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}}> 详情
|
}}> 详情
|
||||||
</a >
|
</a >
|
||||||
}
|
}
|
||||||
|
{/* <Popconfirm
|
||||||
|
|
||||||
<Popconfirm
|
|
||||||
title={"确认删除?"}
|
title={"确认删除?"}
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
deleteRecord(record?.id)
|
deleteRecord(record?.id)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm> */}
|
||||||
|
|
||||||
</Space >
|
</Space >
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,14 +86,14 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.id && record?.inspectionNumber > 0 ? <span>
|
return record?.id && record?.inspectionNumber > 0 && record?.type !== 'servicePart' && record?.type !== 'district' ? <span>
|
||||||
<a style={{ color: record?.inspectionNumber === record?.allDay ? '' : 'red' }} onClick={() => {
|
<a style={{ color: record?.inspectionNumber === record?.allDay ? '' : 'red' }} onClick={() => {
|
||||||
setCurrentRow(record)
|
setCurrentRow(record)
|
||||||
setShowType(1)
|
// setShowType(1)
|
||||||
setShowDetail(true)
|
setShowDetail(true)
|
||||||
}}>
|
}}>
|
||||||
{record?.inspectionNumber || '-'}
|
{record?.inspectionNumber || '-'} / {record?.allDay}
|
||||||
</a> / {record?.allDay}
|
</a>
|
||||||
</span > : record?.allDay ? <span>
|
</span > : record?.allDay ? <span>
|
||||||
<span style={{ color: record?.inspectionNumber === record?.allDay ? '' : 'red' }}>{record?.inspectionNumber || '-'} </span>
|
<span style={{ color: record?.inspectionNumber === record?.allDay ? '' : 'red' }}>{record?.inspectionNumber || '-'} </span>
|
||||||
<span>/ {record?.allDay}</span>
|
<span>/ {record?.allDay}</span>
|
||||||
@ -101,14 +101,14 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>巡查完成率</div>,
|
title: <div style={{ textAlign: 'center' }}>巡查完成率(%)</div>,
|
||||||
dataIndex: "inspectionRate",
|
dataIndex: "inspectionRate",
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.inspectionRate ? record?.inspectionRate * 100 + '%' : ""
|
return record?.inspectionRate ? (record?.inspectionRate * 100).toFixed(2) : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -119,13 +119,17 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.template && record?.template.id && record?.normalNumber > 0 ? <a onClick={() => {
|
return record?.template && record?.template.id && record?.normalNumber > 0 ?
|
||||||
setCurrentRow(record)
|
<span>{record?.normalNumber || '-'}</span> : ""
|
||||||
setShowType(2)
|
|
||||||
setShowDetail(true)
|
// <a onClick={() => {
|
||||||
}}>
|
// setCurrentRow(record)
|
||||||
{record?.normalNumber || '-'}
|
// setShowType(2)
|
||||||
</a> : <span>{record?.normalNumber || '-'}</span>
|
// setShowDetail(true)
|
||||||
|
// }}>
|
||||||
|
// {record?.normalNumber || '-'}
|
||||||
|
// </a> : ''
|
||||||
|
// <span>{record?.normalNumber || '-'}</span>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -136,13 +140,16 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.template && record?.template.id && record?.errorNumber > 0 ? <a onClick={() => {
|
return record?.template && record?.template.id && record?.errorNumber > 0 ?
|
||||||
setCurrentRow(record)
|
<span>{record?.errorNumber || '-'}</span> : ""
|
||||||
setShowType(3)
|
|
||||||
setShowDetail(true)
|
// <a onClick={() => {
|
||||||
}}>
|
// setCurrentRow(record)
|
||||||
{record?.errorNumber || '-'}
|
// setShowType(3)
|
||||||
</a> : ""
|
// setShowDetail(true)
|
||||||
|
// }}>
|
||||||
|
// {record?.errorNumber || '-'}
|
||||||
|
// </a> : ""
|
||||||
// <span>{record?.errorNumber || '-'}</span>
|
// <span>{record?.errorNumber || '-'}</span>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -171,13 +178,15 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.template ? record?.template.errorStatus01 > 0 ? <a onClick={() => {
|
return record?.template && record?.template.errorStatus01 > 0 ?
|
||||||
setCurrentRow(record)
|
<span>{record?.template.errorStatus01 || '-'}</span> : ""
|
||||||
setShowType(5)
|
// <a onClick={() => {
|
||||||
setShowDetail(true)
|
// setCurrentRow(record)
|
||||||
}}>
|
// setShowType(5)
|
||||||
{record?.template.errorStatus01 || '-'}
|
// setShowDetail(true)
|
||||||
</a> : <span>{record?.template.errorStatus01 || '-'}</span> : ""
|
// }}>
|
||||||
|
// {record?.template.errorStatus01 || '-'}
|
||||||
|
// </a> : <span>{record?.template.errorStatus01 || '-'}</span> : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@ -211,29 +220,29 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>未完成率</div>,
|
title: <div style={{ textAlign: 'center' }}>未完成率(%)</div>,
|
||||||
dataIndex: "unfinishedRate",
|
dataIndex: "unfinishedRate",
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return record?.template && record?.template.unfinishedRate ? <span>{record?.template.unfinishedRate * 100}%</span> : "-"
|
return record?.template && record?.template.unfinishedRate ? <span>{(record?.template.unfinishedRate * 100).toFixed(2)}</span> : "-"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const drawerColumns: any = [
|
const drawerColumns: any = [
|
||||||
// {
|
{
|
||||||
// title: "巡查类型",
|
title: "巡查类型",
|
||||||
// dataIndex: "inspectionType",
|
dataIndex: "inspectionType",
|
||||||
// hideInTable: true,
|
hideInTable: true,
|
||||||
// valueType: "select",
|
valueType: "select",
|
||||||
// valueEnum: {
|
valueEnum: {
|
||||||
// "1": '异常',
|
"1": '异常',
|
||||||
// "0": "正常"
|
"0": "正常"
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>巡查时间</div>,
|
title: <div style={{ textAlign: 'center' }}>巡查时间</div>,
|
||||||
dataIndex: "createdAt",
|
dataIndex: "createdAt",
|
||||||
@ -291,6 +300,21 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
}</a> : ""
|
}</a> : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: <div style={{ textAlign: 'center' }}>现场图片</div>,
|
||||||
|
dataIndex: "placeName",
|
||||||
|
hideInSearch: true,
|
||||||
|
width: 150,
|
||||||
|
ellipsis: true,
|
||||||
|
align: 'center',
|
||||||
|
render: (_, record) => {
|
||||||
|
return record.imgsList && record.imgsList.length > 0 ?
|
||||||
|
<Button type="primary" onClick={() => {
|
||||||
|
setShowImgList(record.imgsList)
|
||||||
|
setImagePreviewVisible(true)
|
||||||
|
}}>查看附件</Button> : "-"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: <div style={{ textAlign: 'center' }}>巡查内容</div>,
|
title: <div style={{ textAlign: 'center' }}>巡查内容</div>,
|
||||||
dataIndex: "uploadResult",
|
dataIndex: "uploadResult",
|
||||||
@ -343,21 +367,7 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: <div style={{ textAlign: 'center' }}>现场图片</div>,
|
|
||||||
dataIndex: "placeName",
|
|
||||||
hideInSearch: true,
|
|
||||||
width: 150,
|
|
||||||
ellipsis: true,
|
|
||||||
align: 'center',
|
|
||||||
render: (_, record) => {
|
|
||||||
return record.imgsList && record.imgsList.length > 0 ?
|
|
||||||
<Button type="primary" onClick={() => {
|
|
||||||
setShowImgList(record.imgsList)
|
|
||||||
setImagePreviewVisible(true)
|
|
||||||
}}>查看附件</Button> : "-"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -542,7 +552,7 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
thirdItem.processingNumber = thirdItem.template.errorStatus1
|
thirdItem.processingNumber = thirdItem.template.errorStatus1
|
||||||
thirdItem.processedNumber = thirdItem.template.errorStatus2
|
thirdItem.processedNumber = thirdItem.template.errorStatus2
|
||||||
|
|
||||||
normalNumberSum += thirdItem.template.situation0
|
normalNumberSum = allDay
|
||||||
errorNumberSum += thirdItem.template.situation1
|
errorNumberSum += thirdItem.template.situation1
|
||||||
pendingProcessNumberSum += thirdItem.pendingProcessNumber
|
pendingProcessNumberSum += thirdItem.pendingProcessNumber
|
||||||
processingNumberSum += thirdItem.processingNumber
|
processingNumberSum += thirdItem.processingNumber
|
||||||
@ -560,7 +570,7 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
|
|
||||||
bigSuccessSum += Number(subItem.inspectionRate)
|
bigSuccessSum += Number(subItem.inspectionRate)
|
||||||
inspectionNumberItemSum += subItem.inspectionNumber
|
inspectionNumberItemSum += subItem.inspectionNumber
|
||||||
normalNumberItemSum += subItem.normalNumber
|
normalNumberItemSum = allDay
|
||||||
errorNumberItemSum += subItem.errorNumber
|
errorNumberItemSum += subItem.errorNumber
|
||||||
pendingProcessNumberItemSum += subItem.pendingProcessNumber
|
pendingProcessNumberItemSum += subItem.pendingProcessNumber
|
||||||
processingNumberItemSum += subItem.processingNumber
|
processingNumberItemSum += subItem.processingNumber
|
||||||
@ -651,9 +661,6 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}>考核记录管理</span>}
|
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}>考核记录管理</span>}
|
||||||
search={{ span: 6 }}
|
search={{ span: 6 }}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
|
|
||||||
console.log('searchParams', searchParams);
|
|
||||||
console.log('currentRow', currentRow);
|
|
||||||
if (!currentRow?.serverPartId) {
|
if (!currentRow?.serverPartId) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -665,59 +672,66 @@ const recordSummary: React.FC<{ currentUser: any }> = (props) => {
|
|||||||
serverPartIds: [currentRow?.serverPartId],
|
serverPartIds: [currentRow?.serverPartId],
|
||||||
startTime: searchParams?.startTime ? `${searchParams?.startTime}` : "",
|
startTime: searchParams?.startTime ? `${searchParams?.startTime}` : "",
|
||||||
endTime: searchParams?.endTime ? `${searchParams?.endTime}` : "",
|
endTime: searchParams?.endTime ? `${searchParams?.endTime}` : "",
|
||||||
extend: showType === 1 ? [
|
extend: params?.inspectionType ? [
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
|
||||||
] : showType === 2 ? [
|
|
||||||
{
|
{
|
||||||
key: "situation",
|
key: "situation",
|
||||||
value: 0,
|
value: params?.inspectionType
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
|
||||||
] : showType === 3 ? [
|
|
||||||
{
|
|
||||||
key: "situation",
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
|
||||||
] : showType === 4 ? [
|
|
||||||
{
|
|
||||||
key: "errorStatus",
|
|
||||||
value: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
|
||||||
] :
|
|
||||||
showType === 5 ? [
|
|
||||||
{
|
|
||||||
key: "errorStatus01",
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
|
||||||
] :
|
|
||||||
showType === 6 ? [
|
|
||||||
{
|
|
||||||
key: "errorStatus",
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "templateId",
|
|
||||||
value: currentRow?.template.id,
|
|
||||||
}
|
}
|
||||||
] : undefined
|
] : undefined
|
||||||
|
|
||||||
|
// showType === 1 ? [
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] : showType === 2 ? [
|
||||||
|
// {
|
||||||
|
// key: "situation",
|
||||||
|
// value: 0,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] : showType === 3 ? [
|
||||||
|
// {
|
||||||
|
// key: "situation",
|
||||||
|
// value: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] : showType === 4 ? [
|
||||||
|
// {
|
||||||
|
// key: "errorStatus",
|
||||||
|
// value: 0,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] :
|
||||||
|
// showType === 5 ? [
|
||||||
|
// {
|
||||||
|
// key: "errorStatus01",
|
||||||
|
// value: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] :
|
||||||
|
// showType === 6 ? [
|
||||||
|
// {
|
||||||
|
// key: "errorStatus",
|
||||||
|
// value: 2,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// key: "templateId",
|
||||||
|
// value: currentRow?.template.id,
|
||||||
|
// }
|
||||||
|
// ] : undefined
|
||||||
}
|
}
|
||||||
console.log('req', req);
|
console.log('req', req);
|
||||||
const data = await handleNewSummaryList(req)
|
const data = await handleNewSummaryList(req)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user