fix: 设备验收预警优化

This commit is contained in:
sophie committed 2026-10-13 15:52:09 +08:00
1 parent 7e7bcbd388
commit b8cc0cbe77
25 files changed
+1398 -193

No files matched your search

@@ -4,9 +4,9 @@
* 依赖:统一 requestJson;后端 /api/equipment-acceptance。
* 逻辑:Chat 作业面调用。同步只读 E10。配置只保存天数和系统用户,不保存发送时刻。
* 保存配置自行声明 Content-Type: application/json,供 Flask get_json 解析。
* 发送记录只读已落库的行,扫描尚未写入时列表为空。
* 发送记录只读已落库的行。每位收件人的 Excel 可再下载。
*/
import { requestJson } from '@/shared/api/client';
import { requestBlob, requestJson } from '@/shared/api/client';
export interface EquipmentAcceptanceNode {
node_id?: string | null;
@@ -150,6 +150,7 @@ export interface EquipmentAcceptanceSendRecord {
sent_at?: string | null;
error_message?: string | null;
created_at?: string | null;
files?: Array<{ id: number; excel_file_name?: string | null }>;
}
export interface EquipmentAcceptanceSendListResponse {
@@ -166,6 +167,33 @@ export interface EquipmentAcceptanceSendListResponse {
* @param params.pageSize - 每页条数
* @returns 当前页记录和总数
*/
export interface EquipmentAcceptanceSendFile {
id: number;
recipient_name?: string | null;
excel_file_name?: string | null;
excel_file_size?: number | null;
status: string;
sent_at?: string | null;
created_at?: string | null;
}
/**
* 列出最近按收件人归档的 Excel。不含文件内容。
* @returns 文件摘要
*/
export function listEquipmentAcceptanceSendFiles() {
return requestJson<{ items: EquipmentAcceptanceSendFile[] }>('/api/equipment-acceptance/send-files');
}
/**
* 下载一份当时发给收件人的 Excel。
* @param fileId - 归档文件主键
* @returns 文件字节和文件名
*/
export function downloadEquipmentAcceptanceSendFile(fileId: number) {
return requestBlob(`/api/equipment-acceptance/send-files/${fileId}/excel`);
}
export function listEquipmentAcceptanceSends(params?: { page?: number; pageSize?: number }) {
const search = new URLSearchParams();
if (params?.page) search.set('page', String(params.page));
@@ -185,6 +213,7 @@ export interface EquipmentAcceptanceConfigUser {
export interface EquipmentAcceptanceConfig {
days: number[];
round_4_enabled?: boolean;
buyer_manager_user_id?: number | null;
coo_user_id?: number | null;
executive_user_id?: number | null;
@@ -202,9 +231,10 @@ export function getEquipmentAcceptanceConfig() {
}
/**
* 保存四档天数和三个岗位的系统用户。仅平台管理员。
* 核心逻辑:岗位传用户主键或 null,不传姓名。
* 保存四档天数、第 4 轮开关和三个岗位的系统用户。仅平台管理员。
* 核心逻辑:岗位传用户主键或 null,不传姓名。第 4 轮关闭时不通知总经理。
* @param payload.days - 四个逐档增大的天数
* @param payload.round4Enabled - 是否启用第 4 轮
* @param payload.buyerManagerUserId - 采购经副理
* @param payload.cooUserId - COO
* @param payload.executiveUserId - 总经理对应岗位
@@ -212,6 +242,7 @@ export function getEquipmentAcceptanceConfig() {
*/
export function saveEquipmentAcceptanceConfig(payload: {
days: number[];
round4Enabled: boolean;
buyerManagerUserId: number | null;
cooUserId: number | null;
executiveUserId: number | null;
@@ -221,6 +252,7 @@ export function saveEquipmentAcceptanceConfig(payload: {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
days: payload.days,
round_4_enabled: payload.round4Enabled,
buyer_manager_user_id: payload.buyerManagerUserId,
coo_user_id: payload.cooUserId,
executive_user_id: payload.executiveUserId,
@@ -1,8 +1,8 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceConfigPage.vue
用途:设备验收预警配置页。编辑四档天数,并为三个固定岗位选择系统用户。
用途:设备验收预警配置页。按升级轮次编辑天数、第 4 轮开关和三个固定岗位。
依赖:equipment-acceptance.api、UserPickerDialog、userPicker.utils、vue-i18n。
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。姓名只用于展示。
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。同一岗位在多个轮次里共用一个人。
发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
-->
<script setup lang="ts">
@@ -23,15 +23,47 @@ const props = defineProps<{
}>();
type RoleKey = 'buyer_manager' | 'coo' | 'executive';
type RoundLine =
| { kind: 'plain'; tag: 'ruleTo' | 'ruleCc'; text: string; note?: string }
| { kind: 'roles'; tag: 'ruleTo' | 'ruleCc'; roles: RoleKey[] };
const ROLE_FIELDS: RoleKey[] = ['buyer_manager', 'coo', 'executive'];
const TIER_WHO = ['tierWho1', 'tierWho2', 'tierWho3', 'tierWho4'] as const;
const ROUNDS: Array<{ index: number; lines: RoundLine[] }> = [
{
index: 0,
lines: [
{ kind: 'plain', tag: 'ruleTo', text: 'ruleTo1' },
{ kind: 'plain', tag: 'ruleCc', text: 'ruleCc1', note: 'roundFixedNote' },
],
},
{
index: 1,
lines: [
{ kind: 'plain', tag: 'ruleTo', text: 'ruleTo2' },
{ kind: 'roles', tag: 'ruleCc', roles: ['coo', 'buyer_manager'] },
],
},
{
index: 2,
lines: [
{ kind: 'roles', tag: 'ruleTo', roles: ['coo'] },
{ kind: 'roles', tag: 'ruleCc', roles: ['buyer_manager'] },
],
},
{
index: 3,
lines: [
{ kind: 'roles', tag: 'ruleTo', roles: ['executive'] },
{ kind: 'roles', tag: 'ruleCc', roles: ['coo', 'buyer_manager'] },
],
},
];
const { t } = useI18n();
const msg = useMessage();
const loading = ref(false);
const saving = ref(false);
const days = ref<number[]>([30, 37, 44, 51]);
const round4Enabled = ref(false);
const roleIds = ref<Record<RoleKey, number | null>>({
buyer_manager: null,
coo: null,
@@ -54,13 +86,6 @@ const pickerSelectedIds = computed(() => {
return id ? [id] : [];
});
const ruleRows = computed(() => ([
{ to: 'ruleTo1', cc: 'ruleCc1' },
{ to: 'ruleTo2', cc: 'ruleCc2' },
{ to: 'ruleTo3', cc: 'ruleCc3' },
{ to: 'ruleTo4', cc: 'ruleCc4' },
]));
/**
* 读取当前配置。管理员响应里包含候选人。
* 核心逻辑:失败时保留页面上的默认天数,并用统一错误提示。
@@ -70,6 +95,7 @@ async function load(): Promise<void> {
try {
const result = await getEquipmentAcceptanceConfig();
days.value = result.days?.length === 4 ? [...result.days] : [30, 37, 44, 51];
round4Enabled.value = result.round_4_enabled === true;
roleIds.value = {
buyer_manager: result.buyer_manager_user_id ?? null,
coo: result.coo_user_id ?? null,
@@ -114,7 +140,7 @@ function clearRole(role: RoleKey): void {
}
/**
* 保存天数和三个岗位。天数须逐档增大。
* 保存天数、第 4 轮开关和三个岗位。天数须逐档增大。
* 核心逻辑:先在页面拦住空值和倒序,服务端再校验用户是否存在。
*/
async function save(): Promise<void> {
@@ -131,11 +157,13 @@ async function save(): Promise<void> {
try {
const result = await saveEquipmentAcceptanceConfig({
days: nextDays,
round4Enabled: round4Enabled.value,
buyerManagerUserId: roleIds.value.buyer_manager,
cooUserId: roleIds.value.coo,
executiveUserId: roleIds.value.executive,
});
days.value = [...result.days];
round4Enabled.value = result.round_4_enabled === true;
knownUsers.value = result.selected_users || [];
candidates.value = result.users || [];
msg.success(t('admin.equipmentAcceptance.configSaved'));
@@ -147,14 +175,47 @@ async function save(): Promise<void> {
}
/**
* 岗位上已选用户的展示名。没有选择时返回空串,模板改显示未选择。
* @param role - 岗位键
* @returns 姓名,有工号时附在后面
* 取出某个岗位已选的人。没有选择时为空。
* @param role - buyer_manager、coo、executive
* @returns 选人组件里的用户,或空
*/
function roleLabel(role: RoleKey): string {
function rolePerson(role: RoleKey): UserPickerPerson | undefined {
const id = roleIds.value[role];
if (!id) return '';
return userPickerLabel(people.value.get(id), id);
if (!id) return undefined;
return people.value.get(id);
}
/**
* 芯片上的姓名。没有选择时返回空串。
* @param role - 岗位键
* @returns 展示名
*/
function roleName(role: RoleKey): string {
const person = rolePerson(role);
if (!person) return '';
return userPickerLabel(person).replace(/([^)]*)$/, '') || userPickerLabel(person);
}
/**
* 姓名首字,画在圆形头像里。
* @param role - 岗位键
* @returns 一个字符
*/
function roleInitial(role: RoleKey): string {
const name = roleName(role).trim();
return name.slice(0, 1) || '?';
}
/**
* 芯片第二行:工号和岗位名。
* @param role - 岗位键
* @returns 例如 26030025 · COO
*/
function roleMeta(role: RoleKey): string {
const person = rolePerson(role);
const roleText = t(`admin.equipmentAcceptance.role.${role}`);
const employeeId = String(person?.employee_id || person?.username || '').trim();
return employeeId ? `${employeeId} · ${roleText}` : roleText;
}
onMounted(() => {
@@ -167,97 +228,95 @@ onMounted(() => {
<p class="mb-3 text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.configLead') }}</p>
<p v-if="loading" class="text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.loading') }}</p>
<template v-else>
<div class="grid grid-cols-4 gap-3">
<label
v-for="(who, index) in TIER_WHO"
:key="who"
class="rounded-xl border border-[#dce4ef] border-t-[3px] bg-white px-3 py-3"
:class="index === 0 ? 'border-t-[#93c5fd]' : index === 1 ? 'border-t-[#2563eb]' : index === 2 ? 'border-t-[#d97706]' : 'border-t-[#dc2626]'"
>
<span class="block text-xs font-bold text-[#64748b]">{{ t(`admin.equipmentAcceptance.tier${index + 1}`) }}</span>
<span class="mt-2 flex items-center gap-2">
<input
v-model.number="days[index]"
class="h-11 w-16 rounded-lg border border-[#d7dee8] bg-[#f8fafc] text-center text-xl font-bold text-[#142033] disabled:opacity-70"
type="number"
min="1"
:disabled="!editable"
/>
<span class="text-sm font-semibold text-[#94a3b8]">{{ t('admin.equipmentAcceptance.dayUnit') }}</span>
</span>
<span class="mt-2 block text-xs font-bold text-[#334155]">{{ t(`admin.equipmentAcceptance.${who}`) }}</span>
</label>
</div>
<div class="mt-3 grid gap-3 lg:grid-cols-2">
<article class="rounded-xl border border-[#dce4ef] bg-white">
<h2 class="px-4 pt-4 text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.fixedRoles') }}</h2>
<div class="px-4 pb-2">
<div
v-for="role in ROLE_FIELDS"
:key="role"
class="grid grid-cols-[108px_minmax(0,1fr)] items-center gap-3 border-b border-[#dce4ef] py-3 last:border-b-0"
>
<span class="text-sm font-bold text-[#334155]">{{ t(`admin.equipmentAcceptance.role.${role}`) }}</span>
<div class="flex min-w-0 flex-wrap items-center gap-2">
<span v-if="roleLabel(role)" class="truncate text-sm text-[#142033]">{{ roleLabel(role) }}</span>
<span v-else class="text-sm text-[#94a3b8]">{{ t('admin.equipmentAcceptance.roleEmpty') }}</span>
<button
v-if="editable"
class="ml-auto rounded-lg border border-[#bfdbfe] bg-[#eaf2ff] px-2.5 py-1 text-xs font-bold text-[#1d4ed8]"
type="button"
@click="openPicker(role)"
>
{{ t('admin.equipmentAcceptance.selectUser') }}
</button>
<button
v-if="editable && roleIds[role]"
class="text-xs font-bold text-[#64748b]"
type="button"
@click="clearRole(role)"
>
{{ t('admin.equipmentAcceptance.clearUser') }}
</button>
<section class="overflow-hidden rounded-2xl border border-[#dce4ef] bg-white">
<div class="px-5 pb-2 pt-4">
<h2 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.configSheetTitle') }}</h2>
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.configSheetLead') }}</p>
</div>
<div class="px-3 pb-2">
<article
v-for="round in ROUNDS"
:key="round.index"
class="relative ml-4 grid grid-cols-1 gap-3 border-l-2 border-[#c9d4e3] py-4 pl-7 sm:grid-cols-[168px_minmax(0,1fr)] sm:gap-x-5"
:class="round.index === ROUNDS.length - 1 ? 'border-transparent' : ''"
>
<span class="absolute -left-[7px] top-6 h-3 w-3 rounded-full border-2 border-white bg-[#1d4e89] shadow-[0_0_0_1px_#c9d4e3]"></span>
<div class="flex flex-col gap-2">
<b class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.roundName', { n: round.index + 1 }) }}</b>
<label class="flex items-center gap-2 text-[13px] text-[#64748b]">
{{ t('admin.equipmentAcceptance.overPrefix') }}
<input
v-model.number="days[round.index]"
class="h-10 w-[72px] rounded-lg border border-[#d5dee8] bg-[#f8fafc] text-center text-[22px] font-semibold text-[#142033] disabled:opacity-70"
type="number"
min="1"
:disabled="!editable"
/>
{{ t('admin.equipmentAcceptance.dayUnit') }}
</label>
<template v-if="round.index === 3">
<label class="flex items-center gap-1.5 text-[13px] font-bold text-[#142033]">
<input v-model="round4Enabled" class="h-4 w-4 accent-[#1d4e89]" type="checkbox" :disabled="!editable" />
{{ t('admin.equipmentAcceptance.round4Enabled') }}
</label>
<small class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.round4ShortHint') }}</small>
</template>
</div>
<div class="flex flex-col gap-2" :class="round.index === 3 && !round4Enabled ? 'opacity-45' : ''">
<div v-for="(line, lineIndex) in round.lines" :key="`${round.index}-${lineIndex}`" class="flex items-start gap-2.5">
<span class="mt-1.5 w-9 shrink-0 text-xs font-bold text-[#64748b]">{{ t(`admin.equipmentAcceptance.${line.tag}`) }}</span>
<div class="min-w-0">
<template v-if="line.kind === 'plain'">
<p class="mt-1 text-sm font-semibold text-[#142033]">{{ t(`admin.equipmentAcceptance.${line.text}`) }}</p>
<p v-if="line.note" class="mt-1 text-xs text-[#94a3b8]">{{ t(`admin.equipmentAcceptance.${line.note}`) }}</p>
</template>
<div v-else class="flex flex-wrap gap-2">
<div
v-for="role in line.roles"
:key="role"
class="flex min-h-8 items-center gap-2 rounded-full bg-[#eef3f8] py-1 pl-1 pr-2"
>
<span class="grid h-6 w-6 place-items-center rounded-full bg-[#d7e4f2] text-xs font-bold text-[#1d4e89]">{{ roleInitial(role) }}</span>
<span class="flex flex-col leading-tight">
<strong class="text-[13px] text-[#142033]">{{ roleName(role) || t('admin.equipmentAcceptance.roleEmpty') }}</strong>
<span class="text-[11px] text-[#64748b]">{{ roleMeta(role) }}</span>
</span>
<button
v-if="editable"
class="text-xs font-bold text-[#1d4e89]"
type="button"
@click="openPicker(role)"
>
{{ roleIds[role] ? t('admin.equipmentAcceptance.replaceUser') : t('admin.equipmentAcceptance.selectUser') }}
</button>
<button
v-if="editable && roleIds[role]"
class="text-xs text-[#64748b]"
type="button"
@click="clearRole(role)"
>
{{ t('admin.equipmentAcceptance.clearUser') }}
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="flex items-center justify-between gap-3 border-t border-[#dce4ef] bg-[#fafbfd] px-4 py-3">
<span class="text-xs text-[#64748b]">{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
<button
v-if="editable"
class="rounded-lg bg-[#2563eb] px-3 py-1.5 text-xs font-bold text-white disabled:opacity-50"
type="button"
:disabled="saving"
@click="save"
>
{{ t('admin.equipmentAcceptance.saveConfig') }}
</button>
</div>
</article>
<article class="overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
<div class="px-4 pt-4">
<h2 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.rulesTitle') }}</h2>
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.rulesLead') }}</p>
</div>
<table class="mt-3 w-full border-collapse text-left text-xs">
<thead class="bg-[#f8fbff] text-[#64748b]">
<tr>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleTier') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleTo') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleCc') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in ruleRows" :key="row.to" class="border-t border-[#dce4ef]">
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.ruleOver', { days: days[index] || '—' }) }}</td>
<td class="px-3 py-2.5">{{ t(`admin.equipmentAcceptance.${row.to}`) }}</td>
<td class="px-3 py-2.5">{{ t(`admin.equipmentAcceptance.${row.cc}`) }}</td>
</tr>
</tbody>
</table>
</article>
</div>
</article>
</div>
<div class="flex items-center justify-between gap-4 border-t border-[#dce4ef] bg-[#fafbfd] px-5 py-3.5">
<span class="text-xs text-[#64748b]">{{ editable ? t('admin.equipmentAcceptance.configSaveHint') : t('admin.equipmentAcceptance.configReadOnly') }}</span>
<button
v-if="editable"
class="h-9 rounded-lg bg-[#1d4e89] px-4 text-[13px] font-bold text-white disabled:opacity-50"
type="button"
:disabled="saving"
@click="save"
>
{{ t('admin.equipmentAcceptance.saveConfig') }}
</button>
</div>
</section>
</template>
<UserPickerDialog
@@ -1,17 +1,19 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceSendsPage.vue
用途:设备验收预警发送记录页,列出每张验收单某一档的主送、抄送和结果。
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n。
逻辑:由 Chat 作业面的「发送记录」Tab 嵌入。只读已落库记录。扫描尚未写入时显示空状态。
用途:设备验收预警发送记录页,列出每张验收单某一档的主送、抄送、Excel 附件和结果。
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n、lucide 图标。
逻辑:由 Chat 作业面的「发送记录」Tab 嵌入。Excel 附件列点击文件名下载。发送失败时悬停图标看原因。
-->
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { CircleAlert, Download } from 'lucide-vue-next';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import PaginationBar from '@/shared/components/PaginationBar.vue';
import { useMessage } from '@/shared/composables/useMessage';
import { formatLocalDateTime } from '@/shared/utils/dateTime';
import {
downloadEquipmentAcceptanceSendFile,
listEquipmentAcceptanceSends,
type EquipmentAcceptanceSendRecord,
} from '../api/equipment-acceptance.api';
@@ -19,11 +21,13 @@ import {
const { t, te } = useI18n();
const msg = useMessage();
const records = ref<EquipmentAcceptanceSendRecord[]>([]);
const downloadingId = ref<number | null>(null);
const loading = ref(false);
const page = ref(1);
const pageSize = ref(20);
const total = ref(0);
const pages = ref(1);
const failureTip = ref<{ text: string; left: number; top: number } | null>(null);
/**
* 拉取当前页发送记录。
@@ -76,6 +80,55 @@ function sentText(value?: string | null): string {
return text === '-' ? '—' : text;
}
/**
* 在失败图标下方显示原因。用固定定位,避免被表格滚动容器裁掉。
* @param event - 悬停或聚焦事件
* @param message - 发送失败原因
*/
function openFailureTip(event: Event, message: string): void {
const target = event.currentTarget;
if (!(target instanceof HTMLElement)) return;
const rect = target.getBoundingClientRect();
const width = 280;
failureTip.value = {
text: message || t('admin.equipmentAcceptance.failureReasonEmpty'),
left: Math.max(8, Math.min(rect.left, window.innerWidth - width - 8)),
top: rect.bottom + 6,
};
}
/**
* 鼠标离开或失焦时关掉失败原因提示。
*/
function closeFailureTip(): void {
failureTip.value = null;
}
/**
* 下载一份已归档的收件人 Excel。
* 核心逻辑:接口返回当时发出的字节,由浏览器保存。
* @param file - 这一行上的 Excel 摘要
*/
async function downloadFile(file: { id: number; excel_file_name?: string | null }): Promise<void> {
if (downloadingId.value === file.id) return;
downloadingId.value = file.id;
try {
const { blob, filename } = await downloadEquipmentAcceptanceSendFile(file.id);
const objectUrl = URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.href = objectUrl;
anchor.download = filename || file.excel_file_name || `equipment-acceptance-alert-${file.id}.xlsx`;
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
URL.revokeObjectURL(objectUrl);
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.excelDownloadFailed'));
} finally {
downloadingId.value = null;
}
}
onMounted(() => {
void load();
});
@@ -97,6 +150,7 @@ defineExpose({ reload: load });
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleTo') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.ruleCc') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.sendResult') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.excelColumn') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.sentAt') }}</th>
</tr>
</thead>
@@ -108,15 +162,43 @@ defineExpose({ reload: load });
<td class="px-3 py-2.5">{{ item.to_text || '—' }}</td>
<td class="px-3 py-2.5">{{ item.cc_text || '—' }}</td>
<td class="px-3 py-2.5">
{{ statusText(item.status) }}
<span v-if="item.error_message" class="mt-1 block text-[#b42318]">
{{ item.error_message }}
<span class="inline-flex items-center gap-1" :class="item.status === 'failed' ? 'font-bold text-[#b42318]' : ''">
{{ statusText(item.status) }}
<button
v-if="item.status === 'failed'"
class="inline-flex h-[22px] w-[22px] items-center justify-center rounded-full text-[#b42318] hover:bg-[#fff1f2]"
type="button"
:aria-label="t('admin.equipmentAcceptance.failureReasonAria')"
@mouseenter="openFailureTip($event, item.error_message || '')"
@mouseleave="closeFailureTip"
@focus="openFailureTip($event, item.error_message || '')"
@blur="closeFailureTip"
>
<CircleAlert class="h-4 w-4" />
</button>
</span>
</td>
<td class="px-3 py-2.5">
<div v-if="item.files?.length" class="flex max-w-[280px] flex-col gap-1">
<button
v-for="file in item.files"
:key="file.id"
class="inline-flex min-w-0 items-center gap-1 font-semibold text-[#2563eb] disabled:opacity-50"
type="button"
:disabled="downloadingId === file.id"
:title="t('admin.equipmentAcceptance.excelColumn')"
@click="downloadFile(file)"
>
<Download class="h-3.5 w-3.5 shrink-0" />
<span class="truncate">{{ file.excel_file_name }}</span>
</button>
</div>
<span v-else>—</span>
</td>
<td class="px-3 py-2.5">{{ sentText(item.sent_at) }}</td>
</tr>
<tr v-if="!loading && !records.length">
<td colspan="7" class="px-3 py-10 text-center text-[#64748b]">
<td colspan="8" class="px-3 py-10 text-center text-[#64748b]">
{{ t('admin.equipmentAcceptance.sendsEmpty') }}
</td>
</tr>
@@ -133,5 +215,15 @@ defineExpose({ reload: load });
@update:page="() => load()"
@update:page-size="() => load()"
/>
<Teleport to="body">
<div
v-if="failureTip"
class="pointer-events-none fixed z-[80] max-w-[280px] whitespace-normal break-words rounded-lg bg-slate-900 px-2.5 py-1.5 text-xs leading-relaxed text-white shadow-lg"
role="tooltip"
:style="{ left: `${failureTip.left}px`, top: `${failureTip.top}px` }"
>
{{ failureTip.text }}
</div>
</Teleport>
</section>
</template>
+18 -1
View File
@@ -5742,6 +5742,10 @@
"tabSends": "Send records",
"tabConfig": "Alert settings",
"sendsLead": "The daily scan creates records waiting to be sent. They appear here after the Friday 18:00 summary goes out to each recipient. Names stay as they were at send time.",
"excelColumn": "Excel attachment",
"sentExcelTitle": "Sent Excel files",
"sentExcelHint": "One file per recipient. You can download the copy that was sent.",
"excelDownloadFailed": "Could not download the Excel file",
"sendsEmpty": "No send records yet",
"sendsFailed": "Failed to load send records",
"scanAlerts": "Scan alerts",
@@ -5751,6 +5755,9 @@
"scanDone": "Added {created}, updated {updated}, cancelled {cancelled}",
"sendDone": "Sent to {sent} people, {failed} failed",
"sendResult": "Result",
"failureReason": "Failure reason",
"failureReasonEmpty": "No failure reason was recorded",
"failureReasonAria": "View failure reason",
"sentAt": "Sent at",
"sendStatus": {
"pending": "Waiting to send",
@@ -5758,11 +5765,21 @@
"failed": "Failed",
"cancelled": "Cancelled"
},
"configLead": "Each tier must be longer than the one before it. Saving affects only alerts created later. The send time is set on the schedule.",
"configLead": "Each round must be longer than the one before it. Saving affects only alerts created later. The send time is set on the schedule.",
"configSheetTitle": "Escalation rounds",
"configSheetLead": "Set the day threshold on the left. The right side lists who is notified. COO, purchasing deputy manager, and general manager are each chosen once and shown on every round that uses them.",
"overPrefix": "Over",
"roundName": "Round {n}",
"roundFixedNote": "Follows the current order. No one is picked here.",
"replaceUser": "Change",
"round4ShortHint": "Off by default. The general manager is not notified.",
"tier1": "Tier 1",
"tier2": "Tier 2",
"tier3": "Tier 3",
"tier4": "Tier 4",
"round4Enabled": "Enable round 4",
"round4EnabledHint": "While this is off, the general manager is not notified. It stays off until turned on.",
"round4Off": "Off",
"tierWho1": "Current handler",
"tierWho2": "Deputy manager",
"tierWho3": "COO",
+18 -1
View File
@@ -5742,6 +5742,10 @@
"tabSends": "บันทึกการส่ง",
"tabConfig": "ตั้งค่าการเตือน",
"sendsLead": "การสแกนรายวันสร้างรายการที่รอส่ง หลังสรุปส่งทุกวันศุกร์ 18:00 ตามผู้รับแล้ว จะแสดงที่นี่ ชื่อคงตามตอนที่ส่ง",
"excelColumn": "ไฟล์แนบ Excel",
"sentExcelTitle": "ไฟล์ Excel ที่ส่งแล้ว",
"sentExcelHint": "หนึ่งไฟล์ต่อผู้รับหนึ่งคน ดาวน์โหลดสำเนาที่ส่งไปแล้วได้",
"excelDownloadFailed": "ดาวน์โหลดไฟล์ Excel ไม่สำเร็จ",
"sendsEmpty": "ยังไม่มีบันทึกการส่ง",
"sendsFailed": "โหลดบันทึกการส่งไม่สำเร็จ",
"scanAlerts": "สแกนการเตือน",
@@ -5751,6 +5755,9 @@
"scanDone": "เพิ่ม {created} รายการ อัปเดต {updated} รายการ ยกเลิก {cancelled} รายการ",
"sendDone": "ส่งถึง {sent} คน ไม่สำเร็จ {failed} คน",
"sendResult": "ผลลัพธ์",
"failureReason": "สาเหตุที่ล้มเหลว",
"failureReasonEmpty": "ไม่ได้บันทึกสาเหตุ",
"failureReasonAria": "ดูสาเหตุที่ล้มเหลว",
"sentAt": "เวลาที่ส่ง",
"sendStatus": {
"pending": "รอส่ง",
@@ -5758,11 +5765,21 @@
"failed": "ส่งไม่สำเร็จ",
"cancelled": "ยกเลิกแล้ว"
},
"configLead": "จำนวนวันแต่ละขั้นต้องมากขึ้นตามลำดับ การบันทึกมีผลเฉพาะการเตือนที่เกิดภายหลัง เวลาส่งตั้งในตารางงาน",
"configLead": "จำนวนวันแต่ละรอบต้องมากขึ้นตามลำดับ การบันทึกมีผลเฉพาะการเตือนที่เกิดภายหลัง เวลาส่งตั้งในตารางงาน",
"configSheetTitle": "รอบการยกระดับ",
"configSheetLead": "ด้านซ้ายกำหนดจำนวนวันที่เกิน ด้านขวาคือผู้รับในรอบนี้ COO รองผู้จัดการจัดซื้อ และผู้จัดการทั่วไปเลือกครั้งเดียว แล้วแสดงคนเดียวกันในทุกรอบที่ใช้",
"overPrefix": "เกิน",
"roundName": "รอบที่ {n}",
"roundFixedNote": "ตามเอกสารปัจจุบัน ไม่ต้องเลือกคนที่นี่",
"replaceUser": "เปลี่ยน",
"round4ShortHint": "ค่าเริ่มต้นคือปิด จะไม่แจ้งผู้จัดการทั่วไป",
"tier1": "ขั้นที่ 1",
"tier2": "ขั้นที่ 2",
"tier3": "ขั้นที่ 3",
"tier4": "ขั้นที่ 4",
"round4Enabled": "เปิดใช้รอบที่ 4",
"round4EnabledHint": "เมื่อปิด จะไม่แจ้งผู้จัดการทั่วไป ค่าเริ่มต้นคือปิด เปิดแล้วจึงเตือนตามจำนวนวันของขั้นที่ 4",
"round4Off": "ปิดอยู่",
"tierWho1": "ผู้ดำเนินการปัจจุบัน",
"tierWho2": "รองผู้จัดการ",
"tierWho3": "COO",
+18 -1
View File
@@ -5775,6 +5775,10 @@
"tabSends": "发送记录",
"tabConfig": "预警配置",
"sendsLead": "每日扫描生成待发送。默认每周五 18:00 按收件人汇总发出后记在这里。已发送的姓名保持发送当时的人。",
"excelColumn": "Excel 附件",
"sentExcelTitle": "已发送的 Excel",
"sentExcelHint": "每位收件人一份,可再次下载当时发出的文件。",
"excelDownloadFailed": "下载 Excel 失败",
"sendsEmpty": "还没有发送记录",
"sendsFailed": "读取发送记录失败",
"scanAlerts": "扫描预警",
@@ -5784,6 +5788,9 @@
"scanDone": "新增 {created} 条,更新 {updated} 条,取消 {cancelled} 条",
"sendDone": "已向 {sent} 人发送,{failed} 人失败",
"sendResult": "结果",
"failureReason": "失败原因",
"failureReasonEmpty": "没有记下失败原因",
"failureReasonAria": "查看失败原因",
"sentAt": "发送时间",
"sendStatus": {
"pending": "待发送",
@@ -5791,11 +5798,21 @@
"failed": "发送失败",
"cancelled": "已取消"
},
"configLead": "四档天数须逐档增大。保存后只影响以后新产生的预警。发送时刻在排程里配置。",
"configLead": "四轮天数须逐轮增大。保存后只影响以后新产生的预警。发送时刻在排程里改。",
"configSheetTitle": "升级轮次",
"configSheetLead": "左边改超过多少天。右边是这一轮的主送和抄送。COO、采购经副理、总经理各选一次,用到的轮次都显示同一个人。",
"overPrefix": "超过",
"roundName": "第 {n} 轮",
"roundFixedNote": "随当前单据变化,这里不选人",
"replaceUser": "更换",
"round4ShortHint": "默认关闭,不通知总经理",
"tier1": "第 1 档",
"tier2": "第 2 档",
"tier3": "第 3 档",
"tier4": "第 4 档",
"round4Enabled": "启用第 4 轮",
"round4EnabledHint": "关闭后不向总经理发送。默认关闭,打开后才按第 4 档天数提醒。",
"round4Off": "未启用",
"tierWho1": "当前处理人",
"tierWho2": "经副理",
"tierWho3": "COO",
+18 -1
View File
@@ -5742,6 +5742,10 @@
"tabSends": "發送記錄",
"tabConfig": "預警配置",
"sendsLead": "每日掃描產生待發送。預設每週五 18:00 按收件人彙總發出後記在這裡。已發送的姓名保持發送當時的人。",
"excelColumn": "Excel 附件",
"sentExcelTitle": "已發送的 Excel",
"sentExcelHint": "每位收件人一份,可再次下載當時發出的檔案。",
"excelDownloadFailed": "下載 Excel 失敗",
"sendsEmpty": "還沒有發送記錄",
"sendsFailed": "讀取發送記錄失敗",
"scanAlerts": "掃描預警",
@@ -5751,6 +5755,9 @@
"scanDone": "新增 {created} 條,更新 {updated} 條,取消 {cancelled} 條",
"sendDone": "已向 {sent} 人發送,{failed} 人失敗",
"sendResult": "結果",
"failureReason": "失敗原因",
"failureReasonEmpty": "沒有記下失敗原因",
"failureReasonAria": "查看失敗原因",
"sentAt": "發送時間",
"sendStatus": {
"pending": "待發送",
@@ -5758,11 +5765,21 @@
"failed": "發送失敗",
"cancelled": "已取消"
},
"configLead": "四檔天數須逐檔增大。儲存後只影響以後新產生的預警。發送時刻在排程裡配置。",
"configLead": "四輪天數須逐輪增大。儲存後只影響以後新產生的預警。發送時刻在排程裡改。",
"configSheetTitle": "升級輪次",
"configSheetLead": "左邊改超過多少天。右邊是這一輪的主送和抄送。COO、採購經副理、總經理各選一次,用到的輪次都顯示同一個人。",
"overPrefix": "超過",
"roundName": "第 {n} 輪",
"roundFixedNote": "隨目前單據變化,這裡不選人",
"replaceUser": "更換",
"round4ShortHint": "預設關閉,不通知總經理",
"tier1": "第 1 檔",
"tier2": "第 2 檔",
"tier3": "第 3 檔",
"tier4": "第 4 檔",
"round4Enabled": "啟用第 4 輪",
"round4EnabledHint": "關閉後不向總經理發送。預設關閉,打開後才按第 4 檔天數提醒。",
"round4Off": "未啟用",
"tierWho1": "目前處理人",
"tierWho2": "經副理",
"tierWho3": "COO",