index.jsx 24.4 KB
Newer Older
TZW's avatar
TZW committed
1 2 3 4
/* 保养工单
 * @Author: Li Hanlin
 * @Date: 2023-01-19 09:53:59
 * @Last Modified by: Li Hanlin
TZW's avatar
TZW committed
5
 * @Last Modified time: 2023-02-27 17:21:42
TZW's avatar
TZW committed
6 7
 */

TZW's avatar
TZW committed
8
import * as React from 'react';
TZW's avatar
TZW committed
9 10 11 12 13 14 15 16
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
import AutoTables from '@/components/AutoTable/mtable';
TZW's avatar
TZW committed
17
import { Radio, InputNumber, Input, Divider, message } from 'antd';
TZW's avatar
TZW committed
18 19
import InitForm from '@/components/InitForm';
import getDetailColumns from './detailColumns';
TZW's avatar
TZW committed
20
import { useModel } from '@umijs/max';
TZW's avatar
TZW committed
21
import DetailNode from '@/components/DetailNode';
TZW's avatar
TZW committed
22

TZW's avatar
TZW committed
23
function WorkOrder(props) {
TZW's avatar
TZW committed
24 25
  const { initialState, setInitialState } = useModel('@@initialState');

TZW's avatar
TZW committed
26
  let actionRef = useRef(),
TZW's avatar
TZW committed
27 28
    formRef = useRef();
  const [drawer, setdrawer] = useState({
TZW's avatar
TZW committed
29
      open: false,
TZW's avatar
TZW committed
30 31
    }),
    [activeTabKey, setactiveTabKey] = useState('1');
TZW's avatar
TZW committed
32

TZW's avatar
TZW committed
33 34 35 36
  const { run, loading, runAsync } = useRequest(doFetch, {
    manual: true,
    onSuccess: (res, params) => {
      if (res?.code == '0000') {
TZW's avatar
TZW committed
37
        message.success('操作成功!');
TZW's avatar
TZW committed
38 39 40 41 42 43 44 45
        actionRef?.current?.reload();
        setdrawer((s) => ({
          ...s,
          open: false,
        }));
      }
    },
  });
TZW's avatar
TZW committed
46

TZW's avatar
TZW committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
  const detail = (text, row, _, action) => {
    return (
      <PremButton
        btn={{
          size: 'small',
          type: 'link',
          onClick: () => {
            setdrawer((s) => ({
              ...s,
              open: true,
              item: row,
              title: '详情',
              val: 'detail',
              title: '详细信息',
            }));
          },
        }}
      >
        详情
      </PremButton>
    );
  };
TZW's avatar
TZW committed
69

TZW's avatar
TZW committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  const detailaddonColumns = useMemo(() => {
    if (activeTabKey == 1) {
      if (drawer?.type == 'yz') {
        const columnsc = [
          {
            title: '保养项目',
            dataIndex: 'maintainItemName',
            key: 'maintainItemName',
            hideInForm: true,
          },
          {
            title: '部位',
            dataIndex: 'maintainPosition',
            key: 'maintainPosition',
            hideInForm: true,
          },
          {
            title: '保养方法',
            dataIndex: 'maintainMethod',
            key: 'maintainMethod',
            hideInForm: true,
          },
          {
            title: '结果',
TZW's avatar
TZW committed
94 95
            dataIndex: 'qualitativeJudgeResult',
            key: 'qualitativeJudgeResult',
TZW's avatar
TZW committed
96
            hideInForm: true,
TZW's avatar
TZW committed
97 98 99 100 101 102 103
            render: (_, row) => {
              if (row?.judgeType == 1) {
                return row?.judgeResultName;
              } else {
                return row?.qualitativeJudgeResult;
              }
            },
TZW's avatar
TZW committed
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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
          },
          {
            title: '下限值',
            dataIndex: 'lowerLimit',
            key: 'lowerLimit',
            hideInForm: true,
          },
          {
            title: '上限值',
            dataIndex: 'upperLimit',
            key: 'upperLimit',
            hideInForm: true,
          },
          {
            title: '备注',
            dataIndex: 'remark',
            key: 'remark',
            hideInForm: true,
          },
        ];
        return [
          {
            title: '工单信息',
            valueType: 'split',
          },
          {
            title: '保养单号',
            dataIndex: 'taskNo',
            key: 'taskNo',
          },
          {
            title: '设备编号',
            dataIndex: 'equipmentNo',
            key: 'equipmentNo',
          },
          {
            title: '设备名称',
            dataIndex: 'equipmentName',
            key: 'equipmentName',
          },
          {
            title: '保养类型',
            dataIndex: 'maintainTypeName',
            key: 'maintainTypeName',
          },

          {
            title: '保养频次',
            dataIndex: 'maintainFrequencyName',
            key: 'maintainFrequency',
          },
          {
            title: '保养截止日期',
            dataIndex: 'planMaintainDate',
            key: 'planMaintainDate',
          },
          {
            title: '接单时间',
            dataIndex: 'maintainStartTime',
            key: 'maintainStartTime',
          },
          {
            title: '完成保养时间',
            dataIndex: 'maintainEndTime',
            key: 'maintainEndTime',
          },
          {
            title: '保养项目',
            valueType: 'split',
          },
          {
            dataIndex: 'itemList',
            key: 'itemList',
            valueType: 'formList',
            columns,
            span: 3,
            render: (text, row, _, action) => {
              return (
                <AutoTables
                  columns={columnsc?.map((it) => ({
                    ...it,
                    hideInSearch: true,
                  }))}
                  dataSource={drawer?.item?.maintainTaskItemList}
                />
              );
TZW's avatar
TZW committed
190
            },
TZW's avatar
TZW committed
191 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 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
          },
        ];
      } else if (drawer?.type == 'wcby') {
        const columnsc = [
          {
            title: '保养项目',
            dataIndex: 'maintainItemName',
            key: 'maintainItemName',
            hideInForm: true,
          },
          {
            title: '部位',
            dataIndex: 'maintainPosition',
            key: 'maintainPosition',
            hideInForm: true,
          },
          {
            title: '保养方法',
            dataIndex: 'maintainMethod',
            key: 'maintainMethod',
            hideInForm: true,
          },
          {
            title: '结果',
            dataIndex: 'result',
            key: 'result',
            hideInForm: true,
            render: (text, row, _, action) => {
              return row.judgeType == 1 ? (
                <Radio.Group
                  onChange={(e) => {
                    row.result = e.target.value;
                  }}
                >
                  <Radio value={1}>正常</Radio>
                  <Radio value={2}>异常</Radio>
                </Radio.Group>
              ) : (
                <InputNumber
                  onChange={(value) => {
                    row.result = value;
                  }}
                />
              );
            },
          },
          {
            title: '下限值',
            dataIndex: 'lowerLimit',
            key: 'lowerLimit',
            hideInForm: true,
          },
          {
            title: '上限值',
            dataIndex: 'upperLimit',
            key: 'upperLimit',
            hideInForm: true,
          },
          {
            title: '备注',
            dataIndex: 'remark',
            key: 'remark',
            hideInForm: true,
            render: (text, row, _, action) => {
              return (
                <Input
                  onChange={(e) => {
                    row.remark = e.target.value;
                  }}
                />
              );
            },
          },
        ];
        return [
          {
            title: '工单信息',
            valueType: 'split',
          },
          {
            title: '保养单号',
            dataIndex: 'taskNo',
            key: 'taskNo',
          },
          {
            title: '创建时间',
TZW's avatar
TZW committed
277 278
            dataIndex: 'createTime',
            key: 'createTime',
TZW's avatar
TZW committed
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 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
          },
          {
            title: '工单状态',
            dataIndex: 'taskStatusName',
            key: 'taskStatusName',
          },
          {
            title: '保养计划单号',
            dataIndex: 'maintainNo',
            key: 'maintainNo',
          },
          {
            title: '设备编号',
            dataIndex: 'equipmentNo',
            key: 'equipmentNo',
          },
          {
            title: '设备名称',
            dataIndex: 'equipmentName',
            key: 'equipmentName',
          },
          {
            title: '设备型号',
            dataIndex: 'equipmentModelName',
            key: 'equipmentModelName',
          },
          {
            title: '保养类型',
            dataIndex: 'maintainTypeName',
            key: 'maintainTypeName',
          },
          {
            title: '保养频次',
            dataIndex: 'maintainFrequencyName',
            key: 'maintainFrequency',
          },
          {
            title: '保养截止日期',
            dataIndex: 'planMaintainDate',
            key: 'planMaintainDate',
          },
          {
            title: '接单时间',
            dataIndex: 'maintainStartTime',
            key: 'maintainStartTime',
            span: 2,
          },
          {
            title: '保养项目',
            valueType: 'split',
          },
          {
            dataIndex: 'itemList',
            key: 'itemList',
            valueType: 'formList',
            columns,
            span: 3,
            render: (text, row, _, action) => {
              return (
                <AutoTables
                  columns={columnsc?.map((it) => ({
                    ...it,
                    hideInSearch: true,
                  }))}
                  dataSource={drawer?.item?.maintainTaskItemList}
                />
              );
            },
          },
        ];
      }
    }
  }, [drawer?.item, activeTabKey]);
TZW's avatar
TZW committed
352

TZW's avatar
TZW committed
353 354 355
  const order = (text, row, _, action) => {
    return (
      <PremButton
TZW's avatar
TZW committed
356
        access="umMaintainTask_orderReceiving"
TZW's avatar
TZW committed
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
        pop={{
          title: '是否接单?',
          okText: '确认',
          cancelText: '取消',
          onConfirm: async () => {
            await runAsync({
              url: '/maintain/umMaintainTask/orderReceiving',
              params: { id: row?.id },
            });
          },
        }}
        btn={{
          size: 'small',
        }}
      >
        接单
      </PremButton>
    );
  };
  const close = (text, row, _, action) => {
    return (
      <PremButton
TZW's avatar
TZW committed
379
        access="umMaintainTask_customsDeclaration"
TZW's avatar
TZW committed
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
        pop={{
          title: '是否关单?',
          okText: '确认',
          cancelText: '取消',
          onConfirm: async () => {
            await runAsync({
              url: '/maintain/umMaintainTask/customsDeclaration',
              params: { id: row?.id },
            });
          },
        }}
        btn={{
          size: 'small',
          type: 'danger',
        }}
      >
        关单
      </PremButton>
    );
  };
  const finish = (text, row, _, action) => {
    return (
      <PremButton
TZW's avatar
TZW committed
403
        access="umMaintainTask_finishMaintainTask"
TZW's avatar
TZW committed
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
        btn={{
          size: 'small',
          onClick: () => {
            doFetch({
              url: '/maintain/umMaintainTask/queryById',
              params: { id: row.id },
            }).then((res) => {
              if (res.code == '0000') {
                setdrawer((s) => ({
                  ...s,
                  open: true,
                  item: {
                    ...res.data?.data,
                    id: row.id,
                  },
                  title: '完成保养',
                  val: 'detailaddon',
                  type: 'wcby',
                }));
              }
            });
          },
        }}
      >
        完成保养
      </PremButton>
    );
  };
TZW's avatar
TZW committed
432

TZW's avatar
TZW committed
433
  const remove = (text, row, _, action) => {
TZW's avatar
TZW committed
434
    return (
TZW's avatar
TZW committed
435
      <PremButton
TZW's avatar
TZW committed
436
        access="umMaintainTask_deleteById"
TZW's avatar
TZW committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
        pop={{
          title: '是否删除?',
          okText: '确认',
          cancelText: '取消',
          onConfirm: () => {
            run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
          },
        }}
        btn={{
          size: 'small',
          type: 'danger',
        }}
      >
        删除
      </PremButton>
    );
  };

  const verify = (text, row, _, action) => {
    return (
      <PremButton
TZW's avatar
TZW committed
458
        access="umMaintainTask_verification"
TZW's avatar
TZW committed
459 460 461 462 463 464 465 466
        btn={{
          size: 'small',
          onClick: () => {
            doFetch({
              url: '/maintain/umMaintainTask/queryById',
              params: { id: row.id },
            }).then((res) => {
              if (res.code == '0000') {
TZW's avatar
TZW committed
467 468 469
                setdrawer((s) => ({
                  ...s,
                  open: true,
TZW's avatar
TZW committed
470 471 472 473 474 475 476
                  item: {
                    ...res.data?.data,
                    id: row.id,
                  },
                  title: '验证',
                  val: 'detailaddon',
                  type: 'yz',
TZW's avatar
TZW committed
477
                }));
TZW's avatar
TZW committed
478 479 480 481 482 483 484 485 486
              }
            });
          },
        }}
      >
        验证
      </PremButton>
    );
  };
TZW's avatar
TZW committed
487

TZW's avatar
TZW committed
488 489 490 491 492 493 494 495
  const columns = useMemo(() => {
    let defcolumn = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.columns;
    let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
    return activeTabKey == 1
      ? defcolumn.concat({
          title: '操作',
          valueType: 'option',
          width: 150,
TZW's avatar
TZW committed
496 497 498 499 500 501 502 503 504 505 506
          render: (text, row, _, action) => {
            if (row?.taskStatus == 1) {
              return [order(text, row, _, action), close(text, row, _, action)];
            } else if (row?.taskStatus == 2) {
              return [finish(text, row, _, action)];
            } else if (row?.taskStatus == 5) {
              return [verify(text, row, _, action)];
            } else {
              return '无操作';
            }
          },
TZW's avatar
TZW committed
507 508 509 510 511 512 513 514 515 516 517 518
        })
      : defcolumn;
  }, [activeTabKey]);

  const pathconfig = useMemo(() => {
    let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
    return defpath;
  }, [activeTabKey]);

  const seletType = {
    wcby: (
      <div>
TZW's avatar
TZW committed
519 520 521
        <InitForm
          fields={[
            {
TZW's avatar
TZW committed
522 523 524 525 526
              title: (
                <span style={{ fontSize: 14, fontWeight: 600, color: '#262626' }}>
                  非寿命件消耗
                </span>
              ),
TZW's avatar
TZW committed
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 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
              valueType: 'split',
            },
            {
              dataIndex: 'lineStockUseList',
              key: 'lineStockUseList',
              valueType: 'formSelectList',
              colProps: {
                span: 24,
              },
              span: 3,
              columns: [
                {
                  title: '线边库',
                  dataIndex: 'stockName',
                  key: 'stockName',
                  editable: false,
                },
                {
                  title: '备件料号',
                  dataIndex: 'sparePartNo',
                  key: 'sparePartNo',
                  span: 3,
                  editable: false,
                },
                {
                  title: '备件名称',
                  dataIndex: 'sparePartName',
                  key: 'sparePartName',
                  span: 3,
                  editable: false,
                },
                {
                  title: '供应商编号',
                  dataIndex: 'supplierNo',
                  key: 'supplierNo',
                  span: 3,
                  editable: false,
                },
                {
                  title: '供应商名称',
                  dataIndex: 'supplierName',
                  key: 'supplierName',
                  span: 3,
                  editable: false,
                },
                {
                  title: '可用数量',
                  dataIndex: 'usedStock',
                  key: 'usedStock',
                  search: false,
                  span: 3,
                  editable: false,
                },
                {
                  title: (
                    <div>
TZW's avatar
TZW committed
583
                      消耗数量 <span style={{ color: 'red' }}>* </span>
TZW's avatar
TZW committed
584 585 586 587 588 589 590 591 592 593 594 595 596 597
                    </div>
                  ),
                  search: false,
                  dataIndex: 'operateNum',
                  valueType: 'digit',
                  fieldProps: {
                    precision: 3,
                  },
                  key: 'operateNum',
                },
              ],
              hideInSearch: true,
              hideInTable: true,
              path: '/sparepart/lineStock/queryConsumeStock',
TZW's avatar
TZW committed
598
              rowName: 'lineStockUseList',
TZW's avatar
TZW committed
599 600 601 602 603 604 605 606
              rowSelection: {
                type: 'checkbox',
                getCheckboxProps: (record) => ({
                  disabled: record.isAsh == '1',
                }),
              },
            },
            {
TZW's avatar
TZW committed
607 608 609
              title: (
                <span style={{ fontSize: 14, fontWeight: 600, color: '#262626' }}>寿命件更换</span>
              ),
TZW's avatar
TZW committed
610 611 612
              valueType: 'split',
            },
            {
TZW's avatar
TZW committed
613 614
              dataIndex: 'lifePieceStockUseList',
              key: 'lifePieceStockUseList',
TZW's avatar
TZW committed
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655
              valueType: 'Expandable',
              colProps: {
                span: 24,
              },
              columns: [
                {
                  title: '备件料号',
                  dataIndex: 'sparePartNo',
                  key: 'sparePartNo',
                },
                {
                  title: '备件名称',
                  dataIndex: 'sparePartName',
                  key: 'sparePartName',
                },
                {
                  title: '供应商编号',
                  dataIndex: 'supplierNo',
                  key: 'supplierNo',
                  search: false,
                },
                {
                  title: '供应商名称',
                  dataIndex: 'supplierName',
                  search: false,
                  key: 'supplierName',
                },
                {
                  title: '安装部位',
                  dataIndex: 'installPosition',
                  key: 'installPosition',
                },
                {
                  title: '安装数量',
                  dataIndex: 'installNum',
                  search: false,
                  key: 'installNum',
                },
                {
                  title: '下次更换日期',
                  dataIndex: 'nextReplaceDate',
TZW's avatar
TZW committed
656
                  key: 'nextReplaceDateList',
TZW's avatar
TZW committed
657 658 659 660 661
                  valueType: 'dateRange',
                },
              ],
              path: '/sparepart/lifePieceAccount/queryPageByEquipment',
              extraparams: { equipmentId: drawer?.item?.equipmentId },
TZW's avatar
TZW committed
662
              expandablePath: '/sparepart/lineStock/queryReplaceStockAll',
TZW's avatar
TZW committed
663
            },
TZW's avatar
TZW committed
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
          ]}
          onFinish={(vals) => {
            console.log(vals);
            let maintainTaskItemList = drawer?.item?.maintainTaskItemList?.map((it) => {
              if (it.judgeType == 1) {
                return {
                  id: it.id,
                  remark: it.remark,
                  judgeResultType: it.result,
                };
              } else {
                return {
                  id: it.id,
                  remark: it.remark,
                  qualitativeJudgeResult: it.result,
                };
              }
            });
TZW's avatar
TZW committed
682 683 684 685 686
            let lineStockUseList =
              vals?.lineStockUseList?.map((it) => ({
                lineStockId: it?.id,
                operateNum: it?.operateNum,
              })) ?? [];
TZW's avatar
TZW committed
687
            let lifePieceStockUseList = vals?.lifePieceStockUseList ?? [];
TZW's avatar
TZW committed
688 689
            run({
              url: '/maintain/umMaintainTask/finishMaintainTask',
TZW's avatar
TZW committed
690 691 692 693
              params: {
                id: drawer?.item?.id,
                maintainTaskItemList,
                lineStockUseList,
TZW's avatar
TZW committed
694
                lifePieceStockUseList,
TZW's avatar
TZW committed
695
              },
TZW's avatar
TZW committed
696
            });
TZW's avatar
TZW committed
697
          }}
TZW's avatar
TZW committed
698
        />
TZW's avatar
TZW committed
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
      </div>
    ),
    yz: (
      <div>
        <Divider />
        <InitForm
          fields={[
            {
              title: '验证结果',
              valueType: 'select',
              dataIndex: 'approveStatus',
              key: 'approveStatus',
              formItemProps: {
                rules: [
                  {
                    required: true,
                    message: '此项为必填项',
                  },
                ],
              },
              options: [
                {
                  value: '1',
                  label: '通过',
                },
                {
                  value: '2',
                  label: '不通过',
                },
              ],
            },
            {
              title: '备注',
              valueType: 'textarea',
              dataIndex: 'approveContent',
              key: 'approveContent',
            },
          ]}
TZW's avatar
TZW committed
737
          onFinish={(vals) => {
TZW's avatar
TZW committed
738 739 740 741
            run({
              url: '/maintain/umMaintainTask/verification',
              params: { ...vals, id: drawer?.item?.id },
            });
TZW's avatar
TZW committed
742 743 744
          }}
        />
      </div>
TZW's avatar
TZW committed
745 746 747 748 749 750 751 752
    ),
  };

  const DetailLine = () => {
    return (
      <>
        <DetailNode
          path="/maintain/umMaintainTaskOperation/queryDetailList"
TZW's avatar
TZW committed
753 754 755 756 757
          params={
            activeTabKey == 3
              ? { maintainTaskId: drawer?.item?.equipmentMaintainTaskId }
              : { maintainTaskId: drawer?.item?.id }
          }
TZW's avatar
TZW committed
758 759 760 761 762 763 764 765 766 767
          titleColumns={
            activeTabKey == 3
              ? [
                  {
                    title: '保养单号',
                    dataIndex: 'taskNo',
                    key: 'taskNo',
                  },
                  {
                    title: '创建时间',
TZW's avatar
TZW committed
768 769
                    dataIndex: 'createTime',
                    key: 'createTime',
TZW's avatar
TZW committed
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
                  },
                  {
                    title: '工单状态',
                    dataIndex: 'taskStatusName',
                    key: 'taskStatusName',
                  },
                  {
                    title: '保养计划单号',
                    dataIndex: 'maintainNo',
                    key: 'maintainNo',
                  },
                  {
                    title: '关单时间',
                    dataIndex: 'customsTime',
                    key: 'customsTime',
                  },
                ]
              : [
                  {
                    title: '保养单号',
                    dataIndex: 'taskNo',
                    key: 'taskNo',
                  },
                  {
                    title: '创建时间',
TZW's avatar
TZW committed
795 796
                    dataIndex: 'createTime',
                    key: 'createTime',
TZW's avatar
TZW committed
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
                  },
                  {
                    title: '工单状态',
                    dataIndex: 'taskStatusName',
                    key: 'taskStatusName',
                  },
                  {
                    title: '保养计划单号',
                    dataIndex: 'maintainNo',
                    key: 'maintainNo',
                  },
                ]
          }
          detailKey="maintainTaskItemList"
          columns={getDetailColumns}
        />
      </>
TZW's avatar
TZW committed
814
    );
TZW's avatar
TZW committed
815 816 817 818 819 820 821 822
  };

  return (
    <div style={{ position: 'relative' }}>
      <AutoTable
        pagetitle={<h3 className="page-title">保养工单</h3>}
        columns={columns}
        path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
TZW's avatar
TZW committed
823
        extraparams={activeTabKey == 1 ? { mainUserId: initialState?.currentUser?.id } : null}
TZW's avatar
TZW committed
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
        actionRef={actionRef}
        pageextra={pathconfig?.enableadd ? 'add' : null}
        resizeable={false}
        addconfig={{
          // access: 'sysDepartment_save',
          btn: {
            disabled: false,
            onClick: () => {
              setdrawer((s) => ({
                ...s,
                open: true,
                item: null,
                title: '新增',
                val: 'add',
              }));
            },
          },
        }}
        tabList={getcolumns()}
        activeTabKey={activeTabKey}
        onTabChange={(key) => {
          setactiveTabKey(key);
        }}
      />

      <DrawerPro
        fields={detailaddonColumns}
        detailpath={pathconfig?.detail || null}
        detailData={drawer?.item}
        defaultFormValue={drawer?.item}
        params={{ id: drawer?.item?.id }}
        formRef={formRef}
        placement="right"
        onClose={() => {
          setdrawer((s) => ({
            ...s,
            open: false,
          }));
        }}
        {...drawer}
        onFinish={(vals) => {
          if (drawer?.val == 'add') {
            run({ url: pathconfig?.add || '/add', params: { ...vals } });
          } else if (drawer?.val == 'edit') {
            run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
          }
        }}
      >
        {drawer?.val == 'only' ? (
          <DetailLine />
        ) : drawer?.val == 'detailaddon' ? (
          seletType[drawer?.type]
        ) : null}
      </DrawerPro>
    </div>
  );
}
TZW's avatar
TZW committed
881

TZW's avatar
TZW committed
882
export default WorkOrder;