质量工程师首页完成

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>
+2 -2
View File
@@ -283,7 +283,7 @@ onUnmounted(() => {
</div>
<div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<NTag v-if="row.step_name" size="small" type="warning">审批:{{row.step_name}}</NTag>
<NTag v-if="row.step_name" size="small" type="warning">{{row.step_name}}</NTag>
<NButton size="small" type="primary" class="text-xs">
去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
@@ -390,7 +390,7 @@ onUnmounted(() => {
</NProgress>
</div>
<div class="flex items-center justify-between text-[11px] text-slate-400">
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0.92}}%</b></span>
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span>
<span>目标 2 天内签署</span>
</div>
</div>
+30 -54
View File
@@ -5,7 +5,7 @@ import { useThemeStore } from '@/store/modules/theme';
import { useRouterPush } from '@/hooks/common/router';
import { getColorWithOpacity, tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { systemConfigApi } from "@/service/api/system";
import { homeProfessionalApi } from "@/service/api/statistics";
import { homeQualityApi } from "@/service/api/statistics";
const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush();
@@ -23,28 +23,16 @@ let timer: any = null;
// 首页数据
const homeData = ref<any>(null);
const highRisk = [
{ title: "聚合反应温度控制上限调整", why: "涉及工艺安全边界,建议参与 HAZOP 分析" },
{ title: "R-101 搅拌提速至 180rpm", why: "搅拌轴强度与密封形式需校核" },
];
// 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => {
if(key==='my_initiatechange' && qid){
routerPushByKey(key,{ query: { id: qid.toString() } });
}else if(key==='details_closedoc' && qid){
if(key==='details_approval' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){
routerPushByKey("details_index",{ query: { id: qid.toString(),key:'home' } });
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else{
routerPushByKey(key as any);
}
}
// 打开审批详情
const openDetail = (row: any) => {
routerPushByKey("details_approval",{ query: { id: row?.change_id?.toString(),key:'home' } });
};
// 获取当前时间字符串
const getCurrentTimeStr = () => {
@@ -75,7 +63,7 @@ const matchObj = (list:any,val:number) => {
// 获取数据
const getData = async () => {
loading.value = true;
const {data,error} = await homeProfessionalApi();
const {data,error} = await homeQualityApi();
if(!error){
console.log(data)
homeData.value = data;
@@ -163,15 +151,15 @@ onUnmounted(() => {
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0"
:end-value="homeData?.todo_sign?.total || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
:style="{ color: homeData?.todo_sign?.overdue_count ? themeStore.otherColor.error : themeStore.themeColor }"
/>
</div>
<div>
<p class="text-12px font-600">待我会签</p>
<!-- <p class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 1 项 · 请优先处理</p> -->
<p class="text-12px text-slate-400">无超期</p>
<p v-if="homeData?.todo_sign?.overdue_count" class="text-12px" :style="{ color: themeStore.otherColor.error }">其中超期 {{homeData?.todo_sign?.overdue_count || 0}} 项 · 请优先处理</p>
<p v-else class="text-12px text-slate-400">无超期</p>
</div>
</div>
</NGi>
@@ -179,7 +167,7 @@ onUnmounted(() => {
<div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('professionalstatistics')"
@click="jumpTo('signstatistics')"
>
<div class="flex justify-between">
<CountTo
@@ -191,7 +179,6 @@ onUnmounted(() => {
</div>
<div>
<p class="text-12px font-600">本月已会签</p>
<p class="text-12px text-slate-400">含附检验要求同意 1 起 · 系统自动采集</p>
</div>
</div>
</NGi>
@@ -199,12 +186,12 @@ onUnmounted(() => {
<div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_highrisk')"
@click="jumpTo('changeledger')"
>
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0"
:end-value="homeData?.quality_focus?.total || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
/>
@@ -219,19 +206,18 @@ onUnmounted(() => {
<div
class="flex-1 bg-[#fff] px-16px py-12px cursor-pointer flex items-center gap-3"
:style="{ borderRadius: themeStore.themeRadius + 'px' }"
@click="jumpTo('my_mytask')"
@click="jumpTo('signstatistics')"
>
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.sign_stats?.risk_analysis_count || 0"
:end-value="homeData?.quality_focus?.year_fmea_count || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
/>
</div>
<div>
<p class="text-12px font-600">检验方案确认</p>
<p class="text-12px text-slate-400">近一年 · 检验项目 / 频次调整确认</p>
<p class="text-12px font-600">FMEA分析条数</p>
</div>
</div>
</NGi>
@@ -240,7 +226,7 @@ onUnmounted(() => {
<NGrid :x-gap="16" :y-gap="16" responsive="screen" item-responsive>
<!-- 左侧 -->
<NGi span="24 s:24 m:24 l:16">
<!-- 我的变更进度 -->
<!-- 待我会签 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
@@ -248,14 +234,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_mytask')">
<NButton v-if="homeData?.todo_sign?.total > 0" ghost size="small" class="text-xs" @click="jumpTo('my_mytask')">
我的任务
<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" @click="openDetail(row)"
<template v-if="homeData?.todo_sign?.total > 0">
<div v-for="row in homeData?.todo_sign?.items || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
class="cursor-pointer flex w-full items-center gap-3 border px-3.5 py-2.5 text-left transition hover:border-[var(--hover-border)] hover:bg-[var(--hover-bg)] hover:bg-[#EAF0F9]/40"
:style="{
borderRadius: themeStore.themeRadius + 'px',
@@ -288,32 +274,22 @@ onUnmounted(() => {
<NTag class="text-[11px]" v-if="row.duration_type===2" type="warning" size="small">临时</NTag>
<NTag class="text-[11px]" v-else type="info" size="small">永久</NTag>
<span class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 3 天</span>
<span v-if="row.overdue_status===2" class="text-xs" :style="{ color: themeStore.otherColor.error }">已超期 {{row.overdue_days}} 天</span>
</div>
<div class="mt-1 flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<!-- 状态标签 -->
<NTag v-if="row.status==='APPROVING'" size="small" type="warning">审批中</NTag>
<NTag v-if="row.status==='APPROVED'" size="small" type="success">已通过</NTag>
<NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">待验收</NTag>
<NTag v-if="row.status==='ACCEPTED'" size="small" type="error">待关闭</NTag>
<NTag v-if="row.status==='CLOSED'" size="small" type="success">已关闭</NTag>
<NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">已撤回</NTag>
<NTag v-if="row.status==='REJECTED'" size="small" type="error">已驳回</NTag>
<NTag size="small" type="warning">{{row.step_name}}</NTag>
<NButton size="small" type="primary" class="text-xs">
去审批
<Icon icon="akar-icons:arrow-right" class="size-13px ml-1" />
</NButton>
</div>
<div class="mt-0.5 truncate text-[11px] text-slate-400 flex items-center gap-2">
<p>申请人:{{row.step_name}}</p>
<p>申请人:{{row.applicant_name}}</p>
<span v-if="row.apply_time" class="text-[11px] text-slate-400">{{ row.apply_time?.slice(0, 10) }}</span>
</div>
</div>
</div>
<NButton dashed type="primary" size="small" class="text-xs" @click="jumpTo('my_mytask')">
还有{{(homeData?.my_changes_progress?.total - 3) > 0 ? (homeData?.my_changes_progress?.total - 3) : 0}}条,前往我的任务查看全部 →
</NButton>
</template>
<template v-else>
<p class="text-xs text-slate-400 text-center">暂无数据</p>
@@ -358,14 +334,14 @@ onUnmounted(() => {
<p class="text-13px font-700 text-#64749a">质量关注变更</p>
<p class="text-11px text-#94a3b8">在办 · 影响产品合格判定,建议重点关注</p>
</div>
<template v-if="highRisk.length">
<template v-if="homeData?.quality_focus?.items?.length">
<div class="space-y-2.5">
<div v-for="h in highRisk" :key="h.title" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5">
<div v-for="h in homeData?.quality_focus?.items || []" :key="h.change_id" class="rounded-md border border-amber-200 bg-amber-50/60 px-3.5 py-2.5">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">{{ h.title }}</span>
<NButton size="tiny" ghost type="warning" class="text-xs">查看</NButton>
<NButton size="tiny" ghost type="warning" class="text-xs" @click="jumpTo('changeledger')">查看</NButton>
</div>
<div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.why }}</div>
<div class="mt-1 text-[11px]" :style="{ color: themeStore.otherColor.warning }">{{ h.effect }}</div>
</div>
</div>
</template>
@@ -386,11 +362,11 @@ onUnmounted(() => {
<NProgress
type="line"
status="info"
:percentage="(1.8 / 3) * 100"
:percentage="((homeData?.sign_stats?.avg_audit_days || 0) / 2) * 100"
:height="10"
border-radius="6px"
>
<span class="text-xs text-slate-700 font-semibold">1.8天</span>
<span class="text-xs text-slate-700 font-semibold">{{homeData?.sign_stats?.avg_audit_days || 0}}天</span>
</NProgress>
</div>
<div class="flex items-center gap-2">
@@ -398,15 +374,15 @@ onUnmounted(() => {
<NProgress
type="line"
status="error"
:percentage="(2.6 / 3) * 100"
:percentage="((homeData?.sign_stats?.max_audit_days || 0) / 2) * 100"
:height="10"
border-radius="6px"
>
<span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">2.6天</span>
<span class="text-xs text-slate-700 font-semibold" :style="{ color: themeStore.otherColor.error }">{{homeData?.sign_stats?.max_audit_days || 0}}天</span>
</NProgress>
</div>
<div class="flex items-center justify-between text-[11px] text-slate-400">
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">92%</b></span>
<span>会签及时率 <b :style="{ color: themeStore.otherColor.success }">{{homeData?.sign_stats?.timely_rate || 0}}%</b></span>
<span>目标 2 天内签署</span>
</div>
</div>