columns.js 4.55 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
    columns: [
      {
        title: '备件料号',
        dataIndex: 'sparePartNo',
        key: 'sparePartNo',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
TZW's avatar
TZW committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
        render: (_, row) => {
          return (
            <a
              onClick={() => {
                setdrawer((s) => ({
                  ...s,
                  open: true,
                  item: row,
                  title: '详情',
                  val: 'detail',
                  title: '详细信息',
                }));
              }}
            >
              {row?.sparePartNo}
            </a>
          );
        },
wuhao's avatar
wuhao committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
      },
      {
        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
98
        hideInSearch: true,
wuhao's avatar
wuhao committed
99 100 101 102 103 104
      },
      {
        title: '库存上限',
        dataIndex: 'stockUpper',
        key: 'stockUpper',
        valueType: 'digit',
wuhao's avatar
wuhao committed
105
        hideInSearch: true,
wuhao's avatar
wuhao committed
106 107 108 109 110 111
      },
      {
        title: '库存下限',
        dataIndex: 'stockLower',
        key: 'stockLower',
        valueType: 'digit',
wuhao's avatar
wuhao committed
112
        hideInSearch: true,
wuhao's avatar
wuhao committed
113 114 115 116 117 118 119 120 121 122 123 124 125
      },
      {
        title: '库存单位',
        dataIndex: 'unit',
        key: 'unit',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
wuhao's avatar
wuhao committed
126
        hideInSearch: true,
wuhao's avatar
wuhao committed
127 128 129 130 131 132
      },
      {
        title: '是否寿命件',
        dataIndex: 'isLifeName',
        key: 'isLife',
        valueType: 'select',
TZW's avatar
TZW committed
133 134 135 136 137 138 139 140
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
wuhao's avatar
wuhao committed
141 142 143 144 145 146 147 148 149 150
        options: [
          {
            label: '是',
            value: 1,
          },
          {
            label: '否',
            value: 2,
          },
        ],
wuhao's avatar
wuhao committed
151 152
        hideInSearch: true,
        hideInTable: true,
wuhao's avatar
wuhao committed
153
      },
TZW's avatar
TZW committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
      // {
      //   title: '供应商信息',
      //   dataIndex: 'relations',
      //   key: 'relations',
      //   valueType: 'split',
      // },
      // {
      //   // title: '供应商',
      //   dataIndex: 'relationSupplierList',
      //   key: 'relationSupplierList',
      //   valueType: 'formSelectList',
      //   colProps: {
      //     span: 24,
      //   },
      //   columns,
      //   span: 12,
      //   path: '/sparepart/sparePartSupplier/queryList',
      //   params: { status: 1 },
      //   hideInSearch: true,
      //   hideInTable: true,
      //   render: (text, row) => {
      //     return (
      //       <AutoTable
      //         columns={columns?.map((it) => ({
      //           ...it,
      //           hideInSearch: true,
      //         }))}
      //         dataSource={row?.relationSupplierList}
      //       />
      //     );
      //   },
      // },
wuhao's avatar
wuhao committed
186 187 188 189 190 191 192 193 194 195 196 197 198
    ],
    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
199
}
wuhao's avatar
wuhao committed
200
export default getcolumns;