<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>
|