bill 8 months ago
parent
commit
db7954611f
6 changed files with 30 additions and 71 deletions
  1. 7 4
      src/api/constant.ts
  2. 2 50
      src/api/material.ts
  3. 4 11
      src/api/path.ts
  4. 2 0
      src/components/path/sign.vue
  5. 2 1
      src/sdk/association/tagging.ts
  6. 13 5
      src/store/group.ts

+ 7 - 4
src/api/constant.ts

@@ -40,11 +40,12 @@ export const INSERT_TAGGING = `${namespace}/caseTag/add`
 export const UPDATE_TAGGING = `${namespace}/caseTag/update`
 export const DELETE_TAGGING = `${namespace}/caseTag/delete`
 
+
 // 路线列表
-export const PATH_LIST = `${namespace}/path/allList`
-export const INSERT_PATH = `${namespace}/path/add`
-export const UPDATE_PATH = `${namespace}/path/update`
-export const DELETE_PATH = `${namespace}/path/delete`
+export const PATH_LIST = `${namespace}/casePath/info`
+export const INSERT_PATH = `${namespace}/casePath/saveOrUpdate`
+export const UPDATE_PATH = `${namespace}/casePath/saveOrUpdate`
+export const DELETE_PATH = `${namespace}/casePath/del`
 
 // 标签放置列表
 export const TAGGING_POINT_LIST = `${namespace}/caseTagPoint/allList`
@@ -100,8 +101,10 @@ export const UPDATE_SETTING = `${namespace}/caseSettings/saveOrUpdate`
 export const FOLDER_TYPE_LIST = `${namespace}/caseFilesType/allList`
 
 // 卷宗
+// export const FLODER_LIST = `${namespace}/caseFiles/allList`
 export const FLODER_LIST = `${namespace}/caseFiles/allList`
 
+
 // 文件上传
 export const UPLOAD_FILE = `${namespace}/upload/file`
 

+ 2 - 50
src/api/material.ts

@@ -21,56 +21,8 @@ export type Material = {
 
 export type MaterialPageProps = PagingRequest<Partial<Material> & {groupIds: number[]}>;
 export const fetchMaterialPage = async (params: MaterialPageProps) => {
-  await asyncTimeout(160)
-  let materials: PagingResult<Material[]> = {
-    ...params,
-    total: 100,
-    list: [
-      {
-        id: params.pageNum,
-        name: "test",
-        format: params.format || "png",
-        url: "icon/h_default_64.png",
-        groupId: 1,
-        group: "分组1",
-        size: 1024,
-      },
-      {
-        id: params.pageNum + 100,
-        name: "test",
-        format: params.format || "mp3",
-        url: "icon/h_default_64.png",
-        groupId: 1,
-        group: "分组1",
-        size: 1024,
-      },
-      {
-        id: params.pageNum + 200,
-        name: "test",
-        format: params.format || "mp4",
-        url: "icon/h_default_64.png",
-        groupId: 1,
-        group: "分组1",
-        size: 1024,
-      },
-      {
-        id: params.pageNum + 300,
-        name: "mesh",
-        format: "obj",
-        url: "icon/h_default_64.png",
-        groupId: 2,
-        group: "分组2",
-        modelId: 1055,
-        size: 254.58 * 1024 * 1024,
-      },
-    ],
-  };
-  if (params.groupIds) {
-    materials.list =  materials.list.filter(i => params.groupIds.includes(i.groupId))
-  }
-  return materials
-  // const material = await axios.get<PagingResult<Material[]>>(MATERIAL_PAG, { params })
-  // return material
+  const material = await axios.get<PagingResult<Material[]>>(MATERIAL_PAG, { params })
+  return material
 };
 
 export const fetchMaterialGroups = async () => {

+ 4 - 11
src/api/path.ts

@@ -1,7 +1,6 @@
 import axios from "./instance";
 import { params } from "@/env";
 import { PATH_LIST, DELETE_PATH, INSERT_PATH, UPDATE_PATH } from "./constant";
-import { createPath } from "@/store";
 
 interface ServerPath {
   id: number;
@@ -44,16 +43,10 @@ const localToService = (path: Path): ServerPath => ({
 });
 
 export const fetchPaths = async () => {
-  const paths: Paths = [
-    // createPath({ name: "路径1" }),
-    // createPath({ name: "路径3" }),
-  ];
-
-  return paths;
-  // const staggings = await axios.get<ServerPath[]>(PATH_LIST, {
-  //   params: { caseId: params.caseId },
-  // });
-  // return staggings.map(serviceToLocal);
+  const staggings = await axios.get<ServerPath[]>(PATH_LIST, {
+    params: { caseId: params.caseId },
+  });
+  return staggings.map(serviceToLocal);
 };
 
 export const postAddPath = async (path: Path) => {

+ 2 - 0
src/components/path/sign.vue

@@ -35,6 +35,7 @@ const getLineProps = () => ({
   modelId: props.path.linePosition?.modelId || props.path.points[0]?.modelId,
 });
 
+console.log("create", sdk.createPath);
 const path = sdk.createPath({
   name: props.path.name,
   showName: props.path.showName,
@@ -44,6 +45,7 @@ const path = sdk.createPath({
   line: getLineProps(),
   points: props.path.points,
 });
+console.log(props.path.points);
 // path.changeCanEdit(false);
 
 watchEffect(() => path.visibilityName(props.path.showName));

+ 2 - 1
src/sdk/association/tagging.ts

@@ -58,10 +58,11 @@ export const taggingGroup = (tagging: Tagging | Tagging["id"]) => {
     const nodes = [] as TaggingPositionNode[];
     if (typeof tagging !== "object") {
       tagging = taggings.value.find((item) => item.id === tagging)!;
+
       if (tagging) {
         const node = getTaggingNode(tagging);
         if (node) {
-          nodes.push(...node.map(({ node }) => node));
+          nodes.push(...node.map(({ node }) => node).filter(node => node));
         }
       }
     }

+ 13 - 5
src/store/group.ts

@@ -12,16 +12,24 @@ export const groupProxy = <T extends object>(
     {
       get(_, key) {
         const group = getter();
-        const res = group.filter(item => !!item).map((item: any) => item[key]) as any[];
+        const res = group
+          .filter((item) => !!item)
+          .map((item: any) => item[key]) as any[];
         if (res.length && typeof res[0] !== "function") {
           return res;
         }
 
         return function (...args: any[]) {
+          const group = getter();
+          const res = group
+            .filter((item) => !!item)
+            .map((item: any) => item[key]) as any[];
           const funRes = [] as any[];
           for (let i = 0; i < group.length; i++) {
-            const fun = res[i];
-            funRes[i] = fun.apply(group[i], args);
+            if (res[i]) {
+              const fun = res[i];
+              funRes[i] = fun.apply(group[i], args);
+            }
           }
           return funRes;
         };
@@ -29,9 +37,9 @@ export const groupProxy = <T extends object>(
       set(_, key, val) {
         const group = getter() as any[];
         for (const item of group) {
-          item[key] = val
+          item[key] = val;
         }
-        return true
+        return true;
       },
     }
   ) as GroupProxy<T>;