columns.js 3.5 KB
Newer Older
TZW's avatar
TZW committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import AutoTable from '@/components/AutoTable/mtable';

function getcolumns(setdrawer) {
  const columns = [
    {
      title: '供应商编号',
      dataIndex: 'supplierNo',
      key: 'supplierNo',
      editable: false,
    },
    {
      title: '供应商名称',
      dataIndex: 'supplierName',
      key: 'supplierName',
      editable: false,
    },
    {
      title: '更换周期(天)',
      dataIndex: 'replaceCycle',
      key: 'replaceCycle',
      hideInSearch: true,
      valueType: 'digit',
      fieldProps: {
TZW's avatar
TZW committed
24
        defaultValue:0,
TZW's avatar
TZW committed
25 26 27 28 29 30 31 32 33 34 35 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
        precision: 0,
      },
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
    },
  ];
  return {
    columns: [
      {
        title: '设备型号',
        dataIndex: 'equipmentModelName',
        key: 'equipmentModelId',
        colProps: {
          span: 8,
        },
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
        valueType: 'select',
        mode: 'radio',
        fieldProps: {
          showSearch: true,
          dropdownMatchSelectWidth: 100,
        },
        options: {
          path: '/asset/equipmentModel/query/selection',
          params: {},
        },
      },
      {
        title: '安装部位',
        dataIndex: 'installPosition',
        colProps: {
          span: 8,
        },
        key: 'installPosition',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
      },
      {
        dataIndex: 'sparePartId',
        valueType: 'select',
        title: '选择寿命件',
        colProps: {
          span: 8,
        },
        key: 'sparePartId',
        hideInDescriptions: true,
        hideInSearch: true,
        hideInTable: true,
        options: {
          path: '/sparepart/sparePart/queryLifeSelect',
          params: {},
        },
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
      },
      {
        title: '备件料号',
        dataIndex: 'sparePartNo',
        key: 'sparePartNo',
        hideInForm: true,
      },
      {
        title: '备件名称',
        dataIndex: 'sparePartName',
        key: 'sparePartName',
        span: 3,
        hideInForm: true,
      },
      {
        title: '备件更换周期',
        dataIndex: 'supplierList',
        key: 'supplierList',
        valueType: 'formSelectList',
        colProps: {
          span: 24,
        },
        span: 3,
        columns,
        hideInSearch: true,
        hideInTable: true,
        path: '/sparepart/sparePartSupplier/queryList',
        params: { status: 1 },
        rowName: 'supplierList',
        render: (text, row) => {
          console.log(row);
          return <AutoTable columns={columns} dataSource={row?.supplierList} />;
        },
      },
    ],
    pathconfig: {
      enableadd: true,
      enableedit: true,
      enabledelete: true,
      enabledetail: true,
      add: '/sparepart/lifePieceStandard/save',
      edit: '/sparepart/lifePieceStandard/save',
      list: '/sparepart/lifePieceStandard/queryList',
      delete: '/sparepart/lifePieceStandard/deleteById',
      detail: '/sparepart/lifePieceStandard/queryDetails',
    },
  };
}
export default getcolumns;