质量工程师首页完成

This commit is contained in:
2026-09-29 17:27:28 +08:00
parent bd7cad2740
commit ef7c65be05
4 changed files with 57 additions and 87 deletions
+11 -31
View File
@@ -4,14 +4,12 @@ import { Icon } from '@iconify/vue'
import { useThemeStore } from '@/store/modules/theme';
import { useRouterPush } from '@/hooks/common/router';
import { getColorWithOpacity } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system";
import { homeApi } from "@/service/api/statistics";
import { homeAdminApi } from "@/service/api/statistics";
const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush();
const loading = ref<boolean>(false);
const isAiOpen = ref<number>(0);
// 时间显示
const clock = ref<string>('');
let timer: any = null;
@@ -54,7 +52,7 @@ const tick = () => {
// 获取数据
const getData = async () => {
loading.value = true;
const {data,error} = await homeApi();
const {data,error} = await homeAdminApi();
if(!error){
homeData.value = data;
console.log(data)
@@ -62,25 +60,8 @@ const getData = async () => {
loading.value = false;
}
// 获取系统配置
const getConfig = async () => {
const {data,error} = await systemConfigApi();
if(!error){
// 解析 AI 辅助功能配置
const aiAssistGroup = data.find((group:{group_key:string}) => group.group_key === 'ai_assist');
if (aiAssistGroup) {
console.log(aiAssistGroup.items)
const target = aiAssistGroup?.items?.find((item:any) => item.item_key === 'enabled');
if (target) {
isAiOpen.value = Number(target.value);
}
}
}
}
onMounted(() => {
tick();
getConfig();
getData();
})
@@ -121,15 +102,14 @@ onUnmounted(() => {
<NGrid cols="s:1 m:2 l:2" responsive="screen" :x-gap="16" :y-gap="16">
<NGi>
<div
class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555] cursor-pointer"
class="flex-1 bg-[#fff2f0] px-16px py-12px text-[#e15555]"
:style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_closeconfirm')"
>
<p class="text-12px font-600">待关闭确认</p>
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0"
:end-value="homeData?.close_pending?.total || 0"
class="text-26px font-600"
/>
</div>
@@ -146,7 +126,7 @@ onUnmounted(() => {
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.near_overdue_total || 0"
:end-value="homeData?.open_changes?.total || 0"
class="text-26px font-600 text-[#333]"
/>
</div>
@@ -166,14 +146,14 @@ onUnmounted(() => {
<p class="text-13px font-700 text-#64749a">待关闭确认</p>
<p class="text-11px text-#94a3b8 mt-2px">变更主管部门(归口部门)专责确认 · 系统记录关闭时间</p>
</div>
<NButton v-if="homeData?.my_changes_progress?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_closeconfirm')">
<NButton v-if="homeData?.close_pending?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_closeconfirm')">
关闭管理
<Icon icon="formkit:right" class="size-12px" />
</NButton>
</div>
<div class="flex flex-col gap-3">
<template v-if="homeData?.my_changes_progress?.total > 0">
<div v-for="row in homeData?.my_changes_progress?.items?.slice(0, 3) || []" :key="row.change_id"
<template v-if="homeData?.close_pending?.total > 0">
<div v-for="row in homeData?.close_pending?.items || []" :key="row.change_id"
class="flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition"
:style="{borderRadius: themeStore.themeRadius + 'px'}"
>
@@ -194,8 +174,8 @@ onUnmounted(() => {
</div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<span>{{ row.change_no }}</span>
<span>一车间</span>
<span>李四</span>
<span>{{row.org_name}}</span>
<span>{{row.applicant_name}}</span>
</div>
</div>
</div>
@@ -338,7 +318,7 @@ onUnmounted(() => {
'--success-bg': getColorWithOpacity(themeStore.otherColor.success, 0.1),
}"
>
<div v-if="isAiOpen" class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--success-bg)] px-3 py-2 text-[11px] text-[var(--success-color)]">
<div v-if="homeData?.ai_assist_enabled" class="mt-3 flex items-center gap-2 rounded-lg bg-[var(--success-bg)] px-3 py-2 text-[11px] text-[var(--success-color)]">
<Icon icon="lucide:sparkles" class="size-12px" />
AI 辅助当前已启用 · 可在「AI 开关与维护」调整
</div>