修复打包问题
This commit is contained in:
@@ -2,6 +2,6 @@ VITE_API_URL=
|
||||
VITE_STORE_PREFIX=senmeshzc
|
||||
VITE_BASEPATH=
|
||||
VITE_APP_TITLE=森睿智传
|
||||
VITE_IS_INSIDE=true
|
||||
VITE_IS_INSIDE=false
|
||||
VITE_DOMAIN=
|
||||
VITE_INIT_PASSWORD="Qaz123567!@#"
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,3 +22,4 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
*.zip
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"prod": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
||||
@@ -2,29 +2,35 @@ import { http, HTTP_CONTENT_TYPE } from "@/lib/http";
|
||||
|
||||
const baseUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
export enum RootType {
|
||||
export const RootType = {
|
||||
// 1普通/2内穿外/3外传内/4我的分享
|
||||
MY = "1",
|
||||
INSIDE = "2",
|
||||
OUTSIDE = "3",
|
||||
SHARE = "4",
|
||||
}
|
||||
MY: "1",
|
||||
INSIDE: "2",
|
||||
OUTSIDE: "3",
|
||||
SHARE: "4",
|
||||
} as const;
|
||||
|
||||
export enum FileStatus {
|
||||
export type RootType = (typeof RootType)[keyof typeof RootType];
|
||||
|
||||
export const FileStatus = {
|
||||
// 1正常2失效11解析中12待审核13传输中14失败
|
||||
VALID = "1",
|
||||
INVALID = "2",
|
||||
PARSING = "11",
|
||||
AUDITING = "12",
|
||||
TRANSFERING = "13",
|
||||
FAILED = "14",
|
||||
}
|
||||
VALID: "1",
|
||||
INVALID: "2",
|
||||
PARSING: "11",
|
||||
AUDITING: "12",
|
||||
TRANSFERING: "13",
|
||||
FAILED: "14",
|
||||
} as const;
|
||||
|
||||
export enum FileType {
|
||||
export type FileStatus = (typeof FileStatus)[keyof typeof FileStatus];
|
||||
|
||||
export const FileType = {
|
||||
// 1文件/2目录
|
||||
FILE = "1",
|
||||
DIRECTORY = "2",
|
||||
}
|
||||
FILE: "1",
|
||||
DIRECTORY: "2",
|
||||
} as const;
|
||||
|
||||
export type FileType = (typeof FileType)[keyof typeof FileType];
|
||||
|
||||
// 获取文件下载地址
|
||||
export const getFileUrl = (code?: string, appendBaseUrl = true) => {
|
||||
|
||||
@@ -36,7 +36,7 @@ export function DataTable<TData>({
|
||||
? null
|
||||
: flexRender(
|
||||
header.column.columnDef.header,
|
||||
header.getContext()
|
||||
header.getContext(),
|
||||
)}
|
||||
</TableHead>
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from "@/components/ui/dialog";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { FileType, getFilePage } from "@/apis/file";
|
||||
import { Folder, FolderInput, CircleAlert, MoveRight } from "lucide-react";
|
||||
import { Folder, FolderInput, MoveRight } from "lucide-react";
|
||||
import clsx from "clsx";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { DirectoryBreadcrumb } from "@/components/directory-breadcrumb";
|
||||
@@ -66,7 +66,7 @@ export function MoveFileDialog({
|
||||
// 选中行
|
||||
const [rowSelection, setRowSelection] = useState({});
|
||||
// 当前打开的目录层级
|
||||
const [openDirectorys, setOpenDirectorys] = useState([]);
|
||||
const [openDirectorys, setOpenDirectorys] = useState<any[]>([]);
|
||||
// 文件目录ID
|
||||
const [parentId, setParentId] = useState(0);
|
||||
// 分页
|
||||
@@ -213,7 +213,6 @@ export function MoveFileDialog({
|
||||
</div>
|
||||
|
||||
<Alert className="!bg-amber-50 !border-amber-200">
|
||||
<CircleAlert />
|
||||
<AlertTitle>
|
||||
您确定要将{data?.fileType === FileType.DIRECTORY ? "目录" : "文件"}
|
||||
移动到该目录下吗?
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
Folder,
|
||||
FolderPlus,
|
||||
FolderInput,
|
||||
Eye,
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { EditFileDialog } from "./-components/EditFileDialog";
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "@/components/ui/dialog";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { useBatchRemoveFile } from "../-hooks/useBatchRemoveFile";
|
||||
import { toast } from "sonner";
|
||||
|
||||
type BatchRemoveConfirmDialogProps = {
|
||||
open: boolean;
|
||||
@@ -32,6 +33,10 @@ export function BatchRemoveConfirmDialog({
|
||||
});
|
||||
|
||||
const onSubmit = () => {
|
||||
if (!ids?.length) {
|
||||
toast("请至少选择一个文件/目录");
|
||||
return;
|
||||
}
|
||||
batchRemove(ids);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export const useBatchRemoveFile = (mutationOptions?: any) => {
|
||||
const {
|
||||
mutateAsync: batchRemoveMutateAsync,
|
||||
isPending: batchRemoveIsPending,
|
||||
} = useMutation({
|
||||
} = useMutation<any, Error, number[]>({
|
||||
mutationFn: removeFileByIds,
|
||||
...(mutationOptions || {}),
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import { toast } from "sonner";
|
||||
|
||||
export const useRecoverFile = (mutationOptions?: any) => {
|
||||
const { mutateAsync: recoverMutateAsync, isPending: recoverIsPending } =
|
||||
useMutation({
|
||||
useMutation<any, Error, number>({
|
||||
mutationFn: recoverFile,
|
||||
...(mutationOptions || {}),
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import { toast } from "sonner";
|
||||
|
||||
export const useRemoveFile = (mutationOptions?: any) => {
|
||||
const { mutateAsync: removeMutateAsync, isPending: removeIsPending } =
|
||||
useMutation({
|
||||
useMutation<any, Error, number>({
|
||||
mutationFn: removeFile,
|
||||
...(mutationOptions || {}),
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ export function useColumns({
|
||||
return [
|
||||
{
|
||||
id: "select",
|
||||
header: ({ table }) => (
|
||||
header: ({ table }: any) => (
|
||||
<Checkbox
|
||||
checked={
|
||||
table.getIsAllPageRowsSelected() ||
|
||||
@@ -39,7 +39,7 @@ export function useColumns({
|
||||
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
cell: ({ row }: any) => (
|
||||
<Checkbox
|
||||
checked={row.getIsSelected()}
|
||||
onCheckedChange={(value) => row.toggleSelected(!!value)}
|
||||
@@ -206,7 +206,7 @@ function RouteComponent() {
|
||||
setOpen={setOpenBatchRemoveConfirmDialog}
|
||||
ids={table
|
||||
.getFilteredSelectedRowModel()
|
||||
.rows.map((row) => row.original.id)}
|
||||
.rows.map((row: any) => row.original.id)}
|
||||
refetch={query.refetch}
|
||||
/>
|
||||
<RemoveConfirmDialog
|
||||
|
||||
@@ -8,7 +8,6 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { AICreateRiskRule } from "./AICreateRiskRule";
|
||||
import { ManualCreateRiskRule } from "./ManualCreateRiskRule";
|
||||
import { useSaveRiskRule } from "../-hooks/useSaveRiskRule";
|
||||
import { nanoid } from "nanoid";
|
||||
import { toast } from "sonner";
|
||||
|
||||
type CreateRiskRuleDialogProps = {
|
||||
@@ -40,7 +39,7 @@ export function CreateRiskRuleDialog({
|
||||
};
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogContent className="!max-w-[400px] overflow-auto">
|
||||
<DialogContent className="!max-w-[500px] overflow-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle>风险预警设置</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -119,7 +119,7 @@ export function ManualCreateRiskRule({ onSubmit, loading, onClose }: any) {
|
||||
<FormItem>
|
||||
<FormLabel>内容示例</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
<Textarea {...field} rows={6} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -132,7 +132,7 @@ export function ManualCreateRiskRule({ onSubmit, loading, onClose }: any) {
|
||||
<FormItem>
|
||||
<FormLabel>判断依据</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} />
|
||||
<Textarea {...field} rows={6} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
import { Settings, ShieldAlert, ShieldCheck } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useState } from "react";
|
||||
import { RiskSettingDialog } from "./RiskSettingDialog";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getFilePageSuper } from "@/apis/file";
|
||||
|
||||
export function RiskList() {
|
||||
const [openRiskSettingDialog, setOpenRiskSettingDialog] = useState(false);
|
||||
|
||||
const handle = (item: any) => {
|
||||
|
||||
};
|
||||
|
||||
const trust = (item: any) => {
|
||||
|
||||
};
|
||||
|
||||
// 分页
|
||||
const [pagination, setPagination] = useState({
|
||||
pageIndex: 0,
|
||||
pageSize: 10,
|
||||
});
|
||||
|
||||
// 查询数据
|
||||
const query = useQuery<any>({
|
||||
queryKey: ["fileRiskList", pagination],
|
||||
queryFn: () =>
|
||||
getFilePageSuper({
|
||||
pageSize: pagination.pageSize,
|
||||
pageNo: pagination.pageIndex + 1,
|
||||
}).then((res) => res.data),
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<RiskSettingDialog
|
||||
open={openRiskSettingDialog}
|
||||
setOpen={setOpenRiskSettingDialog}
|
||||
/>
|
||||
<div className="w-full">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="text-lg">风险告警</div>
|
||||
</div>
|
||||
<Button
|
||||
variant="default"
|
||||
onClick={() => setOpenRiskSettingDialog(true)}
|
||||
>
|
||||
<Settings />
|
||||
风险告警设置
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{query?.data?.entityList.length > 0 ? (
|
||||
<div className="mt-4 grid grid-cols-4 gap-2">
|
||||
{query?.data?.entityList.map((item: any) => {
|
||||
var file = JSON.parse(item.difyFileJson || "{}");
|
||||
var risk = JSON.parse(item.riskJson || "{}");
|
||||
return (
|
||||
<div
|
||||
className="p-4 border border-solid border-black/10 rounded-lg"
|
||||
key={item.id}
|
||||
>
|
||||
<div className="flex gap-2 items-start">
|
||||
{risk.has_risk ? (
|
||||
<div className="flex-none h-8 w-8 rounded-full flex items-center justify-center bg-red-500 text-white">
|
||||
<ShieldAlert size={16} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex-none h-8 w-8 rounded-full flex items-center justify-center bg-green-500 text-white">
|
||||
<ShieldCheck size={16} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex-auto">
|
||||
<div className="text-base font-bold flex items-center gap-2 break-all leading-snug">
|
||||
{file.name}
|
||||
</div>
|
||||
<div className="text-xs text-black/50">
|
||||
{item.createTime}
|
||||
</div>
|
||||
<div className="text-xs text-black/50">
|
||||
{risk.recommendation}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 grid grid-cols-2 gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => handle(item)}
|
||||
>
|
||||
处理
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => trust(item)}
|
||||
>
|
||||
信任
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-center py-10">
|
||||
<div className="text-sm text-muted-foreground">暂无数据</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="py-2 flex gap-2">
|
||||
<div className="flex-auto"></div>
|
||||
<div className="flex-none flex items-center gap-2">
|
||||
<div className="text-sm text-muted-foreground mr-4">
|
||||
当页共{query?.data?.entityList.length || 0}条,总共
|
||||
{query?.data?.totalCount || 0}条
|
||||
</div>
|
||||
<Button
|
||||
disabled={pagination.pageIndex === 0}
|
||||
onClick={() =>
|
||||
setPagination({
|
||||
...pagination,
|
||||
pageIndex: pagination.pageIndex - 1,
|
||||
})
|
||||
}
|
||||
>
|
||||
上一页
|
||||
</Button>
|
||||
<Button disabled variant="ghost">
|
||||
1 / 1
|
||||
</Button>
|
||||
<Button
|
||||
disabled={pagination.pageIndex === query?.data?.pageCount - 1}
|
||||
onClick={() =>
|
||||
setPagination({
|
||||
...pagination,
|
||||
pageIndex: pagination.pageIndex + 1,
|
||||
})
|
||||
}
|
||||
>
|
||||
下一页
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ export function RiskSettingDialog({ open, setOpen }: RiskSettingDialogProps) {
|
||||
</Button>
|
||||
</div>
|
||||
<div className="mt-2 overflow-auto max-h-[400px]">
|
||||
<DataTable table={table} query={query} showPagination={false} />
|
||||
<DataTable table={table} query={query} />
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AppLayout } from "@/components/app-layout";
|
||||
import { useIsPlatformOrg } from "@/stores/user";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { ShieldAlert, Building2, Network, UserRoundPen } from "lucide-react";
|
||||
import { ShieldAlert, Building2, UserRoundPen } from "lucide-react";
|
||||
|
||||
export const Route = createFileRoute("/admin")({
|
||||
component: Layout,
|
||||
|
||||
@@ -11,7 +11,7 @@ export const Route = createFileRoute("/admin/tenant/")({
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
export function useColumns({ handleEditOrg }: any) {
|
||||
export function useColumns({ handleEditOrg: _handleEditOrg }: any) {
|
||||
return [
|
||||
{
|
||||
accessorKey: "orgName",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { toast } from "sonner";
|
||||
|
||||
export const useCancelUser = (mutationOptions?: any) => {
|
||||
const { mutateAsync: cancelMutateAsync, isPending: cancelIsPending } =
|
||||
useMutation({
|
||||
useMutation<any, Error, number>({
|
||||
mutationFn: cancelUser,
|
||||
...(mutationOptions || {}),
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createFileRoute, useRouter, useSearch } from "@tanstack/react-router";
|
||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
@@ -12,8 +12,6 @@ import {
|
||||
} from "@/components/ui/form";
|
||||
import {
|
||||
Empty,
|
||||
EmptyContent,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyMedia,
|
||||
EmptyTitle,
|
||||
|
||||
@@ -27,9 +27,9 @@ type UserStoreActions = {
|
||||
|
||||
type UserStore = UserStoreState & UserStoreActions;
|
||||
|
||||
export const useUserStore = create<UserStore>(
|
||||
export const useUserStore = create<UserStore>()(
|
||||
persist(
|
||||
subscribeWithSelector((set: any) => ({
|
||||
subscribeWithSelector<UserStore>((set) => ({
|
||||
token: null,
|
||||
user: null,
|
||||
org: null,
|
||||
|
||||
Reference in New Issue
Block a user