123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- 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<CaseFileType[]>(caseFileTypes)).data;
- export const getCaseFiles = async (props: {
- caseId: number;
- filesTypeId?: number;
- }) => (await axios.get<CaseFile[]>(caseFiles, { params: props })).data;
- export const addCaseFile = (
- data: Pick<CaseFile, "caseId" | "filesTitle" | "filesTypeId"> & { file: File }
- ) => axios.post(insertCaseFile, data);
- export const setCaseFile = (props: Pick<CaseFile, "filesId" | "filesTitle">) =>
- axios.post(updateCaseFile, props);
- export const delCaseFile = (props: Pick<CaseFile, "caseId" | "filesId">) =>
- axios.post(deleteCaseFile, props);
- export const getCaseFileImageInfo = async (fileId: number) => {
- const data = (
- await axios.get<CaseFile | null>(caseFileInfo, {
- params: { filesId: fileId },
- })
- ).data;
- return (
- data &&
- ({
- ...data,
- content: JSON.parse(data.content as any),
- } as CaseFile)
- );
- };
- export type SaveCaseFileImageInfo = Pick<CaseFile, "caseId" | "filesTitle"> & {
- filesId?: number;
- imgType: BoardType;
- content: BoardData;
- file: File;
- ognFileUrl?: string;
- };
- export const saveCaseFileImageInfo = async (props: SaveCaseFileImageInfo) =>
- (
- await axios.post<Required<SaveCaseFileImageInfo>>(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[];
- }
|