ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { computed, ref } from 'vue';
 
import { useGo } from '@jnpf/hooks';
import { openWindow } from '@jnpf/utils';
 
import { APP_BACKEND_PREFIX, APP_PREFIX } from '#/utils/constants';
 
const props = defineProps({
  latelyUseFlowList: {
    default: () => [],
    type: Array as any,
  },
  latelyUseMenuList: {
    default: () => [],
    type: Array as any,
  },
  commonUseFlowList: {
    default: () => [],
    type: Array as any,
  },
  commonUseMenuList: {
    default: () => [],
    type: Array as any,
  },
  flowEnabled: {
    default: false,
    type: Boolean,
  },
});
 
const emit = defineEmits(['launch']);
const activeKey = ref('1');
const activeTabKey = ref('1');
const go = useGo();
 
const getList = computed(() => {
  if (activeTabKey.value === '1') {
    return activeKey.value === '1' ? props.latelyUseMenuList : props.latelyUseFlowList;
  } else {
    return activeKey.value === '1' ? props.commonUseMenuList : props.commonUseFlowList;
  }
});
 
function openSystem(item) {
  const { systemCode, urlAddress, isBackend } = item;
  if (!urlAddress) return;
  const url = urlAddress.startsWith('/') ? urlAddress : `/${urlAddress}`;
  if (!systemCode || systemCode === 'mainSystem') {
    go(url);
  } else {
    const fullUrl = `${window.location.origin}/${APP_PREFIX + (isBackend ? APP_BACKEND_PREFIX : '') + systemCode}${url}`;
    openWindow(fullUrl);
  }
}
function toggleActive(key) {
  if (activeKey.value === key) return;
  activeKey.value = key;
}
function toggleTabActive(key) {
  if (activeTabKey.value === key) return;
  activeTabKey.value = key;
}
function launch(id) {
  emit('launch', id);
}
function handleClick(item) {
  activeKey.value === '1' ? openSystem(item) : launch(item.id);
}
</script>
<template>
  <div class="common-pane lately-pane dashboard-pane">
    <div class="dashboard-header">
      <div class="lately-tabs">
        <span class="lately-tabs-item" :class="{ 'lately-tabs-item-active': activeTabKey == '1' }" @click="toggleTabActive('1')">最近使用</span>
        <span class="lately-tabs-item" :class="{ 'lately-tabs-item-active': activeTabKey == '2' }" @click="toggleTabActive('2')">最近常用</span>
      </div>
      <div class="dashboard-header-tabs">
        <span class="header-tabs-item" :class="{ 'header-tabs-item-active': activeKey == '1' }" @click="toggleActive('1')">应用功能</span>
        <span class="header-tabs-item" :class="{ 'header-tabs-item-active': activeKey == '2' }" @click="toggleActive('2')" v-if="flowEnabled">发起审批</span>
      </div>
    </div>
    <a-row class="common-list" :gutter="16">
      <a-col class="common-item" v-for="(item, i) in getList" :key="i" :sm="24" :md="12" :lg="8" @click="handleClick(item)">
        <i :class="item.icon" class="common-item-icon" :style="{ background: item.iconBackground || '#008cff' }"></i>
        <div class="common-item-text">
          <p class="common-item-title" :title="item.fullName">{{ item.fullName }}</p>
          <p class="common-item-desc" :title="item.systemName">{{ item.systemName }}</p>
        </div>
      </a-col>
      <a-col :span="24" v-if="!getList.length">
        <jnpf-empty />
      </a-col>
    </a-row>
  </div>
</template>