123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- /**
- * 列配置 Mock Handlers
- * 用于模拟表格列配置 API 响应
- */
- export const FetchColumnConfig = '@fetchColumnConfig';
- export const FetchColumnConfigFail = '@fetchColumnConfigFail';
- /**
- * Mock 列配置 API 成功响应 - 默认配置
- */
- export function mockColumnConfigSuccess() {
- cy.intercept('GET', '/api/config/table-columns', {
- statusCode: 200,
- body: {
- success: true,
- data: [
- {
- tableName: 'worklist',
- columns: [
- { key: 'PatientID', visible: true, order: 1, width: 120 },
- { key: 'PatientName', visible: true, order: 2, width: 150 },
- { key: 'StudyID', visible: true, order: 3, width: 120 },
- { key: 'AccessionNumber', visible: true, order: 4, width: 150 },
- { key: 'StudyStatus', visible: true, order: 5, width: 100 },
- { key: 'Modality', visible: true, order: 6, width: 100 },
- { key: 'StudyStartDatetime', visible: true, order: 7, width: 180 },
- { key: 'PatientAge', visible: true, order: 8, width: 80 },
- { key: 'PatientSex', visible: true, order: 9, width: 80 },
- // 其他列默认隐藏
- { key: 'StudyInstanceUID', visible: false, order: 100 },
- { key: 'SpecificCharacterSet', visible: false, order: 101 },
- ],
- version: '1.0.0',
- updatedAt: '2025-10-07T10:00:00Z',
- },
- {
- tableName: 'history',
- columns: [
- { key: 'StudyID', visible: true, order: 1, width: 120 },
- { key: 'PatientName', visible: true, order: 2, width: 150 },
- { key: 'IsExported', visible: true, order: 3, width: 100 },
- { key: 'StudyDescription', visible: true, order: 4, width: 200 },
- { key: 'StudyStartDatetime', visible: true, order: 5, width: 180 },
- ],
- version: '1.0.0',
- updatedAt: '2025-10-07T10:00:00Z',
- },
- ],
- },
- }).as(FetchColumnConfig);
- }
- /**
- * Mock 列配置 API 失败响应
- */
- export function mockColumnConfigFail() {
- cy.intercept('GET', '/api/config/table-columns', {
- statusCode: 500,
- body: {
- success: false,
- message: 'Internal Server Error',
- },
- }).as(FetchColumnConfigFail);
- }
- /**
- * Mock 列配置 API - 自定义列顺序
- */
- export function mockColumnConfigCustomOrder() {
- cy.intercept('GET', '/api/config/table-columns', {
- statusCode: 200,
- body: {
- success: true,
- data: [
- {
- tableName: 'worklist',
- columns: [
- { key: 'StudyStatus', visible: true, order: 1, width: 100 },
- { key: 'PatientID', visible: true, order: 2, width: 120 },
- { key: 'Modality', visible: true, order: 3, width: 100 },
- { key: 'PatientName', visible: true, order: 4, width: 150 },
- ],
- version: '1.0.0',
- },
- ],
- },
- }).as(FetchColumnConfig);
- }
- /**
- * Mock 列配置 API - 最小列配置(仅4列)
- */
- export function mockColumnConfigMinimal() {
- cy.intercept('GET', '/api/config/table-columns', {
- statusCode: 200,
- body: {
- success: true,
- data: [
- {
- tableName: 'worklist',
- columns: [
- { key: 'PatientID', visible: true, order: 1, width: 120 },
- { key: 'PatientName', visible: true, order: 2, width: 150 },
- { key: 'Modality', visible: true, order: 3, width: 100 },
- { key: 'StudyStatus', visible: true, order: 4, width: 100 },
- ],
- version: '1.0.0',
- },
- ],
- },
- }).as(FetchColumnConfig);
- }
- /**
- * Mock 多表格配置 - 用于测试配置隔离
- */
- export function mockMultiTableConfig() {
- cy.intercept('GET', '/api/config/table-columns', {
- statusCode: 200,
- body: {
- success: true,
- data: [
- {
- tableName: 'worklist',
- columns: [
- { key: 'PatientID', visible: true, order: 1, width: 120 },
- { key: 'PatientName', visible: true, order: 2, width: 150 },
- ],
- },
- {
- tableName: 'history',
- columns: [
- { key: 'StudyID', visible: true, order: 1, width: 120 },
- { key: 'IsExported', visible: true, order: 2, width: 100 },
- { key: 'StudyDescription', visible: true, order: 3, width: 200 },
- ],
- },
- ],
- },
- }).as(FetchColumnConfig);
- }
|