Prechádzať zdrojové kódy

添加设备保养维修详情页面

Renxy 1 rok pred
rodič
commit
af14209d22

+ 6 - 0
.umirc.ts

@@ -300,6 +300,12 @@ export default defineConfig({
       name: '',
       component: './DeviceManager/EquipmentConstructionList',
     },
+    //设备维修保养详情
+    {
+      path: '/device/maintain-detail/:projectId',
+      name: '',
+      component: './DeviceManager/deviceMaintainDetail',
+    },
   ],
   npmClient: 'yarn',
 });

+ 122 - 0
src/pages/DeviceManager/deviceMaintainDetail.js

@@ -0,0 +1,122 @@
+import PageContent from '@/components/PageContent';
+import { useParams } from '@umijs/max';
+import { Table } from 'antd';
+export default function DeviceMaintainDetail() {
+  const { projectId, type } = useParams();
+
+  const columns = [
+    {
+      title: type == 1 ? '维修资料' : '保养资料',
+      dataIndex: 'Name',
+      render: (text, item) => {
+        return <PreviewFile name={item.Name} src={item.Url} />;
+      },
+    },
+    {
+      title: '创建时间',
+      dataIndex: 'CreatedTime',
+      render: (text) => {
+        return text ? moment(text).format('YYYY年MM月DD日  HH:mm:ss') : null;
+      },
+    },
+    {
+      title: '操作',
+      width: '20%',
+      render: (record) => (
+        <Fragment>
+          {this.showJurisdiction('func-01-ops-1-2-3-01') && (
+            <>
+              &nbsp;&nbsp;
+              <a
+                style={{ color: '#7BFFFB' }}
+                onClick={() => this.checkFile(record)}
+                download
+              >
+                下载
+              </a>
+            </>
+          )}
+        </Fragment>
+      ),
+    },
+  ];
+
+  function getUser(params) {
+    let arr = [];
+    if (!params) {
+      return;
+    } else {
+      return (arr = params
+        .map((item) => {
+          return item.Operator?.CName;
+        })
+        .join(','));
+    }
+  }
+  const getStatus = (time, acStatus) => {
+    if (time && acStatus == 0) return '不通过';
+    if (time && acStatus == 2) return '通过';
+    return '';
+  };
+  const {
+    DeviceCode,
+    DeviceName,
+    Reason,
+    PlanTime,
+    RepairType,
+    IsPlan,
+    DifficultyLevel,
+    AcceptanceStatus,
+    EvaluationScore,
+    Operators,
+    RepairTime,
+    Desc,
+    MaterialConsumption,
+    AcceptorUser,
+    AcceptanceTime,
+    Level,
+    AcceptanceOpinion,
+    Note,
+    Files = [],
+  } = {};
+  return (
+    <PageContent closeable={false}>
+      <div>
+        <span>设备位号:{DeviceCode}</span>
+        <span>维修人:{getUser(Operators)}</span>
+        <span>设备名称:{DeviceName}</span>
+        <span>维修日期:{RepairTime}</span>
+        <span>维修原因:{Reason}</span>
+        <span>维修内容简述:{Desc}</span>
+
+        <span>计划日期:{PlanTime}</span>
+        <span>物料消耗:{MaterialConsumption}</span>
+
+        <span>维修方式:{RepairType}</span>
+        <span>验收人:{AcceptorUser?.CName}</span>
+
+        <span>是否计划内:{String(IsPlan) == 0 ? '否' : '是'}</span>
+        <div>验收状态:{getStatus(AcceptanceTime, AcceptanceStatus)}</div>
+
+        <span>难度级别:{DifficultyLevel}</span>
+        <span>级别:{Level}</span>
+        <span>维修状态:{AcceptanceStatus}</span>
+        <span>验收意见:{AcceptanceOpinion}</span>
+
+        <span>评估分数:{EvaluationScore * 100}</span>
+        <span>
+          保养备注:
+          {Note?.split('|').map((item) => (
+            <div>{item}</div>
+          ))}
+        </span>
+      </div>
+      <Table
+        style={{ marginTop: '0.1rem' }}
+        dataSource={Files}
+        columns={columns}
+        pagination={false}
+      />
+    </PageContent>
+  );
+}

+ 3 - 7
src/pages/DeviceManager/index.js

@@ -242,13 +242,6 @@ const Device = ({ projectId }) => {
   return (
     <div className={`content-tab ${styles.sparePart}`}>
       <Spin spinning={loadingDevice}>
-        {/* <div className={styles.titleContent}>
-          <img className={styles.img} src={deviceIcon} />
-          <div>
-            <div className="value-number">{allData?.total}</div>
-            <div className={styles.text}>设备总数(个)</div>
-          </div>
-        </div> */}
         <div className={styles.top}>
           <div className={styles.left}>
             <img
@@ -298,6 +291,9 @@ const Device = ({ projectId }) => {
           dataSource={repairData?.filter((item) => item.DeviceCode)}
           columns={columnsRepair}
           pagination={false}
+          onRow={(record, index) => ({
+            onClick: () => console.log(record),
+          })}
         />
       )}
       {type == 2 && (