DesItem.jsx 3.61 KB
Newer Older
TZW's avatar
TZW committed
1 2 3 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 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 98 99 100 101 102 103 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
import React, { useState, useEffect } from 'react';
import { ProDescriptions } from '@ant-design/pro-components';
import { Divider, Image } from 'antd';

export default ({ index, title, dataSource, columns, hidden }) => {
  const [flag, setflag] = useState(true);
  // 0:报修 1:接单 2:派单 3:完成维修  4:转追踪 5:转外协 6:转单 7:退单 8:追踪审核 9:外协审核 10:退单审核 11:效果验证
  const columns_mes = {
    sbxx: [
      {
        title: '设备编号',
        dataIndex: 'equipmentNo',
        key: 'equipmentNo',
      },
      {
        title: '设备名称',
        dataIndex: 'equipmentName',
        key: 'equipmentName',
      },
      {
        title: '设备型号',
        dataIndex: 'equipmentName',
        key: 'equipmentName',
      },
      {
        title: '公司名称',
        dataIndex: 'organizationName',
        key: 'organizationId',
      },
      {
        title: '部门名称',
        dataIndex: 'departmentName',
        key: 'departmentId',
      },
      {
        title: '工厂名称',
        dataIndex: 'factoryName',
        key: 'factoryId',
      },
      {
        title: '车间名称',
        dataIndex: 'shopName',
        key: 'shopId',
      },
      {
        title: '工段名称',
        dataIndex: 'sectionName',
        key: 'sectionId',
      },
      {
        title: '产线名称',
        dataIndex: 'productLineName',
        key: 'productLineName',
      },
    ],
    gzxx: [
      {
        title: '报修人员',
        dataIndex: 'repairUserName',
        key: 'repairUserName',
      },
      {
        title: '报修时间',
        dataIndex: 'repairTime',
        key: 'repairTime',
      },
      {
        title: '是否停机',
        dataIndex: 'isShutdown',
        key: 'isShutdown',
        render: (text, row, _, action) => {
          return row?.isShutdown == '1' ? '是' : '否';
        },
      },
      {
        title: '故障类型',
        dataIndex: 'faultType',
        key: 'faultType',
      },
      {
        title: '故障名称',
        dataIndex: 'faultDetailName',
        key: 'faultDetailName',
      },
      {
        title: '故障描述',
        dataIndex: 'faultDescription',
        key: 'faultDescription',
      },
      {
        title: '故障图片',
        dataIndex: 'pictureUrl',
        key: 'pictureUrl',
        render: (text, row, _, action) => {
          if (row?.pictureUrl) {
            return <Image width={70} src={row.pictureUrl} />;
          } else {
            return '暂无';
          }
        },
      },
    ],
  };
  useEffect(() => {
    setflag(hidden);
  }, []);
  console.log('datasource', dataSource);
  return (
    <>
      {flag ? (
        <div>
          {index == 0 ? (
            <div>
              <div>
                <h2 className="page-title">{title}</h2>
              </div>
              <Divider orientation="left">设备信息</Divider>
              <ProDescriptions dataSource={dataSource?.equipment} columns={columns_mes['sbxx']} />
              <Divider orientation="left">故障信息</Divider>
              <ProDescriptions dataSource={dataSource} columns={columns_mes['gzxx']} />
            </div>
          ) : (
            <div>
              <div style={{ borderLeft: '1px solid #ccc' }}>
                <span
                  style={{ border: '1px solid #ccc', backgroundColor: 'white', borderRidus: '30%' }}
                >
                  {index}
                </span>
              </div>
              <ProDescriptions dataSource={dataSource} columns={columns} />
            </div>
          )}
        </div>
      ) : null}
    </>
  );
};