12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <List :title="title" rawKey="id" :data="modelList" :showContent="showContent">
- <template #action>
- <slot name="action" />
- </template>
- <template #atom="{ item }">
- <ModelSign :canChange="canChange" :model="item.raw" @delete="modelDelete(item.raw)"
- @click="(mode: any) => modelChangeSelect(item.raw, mode)" />
- </template>
- </List>
- <Teleport to="#left-pano" v-if="panoModel">
- <div class="mode-tab strengthen">
- <div class="mode-icon-layout" @click="custom.showMode = 'fuse'" :class="{ active: custom.showMode === 'fuse' }">
- <ui-icon type="show_3d_n" class="icon" ctrl />
- </div>
- <div class="mode-icon-layout" @click="custom.showMode = 'pano'" :class="{ active: custom.showMode === 'pano' }">
- <ui-icon type="show_roaming_n" class="icon" ctrl />
- </div>
- </div>
- </Teleport>
- </template>
- <script lang="ts" setup>
- import { computed, watchEffect } from "vue";
- import { custom } from "@/env";
- import List from "@/components/list/index.vue";
- import ModelSign from "./sign.vue";
- import { getSupperPanoModel } from "@/sdk/association";
- import { fuseModels, getFuseModelShowVariable } from "@/store";
- import type { FuseModel } from "@/store";
- import { currentModel, fuseModel } from "@/model";
- export type ModelListProps = {
- title?: string;
- canChange?: boolean;
- showContent?: boolean;
- };
- withDefaults(defineProps<ModelListProps>(), {
- title: "数据列表",
- change: false,
- showContent: true,
- });
- defineEmits<{
- (e: "deleteModel", model: FuseModel): void;
- (e: "clickModel", model: FuseModel): void;
- }>();
- const panoModel = getSupperPanoModel();
- watchEffect(() => console.error(panoModel.value));
- const modelList = computed(() =>
- fuseModels.value.map((model) => ({
- raw: model,
- select: custom.currentModel === model && currentModel.value === fuseModel,
- }))
- );
- const modelChangeSelect = (model: FuseModel, mode: "pano" | "fuse") => {
- console.error(getFuseModelShowVariable(model).value);
- if (getFuseModelShowVariable(model).value) {
- console.log(custom.currentModel, model);
- if (custom.currentModel === model && mode === custom.showMode) {
- custom.currentModel = null;
- custom.showMode = "fuse";
- console.log("a?");
- } else {
- custom.currentModel = model;
- custom.showMode = mode;
- }
- }
- };
- watchEffect(() => {
- if (custom.currentModel && !getFuseModelShowVariable(custom.currentModel).value) {
- custom.currentModel = null;
- }
- });
- const modelDelete = (model: FuseModel) => {
- const index = fuseModels.value.indexOf(model);
- if (~index) {
- fuseModels.value.splice(index, 1);
- }
- };
- </script>
- <style lang="scss" scoped src="./style.scss"></style>
|