|
@@ -9,6 +9,14 @@ import { STATUS_TAG_COLOR, STATUS_MAP } from "./PendingToolsList";
|
|
|
const { TextArea } = Input;
|
|
const { TextArea } = Input;
|
|
|
const { Option } = Select;
|
|
const { Option } = Select;
|
|
|
|
|
|
|
|
|
|
+const STATUS_OPTIONS = [
|
|
|
|
|
+ { value: 0, label: "待处理" },
|
|
|
|
|
+ { value: 1, label: "处理中" },
|
|
|
|
|
+ { value: 2, label: "已完成" },
|
|
|
|
|
+ { value: 3, label: "失败" },
|
|
|
|
|
+ { value: 5, label: "待审核" },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
const PendingToolsDetail = () => {
|
|
const PendingToolsDetail = () => {
|
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
|
const [data, setData] = useState(null);
|
|
const [data, setData] = useState(null);
|
|
@@ -30,20 +38,22 @@ const PendingToolsDetail = () => {
|
|
|
const fetchData = async () => {
|
|
const fetchData = async () => {
|
|
|
try {
|
|
try {
|
|
|
const response = await pendingToolsApi.getDetail(id);
|
|
const response = await pendingToolsApi.getDetail(id);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果没有详情数据,创建一个默认的详情项
|
|
// 如果没有详情数据,创建一个默认的详情项
|
|
|
if (!response.data.detail || response.data.detail.length === 0) {
|
|
if (!response.data.detail || response.data.detail.length === 0) {
|
|
|
- response.data.detail = [{
|
|
|
|
|
- id: null, // 新创建的详情项没有ID
|
|
|
|
|
- search_task_id: id,
|
|
|
|
|
- search_channel: '',
|
|
|
|
|
- query: '',
|
|
|
|
|
- status: 1,
|
|
|
|
|
- search_result: '',
|
|
|
|
|
- fail_reason: ''
|
|
|
|
|
- }];
|
|
|
|
|
|
|
+ response.data.detail = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: null, // 新创建的详情项没有ID
|
|
|
|
|
+ search_task_id: id,
|
|
|
|
|
+ search_channel: "",
|
|
|
|
|
+ query: "",
|
|
|
|
|
+ status: 1,
|
|
|
|
|
+ search_result: "",
|
|
|
|
|
+ fail_reason: "",
|
|
|
|
|
+ },
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
setData(response.data);
|
|
setData(response.data);
|
|
|
if (response.data.task) {
|
|
if (response.data.task) {
|
|
|
form.setFieldsValue(response.data.task);
|
|
form.setFieldsValue(response.data.task);
|
|
@@ -72,7 +82,7 @@ const PendingToolsDetail = () => {
|
|
|
query: detail.query,
|
|
query: detail.query,
|
|
|
status: detail.status,
|
|
status: detail.status,
|
|
|
search_result: detail.search_result,
|
|
search_result: detail.search_result,
|
|
|
- fail_reason: detail.fail_reason
|
|
|
|
|
|
|
+ fail_reason: detail.fail_reason,
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
// 现有的详情项,使用更新API
|
|
// 现有的详情项,使用更新API
|
|
@@ -169,11 +179,14 @@ const PendingToolsDetail = () => {
|
|
|
rules={[{ required: false, message: "请选择状态" }]}
|
|
rules={[{ required: false, message: "请选择状态" }]}
|
|
|
>
|
|
>
|
|
|
<Select>
|
|
<Select>
|
|
|
- <Option value={0}>待处理</Option>
|
|
|
|
|
- <Option value={1}>处理中</Option>
|
|
|
|
|
- <Option value={2}>已完成</Option>
|
|
|
|
|
- <Option value={3}>失败</Option>
|
|
|
|
|
- <Option value={4}>待审核</Option>
|
|
|
|
|
|
|
+ {STATUS_OPTIONS.map((option) => (
|
|
|
|
|
+ <Option
|
|
|
|
|
+ key={option.value}
|
|
|
|
|
+ value={option.value}
|
|
|
|
|
+ >
|
|
|
|
|
+ {option.label}
|
|
|
|
|
+ </Option>
|
|
|
|
|
+ ))}
|
|
|
</Select>
|
|
</Select>
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
|
|
|