|
@@ -3,8 +3,8 @@ import { Link } from 'react-router-dom';
|
|
|
import { IconButton } from './button';
|
|
import { IconButton } from './button';
|
|
|
import ReturnIcon from "../icons/return.svg";
|
|
import ReturnIcon from "../icons/return.svg";
|
|
|
import Excel from 'js-export-excel';
|
|
import Excel from 'js-export-excel';
|
|
|
|
|
+import { ApiPath } from "@/app/constant";
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
-import { ApiPath } from "@/app/constant";
|
|
|
|
|
|
|
|
|
|
const RecordApp: React.FC = () => {
|
|
const RecordApp: React.FC = () => {
|
|
|
const [account, setAccount] = React.useState('');
|
|
const [account, setAccount] = React.useState('');
|
|
@@ -14,8 +14,8 @@ const RecordApp: React.FC = () => {
|
|
|
const onClickExport = async (data: { account: string, password: string }) => {
|
|
const onClickExport = async (data: { account: string, password: string }) => {
|
|
|
if (data.account && data.password) {
|
|
if (data.account && data.password) {
|
|
|
if (data.account === 'root' && password === 'root@2024') {
|
|
if (data.account === 'root' && password === 'root@2024') {
|
|
|
- const res = await fetch(ApiPath.BigModel,{
|
|
|
|
|
- method:'GET',
|
|
|
|
|
|
|
+ const res = await fetch(ApiPath.BigModel, {
|
|
|
|
|
+ method: 'GET',
|
|
|
});
|
|
});
|
|
|
const body = await res.json();
|
|
const body = await res.json();
|
|
|
const list: {
|
|
const list: {
|
|
@@ -24,6 +24,7 @@ const RecordApp: React.FC = () => {
|
|
|
create_time: string;
|
|
create_time: string;
|
|
|
content: string;
|
|
content: string;
|
|
|
}[] = body.data;
|
|
}[] = body.data;
|
|
|
|
|
+
|
|
|
// 标题行
|
|
// 标题行
|
|
|
const headerRow = [
|
|
const headerRow = [
|
|
|
{ id: 'ID', role: '角色', createTime: '创建时间', content: '内容' },
|
|
{ id: 'ID', role: '角色', createTime: '创建时间', content: '内容' },
|
|
@@ -35,6 +36,7 @@ const RecordApp: React.FC = () => {
|
|
|
createTime: dayjs(item.create_time).format('YYYY-MM-DD HH:mm:ss'),
|
|
createTime: dayjs(item.create_time).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
content: item.content,
|
|
content: item.content,
|
|
|
}))];
|
|
}))];
|
|
|
|
|
+
|
|
|
// 导出数据到Excel
|
|
// 导出数据到Excel
|
|
|
const option = {
|
|
const option = {
|
|
|
fileName: '聊天记录',
|
|
fileName: '聊天记录',
|