广丰卷烟厂数采质量分析系统
zhuguifei
2026-03-02 80ff784bf60637cd348ae665fc907f7b1e527dd8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<script setup lang="ts">
import type { PopoverPlacement } from 'naive-ui';
import { themeLayoutModeRecord } from '@/constants/app';
import { $t } from '@/locales';
 
defineOptions({
  name: 'LayoutModeCard'
});
 
interface Props {
  /** Layout mode */
  mode: UnionKey.ThemeLayoutMode;
  /** Disabled */
  disabled?: boolean;
}
 
const props = defineProps<Props>();
 
interface Emits {
  /** Layout mode change */
  (e: 'update:mode', mode: UnionKey.ThemeLayoutMode): void;
}
 
const emit = defineEmits<Emits>();
 
type LayoutConfig = Record<
  UnionKey.ThemeLayoutMode,
  {
    placement: PopoverPlacement;
    menuClass: string;
    mainClass: string;
  }
>;
 
const layoutConfig: LayoutConfig = {
  vertical: {
    placement: 'bottom',
    menuClass: 'w-1/3 h-full',
    mainClass: 'w-2/3 h-3/4'
  },
  'vertical-mix': {
    placement: 'bottom',
    menuClass: 'w-1/4 h-full',
    mainClass: 'w-2/3 h-3/4'
  },
  'vertical-hybrid-header-first': {
    placement: 'bottom',
    menuClass: 'w-1/4 h-full',
    mainClass: 'w-2/3 h-3/4'
  },
  horizontal: {
    placement: 'bottom',
    menuClass: 'w-full h-1/4',
    mainClass: 'w-full h-3/4'
  },
  'top-hybrid-sidebar-first': {
    placement: 'bottom',
    menuClass: 'w-full h-1/4',
    mainClass: 'w-2/3 h-3/4'
  },
  'top-hybrid-header-first': {
    placement: 'bottom',
    menuClass: 'w-full h-1/4',
    mainClass: 'w-2/3 h-3/4'
  }
};
 
function handleChangeMode(mode: UnionKey.ThemeLayoutMode) {
  if (props.disabled) return;
 
  emit('update:mode', mode);
}
</script>
 
<template>
  <div class="grid grid-cols-2 gap-x-16px gap-y-12px md:grid-cols-3">
    <div
      v-for="(item, key) in layoutConfig"
      :key="key"
      class="flex-col-center cursor-pointer"
      @click="handleChangeMode(key)"
    >
      <IconTooltip :placement="item.placement">
        <template #trigger>
          <div
            class="h-64px w-96px gap-6px rd-4px p-6px shadow ring-2 ring-transparent transition-all hover:ring-primary"
            :class="{ '!ring-primary': mode === key }"
          >
            <div class="h-full w-full gap-1" :class="[key.includes('vertical') ? 'flex' : 'flex-col']">
              <slot :name="key"></slot>
            </div>
          </div>
        </template>
        {{ $t(`theme.layout.layoutMode.${key}_detail`) }}
      </IconTooltip>
      <p class="mt-8px text-12px">{{ $t(themeLayoutModeRecord[key]) }}</p>
    </div>
  </div>
</template>
 
<style scoped></style>