所有页面没有数据时显示内容修改

This commit is contained in:
2026-10-08 14:12:54 +08:00
parent 4ab213e396
commit a26075d61b
12 changed files with 60 additions and 24 deletions
+6 -6
View File
@@ -22,7 +22,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const token = ref(''); const token = ref('');
const userInfo: Api.Auth.UserInfo = reactive({ const userInfo: Api.Auth.UserInfo = reactive({
userId: '', user_id: 0,
username: '', username: '',
roles: [], roles: [],
buttons: [] buttons: []
@@ -56,12 +56,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
/** Record the user ID of the previous login session Used to compare with the current user ID on next login */ /** Record the user ID of the previous login session Used to compare with the current user ID on next login */
function recordUserId() { function recordUserId() {
if (!userInfo.userId) { if (!userInfo.user_id) {
return; return;
} }
// Store current user ID locally for next login comparison // Store current user ID locally for next login comparison
localStg.set('lastLoginUserId', userInfo.userId); localStg.set('lastLoginUserId', String(userInfo.user_id));
} }
/** /**
@@ -70,14 +70,14 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
* @returns {boolean} Whether to clear all tabs * @returns {boolean} Whether to clear all tabs
*/ */
function checkTabClear(): boolean { function checkTabClear(): boolean {
if (!userInfo.userId) { if (!userInfo.user_id) {
return false; return false;
} }
const lastLoginUserId = localStg.get('lastLoginUserId'); const lastLoginUserId = localStg.get('lastLoginUserId');
// Clear all tabs if current user is different from previous user // Clear all tabs if current user is different from previous user
if (!lastLoginUserId || lastLoginUserId !== userInfo.userId) { if (!lastLoginUserId || lastLoginUserId !== String(userInfo.user_id)) {
localStg.remove('globalTabs'); localStg.remove('globalTabs');
tabStore.clearTabs(); tabStore.clearTabs();
@@ -155,7 +155,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
// 同步 AI 插件用户身份(exchange 换 ai_token 用) // 同步 AI 插件用户身份(exchange 换 ai_token 用)
setAiUser({ setAiUser({
platform_user_id: String(info.userId), platform_user_id: String(info.user_id),
align_key: info.username, align_key: info.username,
display_name: info.username display_name: info.username
}); });
+1 -1
View File
@@ -12,7 +12,7 @@ declare namespace Api {
} }
interface UserInfo { interface UserInfo {
userId: string; user_id: number;
username: string; username: string;
roles: string[]; roles: string[];
buttons: string[]; buttons: string[];
+3 -1
View File
@@ -527,7 +527,9 @@ onMounted(async () => {
</div> </div>
</div> </div>
</div> </div>
<div v-if="list.length === 0" class="rounded-lg border border-dashed bg-white py-12 text-center text-sm text-slate-400">当前筛选条件下暂无变更记录</div> <div v-if="list.length === 0" class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据"></NEmpty>
</div>
</div> </div>
<div class="flex justify-end mt-3"> <div class="flex justify-end mt-3">
<NPagination <NPagination
+3
View File
@@ -295,6 +295,9 @@ onMounted(() => {
<div class="h-full rounded-full" :style="{ width: `${(a.avg_days / a.total) * 100}%`, background: a.avg_days > 2 ? themeStore.otherColor.error : themeStore.themeColor }"></div> <div class="h-full rounded-full" :style="{ width: `${(a.avg_days / a.total) * 100}%`, background: a.avg_days > 2 ? themeStore.otherColor.error : themeStore.themeColor }"></div>
</div> </div>
</div> </div>
<div v-if="deptStatistics?.approver_time?.length === 0" class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
+5 -3
View File
@@ -214,7 +214,7 @@ onMounted(async () => {
</NButton> </NButton>
</div> </div>
<div class="scroll"> <div class="scroll">
<div class="space-y-3 px-4 pb-3"> <div v-if="list.length" class="space-y-3 px-4 pb-3">
<div v-for="(s, i) in list" :key="`${s.cid ?? 'x'}-${i}`" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-3"> <div v-for="(s, i) in list" :key="`${s.cid ?? 'x'}-${i}`" class="flex flex-wrap items-center gap-3 rounded-lg border px-4 py-3">
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div class="flex flex-wrap items-center gap-2"> <div class="flex flex-wrap items-center gap-2">
@@ -345,8 +345,10 @@ onMounted(async () => {
<NButton ghost size="small" class="text-xs" @click="jumpTo(s)">查看变更</NButton> <NButton ghost size="small" class="text-xs" @click="jumpTo(s)">查看变更</NButton>
<NButton size="small" type="primary" class="text-xs" @click="viewAnalysis(s)">查看分析记录</NButton> <NButton size="small" type="primary" class="text-xs" @click="viewAnalysis(s)">查看分析记录</NButton>
</div> </div>
<div v-if="list.length === 0" class="py-6 text-center text-xs text-slate-400">当前筛选条件下无新增高风险场景</div> </div>
</div> <div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据"></NEmpty>
</div>
</div> </div>
<div class="flex justify-end mt-3 px-4 py-2 border-t"> <div class="flex justify-end mt-3 px-4 py-2 border-t">
<NPagination <NPagination
+4 -4
View File
@@ -286,10 +286,7 @@ onMounted(() => {
</span> </span>
</div> </div>
<div class="space-y-2 scroll"> <div class="space-y-2 scroll">
<div class="flex flex-col gap-3"> <div v-if="list.length" class="flex flex-col gap-3">
<div v-if="list.length===0" class="text-center text-slate-400">
暂无数据
</div>
<div <div
class="border border-slate-200 p-4" class="border border-slate-200 p-4"
:style="{ borderRadius: themeStore.themeRadius + 'px' }" :style="{ borderRadius: themeStore.themeRadius + 'px' }"
@@ -430,6 +427,9 @@ onMounted(() => {
</div> </div>
</div> </div>
</div> </div>
<div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据"></NEmpty>
</div>
</div> </div>
<!-- 进度弹框 --> <!-- 进度弹框 -->
<NDrawer v-model:show="progressDrawer" :width="502" placement="right"> <NDrawer v-model:show="progressDrawer" :width="502" placement="right">
+3 -1
View File
@@ -197,7 +197,9 @@ onMounted(() => {
<NEmpty description="暂无数据"></NEmpty> <NEmpty description="暂无数据"></NEmpty>
</div> </div>
</div> </div>
<div v-else class="text-xs text-slate-400 text-center border rounded-md py-5">暂无数据</div> <div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据"></NEmpty>
</div>
</div> </div>
<div class="flex justify-end mt-3"> <div class="flex justify-end mt-3">
<NPagination <NPagination
+6 -2
View File
@@ -161,7 +161,9 @@ onMounted(() => {
<div class="h-full rounded-full" :class="e.avg_days > hourToDay(homeData?.my_stats?.sign_timely_hours || 0) ? 'bg-[var(--error-color)]' : 'bg-[var(--theme-color)]'" :style="{ width: `${Math.min(100, (e.avg_days / e.total) * 100)}%` }"></div> <div class="h-full rounded-full" :class="e.avg_days > hourToDay(homeData?.my_stats?.sign_timely_hours || 0) ? 'bg-[var(--error-color)]' : 'bg-[var(--theme-color)]'" :style="{ width: `${Math.min(100, (e.avg_days / e.total) * 100)}%` }"></div>
</div> </div>
</div> </div>
<p v-if="homeData?.approver_time?.length===0" class="text-xs text-slate-400 text-center py-3">暂无数据</p> <div v-if="homeData?.approver_time?.length === 0" class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
<div> <div>
<div class="mb-1 flex items-center justify-between text-xs"> <div class="mb-1 flex items-center justify-between text-xs">
<span class="text-slate-600">考核目标</span> <span class="text-slate-600">考核目标</span>
@@ -208,7 +210,9 @@ onMounted(() => {
</div> </div>
<p class="text-[11px] text-slate-400">更多高风险场景与分析记录见「高风险」页</p> <p class="text-[11px] text-slate-400">更多高风险场景与分析记录见「高风险」页</p>
</div> </div>
<p v-else class="text-center text-xs text-slate-400">暂无高风险在办</p> <div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
+15 -3
View File
@@ -170,7 +170,7 @@ onMounted(() => {
<NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }"> <NCard :bordered="true" size="small" :content-style="{padding: 0}" :style="{ borderRadius: themeStore.themeRadius + 'px', height: '100%' }">
<p class=" text-base font-semibold border-b border-slate-100 p-3">各车间变更数量({{dateLabel}})</p> <p class=" text-base font-semibold border-b border-slate-100 p-3">各车间变更数量({{dateLabel}})</p>
<div class="py-3 px-4"> <div class="py-3 px-4">
<ColumnChart v-if="homeData" :data="homeData?.workshop_counts?.items || []" /> <ColumnChart v-if="homeData" :data="homeData?.workshop_counts?.items || []" />
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
@@ -214,7 +214,11 @@ onMounted(() => {
</thead> </thead>
<tbody> <tbody>
<tr v-if="homeData?.approver_eff?.rows?.length===0"> <tr v-if="homeData?.approver_eff?.rows?.length===0">
<td colspan="4" class="text-center text-xs text-slate-400 py-3">暂无数据</td> <td colspan="4">
<div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</td>
</tr> </tr>
<tr v-for="r in homeData?.approver_eff?.rows || []" :key="r.p" class="border-b last:border-0"> <tr v-for="r in homeData?.approver_eff?.rows || []" :key="r.p" class="border-b last:border-0">
<td class="py-2"> <td class="py-2">
@@ -296,6 +300,9 @@ onMounted(() => {
<NButton size="small" class="text-[11px]" @click="jumpTo('details_index',r.change_id)">查看</NButton> <NButton size="small" class="text-[11px]" @click="jumpTo('details_index',r.change_id)">查看</NButton>
</span> </span>
</div> </div>
<div v-if="homeData?.accept_detail?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -440,6 +447,9 @@ onMounted(() => {
<span class="w-12 shrink-0 text-right text-xs font-bold text-slate-800">{{ e.days }} 天</span> <span class="w-12 shrink-0 text-right text-xs font-bold text-slate-800">{{ e.days }} 天</span>
</NProgress> </NProgress>
</div> </div>
<div v-if="homeData?.dept_approval_days?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</div> </div>
</NCard> </NCard>
@@ -536,7 +546,9 @@ onMounted(() => {
<span class="w-12 shrink-0 text-right text-xs font-bold text-slate-800">{{ r.count }} 起</span> <span class="w-12 shrink-0 text-right text-xs font-bold text-slate-800">{{ r.count }} 起</span>
</NProgress> </NProgress>
</div> </div>
<div class="text-[11px] text-slate-400">可用于申请端填报质量改进:TOP2 理由已纳入 AI 预识别检查项</div> <div v-if="!homeData?.reject?.reasons || homeData?.reject?.reasons?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</div> </div>
</NCard> </NCard>
+3
View File
@@ -239,6 +239,9 @@ onMounted(() => {
<NTag size="small" type="error">超期 {{ o.overdue_days }} 天</NTag> <NTag size="small" type="error">超期 {{ o.overdue_days }} 天</NTag>
<NButton size="small" ghost class="text-xs" :disabled="btnLoading" @click="handleReminder(o.change_id)">催办</NButton> <NButton size="small" ghost class="text-xs" :disabled="btnLoading" @click="handleReminder(o.change_id)">催办</NButton>
</div> </div>
<div v-if="homeData?.overdue_list?.length===0" class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
+6 -2
View File
@@ -161,7 +161,9 @@ onMounted(() => {
<div class="h-full rounded-full" :class="e.avg_days > hourToDay(homeData?.my_stats?.sign_timely_hours || 0) ? 'bg-[var(--error-color)]' : 'bg-[var(--theme-color)]'" :style="{ width: `${Math.min(100, (e.avg_days / e.total) * 100)}%` }"></div> <div class="h-full rounded-full" :class="e.avg_days > hourToDay(homeData?.my_stats?.sign_timely_hours || 0) ? 'bg-[var(--error-color)]' : 'bg-[var(--theme-color)]'" :style="{ width: `${Math.min(100, (e.avg_days / e.total) * 100)}%` }"></div>
</div> </div>
</div> </div>
<p v-if="homeData?.approver_time?.length===0" class="text-xs text-slate-400 text-center py-3">暂无数据</p> <div v-if="homeData?.approver_time?.length === 0" class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
<div> <div>
<div class="mb-1 flex items-center justify-between text-xs"> <div class="mb-1 flex items-center justify-between text-xs">
<span class="text-slate-600">考核目标</span> <span class="text-slate-600">考核目标</span>
@@ -208,7 +210,9 @@ onMounted(() => {
</div> </div>
<p class="text-[11px] text-slate-400">更多高风险场景与分析记录见「高风险」页</p> <p class="text-[11px] text-slate-400">更多高风险场景与分析记录见「高风险」页</p>
</div> </div>
<p v-else class="text-center text-xs text-slate-400">暂无高风险在办</p> <div v-else class="h-100% flex items-center justify-center">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</div> </div>
</NCard> </NCard>
</NGi> </NGi>
+5 -1
View File
@@ -308,7 +308,11 @@ onMounted(() => {
</thead> </thead>
<tbody> <tbody>
<tr v-if="homeData?.invest?.items?.length===0"> <tr v-if="homeData?.invest?.items?.length===0">
<td colspan="6" class="text-center text-xs !text-slate-400">暂无数据</td> <td colspan="6">
<div class="h-100% flex items-center justify-center py-3">
<NEmpty description="暂无数据" class="!text-xs"></NEmpty>
</div>
</td>
</tr> </tr>
<tr v-for="row in homeData?.invest?.items || []" :key="row.change_id"> <tr v-for="row in homeData?.invest?.items || []" :key="row.change_id">
<td> <td>