columns.js 13.4 KB
Newer Older
wuhao's avatar
wuhao committed
1
import AutoTable from '@/components/AutoTable/mtable';
TZW's avatar
TZW committed
2 3
import { ProDescriptions } from '@ant-design/pro-components';
import { Divider } from 'rc-menu';
wuhao's avatar
wuhao committed
4
function getcolumns(setdrawer) {
wuhao's avatar
wuhao committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
  const columns = [
    {
      title: '备件料号/名称',
      dataIndex: 'sparePartId',
      key: 'sparePartId',
      editable: false,
      hideInSearch: true,
      colProps: {
        span: 6,
      },
      valueType: 'select',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      options: {
        path: '/sparepart/sparePart/queryAllSelect',
        params: {},
      },
TZW's avatar
TZW committed
28
      render: (text, row) => `${row?.sparePartNo || '--'}/${row?.sparePartName}`,
wuhao's avatar
wuhao committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    },
    {
      title: '供应商编号/名称',
      dataIndex: 'supplierId',
      key: 'supplierId',
      editable: false,
      hideInSearch: true,
      colProps: {
        span: 6,
      },
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      valueType: 'select',
      options: {
        path: '/sparepart/sparePartSupplier/queryOnSelect',
        params: {},
      },
TZW's avatar
TZW committed
52
      render: (text, row) => {
TZW's avatar
TZW committed
53
        return `${row?.supplierNo || '--'}/${row?.supplierName}`;
TZW's avatar
TZW committed
54
      },
wuhao's avatar
wuhao committed
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
    },
    {
      title: '入库数量',
      dataIndex: 'operateNum',
      valueType: 'digit',
      fieldProps: {
        precision: 0,
      },
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      hideInSearch: true,
      colProps: {
        span: 6,
      },
    },
    {
      title: '库存单位',
      dataIndex: 'unit',
      key: 'unit',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      fieldProps: {
        disabled: true,
      },
      hideInSearch: true,
      editable: false,
      colProps: {
        span: 6,
      },
    },
  ];
wuhao's avatar
wuhao committed
98

wuhao's avatar
wuhao committed
99 100 101 102 103 104 105 106 107
  return [
    {
      tab: '未完成',
      key: '1',
      columns: [
        {
          title: '入库单号',
          dataIndex: 'taskNo',
          key: 'taskNo',
TZW's avatar
TZW committed
108 109 110
          fieldProps: {
            placeholder: '不填系统自动生成',
          },
TZW's avatar
TZW committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
          render: (_, row) => {
            return (
              <a
                onClick={() => {
                  setdrawer((s) => ({
                    ...s,
                    open: true,
                    item: row,
                    title: '详情',
                    val: 'detail',
                    title: '详细信息',
                  }));
                }}
              >
                {row?.taskNo}
              </a>
            );
          },
wuhao's avatar
wuhao committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
        },
        {
          title: '入库类型',
          dataIndex: 'inTypeName',
          key: 'inType',
          valueType: 'select',
          options: [
            {
              label: '采购入库',
              value: '1',
            },
            {
              label: '生产入库',
              value: '2',
            },
            {
              label: '其他入库',
              value: '3',
            },
          ],
wuhao's avatar
wuhao committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
          searchOptions: [
            {
              label: '采购入库',
              value: '1',
            },
            {
              label: '生产入库',
              value: '2',
            },
            {
              label: '其他入库',
              value: '3',
            },
            {
              label: '备件回冲入库',
              value: '4',
            },
          ],
          fieldProps: {
            dropdownMatchSelectWidth: 120,
          },
wuhao's avatar
wuhao committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseName',
          hideInForm: true,
        },
wuhao's avatar
wuhao committed
185 186 187 188 189 190 191
        {
          title: '入库仓库',
          dataIndex: 'nosubmits',
          initialValue: '备件仓库',
          valueType: 'nosubmit',
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '备注',
          dataIndex: 'remark',
          key: 'remark',
          valueType: 'textarea',
          hideInSearch: true,
        },
        {
          title: '创建人',
          dataIndex: 'createUserName',
          key: 'createUserId',
          hideInForm: true,
          valueType: 'select',
          fieldProps: {
            showSearch: true,
          },
          options: {
            path: '/auth/sysUser/selection',
            params: {},
          },
        },
        {
          title: '创建时间',
TZW's avatar
TZW committed
240
          dataIndex: 'createTime',
wuhao's avatar
wuhao committed
241
          key: 'createTimeList',
TZW's avatar
TZW committed
242 243 244 245 246 247
          fieldProps: {
            showTime: {
              format: 'HH:mm',
            },
            format: 'YYYY-MM-DD HH:mm',
          },
wuhao's avatar
wuhao committed
248
          hideInForm: true,
TZW's avatar
TZW committed
249
          valueType: 'dateTimeRange',
wuhao's avatar
wuhao committed
250
          render: (text, row) => {
TZW's avatar
TZW committed
251
            return <span style={{ fontSize: 14 }}>{row?.createTime}</span>;
wuhao's avatar
wuhao committed
252 253 254
          },
        },
        {
TZW's avatar
TZW committed
255 256 257 258 259
          title: (
            <div>
              <span style={{ color: 'red' }}>* </span>备件信
            </div>
          ),
wuhao's avatar
wuhao committed
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
        },
        {
          dataIndex: 'detailsList',
          key: 'detailsList',
          valueType: 'formList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/sparePart/queryList',
          hideInSearch: true,
          hideInTable: true,
          render: (text, row) => {
            return (
              <AutoTable
                columns={columns?.map((it) => ({
                  ...it,
                  hideInSearch: true,
                }))}
                dataSource={row?.detailsList}
              />
            );
          },
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: true,
        enabledelete: true,
        enabledetail: true,
        add: '/sparepart/inWarehouseTask/save',
        edit: '/sparepart/inWarehouseTask/save',
        list: '/sparepart/inWarehouseTask/queryNoComplete',
        delete: '',
        detail: '/sparepart/inWarehouseTask/queryDetails',
      },
    },
    {
      tab: '已完成',
      key: '2',
      columns: [
        {
          title: '入库单号',
          dataIndex: 'taskNo',
          key: 'taskNo',
TZW's avatar
TZW committed
309 310 311
          fieldProps: {
            placeholder: '不填系统自动生成',
          },
TZW's avatar
TZW committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
          render: (_, row) => {
            return (
              <a
                onClick={() => {
                  setdrawer((s) => ({
                    ...s,
                    open: true,
                    item: row,
                    title: '详情',
                    val: 'detail',
                    title: '详细信息',
                  }));
                }}
              >
                {row?.taskNo}
              </a>
            );
          },
wuhao's avatar
wuhao committed
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
        },
        {
          title: '入库类型',
          dataIndex: 'inTypeName',
          key: 'inType',
          valueType: 'select',
          options: [
            {
              label: '采购入库',
              value: '1',
            },
            {
              label: '生产入库',
              value: '2',
            },
            {
              label: '其他入库',
              value: '3',
            },
          ],
wuhao's avatar
wuhao committed
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
          searchOptions: [
            {
              label: '采购入库',
              value: '1',
            },
            {
              label: '生产入库',
              value: '2',
            },
            {
              label: '其他入库',
              value: '3',
            },
            {
              label: '备件回冲入库',
              value: '4',
            },
          ],
          fieldProps: {
            dropdownMatchSelectWidth: 120,
          },
wuhao's avatar
wuhao committed
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseName',
          hideInForm: true,
        },
wuhao's avatar
wuhao committed
386 387 388 389 390 391 392
        {
          title: '入库仓库',
          dataIndex: 'nosubmits',
          initialValue: '备件仓库',
          valueType: 'nosubmit',
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '备注',
          dataIndex: 'remark',
          key: 'remark',
          valueType: 'textarea',
          hideInSearch: true,
        },
        {
          title: '创建人',
          dataIndex: 'createUserName',
          key: 'createUserId',
          hideInForm: true,
          valueType: 'select',
          fieldProps: {
            showSearch: true,
          },
          options: {
            path: '/auth/sysUser/selection',
            params: {},
          },
        },
        {
          title: '创建时间',
TZW's avatar
TZW committed
441
          dataIndex: 'createTime',
wuhao's avatar
wuhao committed
442 443
          key: 'createTimeList',
          hideInForm: true,
TZW's avatar
TZW committed
444
          valueType: 'dateTimeRange',
TZW's avatar
TZW committed
445 446 447 448 449 450
          fieldProps: {
            showTime: {
              format: 'HH:mm',
            },
            format: 'YYYY-MM-DD HH:mm',
          },
wuhao's avatar
wuhao committed
451
          render: (text, row) => {
TZW's avatar
TZW committed
452
            return <span>{row?.createTime}</span>;
wuhao's avatar
wuhao committed
453 454 455 456 457 458
          },
        },
        {
          title: '完成时间',
          dataIndex: 'completeTime',
          key: 'completeTimeList',
TZW's avatar
TZW committed
459 460 461 462 463 464
          fieldProps: {
            showTime: {
              format: 'HH:mm',
            },
            format: 'YYYY-MM-DD HH:mm',
          },
wuhao's avatar
wuhao committed
465 466 467 468 469 470
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
            return <span>{row?.completeTime}</span>;
          },
        },
TZW's avatar
TZW committed
471
        {
TZW's avatar
TZW committed
472
          title: '工单状态',
TZW's avatar
TZW committed
473
          dataIndex: 'statusName',
TZW's avatar
TZW committed
474 475 476
          key: 'statusName',
          hideInSearch: true,
          hideInTable: true,
TZW's avatar
TZW committed
477
          hideInForm: true,
TZW's avatar
TZW committed
478
          span: 2,
TZW's avatar
TZW committed
479
        },
wuhao's avatar
wuhao committed
480
        {
TZW's avatar
TZW committed
481 482 483 484 485
          title: (
            <div>
              <span style={{ color: 'red' }}>* </span>备件信
            </div>
          ),
wuhao's avatar
wuhao committed
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
        },
        {
          dataIndex: 'detailsList',
          key: 'detailsList',
          valueType: 'formList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/sparePart/queryList',
          hideInSearch: true,
          hideInTable: true,
          render: (text, row) => {
            return (
              <AutoTable
                columns={columns?.map((it) => ({
                  ...it,
                  hideInSearch: true,
                }))}
                dataSource={row?.detailsList}
              />
            );
          },
        },
        {
          dataIndex: 'splias',
          valueType: 'split',
TZW's avatar
TZW committed
517
          title: '入库/关单信息',
wuhao's avatar
wuhao committed
518 519
          key: 'splisa',
          hideInForm: true,
TZW's avatar
TZW committed
520
          render: (_, row) => {
TZW's avatar
TZW committed
521
            return row?.status == 2 ? '入库信息' : '关单信息';
TZW's avatar
TZW committed
522
          },
wuhao's avatar
wuhao committed
523
        },
TZW's avatar
TZW committed
524

TZW's avatar
TZW committed
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
        {
          title: '操作人',
          dataIndex: 'operateUserName',
          key: 'operateUserName',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '操作时间',
          dataIndex: 'operateTime',
          key: 'operateTime',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
wuhao's avatar
wuhao committed
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: false,
        enabledelete: false,
        enabledetail: true,
        add: '/sparepart/inWarehouseTask/save',
        edit: '/sparepart/inWarehouseTask/save',
        list: '/sparepart/inWarehouseTask/queryYesComplete',
        delete: '',
        detail: '/sparepart/inWarehouseTask/queryDetails',
      },
    },
  ];
wuhao's avatar
wuhao committed
555
}
wuhao's avatar
wuhao committed
556
export default getcolumns;