Merge branch 'dev' into picture-feedback
This commit is contained in:
commit
34ad40778b
180 files changed
+13262
-5333
No files matched your search
+75
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* features/equipment-acceptance/views/EquipmentAcceptanceDetailPage.spec.ts
|
||||
* 用途:确认详情在接口返回后能画出标题和当前节点表格,加载遮罩会关掉。
|
||||
* 依赖:EquipmentAcceptanceDetailPage、vue-i18n、@vue/test-utils。
|
||||
* 逻辑:只挂本页,接口用桩数据。不覆盖对话壳。
|
||||
*/
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { getEquipmentAcceptanceOrder } from '../api/equipment-acceptance.api';
|
||||
import EquipmentAcceptanceDetailPage from './EquipmentAcceptanceDetailPage.vue';
|
||||
|
||||
vi.mock('../api/equipment-acceptance.api', () => ({
|
||||
getEquipmentAcceptanceOrder: vi.fn(),
|
||||
}));
|
||||
|
||||
const sample = {
|
||||
id: 1,
|
||||
request_title: '托威斯平台式自动拉钉机/1套资产验收单提交OA-20260718000003',
|
||||
acceptance_no: '20260718000003',
|
||||
flow_no: '20260718-1520',
|
||||
request_created_at: '2026-07-18T16:51:47',
|
||||
finished_at: null,
|
||||
applicant_name: '柴晓红',
|
||||
purchase_order_no: '5202-2606030008',
|
||||
flow_status_raw: 1,
|
||||
dwell_days: null,
|
||||
timer_started_at: null,
|
||||
can_accept: 1,
|
||||
is_returned: 0,
|
||||
cannot_accept_note: null,
|
||||
monitor_status: 'not_started',
|
||||
overdue: false,
|
||||
nodes: [{ node_id: '1', node_name: '品质担当', node_type: null }],
|
||||
operators: [{ node_id: '1', user_id: '9', handler_name: '温德佳', handler_job_num: '25060045' }],
|
||||
};
|
||||
|
||||
describe('设备验收详情', () => {
|
||||
it('接口返回后显示标题、当前节点、处理人和工号,并关掉加载遮罩', async () => {
|
||||
const errors: unknown[] = [];
|
||||
vi.mocked(getEquipmentAcceptanceOrder).mockResolvedValue(sample as never);
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
missing: (_locale, key) => key,
|
||||
messages: { 'zh-CN': {} },
|
||||
});
|
||||
const wrapper = mount(EquipmentAcceptanceDetailPage, {
|
||||
props: { orderId: 1 },
|
||||
global: {
|
||||
plugins: [i18n],
|
||||
config: {
|
||||
errorHandler(err) {
|
||||
errors.push(err);
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
await flushPromises();
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
const text = wrapper.text();
|
||||
// 标题用流程标题,不再用验收单号占页眉。
|
||||
expect(text).toContain(sample.request_title);
|
||||
// 采购单号单独占字段表第一行。
|
||||
expect(wrapper.find('.el-descriptions__label').text()).toBe('admin.equipmentAcceptance.purchaseOrderNo');
|
||||
// 当前节点、处理人、工号只出现在下方表格。
|
||||
expect(text).toContain('品质担当');
|
||||
expect(text).toContain('温德佳');
|
||||
expect(text).toContain('25060045');
|
||||
// 加载结束不能留下可见遮罩,否则页面会一直转圈。
|
||||
const mask = wrapper.find('.el-loading-mask');
|
||||
expect(mask.exists() && mask.isVisible()).toBe(false);
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user