columns.js 7.63 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',
wuhao's avatar
wuhao committed
9

TZW's avatar
TZW committed
10
      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',
wuhao's avatar
wuhao committed
16

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 22 23
    {
      title: '位置号',
      width: 120,
wuhao's avatar
wuhao committed
24

TZW's avatar
TZW committed
25 26
      dataIndex: 'positionNo',
      search: false,
TZW's avatar
TZW committed
27
      hideInTable: true,
TZW's avatar
TZW committed
28 29
      key: 'positionNo',
    },
wuhao's avatar
wuhao committed
30
    {
TZW's avatar
TZW committed
31
      width: 120,
TZW's avatar
TZW committed
32 33
      title: '设备类型',
      dataIndex: 'equipmentTypeName',
TZW's avatar
TZW committed
34
      key: 'equipmentTypeId',
TZW's avatar
TZW committed
35 36 37
      valueType: 'treeSelect',
      options: { path: '/asset/equipmentType/queryTreeList', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
38 39
    },
    {
TZW's avatar
TZW committed
40 41
      title: '设备型号',
      dataIndex: 'equipmentModelName',
TZW's avatar
TZW committed
42
      width: 120,
wuhao's avatar
wuhao committed
43

TZW's avatar
TZW committed
44
      key: 'equipmentModelId',
TZW's avatar
TZW committed
45
      valueType: 'select',
TZW's avatar
TZW committed
46 47 48 49
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
50 51
      options: { path: '/asset/equipmentModel/query/selection', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
52 53
    },
    {
TZW's avatar
TZW committed
54
      title: '公司名称',
wuhao's avatar
wuhao committed
55

TZW's avatar
TZW committed
56
      dataIndex: 'organizationName',
TZW's avatar
TZW committed
57 58
      width: 120,
      key: 'organizationId',
TZW's avatar
TZW committed
59 60 61 62
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
63 64 65
      valueType: 'select',
      options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
66
    },
TZW's avatar
TZW committed
67 68 69
    {
      title: '部门名称',
      width: 120,
TZW's avatar
TZW committed
70
      valueType: 'treeSelect',
TZW's avatar
TZW committed
71 72 73
      dataIndex: 'departmentName',
      key: 'departmentId',
      options: {
TZW's avatar
TZW committed
74
        path: '/auth/sysDepartment/query/children/tree',
TZW's avatar
TZW committed
75 76 77 78 79
        linkParams: {
          organizationId: 'parentId',
        },
      },
    },
wuhao's avatar
wuhao committed
80
    {
TZW's avatar
TZW committed
81 82
      title: '工厂名称',
      dataIndex: 'factoryName',
TZW's avatar
TZW committed
83 84
      key: 'factoryId',
      width: 120,
TZW's avatar
TZW committed
85 86 87 88
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
89
      valueType: 'select',
TZW's avatar
TZW committed
90
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
TZW's avatar
TZW committed
91
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
92 93
    },
    {
TZW's avatar
TZW committed
94 95
      title: '车间名称',
      dataIndex: 'shopName',
wuhao's avatar
wuhao committed
96

TZW's avatar
TZW committed
97 98
      width: 120,
      valueType: 'select',
TZW's avatar
TZW committed
99 100 101 102
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
103 104 105 106 107 108 109
      options: {
        path: '/auth/sysShop/getShopSelectionByFactory',
        linkParams: {
          factoryId: '',
        },
      },
      key: 'shopId',
TZW's avatar
TZW committed
110
      search: false,
TZW's avatar
TZW committed
111
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
112
    },
TZW's avatar
TZW committed
113 114 115 116 117 118 119 120 121 122 123
    {
      title: '车间名称',
      dataIndex: 'shopName',
      width: 120,
      valueType: 'select',
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
      options: {
        path: '/auth/sysShop/getAllShopSelection',
TZW's avatar
TZW committed
124
        params: {},
TZW's avatar
TZW committed
125 126 127 128 129
      },
      key: 'shopId',
      hideInForm: true,
      hideInTable: true,
    },
wuhao's avatar
wuhao committed
130
    {
TZW's avatar
TZW committed
131 132 133
      title: '工段名称',
      width: 120,
      dataIndex: 'sectionName',
wuhao's avatar
wuhao committed
134

TZW's avatar
TZW committed
135
      key: 'sectionId',
TZW's avatar
TZW committed
136 137 138 139
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
140 141 142 143 144 145 146
      valueType: 'select',
      options: {
        path: '/auth/sysSection/getAllSectionSelectionByShop',
        linkParams: {
          shopId: '',
        },
      },
TZW's avatar
TZW committed
147 148 149 150 151 152 153 154 155 156 157 158 159 160
      search: false,
    },
    {
      title: '工段名称',
      width: 120,
      dataIndex: 'sectionName',
      key: 'sectionId',
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
      valueType: 'select',
      options: {
        path: '/auth/sysSection/getAllSectionSelection',
TZW's avatar
TZW committed
161
        params: {},
TZW's avatar
TZW committed
162 163 164
      },
      hideInForm: true,
      hideInTable: true,
TZW's avatar
TZW committed
165 166 167 168 169 170
    },
    {
      title: '产线名称',
      width: 120,
      dataIndex: 'productLineName',
      valueType: 'select',
TZW's avatar
TZW committed
171 172 173 174
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
175
      key: 'productLineId',
wuhao's avatar
wuhao committed
176

TZW's avatar
TZW committed
177
      options: {
TZW's avatar
TZW committed
178
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
TZW's avatar
TZW committed
179 180 181 182
        linkParams: {
          shopId: '',
        },
      },
TZW's avatar
TZW committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196
      search: false,
    },
    {
      title: '产线名称',
      width: 120,
      dataIndex: 'productLineName',
      valueType: 'select',
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
      key: 'productLineId',
      options: {
        path: '/auth/sysProductionLine/getAllProductLineSelection',
TZW's avatar
TZW committed
197
        params: {},
TZW's avatar
TZW committed
198 199 200
      },
      hideInForm: true,
      hideInTable: true,
TZW's avatar
TZW committed
201 202 203 204 205 206
    },
    {
      title: '供应商',
      width: 120,
      valueType: 'select',
      dataIndex: 'supplierName',
wuhao's avatar
wuhao committed
207

TZW's avatar
TZW committed
208
      hideInTable: true,
TZW's avatar
TZW committed
209
      search: false,
TZW's avatar
TZW committed
210 211 212 213 214 215 216 217
      key: 'supplierId',
      options: {
        path: '/asset/equipmentSupplier/query/selection',
        params: {},
      },
    },
    {
      title: '设备原值(万元)',
TZW's avatar
TZW committed
218
      valueType: 'digit',
TZW's avatar
TZW committed
219
      search: false,
TZW's avatar
TZW committed
220
      hideInTable: true,
wuhao's avatar
wuhao committed
221

TZW's avatar
TZW committed
222 223 224 225 226 227
      dataIndex: 'equipmentWorth',
      key: 'equipmentWorth',
    },
    {
      title: '安装投产日期',
      hideInTable: true,
TZW's avatar
TZW committed
228
      search: false,
wuhao's avatar
wuhao committed
229

TZW's avatar
TZW committed
230 231 232 233 234 235 236
      dataIndex: 'productDate',
      key: 'productDate',
      valueType: 'date',
    },
    {
      title: '图片',
      width: 120,
TZW's avatar
TZW committed
237 238
      dataIndex: 'pictureUrl',
      search: false,
TZW's avatar
TZW committed
239
      search: false,
TZW's avatar
TZW committed
240
      key: 'picList',
wuhao's avatar
wuhao committed
241

wuhao's avatar
wuhao committed
242 243
      valueType: 'uploadImage',
      fieldProps: {
TZW's avatar
TZW committed
244
        limit: 1,
wuhao's avatar
wuhao committed
245 246 247 248
      },
      formItemProps: {
        rules: [
          {
TZW's avatar
TZW committed
249
            required: false,
wuhao's avatar
wuhao committed
250 251 252 253
            message: '此项为必填项',
          },
        ],
      },
TZW's avatar
TZW committed
254 255 256 257 258 259 260
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
TZW's avatar
TZW committed
261 262 263
    },
    {
      title: '二维码',
TZW's avatar
TZW committed
264
      width: 120,
wuhao's avatar
wuhao committed
265

TZW's avatar
TZW committed
266
      search: false,
wuhao's avatar
wuhao committed
267

TZW's avatar
TZW committed
268 269 270 271 272
      dataIndex: 'qrCodeUrl',
      key: 'qrCodeUrl',
      valueType: 'uploadImage',
      search: false,
      hideInForm: true,
TZW's avatar
TZW committed
273 274
      render: (text, row) => {
        if (row?.qrCodeUrl == null) {
TZW's avatar
TZW committed
275 276 277 278 279 280 281 282 283 284 285 286
          return (
            <div
              style={{
                height: 50,
                display: 'flex',
                justifyContent: 'center',
                alignItems: 'center',
              }}
            >
              <span>暂无图片</span>
            </div>
          );
TZW's avatar
TZW committed
287
        } else {
TZW's avatar
TZW committed
288
          return <Image width={50} src={row.qrCodeUrl} />;
TZW's avatar
TZW committed
289 290 291 292 293
        }
      },
    },
    {
      title: '状态名称',
wuhao's avatar
wuhao committed
294

TZW's avatar
TZW committed
295
      search: false,
TZW's avatar
TZW committed
296 297 298 299 300 301 302 303 304
      hideInTable: true,
      dataIndex: 'statusName',
      key: 'statusName',
      hideInForm: true,
    },
    {
      title: '设备状态',
      dataIndex: 'status',
      width: 120,
wuhao's avatar
wuhao committed
305

TZW's avatar
TZW committed
306 307
      hideInForm: true,
      fixed: 'right',
TZW's avatar
TZW committed
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
      valueType: 'select',
      options: [
        {
          label: '在用',
          value: 1,
        },
        {
          label: '借用中',
          value: 2,
        },
        {
          label: '报废',
          value: 3,
        },
      ],
TZW's avatar
TZW committed
323 324 325 326 327 328
      key: 'status',
      render: (text, row) => {
        switch (row.status) {
          case 1:
            return <Tag color="success">在用</Tag>;
          case 3:
TZW's avatar
TZW committed
329 330
            return <Tag>报废</Tag>;
          case 2:
TZW's avatar
TZW committed
331 332 333 334 335
            return <Tag color="volcano">借用中</Tag>;
          default:
            break;
        }
      },
wuhao's avatar
wuhao committed
336 337 338 339 340
    },
  ];
}

export default getcolumns;