|
@@ -7,11 +7,12 @@ import {
|
|
getCraftRecordList,
|
|
getCraftRecordList,
|
|
getMaintainRecordList,
|
|
getMaintainRecordList,
|
|
getRepairRecordList,
|
|
getRepairRecordList,
|
|
|
|
+ getWorkOrderFlow,
|
|
queryReagentDetail,
|
|
queryReagentDetail,
|
|
} from '@/services/TaskManage';
|
|
} from '@/services/TaskManage';
|
|
import { useLocation } from '@@/exports';
|
|
import { useLocation } from '@@/exports';
|
|
import { connect, useRequest } from '@umijs/max';
|
|
import { connect, useRequest } from '@umijs/max';
|
|
-import { Col, Row } from 'antd';
|
|
|
|
|
|
+import { Col, Row, Steps } from 'antd';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import { DefaultOptionType } from 'rc-select/es/Select';
|
|
import { DefaultOptionType } from 'rc-select/es/Select';
|
|
import React, { useEffect, useState } from 'react';
|
|
import React, { useEffect, useState } from 'react';
|
|
@@ -42,6 +43,11 @@ interface IOrderInfo {
|
|
MandateImages?: any[];
|
|
MandateImages?: any[];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+interface IStepInfo {
|
|
|
|
+ content: string;
|
|
|
|
+ time: string;
|
|
|
|
+}
|
|
|
|
+
|
|
const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
const { userList, dispatch } = props;
|
|
const { userList, dispatch } = props;
|
|
|
|
|
|
@@ -50,10 +56,11 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
const project_id = Number(queryParams.get('project_id'));
|
|
const project_id = Number(queryParams.get('project_id'));
|
|
const order_id = Number(queryParams.get('order_id'));
|
|
const order_id = Number(queryParams.get('order_id'));
|
|
const order_type = Number(queryParams.get('order_type'));
|
|
const order_type = Number(queryParams.get('order_type'));
|
|
- const mandate_class = Number(queryParams.get('mandate_class'));
|
|
|
|
|
|
+ // const mandate_class = Number(queryParams.get('mandate_class'));
|
|
|
|
|
|
const [orderInfo, setOrderInfo] = useState<IOrderInfo>();
|
|
const [orderInfo, setOrderInfo] = useState<IOrderInfo>();
|
|
const [additionalInfo, setAdditionalInfo] = useState<any>({});
|
|
const [additionalInfo, setAdditionalInfo] = useState<any>({});
|
|
|
|
+ const [stepInfo, setStepInfo] = useState<IStepInfo[]>();
|
|
|
|
|
|
// 根据type请求详情
|
|
// 根据type请求详情
|
|
const { run: getMaintainDetail } = useRequest(getMaintainRecordList, {
|
|
const { run: getMaintainDetail } = useRequest(getMaintainRecordList, {
|
|
@@ -61,9 +68,15 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
formatResult: (result) => {
|
|
formatResult: (result) => {
|
|
const temp = result.data.list[0];
|
|
const temp = result.data.list[0];
|
|
const tempDetail = {
|
|
const tempDetail = {
|
|
- CreateTime: dayjs(temp.CreateTime).format('YYYY-MM-DD HH:mm'),
|
|
|
|
- PlanTime: dayjs(temp.PlanTime).format('YYYY-MM-DD HH:mm'),
|
|
|
|
- RepairTime: dayjs(temp.RepairTime).format('YYYY-MM-DD HH:mm') || '-',
|
|
|
|
|
|
+ CreateTime: temp?.CreateTime
|
|
|
|
+ ? dayjs(temp?.CreateTime).format('YYYY-MM-DD HH:mm')
|
|
|
|
+ : '-',
|
|
|
|
+ PlanTime: temp?.PlanTime
|
|
|
|
+ ? dayjs(temp.PlanTime).format('YYYY-MM-DD HH:mm')
|
|
|
|
+ : '-',
|
|
|
|
+ RepairTime: temp?.RepairTime
|
|
|
|
+ ? dayjs(temp.RepairTime).format('YYYY-MM-DD HH:mm')
|
|
|
|
+ : '-',
|
|
Reason: temp.Note,
|
|
Reason: temp.Note,
|
|
Lubrication: temp.Lubrication,
|
|
Lubrication: temp.Lubrication,
|
|
Fasten: temp.Fasten,
|
|
Fasten: temp.Fasten,
|
|
@@ -82,7 +95,6 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
MandateImages:
|
|
MandateImages:
|
|
temp?.mandate_images?.length > 0
|
|
temp?.mandate_images?.length > 0
|
|
? temp.mandate_images.map((item: any) => {
|
|
? temp.mandate_images.map((item: any) => {
|
|
- console.log(item);
|
|
|
|
if (item.type === 2) {
|
|
if (item.type === 2) {
|
|
return {
|
|
return {
|
|
src: item.val,
|
|
src: item.val,
|
|
@@ -141,31 +153,6 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
- const renderReason = (detail: any) => {
|
|
|
|
- const title = detail.match(/^(.*?)(?=\{)/g)[0];
|
|
|
|
- const content = JSON.parse(detail.match(/\{.*\}/g)[0]);
|
|
|
|
- console.log(content, title);
|
|
|
|
- console.log(Object.values(content));
|
|
|
|
- const result = [];
|
|
|
|
- result.push(
|
|
|
|
- <Row className={[styles.fontS28, styles.rowMargin].join(' ')}>
|
|
|
|
- {title}
|
|
|
|
- </Row>,
|
|
|
|
- );
|
|
|
|
- Object.values(content).forEach((item: any) => {
|
|
|
|
- result.push(
|
|
|
|
- <Row className={[styles.fontS28, styles.rowMargin].join(' ')}>
|
|
|
|
- {item['item_alias'] +
|
|
|
|
- ' 现有数值:' +
|
|
|
|
- item['old_value'] +
|
|
|
|
- ' 建议调整数值' +
|
|
|
|
- item['new_value']}
|
|
|
|
- </Row>,
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
- return result;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
// 根据type请求详情
|
|
// 根据type请求详情
|
|
const { run: getCraftDetail } = useRequest(getCraftRecordList, {
|
|
const { run: getCraftDetail } = useRequest(getCraftRecordList, {
|
|
manual: true,
|
|
manual: true,
|
|
@@ -178,7 +165,7 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
(temp.actual_end_time &&
|
|
(temp.actual_end_time &&
|
|
dayjs(temp.actual_end_time).format('YYYY-MM-DD HH:mm')) ||
|
|
dayjs(temp.actual_end_time).format('YYYY-MM-DD HH:mm')) ||
|
|
'-',
|
|
'-',
|
|
- Reason: mandate_class !== 2 ? temp.detail : renderReason(temp.detail),
|
|
|
|
|
|
+ Reason: temp.detail,
|
|
Repairman: userList.find((item) => item.ID === temp.checker_id) || '-',
|
|
Repairman: userList.find((item) => item.ID === temp.checker_id) || '-',
|
|
DispatchMan:
|
|
DispatchMan:
|
|
userList.find((item) => item.ID === temp.operator_id) || '-',
|
|
userList.find((item) => item.ID === temp.operator_id) || '-',
|
|
@@ -212,6 +199,17 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // 获取工单流程信息
|
|
|
|
+ const { run: getOrderFlow } = useRequest(getWorkOrderFlow, {
|
|
|
|
+ // manual: true,
|
|
|
|
+ defaultParams: [{ work_type: order_type, work_id: order_id }],
|
|
|
|
+ formatResult(res: IStepInfo[]) {
|
|
|
|
+ if (res && res?.length) {
|
|
|
|
+ setStepInfo(res);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (userList.length === 0) {
|
|
if (userList.length === 0) {
|
|
dispatch({
|
|
dispatch({
|
|
@@ -237,11 +235,6 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
}
|
|
}
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
- const image = [];
|
|
|
|
- // JSON.parse(
|
|
|
|
- // '[{"name":"1694762306412_Screenshot_20230815_180902_uni.UNI7E61B21.jpg","path":"work_order_files/1694762306412_Screenshot_20230815_180902_uni.UNI7E61B21.jpg","created_time":"2023-09-15 15:18:29","url":"https://water-service-test.oss-cn-hangzhou.aliyuncs.com/work_order_files/1694762306412_Screenshot_20230815_180902_uni.UNI7E61B21.jpg"},{"name":"1694762306230_Screenshot_20230815_180907_uni.UNI7E61B21.jpg","path":"work_order_files/1694762306230_Screenshot_20230815_180907_uni.UNI7E61B21.jpg","created_time":"2023-09-15 15:18:29","url":"https://water-service-test.oss-cn-hangzhou.aliyuncs.com/work_order_files/1694762306230_Screenshot_20230815_180907_uni.UNI7E61B21.jpg"}]',
|
|
|
|
- // );
|
|
|
|
-
|
|
|
|
const renderImg = () => {
|
|
const renderImg = () => {
|
|
return (
|
|
return (
|
|
<PhotoProvider>
|
|
<PhotoProvider>
|
|
@@ -277,24 +270,24 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
/>
|
|
/>
|
|
<div style={{ padding: '15px', letterSpacing: '1.5px' }}>
|
|
<div style={{ padding: '15px', letterSpacing: '1.5px' }}>
|
|
<Row className={styles.rowMargin}>
|
|
<Row className={styles.rowMargin}>
|
|
- <Col className={styles.fontS28} span={16}>
|
|
|
|
- {/*// @ts-ignore*/}
|
|
|
|
|
|
+ <Col className={styles.fontS28} span={15}>
|
|
|
|
+ {/* @ts-ignore */}
|
|
工单类型:
|
|
工单类型:
|
|
{OrderType.find((item) => item.value === order_type)?.label ||
|
|
{OrderType.find((item) => item.value === order_type)?.label ||
|
|
'-'}
|
|
'-'}
|
|
</Col>
|
|
</Col>
|
|
- <Col className={styles.fontS28} span={8}>
|
|
|
|
- {/*// @ts-ignore*/}
|
|
|
|
|
|
+ <Col className={styles.fontS28} span={9}>
|
|
|
|
+ {/* @ts-ignore */}
|
|
工单负责人:{orderInfo?.Repairman?.CName || '-'}
|
|
工单负责人:{orderInfo?.Repairman?.CName || '-'}
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
<Row className={styles.rowMargin}>
|
|
<Row className={styles.rowMargin}>
|
|
- <Col className={styles.fontS28} span={16}>
|
|
|
|
- {/*// @ts-ignore*/}
|
|
|
|
|
|
+ <Col className={styles.fontS28} span={15}>
|
|
|
|
+ {/* @ts-ignore */}
|
|
工单状态:{orderInfo?.OrderStatus?.label}
|
|
工单状态:{orderInfo?.OrderStatus?.label}
|
|
</Col>
|
|
</Col>
|
|
- <Col className={styles.fontS28} span={8}>
|
|
|
|
- {/*// @ts-ignore*/}
|
|
|
|
|
|
+ <Col className={styles.fontS28} span={9}>
|
|
|
|
+ {/* @ts-ignore */}
|
|
派单人员:{orderInfo?.DispatchMan?.CName}
|
|
派单人员:{orderInfo?.DispatchMan?.CName}
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
@@ -327,6 +320,7 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
)}
|
|
)}
|
|
|
|
+ {/* @ts-ignore */}
|
|
{orderInfo?.MandateImages?.length > 0 && (
|
|
{orderInfo?.MandateImages?.length > 0 && (
|
|
<Row className={styles.rowMarginTop}>
|
|
<Row className={styles.rowMarginTop}>
|
|
<Col className={styles.fontS28}>任务图片:</Col>
|
|
<Col className={styles.fontS28}>任务图片:</Col>
|
|
@@ -364,35 +358,29 @@ const TaskOrder: React.FC<IPropsType> = (props) => {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
)}
|
|
-
|
|
|
|
- {/*<div>*/}
|
|
|
|
- {/* <SubTitle title="工单流程" />*/}
|
|
|
|
- {/* <div style={{ padding: '15px' }}>*/}
|
|
|
|
- {/* <Steps*/}
|
|
|
|
- {/* direction="vertical"*/}
|
|
|
|
- {/* style={{ fontSize: '14px' }}*/}
|
|
|
|
- {/* current={1}*/}
|
|
|
|
- {/* items={[*/}
|
|
|
|
- {/* {*/}
|
|
|
|
- {/* title: '工单已派遣至值班人员张**',*/}
|
|
|
|
- {/* description: '2023-08-02 13:23',*/}
|
|
|
|
- {/* },*/}
|
|
|
|
- {/* {*/}
|
|
|
|
- {/* title: '张**接收工单',*/}
|
|
|
|
- {/* description: '2023-08-02 13:23',*/}
|
|
|
|
- {/* },*/}
|
|
|
|
- {/* {*/}
|
|
|
|
- {/* title: '张**提交处理结果',*/}
|
|
|
|
- {/* description: '2023-08-02 13:23',*/}
|
|
|
|
- {/* },*/}
|
|
|
|
- {/* {*/}
|
|
|
|
- {/* title: '工单审批通过',*/}
|
|
|
|
- {/* description: '2023-08-02 13:23',*/}
|
|
|
|
- {/* },*/}
|
|
|
|
- {/* ]}*/}
|
|
|
|
- {/* />*/}
|
|
|
|
- {/* </div>*/}
|
|
|
|
- {/*</div>*/}
|
|
|
|
|
|
+ {/* @ts-ignore */}
|
|
|
|
+ {stepInfo?.length > 0 && (
|
|
|
|
+ <div>
|
|
|
|
+ <SubTitle title="工单流程" />
|
|
|
|
+ <div style={{ padding: '15px 20px' }}>
|
|
|
|
+ <Steps
|
|
|
|
+ direction="vertical"
|
|
|
|
+ current={stepInfo?.length ? stepInfo.length - 1 : 0}
|
|
|
|
+ progressDot
|
|
|
|
+ items={stepInfo?.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ title: (
|
|
|
|
+ <span className={styles.fontS24}>{item.content}</span>
|
|
|
|
+ ),
|
|
|
|
+ description: (
|
|
|
|
+ <span className={styles.fontS20}>{item.time}</span>
|
|
|
|
+ ),
|
|
|
|
+ };
|
|
|
|
+ })}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ )}
|
|
</div>
|
|
</div>
|
|
</PageContent>
|
|
</PageContent>
|
|
);
|
|
);
|