车间能级提升-智能设备管理系统
zhuguifei
2025-04-16 609b918b24e8dbbe75bf2eaef7a532308d83a708
eims-ui/apps/web-antd/src/views/eims/spare/data.tsx
@@ -1,11 +1,13 @@
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 } from '#/adapter/form';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
import { getPopupContainer } from '@vben/utils';
export const querySchema: FormSchemaGetter = () => [
  {
@@ -84,7 +86,7 @@
    sortable: true,
    slots: {
      default: ({ row }) => {
        if (row.unit === null || row.unit === '') {
        if (!row.unit || row.unit === '') {
          return '';
        }
        return renderDict(row.unit, DictEnum.EIMS_SPARE_UNIT);
@@ -138,6 +140,87 @@
  }
];
export const inoutCol: VxeGridProps['columns'] = [
  {
    title: '出入库单号',
    field: 'orderCode',
    width: 180
  },
  {
    title: '日期',
    field: 'orderTime',
    width: 180
  },
  {
    title: '方向',
    field: 'type1',
    width: 80,
    slots: {
      default: ({ row }) => {
        const type = row.type;
        switch (type) {
          case '1': {
            return <Tag color="green"> 入库 </Tag>;
          }
          case '2': {
            return <Tag color="blue"> 出库 </Tag>;
          }
          // No default
        }
        return '';
      }
    }
  },
  {
    title: '类型',
    field: 'type',
    width: 100,
    slots: {
      default: ({ row }) => {
        if (!row.type || row.type === '') {
          return '';
        }
        return renderDict(row.type, DictEnum.SPARE_INOUT_TYPE);
      }
    }
  },
  {
    title: '入库',
    field: 'inQuantity',
    width: 120,
    slots: {
      default: ({ row }) => {
        return row.type && row.type === '1' ? row.quantity : '';
      }
    }
  },
  {
    title: '出库',
    field: 'outQuantity',
    width: 120,
    slots: {
      default: ({ row }) => {
        return row.type && row.type === '2' ? row.quantity : '';
      }
    }
  },
  {
    title: '库存',
    field: 'actualStock',
    width: 80
  },
  {
    title: '单价',
    field: 'unitPrice',
    width: 80
  },
  {
    title: '金额',
    field: 'amount',
    width: 80
  }
];
export const drawerSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
@@ -173,7 +256,7 @@
      show: () => false,
      triggerFields: ['imgUrl']
    },
    label: '备件预览',
    label: '备件预览'
  },
  {
    component: 'Input',