Merge remote-tracking branch 'origin/wuxichen' into wuxichen
Some checks failed
Auto Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-03-02 15:55:19 +08:00
11 changed files with 246 additions and 217 deletions

View File

@@ -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

View File

@@ -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();
}
};

View File

@@ -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"

View File

@@ -1,5 +1,6 @@
.uploader-card {
background-color: #fff;
padding: 10px;
:global {
.ant-upload-drag {
background-color: #fff;

View File

@@ -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();

View File

@@ -112,7 +112,7 @@ const ModelPage = () => {
columns={columns}
request={onFetch}
toolbarActions={toolbarActions}
headerTitle="租户列表"
headerTitle="模型管理"
showIndex={false}
showSelection={false}
search={false}

View File

@@ -72,7 +72,7 @@ export const baseTenantColumns: ProColumns<AiSampleRespVO>[] = [
},
}}
editable
placeholder="请选择技术栈"
placeholder="请选择标签"
/>
);
},

View File

@@ -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 = () => {
@@ -187,165 +175,180 @@ const SampleTagDetail = <T extends Record<string, any>>(
};
return (
<>
<ProForm name="validate_other" formRef={formRef} submitter={false}>
{type === 'radio' && (
<ProFormGroup title="预览">
{data?.[0].sampleFilePath && (
<audio
controls
preload="true"
crossOrigin="anonymous"
style={{ marginBottom: 24 }}
>
<source src={data[0].sampleFilePath} />
<track kind="captions" />
</audio>
{data!.length > 0 ? (
<>
<ProForm name="validate_other" formRef={formRef} submitter={false}>
{type === 'radio' && (
<ProFormGroup title="预览">
{data?.[0].sampleFilePath && (
<audio
controls
preload="true"
crossOrigin="anonymous"
style={{ marginBottom: 24 }}
>
<source src={data[0].sampleFilePath} />
<track kind="captions" />
</audio>
)}
</ProFormGroup>
)}
</ProFormGroup>
)}
<ProFormGroup title="基本信息">
{type === 'radio' && (
<ProFormText
width="md"
name="sampleName"
placeholder="请输入样本名称"
fieldProps={{
onBlur: async (e) => {
if (e.target.value) {
const newData =
data?.map((sample) => {
return {
id: sample.id,
sampleName: e.target.value,
};
}) || [];
await updateSamples(newData);
props?.onRefresh?.();
message.success('更新成功');
}
},
}}
rules={[{ required: true, message: '样本名称不能为空' }]}
/>
)}
<ProFormText
width="md"
fieldProps={{
onBlur: async (e) => {
if (e.target.value) {
const newData =
data?.map((sample) => {
return {
id: sample.id,
remark: e.target.value,
};
}) || [];
await updateSamples(newData);
props?.onRefresh?.();
}
<ProFormGroup title="基本信息">
{type === 'radio' && (
<ProFormText
width="md"
name="sampleName"
placeholder="请输入样本名称"
fieldProps={{
onBlur: async (e) => {
if (e.target.value) {
const newData =
data?.map((sample) => {
return {
id: sample.id,
sampleName: e.target.value,
};
}) || [];
await updateSamples(newData);
props?.onRefresh?.();
message.success('更新样本名称成功');
}
},
}}
rules={[{ required: true, message: '样本名称不能为空' }]}
/>
)}
<ProFormText
width="md"
fieldProps={{
onBlur: async (e) => {
if (e.target.value) {
const newData =
data?.map((sample) => {
return {
id: sample.id,
remark: e.target.value,
};
}) || [];
await updateSamples(newData);
props?.onRefresh?.();
message.success('更新注释成功');
}
},
}}
name="remark"
placeholder="请输入注释"
/>
</ProFormGroup>
<ProFormGroup title="标签">
{/* <Form.Item name="tag"> */}
{forMap(value.tags || [])}
</ProFormGroup>
<Button
type="dashed"
block
style={{ marginBottom: 24 }}
onClick={handleAddTag}
>
</Button>
<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>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span></span>
<span>
{dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')}
</span>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span>: </span>
<span>{value.sampleSize}</span>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span>: </span>
<span>{value.sampleMineType}</span>
</Space>
{type === 'checkbox' && (
<>
<ProFormGroup title="其他"></ProFormGroup>
<Button
block
style={{ marginBottom: 24 }}
onClick={handleTagManager}
>
</Button>
<Button
block
style={{ marginBottom: 24 }}
onClick={handleDownloadAll}
>
</Button>
<Button
block
color="danger"
style={{ marginBottom: 24 }}
onClick={handleDeleteAll}
>
</Button>
</>
)}
</ProForm>
<GroupTagModal
visible={modalVisible}
onCancel={() => setModalVisible(false)}
onChange={onListAddTag}
editable={false}
value={value?.tags}
request={{
groupsApi: {
get: getSampleTagGroup,
create: createSampleTagGroup,
delete: deleteSampleTagGroup,
update: updateSampleTagGroup,
},
tagsApi: {
get: getSampleTagPage,
create: createSampleTag,
delete: deleteSampleTag,
update: updateSampleTag,
},
}}
name="remark"
placeholder="请输入注释"
title="管理技术标签"
width={800}
height={500}
/>
</ProFormGroup>
<ProFormGroup title="标签">
{/* <Form.Item name="tag"> */}
{forMap(value.tags || [])}
</ProFormGroup>
<Button
type="dashed"
block
style={{ marginBottom: 24 }}
onClick={handleAddTag}
>
</Button>
<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>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span></span>
<span>{dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')}</span>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span>: </span>
<span>{value.sampleSize}</span>
</Space>
<Space size={10} style={{ width: '100%', marginBottom: 12 }}>
<span>: </span>
<span>{value.sampleMineType}</span>
</Space>
{type === 'checkbox' && (
<>
<ProFormGroup title="其他"></ProFormGroup>
<Button
block
style={{ marginBottom: 24 }}
onClick={handleTagManager}
<TagManager
visible={tagManagerVisible}
files={tagNames}
onOk={onRename}
onCancel={() => setTagManagerVisible(false)}
></TagManager>
{type === 'radio' && (
<Space
style={{ width: '100%', justifyContent: 'center', padding: 12 }}
>
</Button>
<Button
block
style={{ marginBottom: 24 }}
onClick={handleDownloadAll}
>
</Button>
<Button
block
color="danger"
style={{ marginBottom: 24 }}
onClick={handleDeleteAll}
>
</Button>
</>
)}
</ProForm>
<GroupTagModal
visible={modalVisible}
onCancel={() => setModalVisible(false)}
onChange={onListAddTag}
editable={false}
value={value?.tags}
request={{
groupsApi: {
get: getSampleTagGroup,
create: createSampleTagGroup,
delete: deleteSampleTagGroup,
update: updateSampleTagGroup,
},
tagsApi: {
get: getSampleTagPage,
create: createSampleTag,
delete: deleteSampleTag,
update: updateSampleTag,
},
}}
title="管理技术标签"
width={800}
height={500}
/>
<TagManager
visible={tagManagerVisible}
files={tagNames}
onOk={onRename}
onCancel={() => setTagManagerVisible(false)}
></TagManager>
<Space style={{ width: '100%', justifyContent: 'center', padding: 12 }}>
<Button color="danger" onClick={onDownload}>
</Button>
<Button color="danger" variant="solid" onClick={handleDeleteAll}>
</Button>
</Space>
<Button color="danger" onClick={onDownload}>
</Button>
<Button color="danger" variant="solid" onClick={handleDeleteAll}>
</Button>
</Space>
)}
</>
) : (
'暂无数据-请选择样本'
)}
</>
);
};

View File

@@ -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;
}

View File

@@ -77,35 +77,37 @@ const SampleTag: React.FC = () => {
};
return (
<>
<UploadCard onChange={onChangeVideo} />
<div className={styles['tag-content']}>
<EnhancedProTable<AiSampleRespVO>
ref={tableRef}
columns={baseTenantColumns}
request={onFetch}
toolbarActions={toolbarActions}
headerTitle="样本列表"
showIndex={false}
enableRowClick={true}
scroll={{ x: 400 }}
rowSelection={{
type: selectTableType,
selectedRowKeys: selectedRows.map((item) => item.id) as React.Key[],
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
<div className="left">
<UploadCard onChange={onChangeVideo} />
<EnhancedProTable<AiSampleRespVO>
ref={tableRef}
columns={baseTenantColumns}
request={onFetch}
toolbarActions={toolbarActions}
headerTitle="样本列表"
showIndex={false}
enableRowClick={true}
scroll={{ x: 400 }}
rowSelection={{
type: selectTableType,
selectedRowKeys: selectedRows.map(
(item) => item.id,
) as React.Key[],
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
</div>
{selectedRows.length > 0 && (
<div className="detail">
<SampleTagDetail<AiSampleRespVO>
type={selectTableType}
data={selectedRows}
onRefresh={onRefresh}
/>
</div>
)}
<div className="detail">
<SampleTagDetail<AiSampleRespVO>
type={selectTableType}
data={selectedRows}
onRefresh={onRefresh}
/>
</div>
</div>
<GroupTagModal
visible={modalVisible}

View File

@@ -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);