|
@@ -1,10 +1,10 @@
|
|
-import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
-import { Button, Divider, message, Modal, Radio } from 'antd';
|
|
|
|
-import React, { useRef, useState } from 'react';
|
|
|
|
-import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
|
|
-import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
|
|
|
-import { SorterResult } from 'antd/es/table/interface';
|
|
|
|
-import { TableListItem } from './data.d';
|
|
|
|
|
|
+import {PlusOutlined} from '@ant-design/icons';
|
|
|
|
+import {Button, Divider, message, Modal, Radio} from 'antd';
|
|
|
|
+import React, {useRef, useState} from 'react';
|
|
|
|
+import {PageHeaderWrapper} from '@ant-design/pro-layout';
|
|
|
|
+import ProTable, {ActionType, ProColumns} from '@ant-design/pro-table';
|
|
|
|
+import {SorterResult} from 'antd/es/table/interface';
|
|
|
|
+import {TableListItem} from './data.d';
|
|
import service from './service';
|
|
import service from './service';
|
|
import QueryForm from '@/pages/ModelList/components/QueryForm';
|
|
import QueryForm from '@/pages/ModelList/components/QueryForm';
|
|
|
|
|
|
@@ -15,7 +15,7 @@ import QueryForm from '@/pages/ModelList/components/QueryForm';
|
|
const handleAdd = async (fields: TableListItem) => {
|
|
const handleAdd = async (fields: TableListItem) => {
|
|
const hide = message.loading('正在添加');
|
|
const hide = message.loading('正在添加');
|
|
try {
|
|
try {
|
|
- await service.addModel({ ...fields });
|
|
|
|
|
|
+ await service.addModel({...fields});
|
|
hide();
|
|
hide();
|
|
message.success('添加成功');
|
|
message.success('添加成功');
|
|
return true;
|
|
return true;
|
|
@@ -51,10 +51,10 @@ const handleUpdate = async (fields: TableListItem) => {
|
|
const handleRemove = async (fields: TableListItem) => {
|
|
const handleRemove = async (fields: TableListItem) => {
|
|
const hide = message.loading('正在删除');
|
|
const hide = message.loading('正在删除');
|
|
try {
|
|
try {
|
|
- await service.removeModel(fields);
|
|
|
|
|
|
+ const res = await service.removeModel(fields);
|
|
hide();
|
|
hide();
|
|
message.success('删除成功,即将刷新');
|
|
message.success('删除成功,即将刷新');
|
|
- return true;
|
|
|
|
|
|
+ return res.success;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
hide();
|
|
hide();
|
|
message.error('删除失败,请重试');
|
|
message.error('删除失败,请重试');
|
|
@@ -84,13 +84,13 @@ const TableList: React.FC<{}> = () => {
|
|
return (
|
|
return (
|
|
<Radio.Group>
|
|
<Radio.Group>
|
|
<Radio value={0}>albert</Radio>
|
|
<Radio value={0}>albert</Radio>
|
|
- <Radio value={1}>Blstm</Radio>
|
|
|
|
|
|
+ <Radio value={1}>bilstm</Radio>
|
|
</Radio.Group>
|
|
</Radio.Group>
|
|
);
|
|
);
|
|
},
|
|
},
|
|
valueEnum: {
|
|
valueEnum: {
|
|
- 0: { text: 'albert' },
|
|
|
|
- 1: { text: 'Blstm' },
|
|
|
|
|
|
+ 0: {text: 'albert'},
|
|
|
|
+ 1: {text: 'bilstm'},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -110,7 +110,7 @@ const TableList: React.FC<{}> = () => {
|
|
rules: [
|
|
rules: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
- message: '模型名称为必填项',
|
|
|
|
|
|
+ message: '模型文件为必填项',
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
@@ -140,11 +140,45 @@ const TableList: React.FC<{}> = () => {
|
|
title: '必包含',
|
|
title: '必包含',
|
|
dataIndex: 'mustTag',
|
|
dataIndex: 'mustTag',
|
|
hideInSearch: true,
|
|
hideInSearch: true,
|
|
|
|
+ formItemProps: {
|
|
|
|
+ placeholder: '逗号分隔'
|
|
|
|
+ },
|
|
|
|
+ hideInTable: true,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '必不包含',
|
|
title: '必不包含',
|
|
dataIndex: 'mustNotTag',
|
|
dataIndex: 'mustNotTag',
|
|
hideInSearch: true,
|
|
hideInSearch: true,
|
|
|
|
+ formItemProps: {
|
|
|
|
+ placeholder: '逗号分隔'
|
|
|
|
+ },
|
|
|
|
+ hideInTable: true,
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ title: 'BatchSize',
|
|
|
|
+ dataIndex: 'maxBatchSize',
|
|
|
|
+ hideInSearch: true,
|
|
|
|
+ hideInTable: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: 'SeqLength',
|
|
|
|
+ dataIndex: 'maxSeqLength',
|
|
|
|
+ hideInSearch: true,
|
|
|
|
+ hideInTable: true,
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ {
|
|
|
|
+ title: 'HiddenLayers',
|
|
|
|
+ dataIndex: 'numHiddenLayers',
|
|
|
|
+ hideInSearch: true,
|
|
|
|
+ hideInTable: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: 'AttentionHeads',
|
|
|
|
+ dataIndex: 'numAttentionHeads',
|
|
|
|
+ hideInSearch: true,
|
|
|
|
+ hideInTable: true,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '纯文本',
|
|
title: '纯文本',
|
|
@@ -159,8 +193,26 @@ const TableList: React.FC<{}> = () => {
|
|
);
|
|
);
|
|
},
|
|
},
|
|
valueEnum: {
|
|
valueEnum: {
|
|
- true: { text: '是' },
|
|
|
|
- false: { text: '否' },
|
|
|
|
|
|
+ true: {text: '是'},
|
|
|
|
+ false: {text: '否'},
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '大小写',
|
|
|
|
+ dataIndex: 'doLowerCase',
|
|
|
|
+ hideInSearch: true,
|
|
|
|
+ hideInTable: true,
|
|
|
|
+ renderFormItem: () => {
|
|
|
|
+ return (
|
|
|
|
+ <Radio.Group>
|
|
|
|
+ <Radio value="0">区分</Radio>
|
|
|
|
+ <Radio value="1">不分区</Radio>
|
|
|
|
+ </Radio.Group>
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ valueEnum: {
|
|
|
|
+ "0": {text: '区分'},
|
|
|
|
+ "1": {text: '不分区'},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
|
|
@@ -168,32 +220,34 @@ const TableList: React.FC<{}> = () => {
|
|
title: '操作',
|
|
title: '操作',
|
|
dataIndex: 'option',
|
|
dataIndex: 'option',
|
|
valueType: 'option',
|
|
valueType: 'option',
|
|
- render: (_, record) => (
|
|
|
|
|
|
+ render: (_, record,index,action) => (
|
|
<>
|
|
<>
|
|
<a
|
|
<a
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- setModalVisible(true);
|
|
|
|
setFormValues(record);
|
|
setFormValues(record);
|
|
|
|
+ setModalVisible(true);
|
|
console.log(record);
|
|
console.log(record);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
配置
|
|
配置
|
|
</a>
|
|
</a>
|
|
- <Divider type="vertical" />
|
|
|
|
|
|
+ <Divider type="vertical"/>
|
|
<a
|
|
<a
|
|
- onClick={() => {
|
|
|
|
- handleRemove(record);
|
|
|
|
|
|
+ onClick={async () => {
|
|
|
|
+ const success = await handleRemove(record);
|
|
|
|
+ if (success) {
|
|
|
|
+ await action.reload();
|
|
|
|
+ }
|
|
console.log(record);
|
|
console.log(record);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
删除
|
|
删除
|
|
</a>
|
|
</a>
|
|
- <Divider type="vertical" />
|
|
|
|
|
|
+ <Divider type="vertical"/>
|
|
<a
|
|
<a
|
|
- onClick={() => {
|
|
|
|
- setQueryVisible(true);
|
|
|
|
|
|
+ onClick={async () => {
|
|
setFormValues(record);
|
|
setFormValues(record);
|
|
- console.log(record);
|
|
|
|
|
|
+ setQueryVisible(true);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
查询
|
|
查询
|
|
@@ -222,15 +276,22 @@ const TableList: React.FC<{}> = () => {
|
|
sorter,
|
|
sorter,
|
|
}}
|
|
}}
|
|
/* eslint-disable */
|
|
/* eslint-disable */
|
|
- toolBarRender={(action, { selectedRows }) => [
|
|
|
|
|
|
+ toolBarRender={(action, {selectedRows}) => [
|
|
<Button
|
|
<Button
|
|
type="primary"
|
|
type="primary"
|
|
onClick={() => {
|
|
onClick={() => {
|
|
setModalVisible(true);
|
|
setModalVisible(true);
|
|
- setFormValues({});
|
|
|
|
|
|
+ setFormValues({
|
|
|
|
+ maxBatchSize: 1,
|
|
|
|
+ maxSeqLength: 40,
|
|
|
|
+ numAttentionHeads: 12,
|
|
|
|
+ numHiddenLayers: 3,
|
|
|
|
+ doLowerCase: "1",
|
|
|
|
+ onlyWord: "true",
|
|
|
|
+ });
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <PlusOutlined /> 新建
|
|
|
|
|
|
+ <PlusOutlined/> 新建
|
|
</Button>,
|
|
</Button>,
|
|
]}
|
|
]}
|
|
request={(params) => service.queryModel(params)}
|
|
request={(params) => service.queryModel(params)}
|
|
@@ -247,7 +308,7 @@ const TableList: React.FC<{}> = () => {
|
|
<ProTable<TableListItem, TableListItem>
|
|
<ProTable<TableListItem, TableListItem>
|
|
onSubmit={async (value) => {
|
|
onSubmit={async (value) => {
|
|
let success = false;
|
|
let success = false;
|
|
- if (value.id) {
|
|
|
|
|
|
+ if (!value.id) {
|
|
success = await handleAdd(value);
|
|
success = await handleAdd(value);
|
|
} else {
|
|
} else {
|
|
success = await handleUpdate(value);
|
|
success = await handleUpdate(value);
|
|
@@ -264,15 +325,18 @@ const TableList: React.FC<{}> = () => {
|
|
type="form"
|
|
type="form"
|
|
columns={columns}
|
|
columns={columns}
|
|
rowSelection={{}}
|
|
rowSelection={{}}
|
|
- form={{ initialValues: formValues }}
|
|
|
|
|
|
+ form={{initialValues: formValues}}
|
|
/>
|
|
/>
|
|
</Modal>
|
|
</Modal>
|
|
|
|
|
|
- <QueryForm
|
|
|
|
- onCancel={() => setQueryVisible(false)}
|
|
|
|
- modalVisible={queryVisible}
|
|
|
|
- values={formValues}
|
|
|
|
- />
|
|
|
|
|
|
+ {queryVisible ? (
|
|
|
|
+ <QueryForm
|
|
|
|
+ onCancel={() => setQueryVisible(false)}
|
|
|
|
+ modalVisible={queryVisible}
|
|
|
|
+ values={formValues}
|
|
|
|
+ />
|
|
|
|
+ ) : null}
|
|
|
|
+
|
|
</PageHeaderWrapper>
|
|
</PageHeaderWrapper>
|
|
);
|
|
);
|
|
};
|
|
};
|