Merge remote-tracking branch 'origin/wuxichen' into wuxichen
Some checks failed
Auto Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Auto Deploy / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -35,7 +35,6 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
type={action.type}
|
||||
danger={action.danger}
|
||||
disabled={action.disabled}
|
||||
// icon={action.icon ?? <PlusOutlined />}
|
||||
onClick={() => action.onClick()}
|
||||
>
|
||||
{action.label}
|
||||
@@ -55,7 +54,6 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
toolBarRender={toolBarRender}
|
||||
manualRequest={false}
|
||||
showSorterTooltip
|
||||
// scroll={{ x: "max-content" }}
|
||||
scroll={scroll ? scroll : { x: 1200 }}
|
||||
components={components}
|
||||
search={
|
||||
@@ -83,7 +81,8 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
? {
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
pageSize: 10,
|
||||
// pageSize: 10,
|
||||
defaultPageSize: 10,
|
||||
showTotal: formatPaginationTotal,
|
||||
}
|
||||
: false
|
||||
|
||||
@@ -169,17 +169,7 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
|
||||
id: tagsModalValue?.id,
|
||||
...value,
|
||||
});
|
||||
|
||||
const newTag = currentGroup?.tags?.map((tag) => {
|
||||
if (tag.id === tagsModalValue?.id) {
|
||||
return { ...tag, tagName: value.tagName };
|
||||
} else {
|
||||
return tag;
|
||||
}
|
||||
});
|
||||
|
||||
const newGroup = { ...currentGroup, tags: newTag };
|
||||
setCurrentGroup(newGroup as GroupItem);
|
||||
fetchTagsApi();
|
||||
}
|
||||
setVisible(false);
|
||||
message.success('修改成功');
|
||||
@@ -195,7 +185,8 @@ const GroupTagCore: React.FC<GroupTagCoreProps> = (props) => {
|
||||
setCurrentGroup(newGroups[0]);
|
||||
}
|
||||
} else {
|
||||
tagsApi.delete(id);
|
||||
await tagsApi.delete(id);
|
||||
fetchTagsApi();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Form, Input, Modal, Select } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getGroupListByYagId } from '@/services/ai/sample';
|
||||
|
||||
interface TagsModalProps {
|
||||
visible: boolean;
|
||||
@@ -24,8 +25,19 @@ const TagsModal = (props: TagsModalProps) => {
|
||||
const { value, visible, type, modalType, groups, onCancel, onConfirm } =
|
||||
props;
|
||||
|
||||
const onGroupListByYagId = async (id: number) => {
|
||||
const groupItem: { id?: number; groupName?: string }[] =
|
||||
await getGroupListByYagId(id);
|
||||
form.setFieldsValue({
|
||||
groupIds: groupItem.map((item) => item.id),
|
||||
});
|
||||
};
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(value);
|
||||
console.log('value', value);
|
||||
if (visible && type === 'tag' && value.id) {
|
||||
onGroupListByYagId(value.id);
|
||||
}
|
||||
return () => {
|
||||
form.resetFields();
|
||||
setLoading(false);
|
||||
@@ -61,7 +73,7 @@ const TagsModal = (props: TagsModalProps) => {
|
||||
wrapperCol={{ span: 20 }}
|
||||
style={{ maxWidth: 600, marginTop: 30 }}
|
||||
>
|
||||
{type === 'tag' && modalType === 'add' && (
|
||||
{type === 'tag' && (
|
||||
<Form.Item
|
||||
label="分组"
|
||||
name="groupIds"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.uploader-card {
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
:global {
|
||||
.ant-upload-drag {
|
||||
background-color: #fff;
|
||||
|
||||
@@ -5,7 +5,11 @@ import type {
|
||||
} from '@ant-design/pro-components';
|
||||
import { Modal, message, Switch } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { type AiModelRespVO, updateModelStatus } from '@/services/ai/model';
|
||||
import {
|
||||
type AiModelRespVO,
|
||||
updateModel,
|
||||
updateModelStatus,
|
||||
} from '@/services/ai/model';
|
||||
|
||||
export const baseDeptColumns: ProColumns<AiModelRespVO>[] = [
|
||||
{
|
||||
@@ -47,9 +51,9 @@ export const baseDeptColumns: ProColumns<AiModelRespVO>[] = [
|
||||
}"类目吗?`,
|
||||
onOk: async () => {
|
||||
console.log(checked);
|
||||
await updateModelStatus({
|
||||
await updateModel({
|
||||
...record,
|
||||
status: checked ? 1 : 0,
|
||||
id: record.id,
|
||||
});
|
||||
message.success('修改成功');
|
||||
action?.reload();
|
||||
|
||||
@@ -112,7 +112,7 @@ const ModelPage = () => {
|
||||
columns={columns}
|
||||
request={onFetch}
|
||||
toolbarActions={toolbarActions}
|
||||
headerTitle="租户列表"
|
||||
headerTitle="模型管理"
|
||||
showIndex={false}
|
||||
showSelection={false}
|
||||
search={false}
|
||||
|
||||
@@ -72,7 +72,7 @@ export const baseTenantColumns: ProColumns<AiSampleRespVO>[] = [
|
||||
},
|
||||
}}
|
||||
editable
|
||||
placeholder="请选择技术栈"
|
||||
placeholder="请选择标签"
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -128,18 +128,6 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
const handleDownloadAll = async () => {
|
||||
const ids = data?.map((sample) => sample.id) as number[];
|
||||
downloadZipFile(ids);
|
||||
// const res = await downloadSample(ids);
|
||||
// console.log(res);
|
||||
// const downloadUrl = window.URL.createObjectURL(res);
|
||||
// const link = document.createElement("a");
|
||||
// link.href = downloadUrl;
|
||||
// link.download = downloadUrl; // 设置下载的文件名
|
||||
// link.style.display = "none";
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// // const blob = new Blob([response.data], { type: 'application/pdf' });
|
||||
// // const url = window.URL.createObjectURL(blob);
|
||||
};
|
||||
|
||||
const handleTagManager = () => {
|
||||
@@ -186,6 +174,8 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{data!.length > 0 ? (
|
||||
<>
|
||||
<ProForm name="validate_other" formRef={formRef} submitter={false}>
|
||||
{type === 'radio' && (
|
||||
@@ -221,7 +211,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
}) || [];
|
||||
await updateSamples(newData);
|
||||
props?.onRefresh?.();
|
||||
message.success('更新成功');
|
||||
message.success('更新样本名称成功');
|
||||
}
|
||||
},
|
||||
}}
|
||||
@@ -242,6 +232,7 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
}) || [];
|
||||
await updateSamples(newData);
|
||||
props?.onRefresh?.();
|
||||
message.success('更新注释成功');
|
||||
}
|
||||
},
|
||||
}}
|
||||
@@ -265,11 +256,15 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
<ProFormGroup title="文本信息" block></ProFormGroup>
|
||||
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
|
||||
<span>添加日期: </span>
|
||||
<span>{dayjs(value.createTime).format('YYYY-MM-DD HH:mm:ss')}</span>
|
||||
<span>
|
||||
{dayjs(value.createTime).format('YYYY-MM-DD HH:mm:ss')}
|
||||
</span>
|
||||
</Space>
|
||||
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
|
||||
<span>修改日期</span>
|
||||
<span>{dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')}</span>
|
||||
<span>
|
||||
{dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')}
|
||||
</span>
|
||||
</Space>
|
||||
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
|
||||
<span>文件大小: </span>
|
||||
@@ -338,7 +333,10 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
onOk={onRename}
|
||||
onCancel={() => setTagManagerVisible(false)}
|
||||
></TagManager>
|
||||
<Space style={{ width: '100%', justifyContent: 'center', padding: 12 }}>
|
||||
{type === 'radio' && (
|
||||
<Space
|
||||
style={{ width: '100%', justifyContent: 'center', padding: 12 }}
|
||||
>
|
||||
<Button color="danger" onClick={onDownload}>
|
||||
下载
|
||||
</Button>
|
||||
@@ -346,6 +344,11 @@ const SampleTagDetail = <T extends Record<string, any>>(
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
'暂无数据-请选择样本'
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
.tag-content {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
:global {
|
||||
.ant-pro-table {
|
||||
flex: 1 auto;
|
||||
.left {
|
||||
padding-right: 385px;
|
||||
}
|
||||
.uploader-card {
|
||||
padding-right: 400px;
|
||||
}
|
||||
|
||||
.detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-left: 1px solid #e8e8e8;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
width: 400px;
|
||||
padding: 16px;
|
||||
top: 74px;
|
||||
height: calc(100vh - 80px);
|
||||
overflow: auto;
|
||||
background: #fff;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
form {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@@ -77,8 +77,9 @@ const SampleTag: React.FC = () => {
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<UploadCard onChange={onChangeVideo} />
|
||||
<div className={styles['tag-content']}>
|
||||
<div className="left">
|
||||
<UploadCard onChange={onChangeVideo} />
|
||||
<EnhancedProTable<AiSampleRespVO>
|
||||
ref={tableRef}
|
||||
columns={baseTenantColumns}
|
||||
@@ -90,14 +91,16 @@ const SampleTag: React.FC = () => {
|
||||
scroll={{ x: 400 }}
|
||||
rowSelection={{
|
||||
type: selectTableType,
|
||||
selectedRowKeys: selectedRows.map((item) => item.id) as React.Key[],
|
||||
selectedRowKeys: selectedRows.map(
|
||||
(item) => item.id,
|
||||
) as React.Key[],
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{selectedRows.length > 0 && (
|
||||
<div className="detail">
|
||||
<SampleTagDetail<AiSampleRespVO>
|
||||
type={selectTableType}
|
||||
@@ -105,7 +108,6 @@ const SampleTag: React.FC = () => {
|
||||
onRefresh={onRefresh}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<GroupTagModal
|
||||
visible={modalVisible}
|
||||
|
||||
@@ -257,6 +257,13 @@ export const downloadSample = async (ids: number[]) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getGroupListByYagId = async (id: number) => {
|
||||
return request("/ai/sampleTag/group-list-by-tag-id", {
|
||||
method: "GET",
|
||||
params: { tagId: id },
|
||||
});
|
||||
};
|
||||
|
||||
export async function downloadZipFile(ids: number[]) {
|
||||
try {
|
||||
const response = await downloadSample(ids);
|
||||
|
||||
Reference in New Issue
Block a user