<script lang="ts" setup>
|
import { onMounted, ref } from 'vue';
|
import { useRouter } from 'vue-router';
|
|
import { encryptByBase64 } from '@jnpf/utils';
|
|
import dayjs from 'dayjs';
|
|
import { getFlowTodoList } from '#/api/workFlow/flowMonitor';
|
|
import CardHeader from '../CardHeader/index.vue';
|
|
const props = defineProps(['activeData']);
|
const list = ref<any[]>([]);
|
const hasAuth = ref<boolean>(true);
|
const loading = ref<boolean>(false);
|
const router = useRouter();
|
|
function initData() {
|
loading.value = true;
|
getFlowTodoList(props.activeData.type || 0).then((res) => {
|
list.value = res.data?.list?.length ? res.data.list.slice(0, 7) : [];
|
hasAuth.value = !!res.data?.isAuthorize;
|
loading.value = false;
|
});
|
}
|
function goDetail(item) {
|
const config = JSON.stringify({ ...item, operatorId: item.id, opType: props.activeData.type });
|
router.push(`/workFlowDetail?config=${encodeURIComponent(encryptByBase64(config))}`);
|
}
|
|
onMounted(() => initData());
|
</script>
|
<template>
|
<a-card class="portal-card-box">
|
<template #title v-if="activeData.title">
|
<CardHeader :title="activeData.title" :card="activeData.card" />
|
</template>
|
<template v-if="!loading">
|
<div class="portal-card-body portal-card-todoList" v-if="hasAuth">
|
<template v-if="list.length">
|
<a class="item" v-for="(item, i) in list" :key="i">
|
<span class="name com-hover" @click="goDetail(item)">{{ item.fullName }}</span>
|
<span class="time">{{ dayjs(item.creatorTime).format('YYYY-MM-DD') }}</span>
|
</a>
|
</template>
|
<div class="portal-common-noData" v-else>
|
<jnpf-empty />
|
</div>
|
</div>
|
<div class="portal-card-body portal-card-todoList no-auth-todoList" v-else>
|
<p class="no-auth-tip">您暂无该控件的访问权限</p>
|
</div>
|
</template>
|
</a-card>
|
</template>
|