xuruiqian
2025-02-25 e85ab165147c37b571ea67ce6f6ae9ae55a96070
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
<template>
  <div v-if="!loading">
    <el-row v-if="entityList&&entityList.length>0">
      <el-col :span="24" v-for="item in entityList" :key="item.id">
        <el-alert :type="item.type?item.type:'info'" show-icon style="margin: 2px;">
          <template #title>
            <el-text size="small">{{ item.title }}</el-text>
          </template>
          <template #default>
            <el-text size="small">{{ item.description }}</el-text>
          </template>
        </el-alert>
      </el-col>
    </el-row>
    <el-empty :image-size="80" v-else/>
    <div style="display: flex;justify-content: space-between">
      <div>
 
      </div>
      <div>
        <el-link type="primary" @click="showNotificationCenter">
          {{ `${$t('button.More')}` }}
          <el-icon>
            <Right/>
          </el-icon>
        </el-link>
      </div>
    </div>
  </div>
  <el-skeleton v-else :rows="5"/>
</template>
 
<script>
 
import {getCurrentInstance, onBeforeUnmount, onMounted, reactive, toRefs} from "vue";
import {useBasicInfoStore} from "@/store/basicInfo";
import * as icon from "@element-plus/icons-vue";
import {formatterDate, formatterDatetime, formatterNumber} from "@/utils/common";
import {GetNotificationList} from "@/api/admin/ifc";
 
export default {
  name: 'LatestTask',
  components: {},
  setup() {
    let {proxy} = getCurrentInstance();
    const store = useBasicInfoStore();
    const state = reactive({
      loading: false,
      entityList: [],
    });
 
    onMounted(() => {
      Init();
      LoadData();
    });
    onBeforeUnmount(() => {
 
    });
 
    const Init = () => {
 
    };
    const LoadData = () => {
      state.loading = true;
      let userid = store.user.id;
 
      GetNotificationList(userid).then(resp => {
        if (resp.data) {
          state.entityList = resp.data.data;
        }
        state.loading = false;
      }).catch(err => {
        console.error(err);
      });
    };
    const showNotificationCenter = () => {
      store.launchIframe(`${WGURL.ifcDomain}/client/center/notification`, `${proxy.$t('label.NotificationCenter')}`);
    }
 
    const dismissNotification = (data) => {
      state.notifications = state.notifications.filter(e => e.id != data.id);
    }
 
    return {
      ...toRefs(state),
      icon,
      formatterDate,
      formatterDatetime,
      formatterNumber,
      showNotificationCenter,
      dismissNotification
    }
  },
}
</script>
 
<style scoped>
 
</style>