优化日程和提醒互导功能

This commit is contained in:
2026-09-09 18:42:22 +08:00
parent c146dc2f2f
commit a89bdd839b
5 changed files with 184 additions and 9 deletions
+108 -2
View File
@@ -11,6 +11,34 @@
<div class="dashboard-columns">
<!-- 左侧 60%:报销相关内容 -->
<div class="col-left">
<!-- 待办概览卡片:今日 / 本周 / 本月 待办数量 -->
<div class="todo-stats-row">
<div class="todo-stat-card">
<div class="todo-stat-label">今日待办</div>
<div class="todo-stat-value">{{ todoTodayPending }}</div>
<div class="todo-stat-sub">
共 {{ scheduleStats.today_total || 0 }} 项 · 已完成
{{ scheduleStats.today_done || 0 }}
</div>
</div>
<div class="todo-stat-card">
<div class="todo-stat-label">本周待办</div>
<div class="todo-stat-value">{{ todoWeekPending }}</div>
<div class="todo-stat-sub">
共 {{ scheduleStats.week_total || 0 }} 项 · 已完成
{{ scheduleStats.week_done || 0 }}
</div>
</div>
<div class="todo-stat-card">
<div class="todo-stat-label">本月待办</div>
<div class="todo-stat-value">{{ todoMonthPending }}</div>
<div class="todo-stat-sub">
共 {{ scheduleStats.month_total || 0 }} 项 · 已完成
{{ scheduleStats.month_done || 0 }}
</div>
</div>
</div>
<!-- 报销统计卡片 -->
<el-row :gutter="16" class="stat-row">
<el-col :span="8" :xs="24" v-for="item in statCards" :key="item.key">
@@ -252,7 +280,7 @@
<SchedulePostpone
v-model="schedulePostponeVisible"
:schedule="scheduleDetailItem"
@saved="loadScheduleReminders"
@saved="onPostponeSaved"
/>
</div>
</template>
@@ -268,7 +296,7 @@ import {
getNoticeDetail,
getNoticePortal
} from "@/api/oaNotice";
import { finishSchedule, getScheduleList } from "@/api/oaSchedule";
import { finishSchedule, getScheduleList, getScheduleStats } from "@/api/oaSchedule";
import ScheduleDetail from "../schedule/components/detail.vue";
import SchedulePostpone from "../schedule/components/postponeDialog.vue";
@@ -366,6 +394,18 @@ const typePercent = (amount) =>
const responseData = (res) => res?.data?.data ?? res?.data ?? res ?? {};
// ---------- 待办概览(顶部卡片) ----------
const scheduleStats = ref({});
const todoTodayPending = computed(
() => (scheduleStats.value.today_total || 0) - (scheduleStats.value.today_done || 0),
);
const todoWeekPending = computed(
() => (scheduleStats.value.week_total || 0) - (scheduleStats.value.week_done || 0),
);
const todoMonthPending = computed(
() => (scheduleStats.value.month_total || 0) - (scheduleStats.value.month_done || 0),
);
// ---------- 工作日程提醒 ----------
const router = useRouter();
const scheduleReminders = ref([]);
@@ -526,6 +566,8 @@ const toggleScheduleFinish = async (item) => {
ElMessage.success(res.data?.status === 1 ? "已完成" : "已反审核");
scheduleDetailVisible.value = false;
loadScheduleReminders();
// 完成/反审核会改变待办数量,刷新顶部概览卡片
loadScheduleStats();
} else {
ElMessage.error(res?.msg || "操作失败");
}
@@ -540,6 +582,12 @@ const handleSchedulePostpone = (item) => {
schedulePostponeVisible.value = true;
};
// 顺延保存后:原日程标记完成并生成次日待办,需同步刷新列表与顶部概览卡片
const onPostponeSaved = () => {
loadScheduleReminders();
loadScheduleStats();
};
const goSchedule = () => router.push("/apps/oa/schedule");
// 跳转到日程管理页并打开该日程的编辑抽屉
@@ -606,6 +654,16 @@ const openNoticeDetail = async (item) => {
const goNotice = () => router.push("/apps/oa/notice");
// 刷新顶部"待办概览"卡片:今日 / 本周 / 本月 未完成数量
const loadScheduleStats = async () => {
try {
const res = await getScheduleStats();
scheduleStats.value = res?.data || {};
} catch (error) {
console.warn("加载待办统计失败:", error?.message);
}
};
const loadDashboard = async () => {
try {
const data = responseData(await getReimbursementDashboard());
@@ -618,6 +676,7 @@ const loadDashboard = async () => {
} catch (error) {
console.warn("加载报销统计失败:", error?.message);
}
await loadScheduleStats();
renderTrendChart();
loadScheduleReminders();
loadNotices();
@@ -723,6 +782,40 @@ onBeforeUnmount(() => {
}
}
/* 待办概览卡片(顶部) */
.todo-stats-row {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 16px;
}
.todo-stat-card {
background: #fff;
border-radius: 4px;
padding: 16px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.todo-stat-label {
font-size: 13px;
color: #909399;
margin-bottom: 6px;
}
.todo-stat-value {
font-size: 28px;
font-weight: 600;
line-height: 1.2;
color: #303133;
}
.todo-stat-sub {
margin-top: 6px;
font-size: 12px;
color: #c0c4cc;
}
/* 左右分栏:左 70% 报销,右 30% 日程提醒 */
.dashboard-columns {
display: flex;
@@ -1202,6 +1295,19 @@ html.dark & {
}
}
.todo-stat-card {
background: var(--el-bg-color);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.todo-stat-label {
color: var(--el-text-color-secondary);
}
.todo-stat-sub {
color: var(--el-text-color-placeholder);
}
.chart-card {
background: var(--el-bg-color);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);