index.ts 1.82 KB
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn } from '/@/components/Table';
import {getRepairOrderList} from "../../../api/repair/order";
const { t } = useI18n();

export const columns: BasicColumn[] = [
  {
    title: t('repair.history.photo'),
    dataIndex: 'situationImg',
    slots: { customRender: 'situationImg' },
  },
  {
    title: t('repair.history.orderCode'),
    dataIndex: 'code',
  },
  {
    title: t('repair.history.orderText'),
    dataIndex: 'tkRepairOrderDTO',
    format: (text, record) => {
      return record.tkRepairOrderDTO?.orderCode || '-' || text;
    },
  },
  {
    title: t('repair.history.deviceNameText'),
    dataIndex: 'deviceAccountName',
  },
  {
    title: t('repair.history.time'),
    dataIndex: 'tkRepairOrderDTO',
    format: (text, record) => {
      return record.tkRepairOrderDTO?.reportDate || '-' || text;
    },
  },
  {
    title: t('repair.history.reportByName'),
    dataIndex: 'tkRepairOrderDTO',
    format: (text, record) => {
      return record.tkRepairOrderDTO?.reportByName || '-' || text;
    },
  },

  {
    title: t('repair.history.description'),
    dataIndex: 'description',
  },
  {
    title: t('repair.history.repairTime'),
    dataIndex: 'repairDate',
  },
  {
    title: t('repair.history.repairByName'),
    dataIndex: 'repairName',
  },
  {
    title: t('repair.history.repairReason'),
    dataIndex: 'malfunctionReasonName',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'orderId',
    label: t('repair.history.orderText'),
    component: 'ApiSelect',
    colProps: { span: 6 },
    componentProps: {
      api: getRepairOrderList,
      params: {
        page: 1,
        pageSize: 999,
      },
      resultField: 'items',
      labelField: 'orderCode',
      valueField: 'id',
    },
  },
];