bill vor 8 Monaten
Ursprung
Commit
04589c0ecf

+ 4 - 4
src/api/constant.ts

@@ -109,7 +109,7 @@ export const FLODER_LIST = `${namespace}/caseFiles/allList`
 export const UPLOAD_FILE = `${namespace}/upload/file`
 
 // 素材库分页
-export const MATERIAL_PAG = `${namespace}/material/allList`
-export const ADD_MATERIAL = `${namespace}/material/add`
-export const DEL_MATERIAL = `${namespace}/material/del`
-export const MATERIAL_GROUP_LIST = `${namespace}/material/allList`
+export const MATERIAL_PAG = `/service/manage/dictFile/pageList/media-library`
+export const ADD_MATERIAL = `/service/manage/common/upload/fileNew`
+export const DEL_MATERIAL = `/service/manage/dictFile/del/media-library`
+export const MATERIAL_GROUP_LIST = `/service/manage/dict/getByKey/media-library`

+ 63 - 17
src/api/material.ts

@@ -1,8 +1,35 @@
 import { asyncTimeout, jsonToForm } from "@/utils";
 import { PagingRequest, PagingResult } from ".";
-import { ADD_MATERIAL, DEL_MATERIAL, MATERIAL_GROUP_LIST, MATERIAL_PAG, UPLOAD_HEADS } from "./constant";
+import {
+  ADD_MATERIAL,
+  DEL_MATERIAL,
+  MATERIAL_GROUP_LIST,
+  MATERIAL_PAG,
+  UPLOAD_HEADS,
+} from "./constant";
 import axios from "./instance";
 
+type ServiceMaterialGroup = {
+  dictKey: string;
+  dictName: string;
+  id: number;
+};
+type ServiceMaterial = {
+  createTime: string;
+  dictId: number;
+  dictName: string;
+  fileFormat: string;
+  fileName: string;
+  fileSize: string;
+  fileType: string;
+  fileUrl: string;
+  id: number;
+  name: string;
+  newFileName: string;
+  typeKey: string;
+  updateTime: string;
+  uploadId: number;
+};
 export type MaterialGroup = {
   id: number;
   name: string;
@@ -16,35 +43,54 @@ export type Material = {
   size: number;
   groupId: number;
   group: string;
-  modelId?: number
+  modelId?: number;
 };
 
-export type MaterialPageProps = PagingRequest<Partial<Material> & {groupIds: number[]}>;
+export type MaterialPageProps = PagingRequest<
+  Partial<Material> & { groupIds: number[], formats: string[] }
+>;
 export const fetchMaterialPage = async (params: MaterialPageProps) => {
-  const material = await axios.get<PagingResult<Material[]>>(MATERIAL_PAG, { params })
-  return material
+  //
+  const material = await axios.post<PagingResult<ServiceMaterial[]>>(MATERIAL_PAG, {
+    pageNum: params.pageNum,
+    pageSize: params.pageSize,
+    dictIds: params.groupIds,
+    fileFormats: params.formats
+  });
+  const nm = {
+    ...material,
+    list: material.list.map((item): Material => ({
+      id: item.id,
+      name: item.fileName,
+      format: item.fileFormat,
+      url: item.fileUrl,
+      size: Number(item.fileSize),
+      groupId: item.dictId,
+      group: item.dictName,
+    }))
+  }
+  
+  return nm;
 };
 
 export const fetchMaterialGroups = async () => {
-  await asyncTimeout(160)
-  const groups: MaterialGroup[] = [
-    {id: 1, name: '分组1'},
-    {id: 2, name: '分组2'},
-  ]
-  return groups
-  // return axios.get<MaterialGroup[]>(MATERIAL_GROUP_LIST);
+  return (await axios.get<ServiceMaterialGroup[]>(MATERIAL_GROUP_LIST)).map(
+    (item) => ({
+      name: item.dictName,
+      id: item.id,
+    })
+  ) as MaterialGroup[];
 };
 
 export const addMaterial = (file: File) => {
-  console.log(file)
   return axios<string>({
     method: "POST",
     url: ADD_MATERIAL,
     data: jsonToForm({ file }),
     headers: { ...UPLOAD_HEADS },
   });
-}
+};
 
-export const delMaterial = (id: Material['id']) => {
-  return axios.post(DEL_MATERIAL, { id })
-}
+export const delMaterial = (id: Material["id"]) => {
+  return axios.post(DEL_MATERIAL, { id });
+};

+ 9 - 8
src/components/materials/index.vue

@@ -113,7 +113,12 @@ const ft = computed(() => {
 });
 
 const Search = Input.Search;
-const params = reactive({ pageNum: 1, pageSize: 12 }) as MaterialPageProps;
+const params = reactive({
+  pageNum: 1,
+  pageSize: 12,
+  groupIds: [],
+  formats: props.format,
+}) as MaterialPageProps;
 const origin = ref<PagingResult<Material[]>>({
   list: [],
   pageNum: 1,
@@ -138,12 +143,6 @@ const rowSelection: any = ref({
     }
   },
   getCheckboxProps: (record: Material) => {
-    console.log(
-      props.format && !props.format.includes(record.format),
-      props.maxSize && record.size > props.maxSize,
-      props.maxSize,
-      record.size
-    );
     return {
       disabled:
         (props.format && !props.format.includes(record.format)) ||
@@ -153,22 +152,24 @@ const rowSelection: any = ref({
 });
 const cloumns = computed(() => [
   {
-    width: "400px",
     title: "名称",
     dataIndex: "name",
     key: "name",
   },
   {
+    width: "100px",
     title: "格式",
     dataIndex: "format",
     key: "format",
   },
   {
+    width: "100px",
     title: "大小",
     dataIndex: "size",
     key: "size",
   },
   {
+    width: "100px",
     title: "分组",
     dataIndex: "group",
     key: "group",

+ 3 - 1
src/env/index.ts

@@ -1,7 +1,7 @@
 import { stackFactory, flatStacksValue, strToParams } from '@/utils'
 import { reactive, ref } from 'vue'
 
-import type { FuseModel, TaggingPosition, View } from '@/store'
+import type { FuseModel, Path, TaggingPosition, View } from '@/store'
 export const namespace = '/fusion'
 export const viewModeStack = stackFactory(ref<'full' | 'auto'>('auto'))
 export const showToolbarStack = stackFactory(ref<boolean>(false))
@@ -15,6 +15,7 @@ export const showBottomBarStack = stackFactory(ref<boolean>(false), true)
 export const bottomBarHeightStack = stackFactory(ref<string>('60px'))
 export const showTaggingsStack = stackFactory(ref<boolean>(true))
 export const showPathsStack = stackFactory(ref<boolean>(true))
+export const showPathStack = stackFactory(ref<Path['id']>())
 export const showMeasuresStack = stackFactory(ref<boolean>(true))
 export const currentModelStack = stackFactory(ref<FuseModel | null>(null))
 export const showModelsMapStack = stackFactory(ref<WeakMap<FuseModel, boolean>>(new WeakMap()), true)
@@ -31,6 +32,7 @@ export const custom = flatStacksValue({
   shwoRightCtrlPano: showRightCtrlPanoStack,
   showTaggings: showTaggingsStack,
   showPaths: showPathsStack,
+  showPath: showPathStack,
   showMeasures: showMeasuresStack,
   currentModel: currentModelStack,
   showModelsMap: showModelsMapStack,

+ 1 - 1
src/layout/left-pano.vue

@@ -41,7 +41,7 @@ import { custom } from "@/env";
   border-radius: 0 6px 6px 0;
   top: 50%;
   transform: translateY(-50%);
-  z-index: 1000;
+  z-index: 100;
   display: flex;
   align-items: center;
   justify-content: center;

+ 21 - 4
src/sdk/association/path.ts

@@ -2,10 +2,11 @@ import { diffArrayChange, mount, shallowWatchArray } from "@/utils";
 import TaggingComponent from "@/components/path/list.vue";
 import { Path as PathData, paths } from "@/store/path";
 import { sdk, Path, SDK } from "../sdk";
-import { reactive, watch } from "vue";
+import { reactive, ref, watch, watchEffect } from "vue";
 import { groupProxy } from "@/store/group";
 import { isScenePlayRun, pauseScene, playScene } from "@/utils/full";
 import { analysisPose, setPose } from ".";
+import { custom, showPathsStack, showPathStack } from "@/env";
 
 // -----------------导览线关联--------------------
 export type PathNode = Path;
@@ -23,7 +24,7 @@ export const getPathNode = (
   return pathNodes.get(path);
 };
 
-export const taggingsGroup = groupProxy(() => {
+export const pathsGroup = groupProxy(() => {
   const nodes = [] as PathNode[];
   for (const path of paths.value) {
     const node = getPathNode(path);
@@ -34,16 +35,29 @@ export const taggingsGroup = groupProxy(() => {
   return nodes;
 });
 
+watchEffect(() => {
+  pathsGroup.visibility(custom.showPaths);
+  if (custom.showPath) {
+    const node = getPathNode(custom.showPath);
+    node?.visibility(true);
+    node?.fly()
+    console.log('a1', node, custom.showPath)
+  }
+})
 
-export const playScenePath = (
+export const playScenePath = async (
   path: PathData,
   forceFull = false,
 ) => {
   const node = getPathNode(path)
   if (!node) return null;
 
+  showPathsStack.push(ref(false))
+  showPathStack.push(ref(path.id))
+
+  
   let initPose: any;
-  playScene({
+  await playScene({
     play: () => {
       return new Promise(resolve => {
         initPose = analysisPose(sdk.getPose());
@@ -55,6 +69,9 @@ export const playScenePath = (
       node.pause();
     }
   }, forceFull)
+
+  showPathsStack.pop()
+  showPathStack.pop()
 }
 
 export const pauseScenePath = pauseScene

+ 0 - 1
src/store/path.ts

@@ -28,7 +28,6 @@ export const paths = ref<Paths>([])
 export const getPath = (id: Path['id']) => paths.value.find(path => path.id === id)
 
 export const getPathIsShow = (path: Path) => {
-  if (!custom.showPaths) return false;
   const modelIds = path.points.map(item => item.modelId)
   if (path.linePosition?.modelId) {
     modelIds.push(path.linePosition.modelId)

+ 1 - 1
src/utils/full.ts

@@ -1,4 +1,4 @@
-import { showLeftPanoStack, viewModeStack } from "@/env";
+import { showLeftPanoStack, showPathsStack, showPathStack, viewModeStack } from "@/env";
 import { togetherCallback } from ".";
 import { ref, watch } from "vue";
 import { isEdit, sysBus } from "@/store";

+ 10 - 9
src/views/guide/path/edit-path.vue

@@ -114,7 +114,7 @@
           @click="switchPlay"
           v-if="data.points.length"
         >
-          {{ isScenePathPlayIng ? "停止" : "" }} 预览路径
+          {{ isScenePathPlayIng ? "停止" : "" }}预览路径
         </Button>
       </div>
       <div v-if="~activePointNdx">
@@ -174,9 +174,6 @@ import {
   pauseScenePath,
   playScenePath,
 } from "@/sdk/association/path";
-import { nextTick } from "process";
-import path from "path";
-import { sdk, analysisPose, setPose } from "@/sdk";
 
 const props = defineProps<{ data: Path }>();
 
@@ -185,11 +182,15 @@ defineEmits<{
 }>();
 
 const node = computed(() => getPathNode(props.data.id));
-watch(node, () => {
-  if (props.data.points.length) {
-    node.value?.fly();
-  }
-});
+watch(
+  node,
+  () => {
+    if (props.data.points.length) {
+      node.value?.fly();
+    }
+  },
+  { immediate: true }
+);
 
 const activePointNdx = ref(-1);
 watchEffect((onCleanup) => {

+ 11 - 2
src/views/guide/path/edit.vue

@@ -20,17 +20,24 @@
 </template>
 
 <script lang="ts" setup>
-import { ref } from "vue";
+import { computed, ref } from "vue";
 import PathSign from "./sign.vue";
 import EditPath from "./edit-path.vue";
+import { getPathNode, pathsGroup } from "@/sdk/association/path";
 import { useViewStack } from "@/hook";
 import { paths, enterEdit, sysBus, autoSavePaths, createPath, enterOld } from "@/store";
 
 import type { Path } from "@/store";
 import { Dialog } from "bill/expose-common";
+import { showPathsStack, showPathStack } from "@/env";
 
 const currentPath = ref<Path | null>();
-const leaveEdit = () => (currentPath.value = null);
+const leaveEdit = () => {
+  currentPath.value = null;
+  pathsGroup.visibility(true);
+  showPathsStack.pop();
+  showPathStack.pop();
+};
 const edit = (path?: Path) => {
   if (!path) {
     path = createPath();
@@ -39,6 +46,8 @@ const edit = (path?: Path) => {
   currentPath.value = path;
   enterEdit();
   sysBus.on("leave", leaveEdit);
+  showPathsStack.push(ref(false));
+  showPathStack.push(computed(() => path.id));
 };
 
 const deletePath = (path: Path) => {

+ 13 - 8
src/views/tagging/edit.vue

@@ -97,7 +97,9 @@
               <ui-icon type="add" /> 支持 mp3/wav 格式,≤30MB
             </p>
             <p v-else class="rep-val">
-              {{ getFileName(tagging.audio) }}
+              <span>
+                {{ getFileName(tagging.audio) }}
+              </span>
               <ui-icon class="icon" @click.stop="tagging.audio = ''" type="del" ctrl />
             </p>
           </template>
@@ -302,14 +304,17 @@ const imageSelect = async () => {
 
 <style lang="scss" scoped>
 .rep-val {
-  width: 100%;
-  position: relative;
-  text-align: center;
+  width: 80%;
+  display: flex;
+  align-items: center;
+  span {
+    flex: 1;
+    text-align: center;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
   .icon {
-    position: absolute;
-    right: 10px;
-    top: 50%;
-    transform: translateY(-50%);
     pointer-events: all;
   }
 }