diff --git a/src/components/EnhancedProTable/index.tsx b/src/components/EnhancedProTable/index.tsx index 6519421..138ad01 100644 --- a/src/components/EnhancedProTable/index.tsx +++ b/src/components/EnhancedProTable/index.tsx @@ -35,7 +35,6 @@ function EnhancedProTable( type={action.type} danger={action.danger} disabled={action.disabled} - // icon={action.icon ?? } onClick={() => action.onClick()} > {action.label} @@ -55,7 +54,6 @@ function EnhancedProTable( toolBarRender={toolBarRender} manualRequest={false} showSorterTooltip - // scroll={{ x: "max-content" }} scroll={scroll ? scroll : { x: 1200 }} components={components} search={ @@ -83,7 +81,8 @@ function EnhancedProTable( ? { showSizeChanger: true, showQuickJumper: true, - pageSize: 10, + // pageSize: 10, + defaultPageSize: 10, showTotal: formatPaginationTotal, } : false diff --git a/src/components/GroupTag/GroupTagCore.tsx b/src/components/GroupTag/GroupTagCore.tsx index 81c835a..66ae403 100644 --- a/src/components/GroupTag/GroupTagCore.tsx +++ b/src/components/GroupTag/GroupTagCore.tsx @@ -169,17 +169,7 @@ const GroupTagCore: React.FC = (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 = (props) => { setCurrentGroup(newGroups[0]); } } else { - tagsApi.delete(id); + await tagsApi.delete(id); + fetchTagsApi(); } }; diff --git a/src/components/GroupTag/TagsModal.tsx b/src/components/GroupTag/TagsModal.tsx index 1f3cef3..0f26ead 100644 --- a/src/components/GroupTag/TagsModal.tsx +++ b/src/components/GroupTag/TagsModal.tsx @@ -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' && ( [] = [ { @@ -47,9 +51,9 @@ export const baseDeptColumns: ProColumns[] = [ }"类目吗?`, onOk: async () => { console.log(checked); - await updateModelStatus({ + await updateModel({ + ...record, status: checked ? 1 : 0, - id: record.id, }); message.success('修改成功'); action?.reload(); diff --git a/src/pages/ai/model/index.tsx b/src/pages/ai/model/index.tsx index dc156e2..1a587ed 100644 --- a/src/pages/ai/model/index.tsx +++ b/src/pages/ai/model/index.tsx @@ -112,7 +112,7 @@ const ModelPage = () => { columns={columns} request={onFetch} toolbarActions={toolbarActions} - headerTitle="租户列表" + headerTitle="模型管理" showIndex={false} showSelection={false} search={false} diff --git a/src/pages/ai/sample-tag/config.tsx b/src/pages/ai/sample-tag/config.tsx index f8da7aa..9568029 100644 --- a/src/pages/ai/sample-tag/config.tsx +++ b/src/pages/ai/sample-tag/config.tsx @@ -72,7 +72,7 @@ export const baseTenantColumns: ProColumns[] = [ }, }} editable - placeholder="请选择技术栈" + placeholder="请选择标签" /> ); }, diff --git a/src/pages/ai/sample-tag/detail.tsx b/src/pages/ai/sample-tag/detail.tsx index 0155abc..d63a059 100644 --- a/src/pages/ai/sample-tag/detail.tsx +++ b/src/pages/ai/sample-tag/detail.tsx @@ -128,18 +128,6 @@ const SampleTagDetail = >( 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 = >( }; return ( <> - - {type === 'radio' && ( - - {data?.[0].sampleFilePath && ( - + {data!.length > 0 ? ( + <> + + {type === 'radio' && ( + + {data?.[0].sampleFilePath && ( + + )} + )} - - )} - - {type === 'radio' && ( - { - 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: '样本名称不能为空' }]} - /> - )} - { - if (e.target.value) { - const newData = - data?.map((sample) => { - return { - id: sample.id, - remark: e.target.value, - }; - }) || []; - await updateSamples(newData); - props?.onRefresh?.(); - } + + {type === 'radio' && ( + { + 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: '样本名称不能为空' }]} + /> + )} + { + 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="请输入注释" + /> + + + + {/* */} + {forMap(value.tags || [])} + + + + + 添加日期: + + {dayjs(value.createTime).format('YYYY-MM-DD HH:mm:ss')} + + + + 修改日期 + + {dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')} + + + + 文件大小: + {value.sampleSize} + + + 格式: + {value.sampleMineType} + + + {type === 'checkbox' && ( + <> + + + + + + )} + + 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} /> - - - - {/* */} - {forMap(value.tags || [])} - - - - - 添加日期: - {dayjs(value.createTime).format('YYYY-MM-DD HH:mm:ss')} - - - 修改日期 - {dayjs(value.updateTime).format('YYYY-MM-DD HH:mm:ss')} - - - 文件大小: - {value.sampleSize} - - - 格式: - {value.sampleMineType} - - - {type === 'checkbox' && ( - <> - - - - - - )} - - 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} - /> - setTagManagerVisible(false)} - > - - - - + + + + )} + + ) : ( + '暂无数据-请选择样本' + )} ); }; diff --git a/src/pages/ai/sample-tag/index.module.less b/src/pages/ai/sample-tag/index.module.less index 1ad3a44..645d561 100644 --- a/src/pages/ai/sample-tag/index.module.less +++ b/src/pages/ai/sample-tag/index.module.less @@ -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; } diff --git a/src/pages/ai/sample-tag/index.tsx b/src/pages/ai/sample-tag/index.tsx index 38809ae..ce63699 100644 --- a/src/pages/ai/sample-tag/index.tsx +++ b/src/pages/ai/sample-tag/index.tsx @@ -77,35 +77,37 @@ const SampleTag: React.FC = () => { }; return ( <> -
- - 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); - }, - }} - /> +
+ + + 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); + }, + }} + /> +
- {selectedRows.length > 0 && ( -
- - type={selectTableType} - data={selectedRows} - onRefresh={onRefresh} - /> -
- )} +
+ + type={selectTableType} + data={selectedRows} + onRefresh={onRefresh} + /> +
{ }); }; +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);