import {
  beforeSetup,
  exportIntercept,
  generateNetworkResult,
  intercept,
  intoMenu,
  validateExport,
  validateTableList,
  validateTableSearch,
} from './utils';

const basicData = {
  id: '21',
  userId: '3',
  userName: 'admin',
  scrq: '2023-04-12 16:39:59',
  data: '{production_code=DD01, entry_number=1, warehousing_num=0, num=20, wbs=1, material_id=00000000000000012034, id=25, measurement_id=00000000000000000001, type=0, notice_id=TGD01202303230001}',
  type: '0',
  documentType: '报工单',
  startTime: null,
  endTime: null,
  page: 0,
  limit: 0,
};

describe('单据删除日志', function () {
  beforeEach(function () {
    beforeSetup();
    intoMenu('系统日志', '单据删除日志');
  });

  beforeEach(function () {
    intercept('/queryList/getLogData', function ({reply, search}) {
      generateNetworkResult({search, reply, basicData, title: 'userName'});
    });

    exportIntercept('/queryList/getLogDataExcel');
  });

  it('table', function () {
    validateTableList('order_log_table');

    validateTableSearch(
      'order_log_table',
      [
        'orderLogData',
        {id: 'orderLogType', value: '质检单', type: 'select'},
        'userName',
        {id: 'orderLogDate', type: 'date'},
      ],
      {
        toolId: 'order_log_filter',
        url: '/queryList/getLogData',
      },
    );

    validateExport('order_log_table');
  });
});
