|
@@ -1,9 +1,9 @@
|
|
|
-import React, { useState, useEffect } from 'react';
|
|
|
-import { Form, Input, Select, Button, Card, Descriptions, Tag, message, Spin } from 'antd';
|
|
|
-import { useParams, useNavigate, useLocation } from 'react-router-dom';
|
|
|
-import { ArrowLeftOutlined } from '@ant-design/icons';
|
|
|
-import { autoAccessTasksApi } from '../services/api';
|
|
|
-import moment from 'moment';
|
|
|
+import React, { useState, useEffect } from "react";
|
|
|
+import { Form, Input, Select, Button, Card, Descriptions, Tag, message, Spin } from "antd";
|
|
|
+import { useParams, useNavigate, useLocation } from "react-router-dom";
|
|
|
+import { ArrowLeftOutlined } from "@ant-design/icons";
|
|
|
+import { autoAccessTasksApi } from "../services/api";
|
|
|
+import moment from "moment";
|
|
|
|
|
|
const { TextArea } = Input;
|
|
|
const { Option } = Select;
|
|
@@ -16,35 +16,35 @@ const AutoAccessTaskDetail = () => {
|
|
|
const { id } = useParams();
|
|
|
const navigate = useNavigate();
|
|
|
const location = useLocation();
|
|
|
- const isEditMode = location.search.includes('mode=edit');
|
|
|
+ const isEditMode = location.search.includes("mode=edit");
|
|
|
|
|
|
const getStatusColor = (status) => {
|
|
|
const statusMap = {
|
|
|
- '0': 'processing',
|
|
|
- '1': 'warning',
|
|
|
- '2': 'success',
|
|
|
- '3': 'error',
|
|
|
- '4': 'error',
|
|
|
+ 0: "processing",
|
|
|
+ 1: "warning",
|
|
|
+ 2: "success",
|
|
|
+ 3: "error",
|
|
|
+ 4: "error",
|
|
|
};
|
|
|
- return statusMap[status] || 'default';
|
|
|
+ return statusMap[status] || "default";
|
|
|
};
|
|
|
|
|
|
const getStatusText = (status) => {
|
|
|
const statusMap = {
|
|
|
- '0': '待处理',
|
|
|
- '1': '处理中',
|
|
|
- '2': '已完成',
|
|
|
- '3': '失败',
|
|
|
- '4': '异常',
|
|
|
+ 0: "待处理",
|
|
|
+ 1: "处理中",
|
|
|
+ 2: "已完成",
|
|
|
+ 3: "失败",
|
|
|
+ 4: "异常",
|
|
|
};
|
|
|
- return statusMap[status] || '未知';
|
|
|
+ return statusMap[status] || "未知";
|
|
|
};
|
|
|
|
|
|
const getAccessTypeText = (type) => {
|
|
|
const typeMap = {
|
|
|
- 'api_no_crack': 'API无破解',
|
|
|
- 'api_crack': 'API破解',
|
|
|
- 'browser_auto_operate': '浏览器自动操作',
|
|
|
+ api_no_crack: "API无破解",
|
|
|
+ api_crack: "API破解",
|
|
|
+ browser_auto_operate: "浏览器自动操作",
|
|
|
};
|
|
|
return typeMap[type] || type;
|
|
|
};
|
|
@@ -55,7 +55,7 @@ const AutoAccessTaskDetail = () => {
|
|
|
setData(response.data);
|
|
|
form.setFieldsValue(response.data);
|
|
|
} catch (error) {
|
|
|
- message.error('获取详情失败');
|
|
|
+ message.error("获取详情失败");
|
|
|
} finally {
|
|
|
setLoading(false);
|
|
|
}
|
|
@@ -65,10 +65,10 @@ const AutoAccessTaskDetail = () => {
|
|
|
setSaving(true);
|
|
|
try {
|
|
|
await autoAccessTasksApi.update(id, values);
|
|
|
- message.success('更新成功');
|
|
|
- navigate('/auto-access-tasks');
|
|
|
+ message.success("更新成功");
|
|
|
+ navigate("/auto-access-tasks");
|
|
|
} catch (error) {
|
|
|
- message.error('更新失败');
|
|
|
+ message.error("更新失败");
|
|
|
} finally {
|
|
|
setSaving(false);
|
|
|
}
|
|
@@ -80,7 +80,7 @@ const AutoAccessTaskDetail = () => {
|
|
|
|
|
|
if (loading) {
|
|
|
return (
|
|
|
- <div style={{ textAlign: 'center', padding: '50px' }}>
|
|
|
+ <div style={{ textAlign: "center", padding: "50px" }}>
|
|
|
<Spin size="large" />
|
|
|
</div>
|
|
|
);
|
|
@@ -94,14 +94,17 @@ const AutoAccessTaskDetail = () => {
|
|
|
<div className="detail-container">
|
|
|
<Button
|
|
|
icon={<ArrowLeftOutlined />}
|
|
|
- onClick={() => navigate('/auto-access-tasks')}
|
|
|
+ onClick={() => navigate("/auto-access-tasks")}
|
|
|
style={{ marginBottom: 16 }}
|
|
|
>
|
|
|
返回列表
|
|
|
</Button>
|
|
|
|
|
|
{isEditMode ? (
|
|
|
- <Card title="编辑自动接入任务" style={{ marginBottom: 24 }}>
|
|
|
+ <Card
|
|
|
+ title="编辑自动接入任务"
|
|
|
+ style={{ marginBottom: 24 }}
|
|
|
+ >
|
|
|
<Form
|
|
|
form={form}
|
|
|
layout="vertical"
|
|
@@ -118,7 +121,7 @@ const AutoAccessTaskDetail = () => {
|
|
|
<Form.Item
|
|
|
label="工具名称"
|
|
|
name="tools_name"
|
|
|
- rules={[{ required: true, message: '请输入工具名称' }]}
|
|
|
+ rules={[{ required: true, message: "请输入工具名称" }]}
|
|
|
>
|
|
|
<Input />
|
|
|
</Form.Item>
|
|
@@ -126,7 +129,7 @@ const AutoAccessTaskDetail = () => {
|
|
|
<Form.Item
|
|
|
label="工具功能名称"
|
|
|
name="tools_function_name"
|
|
|
- rules={[{ required: true, message: '请输入工具功能名称' }]}
|
|
|
+ rules={[{ required: true, message: "请输入工具功能名称" }]}
|
|
|
>
|
|
|
<Input />
|
|
|
</Form.Item>
|
|
@@ -134,7 +137,7 @@ const AutoAccessTaskDetail = () => {
|
|
|
<Form.Item
|
|
|
label="接入方式"
|
|
|
name="access_type"
|
|
|
- rules={[{ required: true, message: '请选择接入方式' }]}
|
|
|
+ rules={[{ required: true, message: "请选择接入方式" }]}
|
|
|
>
|
|
|
<Select>
|
|
|
<Option value="api_no_crack">API无破解</Option>
|
|
@@ -181,14 +184,14 @@ const AutoAccessTaskDetail = () => {
|
|
|
<Form.Item
|
|
|
label="状态"
|
|
|
name="status"
|
|
|
- rules={[{ required: true, message: '请选择状态' }]}
|
|
|
+ rules={[{ required: true, message: "请选择状态" }]}
|
|
|
>
|
|
|
<Select>
|
|
|
- <Option value="0">待处理</Option>
|
|
|
- <Option value="1">处理中</Option>
|
|
|
- <Option value="2">已完成</Option>
|
|
|
- <Option value="3">失败</Option>
|
|
|
- <Option value="4">异常</Option>
|
|
|
+ <Option value={0}>待处理</Option>
|
|
|
+ <Option value={1}>处理中</Option>
|
|
|
+ <Option value={2}>已完成</Option>
|
|
|
+ <Option value={3}>失败</Option>
|
|
|
+ <Option value={4}>异常</Option>
|
|
|
</Select>
|
|
|
</Form.Item>
|
|
|
|
|
@@ -200,10 +203,12 @@ const AutoAccessTaskDetail = () => {
|
|
|
</Form.Item>
|
|
|
|
|
|
<div className="button-group">
|
|
|
- <Button onClick={() => navigate('/auto-access-tasks')}>
|
|
|
- 取消
|
|
|
- </Button>
|
|
|
- <Button type="primary" htmlType="submit" loading={saving}>
|
|
|
+ <Button onClick={() => navigate("/auto-access-tasks")}>取消</Button>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ htmlType="submit"
|
|
|
+ loading={saving}
|
|
|
+ >
|
|
|
保存
|
|
|
</Button>
|
|
|
</div>
|
|
@@ -211,62 +216,67 @@ const AutoAccessTaskDetail = () => {
|
|
|
</Card>
|
|
|
) : (
|
|
|
<Card title="自动接入任务详情">
|
|
|
- <Descriptions column={2} bordered>
|
|
|
- <Descriptions.Item label="接入任务ID">
|
|
|
- {data.access_task_id}
|
|
|
- </Descriptions.Item>
|
|
|
- <Descriptions.Item label="检索任务ID">
|
|
|
- {data.search_task_id}
|
|
|
- </Descriptions.Item>
|
|
|
- <Descriptions.Item label="工具名称">
|
|
|
- {data.tools_name}
|
|
|
- </Descriptions.Item>
|
|
|
- <Descriptions.Item label="工具功能名称">
|
|
|
- {data.tools_function_name}
|
|
|
- </Descriptions.Item>
|
|
|
+ <Descriptions
|
|
|
+ column={2}
|
|
|
+ bordered
|
|
|
+ >
|
|
|
+ <Descriptions.Item label="接入任务ID">{data.access_task_id}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="检索任务ID">{data.search_task_id}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="工具名称">{data.tools_name}</Descriptions.Item>
|
|
|
+ <Descriptions.Item label="工具功能名称">{data.tools_function_name}</Descriptions.Item>
|
|
|
<Descriptions.Item label="接入方式">
|
|
|
<Tag color="blue">{getAccessTypeText(data.access_type)}</Tag>
|
|
|
</Descriptions.Item>
|
|
|
<Descriptions.Item label="状态">
|
|
|
- <Tag color={getStatusColor(data.status)}>
|
|
|
- {getStatusText(data.status)}
|
|
|
- </Tag>
|
|
|
+ <Tag color={getStatusColor(data.status)}>{getStatusText(data.status)}</Tag>
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="工具功能描述" span={2}>
|
|
|
+ <Descriptions.Item
|
|
|
+ label="工具功能描述"
|
|
|
+ span={2}
|
|
|
+ >
|
|
|
{data.tools_function_desc}
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="API文档" span={2}>
|
|
|
- <div style={{ maxHeight: '200px', overflow: 'auto' }}>
|
|
|
- <pre style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
|
|
|
- {data.api_doc || '无'}
|
|
|
- </pre>
|
|
|
+ <Descriptions.Item
|
|
|
+ label="API文档"
|
|
|
+ span={2}
|
|
|
+ >
|
|
|
+ <div style={{ maxHeight: "200px", overflow: "auto" }}>
|
|
|
+ <pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}>{data.api_doc || "无"}</pre>
|
|
|
</div>
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="API类名">
|
|
|
- {data.api_class_name}
|
|
|
- </Descriptions.Item>
|
|
|
+ <Descriptions.Item label="API类名">{data.api_class_name}</Descriptions.Item>
|
|
|
<Descriptions.Item label="源内容链接">
|
|
|
{data.origin_content_link ? (
|
|
|
- <a href={data.origin_content_link} target="_blank" rel="noopener noreferrer">
|
|
|
+ <a
|
|
|
+ href={data.origin_content_link}
|
|
|
+ target="_blank"
|
|
|
+ rel="noopener noreferrer"
|
|
|
+ >
|
|
|
{data.origin_content_link}
|
|
|
</a>
|
|
|
- ) : '无'}
|
|
|
+ ) : (
|
|
|
+ "无"
|
|
|
+ )}
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="操作路径数据" span={2}>
|
|
|
- <div style={{ maxHeight: '200px', overflow: 'auto' }}>
|
|
|
- <pre style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
|
|
|
- {data.operate_path_data || '无'}
|
|
|
- </pre>
|
|
|
+ <Descriptions.Item
|
|
|
+ label="操作路径数据"
|
|
|
+ span={2}
|
|
|
+ >
|
|
|
+ <div style={{ maxHeight: "200px", overflow: "auto" }}>
|
|
|
+ <pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-word" }}>{data.operate_path_data || "无"}</pre>
|
|
|
</div>
|
|
|
</Descriptions.Item>
|
|
|
- <Descriptions.Item label="失败原因" span={2}>
|
|
|
- {data.fail_reason || '无'}
|
|
|
+ <Descriptions.Item
|
|
|
+ label="失败原因"
|
|
|
+ span={2}
|
|
|
+ >
|
|
|
+ {data.fail_reason || "无"}
|
|
|
</Descriptions.Item>
|
|
|
<Descriptions.Item label="创建时间">
|
|
|
- {moment(data.create_time).format('YYYY-MM-DD HH:mm:ss')}
|
|
|
+ {moment(data.create_time).format("YYYY-MM-DD HH:mm:ss")}
|
|
|
</Descriptions.Item>
|
|
|
<Descriptions.Item label="更新时间">
|
|
|
- {moment(data.update_time).format('YYYY-MM-DD HH:mm:ss')}
|
|
|
+ {moment(data.update_time).format("YYYY-MM-DD HH:mm:ss")}
|
|
|
</Descriptions.Item>
|
|
|
</Descriptions>
|
|
|
</Card>
|
|
@@ -275,4 +285,4 @@ const AutoAccessTaskDetail = () => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export default AutoAccessTaskDetail;
|
|
|
+export default AutoAccessTaskDetail;
|