|
@@ -16,11 +16,26 @@ import {
|
|
|
OrderStatus,
|
|
|
OrderType,
|
|
|
} from '@/pages/TaskManage/constent';
|
|
|
-import { getDiagnosticDetail, getMandateDetail } from '@/services/TaskManage';
|
|
|
+import {
|
|
|
+ getDiagnosticDetail,
|
|
|
+ getMandateDetail,
|
|
|
+ withdrawOrderRequest,
|
|
|
+} from '@/services/TaskManage';
|
|
|
import { useLocation } from '@@/exports';
|
|
|
import { UpOutlined } from '@ant-design/icons';
|
|
|
import { connect, useRequest } from '@umijs/max';
|
|
|
-import { Col, Collapse, CollapseProps, Divider, Row, Table } from 'antd';
|
|
|
+import {
|
|
|
+ Col,
|
|
|
+ Collapse,
|
|
|
+ CollapseProps,
|
|
|
+ Divider,
|
|
|
+ Form,
|
|
|
+ Input,
|
|
|
+ Modal,
|
|
|
+ Row,
|
|
|
+ Table,
|
|
|
+ message,
|
|
|
+} from 'antd';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { useEffect, useState } from 'react';
|
|
@@ -50,6 +65,9 @@ function TaskDetail(props: IPropsType) {
|
|
|
CollapseProps['items']
|
|
|
>([]);
|
|
|
const [mandateTable, setMandateTable] = useState<IColumn[]>([]);
|
|
|
+ const [withdrawReason, setWithdrawReason] = useState('');
|
|
|
+ const [withdrawOrderOpen, setWithdrawOrderOpen] = useState(false);
|
|
|
+ const [clickedOrder, setClickedOrder] = useState({});
|
|
|
|
|
|
const columnDef: ColumnsType<IColumn> = [
|
|
|
{
|
|
@@ -156,24 +174,12 @@ function TaskDetail(props: IPropsType) {
|
|
|
<div className={styles.rightButtonContainer}>
|
|
|
<div
|
|
|
className={styles.rightButton}
|
|
|
- style={{ color: '#5697e4' }}
|
|
|
- onClick={() => {
|
|
|
- if (typeof record.RecordType === 'number') {
|
|
|
- return;
|
|
|
- }
|
|
|
- // @ts-ignore
|
|
|
- goTaskOrder(
|
|
|
- record.Id,
|
|
|
- record.RecordType?.value,
|
|
|
- tempMandate?.MandateClass.value,
|
|
|
- );
|
|
|
+ style={{
|
|
|
+ color: '#5697e4',
|
|
|
+ marginBottom: `${
|
|
|
+ record.Status.value === 0 ? '0.15rem' : '0'
|
|
|
+ }`,
|
|
|
}}
|
|
|
- >
|
|
|
- 查看工单
|
|
|
- </div>
|
|
|
- <div
|
|
|
- className={styles.rightButton}
|
|
|
- style={{ color: '#5697e4' }}
|
|
|
onClick={() => {
|
|
|
if (typeof record.RecordType === 'number') {
|
|
|
return;
|
|
@@ -186,8 +192,20 @@ function TaskDetail(props: IPropsType) {
|
|
|
);
|
|
|
}}
|
|
|
>
|
|
|
- 关闭工单
|
|
|
+ 查看
|
|
|
</div>
|
|
|
+ {record?.Status?.value === 0 && (
|
|
|
+ <div
|
|
|
+ className={styles.rightButton}
|
|
|
+ style={{ color: '#5697e4' }}
|
|
|
+ onClick={() => {
|
|
|
+ setWithdrawOrderOpen(true);
|
|
|
+ setClickedOrder(record);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 关闭
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
@@ -282,6 +300,24 @@ function TaskDetail(props: IPropsType) {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+ const withdrawOrderConfirm = async () => {
|
|
|
+ if (!withdrawReason) {
|
|
|
+ message.warning('请输入关闭理由');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await withdrawOrderRequest({
|
|
|
+ record_id: clickedOrder.Id,
|
|
|
+ note: withdrawReason,
|
|
|
+ type: clickedOrder.RecordType.value,
|
|
|
+ });
|
|
|
+ if (res.code === 200) {
|
|
|
+ message.success('关闭工单成功');
|
|
|
+ setClickedOrder({});
|
|
|
+ setWithdrawOrderOpen(false);
|
|
|
+ refreshDetail();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<PageContent closeable={false}>
|
|
|
<PageTitle returnable>任务详情</PageTitle>
|
|
@@ -411,6 +447,25 @@ function TaskDetail(props: IPropsType) {
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <Modal
|
|
|
+ className={styles.handleModal}
|
|
|
+ title="关闭工单"
|
|
|
+ open={withdrawOrderOpen}
|
|
|
+ onCancel={() => {
|
|
|
+ setWithdrawOrderOpen(false);
|
|
|
+ }}
|
|
|
+ onOk={withdrawOrderConfirm}
|
|
|
+ >
|
|
|
+ <Form>
|
|
|
+ <Form.Item label="关闭原因">
|
|
|
+ <Input
|
|
|
+ onChange={(e) => {
|
|
|
+ setWithdrawReason(e.target.value);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
</PageContent>
|
|
|
);
|
|
|
}
|