columns.js 3.85 KB
Newer Older
wuhao's avatar
wuhao committed
1 2
import AutoTable from '@/components/AutoTable/mtable';

wuhao's avatar
wuhao committed
3
function getcolumns(setdrawer) {
wuhao's avatar
wuhao committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
  const columns = [
    {
      title: '供应商编号',
      dataIndex: 'supplierNo',
      key: 'supplierNo',
      editable: false,
    },
    {
      title: '供应商名称',
      dataIndex: 'supplierName',
      key: 'supplierName',
      editable: false,
    },
    {
      title: '保质期(天)',
      dataIndex: 'qualityGuarantee',
      valueType: 'digit',
      precision: 2,
      fieldProps: {
        precision: 2,
      },
      hideInSearch: true,
    },
    {
      title: '价值',
      dataIndex: 'value',
      valueType: 'money',
      hideInSearch: true,
    },
  ];

wuhao's avatar
wuhao committed
35
  return {
wuhao's avatar
wuhao committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
    columns: [
      {
        title: '备件料号',
        dataIndex: 'sparePartNo',
        key: 'sparePartNo',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
      },
      {
        title: '备件名称',
        dataIndex: 'sparePartName',
        key: 'sparePartName',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
      },
      {
        title: '备件类型',
        dataIndex: 'sparePartTypeName',
        key: 'sparePartTypeId',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
        valueType: 'treeSelect',
        options: {
          path: '/sparepart/sparePartType/queryTreeList',
          params: {},
        },
wuhao's avatar
wuhao committed
80
        hideInSearch: true,
wuhao's avatar
wuhao committed
81 82 83 84 85 86
      },
      {
        title: '库存上限',
        dataIndex: 'stockUpper',
        key: 'stockUpper',
        valueType: 'digit',
wuhao's avatar
wuhao committed
87
        hideInSearch: true,
wuhao's avatar
wuhao committed
88 89 90 91 92 93
      },
      {
        title: '库存下限',
        dataIndex: 'stockLower',
        key: 'stockLower',
        valueType: 'digit',
wuhao's avatar
wuhao committed
94
        hideInSearch: true,
wuhao's avatar
wuhao committed
95 96 97 98 99 100 101 102 103 104 105 106 107
      },
      {
        title: '库存单位',
        dataIndex: 'unit',
        key: 'unit',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
wuhao's avatar
wuhao committed
108
        hideInSearch: true,
wuhao's avatar
wuhao committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
      },
      {
        title: '是否寿命件',
        dataIndex: 'isLifeName',
        key: 'isLife',
        valueType: 'select',
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 2,
          },
        ],
wuhao's avatar
wuhao committed
125 126
        hideInSearch: true,
        hideInTable: true,
wuhao's avatar
wuhao committed
127 128 129 130 131 132 133 134
      },
      {
        title: '供应商信息',
        dataIndex: 'relations',
        key: 'relations',
        valueType: 'split',
      },
      {
wuhao's avatar
wuhao committed
135
        title: '供应商',
wuhao's avatar
wuhao committed
136 137 138 139 140 141
        dataIndex: 'relationSupplierList',
        key: 'relationSupplierList',
        valueType: 'formSelectList',
        colProps: {
          span: 24,
        },
wuhao's avatar
wuhao committed
142 143
        columns,
        span: 12,
wuhao's avatar
wuhao committed
144 145
        path: '/sparepart/sparePartSupplier/queryList',
        params: { status: 1 },
wuhao's avatar
wuhao committed
146 147 148 149 150 151 152 153 154 155 156 157 158
        hideInSearch: true,
        hideInTable: true,
        render: (text, row) => {
          return (
            <AutoTable
              columns={columns?.map((it) => ({
                ...it,
                hideInSearch: true,
              }))}
              dataSource={row?.relationSupplierList}
            />
          );
        },
wuhao's avatar
wuhao committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172
      },
    ],
    pathconfig: {
      enableadd: true,
      enableedit: true,
      enabledelete: true,
      enabledetail: true,
      add: '/sparepart/sparePart/save',
      edit: '/sparepart/sparePart/save',
      list: '/sparepart/sparePart/queryList',
      delete: '/sparepart/sparePart/deleteById',
      detail: '/sparepart/sparePart/queryDetails',
    },
  };
wuhao's avatar
wuhao committed
173
}
wuhao's avatar
wuhao committed
174
export default getcolumns;