|
@@ -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> = [
|
|
|
{
|
|
@@ -153,22 +171,41 @@ function TaskDetail(props: IPropsType) {
|
|
|
</Row>
|
|
|
</div>
|
|
|
<Divider type="vertical" style={{ height: '40px' }} />
|
|
|
- <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,
|
|
|
- );
|
|
|
- }}
|
|
|
- >
|
|
|
- 查看工单
|
|
|
+ <div className={styles.rightButtonContainer}>
|
|
|
+ <div
|
|
|
+ className={styles.rightButton}
|
|
|
+ style={{
|
|
|
+ color: '#5697e4',
|
|
|
+ marginBottom: `${
|
|
|
+ record.Status.value === 0 ? '0.15rem' : '0'
|
|
|
+ }`,
|
|
|
+ }}
|
|
|
+ onClick={() => {
|
|
|
+ if (typeof record.RecordType === 'number') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // @ts-ignore
|
|
|
+ goTaskOrder(
|
|
|
+ record.Id,
|
|
|
+ record.RecordType?.value,
|
|
|
+ tempMandate?.MandateClass.value,
|
|
|
+ );
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 查看
|
|
|
+ </div>
|
|
|
+ {record?.Status?.value === 0 && (
|
|
|
+ <div
|
|
|
+ className={styles.rightButton}
|
|
|
+ style={{ color: '#5697e4' }}
|
|
|
+ onClick={() => {
|
|
|
+ setWithdrawOrderOpen(true);
|
|
|
+ setClickedOrder(record);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 关闭
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
@@ -211,28 +248,30 @@ function TaskDetail(props: IPropsType) {
|
|
|
const dataSource = [];
|
|
|
dataSource.push({
|
|
|
detail: {
|
|
|
- text: mandateChild[0].Title,
|
|
|
+ text: `${mandateChild[0].Content}: ${mandateChild[0].Content}`,
|
|
|
key: 'title',
|
|
|
},
|
|
|
});
|
|
|
- dataSource.push(
|
|
|
- ...Object.entries(JSON.parse(mandateChild[0].Payload)).map(
|
|
|
- (item: any) => {
|
|
|
- const [key, value] = item;
|
|
|
- return {
|
|
|
- detail: {
|
|
|
- text:
|
|
|
- value['item_alias'] +
|
|
|
- ' 现有数值:' +
|
|
|
- value['old_value'] +
|
|
|
- ' 建议调整数值' +
|
|
|
- value['new_value'],
|
|
|
- key: key,
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- ),
|
|
|
- );
|
|
|
+ console.log(mandateChild[0]);
|
|
|
+
|
|
|
+ // dataSource.push(
|
|
|
+ // ...Object.entries(JSON.parse(mandateChild[0]?.Payload)).map(
|
|
|
+ // (item: any) => {
|
|
|
+ // const [key, value] = item;
|
|
|
+ // return {
|
|
|
+ // detail: {
|
|
|
+ // text:
|
|
|
+ // value['item_alias'] +
|
|
|
+ // ' 现有数值:' +
|
|
|
+ // value['old_value'] +
|
|
|
+ // ' 建议调整数值' +
|
|
|
+ // value['new_value'],
|
|
|
+ // key: key,
|
|
|
+ // },
|
|
|
+ // };
|
|
|
+ // },
|
|
|
+ // ),
|
|
|
+ // );
|
|
|
setMandateTable(dataSource);
|
|
|
return;
|
|
|
}
|
|
@@ -261,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>
|
|
@@ -390,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>
|
|
|
);
|
|
|
}
|