更新角色管理相关内容

This commit is contained in:
2026-09-09 15:04:34 +08:00
parent de7225b61e
commit fef0233cc4
24 changed files with 1442 additions and 116 deletions
+186 -5
View File
@@ -170,6 +170,7 @@
class="schedule-item-title"
:class="{ done: item.status === 1 }"
>
<i v-if="hasImages(item)" class="fa-solid fa-image schedule-image-icon"></i>
{{ item.title }}
<el-tag
v-if="item.priority > 0"
@@ -295,14 +296,19 @@ const statCards = computed(() => [
// 趋势图
const trendChartRef = ref(null);
let trendChart = null;
let themeObserver = null;
const renderTrendChart = () => {
if (!trendChartRef.value) return;
if (!trendChart) trendChart = echarts.init(trendChartRef.value);
const dark = document.documentElement.classList.contains("dark");
const axisLineColor = dark ? "#3a3a3a" : "#E0E6ED";
const labelColor = dark ? "#A3A6AD" : "#606266";
const splitColor = dark ? "#2a2a2a" : "#F2F6FC";
const months = dashboard.trend.map((item) => item.month.slice(5) + "月");
trendChart.setOption({
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
legend: { data: ["已报销", "未报销"], top: 0 },
legend: { data: ["已报销", "未报销"], top: 0, textStyle: { color: labelColor } },
grid: {
left: "3%",
right: "4%",
@@ -313,15 +319,15 @@ const renderTrendChart = () => {
xAxis: {
type: "category",
data: months,
axisLine: { lineStyle: { color: "#E0E6ED" } },
axisLabel: { color: "#606266", fontSize: 11 },
axisLine: { lineStyle: { color: axisLineColor } },
axisLabel: { color: labelColor, fontSize: 11 },
},
yAxis: {
type: "value",
axisLine: { show: false },
axisTick: { show: false },
splitLine: { lineStyle: { color: "#F2F6FC" } },
axisLabel: { color: "#606266", fontSize: 11 },
splitLine: { lineStyle: { color: splitColor } },
axisLabel: { color: labelColor, fontSize: 11 },
},
series: [
{
@@ -476,6 +482,22 @@ const scheduleDateTag = (item) => {
return `${m}/${d} 周${week}`;
};
// 判断日程是否关联了图片(与详情页 parseImages 语义一致),用于列表标题前展示图片图标
function hasImages(item) {
const imgs = item?.images;
if (!imgs) return false;
if (Array.isArray(imgs)) return imgs.some(img => img && img.url);
if (typeof imgs === "string" && imgs.trim()) {
try {
const parsed = JSON.parse(imgs);
return Array.isArray(parsed) && parsed.some(img => img && img.url);
} catch {
return false;
}
}
return false;
}
const scheduleTimeText = (item) =>
item.all_day === 1
? "全天"
@@ -609,10 +631,18 @@ const statusType = (value) =>
onMounted(async () => {
await loadDashboard();
window.addEventListener("resize", handleResize);
// 主题切换时重绘图表,使坐标轴/文字颜色跟随暗色
themeObserver = new MutationObserver(() => renderTrendChart());
themeObserver.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});
});
onBeforeUnmount(() => {
window.removeEventListener("resize", handleResize);
themeObserver?.disconnect();
themeObserver = null;
trendChart?.dispose();
trendChart = null;
});
@@ -969,6 +999,12 @@ onBeforeUnmount(() => {
}
}
.schedule-image-icon {
flex-shrink: 0;
margin-right: 4px;
color: var(--el-text-color-secondary);
}
.schedule-item-time {
display: flex;
gap: 10px;
@@ -1128,4 +1164,149 @@ onBeforeUnmount(() => {
width: auto;
}
}
// ===== 暗色主题适配 =====
html.dark & {
.oa-dashboard {
background: var(--el-bg-color-page);
}
.page-header {
h2 {
color: var(--el-text-color-primary);
}
p {
color: var(--el-text-color-secondary);
}
}
.stat-card {
background: var(--el-bg-color);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
.stat-title {
color: var(--el-text-color-secondary);
}
.stat-amount {
.currency,
.number {
color: var(--el-text-color-primary);
}
}
.stat-meta {
color: var(--el-text-color-secondary);
}
}
.chart-card {
background: var(--el-bg-color);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
.chart-title {
color: var(--el-text-color-primary);
border-bottom-color: var(--el-border-color-lighter);
}
}
.notice-item {
background: var(--el-fill-color-light);
&:hover {
background: var(--el-fill-color);
}
.notice-text {
color: var(--el-text-color-primary);
}
.notice-time {
color: var(--el-text-color-placeholder);
}
}
.notice-detail-meta {
border-bottom-color: var(--el-border-color-lighter);
}
.notice-detail-text {
color: var(--el-text-color-secondary);
}
.notice-detail-content {
color: var(--el-text-color-primary);
}
.tab-count {
background: var(--el-fill-color);
color: var(--el-text-color-secondary);
}
.schedule-item {
background: var(--el-fill-color-light);
&:hover {
background: var(--el-fill-color);
}
&.done {
background: var(--el-bg-color-page);
border-left-color: var(--el-border-color);
}
.item-status-dot.done {
background: var(--el-text-color-placeholder);
}
.schedule-item-title {
color: var(--el-text-color-primary);
&.done {
color: var(--el-text-color-placeholder);
}
}
.schedule-item-time {
color: var(--el-text-color-secondary);
&.done {
color: var(--el-text-color-placeholder);
}
}
}
.schedule-action-title {
color: var(--el-text-color-primary);
}
.schedule-action-meta {
color: var(--el-text-color-regular);
}
.schedule-action-tip {
color: var(--el-text-color-secondary);
}
.dist-bar-wrap,
.type-bar-wrap {
background: var(--el-fill-color);
}
.dist-count {
color: var(--el-text-color-secondary);
}
.type-name {
color: var(--el-text-color-regular);
}
.type-count {
color: var(--el-text-color-secondary);
}
.type-amount {
color: var(--el-text-color-primary);
}
}
</style>