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