bill 1 year ago
parent
commit
973134a70b

+ 5 - 1
src/components/dialog/index.vue

@@ -24,7 +24,7 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref, watch, watchEffect } from "vue";
+import { computed, ref, watch, watchEffect, nextTick } from "vue";
 import { user } from "@/store/user";
 import { operateIsPermissionByPath } from "@/directive/permission";
 import { DialogProps } from "./type";
@@ -58,6 +58,10 @@ const deleteHandle = () => {
   emit("delete");
 };
 
+if (!showFloor.value) {
+  nextTick(() => enterHandle());
+}
+
 const disabled = computed(() => props.power && !operateIsPermissionByPath(props.power));
 </script>
 

+ 23 - 4
src/store/statistics.ts

@@ -1,3 +1,4 @@
+import { place } from "@/app/fire/constant/fire";
 import {
   axios,
   cameraTypeStatistics,
@@ -15,20 +16,38 @@ export type StatisticsParams = {
 export type StatisticsItem = { groupKey: string; dataCount: number };
 export type StatisticsItems = StatisticsItem[];
 
+const getAmount = (sItem: StatisticsItem, options: string[]) =>
+  options.length - options.findIndex((item) => item === sItem.groupKey);
+
 export const getSceneStatistics = async (params: StatisticsParams) =>
   (await axios.post<StatisticsItems>(sceneStatistics, params)).data;
 
 export const getCaseStatistics = async (params: StatisticsParams) =>
   (await axios.post<StatisticsItems>(caseStatistics, params)).data;
 
-export const getCameraTypeStatistics = async (params: StatisticsParams) =>
-  (await axios.post<StatisticsItems>(cameraTypeStatistics, params)).data;
+const types = ["八目", "双目转台", "激光转台", "激光移动"];
+export const getCameraTypeStatistics = async (params: StatisticsParams) => {
+  const typeItems = (
+    await axios.post<StatisticsItems>(cameraTypeStatistics, params)
+  ).data;
+  typeItems.sort((a, b) => getAmount(b, types) - getAmount(a, types));
+  console.log(typeItems);
+  return typeItems;
+};
 
 export const getCaseTimeStatistics = async (params: StatisticsParams) =>
   (await axios.post<StatisticsItems>(caseTimeStatistics, params)).data;
 
-export const getCasePlaceStatistics = async (params: StatisticsParams) =>
-  (await axios.post<StatisticsItems>(casePlaceStatistics, params)).data;
+const placeLabels = place.map((item) => item.label);
+export const getCasePlaceStatistics = async (params: StatisticsParams) => {
+  const placeItems = (
+    await axios.post<StatisticsItems>(casePlaceStatistics, params)
+  ).data;
+  placeItems.sort(
+    (a, b) => getAmount(b, placeLabels) - getAmount(a, placeLabels)
+  );
+  return placeItems;
+};
 
 export const getCaseReasonStatistics = async (params: StatisticsParams) =>
   (await axios.post<StatisticsItems>(caseReasonStatistics, params)).data;

+ 2 - 2
src/view/case/draw/edit-shape/index.ts

@@ -1,5 +1,5 @@
 import { markRaw, reactive } from "vue";
-import { images, customImage } from "../board/useBoard";
+import { images, customImage,  } from "../board/useBoard";
 
 const componentLoads = import.meta.glob("./*.vue");
 
@@ -7,7 +7,7 @@ export const components: { [key in string]: any } = reactive({});
 
 const map = {
   label: ["Circle", "Rectangle", "Wall", "Arrow"],
-  image: [...images, customImage],
+  image: [...images, customImage, 'BgImage'],
   delete: ["Icon"],
 };
 

+ 9 - 4
src/view/case/draw/selectFuseImage.vue

@@ -91,7 +91,8 @@ const refreshBlob = async () => {
     return;
   }
   const width = 500;
-  const fuseImage = await getFuseImage(iframeRef.value, width, width);
+  const height = 390;
+  const fuseImage = await getFuseImage(iframeRef.value, width, height);
   if (fuseImage?.blob) {
     imageBlob.value =
       fuseImage.type !== FuseImageType.FUSE
@@ -161,17 +162,21 @@ watchEffect(async (onClanup) => {
 
 <style lang="scss" scoped>
 .house-layout {
+  --w: calc(500 / 390 * var(--h));
+  --h: 610px;
   display: flex;
-  height: 556px;
+  height: var(--h);
 }
 
 .iframe-layout {
   height: 100%;
-  flex: 0 0 1040px;
+  flex: 0 0 var(--w);
+  display: flex;
+  align-items: center;
   iframe {
     border: none;
     width: 100%;
-    height: 100%;
+    height: var(--h);
   }
 }
 

+ 10 - 7
src/view/case/help.ts

@@ -182,7 +182,7 @@ export type FuseImageRet = { type: FuseImageType; blob: Blob | null };
 export const getFuseImage = async (
   iframe: HTMLIFrameElement,
   width: number = 500,
-  height: number = width
+  height: number = 390
 ) => {
   const typeMap = await getIframeSceneType(iframe);
   let blob: Blob | null = null;
@@ -218,8 +218,10 @@ export const fuseImageJoinHot = async (
   iframe: HTMLIFrameElement,
   rawBlob: Blob,
   showTags: CaseTagging[],
-  width = 500
+  width = 500,
+  height = 390
 ) => {
+  console.log(width, showTags)
   // fuse场景需要特别处理
   const img = new Image();
   img.src = URL.createObjectURL(rawBlob);
@@ -243,14 +245,15 @@ export const fuseImageJoinHot = async (
     );
     if (index !== -1) {
       const bound = hot.getBoundingClientRect();
-      const size = (img.width / width) * 32;
+      const wsize = (img.width / width) * 32;
+      const hsize = (img.height / height) * 32;
 
-      const left = bound.left + size / 2;
-      const top = bound.top + size / 2;
+      const left = bound.left + wsize / 2;
+      const top = bound.top + hsize / 2;
       ctx.save();
       ctx.translate(left, top);
       ctx.beginPath();
-      ctx.arc(0, 0, size / 2, 0, 2 * Math.PI);
+      ctx.arc(0, 0, hsize / 2, 0, 2 * Math.PI);
       ctx.strokeStyle = "#000";
       ctx.fillStyle = "#fff";
       ctx.stroke();
@@ -259,7 +262,7 @@ export const fuseImageJoinHot = async (
       ctx.fillStyle = "#000";
       ctx.textAlign = "center";
       ctx.textBaseline = "middle";
-      ctx.font = `normal ${size / 2}px serif`;
+      ctx.font = `normal ${hsize / 2}px serif`;
       ctx.fillText((index + 1).toString(), 0, 0);
       ctx.restore();
     }

+ 1 - 1
src/view/case/quisk.ts

@@ -38,7 +38,7 @@ export const showCaseScenes = quiskMountFactory(SceneList, {
 
 export const selectFuseImage = quiskMountFactory(SelectFuseImage, {
   title: "选择户型图",
-  width: 1500,
+  width: 1300,
 })<FuseImage>;
 
 export const selectMapImage = quiskMountFactory(SelectMapImage, {

+ 1 - 1
src/view/vrmodel/downloadLog.vue

@@ -12,7 +12,7 @@
       </el-form-item>
       <el-form-item label="下载时间:">
         <el-date-picker
-          type="date"
+          type="datetime"
           v-model="state.query.createTime"
           placeholder="请选择"
           style="width: 100%"

+ 17 - 6
src/view/vrmodel/quisk.ts

@@ -1,7 +1,8 @@
-import { QuoteScene } from "@/store/scene";
+import { QuoteScene, SceneType } from "@/store/scene";
 import EditModel from "./editModel.vue";
 import SceneDownload from "./sceneDownload.vue";
 import { quiskMountFactory } from "@/helper/mount";
+import { axios, checkHasDownload } from "@/request";
 
 export const editModelScene = quiskMountFactory(EditModel, {
   title: "编辑模型",
@@ -9,9 +10,19 @@ export const editModelScene = quiskMountFactory(EditModel, {
 });
 
 export type SceneDpwnloadProps = { scene: QuoteScene };
+export const sceneDownload = async(props: SceneDpwnloadProps) => {
+  const params = {
+    num: props.scene.num,
+    isObj: Number(![SceneType.SWSS, SceneType.SWYDSS].includes(props.scene.type)),
+  };
+  const res = await axios.get(checkHasDownload, { params });
+  const hideFloor = Number(res.data.downloadStatus) !== 3
 
-export const sceneDownload = quiskMountFactory(SceneDownload, {
-  title: "场景离线包下载",
-  width: 500,
-  hideFloor: true,
-});
+  const sceneDownloadDialog = quiskMountFactory(SceneDownload, {
+    title: "场景离线包下载",
+    width: 500,
+    hideFloor: hideFloor,
+    enterText: '下 载'
+  });
+  return await sceneDownloadDialog(props);
+}

+ 19 - 15
src/view/vrmodel/sceneDownload.vue

@@ -13,8 +13,8 @@
         <span>{{ filename }}</span>
         <span>{{ percent }}%</span>
       </div>
-      <div>
-        <el-slider :disabled="true" v-model="percent" :show-tooltip="false" />
+      <div style="pointer-events: none">
+        <el-slider v-model="percent" :show-tooltip="false" />
       </div>
     </div>
     <div v-else-if="state === State.readDown">
@@ -27,12 +27,11 @@
 import { computed, onMounted, onUnmounted, ref } from "vue";
 import saveAs from "@/util/file-serve";
 import { checkHasDownload, getDownloadProcess, downloadScene, axios } from "@/request";
-import { ElMessage } from "element-plus";
+import { ElLoading, ElMessage } from "element-plus";
 import { QuoteScene, SceneType } from "@/store/scene";
 import { QuiskExpose } from "@/helper/mount";
 
 const props = defineProps<{ scene: QuoteScene }>();
-console.log(props);
 enum State {
   uncreate,
   package,
@@ -50,7 +49,6 @@ const getState = (type: number) => {
   );
 };
 
-const show = ref(false);
 const state = ref<State>(State.uncreate);
 const count = ref<number>(0);
 const filename = ref<string>(props.scene.title + ".zip");
@@ -85,13 +83,10 @@ const initial = async () => {
     }
   }
 
-  show.value = true;
-  console.log(state.value === State.readDown);
   if (state.value === State.package) {
-    refreshPercent();
+    await new Promise<void>((resolve) => requestUpdateURL(resolve));
   } else {
     downloadURL.value = res.data.downloadUrl;
-    download();
   }
 };
 
@@ -101,29 +96,38 @@ const download = () => {
     ElMessage.error("下载链接未生成,请稍等!");
     throw "下载链接未生成,请稍等!";
   } else {
-    saveAs(downloadURL.value, filename.value);
+    return saveAs(downloadURL.value, filename.value);
   }
 };
 
 // 进度请求
 let timer: any;
-const refreshPercent = async () => {
+const requestUpdateURL = async (callback: () => void) => {
   const res = await axios.get(getDownloadProcess, { params });
 
   percent.value = parseInt(res.data.percent);
   downloadURL.value = res.data.url;
   if (downloadURL.value) {
     state.value = State.readDown;
-    download();
+    callback();
   } else {
-    timer = setTimeout(refreshPercent, 1000);
+    timer = setTimeout(() => requestUpdateURL(callback), 1000);
   }
 };
 
 onUnmounted(() => clearTimeout(timer));
-onMounted(initial);
 
 defineExpose<QuiskExpose>({
-  submit: download
+  submit: async () => {
+    await initial();
+    const loading = ElLoading.service({
+      lock: true,
+      text: "下载中",
+      background: "rgba(255, 255, 255, 0.4)",
+    });
+    await download();
+    loading.close();
+    ElMessage.success("下载完成");
+  },
 });
 </script>