|
@@ -1,11 +1,10 @@
|
|
import PageContent from '@/components/PageContent';
|
|
import PageContent from '@/components/PageContent';
|
|
import PageTitle from '@/components/PageTitle';
|
|
import PageTitle from '@/components/PageTitle';
|
|
-import { UnityAction } from '@/utils/utils';
|
|
|
|
|
|
+import { GetTokenFromUrl, UnityAction } from '@/utils/utils';
|
|
import { connect, history, useParams } from '@umijs/max';
|
|
import { connect, history, useParams } from '@umijs/max';
|
|
import { Button, Col, DatePicker, Form, Row, Select, Table } from 'antd';
|
|
import { Button, Col, DatePicker, Form, Row, Select, Table } from 'antd';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import { Fragment, useEffect, useState } from 'react';
|
|
import { Fragment, useEffect, useState } from 'react';
|
|
-import style from './index.less';
|
|
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
const FormItem = Form.Item;
|
|
const { Option } = Select;
|
|
const { Option } = Select;
|
|
@@ -14,81 +13,16 @@ const statusList = [
|
|
{ key: 2, value: '1', label: '异常' },
|
|
{ key: 2, value: '1', label: '异常' },
|
|
];
|
|
];
|
|
|
|
|
|
-function PatrolArtificialRecord(props) {
|
|
|
|
|
|
+function List(props) {
|
|
const { loading, list, processList = [], dispatch } = props;
|
|
const { loading, list, processList = [], dispatch } = props;
|
|
|
|
|
|
const { projectId } = useParams();
|
|
const { projectId } = useParams();
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
const [pagination, setPagination] = useState({ pageSize: 10, current: 1 });
|
|
const [pagination, setPagination] = useState({ pageSize: 10, current: 1 });
|
|
const [groupId, setGroupId] = useState('');
|
|
const [groupId, setGroupId] = useState('');
|
|
- const [rowId, setRowId] = useState();
|
|
|
|
|
|
|
|
const getColumns = () => {
|
|
const getColumns = () => {
|
|
- var arr = [
|
|
|
|
- {
|
|
|
|
- title: '巡检时间',
|
|
|
|
- dataIndex: 'CreatedTime',
|
|
|
|
- width: '26%',
|
|
|
|
- render: (text) => {
|
|
|
|
- return text ? dayjs(text).format('YYYY-MM-DD HH:mm') : null;
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '巡检路线',
|
|
|
|
- dataIndex: 'RouteInfo',
|
|
|
|
- width: '24%',
|
|
|
|
- render: (record) => {
|
|
|
|
- return record.Name;
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '工艺段',
|
|
|
|
- // dataIndex: 'RouteInfo',
|
|
|
|
- width: '24%',
|
|
|
|
- render: (record) => {
|
|
|
|
- // GroupID
|
|
|
|
- const name = processList?.find(
|
|
|
|
- (item) => item.group_id == record?.RouteInfo?.GroupID,
|
|
|
|
- )?.name;
|
|
|
|
- return name || '-';
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '状态',
|
|
|
|
- width: '10%',
|
|
|
|
- dataIndex: 'Status',
|
|
|
|
- render: (text) => {
|
|
|
|
- return text == 0 ? (
|
|
|
|
- '正常'
|
|
|
|
- ) : (
|
|
|
|
- <div style={{ color: '#FF8600' }}>异常</div>
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
- arr.push({
|
|
|
|
- title: '操作',
|
|
|
|
- width: '16%',
|
|
|
|
- render: (text, record) => {
|
|
|
|
- return (
|
|
|
|
- <Fragment>
|
|
|
|
- {
|
|
|
|
- <>
|
|
|
|
- <a
|
|
|
|
- style={{ color: '#7BFFFB' }}
|
|
|
|
- onClick={(e) => {
|
|
|
|
- goToDetail(record, e);
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- 详情
|
|
|
|
- </a>
|
|
|
|
- </>
|
|
|
|
- }
|
|
|
|
- </Fragment>
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- arr = [
|
|
|
|
|
|
+ return [
|
|
{
|
|
{
|
|
title: '自检时间',
|
|
title: '自检时间',
|
|
dataIndex: 'CreatedTime',
|
|
dataIndex: 'CreatedTime',
|
|
@@ -99,10 +33,8 @@ function PatrolArtificialRecord(props) {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '工艺段',
|
|
title: '工艺段',
|
|
- // dataIndex: 'RouteInfo',
|
|
|
|
width: '24%',
|
|
width: '24%',
|
|
render: (record) => {
|
|
render: (record) => {
|
|
- // GroupID
|
|
|
|
const name = processList?.find(
|
|
const name = processList?.find(
|
|
(item) => item.group_id == record?.RouteInfo?.GroupID,
|
|
(item) => item.group_id == record?.RouteInfo?.GroupID,
|
|
)?.name;
|
|
)?.name;
|
|
@@ -130,7 +62,6 @@ function PatrolArtificialRecord(props) {
|
|
{
|
|
{
|
|
<>
|
|
<>
|
|
<a
|
|
<a
|
|
- style={{ color: '#7BFFFB' }}
|
|
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
goToDetail(record, e);
|
|
goToDetail(record, e);
|
|
}}
|
|
}}
|
|
@@ -144,13 +75,10 @@ function PatrolArtificialRecord(props) {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
];
|
|
- return arr;
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- const getRecord = (pagination) => {
|
|
|
|
- setRowId(null);
|
|
|
|
- form.validateFields((err, fieldsValue) => {
|
|
|
|
- if (err) return;
|
|
|
|
|
|
+ const getRecord = async (pagination) => {
|
|
|
|
+ form.validateFields().then((fieldsValue) => {
|
|
fieldsValue.projectId = projectId;
|
|
fieldsValue.projectId = projectId;
|
|
fieldsValue.auto = 1;
|
|
fieldsValue.auto = 1;
|
|
fieldsValue.startDate = dayjs(fieldsValue.startDate).format('YYYY-MM-DD');
|
|
fieldsValue.startDate = dayjs(fieldsValue.startDate).format('YYYY-MM-DD');
|
|
@@ -178,23 +106,9 @@ function PatrolArtificialRecord(props) {
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
UnityAction.sendMsg('reportDetail', '');
|
|
UnityAction.sendMsg('reportDetail', '');
|
|
history.push(
|
|
history.push(
|
|
- `/unity/eq-self-ins-statistics/detail/${projectId}/${record.Id}?JWT-TOKEN=`,
|
|
|
|
|
|
+ `/self-inspection/detail/${projectId}/${record.Id}?JWT-TOKEN=${GetTokenFromUrl()}`,
|
|
);
|
|
);
|
|
};
|
|
};
|
|
- const setRowClassName = (record) => {
|
|
|
|
- return record.Id === rowId ? style.clickRow : '';
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const onRowClick = (event, record) => {
|
|
|
|
- setRowId(record.Id);
|
|
|
|
- dispatch({
|
|
|
|
- type: 'patrolArtificialRecord/queryPatrolRecord',
|
|
|
|
- payload: { recordId: record.Id },
|
|
|
|
- callback: (data) => {
|
|
|
|
- UnityAction.sendMsg('recordData', data);
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
UnityAction.sendMsg('type', 2);
|
|
UnityAction.sendMsg('type', 2);
|
|
@@ -218,8 +132,8 @@ function PatrolArtificialRecord(props) {
|
|
};
|
|
};
|
|
}, []);
|
|
}, []);
|
|
return (
|
|
return (
|
|
- <PageContent>
|
|
|
|
- <PageTitle></PageTitle>
|
|
|
|
|
|
+ <PageContent closeable={false}>
|
|
|
|
+ <PageTitle returnable>自检记录</PageTitle>
|
|
<Form
|
|
<Form
|
|
layout="vertical"
|
|
layout="vertical"
|
|
labelAlign="left"
|
|
labelAlign="left"
|
|
@@ -306,14 +220,6 @@ function PatrolArtificialRecord(props) {
|
|
})}
|
|
})}
|
|
pagination={pagination}
|
|
pagination={pagination}
|
|
onChange={TableOnChange}
|
|
onChange={TableOnChange}
|
|
- onRow={(record) => {
|
|
|
|
- return {
|
|
|
|
- onClick: (event) => {
|
|
|
|
- onRowClick(event, record);
|
|
|
|
- }, // 点击行
|
|
|
|
- };
|
|
|
|
- }}
|
|
|
|
- rowClassName={setRowClassName}
|
|
|
|
/>
|
|
/>
|
|
</PageContent>
|
|
</PageContent>
|
|
);
|
|
);
|
|
@@ -324,4 +230,4 @@ export default connect(({ patrolArtificialRecord, loading }) => ({
|
|
routeInfoList: patrolArtificialRecord.routeInfoList,
|
|
routeInfoList: patrolArtificialRecord.routeInfoList,
|
|
loading: loading.models.patrolArtificialRecord,
|
|
loading: loading.models.patrolArtificialRecord,
|
|
processList: patrolArtificialRecord.processList,
|
|
processList: patrolArtificialRecord.processList,
|
|
-}))(PatrolArtificialRecord);
|
|
|
|
|
|
+}))(List);
|