非审批人员首页完成

This commit is contained in:
2026-09-30 10:49:11 +08:00
parent bcfc167905
commit 253df87b31
5 changed files with 39 additions and 51 deletions
-1
View File
@@ -53,7 +53,6 @@ const getData = async () => {
const {data,error} = await homeAdminApi();
if(!error){
homeData.value = data;
console.log(data)
}
loading.value = false;
}
+29 -47
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 { homeNonApproverApi } from "@/service/api/statistics";
const themeStore = useThemeStore();
const { routerPushByKey } = useRouterPush();
@@ -23,22 +23,10 @@ let timer: any = null;
// 首页数据
const homeData = ref<any>(null);
// 跳转变更申请页面、变更台账、我的任务、发起变更
const jumpTo = (key: string,qid:number = 0) => {
if(key==='my_initiatechange' && qid){
routerPushByKey(key,{ query: { id: qid.toString() } });
}else if(key==='details_closedoc' && qid){
routerPushByKey(key,{ query: { id: qid.toString(),key:'home' } });
}else if(key==='details_index' && qid){
routerPushByKey("details_index",{ query: { id: qid.toString(),key:'home' } });
}else{
// 跳转页面
const jumpTo = (key: string) => {
routerPushByKey(key as any);
}
}
// 打开审批详情
const openDetail = (row: any) => {
routerPushByKey("details_approval",{ query: { id: row?.change_id?.toString(),key:'home' } });
};
// 获取当前时间字符串
const getCurrentTimeStr = () => {
@@ -63,7 +51,7 @@ const tick = () => {
// 获取数据
const getData = async () => {
loading.value = true;
const {data,error} = await homeProfessionalApi();
const {data,error} = await homeNonApproverApi();
if(!error){
console.log(data)
homeData.value = data;
@@ -150,7 +138,7 @@ onUnmounted(() => {
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0"
:end-value="homeData?.summary?.open_total || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
/>
@@ -170,7 +158,7 @@ onUnmounted(() => {
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.sign_stats?.month_signed || 0"
:end-value="homeData?.summary?.important_open_total || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
/>
@@ -190,7 +178,7 @@ onUnmounted(() => {
<div class="flex justify-between">
<CountTo
:start-value="0"
:end-value="homeData?.dept_stats?.reject_count || 0"
:end-value="homeData?.summary?.month_closed || 0"
class="text-26px font-600"
:style="{ color: themeStore.themeColor }"
/>
@@ -214,14 +202,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('changeledger')">
<NButton v-if="homeData?.recent?.items?.length > 0" ghost size="small" class="text-xs" @click="jumpTo('changeledger')">
变更台账
<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?.recent?.items?.length > 0">
<div v-for="row in homeData?.recent?.items || []" :key="row.change_id" @click="jumpTo('changeledger')"
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',
@@ -232,20 +220,20 @@ onUnmounted(() => {
<div class="min-w-0 flex-1">
<div class="flex flex-wrap items-center gap-2">
<!-- 状态标签 -->
<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 v-if="row.status==='APPROVING'" size="small" type="warning">{{row.status_label}}</NTag>
<NTag v-if="row.status==='APPROVED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='IMPLEMENTED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='ACCEPTED'" size="small" type="error">{{row.status_label}}</NTag>
<NTag v-if="row.status==='CLOSED'" size="small" type="success">{{row.status_label}}</NTag>
<NTag v-if="row.status==='WITHDRAWN'" size="small" type="error">{{row.status_label}}</NTag>
<NTag v-if="row.status==='REJECTED'" size="small" type="error">{{row.status_label}}</NTag>
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800 dark:text-white">{{ row.title }}</span>
<span class="ml-auto text-[11px] text-slate-400">2026-07-26 10:25</span>
<span v-if="row.status_changed_at" class="ml-auto text-[11px] text-slate-400">{{row.status_changed_at?.slice(0, 16)}}</span>
</div>
<div class="mt-1 flex items-center gap-2 font-mono text-[11px] text-slate-400">
<span>{{ row.change_no }}</span>
<span>一车间</span>
<span>张工艺</span>
<span>{{row.org_name}}</span>
<span>{{row.applicant_name}}</span>
</div>
</div>
</div>
@@ -265,13 +253,7 @@ onUnmounted(() => {
<p class="text-11px text-#94a3b8 mt-2px">点击进入台账按阶段查看</p>
</div>
<div class="flex gap-2">
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">审批中 14</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">已通过 6</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">待验收 9</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">待关闭 7</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">已关闭 81</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">已撤回 9</NButton>
<NButton size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">已驳回 9</NButton>
<NButton v-for="item in homeData?.stage_dist || []" :key="item.key" size="small" ghost type="primary" class="text-xs" @click="jumpTo('changeledger')">{{item.label}} {{item.count}}</NButton>
</div>
</NCard>
</NGi>
@@ -287,7 +269,7 @@ onUnmounted(() => {
<p class="text-11px text-#94a3b8">现行有效文件 · 只读</p>
</div>
<div class="space-y-2.5">
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_query')">
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')">
<div class="flex-1">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">操作规程查阅</span>
@@ -296,7 +278,7 @@ onUnmounted(() => {
</div>
<NButton text><Icon icon="formkit:right" class="size-14px text-slate-400" /></NButton>
</div>
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_query')">
<div class="rounded-md border px-3.5 py-2.5 flex items-center cursor-pointer" @click="jumpTo('docs_archives')">
<div class="flex-1">
<div class="flex items-center gap-2">
<span class="min-w-0 flex-1 truncate text-sm font-medium text-slate-800">PID 图纸查阅</span>
@@ -329,27 +311,27 @@ onUnmounted(() => {
<NProgress
type="line"
status="info"
:percentage="(1.8 / 3) * 100"
:percentage="((homeData?.stats?.month_created || 0) / 3) * 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?.stats?.month_created || 0}}天</span>
</NProgress>
</div>
<div class="flex items-center gap-2">
<span class="text-xs text-slate-500 w-16">本月关闭</span>
<NProgress
type="line"
status="error"
:percentage="(2.6 / 3) * 100"
status="info"
:percentage="((homeData?.stats?.month_closed || 0) / 3) * 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?.stats?.month_closed || 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?.stats?.accept_full_rate || 0}}%</b></span>
<span>近一年口径</span>
</div>
<NButton size="small" ghost block class="text-xs" @click="jumpTo('factoryoverview')">查看统计报表<Icon icon="formkit:right" class="size-12px" /></NButton>
+2 -2
View File
@@ -288,7 +288,7 @@ onUnmounted(() => {
</div>
<div class="flex flex-col gap-3">
<template v-if="homeData?.todo_approvals?.total > 0">
<div v-for="row in homeData?.todo_approvals?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
<div v-for="row in homeData?.todo_approvals?.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"
:style="{
borderRadius: themeStore.themeRadius + 'px',
@@ -429,7 +429,7 @@ onUnmounted(() => {
</div>
<div class="flex flex-col gap-3">
<template v-if="homeData?.temp_after_use?.total > 0">
<div v-for="row in homeData?.temp_after_use?.items?.slice(0, 3) || []" :key="row.change_id"
<div v-for="row in homeData?.temp_after_use?.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',
+1 -1
View File
@@ -255,7 +255,7 @@ onUnmounted(() => {
</div>
<div class="flex flex-col gap-3">
<template v-if="homeData?.todo_approvals?.total > 0">
<div v-for="row in homeData?.todo_approvals?.items?.slice(0, 3) || []" :key="row.change_id" @click="jumpTo('details_approval',row.change_id)"
<div v-for="row in homeData?.todo_approvals?.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',