车间能级提升-智能设备管理系统
zhuguifei
2025-03-10 6648e74a007254e167c5508de5d25402cd4bb63b
eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx
@@ -3,14 +3,10 @@
import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
import dayjs from 'dayjs';
import { type FormSchemaGetter } from '#/adapter/form';
import { REPAIR_REQ_TYPE } from '#/constants/dict';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
const curDateTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
export const querySchema: FormSchemaGetter = () => [
  {
@@ -54,6 +50,33 @@
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60, fixed: 'left' },
  {
    title: '设备(工具)名称',
    sortable: true,
    minWidth: 150,
    fixed: 'left',
    slots: {
      default: ({ row }) => {
        if (!row.reqType) {
          return '';
        }
        // 根据不同的请求类型返回相应的名称
        switch (row.reqType) {
          case REPAIR_REQ_TYPE.EQU: {
            return row.equName;
          }
          case REPAIR_REQ_TYPE.FIXTURE: {
            return row.fixtureName;
          }
          default: {
            // 如果请求类型既不是 EQU 也不是 FIXTURE,则返回空字符串
            return '';
          }
        }
      }
    }
  },
  {
    title: '维修单号',
    field: 'resCode',
    minWidth: 160,
@@ -76,7 +99,7 @@
  {
    title: '报修单号',
    field: 'reqCode',
    minWidth: 160,
    minWidth: 160
  },
  {
    title: '维修部门',
@@ -107,32 +130,6 @@
    field: 'reqTime',
    sortable: true,
    minWidth: 200
  },
  {
    title: '设备(工具)名称',
    sortable: true,
    minWidth: 150,
    slots: {
      default: ({ row }) => {
        if (!row.reqType) {
          return '';
        }
        // 根据不同的请求类型返回相应的名称
        switch (row.reqType) {
          case REPAIR_REQ_TYPE.EQU: {
            return row.equName;
          }
          case REPAIR_REQ_TYPE.FIXTURE: {
            return row.fixtureName;
          }
          default: {
            // 如果请求类型既不是 EQU 也不是 FIXTURE,则返回空字符串
            return '';
          }
        }
      }
    }
  },
  {
    title: '故障类别',
@@ -167,7 +164,7 @@
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 130
    width: 200
  }
];
@@ -187,7 +184,8 @@
      show: () => false,
      triggerFields: ['']
    },
    label: '报修id'
    label: '报修id',
    rules: 'required'
  },
  {
    component: 'Input',
@@ -196,7 +194,8 @@
      show: () => false,
      triggerFields: ['']
    },
    label: '报修人'
    label: '报修人',
    rules: 'required'
  },
  {
    component: 'Input',
@@ -205,35 +204,41 @@
      show: () => false,
      triggerFields: ['']
    },
    label: '报修部门'
    label: '报修部门',
    rules: 'required'
  },
  {
    component: 'Input',
    fieldName: 'reqCode',
    label: '报修单号'
    label: '报修单号',
    rules: 'required'
  },
  {
    component: 'Input',
    fieldName: 'resCode',
    label: '维修单号'
    label: '维修单号',
    rules: 'required'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'resReason',
    label: '原因分析'
    label: '原因分析',
    rules: 'required'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'resHandle',
    label: '处理措施'
    label: '处理措施',
    rules: 'required'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'resPrevent',
    label: '预防措施'
    label: '预防措施',
    rules: 'required'
  },
  {
    component: 'Input',
@@ -260,8 +265,9 @@
      options: getDictOptions(DictEnum.REPAIR_RES_STATUS)
    },
    fieldName: 'status',
    defaultValue: '0',
    label: '维修状态'
    defaultValue: '1',
    label: '维修状态',
    rules: 'required'
  },
  {
    component: 'DatePicker',
@@ -271,9 +277,9 @@
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      getPopupContainer
    },
    defaultValue: curDateTime,
    fieldName: 'startTime',
    label: '开始时间'
    label: '开始时间',
    rules: 'required'
  },
  {
    component: 'DatePicker',
@@ -292,8 +298,8 @@
    defaultValue: undefined,
    fieldName: 'resDept',
    label: '维修部门',
    help: `报修人员所属部门`
    // rules: 'selectRequired',
    help: `报修人员所属部门`,
    rules: 'selectRequired'
  },
  {
    component: 'Select',
@@ -303,14 +309,13 @@
      getPopupContainer
    },
    fieldName: 'resUser',
    label: '维修人'
    label: '维修人',
    rules: 'selectRequired'
  },
  {
    component: 'Textarea',
    formItemClass: 'items-baseline',
    fieldName: 'remark',
    label: '备注'
  },
  }
];