columns.js 14.9 KB
Newer Older
wuhao's avatar
wuhao committed
1 2
import AutoTable from '@/components/AutoTable/mtable';

TZW's avatar
TZW committed
3
function getcolumns(setdrawer, type, fullName) {
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 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
  const columns = [
    {
      title: '备件料号',
      dataIndex: 'sparePartNo',
      key: 'sparePartNo',
      editable: false,
    },
    {
      title: '备件名称',
      dataIndex: 'sparePartName',
      key: 'sparePartName',
      editable: false,
    },
    {
      title: '可用库存',
      dataIndex: 'usedStock',
      key: 'usedStock',
      editable: false,
      hideInSearch: true,
    },
    {
      title: '申请数量',
      dataIndex: 'operateNum',
      key: 'operateNum',
      hideInSearch: true,
      valueType: 'digit',
      fieldProps: {
        precision: 3,
      },
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
    },
    {
      title: '库存单位',
      dataIndex: 'unit',
      editable: false,
      hideInSearch: true,
    },
  ];
  return [
    {
      tab: '未完成',
      key: '1',
      columns: [
        {
          title: '领用单号',
          dataIndex: 'taskNo',
TZW's avatar
TZW committed
57 58 59
          fieldProps: {
            placeholder: '不填系统自动生成',
          },
wuhao's avatar
wuhao committed
60
          key: 'taskNo',
TZW's avatar
TZW committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
          render: (_, row) => {
            return (
              <a
                onClick={() => {
                  setdrawer((s) => ({
                    ...s,
                    open: true,
                    item: row,
                    title: '详情',
                    val: 'detail',
                    title: '详细信息',
                  }));
                }}
              >
                {row?.taskNo}
              </a>
            );
          },
wuhao's avatar
wuhao committed
79 80 81 82 83 84
        },
        {
          title: '申请原因',
          dataIndex: 'applyReasonName',
          key: 'applyReason',
          valueType: 'select',
wuhao's avatar
wuhao committed
85 86
          searchValueType: 'input',
          searchKey: 'applyReasonName',
TZW's avatar
TZW committed
87 88 89 90 91 92 93 94
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
          options: [
            {
              label: '备库领用',
              value: 1,
            },
            {
              label: '维修领用',
              value: 2,
            },
            {
              label: '保养领用',
              value: 3,
            },
            {
              label: '点检领用',
              value: 4,
            },
          ],
        },
wuhao's avatar
wuhao committed
114 115 116 117 118 119 120 121
        {
          title: '入库仓库(个人)',
          dataIndex: 'nosubmit',
          initialValue: fullName,
          valueType: 'nosubmit',
          hideInForm: type !== 1,
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
122 123 124 125 126
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseId',
          valueType: 'select',
wuhao's avatar
wuhao committed
127
          searchValueType: 'input',
TZW's avatar
TZW committed
128 129 130 131 132 133 134 135
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
136
          searchKey: 'inWarehouseName',
wuhao's avatar
wuhao committed
137 138 139 140 141 142
          options: {
            path: '/auth/sysShop/getUserShopSelection',
            params: {},
          },
          hideInForm: type == 1,
        },
wuhao's avatar
wuhao committed
143 144 145
        {
          title: '出库仓库',
          dataIndex: 'nosubmits',
TZW's avatar
TZW committed
146 147 148 149 150 151 152 153
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
154 155 156 157
          initialValue: '备件仓库',
          valueType: 'nosubmit',
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          hideInForm: true,
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '创建时间',
TZW's avatar
TZW committed
178
          dataIndex: 'createTime',
wuhao's avatar
wuhao committed
179 180 181 182
          key: 'createTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
TZW's avatar
TZW committed
183
            return <span>{row?.createTime}</span>;
wuhao's avatar
wuhao 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
          },
          hideInForm: true,
        },
        {
          title: '出库单号',
          dataIndex: 'outWarehouseTaskNo',
          key: 'outWarehouseTaskNo',
          hideInForm: true,
        },
        {
          dataIndex: 'remark',
          valueType: 'textarea',
          title: '备注',
          key: 'remark',
          colProps: {
            span: 24,
          },
          hideInTable: true,
          hideInSearch: true,
        },
        {
          title: '状态',
          dataIndex: 'statusName',
          key: 'status',
          hideInForm: true,
TZW's avatar
TZW committed
209 210 211
          fieldProps: {
            dropdownMatchSelectWidth: 120,
          },
wuhao's avatar
wuhao committed
212
          valueType: 'select',
wuhao's avatar
wuhao committed
213
          span: 3,
wuhao's avatar
wuhao committed
214 215 216 217 218 219 220 221 222 223 224 225
          options: [
            {
              label: '待审批',
              value: 1,
            },
            {
              label: '出库中',
              value: 2,
            },
          ],
        },
        {
TZW's avatar
TZW committed
226 227 228 229 230
          title: (
            <div>
              <span style={{ color: 'red' }}>* </span>备件信
            </div>
          ),
wuhao's avatar
wuhao committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
        },
        {
          dataIndex: 'detailsList',
          key: 'detailsList',
          valueType: 'formSelectList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/spareStock/queryByOperate',
          hideInSearch: true,
          hideInTable: true,
          rowName: 'sparePartName',
          render: (text, row) => {
            return (
              <AutoTable
wuhao's avatar
wuhao committed
251 252 253 254 255 256
                columns={columns
                  ?.filter((it) => it.key != 'usedStock')
                  .map((it) => ({
                    ...it,
                    hideInSearch: true,
                  }))}
wuhao's avatar
wuhao committed
257 258 259 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 309 310 311 312 313 314 315 316 317 318 319 320
                dataSource={row?.detailsList}
              />
            );
          },
        },
        {
          title: '审批信息',
          dataIndex: 'cdetails',
          key: 'cdetails',
          valueType: 'split',
          hideInForm: true,
        },
        {
          title: '审批人',
          dataIndex: 'approvalUserName',
          key: 'approvalUserName',
          hideInTable: true,
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '审批时间',
          dataIndex: 'approvalTime',
          key: 'approvalTime',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '审批结果',
          dataIndex: 'approvalResultName',
          key: 'approvalResultName',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '审批备注',
          dataIndex: 'approvalRemark',
          key: 'approvalRemark',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: true,
        enabledelete: true,
        enabledetail: true,
        add: '/sparepart/spareApplyTask/save',
        edit: '',
        list: '/sparepart/spareApplyTask/queryNoComplete',
        delete: '/sparepart/spareApplyTask/deleteById',
        detail: '/sparepart/spareApplyTask/queryDetails',
      },
    },
    {
      tab: '已完成',
      key: '2',
      columns: [
        {
          title: '领用单号',
          dataIndex: 'taskNo',
TZW's avatar
TZW committed
321 322 323
          fieldProps: {
            placeholder: '不填系统自动生成',
          },
wuhao's avatar
wuhao committed
324
          key: 'taskNo',
TZW's avatar
TZW committed
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
          render: (_, row) => {
            return (
              <a
                onClick={() => {
                  setdrawer((s) => ({
                    ...s,
                    open: true,
                    item: row,
                    title: '详情',
                    val: 'detail',
                    title: '详细信息',
                  }));
                }}
              >
                {row?.taskNo}
              </a>
            );
          },
wuhao's avatar
wuhao committed
343 344 345 346 347 348
        },
        {
          title: '申请原因',
          dataIndex: 'applyReasonName',
          key: 'applyReason',
          valueType: 'select',
wuhao's avatar
wuhao committed
349
          searchValueType: 'input',
TZW's avatar
TZW committed
350 351 352 353 354 355 356 357
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
358
          searchKey: 'applyReasonName',
wuhao's avatar
wuhao committed
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
          options: [
            {
              label: '备库领用',
              value: 1,
            },
            {
              label: '维修领用',
              value: 2,
            },
            {
              label: '保养领用',
              value: 3,
            },
            {
              label: '点检领用',
              value: 4,
            },
          ],
        },
wuhao's avatar
wuhao committed
378 379 380 381 382
        {
          title: '入库仓库(个人)',
          dataIndex: 'nosubmit',
          initialValue: fullName,
          valueType: 'nosubmit',
TZW's avatar
TZW committed
383 384 385 386 387 388 389 390
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
391 392 393
          hideInForm: type !== 1,
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
394 395 396 397 398
        {
          title: '入库仓库',
          dataIndex: 'inWarehouseName',
          key: 'inWarehouseId',
          valueType: 'select',
wuhao's avatar
wuhao committed
399
          searchValueType: 'input',
TZW's avatar
TZW committed
400 401 402 403 404 405 406 407
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
408
          searchKey: 'inWarehouseName',
wuhao's avatar
wuhao committed
409 410 411 412 413 414
          options: {
            path: '/auth/sysShop/getUserShopSelection',
            params: {},
          },
          hideInForm: type == 1,
        },
wuhao's avatar
wuhao committed
415 416 417 418
        {
          title: '出库仓库',
          dataIndex: 'nosubmits',
          initialValue: '备件仓库',
TZW's avatar
TZW committed
419 420 421 422 423 424 425 426
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
wuhao's avatar
wuhao committed
427 428 429
          valueType: 'nosubmit',
          hideInDescriptions: true,
        },
wuhao's avatar
wuhao committed
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
        {
          title: '出库仓库',
          dataIndex: 'outWarehouseName',
          key: 'outWarehouseName',
          hideInForm: true,
        },
        {
          title: '备件种类',
          dataIndex: 'spareTypeNum',
          key: 'spareTypeNum',
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '相关单号',
          dataIndex: 'relationNo',
          key: 'relationNo',
        },
        {
          title: '创建时间',
TZW's avatar
TZW committed
450
          dataIndex: 'createTime',
wuhao's avatar
wuhao committed
451 452 453 454
          key: 'createTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
TZW's avatar
TZW committed
455
            return <span>{row?.createTime}</span>;
wuhao's avatar
wuhao committed
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
          },
          hideInForm: true,
        },
        {
          title: '完成时间',
          dataIndex: 'completeTime',
          key: 'completeTimeList',
          hideInForm: true,
          valueType: 'dateRange',
          render: (text, row) => {
            return <span>{row?.completeTime}</span>;
          },
          hideInForm: true,
        },
        {
          title: '出库单号',
          dataIndex: 'outWarehouseTaskNo',
          key: 'outWarehouseTaskNo',
          hideInForm: true,
        },
        {
          dataIndex: 'remark',
          valueType: 'textarea',
          title: '备注',
          key: 'remark',
          colProps: {
            span: 24,
          },
          hideInTable: true,
          hideInSearch: true,
        },
        {
          title: '状态',
          dataIndex: 'statusName',
          key: 'status',
TZW's avatar
TZW committed
491 492 493
          fieldProps: {
            dropdownMatchSelectWidth: 120,
          },
wuhao's avatar
wuhao committed
494 495
          hideInForm: true,
          valueType: 'select',
wuhao's avatar
wuhao committed
496
          span: 3,
wuhao's avatar
wuhao committed
497 498 499 500 501 502
          options: [
            {
              label: '已驳回',
              value: 3,
            },
            {
TZW's avatar
TZW committed
503
              label: '出库失败',
wuhao's avatar
wuhao committed
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
              value: 4,
            },
            {
              label: '已完成',
              value: 5,
            },
          ],
        },
        {
          title: '备件信息',
          dataIndex: 'details',
          key: 'details',
          valueType: 'split',
          hideInForm: true,
        },
        {
TZW's avatar
TZW committed
520
          // title: '备件',
wuhao's avatar
wuhao committed
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
          dataIndex: 'detailsList',
          key: 'detailsList',
          valueType: 'formSelectList',
          colProps: {
            span: 24,
          },
          columns,
          span: 12,
          path: '/sparepart/spareStock/queryByOperate',
          hideInSearch: true,
          hideInTable: true,
          rowName: 'sparePartName',
          render: (text, row) => {
            return (
              <AutoTable
wuhao's avatar
wuhao committed
536 537 538 539 540 541
                columns={columns
                  ?.filter((it) => it.key != 'usedStock')
                  .map((it) => ({
                    ...it,
                    hideInSearch: true,
                  }))}
wuhao's avatar
wuhao committed
542 543 544 545 546 547 548 549 550 551 552
                dataSource={row?.detailsList}
              />
            );
          },
        },

        {
          title: '审批信息',
          dataIndex: 'cdetails',
          key: 'cdetails',
          valueType: 'split',
wuhao's avatar
wuhao committed
553
          hideInForm: true,
wuhao's avatar
wuhao committed
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602
        },
        {
          title: '审批人',
          dataIndex: 'approvalUserName',
          key: 'approvalUserName',
          hideInTable: true,
          hideInForm: true,
          hideInSearch: true,
        },
        {
          title: '审批时间',
          dataIndex: 'approvalTime',
          key: 'approvalTime',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '审批结果',
          dataIndex: 'approvalResultName',
          key: 'approvalResultName',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
        {
          title: '审批备注',
          dataIndex: 'approvalRemark',
          key: 'approvalRemark',
          hideInSearch: true,
          hideInTable: true,
          hideInForm: true,
        },
      ],
      pathconfig: {
        enableadd: true,
        enableedit: false,
        enabledelete: false,
        enabledetail: true,
        add: '/sparepart/spareApplyTask/save',
        edit: '',
        list: '/sparepart/spareApplyTask/queryYesComplete',
        delete: '',
        detail: '/sparepart/spareApplyTask/queryDetails',
      },
    },
  ];
}
export default getcolumns;