Browse Source

(+) 巡检报告web页面

master
liujiangyong 2 years ago
parent
commit
1e9366910a
  1. 2
      web/client/src/sections/patrolManage/actions/index.js
  2. 15
      web/client/src/sections/patrolManage/actions/report.js
  3. 3
      web/client/src/sections/patrolManage/containers/index.js
  4. 88
      web/client/src/sections/patrolManage/containers/patrolReport.js
  5. 3
      web/client/src/sections/patrolManage/nav-item.js
  6. 10
      web/client/src/sections/patrolManage/routes.js

2
web/client/src/sections/patrolManage/actions/index.js

@ -2,12 +2,14 @@
import * as plan from './plan'
import * as record from './record'
import * as report from './report'
import * as template from './template'
import * as checkItems from './checkItems'
export default {
...plan,
...record,
...report,
...template,
...checkItems,
}

15
web/client/src/sections/patrolManage/actions/report.js

@ -0,0 +1,15 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
// export function getPatrolReport (query) {
// return dispatch => basicAction({
// type: 'get',
// query,
// dispatch: dispatch,
// actionType: 'GET_PATROL_REPORT',
// url: ApiTable.getPatrolReport,
// msg: { error: '获取巡检报告失败' },
// });
// }

3
web/client/src/sections/patrolManage/containers/index.js

@ -2,7 +2,8 @@
import PatrolPlan from './patrolPlan';
import PatrolReocrd from './patrolRecord';
import PatrolReport from './patrolReport';
import CheckItems from './checkItems';
import PlanTemplate from './patrolTemplate';
export { PatrolPlan, PatrolReocrd, CheckItems, PlanTemplate };
export { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate };

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

@ -0,0 +1,88 @@
import React, { useState, useRef } from 'react';
import { connect } from 'react-redux';
import { Button } from 'antd';
import ProTable from '@ant-design/pro-table';
import { getCheckItems } from '../actions/checkItems';
function patrolReport(props) {
const { dispatch } = props;
const tableRef = useRef();
const [dataSource, setDataSource] = useState([{}]);
const columns = [{
title: '结构物名称',
dataIndex: 'name',
key: 'name',
ellipsis: true,
width: 150,
}, {
title: '巡检报告名称',
dataIndex: 'groupName',
key: 'groupName',
ellipsis: true,
search: false,
width: 250,
render: (_, record) => {
return <div>{record?.checkItemsGroup?.name}</div>
}
}, {
title: '巡检日期',
dataIndex: 'date',
key: 'date',
valueType: 'dateRange',
ellipsis: true,
width: 150,
render: (_, record) => {
return <div>{record?.checkItemsGroup?.name}</div>
}
}, {
title: '操作',
dataIndex: 'action',
key: 'action',
search: false,
width: 200,
render: (_, record) => {
return <>
<Button type="link" onClick={() => {
const qnDomain = localStorage.getItem('qnDomain');
window.open(`https://view.officeapps.live.com/op/view.aspx?src=${qnDomain}${'/project/8fe38891-59c5-4735-b3d9-d8d335fc28ee/test.docx'}`)
}}>预览</Button>
<Button type="link" onClick={() => { /* 下载 */ }}>下载</Button>
</>
},
}];
return (
<>
<ProTable
columns={columns}
actionRef={tableRef}
options={false}
dataSource={dataSource || []}
rowKey='id'
pagination={{ pageSize: 10 }}
request={async (params = {}) => {
// const res = await dispatch(getCheckItems({
// limit: params.pageSize,
// page: params.current - 1,
// name: params?.name
// }));
// setDataSource(res?.payload.data?.rows);
// return {
// ...res,
// total: res.payload.data.count ? res.payload.data.count : 0,
// };
}}
onReset={() => { }}
/>
</>
)
}
function mapStateToProps(state) {
const { auth } = state
return {
user: auth.user
}
}
export default connect(mapStateToProps)(patrolReport);

3
web/client/src/sections/patrolManage/nav-item.js

@ -17,6 +17,9 @@ export function getNavItem (user, dispatch) {
{Func.isAuthorized('PATROL_RECORD_VIEW') && <Menu.Item key="patrolRecord">
<Link to="/patrolManage/patrolRecord">巡检记录</Link>
</Menu.Item>}
{Func.isAuthorized('CHECKREPORT') && <Menu.Item key="patrolReport">
<Link to="/patrolManage/patrolReport">巡检报告</Link>
</Menu.Item>}
{Func.isAuthorized('CHECKITEMSET') && <Menu.Item key="checkItems">
<Link to="/patrolManage/checkItems">检查项设定</Link>
</Menu.Item>}

10
web/client/src/sections/patrolManage/routes.js

@ -1,5 +1,5 @@
'use strict';
import { PatrolPlan, PatrolReocrd, CheckItems, PlanTemplate } from './containers';
import { PatrolPlan, PatrolReocrd, PatrolReport, CheckItems, PlanTemplate } from './containers';
export default [{
type: 'inner',
@ -17,8 +17,12 @@ export default [{
key: 'patrolRecord',
component: PatrolReocrd,
breadcrumb: '巡检记录',
},
{
}, {
path: '/patrolReport',
key: 'patrolReport',
component: PatrolReport,
breadcrumb: '巡检报告',
}, {
path: '/checkItems',
key: 'checkItems',
component: CheckItems,

Loading…
Cancel
Save