columns.js 5.58 KB
Newer Older
TZW's avatar
TZW committed
1
import { Image, Tag } from 'antd';
TZW's avatar
TZW committed
2

wuhao's avatar
wuhao committed
3 4 5
function getcolumns(setdrawer) {
  return [
    {
TZW's avatar
TZW committed
6 7 8
      title: '设备编号',
      dataIndex: 'equipmentNo',
      key: 'equipmentNo',
TZW's avatar
TZW committed
9 10
      align: 'center',
      width: 120,
TZW's avatar
TZW committed
11
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
12 13
    },
    {
TZW's avatar
TZW committed
14 15
      title: '设备名称',
      dataIndex: 'equipmentName',
TZW's avatar
TZW committed
16
      align: 'center',
TZW's avatar
TZW committed
17
      width: 220,
TZW's avatar
TZW committed
18 19
      key: 'equipmentName',
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
20
    },
TZW's avatar
TZW committed
21
    { title: '位置号', width: 120, align: 'center', dataIndex: 'positionNo', key: 'positionNo' },
wuhao's avatar
wuhao committed
22
    {
TZW's avatar
TZW committed
23
      width: 120,
TZW's avatar
TZW committed
24
      title: '设备类型',
TZW's avatar
TZW committed
25
      align: 'center',
TZW's avatar
TZW committed
26
      dataIndex: 'equipmentTypeName',
TZW's avatar
TZW committed
27
      key: 'equipmentTypeId',
TZW's avatar
TZW committed
28 29 30
      valueType: 'treeSelect',
      options: { path: '/asset/equipmentType/queryTreeList', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
31 32
    },
    {
TZW's avatar
TZW committed
33 34
      title: '设备型号',
      dataIndex: 'equipmentModelName',
TZW's avatar
TZW committed
35 36 37
      width: 120,
      align: 'center',
      key: 'equipmentModelId',
TZW's avatar
TZW committed
38 39 40
      valueType: 'select',
      options: { path: '/asset/equipmentModel/query/selection', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
41 42
    },
    {
TZW's avatar
TZW committed
43
      title: '公司名称',
TZW's avatar
TZW committed
44
      align: 'center',
TZW's avatar
TZW committed
45
      dataIndex: 'organizationName',
TZW's avatar
TZW committed
46 47
      width: 120,
      key: 'organizationId',
TZW's avatar
TZW committed
48 49 50
      valueType: 'select',
      options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
51
    },
TZW's avatar
TZW committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65
    {
      title: '部门名称',
      width: 120,
      align: 'center',
      valueType: 'select',
      dataIndex: 'departmentName',
      key: 'departmentId',
      options: {
        path: '/auth/sysDepartment/query/depart/selectbox',
        linkParams: {
          organizationId: 'parentId',
        },
      },
    },
wuhao's avatar
wuhao committed
66
    {
TZW's avatar
TZW committed
67 68
      title: '工厂名称',
      dataIndex: 'factoryName',
TZW's avatar
TZW committed
69 70 71
      key: 'factoryId',
      width: 120,
      align: 'center',
TZW's avatar
TZW committed
72
      valueType: 'select',
TZW's avatar
TZW committed
73
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
TZW's avatar
TZW committed
74
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
75 76
    },
    {
TZW's avatar
TZW committed
77 78
      title: '车间名称',
      dataIndex: 'shopName',
TZW's avatar
TZW committed
79 80 81 82 83 84 85 86 87 88
      align: 'center',
      width: 120,
      valueType: 'select',
      options: {
        path: '/auth/sysShop/getShopSelectionByFactory',
        linkParams: {
          factoryId: '',
        },
      },
      key: 'shopId',
TZW's avatar
TZW committed
89
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
90 91
    },
    {
TZW's avatar
TZW committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
      title: '工段名称',
      width: 120,
      dataIndex: 'sectionName',
      align: 'center',
      key: 'sectionId',
      valueType: 'select',
      options: {
        path: '/auth/sysSection/getAllSectionSelectionByShop',
        linkParams: {
          shopId: '',
        },
      },
    },
    {
      title: '产线名称',
      width: 120,
      dataIndex: 'productLineName',
      valueType: 'select',
      key: 'productLineName',
      align: 'center',
      options: {
TZW's avatar
TZW committed
113
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
TZW's avatar
TZW committed
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
        linkParams: {
          shopId: '',
        },
      },
    },
    {
      title: '供应商',
      width: 120,
      valueType: 'select',
      dataIndex: 'supplierName',
      align: 'center',
      hideInTable: true,
      key: 'supplierId',
      options: {
        path: '/asset/equipmentSupplier/query/selection',
        params: {},
      },
    },
    {
      title: '设备原值(万元)',
      hideInTable: true,
      align: 'center',
      dataIndex: 'equipmentWorth',
      key: 'equipmentWorth',
    },
    {
      title: '安装投产日期',
      hideInTable: true,
      align: 'center',
      dataIndex: 'productDate',
      key: 'productDate',
      valueType: 'date',
    },
    {
      title: '图片',
      width: 120,
TZW's avatar
TZW committed
150 151 152
      dataIndex: 'pictureUrl',
      search: false,
      key: 'picList',
TZW's avatar
TZW committed
153
      align: 'center',
wuhao's avatar
wuhao committed
154 155
      valueType: 'uploadImage',
      fieldProps: {
TZW's avatar
TZW committed
156
        limit: 1,
wuhao's avatar
wuhao committed
157 158 159 160
      },
      formItemProps: {
        rules: [
          {
TZW's avatar
TZW committed
161
            required: true,
wuhao's avatar
wuhao committed
162 163 164 165
            message: '此项为必填项',
          },
        ],
      },
TZW's avatar
TZW committed
166 167 168 169 170 171 172
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
TZW's avatar
TZW committed
173 174 175
    },
    {
      title: '二维码',
TZW's avatar
TZW committed
176 177 178
      width: 120,
      align: 'center',
      align: 'center',
TZW's avatar
TZW committed
179 180 181 182 183
      dataIndex: 'qrCodeUrl',
      key: 'qrCodeUrl',
      valueType: 'uploadImage',
      search: false,
      hideInForm: true,
TZW's avatar
TZW committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
      render: (text, row) => {
        if (row?.qrCodeUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.qrCodeUrl} />;
        }
      },
    },
    {
      title: '状态名称',
      align: 'center',
      hideInTable: true,
      dataIndex: 'statusName',
      key: 'statusName',
      hideInForm: true,
    },
    {
      title: '设备状态',
      dataIndex: 'status',
      width: 120,
      align: 'center',
      hideInForm: true,
      fixed: 'right',
      key: 'status',
      render: (text, row) => {
        switch (row.status) {
          case 1:
            return <Tag color="success">在用</Tag>;
          case 3:
TZW's avatar
TZW committed
213 214
            return <Tag>报废</Tag>;
          case 2:
TZW's avatar
TZW committed
215 216 217 218 219
            return <Tag color="volcano">借用中</Tag>;
          default:
            break;
        }
      },
wuhao's avatar
wuhao committed
220 221 222 223 224
    },
  ];
}

export default getcolumns;