columns.js 3.67 KB
Newer Older
wuhao's avatar
wuhao committed
1 2 3
import { Switch } from 'antd';

function getcolumns(changeState) {
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
  return {
    columns: [
      {
        title: '供应商编号',
        dataIndex: 'supplierNo',
        key: 'supplierNo',
      },
      {
        title: '供应商名称',
        dataIndex: 'supplierName',
        key: 'supplierName',
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
      },
      {
        title: '官网',
        dataIndex: 'officialWebsite',
        key: 'officialWebsite',
        hideInSearch: true,
wuhao's avatar
wuhao committed
29
        hideInTable: true,
wuhao's avatar
wuhao committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
      },
      {
        title: '联系电话',
        dataIndex: 'telephone',
        key: 'telephone',
      },
      {
        title: '邮箱',
        dataIndex: 'email',
        key: 'email',
      },
      {
        title: '地址',
        dataIndex: 'address',
        key: 'address',
        hideInSearch: true,
      },
wuhao's avatar
wuhao committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
      {
        title: '备注',
        dataIndex: 'remark',
        key: 'remark',
        colProps: {
          span: 24,
        },
        valueType: 'textarea',
        hideInSearch: true,
      },
      {
        title: '评分',
        dataIndex: 'score',
        key: 'score',
        valueType: 'rate',
      },
wuhao's avatar
wuhao committed
63 64 65 66 67 68 69 70 71
      {
        title: '状态',
        dataIndex: 'statusName',
        key: 'status',
        valueType: 'select',
        mode: 'radio',
        options: [
          {
            label: '启用',
wuhao's avatar
wuhao committed
72
            value: 1,
wuhao's avatar
wuhao committed
73 74 75
          },
          {
            label: '停用',
wuhao's avatar
wuhao committed
76
            value: 2,
wuhao's avatar
wuhao committed
77 78 79 80 81 82 83 84 85 86
          },
        ],
        formItemProps: {
          rules: [
            {
              required: true,
              message: '此项为必填项',
            },
          ],
        },
wuhao's avatar
wuhao committed
87 88 89 90 91 92 93 94 95 96 97
        render: (text, row) => {
          return (
            <Switch
              checked={row?.status == 1}
              checkedChildren="启用"
              unCheckedChildren="停用"
              onChange={(e) => {
                changeState({ id: row.id, status: e ? 1 : 2 });
              }}
            />
          );
wuhao's avatar
wuhao committed
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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
        },
      },
      {
        title: '列表',
        valueType: 'formList',
        dataIndex: 'userList',
        colProps: {
          xs: 24,
          sm: 24,
        },
        columns: [
          {
            title: '联系人名称',
            dataIndex: 'userName',
            key: 'userName',
            formItemProps: {
              rules: [
                {
                  required: true,
                  message: '此项为必填项',
                },
              ],
            },
            colProps: {
              sm: 6,
            },
          },
          {
            title: '联系电话',
            dataIndex: 'telephone',
            key: 'telephone',
            colProps: {
              sm: 6,
            },
          },
          {
            title: '邮箱',
            dataIndex: 'email',
            key: 'email',
            colProps: {
              sm: 6,
            },
          },
          {
            title: '职务',
            dataIndex: 'title',
            key: 'title',
            colProps: {
              sm: 6,
            },
          },
        ],
        hideInSearch: true,
        hideInTable: true,
      },
    ],
    pathconfig: {
      enableadd: true,
      enableedit: true,
      enabledelete: true,
      enabledetail: true,
      add: '/sparepart/sparePartSupplier/save',
      edit: '/sparepart/sparePartSupplier/save',
      list: '/sparepart/sparePartSupplier/queryList',
      delete: '/sparepart/sparePartSupplier/deleteById',
      detail: '/sparepart/sparePartSupplier/queryDetails',
    },
  };
}
export default getcolumns;