bill 1 gadu atpakaļ
vecāks
revīzija
565d8ac4b3

+ 6 - 5
src/view/device.vue

@@ -23,7 +23,7 @@
 
           <el-form-item>
             <el-button type="primary" @click="refresh">查询</el-button>
-            <el-button type="primary" plain @click="pageProps = initProps">
+            <el-button type="primary" plain @click="pageProps = { ...initProps }">
               重置
             </el-button>
             <el-button type="primary" @click="addHandler"> 添加设备 </el-button>
@@ -74,7 +74,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onActivated, ref, watchEffect } from "vue";
+import { onActivated, ref, watch } from "vue";
 import {
   devicePageFetch,
   DevicePageProps,
@@ -85,6 +85,7 @@ import { Device } from "@/request/type";
 import { DeviceTypeDesc } from "@/store/device";
 import { ElMessageBox } from "element-plus";
 import { deviceEdit } from "./quisk";
+import { debounce } from "@/util";
 
 const initProps: DevicePageProps = {
   pageNum: 1,
@@ -94,11 +95,11 @@ const pageProps = ref({ ...initProps });
 const total = ref<number>(0);
 const relicsArray = ref<Device[]>([]);
 
-const refresh = async () => {
+const refresh = debounce(async () => {
   const data = await devicePageFetch(pageProps.value);
   total.value = data.total;
   relicsArray.value = data.records;
-};
+});
 
 const delHandler = async (deviceId: number) => {
   const ok = await ElMessageBox.confirm("确定要删除吗", {
@@ -115,7 +116,7 @@ const addHandler = async () => {
   await refresh();
 };
 
-watchEffect(refresh);
+watch(pageProps, refresh, { deep: true, immediate: true });
 onActivated(refresh);
 </script>
 

+ 2 - 2
src/view/pano/pano.vue

@@ -99,13 +99,13 @@ const photo = () => {
   setSize(3, 1920, 1080);
   panoDomRef.value!.toBlob(async (blob) => {
     if (blob) {
-      await saveAs(blob, "pano.png");
+      await saveAs(blob, "pano.jpg");
       ElMessage.success("图片导出成功");
     }
 
     setSize(devicePixelRatio);
     loading.value = false;
-  }, "image/png");
+  }, "image/jpg");
 };
 
 let pano: ReturnType<typeof init>;

+ 5 - 4
src/view/relics.vue

@@ -127,7 +127,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onActivated, ref, watchEffect } from "vue";
+import { onActivated, ref, watch } from "vue";
 import {
   relicsPageFetch,
   RelicsPageProps,
@@ -145,6 +145,7 @@ import { router } from "@/router";
 import { ElMessageBox } from "element-plus";
 import { relicsEdit } from "./quisk";
 import TexToolTip from "@/components/tex-tooltip.vue";
+import { debounce } from "@/util";
 
 const initProps: RelicsPageProps = {
   pageNum: 1,
@@ -154,11 +155,11 @@ const pageProps = ref({ ...initProps });
 const total = ref<number>(0);
 const relicsArray = ref<Relics[]>([]);
 
-const refresh = async () => {
+const refresh = debounce(async () => {
   const data = await relicsPageFetch(pageProps.value);
   total.value = data.total;
   relicsArray.value = data.records;
-};
+});
 
 const delHandler = async (relicsId: number) => {
   const ok = await ElMessageBox.confirm("确定要删除吗", {
@@ -198,7 +199,7 @@ const editHandler = async (relics: Relics) => {
     },
   });
 };
-watchEffect(refresh);
+watch(pageProps, refresh, { deep: true, immediate: true });
 onActivated(refresh);
 </script>
 

+ 1 - 1
src/view/scene-select.vue

@@ -39,7 +39,7 @@ const tableProps = {
     simpleScenes.value = simpleScenes.value.filter(
       ({ sceneCode }) =>
         !originSceneCodes.includes(sceneCode) ||
-        !val.some((scene) => scene.sceneCode === sceneCode)
+        val.some((scene) => scene.sceneCode === sceneCode)
     );
 
     let tip = false;

+ 5 - 4
src/view/scene.vue

@@ -150,7 +150,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onActivated, ref, watchEffect } from "vue";
+import { onActivated, ref, watch } from "vue";
 import { scenePageFetch, ScenePageProps, delSceneFetch } from "@/request";
 import {
   SceneStatusDesc,
@@ -163,6 +163,7 @@ import { DeviceTypeDesc, DeviceType } from "@/store/device";
 import { ElMessageBox } from "element-plus";
 import { gotoScene } from "@/store/scene";
 import TexToolTip from "@/components/tex-tooltip.vue";
+import { debounce } from "@/util";
 
 const props = defineProps<{ tableProps?: { [key in string]: any }; simple?: boolean }>();
 
@@ -174,14 +175,14 @@ const pageProps = ref({ ...initProps });
 const total = ref<number>(0);
 const sceneArray = ref<Scene[]>([]);
 
-const refresh = async () => {
+const refresh = debounce(async () => {
   const data = await scenePageFetch(pageProps.value);
   total.value = data.total;
   sceneArray.value = data.records;
   if (props.tableProps) {
     props.tableProps.tableDataChange(sceneArray.value);
   }
-};
+}, 100);
 
 const delHandler = async (relicsId: number) => {
   const ok = await ElMessageBox.confirm("确定要删除吗", {
@@ -193,7 +194,7 @@ const delHandler = async (relicsId: number) => {
   }
 };
 
-watchEffect(refresh);
+watch(pageProps, refresh, { deep: true, immediate: true });
 onActivated(refresh);
 </script>