import { caseFileTypes, caseFiles, insertCaseFile, deleteCaseFile, updateCaseFile, axios, caseFileInfo, saveCaseFileInfo, } from "@/request"; // 可以绘画的fileType export enum BoardType { map = "0", scene = "1", aimap = "2", } export interface CaseFileType { filesTypeId: number; filesTypeName: string; tbStatus: number; createTime: string; updateTime: string; } export interface CaseFile { filesId: number; caseId: number; filesTypeId: number; filesTitle: string; filesUrl: string; tbStatus: number; createTime: string; updateTime: string; imgType?: BoardType; content: BoardData; } export const getCaseFileTypes = async () => (await axios.get(caseFileTypes)).data; export const getCaseFiles = async (props: { caseId: number; filesTypeId?: number; }) => (await axios.get(caseFiles, { params: props })).data; export const addCaseFile = ( data: Pick & { file: File } ) => axios.post(insertCaseFile, data); export const setCaseFile = (props: Pick) => axios.post(updateCaseFile, props); export const delCaseFile = (props: Pick) => axios.post(deleteCaseFile, props); export const getCaseFileImageInfo = async (fileId: number) => { const data = ( await axios.get(caseFileInfo, { params: { filesId: fileId }, }) ).data; return ( data && ({ ...data, content: JSON.parse(data.content as any), } as CaseFile) ); }; export type SaveCaseFileImageInfo = Pick & { filesId?: number; imgType: BoardType; content: BoardData; file: File; ognFileUrl?: string; }; export const saveCaseFileImageInfo = async (props: SaveCaseFileImageInfo) => ( await axios.post>(saveCaseFileInfo, { filesTypeId: 1, ...props, content: JSON.stringify(props.content), }) ).data; import type { brokenLine, text, table, rect, circular, arrow, icon, cigarette, fireoint, footPrint, shoePrint, fingerPrint, corpse, theBlood, compass, title, bgImage, } from "@/view/case/draw/board"; export interface Pos { x: number; y: number; } interface ShapeData { color: string; } interface CurrencyShapeData extends ShapeData { pos: Pos; width: number; height: number; } export interface TitleShapeData extends ShapeData { text: string; type: typeof title; } export interface BgImageShapeData extends ShapeData { url: string; type: typeof bgImage; } export interface CompassShapeData extends ShapeData { rotate: number; type: typeof compass; } export interface BrokenLineShapeData extends ShapeData { type: typeof brokenLine; points: Pos[]; } export interface TextShapeData extends ShapeData { type: typeof text; text: string; fontSize: number; } export type TableShapeContentItem = { width: number; height: number; value: string; rowIndex: number; colIndex: number; }; export interface TableShapeData extends CurrencyShapeData { type: typeof table; content: TableShapeContentItem[]; } export interface RectShapeData extends CurrencyShapeData { type: typeof rect; } export interface CircularShapeData extends CurrencyShapeData { type: typeof circular; } export interface ArrowShapeData extends CurrencyShapeData { type: typeof arrow; direction: number; } export interface IconShapeData extends CurrencyShapeData { type: typeof icon; index: number; } export interface CigaretteShapeData extends CurrencyShapeData { type: typeof cigarette; } export interface FireointShapeData extends CurrencyShapeData { type: typeof fireoint; } export interface FootPrintShapeData extends CurrencyShapeData { type: typeof footPrint; } export interface ShoePrintShapeData extends CurrencyShapeData { type: typeof shoePrint; } export interface FingerPrintShapeData extends CurrencyShapeData { type: typeof fingerPrint; } export interface CorpseShapeData extends CurrencyShapeData { type: typeof corpse; } export interface TheBloodShapeData extends CurrencyShapeData { type: typeof theBlood; } export interface FootPrintShapeData extends CurrencyShapeData { type: typeof footPrint; } export type BoardShapeData = | BrokenLineShapeData | TextShapeData | TableShapeData | RectShapeData | CircularShapeData | ArrowShapeData | IconShapeData | CigaretteShapeData | FireointShapeData | FootPrintShapeData | ShoePrintShapeData | FingerPrintShapeData | CorpseShapeData | TheBloodShapeData | TitleShapeData | BgImageShapeData | CompassShapeData; export interface BoardData { id: number; ognFilesUrl: string | null; shapes: BoardShapeData[]; }