车间能级提升-智能设备管理系统
朱桂飞
2025-02-10 34c674d503e23c0cf6d0b6dec063f3049885e5f8
eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx
@@ -1,18 +1,16 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
import { Tag } from 'ant-design-vue';
import { type FormSchemaGetter, z } from '#/adapter/form';
import { type FormSchemaGetter } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'equCode',
    label: '设备编码'
    label: '设备编号'
  },
  {
    component: 'Input',
@@ -36,83 +34,73 @@
    },
    fieldName: 'equStatus',
    label: '设备状态'
  },
  {
  }
  /* {
    component: 'Select',
    componentProps: {
      options: getDictOptions(DictEnum.EIMS_INVENTORY_DETAIL_STATU)
    },
    fieldName: 'status',
    label: '盘点明细'
  }
  }*/
];
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60, fixed: 'left' },
  {
    title: '盘点状态',
    field: 'status',
    sortable: true,
    minWidth: 100,
    fixed: 'left',
    slots: {
      default: ({ row }) => {
        return renderDict(row.status, DictEnum.EIMS_INVENTORY_DETAIL_STATU);
      }
    }
  },
  {
    title: '设备编号',
    field: 'equCode',
    minWidth: 120,
    fixed: 'left',
    fixed: 'left'
  },
  {
    title: '设备名称',
    field: 'equName',
    minWidth: 100,
    fixed: 'left',
    minWidth: 100
  },
  {
    title: '资产编号',
    field: 'equAssetNo',
    sortable: true,
    minWidth: 100,
  },
  {
    title: '使用部门',
    field: 'deptName',
    minWidth: 100,
  },
  {
    title: '设备类型',
    field: 'equTypeName',
    minWidth: 100,
  },
  {
    title: '设备位置',
    field: 'location',
    minWidth: 100,
    minWidth: 100
  },
  {
    title: '设备状态',
    field: 'equStatus',
    sortable: true,
    minWidth: 100,
    slots: {
      default: ({ row }) => {
        const statu = row.status;
        switch (statu) {
          case '0': {
            return <Tag color="cyan">试用</Tag>;
          }
          case '1': {
            return <Tag color="green">入固</Tag>;
          }
          case '2': {
            return <Tag color="orange">迁移</Tag>;
          }
          case '3': {
            return <Tag color="red">报废</Tag>;
          }
          case null: {
            return '';
          }
          // No default
        }
        return '';
        return renderDict(row.equStatus, DictEnum.SYS_EQU_STATUS);
      }
    },
    minWidth: 80,
    }
  },
  {
    title: '使用部门',
    field: 'deptName',
    minWidth: 100
  },
  {
    title: '设备类型',
    field: 'equTypeName',
    minWidth: 100
  },
  {
    title: '设备位置',
    field: 'location',
    minWidth: 100
  },
  {
    title: '盘点人',
    field: 'inventoryUser',
@@ -135,194 +123,33 @@
      show: () => false,
      triggerFields: ['']
    },
    fieldName: 'id'
  },
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: ['']
    },
    fieldName: 'equId'
  },
  {
    component: 'TreeSelect',
    defaultValue: 0,
    fieldName: 'equTypeId',
    label: '设备类型',
    rules: 'selectRequired'
  },
  {
    component: 'Input',
    fieldName: 'equName',
    label: '设备名称',
    rules: 'required'
  },
  {
    component: 'Input',
    fieldName: 'equCode',
    label: '设备编码',
    help: '设备唯一编码'
  },
  {
    component: 'Input',
    fieldName: 'assetNo',
    label: '资产编号'
  },
  {
    component: 'Input',
    fieldName: 'modelNo',
    label: '型号'
  },
  {
    component: 'Input',
    fieldName: 'madeIn',
    label: '制造商'
  },
  {
    component: 'Input',
    fieldName: 'ratedPower',
    label: '额定功率'
  },
  {
    component: 'Input',
    fieldName: 'plateInfo',
    label: '铭牌信息'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    dependencies: {
      show: () => false,
      triggerFields: ['']
    },
    fieldName: 'purchaseDate',
    label: '采购日期'
    fieldName: 'inventoryId'
  },
  {
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      options: getDictOptions(DictEnum.SYS_EQU_STATUS),
      options: getDictOptions(DictEnum.EIMS_INVENTORY_DETAIL_STATU),
      optionType: 'button'
    },
    defaultValue: '0',
    fieldName: 'status',
    label: '状态'
  },
  {
    component: 'Input',
    fieldName: 'location',
    label: '所在场所',
    help: `设备实际摆放场所`
  },
  {
    component: 'TreeSelect',
    // 在drawer里更新 这里不需要默认的componentProps
    defaultValue: undefined,
    fieldName: 'deptUsed',
    label: '使用部门'
    // rules: 'selectRequired',
  },
  {
    component: 'Select',
    componentProps: {
      allowClear: true,
      showSearch: true,
      getPopupContainer
    },
    fieldName: 'respPerson',
    label: '责任人',
    help: `设备负责人,管理人员`
  },
  {
    component: 'Input',
    fieldName: 'contactPhone',
    label: '联系电话',
    defaultValue: undefined,
    rules: z
      .string()
      .regex(/^1[3-9]\d{9}$/, '请输入正确的手机号码')
      .optional()
      .or(z.literal(''))
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    },
    fieldName: 'deployDate',
    label: '正式使用日期'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    },
    fieldName: 'trialDate',
    label: '开始试用日期'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    },
    fieldName: 'planAcceptDate',
    label: '计划验收日期'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    },
    fieldName: 'actualAcceptDate',
    label: '实际验收日期'
  },
  {
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
      optionType: 'button'
    },
    defaultValue: '0',
    fieldName: 'importStatus',
    formItemClass: 'col-span-2 lg:col-span-1',
    label: '导入状态'
  },
  {
    component: 'Input',
    fieldName: 'serviceLife',
    label: '使用年限'
  },
  {
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
      optionType: 'button'
    },
    defaultValue: '0',
    fieldName: 'inventoryFlag',
    formItemClass: 'col-span-2 lg:col-span-1',
    label: '盘点标志'
  },
  {
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      showTime: false,
      valueFormat: 'YYYY-MM-DD',
      getPopupContainer
    },
    fieldName: 'inventoryDate',
    label: '上次盘点日期'
  }
];