|
|
@@ -30,12 +30,11 @@
|
|
|
<div class="total-card" v-for="(item, index) in stats" :key="index">
|
|
|
<el-popover
|
|
|
placement="top"
|
|
|
- :width="200"
|
|
|
+ :width="100"
|
|
|
trigger="hover"
|
|
|
popper-class="glass-popover"
|
|
|
:disabled="getDetailList(index).length === 0"
|
|
|
- raw-content
|
|
|
- transition="el-zoom-in-top"
|
|
|
+ transition="el-zoom-in-left"
|
|
|
>
|
|
|
<template #reference>
|
|
|
<div class="card-wrapper">
|
|
|
@@ -45,7 +44,15 @@
|
|
|
</div>
|
|
|
<div class="card-content">
|
|
|
<p class="card-title">{{ item.title }}</p>
|
|
|
- <p class="card-number">{{ item.number }}</p>
|
|
|
+ <el-skeleton :rows="1" :animated="true" :loading="statsLoading">
|
|
|
+ <template #template>
|
|
|
+ <el-skeleton-item
|
|
|
+ variant="text"
|
|
|
+ style="width: 60%; height: 32px; border-radius: 50px"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <p class="card-number">{{ item.number }}</p>
|
|
|
+ </el-skeleton>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -174,6 +181,7 @@ import { useUserStore } from "@/stores/useUserStore";
|
|
|
import { getAccessToken } from "@/utils/auth";
|
|
|
import * as echarts from "echarts";
|
|
|
import { useRouter } from "vue-router";
|
|
|
+import { pa } from "element-plus/es/locales.mjs";
|
|
|
const router = useRouter();
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
@@ -411,7 +419,7 @@ const go = async (item) => {
|
|
|
|
|
|
setTimeout(function () {
|
|
|
newTab.location.href = item.flowUrl;
|
|
|
- }, 50);
|
|
|
+ }, 100);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -425,7 +433,7 @@ const go = async (item) => {
|
|
|
|
|
|
setTimeout(function () {
|
|
|
newTab.location.href = item.flowUrl;
|
|
|
- }, 50);
|
|
|
+ }, 100);
|
|
|
}
|
|
|
} else {
|
|
|
router.push({ path: "/login" });
|
|
|
@@ -442,16 +450,31 @@ const handleDetailClick = (task, categoryTitle) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ if (task.name === "OA" && categoryTitle === "已办事项") {
|
|
|
+ router.push({
|
|
|
+ path: "/oa-done-list",
|
|
|
+ query: { type: task.name.toLowerCase() },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
if (task.name === "CRM" && categoryTitle === "我的待办") {
|
|
|
router.push({
|
|
|
path: "/crm-todo-list",
|
|
|
query: { type: task.name.toLowerCase() },
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (task.name === "CRM" && categoryTitle === "已办事项") {
|
|
|
+ router.push({
|
|
|
+ path: "/crm-done-list",
|
|
|
+ query: { type: task.name.toLowerCase() },
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
let oaTasks = ref([]);
|
|
|
let crmTasks = ref([]);
|
|
|
+const statsLoading = ref(true);
|
|
|
|
|
|
const stats = ref([
|
|
|
{
|
|
|
@@ -469,21 +492,6 @@ const stats = ref([
|
|
|
bgcolor: "#eff6ff",
|
|
|
color: "#2563eb",
|
|
|
},
|
|
|
- {
|
|
|
- icon: "mdi:arrow-right-bold-box-outline",
|
|
|
- title: "发起流程",
|
|
|
- number: 0,
|
|
|
- extra: "85% 准时",
|
|
|
- bgcolor: "#eff6ff",
|
|
|
- color: "#2563eb",
|
|
|
- },
|
|
|
- {
|
|
|
- icon: "mdi:file-document-outline",
|
|
|
- title: "草稿箱",
|
|
|
- number: 0,
|
|
|
- bgcolor: "#f8fafc",
|
|
|
- color: "#475569",
|
|
|
- },
|
|
|
]);
|
|
|
|
|
|
const todoCount = ref([
|
|
|
@@ -497,18 +505,6 @@ const doneCount = ref([
|
|
|
{ name: "CRM", value: 0 },
|
|
|
]);
|
|
|
|
|
|
-// 发起流程
|
|
|
-const startCount = ref([
|
|
|
- { name: "OA", value: 0 },
|
|
|
- { name: "CRM", value: 0 },
|
|
|
-]);
|
|
|
-
|
|
|
-// 草稿箱
|
|
|
-const drafts = ref([
|
|
|
- { name: "OA", value: 0 },
|
|
|
- { name: "CRM", value: 0 },
|
|
|
-]);
|
|
|
-
|
|
|
onMounted(async () => {
|
|
|
getAll();
|
|
|
// 等待 DOM 与样式生效,避免移动端首屏尺寸为 0
|
|
|
@@ -528,20 +524,95 @@ onMounted(async () => {
|
|
|
});
|
|
|
|
|
|
if (userStore.getUser.username) {
|
|
|
- const res = await getOATasks(userStore.getUser.username);
|
|
|
- oaTasks.value = res;
|
|
|
+ try {
|
|
|
+ const res = await getOATasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 99,
|
|
|
+ });
|
|
|
+ oaTasks.value = res;
|
|
|
|
|
|
- const crmRes = await getCRMTasks(userStore.getUser.username);
|
|
|
- crmTasks.value = crmRes;
|
|
|
- }
|
|
|
+ const crmRes = await getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "pending",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+ crmTasks.value = crmRes;
|
|
|
+
|
|
|
+ stats.value[0].number =
|
|
|
+ Number(oaTasks.value.todoCount) + Number(crmTasks.value.todoCount);
|
|
|
|
|
|
- stats.value[0].number =
|
|
|
- Number(oaTasks.value.todoCount) + Number(crmTasks.value.todoCount);
|
|
|
+ todoCount.value = [
|
|
|
+ { name: "OA", value: oaTasks.value.todoCount ?? 0 },
|
|
|
+ { name: "CRM", value: crmTasks.value.todoCount ?? 0 },
|
|
|
+ ];
|
|
|
|
|
|
- todoCount.value = [
|
|
|
- { name: "OA", value: oaTasks.value.todoCount },
|
|
|
- { name: "CRM", value: crmTasks.value.todoCount },
|
|
|
- ];
|
|
|
+ // *****************已办事项统计*************************
|
|
|
+
|
|
|
+ const crmDoneRes = await getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "approved",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+
|
|
|
+ stats.value[1].number =
|
|
|
+ Number(oaTasks.value.doneCount) + Number(crmDoneRes.todoCount);
|
|
|
+
|
|
|
+ doneCount.value = [
|
|
|
+ { name: "OA", value: oaTasks.value.doneCount ?? 0 },
|
|
|
+ { name: "CRM", value: crmDoneRes.todoCount ?? 0 },
|
|
|
+ ];
|
|
|
+ } finally {
|
|
|
+ statsLoading.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ setInterval(
|
|
|
+ async () => {
|
|
|
+ const res = await getOATasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+ oaTasks.value = res;
|
|
|
+
|
|
|
+ const crmRes = await getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "pending",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+ crmTasks.value = crmRes;
|
|
|
+
|
|
|
+ stats.value[0].number =
|
|
|
+ Number(oaTasks.value.todoCount) + Number(crmTasks.value.todoCount);
|
|
|
+
|
|
|
+ todoCount.value = [
|
|
|
+ { name: "OA", value: oaTasks.value.todoCount ?? 0 },
|
|
|
+ { name: "CRM", value: crmTasks.value.todoCount ?? 0 },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const crmDoneRes = await getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "approved",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ });
|
|
|
+
|
|
|
+ stats.value[1].number =
|
|
|
+ Number(oaTasks.value.doneCount) + Number(crmDoneRes.todoCount);
|
|
|
+
|
|
|
+ doneCount.value = [
|
|
|
+ { name: "OA", value: oaTasks.value.doneCount ?? 0 },
|
|
|
+ { name: "CRM", value: crmDoneRes.todoCount ?? 0 },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ 5 * 60 * 1000,
|
|
|
+ ); // 每5分钟刷新一次
|
|
|
+ } else {
|
|
|
+ statsLoading.value = false;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 组件卸载时移除监听,防止内存泄漏
|
|
|
@@ -843,8 +914,8 @@ onBeforeUnmount(() => {
|
|
|
}
|
|
|
|
|
|
.total-card {
|
|
|
- flex: 1;
|
|
|
- min-width: 0;
|
|
|
+ /* flex: 1; */
|
|
|
+ width: 300px;
|
|
|
background: #ffffff;
|
|
|
border-radius: 16px;
|
|
|
padding: 20px;
|