feat(equipment-acceptance): 设备验收预警

This commit is contained in:
sophie committed 2026-10-12 11:53:40 +08:00
1 parent 239d373503
commit 86fc8a2c06
48 files changed
+6196 -82

No files matched your search

@@ -4,12 +4,12 @@
* 用途:对话页主区域,组合侧栏、消息列表、输入栏、货代会话 Workflow 时间线与内置浏览器。
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingWorkflowTimeline、ContractPaymentChatPanel、VoucherCheckChatPanel、chunkLoadRecovery、chat.context。
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingWorkflowTimeline、ContractPaymentChatPanel、EquipmentAcceptanceChatPanel、VoucherCheckChatPanel、chunkLoadRecovery、chat.context。
* 逻辑:本文件只做页面结构编排;货代 Chat 仅上传/进度通知,履约写操作不在本页;
* 货代会话主区域:有会话即全屏批次进度中心(常驻),无会话为欢迎页+输入框;会话标题取自侧栏历史并传给中心;
* 右侧「本次处理」由 conversationId 驱动 Workflow projection,extractionRunNo 仅作进度装饰;
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、立账凭证 Agent 用 Tab 作业面替换消息列表与输入框。
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、设备验收预警、立账凭证 Agent 用作业面替换消息列表与输入框。
*/
@@ -47,7 +47,7 @@ import { useChatPageContext } from '@/features/chat/composables/chat.context';
import { matchesTrainingAgent } from '@/features/chat/training/trainingWorkspace.utils';
import { agentHasIntentUiProfile, resolveAgentCode, AGENT_CODE_IN_TRANSIT_TRANSFER, isContractPaymentAgent, isVoucherCheckAgent } from '@/shared/utils/agent-registry.utils';
import { agentHasIntentUiProfile, resolveAgentCode, AGENT_CODE_IN_TRANSIT_TRANSFER, isContractPaymentAgent, isEquipmentAcceptanceAgent, isVoucherCheckAgent } from '@/shared/utils/agent-registry.utils';
import {
SHIPPING_WORKFLOW_KEY,
@@ -79,6 +79,10 @@ const ContractPaymentChatPanel = defineRecoverableAsyncComponent(
() => import('@/features/contract-payment/components/ContractPaymentChatPanel.vue'),
);
const EquipmentAcceptanceChatPanel = defineRecoverableAsyncComponent(
() => import('@/features/equipment-acceptance/components/EquipmentAcceptanceChatPanel.vue'),
);
const VoucherCheckChatPanel = defineRecoverableAsyncComponent(
() => import('@/features/voucher-check/components/VoucherCheckChatPanel.vue'),
);
@@ -130,11 +134,14 @@ const isInTransitTransferAgent = computed(() => resolveAgentCode(page.currentAge
/** 合同付款预警 Agent:主区嵌台账 Tab,隐藏对话输入与历史。 */
const isContractPaymentAgentPage = computed(() => isContractPaymentAgent(page.currentAgent));
/** 设备验收预警 Agent:主区嵌停留列表,隐藏对话输入与历史。 */
const isEquipmentAcceptanceAgentPage = computed(() => isEquipmentAcceptanceAgent(page.currentAgent));
/** 立账凭证 Agent:主区嵌检核任务 / 企微发送记录 Tab,隐藏对话输入与历史。 */
const isVoucherCheckAgentPage = computed(() => isVoucherCheckAgent(page.currentAgent));
/** builtin 作业面 Agent 共用:隐藏新会话、历史列表与输入框。 */
const hideTaskChatSessionUi = computed(() => isContractPaymentAgentPage.value || isVoucherCheckAgentPage.value);
const hideTaskChatSessionUi = computed(() => isContractPaymentAgentPage.value || isEquipmentAcceptanceAgentPage.value || isVoucherCheckAgentPage.value);
/** 在途仓自动调拨业务流激活(来源选择/待处理等子视图)时隐藏聊天输入框,模拟业务页。 */
const transferFlowActive = ref(false);
@@ -489,6 +496,8 @@ watch(() => page.currentAgentId, () => {
<ContractPaymentChatPanel v-else-if="isContractPaymentAgentPage" />
<EquipmentAcceptanceChatPanel v-else-if="isEquipmentAcceptanceAgentPage" />
<VoucherCheckChatPanel v-else-if="isVoucherCheckAgentPage" />
<div v-else class="flex min-h-0 min-w-0 flex-1">
@@ -0,0 +1,227 @@
/**
* features/equipment-acceptance/api/equipment-acceptance.api.ts
* 用途:设备验收预警同步列表、详情和手动同步。
* 依赖:统一 requestJson;后端 /api/equipment-acceptance。
* 逻辑:Chat 作业面调用。同步只读 E10。配置只保存天数和系统用户,不保存发送时刻。
* 发送记录只读已落库的行,扫描尚未写入时列表为空。
*/
import { requestJson } from '@/shared/api/client';
export interface EquipmentAcceptanceNode {
node_id?: string | null;
node_name?: string | null;
node_type?: number | null;
}
export interface EquipmentAcceptanceOperator {
node_id?: string | null;
user_id?: string | null;
handler_name?: string | null;
handler_job_num?: string | null;
}
export interface EquipmentAcceptanceOrder {
id: number;
acceptance_no?: string | null;
purchase_order_no?: string | null;
contract_no?: string | null;
timer_started_at?: string | null;
dwell_days?: number | null;
can_accept?: number | null;
cannot_accept_note?: string | null;
is_returned?: number | null;
flow_status_raw?: number | null;
finished_at?: string | null;
request_id?: string | null;
request_match_count: number;
owner_name?: string | null;
owner_job_num?: string | null;
applicant_name?: string | null;
applicant_job_num?: string | null;
monitor_status: string;
overdue?: boolean;
present_in_source: boolean;
synced_at?: string | null;
nodes: EquipmentAcceptanceNode[];
operators: EquipmentAcceptanceOperator[];
}
export interface EquipmentAcceptanceSummary {
watching: number;
overdue: number;
stopped: number;
not_started: number;
}
export interface EquipmentAcceptanceListResponse {
items: EquipmentAcceptanceOrder[];
total: number;
page: number;
page_size: number;
pages: number;
summary?: EquipmentAcceptanceSummary;
}
export interface EquipmentAcceptanceSyncResult {
upserted: number;
skipped_without_request_id: number;
absent: number;
by_status: Record<string, number>;
}
/**
* 分页查询已同步的验收单。
* 核心逻辑:focus 对应原型分组。空或 all 不过滤。
* @param params.focus - watching、overdue、stopped、not_started
* @param params.page - 页码,从 1 开始
* @param params.pageSize - 每页条数
* @returns 分页快照和全部单据汇总
*/
export function listEquipmentAcceptanceOrders(params?: {
focus?: string;
page?: number;
pageSize?: number;
}) {
const query = new URLSearchParams();
if (params?.focus && params.focus !== 'all') query.set('focus', params.focus);
if (params?.page) query.set('page', String(params.page));
if (params?.pageSize) query.set('page_size', String(params.pageSize));
const suffix = query.toString() ? `?${query.toString()}` : '';
return requestJson<EquipmentAcceptanceListResponse>(`/api/equipment-acceptance/orders${suffix}`);
}
/**
* 读取一张验收单的节点和操作人。
* @param orderId - 本地快照主键
* @returns 快照详情
*/
export function getEquipmentAcceptanceOrder(orderId: number) {
return requestJson<EquipmentAcceptanceOrder>(`/api/equipment-acceptance/orders/${orderId}`);
}
/**
* 从 E10 拉取验收单并更新本地快照。仅平台管理员可调用。
* @returns 本次写入、跳过和未见条数
*/
export function syncEquipmentAcceptance() {
return requestJson<EquipmentAcceptanceSyncResult>('/api/equipment-acceptance/sync', { method: 'POST' });
}
export interface EquipmentAcceptanceScanResult {
created: number;
updated: number;
cancelled: number;
}
export interface EquipmentAcceptanceSendResult {
sent: number;
failed: number;
records_sent: number;
records_failed: number;
}
/**
* 管理员立即同步 E10 并生成待发送记录。
* @returns 新增、更新和取消条数
*/
export function scanEquipmentAcceptanceAlerts() {
return requestJson<EquipmentAcceptanceScanResult>('/api/equipment-acceptance/alerts/scan', { method: 'POST' });
}
/**
* 管理员立即把待发送记录按收件人发到企业微信。
* @returns 成功和失败的收件人数
*/
export function sendEquipmentAcceptanceAlerts() {
return requestJson<EquipmentAcceptanceSendResult>('/api/equipment-acceptance/alerts/send', { method: 'POST' });
}
export interface EquipmentAcceptanceSendRecord {
id: number;
order_id?: number | null;
acceptance_no?: string | null;
purchase_order_no?: string | null;
tier: number;
threshold_days: number;
to_text?: string | null;
cc_text?: string | null;
status: string;
sent_at?: string | null;
error_message?: string | null;
created_at?: string | null;
}
export interface EquipmentAcceptanceSendListResponse {
items: EquipmentAcceptanceSendRecord[];
total: number;
page: number;
page_size: number;
}
/**
* 分页读取发送记录。
* 核心逻辑:按创建时间倒序。还没有扫描写入时 items 为空。
* @param params.page - 从 1 开始
* @param params.pageSize - 每页条数
* @returns 当前页记录和总数
*/
export function listEquipmentAcceptanceSends(params?: { page?: number; pageSize?: number }) {
const search = new URLSearchParams();
if (params?.page) search.set('page', String(params.page));
if (params?.pageSize) search.set('page_size', String(params.pageSize));
const suffix = search.toString() ? `?${search.toString()}` : '';
return requestJson<EquipmentAcceptanceSendListResponse>(`/api/equipment-acceptance/sends${suffix}`);
}
export interface EquipmentAcceptanceConfigUser {
id: number;
username: string;
real_name?: string | null;
employee_id?: string | null;
department?: string | null;
wecom_bound?: boolean;
}
export interface EquipmentAcceptanceConfig {
days: number[];
buyer_manager_user_id?: number | null;
coo_user_id?: number | null;
executive_user_id?: number | null;
selected_users: EquipmentAcceptanceConfigUser[];
users: EquipmentAcceptanceConfigUser[];
updated_at?: string | null;
}
/**
* 读取四档天数和三个固定岗位。管理员响应里带候选人。
* @returns 当前配置
*/
export function getEquipmentAcceptanceConfig() {
return requestJson<EquipmentAcceptanceConfig>('/api/equipment-acceptance/config');
}
/**
* 保存四档天数和三个岗位的系统用户。仅平台管理员。
* 核心逻辑:岗位传用户主键或 null,不传姓名。
* @param payload.days - 四个逐档增大的天数
* @param payload.buyerManagerUserId - 采购经副理
* @param payload.cooUserId - COO
* @param payload.executiveUserId - 廖总对应岗位
* @returns 保存后的配置
*/
export function saveEquipmentAcceptanceConfig(payload: {
days: number[];
buyerManagerUserId: number | null;
cooUserId: number | null;
executiveUserId: number | null;
}) {
return requestJson<EquipmentAcceptanceConfig>('/api/equipment-acceptance/config', {
method: 'PUT',
body: JSON.stringify({
days: payload.days,
buyer_manager_user_id: payload.buyerManagerUserId,
coo_user_id: payload.cooUserId,
executive_user_id: payload.executiveUserId,
}),
});
}
@@ -0,0 +1,225 @@
<!--
features/equipment-acceptance/components/EquipmentAcceptanceChatPanel.vue
用途:设备验收预警 Chat 主区:停留列表、详情、发送记录、预警配置,以及管理员同步、扫描和发送。
依赖:停留列表、详情、发送记录、配置页、auth.store、equipment-acceptance.api、DeleteConfirmDialog、vue-router query。
逻辑:由 ChatViewContent 在 agent_code=equipment_acceptance 时替换消息列表与输入框。
view=config 打开预警配置;view=sends 打开发送记录;orderId 只在停留列表下钻。
同步只在停留列表。扫描和发送只在发送记录,且仅平台管理员可见。
-->
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { RefreshCw } from 'lucide-vue-next';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
import { useAuthStore } from '@/features/auth/stores/auth.store';
import { useMessage } from '@/shared/composables/useMessage';
import {
scanEquipmentAcceptanceAlerts,
sendEquipmentAcceptanceAlerts,
syncEquipmentAcceptance,
} from '../api/equipment-acceptance.api';
import EquipmentAcceptanceConfigPage from '../views/EquipmentAcceptanceConfigPage.vue';
import EquipmentAcceptanceDetailPage from '../views/EquipmentAcceptanceDetailPage.vue';
import EquipmentAcceptancePage from '../views/EquipmentAcceptancePage.vue';
import EquipmentAcceptanceSendsPage from '../views/EquipmentAcceptanceSendsPage.vue';
type WorkspaceView = 'ledger' | 'sends' | 'config';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const auth = useAuthStore();
const msg = useMessage();
const syncing = ref(false);
const alertRunning = ref(false);
const pendingAlert = ref<'scan' | 'send' | null>(null);
const listPage = ref<{ reload: () => Promise<void> } | null>(null);
const sendsPage = ref<{ reload: () => Promise<void> } | null>(null);
const isAdmin = computed(() => Boolean(auth.isAdmin));
const activeView = computed<WorkspaceView>(() => {
if (route.query.view === 'config') return 'config';
if (route.query.view === 'sends') return 'sends';
return 'ledger';
});
const showAlertConfirm = computed({
get: () => pendingAlert.value !== null,
set: (open: boolean) => {
if (!open) pendingAlert.value = null;
},
});
const alertConfirmCopy = computed(() => (
pendingAlert.value === 'send'
? { title: t('admin.equipmentAcceptance.sendAlerts'), message: t('admin.equipmentAcceptance.sendConfirm') }
: { title: t('admin.equipmentAcceptance.scanAlerts'), message: t('admin.equipmentAcceptance.scanConfirm') }
));
const detailId = computed(() => {
if (activeView.value !== 'ledger') return null;
const raw = Number(route.query.orderId);
return Number.isInteger(raw) && raw > 0 ? raw : null;
});
const tabs = computed(() => ([
{ key: 'ledger' as const, label: t('admin.equipmentAcceptance.tabLedger') },
{ key: 'sends' as const, label: t('admin.equipmentAcceptance.tabSends') },
{ key: 'config' as const, label: t('admin.equipmentAcceptance.tabConfig') },
]));
/**
* 把当前 Tab 和详情写入 Chat 路由。
* 核心逻辑:配置和发送记录清掉 orderId。停留列表不写 view,避免旧链接被改掉。
* @param view - ledger、sends 或 config
* @param orderId - 本地快照主键,空表示列表
*/
async function syncQuery(view: WorkspaceView, orderId: number | null): Promise<void> {
const query = { ...route.query };
if (view === 'config' || view === 'sends') {
query.view = view;
delete query.orderId;
} else {
delete query.view;
if (orderId) query.orderId = String(orderId);
else delete query.orderId;
}
const sameView = String(route.query.view || '') === String(query.view || '');
const sameOrder = String(route.query.orderId || '') === String(query.orderId || '');
if (sameView && sameOrder) return;
await router.replace({ params: { ...route.params }, query });
}
/**
* 切换停留列表、发送记录和预警配置。
* @param view - 目标 Tab
*/
function selectView(view: WorkspaceView): void {
void syncQuery(view, null);
}
/**
* 管理员在发送记录页立即扫描或发送。
* 核心逻辑:公共确认框点确定后才调用。先取出动作再关掉弹窗,避免关闭时把待执行动作清掉。
*/
function confirmAlertAction(): void {
const action = pendingAlert.value;
pendingAlert.value = null;
if (action) void runAlertAction(action);
}
/**
* 执行已经确认的扫描或发送。
* 核心逻辑:扫描会同步 E10;发送把待发送记录推到企业微信。
* @param action - scan 或 send
*/
async function runAlertAction(action: 'scan' | 'send'): Promise<void> {
if (alertRunning.value) return;
alertRunning.value = true;
try {
if (action === 'scan') {
const result = await scanEquipmentAcceptanceAlerts();
msg.success(t('admin.equipmentAcceptance.scanDone', {
created: result.created,
updated: result.updated,
cancelled: result.cancelled,
}));
} else {
const result = await sendEquipmentAcceptanceAlerts();
msg.success(t('admin.equipmentAcceptance.sendDone', {
sent: result.sent,
failed: result.failed,
}));
}
await sendsPage.value?.reload();
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.syncFailed'));
} finally {
alertRunning.value = false;
}
}
/**
* 管理员从 E10 同步后刷新列表。
* 核心逻辑:成功提示写入、跳过和本次未见条数。失败展示业务错误。
*/
async function runSync(): Promise<void> {
if (syncing.value) return;
syncing.value = true;
try {
const result = await syncEquipmentAcceptance();
msg.success(t('admin.equipmentAcceptance.syncDone', {
upserted: result.upserted,
skipped: result.skipped_without_request_id,
absent: result.absent,
}));
await listPage.value?.reload();
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.syncFailed'));
} finally {
syncing.value = false;
}
}
</script>
<template>
<section class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[var(--surface-muted,#f4f7fb)]">
<div class="flex flex-wrap items-center justify-between gap-2 px-5 pt-3">
<div class="min-w-0">
<h1 class="text-lg font-bold text-primary md:text-xl">{{ t('admin.equipmentAcceptance.title') }}</h1>
</div>
<div v-if="isAdmin && activeView === 'sends'" class="flex flex-wrap items-center gap-2">
<button class="btn-secondary-ds" type="button" :disabled="alertRunning" @click="pendingAlert = 'scan'">
{{ t('admin.equipmentAcceptance.scanAlerts') }}
</button>
<button class="btn-secondary-ds" type="button" :disabled="alertRunning" @click="pendingAlert = 'send'">
{{ t('admin.equipmentAcceptance.sendAlerts') }}
</button>
</div>
<button
v-if="isAdmin && activeView === 'ledger' && !detailId"
class="btn-secondary-ds"
type="button"
:disabled="syncing"
@click="runSync"
>
<RefreshCw class="h-4 w-4" aria-hidden="true" />{{ t('admin.equipmentAcceptance.sync') }}
</button>
</div>
<div class="mt-2 flex gap-0 border-b border-default px-5">
<button
v-for="tab in tabs"
:key="tab.key"
type="button"
class="mb-[-1px] border-b-2 px-3 py-2 text-sm font-bold"
:class="activeView === tab.key
? 'border-brand-500 text-brand-600'
: 'border-transparent text-muted hover:text-secondary'"
@click="selectView(tab.key)"
>
{{ tab.label }}
</button>
</div>
<EquipmentAcceptanceDetailPage
v-if="detailId"
:order-id="detailId"
@back="syncQuery('ledger', null)"
/>
<EquipmentAcceptanceConfigPage
v-else-if="activeView === 'config'"
:editable="isAdmin"
/>
<EquipmentAcceptanceSendsPage v-else-if="activeView === 'sends'" ref="sendsPage" />
<EquipmentAcceptancePage
v-else
ref="listPage"
@open-detail="syncQuery('ledger', $event)"
/>
<DeleteConfirmDialog
v-if="isAdmin"
v-model="showAlertConfirm"
:title="alertConfirmCopy.title"
:message="alertConfirmCopy.message"
confirm-tone="primary"
@confirm="confirmAlertAction"
/>
</section>
</template>
@@ -0,0 +1,272 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceConfigPage.vue
用途:设备验收预警配置页。编辑四档天数,并为三个固定岗位选择系统用户。
依赖:equipment-acceptance.api、UserPickerDialog、userPicker.utils、vue-i18n。
逻辑:由 Chat 作业面的「预警配置」Tab 嵌入。姓名只用于展示。
发送时刻不在本页,由排程 Cron 配置。非管理员只能查看。
-->
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import UserPickerDialog from '@/shared/components/UserPickerDialog.vue';
import { useMessage } from '@/shared/composables/useMessage';
import { userPickerLabel } from '@/shared/utils/userPicker.utils';
import type { UserPickerPerson } from '@/shared/types/userPicker.types';
import {
getEquipmentAcceptanceConfig,
saveEquipmentAcceptanceConfig,
} from '../api/equipment-acceptance.api';
const props = defineProps<{
editable: boolean;
}>();
type RoleKey = 'buyer_manager' | 'coo' | 'executive';
const ROLE_FIELDS: RoleKey[] = ['buyer_manager', 'coo', 'executive'];
const TIER_WHO = ['tierWho1', 'tierWho2', 'tierWho3', 'tierWho4'] as const;
const { t } = useI18n();
const msg = useMessage();
const loading = ref(false);
const saving = ref(false);
const days = ref<number[]>([30, 37, 44, 51]);
const roleIds = ref<Record<RoleKey, number | null>>({
buyer_manager: null,
coo: null,
executive: null,
});
const candidates = ref<UserPickerPerson[]>([]);
const knownUsers = ref<UserPickerPerson[]>([]);
const pickerOpen = ref(false);
const pickerRole = ref<RoleKey | null>(null);
const people = computed(() => {
const map = new Map<number, UserPickerPerson>();
for (const user of candidates.value) map.set(user.id, user);
for (const user of knownUsers.value) map.set(user.id, user);
return map;
});
const pickerSelectedIds = computed(() => {
const id = pickerRole.value ? roleIds.value[pickerRole.value] : null;
return id ? [id] : [];
});
const ruleRows = computed(() => ([
{ to: 'ruleTo1', cc: 'ruleCc1' },
{ to: 'ruleTo2', cc: 'ruleCc2' },
{ to: 'ruleTo3', cc: 'ruleCc3' },
{ to: 'ruleTo4', cc: 'ruleCc4' },
]));
/**
* 读取当前配置。管理员响应里包含候选人。
* 核心逻辑:失败时保留页面上的默认天数,并用统一错误提示。
*/
async function load(): Promise<void> {
loading.value = true;
try {
const result = await getEquipmentAcceptanceConfig();
days.value = result.days?.length === 4 ? [...result.days] : [30, 37, 44, 51];
roleIds.value = {
buyer_manager: result.buyer_manager_user_id ?? null,
coo: result.coo_user_id ?? null,
executive: result.executive_user_id ?? null,
};
candidates.value = result.users || [];
knownUsers.value = result.selected_users || [];
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.configLoadFailed'));
} finally {
loading.value = false;
}
}
/**
* 打开某个岗位的选人弹窗。每个岗位只保留最后选中的一人。
* @param role - buyer_manager、coo、executive
*/
function openPicker(role: RoleKey): void {
if (!props.editable) return;
pickerRole.value = role;
pickerOpen.value = true;
}
/**
* 把弹窗结果写回当前岗位。选了多人时只留最后一人。
* @param ids - 弹窗确定时的用户主键
*/
function applyPicker(ids: number[]): void {
const role = pickerRole.value;
if (!role) return;
roleIds.value[role] = ids[ids.length - 1] ?? null;
pickerRole.value = null;
}
/**
* 清空一个岗位,保存后表示该岗位未配置。
* @param role - 岗位键
*/
function clearRole(role: RoleKey): void {
roleIds.value[role] = null;
}
/**
* 保存天数和三个岗位。天数须逐档增大。
* 核心逻辑:先在页面拦住空值和倒序,服务端再校验用户是否存在。
*/
async function save(): Promise<void> {
if (!props.editable || saving.value) return;
const nextDays = days.value.map((day) => Number(day));
const [first, second, third, fourth] = nextDays;
const increases = first !== undefined && second !== undefined && third !== undefined && fourth !== undefined
&& first < second && second < third && third < fourth;
if (nextDays.some((day) => !Number.isInteger(day) || day < 1) || !increases) {
msg.error(t('admin.equipmentAcceptance.configDaysInvalid'));
return;
}
saving.value = true;
try {
const result = await saveEquipmentAcceptanceConfig({
days: nextDays,
buyerManagerUserId: roleIds.value.buyer_manager,
cooUserId: roleIds.value.coo,
executiveUserId: roleIds.value.executive,
});
days.value = [...result.days];
knownUsers.value = result.selected_users || [];
candidates.value = result.users || [];
msg.success(t('admin.equipmentAcceptance.configSaved'));
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.configSaveFailed'));
} finally {
saving.value = false;
}
}
/**
* 岗位上已选用户的展示名。没有选择时返回空串,模板改显示未选择。
* @param role - 岗位键
* @returns 姓名,有工号时附在后面
*/
function roleLabel(role: RoleKey): string {
const id = roleIds.value[role];
if (!id) return '';
return userPickerLabel(people.value.get(id), id);
}
onMounted(() => {
void load();
});
</script>
<template>
<section class="min-h-0 flex-1 overflow-auto px-5 pb-6 pt-3">
<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>
</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>
</template>
<UserPickerDialog
v-model="pickerOpen"
:users="candidates"
:selected-ids="pickerSelectedIds"
:title="t('admin.equipmentAcceptance.selectUser')"
:subtitle="t('admin.equipmentAcceptance.configPickOne')"
@confirm="applyPicker"
/>
</section>
</template>
@@ -0,0 +1,314 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceDetailPage.vue
用途:一张验收单的详情卡片,展示状态徽章、停留进度、当前节点和操作人。
依赖:equipment-acceptance.api、vue-i18n、统一消息提示。
逻辑:由 Chat 作业面在选中某行后展示。操作人只显示姓名和工号。
进度条只按签核天数画到 30/37/44/51,不表示已经发送。
-->
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import { useMessage } from '@/shared/composables/useMessage';
import {
getEquipmentAcceptanceOrder,
type EquipmentAcceptanceOrder,
} from '../api/equipment-acceptance.api';
const props = defineProps<{
orderId: number;
}>();
const emit = defineEmits<{
back: [];
}>();
type BadgeTone = 'red' | 'green' | 'gray';
const STOPPED_STATUSES = new Set([
'stopped_returned',
'stopped_cannot_accept',
'stopped_archived',
'stopped_force_finished',
'stopped_voided',
'stopped_revoked',
]);
const FLOW_STATUS_KEYS: Record<number, string> = {
0: 'draft',
1: 'approving',
3: 'archived',
4: 'forceFinished',
5: 'voided',
6: 'pendingSubmit',
7: 'withdrawn',
8: 'withdrawn',
99: 'withdrawn',
[-99]: 'withdrawn',
};
const REMINDER_DAYS = [30, 37, 44, 51];
const { t } = useI18n();
const msg = useMessage();
const loading = ref(false);
const order = ref<EquipmentAcceptanceOrder | null>(null);
/**
* 读取当前验收单详情。
* 核心逻辑:orderId 变化时重新请求。失败清空详情,避免上一张单残留。
*/
async function load(): Promise<void> {
loading.value = true;
try {
order.value = await getEquipmentAcceptanceOrder(props.orderId);
} catch (error) {
order.value = null;
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.detailLoadFailed'));
} finally {
loading.value = false;
}
}
/**
* 只取日期部分。没有值时显示横线。
* @param value - 接口时间字符串
* @returns 日期文本
*/
function dateText(value?: string | null): string {
if (!value) return '—';
return value.slice(0, 10);
}
/**
* 把 0/1 写成否/是。可以验收为空时显示未标明,退回在同步时已把空收成否。
* @param value - 标准 0 否、1 是
* @param emptyLabel - 空值文案
* @returns 展示文案
*/
function yesNo(value: number | null | undefined, emptyLabel: string): string {
if (value === 1) return t('common.yes');
if (value === 0) return t('common.no');
return emptyLabel;
}
/**
* 把流程状态原值写成名称。7、8、99、-99 都显示为撤销,字典没有的数字仍显示原值。
* @param value - flowstatus
* @returns 流程状态文案
*/
function flowText(value?: number | null): string {
if (value === undefined || value === null) return '—';
const key = FLOW_STATUS_KEYS[value];
return key ? t(`admin.equipmentAcceptance.flowStatusName.${key}`) : String(value);
}
/**
* 未开始或没有天数时显示横线,其余显示「N 天」。
* @param item - 当前验收单
* @returns 签核天数文案
*/
function dwellText(item: EquipmentAcceptanceOrder): string {
if (item.monitor_status === 'not_started' || item.dwell_days == null) return '—';
return t('admin.equipmentAcceptance.daysValue', { days: item.dwell_days });
}
/**
* 当前节点名称。没有节点时为空,模板改显示横线。
* @param item - 当前验收单
* @returns 节点名称列表
*/
function nodeNames(item: EquipmentAcceptanceOrder): string[] {
return (item.nodes || []).map((node) => node.node_name).filter((name): name is string => Boolean(name));
}
/**
* 当前处理人去重后拼成一行。
* @param item - 当前验收单
* @returns 处理人姓名
*/
function handlerNames(item: EquipmentAcceptanceOrder): string {
const names = Array.from(new Set(
(item.operators || []).map((person) => person.handler_name).filter((name): name is string => Boolean(name)),
));
return names.length ? names.join('、') : '—';
}
/**
* 与列表相同的徽章颜色。红是已逾期,绿是不再提醒,灰是未开始和未超时。
* @param item - 当前验收单
* @returns 文案和颜色
*/
function statusBadge(item: EquipmentAcceptanceOrder): { label: string; tone: BadgeTone } {
if (item.monitor_status === 'watching' && item.overdue) {
return { label: t('admin.equipmentAcceptance.badgeOverdue'), tone: 'red' };
}
if (item.monitor_status === 'watching') {
return { label: t('admin.equipmentAcceptance.badgeOnTime'), tone: 'gray' };
}
return {
label: t(`admin.equipmentAcceptance.statusLabel.${item.monitor_status}`),
tone: STOPPED_STATUSES.has(item.monitor_status) ? 'green' : 'gray',
};
}
/**
* 徽章底色。
* @param tone - 徽章颜色
* @returns Tailwind 类名
*/
function badgeClass(tone: BadgeTone): string {
if (tone === 'red') return 'bg-[#fff0ef] text-[#b42318]';
if (tone === 'green') return 'bg-[#eafaf1] text-[#067647]';
return 'bg-[#edf1f6] text-[#475569]';
}
/**
* 按签核天数在 0 到第 4 档之间画进度。没有天数时不画。
* 核心逻辑:刻度至少到 60 天,避免 51 天贴在条的尽头。
*/
const track = computed(() => {
const days = order.value?.dwell_days;
if (order.value?.monitor_status === 'not_started' || days == null) return null;
const lastMark = REMINDER_DAYS[REMINDER_DAYS.length - 1] ?? 51;
const scale = Math.max(60, lastMark + 9, days);
return {
width: `${Math.min(100, Math.round((days / scale) * 100))}%`,
marks: [0, ...REMINDER_DAYS, scale].map((day) => ({
day,
left: `${(day / scale) * 100}%`,
label: day === scale ? t('admin.equipmentAcceptance.daysValue', { days: scale }) : String(day),
})),
};
});
onMounted(() => {
void load();
});
watch(() => props.orderId, () => {
void load();
});
</script>
<template>
<section class="min-h-0 flex-1 overflow-auto px-5 pb-6 pt-3">
<button
class="mb-3 rounded-lg border border-[#dce4ef] bg-white px-3 py-1.5 text-xs font-bold text-[#142033]"
type="button"
@click="emit('back')"
>
{{ t('admin.equipmentAcceptance.back') }}
</button>
<p v-if="loading && !order" class="text-sm text-[#64748b]">{{ t('admin.equipmentAcceptance.loading') }}</p>
<article v-else-if="order" class="overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
<div class="flex items-start justify-between gap-3 px-4 pt-4">
<h2 class="text-lg font-bold text-[#142033]">{{ order.acceptance_no || '—' }}</h2>
<span
class="inline-flex shrink-0 rounded-full px-2 py-0.5 text-[11px] font-extrabold"
:class="badgeClass(statusBadge(order).tone)"
>
{{ statusBadge(order).label }}
</span>
</div>
<div v-if="track" class="px-7 pt-5">
<div class="h-2 overflow-hidden rounded-full bg-[#e7edf5]">
<i class="block h-full rounded-full bg-gradient-to-r from-[#93c5fd] to-[#2563eb]" :style="{ width: track.width }"></i>
</div>
<div class="relative mt-1 h-4 text-[11px] text-[#64748b]">
<span
v-for="mark in track.marks"
:key="mark.day"
class="absolute -translate-x-1/2 whitespace-nowrap"
:style="{ left: mark.left }"
>
{{ mark.label }}
</span>
</div>
</div>
<div class="flex flex-wrap gap-1.5 px-4 pb-1 pt-4">
<span
v-for="(name, index) in nodeNames(order)"
:key="`${name}-${index}`"
class="rounded-full bg-[#dbeafe] px-2 py-1 text-[11px] font-extrabold text-[#1d4ed8]"
>
{{ name }}
</span>
<span v-if="!nodeNames(order).length" class="text-sm text-[#64748b]">—</span>
</div>
<dl class="mt-3 grid border-t border-[#dce4ef] px-4 sm:grid-cols-2">
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</dt>
<dd class="text-[#142033]">{{ order.purchase_order_no || '—' }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.applicant') }}</dt>
<dd class="text-[#142033]">{{ order.applicant_name || '—' }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.dwellDays') }}</dt>
<dd class="text-[#142033]">{{ dwellText(order) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.timerStart') }}</dt>
<dd class="text-[#142033]">{{ dateText(order.timer_started_at) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:col-span-2">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.currentHandlers') }}</dt>
<dd class="text-[#142033]">{{ handlerNames(order) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.canAccept') }}</dt>
<dd class="text-[#142033]">{{ yesNo(order.can_accept, t('admin.equipmentAcceptance.unspecified')) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:col-span-2">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.cannotAcceptNote') }}</dt>
<dd class="whitespace-pre-wrap text-[#142033]">{{ order.cannot_accept_note || '—' }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.returnFlag') }}</dt>
<dd class="text-[#142033]">{{ yesNo(order.is_returned, t('common.no')) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.flowStatus') }}</dt>
<dd class="text-[#142033]">{{ flowText(order.flow_status_raw) }}</dd>
</div>
<div class="grid grid-cols-[108px_minmax(0,1fr)] gap-2 border-b border-[#dce4ef] py-2.5 text-xs sm:pl-4">
<dt class="font-bold text-[#64748b]">{{ t('admin.equipmentAcceptance.finishedAt') }}</dt>
<dd class="text-[#142033]">{{ dateText(order.finished_at) }}</dd>
</div>
</dl>
<div class="px-4 pb-4 pt-4">
<h3 class="text-sm font-bold text-[#142033]">{{ t('admin.equipmentAcceptance.operators') }}</h3>
<p class="mt-1 text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.operatorsNote') }}</p>
<div class="mt-3 overflow-auto rounded-xl border border-[#dce4ef]">
<table class="w-full min-w-[640px] 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.operatorName') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.jobNum') }}</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in order.operators"
:key="`${item.user_id}-${item.node_id}-${index}`"
class="border-t border-[#dce4ef]"
>
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.handler_name || '—' }}</td>
<td class="px-3 py-2.5">{{ item.handler_job_num || '—' }}</td>
</tr>
<tr v-if="!order.operators.length">
<td colspan="2" class="px-3 py-6 text-center text-[#64748b]">—</td>
</tr>
</tbody>
</table>
</div>
</div>
</article>
</section>
</template>
@@ -0,0 +1,264 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptancePage.vue
用途:设备验收预警停留列表,对齐原型的汇总卡、分组筛选和状态徽章。
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n。
逻辑:由 Chat 作业面嵌入。点「查看详情」交给父级下钻。
已逾期只看接口给出的 overdue。发送结果在「发送记录」页,这里不显示第几档。
-->
<script setup lang="ts">
import { onMounted, ref } from 'vue';
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 {
listEquipmentAcceptanceOrders,
type EquipmentAcceptanceOrder,
type EquipmentAcceptanceSummary,
} from '../api/equipment-acceptance.api';
const emit = defineEmits<{
'open-detail': [orderId: number];
}>();
type FocusKey = 'all' | 'watching' | 'overdue' | 'stopped' | 'not_started';
type BadgeTone = 'red' | 'green' | 'gray';
const STOPPED_STATUSES = new Set([
'stopped_returned',
'stopped_cannot_accept',
'stopped_archived',
'stopped_force_finished',
'stopped_voided',
'stopped_revoked',
]);
const filters: Array<{ key: FocusKey; label: string }> = [
{ key: 'all', label: 'filterAll' },
{ key: 'watching', label: 'filterWatching' },
{ key: 'overdue', label: 'filterOverdue' },
{ key: 'stopped', label: 'filterStopped' },
{ key: 'not_started', label: 'filterNotStarted' },
];
const { t } = useI18n();
const msg = useMessage();
const loading = ref(false);
const orders = ref<EquipmentAcceptanceOrder[]>([]);
const focus = ref<FocusKey>('all');
const page = ref(1);
const pageSize = ref(20);
const total = ref(0);
const pages = ref(1);
const summary = ref<EquipmentAcceptanceSummary>({
watching: 0,
overdue: 0,
stopped: 0,
not_started: 0,
});
/**
* 加载当前分组的验收单,并刷新全部单据的汇总数字。
* 核心逻辑:汇总不受当前筛选影响,由接口的 summary 给出。
* @param resetPage - 为 true 时回到第一页,用于更换筛选。
*/
async function load(resetPage = false): Promise<void> {
if (resetPage) page.value = 1;
loading.value = true;
try {
const result = await listEquipmentAcceptanceOrders({
focus: focus.value,
page: page.value,
pageSize: pageSize.value,
});
orders.value = result.items || [];
total.value = result.total || 0;
pages.value = result.pages || 1;
if (result.summary) summary.value = result.summary;
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.loadFailed'));
} finally {
loading.value = false;
}
}
/**
* 切换原型分组并回到第一页。
* @param next - all、watching、overdue、stopped、not_started
*/
function selectFocus(next: FocusKey): void {
if (focus.value === next) return;
focus.value = next;
void load(true);
}
/**
* 把节点名称拼成一格。没有节点时显示横线。
* @param order - 列表行
* @returns 节点名称
*/
function nodeNames(order: EquipmentAcceptanceOrder): string {
const names = (order.nodes || []).map((node) => node.node_name).filter((name): name is string => Boolean(name));
return names.length ? names.join('、') : '—';
}
/**
* 把当前处理人姓名去重后拼成一格。这些人不一定是未办。
* @param order - 列表行
* @returns 处理人姓名
*/
function handlerNames(order: EquipmentAcceptanceOrder): string {
const names = Array.from(new Set(
(order.operators || []).map((item) => item.handler_name).filter((name): name is string => Boolean(name)),
));
return names.length ? names.join('、') : '—';
}
/**
* 只取日期部分展示计时起点。
* @param value - 接口返回的时间字符串
* @returns 日期或横线
*/
function dateText(value?: string | null): string {
if (!value) return '—';
return value.slice(0, 10);
}
/**
* 未开始或没有天数时显示横线,其余显示「N 天」。
* @param order - 列表行
* @returns 签核天数文案
*/
function dwellText(order: EquipmentAcceptanceOrder): string {
if (order.monitor_status === 'not_started' || order.dwell_days == null) return '—';
return t('admin.equipmentAcceptance.daysValue', { days: order.dwell_days });
}
/**
* 按监控状态收成徽章。已逾期用红色,表示还要提醒。不再提醒用绿色,未开始和未超时用灰色。
* @param order - 列表行
* @returns 文案和颜色
*/
function statusBadge(order: EquipmentAcceptanceOrder): { label: string; tone: BadgeTone } {
if (order.monitor_status === 'watching' && order.overdue) {
return { label: t('admin.equipmentAcceptance.badgeOverdue'), tone: 'red' };
}
if (order.monitor_status === 'watching') {
return { label: t('admin.equipmentAcceptance.badgeOnTime'), tone: 'gray' };
}
return {
label: t(`admin.equipmentAcceptance.statusLabel.${order.monitor_status}`),
tone: STOPPED_STATUSES.has(order.monitor_status) ? 'green' : 'gray',
};
}
/**
* 徽章底色。红是已逾期,绿是不再提醒,灰是未超时、未开始和不在监控范围。
* @param tone - 徽章颜色
* @returns Tailwind 类名
*/
function badgeClass(tone: BadgeTone): string {
if (tone === 'red') return 'bg-[#fff0ef] text-[#b42318]';
if (tone === 'green') return 'bg-[#eafaf1] text-[#067647]';
return 'bg-[#edf1f6] text-[#475569]';
}
defineExpose({ reload: () => load(false) });
onMounted(() => {
void load();
});
</script>
<template>
<section class="flex min-h-0 flex-1 flex-col gap-3 px-5 pb-4 pt-3">
<div class="grid grid-cols-4 gap-3">
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.watching }}</b>
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiWatching') }}</span>
</article>
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.overdue }}</b>
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiOverdue') }}</span>
</article>
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.stopped }}</b>
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.kpiStopped') }}</span>
</article>
<article class="rounded-xl border border-[#dce4ef] bg-white px-4 py-3.5">
<b class="block text-[26px] font-bold leading-none text-[#142033]">{{ summary.not_started }}</b>
<span class="mt-1 block text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.filterNotStarted') }}</span>
</article>
</div>
<div class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
<div class="flex flex-wrap gap-2 p-3">
<button
v-for="item in filters"
:key="item.key"
type="button"
class="rounded-full border px-2.5 py-1 text-xs font-bold"
:class="focus === item.key
? 'border-[#bfdbfe] bg-[#eaf2ff] text-[#1d4ed8]'
: 'border-[#dce4ef] bg-white text-[#475569]'"
@click="selectFocus(item.key)"
>
{{ t(`admin.equipmentAcceptance.${item.label}`) }}
</button>
</div>
<div class="min-h-0 flex-1 overflow-auto">
<table class="min-w-[960px] w-full border-collapse text-left text-xs">
<thead class="sticky top-0 bg-[#f8fbff] text-[#64748b]">
<tr>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.acceptanceNo') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.applicant') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.currentNodes') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.currentHandlers') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.timerStart') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.dwellDays') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.status') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.actions') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="item in orders" :key="item.id" class="border-b border-[#dce4ef] hover:bg-[#f3f7ff]">
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.acceptance_no || '—' }}</td>
<td class="px-3 py-2.5">{{ item.purchase_order_no || '—' }}</td>
<td class="px-3 py-2.5">{{ item.applicant_name || '—' }}</td>
<td class="px-3 py-2.5">{{ nodeNames(item) }}</td>
<td class="px-3 py-2.5">{{ handlerNames(item) }}</td>
<td class="px-3 py-2.5">{{ dateText(item.timer_started_at) }}</td>
<td class="px-3 py-2.5">{{ dwellText(item) }}</td>
<td class="px-3 py-2.5">
<span
class="inline-flex rounded-full px-2 py-0.5 text-[11px] font-extrabold"
:class="badgeClass(statusBadge(item).tone)"
>
{{ statusBadge(item).label }}
</span>
</td>
<td class="px-3 py-2.5">
<button class="font-extrabold text-[#175cd3]" type="button" @click="emit('open-detail', item.id)">
{{ t('admin.equipmentAcceptance.detail') }}
</button>
</td>
</tr>
<tr v-if="!loading && !orders.length">
<td colspan="9" class="px-3 py-9 text-center text-[#64748b]">{{ t('admin.equipmentAcceptance.empty') }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<PaginationBar
class="shrink-0"
v-model:page="page"
v-model:page-size="pageSize"
:total="total"
:pages="pages"
@update:page="() => load()"
@update:page-size="() => load()"
/>
</section>
</template>
@@ -0,0 +1,137 @@
<!--
features/equipment-acceptance/views/EquipmentAcceptanceSendsPage.vue
用途:设备验收预警发送记录页,列出每张验收单某一档的主送、抄送和结果。
依赖:equipment-acceptance.api、PaginationBar、统一消息提示、vue-i18n。
逻辑:由 Chat 作业面的「发送记录」Tab 嵌入。只读已落库记录。扫描尚未写入时显示空状态。
-->
<script setup lang="ts">
import { onMounted, ref } from 'vue';
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 {
listEquipmentAcceptanceSends,
type EquipmentAcceptanceSendRecord,
} from '../api/equipment-acceptance.api';
const { t, te } = useI18n();
const msg = useMessage();
const records = ref<EquipmentAcceptanceSendRecord[]>([]);
const loading = ref(false);
const page = ref(1);
const pageSize = ref(20);
const total = ref(0);
const pages = ref(1);
/**
* 拉取当前页发送记录。
* 核心逻辑:失败时清空表格并提示。空列表留给模板显示「还没有发送记录」。
*/
async function load(): Promise<void> {
loading.value = true;
try {
const result = await listEquipmentAcceptanceSends({ page: page.value, pageSize: pageSize.value });
records.value = result.items || [];
total.value = result.total || 0;
pages.value = Math.max(1, Math.ceil(total.value / pageSize.value));
} catch (error) {
records.value = [];
total.value = 0;
pages.value = 1;
msg.error(error instanceof BusinessError ? error.message : t('admin.equipmentAcceptance.sendsFailed'));
} finally {
loading.value = false;
}
}
/**
* 轮次列写成「超过 N 天」。
* @param item - 一条发送记录
* @returns 轮次文案
*/
function tierText(item: EquipmentAcceptanceSendRecord): string {
return t('admin.equipmentAcceptance.ruleOver', { days: item.threshold_days });
}
/**
* 结果用已知状态文案。未知状态保留原值。
* @param status - pending、sent、failed、cancelled
* @returns 结果文案
*/
function statusText(status: string): string {
const key = `admin.equipmentAcceptance.sendStatus.${status}`;
return te(key) ? t(key) : status;
}
/**
* 已发送显示本地时间,待发送没有时间时显示横线。
* @param value - 接口返回的发送时间
* @returns 时间或横线
*/
function sentText(value?: string | null): string {
if (!value) return '—';
const text = formatLocalDateTime(value);
return text === '-' ? '—' : text;
}
onMounted(() => {
void load();
});
defineExpose({ reload: load });
</script>
<template>
<section class="flex min-h-0 flex-1 flex-col gap-3 px-5 pb-4 pt-3">
<p class="text-xs text-[#64748b]">{{ t('admin.equipmentAcceptance.sendsLead') }}</p>
<div class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-[#dce4ef] bg-white">
<div class="min-h-0 flex-1 overflow-auto">
<table class="min-w-[960px] w-full border-collapse text-left text-xs">
<thead class="sticky top-0 bg-[#f8fbff] text-[#64748b]">
<tr>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.acceptanceNo') }}</th>
<th class="px-3 py-2.5 font-bold">{{ t('admin.equipmentAcceptance.purchaseOrderNo') }}</th>
<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>
<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.sentAt') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="item in records" :key="item.id" class="border-b border-[#dce4ef]">
<td class="px-3 py-2.5 font-bold text-[#142033]">{{ item.acceptance_no || '—' }}</td>
<td class="px-3 py-2.5">{{ item.purchase_order_no || '—' }}</td>
<td class="px-3 py-2.5">{{ tierText(item) }}</td>
<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>
</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]">
{{ t('admin.equipmentAcceptance.sendsEmpty') }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<PaginationBar
class="shrink-0"
v-model:page="page"
v-model:page-size="pageSize"
:total="total"
:pages="pages"
@update:page="() => load()"
@update:page-size="() => load()"
/>
</section>
</template>
+126
View File
@@ -5731,5 +5731,131 @@
"prevPage": "Previous page",
"nextPage": "Next page"
}
},
"equipmentAcceptance": {
"title": "Equipment acceptance warning",
"sync": "Sync OA data",
"syncDone": "Synced {upserted}, skipped {skipped}, missing this time {absent}",
"syncFailed": "Failed to sync equipment acceptance data",
"tabLedger": "Waiting orders",
"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.",
"sendsEmpty": "No send records yet",
"sendsFailed": "Failed to load send records",
"scanAlerts": "Scan alerts",
"sendAlerts": "Send alerts",
"scanConfirm": "This syncs from E10 and creates records waiting to be sent.",
"sendConfirm": "This sends the waiting records to WeCom, one message per recipient.",
"scanDone": "Added {created}, updated {updated}, cancelled {cancelled}",
"sendDone": "Sent to {sent} people, {failed} failed",
"sendResult": "Result",
"sentAt": "Sent at",
"sendStatus": {
"pending": "Waiting to send",
"sent": "Sent",
"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.",
"tier1": "Tier 1",
"tier2": "Tier 2",
"tier3": "Tier 3",
"tier4": "Tier 4",
"tierWho1": "Current handler",
"tierWho2": "Deputy manager",
"tierWho3": "COO",
"tierWho4": "General manager",
"dayUnit": "days",
"fixedRoles": "Fixed roles",
"role": {
"buyer_manager": "Procurement deputy manager",
"coo": "COO",
"executive": "General manager"
},
"roleEmpty": "Not selected",
"selectUser": "Select",
"clearUser": "Clear",
"configPickOne": "Each role keeps one person. The name is for display; the saved value is the system user.",
"rulesTitle": "Recipient rules",
"rulesLead": "Who receives each tier stays fixed. Only the day thresholds change.",
"ruleTier": "Round",
"ruleTo": "To",
"ruleCc": "Cc",
"ruleOver": "Over {days} days",
"ruleTo1": "Current handler",
"ruleCc1": "Their supervisor and the applicant",
"ruleTo2": "The handler's deputy manager",
"ruleCc2": "COO and procurement deputy manager",
"ruleTo3": "COO",
"ruleCc3": "Procurement deputy manager",
"ruleTo4": "General manager",
"ruleCc4": "COO and procurement deputy manager",
"saveConfig": "Save settings",
"configSaveHint": "Sent alerts stay unchanged",
"configSaved": "Alert settings saved",
"configLoadFailed": "Failed to load alert settings",
"configSaveFailed": "Failed to save alert settings",
"configDaysInvalid": "Each tier must be longer than the previous one",
"configReadOnly": "Only an administrator can change these settings",
"loadFailed": "Failed to load acceptance orders",
"detailLoadFailed": "Failed to load the acceptance order",
"loading": "Loading",
"empty": "No acceptance orders have been synced yet",
"kpiWatching": "In progress",
"kpiOverdue": "Overdue",
"kpiStopped": "No further reminders",
"filterAll": "All",
"filterWatching": "In progress",
"filterOverdue": "Overdue",
"filterStopped": "No further reminders",
"filterNotStarted": "Not started",
"badgeOverdue": "Overdue",
"badgeOnTime": "Not yet due",
"currentHandlers": "Current handlers",
"daysValue": "{days} days",
"statusAll": "All statuses",
"status": "Status",
"acceptanceNo": "Acceptance no.",
"purchaseOrderNo": "Purchase order no.",
"applicant": "Applicant",
"currentNodes": "Current nodes",
"operators": "Operators",
"operatorsNote": "Operators on the current node. Each person is listed once.",
"timerStart": "Timer start",
"dwellDays": "Days in approval",
"actions": "Actions",
"detail": "View details",
"back": "Back to dwell list",
"canAccept": "Can accept",
"cannotAcceptNote": "Reason it cannot be accepted",
"cannotAcceptNote": "Reason it cannot be accepted",
"returnFlag": "Returned",
"unspecified": "Not specified",
"flowStatus": "Flow status",
"finishedAt": "Finished at",
"operatorName": "Name",
"jobNum": "Employee no.",
"flowStatusName": {
"draft": "Draft",
"approving": "Approving",
"archived": "Archived",
"forceFinished": "Force-finished",
"voided": "Voided",
"pendingSubmit": "Pending submit",
"paused": "Paused",
"withdrawn": "Withdrawn"
},
"statusLabel": {
"watching": "In progress",
"not_started": "Not started",
"stopped_returned": "Returned, no further reminders",
"stopped_cannot_accept": "Cannot accept, no further reminders",
"stopped_archived": "Archived, no further reminders",
"stopped_force_finished": "Force-finished, no further reminders",
"stopped_voided": "Voided, no further reminders",
"stopped_revoked": "Revoked, no further reminders",
"excluded": "Outside monitoring"
}
}
}
+7
View File
@@ -564,6 +564,13 @@
"VOUCHER_CHECK_PO_UPLOAD_FAILED": "Failed to upload the purchase-order PDF to the DMS PO-order folder.",
"VOUCHER_CHECK_OA_E10_TOKEN_FAILED": "E10 OpenAPI authorization or token refresh failed.",
"VOUCHER_CHECK_OA_E10_SQL_FAILED": "Failed to query the E10 sales-release table.",
"EQUIPMENT_ACCEPTANCE_CONFIG_INVALID": "E10 database settings for equipment-acceptance sync are incomplete.",
"EQUIPMENT_ACCEPTANCE_OA_SQL_FAILED": "Failed to query E10 equipment-acceptance data.",
"EQUIPMENT_ACCEPTANCE_NOT_FOUND": "The equipment-acceptance sync record does not exist.",
"EQUIPMENT_ACCEPTANCE_FORBIDDEN": "You do not have access to the equipment acceptance warning.",
"EQUIPMENT_ACCEPTANCE_ADMIN_REQUIRED": "Only an administrator can sync equipment acceptance data.",
"EQUIPMENT_ACCEPTANCE_SETTINGS_INVALID": "Each tier must be longer than the previous one, and each role must be an existing system user.",
"EQUIPMENT_ACCEPTANCE_SETTINGS_ADMIN_REQUIRED": "Only an administrator can change equipment acceptance alert settings.",
"VOUCHER_CHECK_OA_E10_DOWNLOAD_FAILED": "Failed to download the sales-release PDF from E10.",
"VOUCHER_CHECK_OA_SALES_RELEASE_INVALID": "Sales-release data is invalid. Provide a valid invoice number and delivery number.",
"VOUCHER_CHECK_OA_SALES_RELEASE_PARTIAL": "Some sales-release PDFs failed to fetch.",
+126
View File
@@ -5731,5 +5731,131 @@
"prevPage": "หน้าก่อนหน้า",
"nextPage": "หน้าถัดไป"
}
},
"equipmentAcceptance": {
"title": "การเตือนตรวจรับอุปกรณ์",
"sync": "ซิงก์ข้อมูล OA",
"syncDone": "ซิงก์แล้ว {upserted} รายการ ข้าม {skipped} รายการ ไม่พบในรอบนี้ {absent} รายการ",
"syncFailed": "ซิงก์ข้อมูลตรวจรับอุปกรณ์ไม่สำเร็จ",
"tabLedger": "รายการค้าง",
"tabSends": "บันทึกการส่ง",
"tabConfig": "ตั้งค่าการเตือน",
"sendsLead": "การสแกนรายวันสร้างรายการที่รอส่ง หลังสรุปส่งทุกวันศุกร์ 18:00 ตามผู้รับแล้ว จะแสดงที่นี่ ชื่อคงตามตอนที่ส่ง",
"sendsEmpty": "ยังไม่มีบันทึกการส่ง",
"sendsFailed": "โหลดบันทึกการส่งไม่สำเร็จ",
"scanAlerts": "สแกนการเตือน",
"sendAlerts": "ส่งการเตือน",
"scanConfirm": "ระบบจะซิงก์จาก E10 และสร้างรายการที่รอส่ง",
"sendConfirm": "ระบบจะส่งรายการที่รอส่งไป WeCom คนละหนึ่งข้อความ",
"scanDone": "เพิ่ม {created} รายการ อัปเดต {updated} รายการ ยกเลิก {cancelled} รายการ",
"sendDone": "ส่งถึง {sent} คน ไม่สำเร็จ {failed} คน",
"sendResult": "ผลลัพธ์",
"sentAt": "เวลาที่ส่ง",
"sendStatus": {
"pending": "รอส่ง",
"sent": "ส่งแล้ว",
"failed": "ส่งไม่สำเร็จ",
"cancelled": "ยกเลิกแล้ว"
},
"configLead": "จำนวนวันแต่ละขั้นต้องมากขึ้นตามลำดับ การบันทึกมีผลเฉพาะการเตือนที่เกิดภายหลัง เวลาส่งตั้งในตารางงาน",
"tier1": "ขั้นที่ 1",
"tier2": "ขั้นที่ 2",
"tier3": "ขั้นที่ 3",
"tier4": "ขั้นที่ 4",
"tierWho1": "ผู้ดำเนินการปัจจุบัน",
"tierWho2": "รองผู้จัดการ",
"tierWho3": "COO",
"tierWho4": "ผู้จัดการทั่วไป",
"dayUnit": "วัน",
"fixedRoles": "ตำแหน่งคงที่",
"role": {
"buyer_manager": "รองผู้จัดการจัดซื้อ",
"coo": "COO",
"executive": "ผู้จัดการทั่วไป"
},
"roleEmpty": "ยังไม่ได้เลือก",
"selectUser": "เลือก",
"clearUser": "ล้าง",
"configPickOne": "แต่ละตำแหน่งเก็บไว้คนเดียว ชื่อใช้แสดงผล ค่าที่บันทึกคือผู้ใช้ระบบ",
"rulesTitle": "กฎผู้รับ",
"rulesLead": "ผู้รับแต่ละขั้นไม่เปลี่ยนตามจำนวนวัน เปลี่ยนได้เฉพาะเกณฑ์วัน",
"ruleTier": "รอบ",
"ruleTo": "ผู้รับหลัก",
"ruleCc": "สำเนา",
"ruleOver": "เกิน {days} วัน",
"ruleTo1": "ผู้ดำเนินการปัจจุบัน",
"ruleCc1": "หัวหน้าตรงและผู้ขอ",
"ruleTo2": "รองผู้จัดการของผู้ดำเนินการ",
"ruleCc2": "COO และรองผู้จัดการจัดซื้อ",
"ruleTo3": "COO",
"ruleCc3": "รองผู้จัดการจัดซื้อ",
"ruleTo4": "ผู้จัดการทั่วไป",
"ruleCc4": "COO และรองผู้จัดการจัดซื้อ",
"saveConfig": "บันทึกการตั้งค่า",
"configSaveHint": "รายการที่ส่งแล้วไม่เปลี่ยน",
"configSaved": "บันทึกการตั้งค่าแล้ว",
"configLoadFailed": "โหลดการตั้งค่าไม่สำเร็จ",
"configSaveFailed": "บันทึกการตั้งค่าไม่สำเร็จ",
"configDaysInvalid": "จำนวนวันแต่ละขั้นต้องมากขึ้นตามลำดับ",
"configReadOnly": "เฉพาะผู้ดูแลระบบที่แก้ไขการตั้งค่าได้",
"loadFailed": "โหลดรายการใบตรวจรับไม่สำเร็จ",
"detailLoadFailed": "โหลดรายละเอียดใบตรวจรับไม่สำเร็จ",
"loading": "กำลังโหลด",
"empty": "ยังไม่มีใบตรวจรับที่ซิงก์มา",
"kpiWatching": "กำลังดำเนินการ",
"kpiOverdue": "เกินกำหนด",
"kpiStopped": "ไม่แจ้งเตือนอีก",
"filterAll": "ทั้งหมด",
"filterWatching": "กำลังดำเนินการ",
"filterOverdue": "เกินกำหนด",
"filterStopped": "ไม่แจ้งเตือนอีก",
"filterNotStarted": "ยังไม่เริ่ม",
"badgeOverdue": "เกินกำหนด",
"badgeOnTime": "ยังไม่เกินกำหนด",
"currentHandlers": "ผู้ดำเนินการปัจจุบัน",
"daysValue": "{days} วัน",
"statusAll": "ทุกสถานะ",
"status": "สถานะ",
"acceptanceNo": "เลขที่ใบตรวจรับ",
"purchaseOrderNo": "เลขที่ใบสั่งซื้อ",
"applicant": "ผู้ขอ",
"currentNodes": "โหนดปัจจุบัน",
"operators": "ผู้ดำเนินการ",
"operatorsNote": "ผู้ดำเนินการบนโหนดปัจจุบัน แต่ละคนแสดงหนึ่งแถว",
"timerStart": "จุดเริ่มนับเวลา",
"dwellDays": "จำนวนวันอนุมัติ",
"actions": "การทำงาน",
"detail": "ดูรายละเอียด",
"back": "กลับไปรายการค้าง",
"canAccept": "ตรวจรับได้",
"cannotAcceptNote": "เหตุผลที่ตรวจรับไม่ได้",
"cannotAcceptNote": "คำอธิบายที่ตรวจรับไม่ได้",
"returnFlag": "ถูกส่งกลับ",
"unspecified": "ยังไม่ระบุ",
"flowStatus": "สถานะกระบวนการ",
"finishedAt": "เวลาสิ้นสุด",
"operatorName": "ชื่อ",
"jobNum": "รหัสพนักงาน",
"flowStatusName": {
"draft": "ร่าง",
"approving": "กำลังอนุมัติ",
"archived": "จัดเก็บแล้ว",
"forceFinished": "บังคับจบ",
"voided": "ยกเลิกเอกสารแล้ว",
"pendingSubmit": "รอส่ง",
"paused": "หยุดชั่วคราว",
"withdrawn": "ถอนกลับ"
},
"statusLabel": {
"watching": "กำลังดำเนินการ",
"not_started": "ยังไม่เริ่ม",
"stopped_returned": "ส่งกลับแล้ว ไม่แจ้งเตือนอีก",
"stopped_cannot_accept": "ตรวจรับไม่ได้ ไม่แจ้งเตือนอีก",
"stopped_archived": "จัดเก็บแล้ว ไม่แจ้งเตือนอีก",
"stopped_force_finished": "บังคับจบแล้ว ไม่แจ้งเตือนอีก",
"stopped_voided": "ยกเลิกแล้ว ไม่แจ้งเตือนอีก",
"stopped_revoked": "เพิกถอนแล้ว ไม่แจ้งเตือนอีก",
"excluded": "อยู่นอกขอบเขตติดตาม"
}
}
}
+7
View File
@@ -564,6 +564,13 @@
"VOUCHER_CHECK_PO_UPLOAD_FAILED": "อัปโหลดไฟล์ PDF ใบสั่งซื้อไปยังโฟลเดอร์ PO订单 ในคลังเอกสารไม่สำเร็จ",
"VOUCHER_CHECK_OA_E10_TOKEN_FAILED": "การอนุญาตหรือรีเฟรชโทเค็น E10 OpenAPI ล้มเหลว",
"VOUCHER_CHECK_OA_E10_SQL_FAILED": "ค้นตารางใบอนุญาตปล่อยสินค้าใน E10 ไม่สำเร็จ",
"EQUIPMENT_ACCEPTANCE_CONFIG_INVALID": "การตั้งค่าฐานข้อมูล E10 สำหรับซิงก์การตรวจรับอุปกรณ์ไม่ครบ",
"EQUIPMENT_ACCEPTANCE_OA_SQL_FAILED": "ค้นข้อมูลการตรวจรับอุปกรณ์ใน E10 ไม่สำเร็จ",
"EQUIPMENT_ACCEPTANCE_NOT_FOUND": "ไม่พบรายการซิงก์การตรวจรับอุปกรณ์",
"EQUIPMENT_ACCEPTANCE_FORBIDDEN": "คุณไม่มีสิทธิ์เข้าถึงการเตือนตรวจรับอุปกรณ์",
"EQUIPMENT_ACCEPTANCE_ADMIN_REQUIRED": "เฉพาะผู้ดูแลระบบเท่านั้นที่ซิงก์ข้อมูลตรวจรับอุปกรณ์ได้",
"EQUIPMENT_ACCEPTANCE_SETTINGS_INVALID": "จำนวนวันแต่ละขั้นต้องมากขึ้นตามลำดับ และตำแหน่งต้องเป็นผู้ใช้ระบบที่มีอยู่",
"EQUIPMENT_ACCEPTANCE_SETTINGS_ADMIN_REQUIRED": "เฉพาะผู้ดูแลระบบที่แก้ไขการตั้งค่าการเตือนตรวจรับอุปกรณ์ได้",
"VOUCHER_CHECK_OA_E10_DOWNLOAD_FAILED": "ดาวน์โหลด PDF ใบอนุญาตปล่อยสินค้าจาก E10 ไม่สำเร็จ",
"VOUCHER_CHECK_OA_SALES_RELEASE_INVALID": "ข้อมูลใบอนุญาตปล่อยสินค้าไม่ถูกต้อง กรุณาระบุเลขที่ใบแจ้งหนี้และเลขที่ใบส่งที่ถูกต้อง",
"VOUCHER_CHECK_OA_SALES_RELEASE_PARTIAL": "ดึง PDF ใบอนุญาตปล่อยสินค้าบางไฟล์ไม่สำเร็จ",
+126
View File
@@ -5764,5 +5764,131 @@
"prevPage": "上一页",
"nextPage": "下一页"
}
},
"equipmentAcceptance": {
"title": "设备验收预警",
"sync": "同步 OA 数据",
"syncDone": "已同步 {upserted} 张,跳过 {skipped} 张,本次未见 {absent} 张",
"syncFailed": "同步设备验收数据失败",
"tabLedger": "停留情况",
"tabSends": "发送记录",
"tabConfig": "预警配置",
"sendsLead": "每日扫描生成待发送。默认每周五 18:00 按收件人汇总发出后记在这里。已发送的姓名保持发送当时的人。",
"sendsEmpty": "还没有发送记录",
"sendsFailed": "读取发送记录失败",
"scanAlerts": "扫描预警",
"sendAlerts": "发送预警",
"scanConfirm": "将从 E10 同步,并生成待发送记录。",
"sendConfirm": "将把待发送记录按收件人发到企业微信。",
"scanDone": "新增 {created} 条,更新 {updated} 条,取消 {cancelled} 条",
"sendDone": "已向 {sent} 人发送,{failed} 人失败",
"sendResult": "结果",
"sentAt": "发送时间",
"sendStatus": {
"pending": "待发送",
"sent": "已发送",
"failed": "发送失败",
"cancelled": "已取消"
},
"configLead": "四档天数须逐档增大。保存后只影响以后新产生的预警。发送时刻在排程里配置。",
"tier1": "第 1 档",
"tier2": "第 2 档",
"tier3": "第 3 档",
"tier4": "第 4 档",
"tierWho1": "当前处理人",
"tierWho2": "经副理",
"tierWho3": "COO",
"tierWho4": "总经理",
"dayUnit": "天",
"fixedRoles": "固定岗位",
"role": {
"buyer_manager": "采购经副理",
"coo": "COO",
"executive": "总经理"
},
"roleEmpty": "未选择",
"selectUser": "选择",
"clearUser": "清除",
"configPickOne": "每个岗位只保留一人。姓名用于显示,保存的是系统用户。",
"rulesTitle": "取人规则",
"rulesLead": "主送对象不随天数改,只改超过多少天才触发。",
"ruleTier": "轮次",
"ruleTo": "主送",
"ruleCc": "抄送",
"ruleOver": "超过 {days} 天",
"ruleTo1": "当前节点处理人",
"ruleCc1": "其直接主管、采购担当",
"ruleTo2": "当前节点处理人的经副理",
"ruleCc2": "COO、采购经副理",
"ruleTo3": "COO",
"ruleCc3": "采购经副理",
"ruleTo4": "总经理",
"ruleCc4": "COO、采购经副理",
"saveConfig": "保存配置",
"configSaveHint": "已发送记录保持不变",
"configSaved": "预警配置已保存",
"configLoadFailed": "预警配置加载失败",
"configSaveFailed": "预警配置保存失败",
"configDaysInvalid": "四档天数须逐档增大",
"configReadOnly": "只有管理员可以修改配置",
"loadFailed": "验收单列表加载失败",
"detailLoadFailed": "验收单详情加载失败",
"loading": "正在加载",
"empty": "还没有同步到验收单",
"kpiWatching": "进行中",
"kpiOverdue": "已逾期",
"kpiStopped": "不再提醒",
"filterAll": "全部",
"filterWatching": "进行中",
"filterOverdue": "已逾期",
"filterStopped": "不再提醒",
"filterNotStarted": "未开始",
"badgeOverdue": "已逾期",
"badgeOnTime": "未超时",
"currentHandlers": "当前处理人",
"daysValue": "{days} 天",
"statusAll": "全部状态",
"status": "状态",
"acceptanceNo": "验收单单号",
"purchaseOrderNo": "采购单号",
"applicant": "申请人",
"currentNodes": "当前节点",
"operators": "操作人",
"operatorsNote": "当前节点上的操作人。同一人只保留一行。",
"timerStart": "计时起点",
"dwellDays": "签核天数",
"actions": "操作",
"detail": "查看详情",
"back": "返回停留情况",
"canAccept": "是否可以验收",
"cannotAcceptNote": "无法验收说明",
"cannotAcceptNote": "无法验收说明",
"returnFlag": "是否退回",
"unspecified": "未标明",
"flowStatus": "流程状态",
"finishedAt": "结束时间",
"operatorName": "姓名",
"jobNum": "工号",
"flowStatusName": {
"draft": "草稿",
"approving": "审批中",
"archived": "正常归档",
"forceFinished": "强制结束",
"voided": "已作废",
"pendingSubmit": "待提交",
"paused": "暂停",
"withdrawn": "撤销"
},
"statusLabel": {
"watching": "进行中",
"not_started": "未开始",
"stopped_returned": "已退回,不再提醒",
"stopped_cannot_accept": "无法验收,不再提醒",
"stopped_archived": "已归档,不再提醒",
"stopped_force_finished": "已强制结束,不再提醒",
"stopped_voided": "已作废,不再提醒",
"stopped_revoked": "已撤销,不再提醒",
"excluded": "不在监控范围"
}
}
}
+7
View File
@@ -564,6 +564,13 @@
"VOUCHER_CHECK_PO_UPLOAD_FAILED": "采购单 PDF 上传到文档库「PO订单」目录失败。",
"VOUCHER_CHECK_OA_E10_TOKEN_FAILED": "E10 OpenAPI 授权或刷新 token 失败。",
"VOUCHER_CHECK_OA_E10_SQL_FAILED": "查询 E10 销货放行单库表失败。",
"EQUIPMENT_ACCEPTANCE_CONFIG_INVALID": "设备验收同步的 E10 数据库配置不完整。",
"EQUIPMENT_ACCEPTANCE_OA_SQL_FAILED": "查询 E10 设备验收数据失败。",
"EQUIPMENT_ACCEPTANCE_NOT_FOUND": "设备验收同步记录不存在。",
"EQUIPMENT_ACCEPTANCE_FORBIDDEN": "你没有设备验收预警的访问权限。",
"EQUIPMENT_ACCEPTANCE_ADMIN_REQUIRED": "仅管理员可同步设备验收数据。",
"EQUIPMENT_ACCEPTANCE_SETTINGS_INVALID": "四档天数须逐档增大,岗位必须选择已有的系统用户。",
"EQUIPMENT_ACCEPTANCE_SETTINGS_ADMIN_REQUIRED": "仅管理员可修改设备验收预警配置。",
"VOUCHER_CHECK_OA_E10_DOWNLOAD_FAILED": "从 E10 下载销货放行单 PDF 失败。",
"VOUCHER_CHECK_OA_SALES_RELEASE_INVALID": "销货放行单数据无效:请提供合法的发票号和销货单号。",
"VOUCHER_CHECK_OA_SALES_RELEASE_PARTIAL": "销货放行单拉取部分失败。",
+126
View File
@@ -5731,5 +5731,131 @@
"prevPage": "上一頁",
"nextPage": "下一頁"
}
},
"equipmentAcceptance": {
"title": "設備驗收預警",
"sync": "同步 OA 資料",
"syncDone": "已同步 {upserted} 張,略過 {skipped} 張,本次未見 {absent} 張",
"syncFailed": "同步設備驗收資料失敗",
"tabLedger": "停留情況",
"tabSends": "發送記錄",
"tabConfig": "預警配置",
"sendsLead": "每日掃描產生待發送。預設每週五 18:00 按收件人彙總發出後記在這裡。已發送的姓名保持發送當時的人。",
"sendsEmpty": "還沒有發送記錄",
"sendsFailed": "讀取發送記錄失敗",
"scanAlerts": "掃描預警",
"sendAlerts": "發送預警",
"scanConfirm": "將從 E10 同步,並產生待發送記錄。",
"sendConfirm": "將把待發送記錄按收件人發到企業微信。",
"scanDone": "新增 {created} 條,更新 {updated} 條,取消 {cancelled} 條",
"sendDone": "已向 {sent} 人發送,{failed} 人失敗",
"sendResult": "結果",
"sentAt": "發送時間",
"sendStatus": {
"pending": "待發送",
"sent": "已發送",
"failed": "發送失敗",
"cancelled": "已取消"
},
"configLead": "四檔天數須逐檔增大。儲存後只影響以後新產生的預警。發送時刻在排程裡配置。",
"tier1": "第 1 檔",
"tier2": "第 2 檔",
"tier3": "第 3 檔",
"tier4": "第 4 檔",
"tierWho1": "目前處理人",
"tierWho2": "經副理",
"tierWho3": "COO",
"tierWho4": "總經理",
"dayUnit": "天",
"fixedRoles": "固定崗位",
"role": {
"buyer_manager": "採購經副理",
"coo": "COO",
"executive": "總經理"
},
"roleEmpty": "未選擇",
"selectUser": "選擇",
"clearUser": "清除",
"configPickOne": "每個崗位只保留一人。姓名用來顯示,儲存的是系統使用者。",
"rulesTitle": "取人規則",
"rulesLead": "主送對象不隨天數改,只改超過多少天才觸發。",
"ruleTier": "輪次",
"ruleTo": "主送",
"ruleCc": "抄送",
"ruleOver": "超過 {days} 天",
"ruleTo1": "目前節點處理人",
"ruleCc1": "其直接主管、採購擔當",
"ruleTo2": "目前節點處理人的經副理",
"ruleCc2": "COO、採購經副理",
"ruleTo3": "COO",
"ruleCc3": "採購經副理",
"ruleTo4": "總經理",
"ruleCc4": "COO、採購經副理",
"saveConfig": "儲存配置",
"configSaveHint": "已發送紀錄保持不變",
"configSaved": "預警配置已儲存",
"configLoadFailed": "預警配置載入失敗",
"configSaveFailed": "預警配置儲存失敗",
"configDaysInvalid": "四檔天數須逐檔增大",
"configReadOnly": "只有管理員可以修改配置",
"loadFailed": "驗收單列表載入失敗",
"detailLoadFailed": "驗收單詳情載入失敗",
"loading": "正在載入",
"empty": "還沒有同步到驗收單",
"kpiWatching": "進行中",
"kpiOverdue": "已逾期",
"kpiStopped": "不再提醒",
"filterAll": "全部",
"filterWatching": "進行中",
"filterOverdue": "已逾期",
"filterStopped": "不再提醒",
"filterNotStarted": "未開始",
"badgeOverdue": "已逾期",
"badgeOnTime": "未超時",
"currentHandlers": "目前處理人",
"daysValue": "{days} 天",
"statusAll": "全部狀態",
"status": "狀態",
"acceptanceNo": "驗收單單號",
"purchaseOrderNo": "採購單號",
"applicant": "申請人",
"currentNodes": "目前節點",
"operators": "操作人",
"operatorsNote": "目前節點上的操作人。同一人只保留一行。",
"timerStart": "計時起點",
"dwellDays": "簽核天數",
"actions": "操作",
"detail": "查看詳情",
"back": "返回停留情況",
"canAccept": "是否可以驗收",
"cannotAcceptNote": "無法驗收說明",
"cannotAcceptNote": "無法驗收說明",
"returnFlag": "是否退回",
"unspecified": "未標明",
"flowStatus": "流程狀態",
"finishedAt": "結束時間",
"operatorName": "姓名",
"jobNum": "工號",
"flowStatusName": {
"draft": "草稿",
"approving": "審批中",
"archived": "正常歸檔",
"forceFinished": "強制結束",
"voided": "已作廢",
"pendingSubmit": "待提交",
"paused": "暫停",
"withdrawn": "撤銷"
},
"statusLabel": {
"watching": "進行中",
"not_started": "未開始",
"stopped_returned": "已退回,不再提醒",
"stopped_cannot_accept": "無法驗收,不再提醒",
"stopped_archived": "已歸檔,不再提醒",
"stopped_force_finished": "已強制結束,不再提醒",
"stopped_voided": "已作廢,不再提醒",
"stopped_revoked": "已撤銷,不再提醒",
"excluded": "不在監控範圍"
}
}
}
+7
View File
@@ -564,6 +564,13 @@
"VOUCHER_CHECK_PO_UPLOAD_FAILED": "採購單 PDF 上傳到文件庫「PO訂單」目錄失敗。",
"VOUCHER_CHECK_OA_E10_TOKEN_FAILED": "E10 OpenAPI 授權或刷新 token 失敗。",
"VOUCHER_CHECK_OA_E10_SQL_FAILED": "查詢 E10 銷貨放行單庫表失敗。",
"EQUIPMENT_ACCEPTANCE_CONFIG_INVALID": "設備驗收同步的 E10 資料庫設定不完整。",
"EQUIPMENT_ACCEPTANCE_OA_SQL_FAILED": "查詢 E10 設備驗收資料失敗。",
"EQUIPMENT_ACCEPTANCE_NOT_FOUND": "設備驗收同步記錄不存在。",
"EQUIPMENT_ACCEPTANCE_FORBIDDEN": "你沒有設備驗收預警的存取權限。",
"EQUIPMENT_ACCEPTANCE_ADMIN_REQUIRED": "僅管理員可同步設備驗收資料。",
"EQUIPMENT_ACCEPTANCE_SETTINGS_INVALID": "四檔天數須逐檔增大,崗位必須選擇已有的系統使用者。",
"EQUIPMENT_ACCEPTANCE_SETTINGS_ADMIN_REQUIRED": "僅管理員可修改設備驗收預警配置。",
"VOUCHER_CHECK_OA_E10_DOWNLOAD_FAILED": "從 E10 下載銷貨放行單 PDF 失敗。",
"VOUCHER_CHECK_OA_SALES_RELEASE_INVALID": "銷貨放行單資料無效:請提供合法的發票號和銷貨單號。",
"VOUCHER_CHECK_OA_SALES_RELEASE_PARTIAL": "銷貨放行單拉取部分失敗。",
@@ -11,6 +11,7 @@ export const AGENT_CODE_SHIPPING_NOTICE = 'shipping_notice';
export const AGENT_CODE_FILE_CHECK = 'file_check';
export const AGENT_CODE_PROCUREMENT_CONTRACT_REVIEW = 'procurement_contract_review';
export const AGENT_CODE_CONTRACT_PAYMENT = 'contract_payment';
export const AGENT_CODE_EQUIPMENT_ACCEPTANCE = 'equipment_acceptance';
export const AGENT_CODE_VOUCHER_CHECK = 'voucher_check';
export const AGENT_CODE_IN_TRANSIT_TRANSFER = 'in_transit_transfer';
@@ -244,6 +245,11 @@ export function isContractPaymentAgent(agent: AgentLike): boolean {
return resolveAgentCode(agent) === AGENT_CODE_CONTRACT_PAYMENT;
}
/** 是否为设备验收预警 Agent(agent_code=equipment_acceptance)。 */
export function isEquipmentAcceptanceAgent(agent: AgentLike): boolean {
return resolveAgentCode(agent) === AGENT_CODE_EQUIPMENT_ACCEPTANCE;
}
/** 是否为立账凭证检核 Agent(agent_code=voucher_check)。 */
export function isVoucherCheckAgent(agent: AgentLike): boolean {
return resolveAgentCode(agent) === AGENT_CODE_VOUCHER_CHECK;